@dxc-technology/halstack-react 0.0.0-12908ef → 0.0.0-13df478

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 (279) hide show
  1. package/BackgroundColorContext.js +50 -0
  2. package/ThemeContext.js +246 -0
  3. package/{dist/select/Select.js → V3Select/V3Select.js} +38 -132
  4. package/V3Select/index.d.ts +27 -0
  5. package/{dist/V3Textarea → V3Textarea}/V3Textarea.js +10 -14
  6. package/V3Textarea/index.d.ts +27 -0
  7. package/accordion/Accordion.d.ts +4 -0
  8. package/{dist/accordion → accordion}/Accordion.js +35 -130
  9. package/accordion/types.d.ts +68 -0
  10. package/accordion/types.js +5 -0
  11. package/accordion-group/AccordionGroup.d.ts +7 -0
  12. package/accordion-group/AccordionGroup.js +170 -0
  13. package/accordion-group/types.d.ts +72 -0
  14. package/accordion-group/types.js +5 -0
  15. package/alert/Alert.d.ts +4 -0
  16. package/{dist/alert → alert}/Alert.js +38 -151
  17. package/alert/Alert.stories.tsx +170 -0
  18. package/alert/types.d.ts +49 -0
  19. package/alert/types.js +5 -0
  20. package/badge/Badge.js +59 -0
  21. package/box/Box.d.ts +4 -0
  22. package/{dist/box → box}/Box.js +13 -43
  23. package/box/Box.stories.tsx +132 -0
  24. package/box/types.d.ts +43 -0
  25. package/box/types.js +5 -0
  26. package/button/Button.d.ts +4 -0
  27. package/{dist/button → button}/Button.js +22 -81
  28. package/button/Button.stories.tsx +276 -0
  29. package/button/types.d.ts +57 -0
  30. package/button/types.js +5 -0
  31. package/card/Card.d.ts +4 -0
  32. package/{dist/card → card}/Card.js +33 -123
  33. package/card/Card.stories.tsx +201 -0
  34. package/card/ice-cream.jpg +0 -0
  35. package/card/types.d.ts +67 -0
  36. package/card/types.js +5 -0
  37. package/checkbox/Checkbox.d.ts +4 -0
  38. package/{dist/checkbox → checkbox}/Checkbox.js +16 -63
  39. package/checkbox/Checkbox.stories.tsx +192 -0
  40. package/checkbox/types.d.ts +60 -0
  41. package/checkbox/types.js +5 -0
  42. package/{dist/chip → chip}/Chip.js +17 -61
  43. package/chip/Chip.stories.tsx +121 -0
  44. package/chip/index.d.ts +22 -0
  45. package/{dist/common → common}/OpenSans.css +0 -0
  46. package/{dist/common → common}/RequiredComponent.js +3 -11
  47. package/{dist/common → common}/fonts/OpenSans-Bold.ttf +0 -0
  48. package/{dist/common → common}/fonts/OpenSans-BoldItalic.ttf +0 -0
  49. package/{dist/common → common}/fonts/OpenSans-ExtraBold.ttf +0 -0
  50. package/{dist/common → common}/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  51. package/{dist/common → common}/fonts/OpenSans-Italic.ttf +0 -0
  52. package/{dist/common → common}/fonts/OpenSans-Light.ttf +0 -0
  53. package/{dist/common → common}/fonts/OpenSans-LightItalic.ttf +0 -0
  54. package/{dist/common → common}/fonts/OpenSans-Regular.ttf +0 -0
  55. package/{dist/common → common}/fonts/OpenSans-SemiBold.ttf +0 -0
  56. package/{dist/common → common}/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  57. package/{dist/common → common}/utils.js +0 -0
  58. package/{dist/common → common}/variables.js +157 -151
  59. package/{dist/date → date}/Date.js +21 -27
  60. package/date/index.d.ts +27 -0
  61. package/date-input/DateInput.d.ts +4 -0
  62. package/{dist/date-input → date-input}/DateInput.js +22 -61
  63. package/date-input/DateInput.stories.tsx +138 -0
  64. package/date-input/types.d.ts +100 -0
  65. package/date-input/types.js +5 -0
  66. package/dialog/Dialog.d.ts +4 -0
  67. package/{dist/dialog → dialog}/Dialog.js +20 -73
  68. package/dialog/Dialog.stories.tsx +212 -0
  69. package/dialog/types.d.ts +43 -0
  70. package/dialog/types.js +5 -0
  71. package/dropdown/Dropdown.d.ts +4 -0
  72. package/{dist/dropdown → dropdown}/Dropdown.js +44 -171
  73. package/dropdown/types.d.ts +89 -0
  74. package/dropdown/types.js +5 -0
  75. package/file-input/FileInput.d.ts +4 -0
  76. package/{dist/file-input → file-input}/FileInput.js +56 -189
  77. package/file-input/FileItem.d.ts +14 -0
  78. package/file-input/FileItem.js +182 -0
  79. package/file-input/types.d.ts +87 -0
  80. package/file-input/types.js +5 -0
  81. package/footer/Footer.d.ts +4 -0
  82. package/{dist/footer → footer}/Footer.js +38 -193
  83. package/footer/Footer.stories.jsx +151 -0
  84. package/{dist/footer → footer}/Icons.js +13 -13
  85. package/footer/types.d.ts +61 -0
  86. package/footer/types.js +5 -0
  87. package/header/Header.d.ts +7 -0
  88. package/{dist/header → header}/Header.js +60 -206
  89. package/header/Header.stories.tsx +162 -0
  90. package/{dist/header → header}/Icons.js +7 -32
  91. package/header/types.d.ts +47 -0
  92. package/header/types.js +5 -0
  93. package/heading/Heading.d.ts +4 -0
  94. package/{dist/heading → heading}/Heading.js +24 -95
  95. package/heading/Heading.stories.tsx +53 -0
  96. package/heading/types.d.ts +33 -0
  97. package/heading/types.js +5 -0
  98. package/{dist/input-text → input-text}/Icons.js +2 -2
  99. package/{dist/input-text → input-text}/InputText.js +36 -130
  100. package/input-text/index.d.ts +36 -0
  101. package/{dist/layout → layout}/ApplicationLayout.js +31 -123
  102. package/{dist/layout → layout}/Icons.js +7 -7
  103. package/link/Link.d.ts +3 -0
  104. package/{dist/link → link}/Link.js +18 -94
  105. package/link/Link.stories.tsx +146 -0
  106. package/link/types.d.ts +74 -0
  107. package/link/types.js +5 -0
  108. package/main.d.ts +44 -0
  109. package/{dist/main.js → main.js} +93 -89
  110. package/number-input/NumberInput.d.ts +4 -0
  111. package/number-input/NumberInput.js +86 -0
  112. package/number-input/NumberInput.stories.tsx +115 -0
  113. package/number-input/NumberInputContext.d.ts +4 -0
  114. package/{dist/number-input → number-input}/NumberInputContext.js +5 -2
  115. package/number-input/numberInputContextTypes.d.ts +19 -0
  116. package/number-input/numberInputContextTypes.js +5 -0
  117. package/number-input/types.d.ts +117 -0
  118. package/number-input/types.js +5 -0
  119. package/package.json +28 -17
  120. package/{dist/paginator → paginator}/Icons.js +9 -9
  121. package/paginator/Paginator.d.ts +4 -0
  122. package/paginator/Paginator.js +198 -0
  123. package/paginator/Paginator.stories.tsx +63 -0
  124. package/paginator/types.d.ts +38 -0
  125. package/paginator/types.js +5 -0
  126. package/password-input/PasswordInput.d.ts +4 -0
  127. package/{dist/password-input → password-input}/PasswordInput.js +24 -60
  128. package/password-input/PasswordInput.stories.tsx +131 -0
  129. package/password-input/types.d.ts +105 -0
  130. package/password-input/types.js +5 -0
  131. package/progress-bar/ProgressBar.d.ts +4 -0
  132. package/{dist/progress-bar → progress-bar}/ProgressBar.js +20 -92
  133. package/progress-bar/ProgressBar.stories.jsx +58 -0
  134. package/progress-bar/types.d.ts +37 -0
  135. package/progress-bar/types.js +5 -0
  136. package/radio/Radio.d.ts +4 -0
  137. package/{dist/radio → radio}/Radio.js +15 -50
  138. package/radio/Radio.stories.tsx +192 -0
  139. package/radio/types.d.ts +54 -0
  140. package/radio/types.js +5 -0
  141. package/resultsetTable/ResultsetTable.d.ts +4 -0
  142. package/{dist/resultsetTable → resultsetTable}/ResultsetTable.js +35 -144
  143. package/resultsetTable/types.d.ts +63 -0
  144. package/resultsetTable/types.js +5 -0
  145. package/select/Select.js +865 -0
  146. package/select/Select.stories.tsx +572 -0
  147. package/select/index.d.ts +131 -0
  148. package/sidenav/Sidenav.d.ts +9 -0
  149. package/{dist/sidenav → sidenav}/Sidenav.js +19 -62
  150. package/sidenav/Sidenav.stories.tsx +165 -0
  151. package/sidenav/types.d.ts +50 -0
  152. package/sidenav/types.js +5 -0
  153. package/slider/Slider.d.ts +4 -0
  154. package/{dist/slider → slider}/Slider.js +72 -159
  155. package/slider/Slider.stories.tsx +177 -0
  156. package/slider/types.d.ts +78 -0
  157. package/slider/types.js +5 -0
  158. package/spinner/Spinner.d.ts +4 -0
  159. package/spinner/Spinner.js +250 -0
  160. package/spinner/Spinner.stories.jsx +102 -0
  161. package/spinner/types.d.ts +32 -0
  162. package/spinner/types.js +5 -0
  163. package/switch/Switch.d.ts +4 -0
  164. package/{dist/switch → switch}/Switch.js +26 -69
  165. package/switch/Switch.stories.tsx +160 -0
  166. package/switch/types.d.ts +58 -0
  167. package/switch/types.js +5 -0
  168. package/table/Table.d.ts +4 -0
  169. package/{dist/table → table}/Table.js +10 -24
  170. package/table/Table.stories.jsx +276 -0
  171. package/table/types.d.ts +21 -0
  172. package/table/types.js +5 -0
  173. package/tabs/Tabs.d.ts +4 -0
  174. package/tabs/Tabs.js +213 -0
  175. package/tabs/types.d.ts +70 -0
  176. package/tabs/types.js +5 -0
  177. package/tag/Tag.d.ts +4 -0
  178. package/tag/Tag.js +193 -0
  179. package/tag/Tag.stories.tsx +145 -0
  180. package/tag/types.d.ts +60 -0
  181. package/tag/types.js +5 -0
  182. package/text-input/TextInput.d.ts +4 -0
  183. package/{dist/text-input → text-input}/TextInput.js +248 -434
  184. package/text-input/types.d.ts +157 -0
  185. package/text-input/types.js +5 -0
  186. package/{dist/textarea → textarea}/Textarea.js +20 -72
  187. package/textarea/Textarea.stories.jsx +135 -0
  188. package/{dist/textarea → textarea}/index.d.ts +0 -0
  189. package/{dist/toggle → toggle}/Toggle.js +15 -49
  190. package/toggle/index.d.ts +21 -0
  191. package/toggle-group/ToggleGroup.d.ts +4 -0
  192. package/{dist/toggle-group → toggle-group}/ToggleGroup.js +28 -138
  193. package/toggle-group/ToggleGroup.stories.tsx +178 -0
  194. package/toggle-group/types.d.ts +84 -0
  195. package/toggle-group/types.js +5 -0
  196. package/{dist/upload → upload}/Upload.js +14 -18
  197. package/{dist/upload → upload}/buttons-upload/ButtonsUpload.js +13 -37
  198. package/{dist/upload → upload}/buttons-upload/Icons.js +7 -7
  199. package/upload/dragAndDropArea/DragAndDropArea.js +225 -0
  200. package/{dist/upload → upload}/dragAndDropArea/Icons.js +6 -6
  201. package/upload/file-upload/FileToUpload.js +115 -0
  202. package/{dist/upload → upload}/file-upload/Icons.js +13 -13
  203. package/{dist/upload → upload}/files-upload/FilesToUpload.js +12 -26
  204. package/upload/index.d.ts +15 -0
  205. package/{dist/upload → upload}/transaction/Icons.js +31 -31
  206. package/upload/transaction/Transaction.js +104 -0
  207. package/upload/transactions/Transactions.js +94 -0
  208. package/{dist/useTheme.js → useTheme.js} +0 -0
  209. package/{dist/wizard → wizard}/Icons.js +8 -8
  210. package/wizard/Wizard.d.ts +4 -0
  211. package/{dist/wizard → wizard}/Wizard.js +32 -206
  212. package/wizard/Wizard.stories.jsx +224 -0
  213. package/wizard/types.d.ts +64 -0
  214. package/wizard/types.js +5 -0
  215. package/README.md +0 -66
  216. package/babel.config.js +0 -8
  217. package/dist/BackgroundColorContext.js +0 -46
  218. package/dist/ThemeContext.js +0 -250
  219. package/dist/accordion-group/AccordionGroup.js +0 -186
  220. package/dist/alert/index.d.ts +0 -51
  221. package/dist/badge/Badge.js +0 -63
  222. package/dist/date-input/index.d.ts +0 -95
  223. package/dist/file-input/FileItem.js +0 -280
  224. package/dist/file-input/index.d.ts +0 -81
  225. package/dist/main.d.ts +0 -8
  226. package/dist/new-select/NewSelect.js +0 -836
  227. package/dist/new-select/index.d.ts +0 -53
  228. package/dist/number-input/NumberInput.js +0 -136
  229. package/dist/number-input/index.d.ts +0 -113
  230. package/dist/paginator/Paginator.js +0 -283
  231. package/dist/password-input/index.d.ts +0 -94
  232. package/dist/spinner/Spinner.js +0 -381
  233. package/dist/tabs/Tabs.js +0 -343
  234. package/dist/tag/Tag.js +0 -282
  235. package/dist/text-input/index.d.ts +0 -135
  236. package/dist/upload/dragAndDropArea/DragAndDropArea.js +0 -329
  237. package/dist/upload/file-upload/FileToUpload.js +0 -189
  238. package/dist/upload/transaction/Transaction.js +0 -148
  239. package/dist/upload/transactions/Transactions.js +0 -138
  240. package/test/Accordion.test.js +0 -33
  241. package/test/AccordionGroup.test.js +0 -125
  242. package/test/Alert.test.js +0 -53
  243. package/test/Box.test.js +0 -10
  244. package/test/Button.test.js +0 -18
  245. package/test/Card.test.js +0 -30
  246. package/test/Checkbox.test.js +0 -45
  247. package/test/Chip.test.js +0 -25
  248. package/test/Date.test.js +0 -397
  249. package/test/DateInput.test.js +0 -242
  250. package/test/Dialog.test.js +0 -23
  251. package/test/Dropdown.test.js +0 -145
  252. package/test/FileInput.test.js +0 -201
  253. package/test/Footer.test.js +0 -94
  254. package/test/Header.test.js +0 -34
  255. package/test/Heading.test.js +0 -83
  256. package/test/InputText.test.js +0 -248
  257. package/test/Link.test.js +0 -43
  258. package/test/NumberInput.test.js +0 -259
  259. package/test/Paginator.test.js +0 -177
  260. package/test/PasswordInput.test.js +0 -83
  261. package/test/ProgressBar.test.js +0 -35
  262. package/test/Radio.test.js +0 -37
  263. package/test/ResultsetTable.test.js +0 -329
  264. package/test/Select.test.js +0 -212
  265. package/test/Sidenav.test.js +0 -45
  266. package/test/Slider.test.js +0 -74
  267. package/test/Spinner.test.js +0 -32
  268. package/test/Switch.test.js +0 -45
  269. package/test/Table.test.js +0 -36
  270. package/test/Tabs.test.js +0 -109
  271. package/test/Tag.test.js +0 -32
  272. package/test/TextInput.test.js +0 -732
  273. package/test/Textarea.test.js +0 -193
  274. package/test/ToggleGroup.test.js +0 -85
  275. package/test/Upload.test.js +0 -60
  276. package/test/V3TextArea.test.js +0 -51
  277. package/test/Wizard.test.js +0 -130
  278. package/test/mocks/pngMock.js +0 -1
  279. package/test/mocks/svgMock.js +0 -1
@@ -1,135 +0,0 @@
1
- type Size = "small" | "medium" | "large" | "fillParent";
2
- type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
- type Margin = {
4
- top?: Space;
5
- bottom?: Space;
6
- left?: Space;
7
- right?: Space;
8
- };
9
- type SVG = string | (HTMLElement & SVGElement);
10
- type Action = {
11
- onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
12
- icon: SVG;
13
- };
14
-
15
- type Props = {
16
- /**
17
- * Text to be placed above the input. This label will be used as the aria-label attribute of the list of suggestions.
18
- */
19
- label?: string;
20
- /**
21
- * Name attribute of the input element.
22
- */
23
- name?: string;
24
- /**
25
- * Value of the input. If undefined, the component will be uncontrolled and the value will be managed internally by the component.
26
- */
27
- value?: string;
28
- /**
29
- * Helper text to be placed above the input.
30
- */
31
- helperText?: string;
32
- /**
33
- * Text to be put as placeholder of the input.
34
- */
35
- placeholder?: string;
36
- /**
37
- * Action to be shown in the input. This is an object composed of an onClick function and an icon,
38
- * being the latter either an inline svg or a URL to the image.
39
- */
40
- action?: Action;
41
- /**
42
- * If true, the input will have an action to clear the entered value.
43
- */
44
- clearable?: boolean;
45
- /**
46
- * If true, the component will be disabled.
47
- */
48
- disabled?: boolean;
49
- /**
50
- * If true, the input will be optional, showing '(Optional)'
51
- * next to the label. Otherwise, the field will be considered required and an error will be
52
- * passed as a parameter to the OnBlur and onChange functions when it has
53
- * not been filled.
54
- */
55
- optional?: boolean;
56
- /**
57
- * Prefix to be placed before the input value.
58
- */
59
- prefix?: string;
60
- /**
61
- * Suffix to be placed after the input value.
62
- */
63
- suffix?: string;
64
- /**
65
- * This function will be called when the user types within the input
66
- * element of the component. An object including the current value and
67
- * the error (if the value entered is not valid) will be passed to this
68
- * function. If there is no error, error will be null.
69
- */
70
- onChange?: (val: { value: string; error: string }) => void;
71
- /**
72
- * This function will be called when the input element loses the focus.
73
- * An object including the input value and the error (if the value
74
- * entered is not valid) will be passed to this function. If there is no error,
75
- * error will be null.
76
- */
77
- onBlur?: (obj: { value: string; error: string }) => void;
78
- /**
79
- * If it is defined, the component will change its appearance, showing
80
- * the error below the input component. If it is not defined, the error
81
- * messages will be managed internally, but never displayed on its own.
82
- */
83
- error?: string;
84
- /**
85
- * These are the options to be displayed as suggestions. It can be either an array or a function:
86
- * - Array: Array of options that will be filtered by the component.
87
- * - Function: This function will be called when the user changes the value, we will send as a parameter the new value;
88
- * apart from that this function should return one promise on which we should make 'then' to get the suggestions filtered.
89
- */
90
- suggestions?: string[] | (() => void);
91
- /**
92
- * Regular expression that defines the valid format allowed by the input.
93
- * This will be checked both when the input element loses the focus and
94
- * while typing within it. If the string entered does not match the
95
- * pattern, the onBlur and onChange functions will be called with the
96
- * current value and an internal error informing that this value does not
97
- * match the pattern. If the pattern is met, the error parameter of both
98
- * events will be null.
99
- */
100
- pattern?: string;
101
- /**
102
- * Specifies the minimun and maximum length allowed by the input.
103
- * This will be checked both when the input element loses the
104
- * focus and while typing within it. If the string entered does not
105
- * comply the length, the onBlur and onChange functions will be called
106
- * with the current value and an internal error informing that the value
107
- * length does not comply the specified range. If a valid length is
108
- * reached, the error parameter of both events will be null.
109
- */
110
- length?: { min?: number; max?: number };
111
- /**
112
- * HTML autocomplete attribute. Lets the user specify if any permission the user agent has to provide automated assistance in filling out the input value.
113
- * Its value must be one of all the possible values of the HTML autocomplete attribute: 'on', 'off', 'email', 'username', 'new-password', ...
114
- */
115
- autocomplete?: string;
116
- /**
117
- * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
118
- * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
119
- */
120
- margin?: Space | Margin;
121
- /**
122
- * Size of the component ('small' | 'medium' | 'large' | 'fillParent').
123
- */
124
- size?: Size;
125
- /**
126
- * Value of the tabindex attribute.
127
- */
128
- tabIndex?: number;
129
- /**
130
- * Reference to the component.
131
- */
132
- ref?: React.RefObject<HTMLDivElement>;
133
- };
134
-
135
- export default function DxcTextInput(props: Props): JSX.Element;
@@ -1,329 +0,0 @@
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 _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
-
16
- var _react = _interopRequireDefault(require("react"));
17
-
18
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
19
-
20
- var _propTypes = _interopRequireDefault(require("prop-types"));
21
-
22
- var _Icons = require("./Icons");
23
-
24
- var _Button = _interopRequireDefault(require("../../button/Button"));
25
-
26
- var _useTheme = _interopRequireDefault(require("../../useTheme.js"));
27
-
28
- var _BackgroundColorContext = require("../../BackgroundColorContext.js");
29
-
30
- function _templateObject11() {
31
- var data = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n text-transform: ", ";\n color: ", ";\n margin-bottom: 10px;\n"]);
32
-
33
- _templateObject11 = function _templateObject11() {
34
- return data;
35
- };
36
-
37
- return data;
38
- }
39
-
40
- function _templateObject10() {
41
- var data = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: ", ";\n & svg {\n fill: ", ";\n height: ", ";\n width: ", ";\n }\n"]);
42
-
43
- _templateObject10 = function _templateObject10() {
44
- return data;
45
- };
46
-
47
- return data;
48
- }
49
-
50
- function _templateObject9() {
51
- var data = (0, _taggedTemplateLiteral2["default"])(["\n --border-color: #666666;\n --border-weight: 1px;\n --dash-size: 8px;\n --gap-size: 8px;\n background: linear-gradient(90deg, var(--border-color) 100%, transparent 100%) top left no-repeat,\n linear-gradient(\n 90deg,\n transparent calc(var(--gap-size) / 2),\n var(--border-color) calc(var(--gap-size) / 2),\n var(--border-color) calc(var(--gap-size) / 2 + var(--dash-size)),\n transparent calc(var(--gap-size) / 2 + var(--dash-size))\n )\n top center repeat-x,\n linear-gradient(90deg, var(--border-color) 100%, transparent 100%) top right no-repeat,\n linear-gradient(0deg, var(--border-color) 100%, transparent 100%) top left no-repeat,\n linear-gradient(\n 0deg,\n transparent calc(var(--gap-size) / 2),\n var(--border-color) calc(var(--gap-size) / 2),\n var(--border-color) calc(var(--gap-size) / 2 + var(--dash-size)),\n transparent calc(var(--gap-size) / 2 + var(--dash-size))\n )\n center left repeat-y,\n linear-gradient(0deg, var(--border-color) 100%, transparent 100%) bottom left no-repeat,\n linear-gradient(90deg, var(--border-color) 100%, transparent 100%) bottom left no-repeat,\n linear-gradient(\n 90deg,\n transparent calc(var(--gap-size) / 2),\n var(--border-color) calc(var(--gap-size) / 2),\n var(--border-color) calc(var(--gap-size) / 2 + var(--dash-size)),\n transparent calc(var(--gap-size) / 2 + var(--dash-size))\n )\n bottom center repeat-x,\n linear-gradient(90deg, var(--border-color) 100%, transparent 100%) bottom right no-repeat,\n linear-gradient(0deg, var(--border-color) 100%, transparent 100%) top right no-repeat,\n linear-gradient(\n 0deg,\n transparent calc(var(--gap-size) / 2),\n var(--border-color) calc(var(--gap-size) / 2),\n var(--border-color) calc(var(--gap-size) / 2 + var(--dash-size)),\n transparent calc(var(--gap-size) / 2 + var(--dash-size))\n )\n center right repeat-y,\n linear-gradient(0deg, var(--border-color) 100%, transparent 100%) bottom right no-repeat;\n background-size: var(--dash-size) var(--border-weight), calc(var(--dash-size) + var(--gap-size)) var(--border-weight),\n var(--dash-size) var(--border-weight), var(--border-weight) var(--dash-size),\n var(--border-weight) calc(var(--dash-size) + var(--gap-size)), var(--border-weight) var(--dash-size);\n background-color: ", ";\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n width: 100%;\n height: 100%;\n cursor: pointer;\n"]);
52
-
53
- _templateObject9 = function _templateObject9() {
54
- return data;
55
- };
56
-
57
- return data;
58
- }
59
-
60
- function _templateObject8() {
61
- var data = (0, _taggedTemplateLiteral2["default"])([""]);
62
-
63
- _templateObject8 = function _templateObject8() {
64
- return data;
65
- };
66
-
67
- return data;
68
- }
69
-
70
- function _templateObject7() {
71
- var data = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n text-transform: ", ";\n color: ", ";\n margin-bottom: 40px;\n"]);
72
-
73
- _templateObject7 = function _templateObject7() {
74
- return data;
75
- };
76
-
77
- return data;
78
- }
79
-
80
- function _templateObject6() {
81
- var data = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n text-transform: ", ";\n color: ", ";\n margin-bottom: 10px;\n"]);
82
-
83
- _templateObject6 = function _templateObject6() {
84
- return data;
85
- };
86
-
87
- return data;
88
- }
89
-
90
- function _templateObject5() {
91
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n align-items: center;\n"]);
92
-
93
- _templateObject5 = function _templateObject5() {
94
- return data;
95
- };
96
-
97
- return data;
98
- }
99
-
100
- function _templateObject4() {
101
- var data = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: ", ";\n margin-bottom: 20px;\n & svg {\n fill: ", ";\n height: ", ";\n width: ", ";\n }\n"]);
102
-
103
- _templateObject4 = function _templateObject4() {
104
- return data;
105
- };
106
-
107
- return data;
108
- }
109
-
110
- function _templateObject3() {
111
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n"]);
112
-
113
- _templateObject3 = function _templateObject3() {
114
- return data;
115
- };
116
-
117
- return data;
118
- }
119
-
120
- function _templateObject2() {
121
- var data = (0, _taggedTemplateLiteral2["default"])(["\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n border-radius: 4px;\n box-shadow: 0px 3px 6px ", ";\n"]);
122
-
123
- _templateObject2 = function _templateObject2() {
124
- return data;
125
- };
126
-
127
- return data;
128
- }
129
-
130
- function _templateObject() {
131
- var data = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n background-color: ", ";\n width: 100%;\n height: 100%;\n"]);
132
-
133
- _templateObject = function _templateObject() {
134
- return data;
135
- };
136
-
137
- return data;
138
- }
139
-
140
- var DxcDragAndDropArea = function DxcDragAndDropArea(_ref) {
141
- var _ref$dashed = _ref.dashed,
142
- dashed = _ref$dashed === void 0 ? false : _ref$dashed,
143
- addFile = _ref.addFile,
144
- tabIndexValue = _ref.tabIndexValue;
145
-
146
- var _React$useState = _react["default"].useState(false),
147
- _React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
148
- dragging = _React$useState2[0],
149
- setDragging = _React$useState2[1];
150
-
151
- var colorsTheme = (0, _useTheme["default"])();
152
- var text = "There are no files to upload";
153
- var description = "Drag and drop your files here or choose one from your computer";
154
- var textHover = "Drag your file here";
155
-
156
- var handleDrag = function handleDrag(e) {
157
- e.preventDefault();
158
- e.stopPropagation();
159
- };
160
-
161
- var handleDragIn = function handleDragIn(e) {
162
- e.preventDefault();
163
- e.stopPropagation();
164
-
165
- if (e.dataTransfer.items && e.dataTransfer.items.length > 0) {
166
- setDragging(true);
167
- }
168
- };
169
-
170
- var handleDragOut = function handleDragOut(e) {
171
- e.preventDefault();
172
- e.stopPropagation();
173
- setDragging(false);
174
- };
175
-
176
- var handleDrop = function handleDrop(e) {
177
- e.preventDefault();
178
- e.stopPropagation();
179
- var filesObject = e.dataTransfer.files;
180
-
181
- if (filesObject && filesObject.length > 0) {
182
- var filesArray = Object.keys(filesObject).map(function (key) {
183
- return filesObject[key];
184
- });
185
- addFile(filesArray);
186
- e.dataTransfer.clearData();
187
- }
188
- };
189
-
190
- var selectFile = function selectFile(e) {
191
- var filesObject = e.target.files;
192
-
193
- if (filesObject && filesObject.length > 0) {
194
- var filesArray = Object.keys(filesObject).map(function (key) {
195
- return filesObject[key];
196
- });
197
- addFile(filesArray);
198
- }
199
- };
200
-
201
- var handleClick = function handleClick() {
202
- document.getElementById("chooseFiles").click();
203
- };
204
-
205
- return _react["default"].createElement(_styledComponents.ThemeProvider, {
206
- theme: colorsTheme.upload
207
- }, _react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
208
- color: colorsTheme.upload.backgroundColor
209
- }, _react["default"].createElement(DXCDragAndDrop, {
210
- onDrop: handleDrop,
211
- onDragEnter: handleDragIn,
212
- onDragOver: handleDrag,
213
- onDragLeave: handleDragOut,
214
- dashed: dashed
215
- }, !dragging && !dashed && _react["default"].createElement(DXCDragAndDropArea, null, _react["default"].createElement(DragAndDropContent, null, _react["default"].createElement(DragAndDropIcon, null, _Icons.uploadFileIcon), _react["default"].createElement(DragAndDropText, null, _react["default"].createElement(DragAndDropTitle, null, text), _react["default"].createElement(DragAndDropDescription, null, description)), _react["default"].createElement("div", null, _react["default"].createElement(_Button["default"], {
216
- label: "CHOOSE FILES",
217
- onClick: handleClick,
218
- tabIndex: tabIndexValue
219
- }), _react["default"].createElement("input", {
220
- id: "chooseFiles",
221
- type: "file",
222
- multiple: true,
223
- onChange: selectFile,
224
- style: {
225
- display: "none"
226
- }
227
- })))), !dragging && dashed && _react["default"].createElement(DragAndDropContentHover, null, _react["default"].createElement(DragAndDropContent, null, _react["default"].createElement(DragAndDropIcon, null, _Icons.uploadFileIcon), _react["default"].createElement(DragAndDropText, null, _react["default"].createElement(DragAndDropTitle, null, text), _react["default"].createElement(DragAndDropDescription, null, description)), _react["default"].createElement(ButtonChooseFiles, null, _react["default"].createElement(_Button["default"], {
228
- theme: "light",
229
- label: "CHOOSE FILES",
230
- onClick: handleClick,
231
- tabIndex: tabIndexValue
232
- }), _react["default"].createElement("input", {
233
- id: "chooseFiles",
234
- type: "file",
235
- multiple: true,
236
- onChange: selectFile,
237
- style: {
238
- display: "none"
239
- }
240
- })))), dragging && _react["default"].createElement(DragAndDropContentHover, null, _react["default"].createElement(DragAndDropTextHover, null, textHover), _react["default"].createElement(DragAndDropIconHover, null, _Icons.dropFileIcon)))));
241
- };
242
-
243
- DxcDragAndDropArea.propTypes = {
244
- dashed: _propTypes["default"].bool,
245
- addFile: _propTypes["default"].func
246
- };
247
-
248
- var DXCDragAndDrop = _styledComponents["default"].div(_templateObject(), function (props) {
249
- return props.theme.fontFamily;
250
- }, function (props) {
251
- return props.theme.backgroundColor;
252
- });
253
-
254
- var DXCDragAndDropArea = _styledComponents["default"].div(_templateObject2(), function (props) {
255
- return props.theme.shadowColor;
256
- });
257
-
258
- var DragAndDropContent = _styledComponents["default"].div(_templateObject3());
259
-
260
- var DragAndDropIcon = _styledComponents["default"].div(_templateObject4(), function (props) {
261
- return props.theme.dragAndDropIconSize;
262
- }, function (props) {
263
- return props.theme.dragAndDropIconSize;
264
- }, function (props) {
265
- return props.theme.dragAndDropIconColor;
266
- }, function (props) {
267
- return props.theme.dragAndDropIconSize;
268
- }, function (props) {
269
- return props.theme.dragAndDropIconSize;
270
- });
271
-
272
- var DragAndDropText = _styledComponents["default"].div(_templateObject5());
273
-
274
- var DragAndDropTitle = _styledComponents["default"].div(_templateObject6(), function (props) {
275
- return props.theme.dragAndDropTitleFontSize;
276
- }, function (props) {
277
- return props.theme.dragAndDropTitleFontStyle;
278
- }, function (props) {
279
- return props.theme.dragAndDropTitleFontWeight;
280
- }, function (props) {
281
- return props.theme.dragAndDropTitleFontTextTransform;
282
- }, function (props) {
283
- return props.theme.dragAndDropTitleFontColor;
284
- });
285
-
286
- var DragAndDropDescription = _styledComponents["default"].div(_templateObject7(), function (props) {
287
- return props.theme.dragAndDropDescriptionFontSize;
288
- }, function (props) {
289
- return props.theme.dragAndDropDescriptionFontStyle;
290
- }, function (props) {
291
- return props.theme.dragAndDropDescriptionFontWeight;
292
- }, function (props) {
293
- return props.theme.dragAndDropDescriptionFontTextTransform;
294
- }, function (props) {
295
- return props.theme.dragAndDropDescriptionFontColor;
296
- });
297
-
298
- var ButtonChooseFiles = _styledComponents["default"].div(_templateObject8());
299
-
300
- var DragAndDropContentHover = _styledComponents["default"].div(_templateObject9(), function (props) {
301
- return props.theme.draggingStateBackgroundColor;
302
- });
303
-
304
- var DragAndDropIconHover = _styledComponents["default"].div(_templateObject10(), function (props) {
305
- return props.theme.dragAndDropDraggingStateIconSize;
306
- }, function (props) {
307
- return props.theme.dragAndDropDraggingStateIconSize;
308
- }, function (props) {
309
- return props.theme.dragAndDropDraggingStateIconColor;
310
- }, function (props) {
311
- return props.theme.dragAndDropDraggingStateIconSize;
312
- }, function (props) {
313
- return props.theme.dragAndDropDraggingStateIconSize;
314
- });
315
-
316
- var DragAndDropTextHover = _styledComponents["default"].div(_templateObject11(), function (props) {
317
- return props.theme.dragAndDropDraggingStateFontSize;
318
- }, function (props) {
319
- return props.theme.dragAndDropDraggingStateFontStyle;
320
- }, function (props) {
321
- return props.theme.dragAndDropDraggingStateFontWeight;
322
- }, function (props) {
323
- return props.theme.dragAndDropDraggingStateFontTextTransform;
324
- }, function (props) {
325
- return props.theme.dragAndDropDraggingStateFontColor;
326
- });
327
-
328
- var _default = DxcDragAndDropArea;
329
- exports["default"] = _default;
@@ -1,189 +0,0 @@
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 _Icons = require("./Icons");
21
-
22
- var _useTheme = _interopRequireDefault(require("../../useTheme.js"));
23
-
24
- function _templateObject8() {
25
- var data = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: ", ";\n border: none;\n display: flex;\n margin-right: 30px;\n margin-top: 11px;\n padding: 0px;\n background: none;\n &:focus {\n visibility: visible;\n }\n & svg {\n fill: ", ";\n height: ", ";\n width: ", ";\n }\n"]);
26
-
27
- _templateObject8 = function _templateObject8() {
28
- return data;
29
- };
30
-
31
- return data;
32
- }
33
-
34
- function _templateObject7() {
35
- var data = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n text-transform: ", ";\n color: ", ";\n"]);
36
-
37
- _templateObject7 = function _templateObject7() {
38
- return data;
39
- };
40
-
41
- return data;
42
- }
43
-
44
- function _templateObject6() {
45
- var data = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n text-transform: ", ";\n color: ", ";\n margin-bottom: 12px;\n"]);
46
-
47
- _templateObject6 = function _templateObject6() {
48
- return data;
49
- };
50
-
51
- return data;
52
- }
53
-
54
- function _templateObject5() {
55
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n"]);
56
-
57
- _templateObject5 = function _templateObject5() {
58
- return data;
59
- };
60
-
61
- return data;
62
- }
63
-
64
- function _templateObject4() {
65
- var data = (0, _taggedTemplateLiteral2["default"])(["\n margin-right: 30px;\n width: 70px;\n height: 52px;\n & svg {\n width: 70px;\n height: 52px;\n }\n"]);
66
-
67
- _templateObject4 = function _templateObject4() {
68
- return data;
69
- };
70
-
71
- return data;
72
- }
73
-
74
- function _templateObject3() {
75
- var data = (0, _taggedTemplateLiteral2["default"])(["\n margin-right: 30px;\n width: 70px;\n height: 52px;\n object-fit: contain;\n"]);
76
-
77
- _templateObject3 = function _templateObject3() {
78
- return data;
79
- };
80
-
81
- return data;
82
- }
83
-
84
- function _templateObject2() {
85
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n margin-bottom: 25px;\n margin-left: 40px;\n"]);
86
-
87
- _templateObject2 = function _templateObject2() {
88
- return data;
89
- };
90
-
91
- return data;
92
- }
93
-
94
- function _templateObject() {
95
- var data = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n max-width: 100%;\n height: 52px;\n display: flex;\n flex-direction: column;\n padding-bottom: 25px;\n padding-top: 25px;\n border-bottom: ", " solid ", ";\n :hover {\n background: ", ";\n &:hover {\n cursor: pointer;\n }\n }\n"]);
96
-
97
- _templateObject = function _templateObject() {
98
- return data;
99
- };
100
-
101
- return data;
102
- }
103
-
104
- var DxcFileToUpload = function DxcFileToUpload(_ref) {
105
- var _ref$name = _ref.name,
106
- name = _ref$name === void 0 ? "" : _ref$name,
107
- _ref$type = _ref.type,
108
- type = _ref$type === void 0 ? "" : _ref$type,
109
- image = _ref.image,
110
- onDelete = _ref.onDelete,
111
- tabIndexValue = _ref.tabIndexValue;
112
-
113
- var icon = type.includes("video") && _Icons.videoIcon || type.includes("audio") && _Icons.audioIcon || _Icons.defaultIcon;
114
-
115
- var hasImage = image && image.includes("image");
116
- var colorsTheme = (0, _useTheme["default"])();
117
- return _react["default"].createElement(_styledComponents.ThemeProvider, {
118
- theme: colorsTheme.upload
119
- }, _react["default"].createElement(DXCFileToUpload, null, _react["default"].createElement(FileContent, null, hasImage && _react["default"].createElement(FileImage, {
120
- src: image
121
- }) || _react["default"].createElement(FileIconContainer, null, icon), _react["default"].createElement(FileInfo, null, _react["default"].createElement(FileName, null, name), _react["default"].createElement(FileType, null, type)), _react["default"].createElement(DeleteFile, {
122
- onClick: onDelete,
123
- tabIndex: tabIndexValue
124
- }, _Icons.closeIcon))));
125
- };
126
-
127
- DxcFileToUpload.propTypes = {
128
- name: _propTypes["default"].string,
129
- type: _propTypes["default"].string,
130
- image: _propTypes["default"].string,
131
- onDelete: _propTypes["default"].func
132
- };
133
-
134
- var DXCFileToUpload = _styledComponents["default"].div(_templateObject(), function (props) {
135
- return props.theme.fontFamily;
136
- }, function (props) {
137
- return props.theme.fileUnderlineThickness;
138
- }, function (props) {
139
- return props.theme.fileUnderlineColor;
140
- }, function (props) {
141
- return props.theme.hoverFileColor;
142
- });
143
-
144
- var FileContent = _styledComponents["default"].div(_templateObject2());
145
-
146
- var FileImage = _styledComponents["default"].img(_templateObject3());
147
-
148
- var FileIconContainer = _styledComponents["default"].div(_templateObject4());
149
-
150
- var FileInfo = _styledComponents["default"].div(_templateObject5());
151
-
152
- var FileName = _styledComponents["default"].div(_templateObject6(), function (props) {
153
- return props.theme.fileNameFontSize;
154
- }, function (props) {
155
- return props.theme.fileNameFontStyle;
156
- }, function (props) {
157
- return props.theme.fileNameFontWeight;
158
- }, function (props) {
159
- return props.theme.fileNameFontTextTransform;
160
- }, function (props) {
161
- return props.theme.fileNameFontColor;
162
- });
163
-
164
- var FileType = _styledComponents["default"].div(_templateObject7(), function (props) {
165
- return props.theme.fileTypeFontSize;
166
- }, function (props) {
167
- return props.theme.fileTypeFontStyle;
168
- }, function (props) {
169
- return props.theme.fileTypeFontWeight;
170
- }, function (props) {
171
- return props.theme.fileTypeFontTextTransform;
172
- }, function (props) {
173
- return props.theme.fileTypeFontColor;
174
- });
175
-
176
- var DeleteFile = _styledComponents["default"].button(_templateObject8(), function (props) {
177
- return props.theme.fileDeleteIconSize;
178
- }, function (props) {
179
- return props.theme.fileDeleteIconSize;
180
- }, function (props) {
181
- return props.theme.fileDeleteIconColor;
182
- }, function (props) {
183
- return props.theme.fileDeleteIconSize;
184
- }, function (props) {
185
- return props.theme.fileDeleteIconSize;
186
- });
187
-
188
- var _default = DxcFileToUpload;
189
- exports["default"] = _default;