@dxc-technology/halstack-react 0.0.0-e628009 → 0.0.0-e690193

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 (136) hide show
  1. package/README.md +27 -47
  2. package/dist/index.d.mts +3923 -0
  3. package/dist/index.d.ts +3923 -0
  4. package/dist/index.js +14133 -0
  5. package/dist/index.mjs +14045 -0
  6. package/package.json +92 -68
  7. package/babel.config.js +0 -8
  8. package/dist/BackgroundColorContext.js +0 -46
  9. package/dist/ThemeContext.js +0 -248
  10. package/dist/V3Textarea/V3Textarea.js +0 -264
  11. package/dist/accordion/Accordion.js +0 -353
  12. package/dist/accordion-group/AccordionGroup.js +0 -186
  13. package/dist/alert/Alert.js +0 -403
  14. package/dist/alert/index.d.ts +0 -51
  15. package/dist/badge/Badge.js +0 -63
  16. package/dist/box/Box.js +0 -156
  17. package/dist/button/Button.js +0 -238
  18. package/dist/card/Card.js +0 -254
  19. package/dist/checkbox/Checkbox.js +0 -300
  20. package/dist/chip/Chip.js +0 -265
  21. package/dist/common/OpenSans.css +0 -81
  22. package/dist/common/RequiredComponent.js +0 -40
  23. package/dist/common/fonts/OpenSans-Bold.ttf +0 -0
  24. package/dist/common/fonts/OpenSans-BoldItalic.ttf +0 -0
  25. package/dist/common/fonts/OpenSans-ExtraBold.ttf +0 -0
  26. package/dist/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  27. package/dist/common/fonts/OpenSans-Italic.ttf +0 -0
  28. package/dist/common/fonts/OpenSans-Light.ttf +0 -0
  29. package/dist/common/fonts/OpenSans-LightItalic.ttf +0 -0
  30. package/dist/common/fonts/OpenSans-Regular.ttf +0 -0
  31. package/dist/common/fonts/OpenSans-SemiBold.ttf +0 -0
  32. package/dist/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  33. package/dist/common/utils.js +0 -22
  34. package/dist/common/variables.js +0 -1569
  35. package/dist/date/Date.js +0 -379
  36. package/dist/date-input/DateInput.js +0 -400
  37. package/dist/date-input/index.d.ts +0 -95
  38. package/dist/dialog/Dialog.js +0 -218
  39. package/dist/dropdown/Dropdown.js +0 -544
  40. package/dist/file-input/FileInput.js +0 -644
  41. package/dist/file-input/FileItem.js +0 -280
  42. package/dist/file-input/index.d.ts +0 -81
  43. package/dist/footer/Footer.js +0 -421
  44. package/dist/footer/Icons.js +0 -77
  45. package/dist/header/Header.js +0 -434
  46. package/dist/header/Icons.js +0 -59
  47. package/dist/heading/Heading.js +0 -230
  48. package/dist/input-text/Icons.js +0 -22
  49. package/dist/input-text/InputText.js +0 -705
  50. package/dist/layout/ApplicationLayout.js +0 -327
  51. package/dist/layout/Icons.js +0 -55
  52. package/dist/link/Link.js +0 -237
  53. package/dist/main.d.ts +0 -8
  54. package/dist/main.js +0 -367
  55. package/dist/new-select/NewSelect.js +0 -836
  56. package/dist/new-select/index.d.ts +0 -53
  57. package/dist/number-input/NumberInput.js +0 -136
  58. package/dist/number-input/NumberInputContext.js +0 -16
  59. package/dist/number-input/index.d.ts +0 -113
  60. package/dist/paginator/Icons.js +0 -66
  61. package/dist/paginator/Paginator.js +0 -283
  62. package/dist/password-input/PasswordInput.js +0 -198
  63. package/dist/password-input/index.d.ts +0 -94
  64. package/dist/progress-bar/ProgressBar.js +0 -242
  65. package/dist/radio/Radio.js +0 -209
  66. package/dist/resultsetTable/ResultsetTable.js +0 -358
  67. package/dist/select/Select.js +0 -549
  68. package/dist/sidenav/Sidenav.js +0 -179
  69. package/dist/slider/Slider.js +0 -404
  70. package/dist/spinner/Spinner.js +0 -381
  71. package/dist/switch/Switch.js +0 -222
  72. package/dist/table/Table.js +0 -132
  73. package/dist/tabs/Tabs.js +0 -343
  74. package/dist/tabs-for-sections/TabsForSections.js +0 -92
  75. package/dist/tag/Tag.js +0 -282
  76. package/dist/text-input/TextInput.js +0 -971
  77. package/dist/text-input/index.d.ts +0 -135
  78. package/dist/textarea/Textarea.js +0 -369
  79. package/dist/textarea/index.d.ts +0 -117
  80. package/dist/toggle/Toggle.js +0 -220
  81. package/dist/toggle-group/ToggleGroup.js +0 -327
  82. package/dist/upload/Upload.js +0 -205
  83. package/dist/upload/buttons-upload/ButtonsUpload.js +0 -135
  84. package/dist/upload/buttons-upload/Icons.js +0 -40
  85. package/dist/upload/dragAndDropArea/DragAndDropArea.js +0 -329
  86. package/dist/upload/dragAndDropArea/Icons.js +0 -39
  87. package/dist/upload/file-upload/FileToUpload.js +0 -189
  88. package/dist/upload/file-upload/Icons.js +0 -66
  89. package/dist/upload/files-upload/FilesToUpload.js +0 -123
  90. package/dist/upload/transaction/Icons.js +0 -160
  91. package/dist/upload/transaction/Transaction.js +0 -148
  92. package/dist/upload/transactions/Transactions.js +0 -138
  93. package/dist/useTheme.js +0 -22
  94. package/dist/wizard/Icons.js +0 -65
  95. package/dist/wizard/Wizard.js +0 -405
  96. package/test/Accordion.test.js +0 -33
  97. package/test/AccordionGroup.test.js +0 -125
  98. package/test/Alert.test.js +0 -53
  99. package/test/Box.test.js +0 -10
  100. package/test/Button.test.js +0 -18
  101. package/test/Card.test.js +0 -30
  102. package/test/Checkbox.test.js +0 -45
  103. package/test/Chip.test.js +0 -25
  104. package/test/Date.test.js +0 -397
  105. package/test/DateInput.test.js +0 -242
  106. package/test/Dialog.test.js +0 -23
  107. package/test/Dropdown.test.js +0 -145
  108. package/test/FileInput.test.js +0 -201
  109. package/test/Footer.test.js +0 -94
  110. package/test/Header.test.js +0 -34
  111. package/test/Heading.test.js +0 -83
  112. package/test/InputText.test.js +0 -248
  113. package/test/Link.test.js +0 -43
  114. package/test/NumberInput.test.js +0 -259
  115. package/test/Paginator.test.js +0 -177
  116. package/test/PasswordInput.test.js +0 -83
  117. package/test/ProgressBar.test.js +0 -35
  118. package/test/Radio.test.js +0 -37
  119. package/test/ResultsetTable.test.js +0 -329
  120. package/test/Select.test.js +0 -212
  121. package/test/Sidenav.test.js +0 -45
  122. package/test/Slider.test.js +0 -74
  123. package/test/Spinner.test.js +0 -32
  124. package/test/Switch.test.js +0 -45
  125. package/test/Table.test.js +0 -36
  126. package/test/Tabs.test.js +0 -109
  127. package/test/TabsForSections.test.js +0 -34
  128. package/test/Tag.test.js +0 -32
  129. package/test/TextInput.test.js +0 -732
  130. package/test/Textarea.test.js +0 -193
  131. package/test/ToggleGroup.test.js +0 -85
  132. package/test/Upload.test.js +0 -60
  133. package/test/V3TextArea.test.js +0 -51
  134. package/test/Wizard.test.js +0 -130
  135. package/test/mocks/pngMock.js +0 -1
  136. package/test/mocks/svgMock.js +0 -1
@@ -1,205 +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 _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
13
-
14
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
15
-
16
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
17
-
18
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
19
-
20
- var _react = _interopRequireWildcard(require("react"));
21
-
22
- var _styledComponents = _interopRequireDefault(require("styled-components"));
23
-
24
- var _propTypes = _interopRequireDefault(require("prop-types"));
25
-
26
- var _DragAndDropArea = _interopRequireDefault(require("./dragAndDropArea/DragAndDropArea"));
27
-
28
- var _FilesToUpload = _interopRequireDefault(require("./files-upload/FilesToUpload"));
29
-
30
- var _Transactions = _interopRequireDefault(require("./transactions/Transactions"));
31
-
32
- var _variables = require("../common/variables.js");
33
-
34
- function _templateObject() {
35
- var data = (0, _taggedTemplateLiteral2["default"])(["\n max-width: 100%;\n height: 400px;\n box-shadow: 0px 3px 6px #00000029;\n border-radius: 4px;\n display: flex;\n flex-direction: row;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"]);
36
-
37
- _templateObject = function _templateObject() {
38
- return data;
39
- };
40
-
41
- return data;
42
- }
43
-
44
- var V3DxcUpload = function V3DxcUpload(_ref) {
45
- var callbackUpload = _ref.callbackUpload,
46
- margin = _ref.margin,
47
- _ref$tabIndex = _ref.tabIndex,
48
- tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
49
-
50
- var _useState = (0, _react.useState)([]),
51
- _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
52
- files = _useState2[0],
53
- setFiles = _useState2[1];
54
-
55
- var getFilesToUpload = function getFilesToUpload() {
56
- return files.filter(function (file) {
57
- return file.status === "pending";
58
- }).map(function (file) {
59
- var fileInfo = {
60
- name: file.name,
61
- type: file.type,
62
- image: file.image,
63
- status: file.status
64
- };
65
-
66
- fileInfo.deleteFile = function () {
67
- var uploadFiles = [];
68
- files.forEach(function (item) {
69
- return uploadFiles.push(item);
70
- });
71
- var fileIndex = uploadFiles.indexOf(file, 0);
72
-
73
- if (fileIndex > -1) {
74
- uploadFiles.splice(fileIndex, 1);
75
- setFiles(uploadFiles);
76
- }
77
- };
78
-
79
- return fileInfo;
80
- });
81
- };
82
-
83
- var getTransactionsFiles = function getTransactionsFiles() {
84
- return files.filter(function (file) {
85
- return file.status === "success" || file.status === "error" || file.status === "processing";
86
- }).map(function (file) {
87
- return {
88
- name: file.name,
89
- type: file.type,
90
- image: file.image,
91
- status: file.status
92
- };
93
- });
94
- };
95
-
96
- var getFilePreview = function getFilePreview(file) {
97
- return new Promise(function (resolve) {
98
- var reader = new FileReader();
99
- reader.readAsDataURL(file);
100
-
101
- reader.onload = function (e) {
102
- resolve(e.target.result);
103
- };
104
- });
105
- };
106
-
107
- var onDragHandler = function onDragHandler(filesToAdd) {
108
- setFiles([].concat((0, _toConsumableArray2["default"])(files), (0, _toConsumableArray2["default"])(filesToAdd.map(function (file) {
109
- var fileToAdd = {
110
- status: "pending",
111
- name: file.name,
112
- type: file.type
113
- };
114
- return fileToAdd;
115
- }))));
116
- Promise.all(filesToAdd.map(function (fileToAdd) {
117
- return getFilePreview(fileToAdd);
118
- })).then(function (previews) {
119
- setFiles([].concat((0, _toConsumableArray2["default"])(files), (0, _toConsumableArray2["default"])(filesToAdd.map(function (file, index) {
120
- var fileToAdd = {
121
- status: "pending",
122
- name: file.name,
123
- type: file.type,
124
- image: previews[index]
125
- };
126
- return fileToAdd;
127
- }))));
128
- });
129
- };
130
-
131
- var onUploadHandler = function onUploadHandler() {
132
- var uploadedFiles = [];
133
- files.forEach(function (file) {
134
- uploadedFiles = [].concat((0, _toConsumableArray2["default"])(uploadedFiles), [file]);
135
- });
136
- uploadedFiles.forEach(function (file) {
137
- if (file.status === "pending") {
138
- file.status = "processing";
139
-
140
- if (typeof callbackUpload === "function") {
141
- callbackUpload(file).then(function () {
142
- file.status = "success";
143
- uploadedFiles = getTransactionsFiles();
144
- setFiles(uploadedFiles);
145
- })["catch"](function (err) {
146
- file.status = "error";
147
- file.message = err;
148
- uploadedFiles = getTransactionsFiles();
149
- setFiles(uploadedFiles);
150
- })["finally"]();
151
- }
152
- }
153
-
154
- setFiles(uploadedFiles);
155
- });
156
- };
157
-
158
- var filesToUpload = getFilesToUpload();
159
- var transactionFiles = getTransactionsFiles();
160
- return _react["default"].createElement(DXCUpload, {
161
- margin: margin
162
- }, transactionFiles && transactionFiles.length !== 0 && _react["default"].createElement(_Transactions["default"], {
163
- tabIndexValue: tabIndex,
164
- transactions: transactionFiles
165
- }), filesToUpload && filesToUpload.length === 0 && transactionFiles && transactionFiles.length === 0 && _react["default"].createElement(_DragAndDropArea["default"], {
166
- dashed: false,
167
- addFile: onDragHandler,
168
- tabIndexValue: tabIndex
169
- }) || filesToUpload && filesToUpload.length === 0 && transactionFiles && transactionFiles.length !== 0 && _react["default"].createElement(_DragAndDropArea["default"], {
170
- dashed: true,
171
- addFile: onDragHandler,
172
- tabIndexValue: tabIndex
173
- }), filesToUpload && filesToUpload.length !== 0 && _react["default"].createElement(_FilesToUpload["default"], {
174
- filesToUpload: filesToUpload,
175
- addFile: onDragHandler,
176
- onUpload: onUploadHandler,
177
- tabIndexValue: tabIndex
178
- }));
179
- };
180
-
181
- V3DxcUpload.propTypes = {
182
- callbackUpload: _propTypes["default"].func,
183
- margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
184
- top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
185
- bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
186
- left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
187
- right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
188
- }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
189
- tabIndex: _propTypes["default"].number
190
- };
191
-
192
- var DXCUpload = _styledComponents["default"].div(_templateObject(), function (props) {
193
- return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
194
- }, function (props) {
195
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
196
- }, function (props) {
197
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "";
198
- }, function (props) {
199
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
200
- }, function (props) {
201
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
202
- });
203
-
204
- var _default = V3DxcUpload;
205
- exports["default"] = _default;
@@ -1,135 +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 _Button = _interopRequireDefault(require("../../button/Button"));
21
-
22
- var _Icons = require("./Icons");
23
-
24
- var _useTheme = _interopRequireDefault(require("../../useTheme.js"));
25
-
26
- var _BackgroundColorContext = require("../../BackgroundColorContext.js");
27
-
28
- function _templateObject3() {
29
- var data = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: ", ";\n margin-right: 5px;\n & svg {\n fill: ", ";\n }\n"]);
30
-
31
- _templateObject3 = function _templateObject3() {
32
- return data;
33
- };
34
-
35
- return data;
36
- }
37
-
38
- function _templateObject2() {
39
- var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n align-items: center;\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n text-transform: ", ";\n color: ", ";\n margin-right: 50px;\n"]);
40
-
41
- _templateObject2 = function _templateObject2() {
42
- return data;
43
- };
44
-
45
- return data;
46
- }
47
-
48
- function _templateObject() {
49
- var data = (0, _taggedTemplateLiteral2["default"])(["\n margin-right: 80px;\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n"]);
50
-
51
- _templateObject = function _templateObject() {
52
- return data;
53
- };
54
-
55
- return data;
56
- }
57
-
58
- var DxcButtonsUpload = function DxcButtonsUpload(_ref) {
59
- var addFile = _ref.addFile,
60
- onUpload = _ref.onUpload;
61
- var colorsTheme = (0, _useTheme["default"])();
62
-
63
- var selectFile = function selectFile(e) {
64
- var filesObject = e.target.files;
65
-
66
- if (filesObject && filesObject.length > 0) {
67
- var filesArray = Object.keys(filesObject).map(function (key) {
68
- return filesObject[key];
69
- });
70
- addFile(filesArray);
71
- }
72
- };
73
-
74
- var handleClick = function handleClick() {
75
- document.getElementById("chooseFiles").click();
76
- };
77
-
78
- return _react["default"].createElement(_styledComponents.ThemeProvider, {
79
- theme: colorsTheme.upload
80
- }, _react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
81
- color: colorsTheme.upload.backgroundColor
82
- }, _react["default"].createElement(DXCButtonsUpload, null, _react["default"].createElement(DragAndDropLabel, null, _react["default"].createElement(DragAndDropIconContainer, null, _Icons.dragAndDropIcon), "Drag and Drop area"), _react["default"].createElement(_Button["default"], {
83
- margin: {
84
- right: "small"
85
- },
86
- mode: "text",
87
- label: "CHOOSE FILES",
88
- onClick: handleClick
89
- }), _react["default"].createElement("input", {
90
- id: "chooseFiles",
91
- type: "file",
92
- multiple: true,
93
- onChange: selectFile,
94
- style: {
95
- display: "none"
96
- }
97
- }), _react["default"].createElement(_Button["default"], {
98
- label: "UPLOAD",
99
- iconPosition: "after",
100
- icon: _Icons.uploadIcon,
101
- onClick: onUpload
102
- }))));
103
- };
104
-
105
- DxcButtonsUpload.propTypes = {
106
- addFile: _propTypes["default"].func,
107
- onUpload: _propTypes["default"].func
108
- };
109
-
110
- var DXCButtonsUpload = _styledComponents["default"].div(_templateObject());
111
-
112
- var DragAndDropLabel = _styledComponents["default"].div(_templateObject2(), function (props) {
113
- return props.theme.fontFamily;
114
- }, function (props) {
115
- return props.theme.dragAndDropAreaTextFontSize;
116
- }, function (props) {
117
- return props.theme.dragAndDropAreaTextFontStyle;
118
- }, function (props) {
119
- return props.theme.dragAndDropAreaTextFontWeight;
120
- }, function (props) {
121
- return props.theme.dragAndDropAreaTextFontTextTransform;
122
- }, function (props) {
123
- return props.theme.dragAndDropAreaTextFontColor;
124
- });
125
-
126
- var DragAndDropIconContainer = _styledComponents["default"].div(_templateObject3(), function (props) {
127
- return props.theme.dragAndDropAreaIconSize;
128
- }, function (props) {
129
- return props.theme.dragAndDropAreaIconSize;
130
- }, function (props) {
131
- return props.theme.dragAndDropAreaIconColor;
132
- });
133
-
134
- var _default = DxcButtonsUpload;
135
- exports["default"] = _default;
@@ -1,40 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.dragAndDropIcon = exports.uploadIcon = void 0;
9
-
10
- var _react = _interopRequireDefault(require("react"));
11
-
12
- var uploadIcon = _react["default"].createElement("svg", {
13
- xmlns: "http://www.w3.org/2000/svg",
14
- width: "24",
15
- height: "24",
16
- viewBox: "0 0 24 24",
17
- fill: "#FFFFFF"
18
- }, _react["default"].createElement("path", {
19
- d: "M0 0h24v24H0z",
20
- fill: "none"
21
- }), _react["default"].createElement("path", {
22
- d: "M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"
23
- }));
24
-
25
- exports.uploadIcon = uploadIcon;
26
-
27
- var dragAndDropIcon = _react["default"].createElement("svg", {
28
- xmlns: "http://www.w3.org/2000/svg",
29
- width: "24",
30
- height: "24",
31
- viewBox: "0 0 24 24",
32
- fill: "#666666"
33
- }, _react["default"].createElement("path", {
34
- fill: "none",
35
- d: "M0 0h24v24H0V0z"
36
- }), _react["default"].createElement("path", {
37
- d: "M3 13h2v-2H3v2zm0 4h2v-2H3v2zm2 4v-2H3c0 1.1.89 2 2 2zM3 9h2V7H3v2zm12 12h2v-2h-2v2zm4-18H9c-1.11 0-2 .9-2 2v10c0 1.1.89 2 2 2h10c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 12H9V5h10v10zm-8 6h2v-2h-2v2zm-4 0h2v-2H7v2z"
38
- }));
39
-
40
- exports.dragAndDropIcon = dragAndDropIcon;