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

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 (195) hide show
  1. package/README.md +1 -1
  2. package/babel.config.js +6 -2
  3. package/dist/BackgroundColorContext.js +46 -0
  4. package/dist/ThemeContext.js +235 -2
  5. package/dist/V3Textarea/V3Textarea.js +264 -0
  6. package/dist/accordion/Accordion.js +170 -81
  7. package/dist/accordion-group/AccordionGroup.js +186 -0
  8. package/dist/alert/Alert.js +184 -83
  9. package/dist/alert/index.d.ts +51 -0
  10. package/dist/badge/Badge.js +63 -0
  11. package/dist/box/Box.js +39 -19
  12. package/dist/button/Button.js +84 -29
  13. package/dist/card/Card.js +64 -56
  14. package/dist/checkbox/Checkbox.js +108 -32
  15. package/dist/chip/Chip.js +135 -40
  16. package/dist/common/RequiredComponent.js +2 -8
  17. package/dist/common/utils.js +2 -22
  18. package/dist/common/variables.js +1486 -105
  19. package/dist/date/Date.js +115 -78
  20. package/dist/date-input/DateInput.js +400 -0
  21. package/dist/date-input/index.d.ts +95 -0
  22. package/dist/dialog/Dialog.js +61 -36
  23. package/dist/dropdown/Dropdown.js +226 -94
  24. package/dist/file-input/FileInput.js +644 -0
  25. package/dist/file-input/FileItem.js +280 -0
  26. package/dist/file-input/index.d.ts +81 -0
  27. package/dist/footer/Footer.js +125 -45
  28. package/dist/footer/Icons.js +77 -0
  29. package/dist/header/Header.js +174 -90
  30. package/dist/header/Icons.js +59 -0
  31. package/dist/heading/Heading.js +93 -22
  32. package/dist/input-text/Icons.js +22 -0
  33. package/dist/input-text/InputText.js +298 -108
  34. package/dist/layout/ApplicationLayout.js +327 -0
  35. package/dist/layout/Icons.js +55 -0
  36. package/dist/link/Link.js +142 -34
  37. package/dist/main.d.ts +8 -0
  38. package/dist/main.js +111 -7
  39. package/dist/new-select/NewSelect.js +836 -0
  40. package/dist/new-select/index.d.ts +53 -0
  41. package/dist/number-input/NumberInput.js +136 -0
  42. package/dist/number-input/NumberInputContext.js +16 -0
  43. package/dist/number-input/index.d.ts +113 -0
  44. package/dist/paginator/Icons.js +66 -0
  45. package/dist/paginator/Paginator.js +162 -57
  46. package/dist/password-input/PasswordInput.js +198 -0
  47. package/dist/password-input/index.d.ts +94 -0
  48. package/dist/progress-bar/ProgressBar.js +97 -44
  49. package/dist/radio/Radio.js +39 -21
  50. package/dist/resultsetTable/ResultsetTable.js +93 -69
  51. package/dist/select/Select.js +253 -129
  52. package/dist/sidenav/Sidenav.js +87 -125
  53. package/dist/slider/Slider.js +219 -73
  54. package/dist/spinner/Spinner.js +249 -64
  55. package/dist/switch/Switch.js +52 -25
  56. package/dist/table/Table.js +63 -15
  57. package/dist/tabs/Tabs.js +210 -50
  58. package/dist/tabs-for-sections/TabsForSections.js +1 -16
  59. package/dist/tag/Tag.js +100 -35
  60. package/dist/text-input/TextInput.js +971 -0
  61. package/dist/text-input/index.d.ts +135 -0
  62. package/dist/textarea/Textarea.js +250 -107
  63. package/dist/textarea/index.d.ts +117 -0
  64. package/dist/toggle/Toggle.js +16 -19
  65. package/dist/toggle-group/ToggleGroup.js +327 -0
  66. package/dist/upload/Upload.js +16 -11
  67. package/dist/upload/buttons-upload/ButtonsUpload.js +35 -25
  68. package/dist/upload/buttons-upload/Icons.js +40 -0
  69. package/dist/upload/dragAndDropArea/DragAndDropArea.js +84 -37
  70. package/dist/upload/dragAndDropArea/Icons.js +39 -0
  71. package/dist/upload/file-upload/FileToUpload.js +64 -33
  72. package/dist/upload/file-upload/Icons.js +66 -0
  73. package/dist/upload/files-upload/FilesToUpload.js +16 -16
  74. package/dist/upload/transaction/Icons.js +160 -0
  75. package/dist/upload/transaction/Transaction.js +42 -49
  76. package/dist/upload/transactions/Transactions.js +38 -20
  77. package/dist/useTheme.js +22 -0
  78. package/dist/wizard/Icons.js +65 -0
  79. package/dist/wizard/Wizard.js +156 -61
  80. package/package.json +14 -6
  81. package/test/AccordionGroup.test.js +125 -0
  82. package/test/Date.test.js +49 -45
  83. package/test/DateInput.test.js +242 -0
  84. package/test/Dropdown.test.js +19 -4
  85. package/test/FileInput.test.js +201 -0
  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/InputText.test.js +53 -41
  90. package/test/Link.test.js +25 -7
  91. package/test/NumberInput.test.js +259 -0
  92. package/test/Paginator.test.js +72 -60
  93. package/test/PasswordInput.test.js +83 -0
  94. package/test/ResultsetTable.test.js +66 -19
  95. package/test/Select.test.js +55 -34
  96. package/test/Sidenav.test.js +22 -64
  97. package/test/Slider.test.js +24 -15
  98. package/test/Spinner.test.js +5 -0
  99. package/test/Tabs.test.js +21 -0
  100. package/test/TextInput.test.js +732 -0
  101. package/test/Textarea.test.js +193 -0
  102. package/test/ToggleGroup.test.js +85 -0
  103. package/test/Upload.test.js +5 -5
  104. package/test/{TextArea.test.js → V3TextArea.test.js} +6 -7
  105. package/dist/accordion/Accordion.stories.js +0 -207
  106. package/dist/accordion/readme.md +0 -96
  107. package/dist/alert/Alert.stories.js +0 -158
  108. package/dist/alert/close.svg +0 -4
  109. package/dist/alert/error.svg +0 -4
  110. package/dist/alert/info.svg +0 -4
  111. package/dist/alert/readme.md +0 -43
  112. package/dist/alert/success.svg +0 -4
  113. package/dist/alert/warning.svg +0 -4
  114. package/dist/button/Button.stories.js +0 -224
  115. package/dist/button/readme.md +0 -93
  116. package/dist/checkbox/Checkbox.stories.js +0 -144
  117. package/dist/checkbox/readme.md +0 -116
  118. package/dist/common/services/example-service.js +0 -10
  119. package/dist/common/services/example-service.test.js +0 -12
  120. package/dist/date/Date.stories.js +0 -205
  121. package/dist/date/calendar.svg +0 -1
  122. package/dist/date/calendar_dark.svg +0 -1
  123. package/dist/date/readme.md +0 -73
  124. package/dist/dialog/Dialog.stories.js +0 -217
  125. package/dist/dialog/readme.md +0 -32
  126. package/dist/dropdown/Dropdown.stories.js +0 -249
  127. package/dist/dropdown/baseline-arrow_drop_down.svg +0 -1
  128. package/dist/dropdown/baseline-arrow_drop_down_wh.svg +0 -4
  129. package/dist/dropdown/baseline-arrow_drop_up.svg +0 -1
  130. package/dist/dropdown/baseline-arrow_drop_up_wh.svg +0 -4
  131. package/dist/dropdown/readme.md +0 -69
  132. package/dist/footer/Footer.stories.js +0 -94
  133. package/dist/footer/dxc_logo_wht.png +0 -0
  134. package/dist/footer/readme.md +0 -41
  135. package/dist/header/Header.stories.js +0 -176
  136. package/dist/header/close_icon.svg +0 -1
  137. package/dist/header/dxc_logo_black.png +0 -0
  138. package/dist/header/dxc_logo_white.png +0 -0
  139. package/dist/header/hamb_menu_black.svg +0 -1
  140. package/dist/header/hamb_menu_white.svg +0 -1
  141. package/dist/header/readme.md +0 -33
  142. package/dist/input-text/InputText.stories.js +0 -209
  143. package/dist/input-text/error.svg +0 -1
  144. package/dist/input-text/readme.md +0 -91
  145. package/dist/link/readme.md +0 -51
  146. package/dist/paginator/images/next.svg +0 -3
  147. package/dist/paginator/images/nextPage.svg +0 -3
  148. package/dist/paginator/images/previous.svg +0 -3
  149. package/dist/paginator/images/previousPage.svg +0 -3
  150. package/dist/paginator/readme.md +0 -50
  151. package/dist/progress-bar/ProgressBar.stories.js +0 -280
  152. package/dist/progress-bar/readme.md +0 -63
  153. package/dist/radio/Radio.stories.js +0 -166
  154. package/dist/radio/readme.md +0 -70
  155. package/dist/resultsetTable/arrow_downward-24px_wht.svg +0 -1
  156. package/dist/resultsetTable/arrow_upward-24px_wht.svg +0 -1
  157. package/dist/resultsetTable/unfold_more-24px_wht.svg +0 -1
  158. package/dist/select/Select.stories.js +0 -235
  159. package/dist/select/readme.md +0 -72
  160. package/dist/sidenav/arrow_icon.svg +0 -3
  161. package/dist/slider/Slider.stories.js +0 -241
  162. package/dist/slider/readme.md +0 -64
  163. package/dist/spinner/Spinner.stories.js +0 -183
  164. package/dist/spinner/readme.md +0 -65
  165. package/dist/switch/Switch.stories.js +0 -134
  166. package/dist/switch/readme.md +0 -133
  167. package/dist/tabs/Tabs.stories.js +0 -130
  168. package/dist/tabs/readme.md +0 -78
  169. package/dist/tabs-for-sections/readme.md +0 -78
  170. package/dist/toggle/Toggle.stories.js +0 -297
  171. package/dist/toggle/readme.md +0 -80
  172. package/dist/upload/Upload.stories.js +0 -72
  173. package/dist/upload/buttons-upload/drag-drop-icon.svg +0 -4
  174. package/dist/upload/buttons-upload/upload-button.svg +0 -1
  175. package/dist/upload/dragAndDropArea/upload_drop.svg +0 -4
  176. package/dist/upload/dragAndDropArea/upload_file.svg +0 -4
  177. package/dist/upload/file-upload/audio-icon.svg +0 -4
  178. package/dist/upload/file-upload/close.svg +0 -4
  179. package/dist/upload/file-upload/file-icon.svg +0 -4
  180. package/dist/upload/file-upload/video-icon.svg +0 -4
  181. package/dist/upload/readme.md +0 -37
  182. package/dist/upload/transaction/audio-icon-err.svg +0 -4
  183. package/dist/upload/transaction/audio-icon.svg +0 -4
  184. package/dist/upload/transaction/error-icon.svg +0 -4
  185. package/dist/upload/transaction/file-icon-err.svg +0 -4
  186. package/dist/upload/transaction/file-icon.svg +0 -4
  187. package/dist/upload/transaction/image-icon-err.svg +0 -4
  188. package/dist/upload/transaction/image-icon.svg +0 -4
  189. package/dist/upload/transaction/success-icon.svg +0 -4
  190. package/dist/upload/transaction/video-icon-err.svg +0 -4
  191. package/dist/upload/transaction/video-icon.svg +0 -4
  192. package/dist/wizard/invalid_icon.svg +0 -6
  193. package/dist/wizard/valid_icon.svg +0 -6
  194. package/dist/wizard/validation-wrong.svg +0 -6
  195. package/test/Toggle.test.js +0 -43
@@ -1,72 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
6
-
7
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
8
-
9
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
-
11
- var _react = _interopRequireDefault(require("react"));
12
-
13
- var _react2 = require("@storybook/react");
14
-
15
- var _readme = _interopRequireDefault(require("./readme.md"));
16
-
17
- var _Upload = _interopRequireDefault(require("./Upload"));
18
-
19
- function callbackFunc() {
20
- return _callbackFunc.apply(this, arguments);
21
- }
22
-
23
- function _callbackFunc() {
24
- _callbackFunc = (0, _asyncToGenerator2["default"])(
25
- /*#__PURE__*/
26
- _regenerator["default"].mark(function _callee() {
27
- return _regenerator["default"].wrap(function _callee$(_context) {
28
- while (1) {
29
- switch (_context.prev = _context.next) {
30
- case 0:
31
- return _context.abrupt("return", new Promise(function (resolve) {
32
- return setTimeout(resolve, 1000);
33
- }));
34
-
35
- case 1:
36
- case "end":
37
- return _context.stop();
38
- }
39
- }
40
- }, _callee);
41
- }));
42
- return _callbackFunc.apply(this, arguments);
43
- }
44
-
45
- (0, _react2.storiesOf)("Form Components|Upload", module).add("Component", function () {
46
- return _react["default"].createElement("div", {
47
- style: {
48
- marginTop: "80px"
49
- }
50
- }, _react["default"].createElement(_Upload["default"], {
51
- callbackUpload: callbackFunc
52
- }));
53
- }, {
54
- notes: {
55
- markdown: _readme["default"]
56
- }
57
- });
58
-
59
- var knobProps = function knobProps() {
60
- return {};
61
- };
62
-
63
- (0, _react2.storiesOf)("Form Components|Upload", module).add("Knobs example", function () {
64
- var props = knobProps();
65
- return _react["default"].createElement(_Upload["default"], (0, _extends2["default"])({}, props, {
66
- callbackUpload: callbackFunc
67
- }));
68
- }, {
69
- notes: {
70
- markdown: _readme["default"]
71
- }
72
- });
@@ -1,4 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#666666">
2
- <path fill="none" d="M0 0h24v24H0V0z"/>
3
- <path 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"/>
4
- </svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"/><path 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"/></svg>
@@ -1,4 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="74.5" height="74.5" viewBox="0 0 24 24" fill="#666666">
2
- <path fill="none" d="M0 0h24v24H0z"/>
3
- <path d="M11 5v5.59H7.5l4.5 4.5 4.5-4.5H13V5h-2zm-5 9c0 3.31 2.69 6 6 6s6-2.69 6-6h-2c0 2.21-1.79 4-4 4s-4-1.79-4-4H6z"/>
4
- </svg>
@@ -1,4 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="43.5" height="43.5" viewBox="0 0 24 24">
2
- <path d="M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6H6zm7 7V3.5L18.5 9H13z"/>
3
- <path d="M0 0h24v24H0z" fill="none"/>
4
- </svg>
@@ -1,4 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
- <path fill="none" d="M0 0h24v24H0V0z"/>
3
- <path d="M21 3H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H3V5h18v14zM8 15c0-1.66 1.34-3 3-3 .35 0 .69.07 1 .18V6h5v2h-3v7.03c-.02 1.64-1.35 2.97-3 2.97-1.66 0-3-1.34-3-3z"/>
4
- </svg>
@@ -1,4 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 24 24">
2
- <path 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 12z"/>
3
- <path d="M0 0h24v24H0z" fill="none"/>
4
- </svg>
@@ -1,4 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
- <path fill="none" d="M0 0h24v24H0V0z"/>
3
- <path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6z"/>
4
- </svg>
@@ -1,4 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
2
- <path d="M18 4l2 4h-3l-2-4h-2l2 4h-3l-2-4H8l2 4H7L5 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4h-4z"/>
3
- <path d="M0 0h24v24H0z" fill="none"/>
4
- </svg>
@@ -1,37 +0,0 @@
1
- # DXC Upload Component
2
-
3
- ## Usage
4
-
5
- ```js
6
- import { DxcUpload } from "@dxc-technology/halstack-react";
7
- ```
8
-
9
- ## Props
10
-
11
- <table>
12
- <tr style="background-color: grey">
13
- <td>Name</td>
14
- <td>Default</td>
15
- <td>Description</td>
16
- </tr>
17
- <tr>
18
- <td>onUpload: function</td>
19
- <td></td>
20
- <td>This function will be called when the user clicks the 'Upload' button for every file to be uploaded, we will send as a parameter the File object; apart from that this function should return one promise on which we should make 'then'(here we should show a Success alert) or 'catch' (in this case we would receive the error message as a string)</td>
21
- </tr>
22
-
23
- </table>
24
-
25
- ## Examples
26
-
27
- ```js
28
- import React from "react";
29
-
30
- import { DxcUpload } from "@dxc-technology/halstack-react";
31
-
32
- function App() {
33
- return <Upload callbackUpload={callbackFunc} />;
34
- }
35
-
36
- export default App;
37
- ```
@@ -1,4 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#D0011B">
2
- <path fill="none" d="M0 0h24v24H0V0z"/>
3
- <path d="M21 3H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H3V5h18v14zM8 15c0-1.66 1.34-3 3-3 .35 0 .69.07 1 .18V6h5v2h-3v7.03c-.02 1.64-1.35 2.97-3 2.97-1.66 0-3-1.34-3-3z"/>
4
- </svg>
@@ -1,4 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#D9D9D9">
2
- <path fill="none" d="M0 0h24v24H0V0z"/>
3
- <path d="M21 3H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H3V5h18v14zM8 15c0-1.66 1.34-3 3-3 .35 0 .69.07 1 .18V6h5v2h-3v7.03c-.02 1.64-1.35 2.97-3 2.97-1.66 0-3-1.34-3-3z"/>
4
- </svg>
@@ -1,4 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#D0011B">
2
- <path 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 12z"/>
3
- <path d="M0 0h24v24H0z" fill="none"/>
4
- </svg>
@@ -1,4 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#D0011B">
2
- <path d="M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6H6zm7 7V3.5L18.5 9H13z"/>
3
- <path d="M0 0h24v24H0z" fill="none"/>
4
- </svg>
@@ -1,4 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#D9D9D9">
2
- <path d="M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6H6zm7 7V3.5L18.5 9H13z"/>
3
- <path d="M0 0h24v24H0z" fill="none"/>
4
- </svg>
@@ -1,4 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#D0011B">
2
- <path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/>
3
- <path d="M0 0h24v24H0z" fill="none"/>
4
- </svg>
@@ -1,4 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#D9D9D9">
2
- <path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/>
3
- <path d="M0 0h24v24H0z" fill="none"/>
4
- </svg>
@@ -1,4 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#50B50F">
2
- <path fill="none" d="M0 0h24v24H0z"/>
3
- <path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"/>
4
- </svg>
@@ -1,4 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#D0011B">
2
- <path d="M18 4l2 4h-3l-2-4h-2l2 4h-3l-2-4H8l2 4H7L5 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4h-4z"/>
3
- <path d="M0 0h24v24H0z" fill="none"/>
4
- </svg>
@@ -1,4 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#D9D9D9">
2
- <path d="M18 4l2 4h-3l-2-4h-2l2 4h-3l-2-4H8l2 4H7L5 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4h-4z"/>
3
- <path d="M0 0h24v24H0z" fill="none"/>
4
- </svg>
@@ -1,6 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="496" height="496" viewBox="0 0 496 496">
2
- <g id="Group_2913" data-name="Group 2913" transform="translate(5286 3925)">
3
- <path id="Path_2821" data-name="Path 2821" d="M240,0C372.548,0,480,107.452,480,240S372.548,480,240,480,0,372.548,0,240,107.452,0,240,0Z" transform="translate(-5278 -3917)" fill="#f9cfcf"/>
4
- <path id="times-circle-regular" d="M256,8C119,8,8,119,8,256S119,504,256,504,504,393,504,256,393,8,256,8Zm0,448A200,200,0,1,1,456,256,199.945,199.945,0,0,1,256,456ZM357.8,193.8,295.6,256l62.2,62.2a12.011,12.011,0,0,1,0,17l-22.6,22.6a12.011,12.011,0,0,1-17,0L256,295.6l-62.2,62.2a12.011,12.011,0,0,1-17,0l-22.6-22.6a12.011,12.011,0,0,1,0-17L216.4,256l-62.2-62.2a12.011,12.011,0,0,1,0-17l22.6-22.6a12.011,12.011,0,0,1,17,0L256,216.4l62.2-62.2a12.011,12.011,0,0,1,17,0l22.6,22.6a12.011,12.011,0,0,1,0,17Z" transform="translate(-5294 -3933)" fill="#e22"/>
5
- </g>
6
- </svg>
@@ -1,6 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="496" height="496" viewBox="0 0 496 496">
2
- <g id="Group_2914" data-name="Group 2914" transform="translate(4677 3925)">
3
- <path id="Path_2822" data-name="Path 2822" d="M240,0C372.548,0,480,107.452,480,240S372.548,480,240,480,0,372.548,0,240,107.452,0,240,0Z" transform="translate(-4669 -3917)" fill="#dbf1c4"/>
4
- <path id="check-circle-regular" d="M256,8C119.033,8,8,119.033,8,256S119.033,504,256,504,504,392.967,504,256,392.967,8,256,8Zm0,48A200,200,0,1,1,56,256,199.893,199.893,0,0,1,256,56M396.2,186.267l-22.536-22.718a12,12,0,0,0-16.97-.068L215.346,303.7,155.554,243.42a12,12,0,0,0-16.97-.069l-22.719,22.536a12,12,0,0,0-.068,16.971l90.781,91.516a12,12,0,0,0,16.97.068l172.589-171.2a12,12,0,0,0,.067-16.971Z" transform="translate(-4685 -3933)" fill="#7ed321"/>
5
- </g>
6
- </svg>
@@ -1,6 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="496" height="496" viewBox="0 0 496 496">
2
- <g id="Group_2913" data-name="Group 2913" transform="translate(5286 3925)">
3
- <path id="Path_2821" data-name="Path 2821" d="M240,0C372.548,0,480,107.452,480,240S372.548,480,240,480,0,372.548,0,240,107.452,0,240,0Z" transform="translate(-5278 -3917)" fill="#f9cfcf"/>
4
- <path id="times-circle-regular" d="M256,8C119,8,8,119,8,256S119,504,256,504,504,393,504,256,393,8,256,8Zm0,448A200,200,0,1,1,456,256,199.945,199.945,0,0,1,256,456ZM357.8,193.8,295.6,256l62.2,62.2a12.011,12.011,0,0,1,0,17l-22.6,22.6a12.011,12.011,0,0,1-17,0L256,295.6l-62.2,62.2a12.011,12.011,0,0,1-17,0l-22.6-22.6a12.011,12.011,0,0,1,0-17L216.4,256l-62.2-62.2a12.011,12.011,0,0,1,0-17l22.6-22.6a12.011,12.011,0,0,1,17,0L256,216.4l62.2-62.2a12.011,12.011,0,0,1,17,0l22.6,22.6a12.011,12.011,0,0,1,0,17Z" transform="translate(-5294 -3933)" fill="#e22"/>
5
- </g>
6
- </svg>
@@ -1,43 +0,0 @@
1
- import React from "react";
2
- import { render, fireEvent } from "@testing-library/react";
3
- import DxcToggle from "../src/toggle/Toggle";
4
-
5
- describe("Toggle component tests", () => {
6
- test("Toggle renders with correct text", () => {
7
- const { getByText } = render(<DxcToggle label="Toggle" />);
8
- expect(getByText("Toggle")).toBeTruthy();
9
- });
10
-
11
- test("Calls correct function on click", () => {
12
- const onClick = jest.fn();
13
- const { getByText} = render(<DxcToggle label="ToggleTest" onClick={onClick} />);
14
- fireEvent.click(getByText("ToggleTest"));
15
- expect(onClick).toHaveBeenCalled();
16
- });
17
-
18
- test("Calls correct function on click with the correct value.", () => {
19
- const onClick = jest.fn();
20
- const { getByText, rerender } = render(<DxcToggle label="ToggleTest" onClick={onClick} />);
21
-
22
- fireEvent.click(getByText("ToggleTest"));
23
- rerender(<DxcToggle label="ToggleTest" onClick={onClick} selected={true} />);
24
- fireEvent.click(getByText("ToggleTest"));
25
- expect(onClick.mock.calls[0][0]).toBe(true);
26
- expect(onClick.mock.calls[1][0]).toBe(false);
27
- });
28
-
29
-
30
- test("Calls correct function on click with the correct value, if it´s controlled and the user doesn´t change the value the function always receives the same", () => {
31
- const onClick = jest.fn();
32
- const { getByText } = render(<DxcToggle label="ToggleTest" selected={true} onClick={onClick} />);
33
-
34
- fireEvent.click(getByText("ToggleTest"));
35
- fireEvent.click(getByText("ToggleTest"));
36
- fireEvent.click(getByText("ToggleTest"));
37
- expect(onClick).toHaveBeenCalledTimes(3);
38
- expect(onClick.mock.calls[0][0]).toBe(false);
39
- expect(onClick.mock.calls[1][0]).toBe(false);
40
- expect(onClick.mock.calls[2][0]).toBe(false);
41
- });
42
-
43
- });