@dxc-technology/halstack-react 0.0.0-4d89cae → 0.0.0-4e5859a

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 (264) hide show
  1. package/BackgroundColorContext.d.ts +10 -0
  2. package/BackgroundColorContext.js +7 -5
  3. package/ThemeContext.d.ts +15 -0
  4. package/ThemeContext.js +84 -91
  5. package/V3Select/V3Select.js +35 -129
  6. package/V3Textarea/V3Textarea.js +12 -16
  7. package/accordion/Accordion.d.ts +4 -0
  8. package/accordion/Accordion.js +37 -132
  9. package/accordion/Accordion.stories.tsx +300 -0
  10. package/accordion/types.d.ts +68 -0
  11. package/accordion/types.js +5 -0
  12. package/accordion-group/AccordionGroup.d.ts +7 -0
  13. package/accordion-group/AccordionGroup.js +66 -82
  14. package/accordion-group/AccordionGroup.stories.tsx +225 -0
  15. package/accordion-group/types.d.ts +72 -0
  16. package/accordion-group/types.js +5 -0
  17. package/alert/Alert.d.ts +4 -0
  18. package/alert/Alert.js +40 -153
  19. package/alert/Alert.stories.tsx +170 -0
  20. package/alert/types.d.ts +49 -0
  21. package/alert/types.js +5 -0
  22. package/badge/Badge.js +10 -14
  23. package/box/Box.d.ts +4 -0
  24. package/box/Box.js +15 -45
  25. package/box/Box.stories.tsx +132 -0
  26. package/box/types.d.ts +43 -0
  27. package/box/types.js +5 -0
  28. package/button/Button.d.ts +4 -0
  29. package/button/Button.js +24 -83
  30. package/button/Button.stories.tsx +276 -0
  31. package/button/types.d.ts +57 -0
  32. package/button/types.js +5 -0
  33. package/card/Card.d.ts +4 -0
  34. package/card/Card.js +34 -124
  35. package/card/Card.stories.tsx +201 -0
  36. package/card/ice-cream.jpg +0 -0
  37. package/card/types.d.ts +67 -0
  38. package/card/types.js +5 -0
  39. package/checkbox/Checkbox.d.ts +4 -0
  40. package/checkbox/Checkbox.js +15 -61
  41. package/checkbox/Checkbox.stories.tsx +192 -0
  42. package/checkbox/types.d.ts +60 -0
  43. package/checkbox/types.js +5 -0
  44. package/chip/Chip.d.ts +4 -0
  45. package/chip/Chip.js +22 -88
  46. package/chip/Chip.stories.tsx +121 -0
  47. package/chip/types.d.ts +53 -0
  48. package/chip/types.js +5 -0
  49. package/common/RequiredComponent.js +3 -11
  50. package/common/variables.js +52 -45
  51. package/date/Date.js +17 -23
  52. package/date-input/DateInput.d.ts +4 -0
  53. package/date-input/DateInput.js +26 -68
  54. package/date-input/DateInput.stories.tsx +138 -0
  55. package/date-input/types.d.ts +100 -0
  56. package/date-input/types.js +5 -0
  57. package/dialog/Dialog.d.ts +4 -0
  58. package/dialog/Dialog.js +22 -75
  59. package/dialog/Dialog.stories.tsx +212 -0
  60. package/dialog/types.d.ts +43 -0
  61. package/dialog/types.js +5 -0
  62. package/dropdown/Dropdown.d.ts +4 -0
  63. package/dropdown/Dropdown.js +45 -172
  64. package/dropdown/Dropdown.stories.tsx +247 -0
  65. package/dropdown/types.d.ts +89 -0
  66. package/dropdown/types.js +5 -0
  67. package/file-input/FileInput.d.ts +4 -0
  68. package/file-input/FileInput.js +98 -221
  69. package/file-input/FileItem.d.ts +14 -0
  70. package/file-input/FileItem.js +40 -143
  71. package/file-input/types.d.ts +112 -0
  72. package/file-input/types.js +5 -0
  73. package/footer/Footer.d.ts +4 -0
  74. package/footer/Footer.js +46 -207
  75. package/footer/Footer.stories.tsx +130 -0
  76. package/footer/Icons.d.ts +2 -0
  77. package/footer/Icons.js +15 -15
  78. package/footer/types.d.ts +65 -0
  79. package/footer/types.js +5 -0
  80. package/header/Header.d.ts +7 -0
  81. package/header/Header.js +58 -204
  82. package/header/Header.stories.tsx +162 -0
  83. package/header/Icons.d.ts +2 -0
  84. package/header/Icons.js +7 -32
  85. package/header/types.d.ts +47 -0
  86. package/header/types.js +5 -0
  87. package/heading/Heading.d.ts +4 -0
  88. package/heading/Heading.js +25 -96
  89. package/heading/Heading.stories.tsx +53 -0
  90. package/heading/types.d.ts +33 -0
  91. package/heading/types.js +5 -0
  92. package/input-text/Icons.js +2 -2
  93. package/input-text/InputText.js +35 -129
  94. package/layout/ApplicationLayout.d.ts +10 -0
  95. package/layout/ApplicationLayout.js +39 -141
  96. package/layout/ApplicationLayout.stories.tsx +171 -0
  97. package/layout/Icons.js +7 -7
  98. package/layout/types.d.ts +57 -0
  99. package/layout/types.js +5 -0
  100. package/link/Link.d.ts +3 -0
  101. package/link/Link.js +19 -95
  102. package/link/Link.stories.tsx +146 -0
  103. package/link/types.d.ts +74 -0
  104. package/link/types.js +5 -0
  105. package/list/List.d.ts +8 -0
  106. package/list/List.js +47 -0
  107. package/list/List.stories.tsx +85 -0
  108. package/main.d.ts +48 -40
  109. package/main.js +118 -82
  110. package/number-input/NumberInput.d.ts +4 -0
  111. package/number-input/NumberInput.js +10 -63
  112. package/number-input/NumberInput.stories.tsx +115 -0
  113. package/number-input/NumberInputContext.d.ts +4 -0
  114. package/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 +15 -12
  120. package/paginator/Icons.js +9 -9
  121. package/paginator/Paginator.d.ts +4 -0
  122. package/paginator/Paginator.js +26 -139
  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/password-input/PasswordInput.js +37 -77
  128. package/password-input/PasswordInput.stories.tsx +131 -0
  129. package/password-input/types.d.ts +107 -0
  130. package/password-input/types.js +5 -0
  131. package/progress-bar/ProgressBar.d.ts +4 -0
  132. package/progress-bar/ProgressBar.js +22 -94
  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/radio/Radio.js +17 -52
  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/resultsetTable/ResultsetTable.js +39 -146
  143. package/resultsetTable/ResultsetTable.stories.tsx +276 -0
  144. package/resultsetTable/types.d.ts +67 -0
  145. package/resultsetTable/types.js +5 -0
  146. package/row/Row.d.ts +11 -0
  147. package/row/Row.js +124 -0
  148. package/row/Row.stories.tsx +223 -0
  149. package/select/Select.d.ts +4 -0
  150. package/select/Select.js +173 -448
  151. package/select/Select.stories.tsx +572 -0
  152. package/select/types.d.ts +170 -0
  153. package/select/types.js +5 -0
  154. package/sidenav/Sidenav.d.ts +9 -0
  155. package/sidenav/Sidenav.js +21 -64
  156. package/sidenav/Sidenav.stories.tsx +165 -0
  157. package/sidenav/types.d.ts +50 -0
  158. package/sidenav/types.js +5 -0
  159. package/slider/Slider.d.ts +4 -0
  160. package/slider/Slider.js +74 -161
  161. package/slider/Slider.stories.tsx +177 -0
  162. package/slider/types.d.ts +78 -0
  163. package/slider/types.js +5 -0
  164. package/spinner/Spinner.d.ts +4 -0
  165. package/spinner/Spinner.js +45 -176
  166. package/spinner/Spinner.stories.jsx +102 -0
  167. package/spinner/types.d.ts +32 -0
  168. package/spinner/types.js +5 -0
  169. package/stack/Stack.d.ts +10 -0
  170. package/stack/Stack.js +94 -0
  171. package/stack/Stack.stories.tsx +150 -0
  172. package/switch/Switch.d.ts +4 -0
  173. package/switch/Switch.js +28 -71
  174. package/switch/Switch.stories.tsx +160 -0
  175. package/switch/types.d.ts +58 -0
  176. package/switch/types.js +5 -0
  177. package/table/Table.d.ts +4 -0
  178. package/table/Table.js +12 -26
  179. package/table/Table.stories.jsx +276 -0
  180. package/table/types.d.ts +21 -0
  181. package/table/types.js +5 -0
  182. package/tabs/Tabs.d.ts +4 -0
  183. package/tabs/Tabs.js +32 -162
  184. package/tabs/Tabs.stories.tsx +121 -0
  185. package/tabs/types.d.ts +70 -0
  186. package/tabs/types.js +5 -0
  187. package/tag/Tag.d.ts +4 -0
  188. package/tag/Tag.js +38 -127
  189. package/tag/Tag.stories.tsx +145 -0
  190. package/tag/types.d.ts +60 -0
  191. package/tag/types.js +5 -0
  192. package/text/Text.d.ts +7 -0
  193. package/text/Text.js +30 -0
  194. package/text/Text.stories.tsx +19 -0
  195. package/text-input/TextInput.d.ts +4 -0
  196. package/text-input/TextInput.js +134 -340
  197. package/text-input/TextInput.stories.tsx +456 -0
  198. package/text-input/types.d.ts +159 -0
  199. package/text-input/types.js +5 -0
  200. package/textarea/Textarea.d.ts +4 -0
  201. package/textarea/Textarea.js +38 -123
  202. package/textarea/Textarea.stories.jsx +135 -0
  203. package/textarea/types.d.ts +130 -0
  204. package/textarea/types.js +5 -0
  205. package/toggle/Toggle.js +16 -50
  206. package/toggle-group/ToggleGroup.d.ts +4 -0
  207. package/toggle-group/ToggleGroup.js +35 -148
  208. package/toggle-group/ToggleGroup.stories.tsx +173 -0
  209. package/toggle-group/types.d.ts +97 -0
  210. package/toggle-group/types.js +5 -0
  211. package/upload/Upload.js +11 -15
  212. package/upload/buttons-upload/ButtonsUpload.js +15 -39
  213. package/upload/buttons-upload/Icons.js +7 -7
  214. package/upload/dragAndDropArea/DragAndDropArea.js +26 -130
  215. package/upload/dragAndDropArea/Icons.js +6 -6
  216. package/upload/file-upload/FileToUpload.js +17 -91
  217. package/upload/file-upload/Icons.js +13 -13
  218. package/upload/files-upload/FilesToUpload.js +13 -27
  219. package/upload/transaction/Icons.js +31 -31
  220. package/upload/transaction/Transaction.js +19 -63
  221. package/upload/transactions/Transactions.js +14 -58
  222. package/useTheme.d.ts +2 -0
  223. package/useTheme.js +1 -1
  224. package/wizard/Wizard.d.ts +4 -0
  225. package/wizard/Wizard.js +90 -214
  226. package/wizard/Wizard.stories.tsx +224 -0
  227. package/wizard/types.d.ts +60 -0
  228. package/wizard/types.js +5 -0
  229. package/accordion/index.d.ts +0 -28
  230. package/accordion-group/index.d.ts +0 -16
  231. package/alert/index.d.ts +0 -51
  232. package/box/index.d.ts +0 -25
  233. package/button/Button.stories.js +0 -27
  234. package/button/index.d.ts +0 -24
  235. package/card/index.d.ts +0 -22
  236. package/checkbox/index.d.ts +0 -24
  237. package/chip/index.d.ts +0 -22
  238. package/date-input/index.d.ts +0 -95
  239. package/dialog/index.d.ts +0 -18
  240. package/dropdown/index.d.ts +0 -26
  241. package/file-input/index.d.ts +0 -81
  242. package/footer/index.d.ts +0 -25
  243. package/header/index.d.ts +0 -25
  244. package/heading/index.d.ts +0 -17
  245. package/link/index.d.ts +0 -23
  246. package/number-input/index.d.ts +0 -113
  247. package/paginator/index.d.ts +0 -20
  248. package/password-input/index.d.ts +0 -94
  249. package/progress-bar/index.d.ts +0 -18
  250. package/radio/index.d.ts +0 -23
  251. package/resultsetTable/index.d.ts +0 -19
  252. package/select/index.d.ts +0 -131
  253. package/sidenav/index.d.ts +0 -13
  254. package/slider/index.d.ts +0 -29
  255. package/spinner/index.d.ts +0 -17
  256. package/switch/index.d.ts +0 -24
  257. package/table/index.d.ts +0 -13
  258. package/tabs/index.d.ts +0 -19
  259. package/tag/index.d.ts +0 -24
  260. package/text-input/index.d.ts +0 -135
  261. package/textarea/index.d.ts +0 -117
  262. package/toggle-group/index.d.ts +0 -21
  263. package/wizard/Icons.js +0 -65
  264. package/wizard/index.d.ts +0 -18
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import AccordionGroupPropsType, { AccordionPropsType } from "./types";
3
+ declare const DxcAccordionGroup: {
4
+ ({ indexActive, disabled, onActiveChange, margin, children, }: AccordionGroupPropsType): JSX.Element;
5
+ Accordion: ({ ...childProps }: AccordionPropsType) => JSX.Element;
6
+ };
7
+ export default DxcAccordionGroup;
@@ -1,108 +1,119 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
-
5
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
4
 
5
+ var _typeof3 = require("@babel/runtime/helpers/typeof");
6
+
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
10
  exports["default"] = void 0;
11
11
 
12
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
-
14
12
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
15
13
 
16
14
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
17
15
 
16
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
+
18
18
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
19
19
 
20
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
20
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
21
21
 
22
22
  var _react = _interopRequireWildcard(require("react"));
23
23
 
24
24
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
25
25
 
26
- var _propTypes = _interopRequireDefault(require("prop-types"));
27
-
28
26
  var _Accordion = _interopRequireDefault(require("../accordion/Accordion"));
29
27
 
30
28
  var _utils = require("../common/utils.js");
31
29
 
32
30
  var _variables = require("../common/variables.js");
33
31
 
34
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
32
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
33
+
34
+ var _templateObject;
35
+
36
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
37
+
38
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
39
 
36
- function _templateObject() {
37
- var data = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n cursor: ", ";\n\n & > :not(div:last-child) {\n & > div:first-child {\n border-radius: 0;\n border-bottom: ", ";\n border-color: ", ";\n\n & > .Mui-expanded {\n border-radius: 0;\n }\n\n & > .MuiButtonBase-root {\n border-radius: 0;\n }\n }\n }\n\n & > div:first-child {\n & > div:first-child {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n border-top-left-radius: ", ";\n border-top-right-radius: ", ";\n border-bottom: ", ";\n border-color: ", ";\n\n & > .Mui-expanded {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n border-top-left-radius: ", ";\n border-top-right-radius: ", ";\n }\n\n & > .MuiButtonBase-root {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n border-top-left-radius: ", ";\n border-top-right-radius: ", ";\n }\n }\n }\n\n & > div:last-child {\n & > div:first-child {\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n\n & > .Mui-expanded {\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n }\n\n & > .MuiButtonBase-root {\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n }\n }\n }\n"]);
40
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
38
41
 
39
- _templateObject = function _templateObject() {
40
- return data;
41
- };
42
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
42
43
 
43
- return data;
44
- }
44
+ var AccordionGroupAccordionContext = /*#__PURE__*/(0, _react.createContext)(null);
45
45
 
46
- var Accordion = function Accordion(_ref) {
47
- var margin = _ref.margin,
48
- childProps = (0, _objectWithoutProperties2["default"])(_ref, ["margin"]);
49
- return _react["default"].createElement(_Accordion["default"], childProps, childProps.children);
46
+ var AccordionGroupAccordion = function AccordionGroupAccordion(_ref) {
47
+ var childProps = (0, _extends2["default"])({}, _ref);
48
+
49
+ var _useContext = (0, _react.useContext)(AccordionGroupAccordionContext),
50
+ innerIsExpanded = _useContext.innerIsExpanded,
51
+ handlerActiveChange = _useContext.handlerActiveChange,
52
+ disabled = _useContext.disabled,
53
+ index = _useContext.index;
54
+
55
+ return /*#__PURE__*/_react["default"].createElement(_Accordion["default"], (0, _extends2["default"])({
56
+ isExpanded: innerIsExpanded === index,
57
+ onChange: function onChange() {
58
+ handlerActiveChange(index);
59
+ },
60
+ disabled: disabled
61
+ }, childProps), childProps.children);
50
62
  };
51
63
 
52
64
  var DxcAccordionGroup = function DxcAccordionGroup(_ref2) {
53
- var _ref2$disabled = _ref2.disabled,
65
+ var indexActive = _ref2.indexActive,
66
+ _ref2$disabled = _ref2.disabled,
54
67
  disabled = _ref2$disabled === void 0 ? false : _ref2$disabled,
55
68
  onActiveChange = _ref2.onActiveChange,
56
- _ref2$indexActive = _ref2.indexActive,
57
- indexActive = _ref2$indexActive === void 0 ? undefined : _ref2$indexActive,
58
69
  margin = _ref2.margin,
59
- _ref2$children = _ref2.children,
60
- children = _ref2$children === void 0 ? [] : _ref2$children;
70
+ children = _ref2.children;
61
71
  var colorsTheme = (0, _useTheme["default"])();
62
72
 
63
- var _React$useState = _react["default"].useState(indexActive),
64
- _React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
65
- innerIsExpanded = _React$useState2[0],
66
- setInnerIsExpanded = _React$useState2[1];
67
-
68
- var handlerActiveChange = function handlerActiveChange(index) {
69
- if (indexActive === undefined) {
70
- setInnerIsExpanded(index === innerIsExpanded ? -1 : index);
71
- } else {
72
- setInnerIsExpanded(indexActive);
73
- }
74
-
75
- if (typeof onActiveChange === "function" && !disabled) {
76
- onActiveChange(index);
77
- }
78
- };
79
-
73
+ var _useState = (0, _react.useState)(0),
74
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
75
+ innerIsExpanded = _useState2[0],
76
+ setInnerIsExpanded = _useState2[1];
77
+
78
+ var handlerActiveChange = (0, _react.useCallback)(function (index) {
79
+ indexActive === undefined ? setInnerIsExpanded(function (prev) {
80
+ return index === prev ? -1 : index;
81
+ }) : setInnerIsExpanded(indexActive);
82
+ !disabled && (onActiveChange === null || onActiveChange === void 0 ? void 0 : onActiveChange(index));
83
+ }, [disabled, indexActive, onActiveChange]);
84
+ var value = (0, _react.useMemo)(function () {
85
+ return {
86
+ innerIsExpanded: innerIsExpanded,
87
+ handlerActiveChange: handlerActiveChange,
88
+ disabled: disabled
89
+ };
90
+ }, [innerIsExpanded, disabled]);
80
91
  (0, _react.useEffect)(function () {
81
92
  setInnerIsExpanded(indexActive);
82
93
  }, [indexActive]);
83
- return _react["default"].createElement(_styledComponents.ThemeProvider, {
94
+ return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
84
95
  theme: colorsTheme.accordion
85
- }, _react["default"].createElement(AccordionGroupContainer, {
96
+ }, /*#__PURE__*/_react["default"].createElement(AccordionGroupContainer, {
86
97
  margin: margin,
87
98
  disabled: disabled
88
- }, (Array.isArray(children) ? children : [children]).filter(function (el) {
89
- return el.type === Accordion;
90
- }).map(function (el, index) {
91
- return _react["default"].cloneElement(el, {
92
- onChange: function onChange() {
93
- handlerActiveChange(index);
94
- },
95
- isExpanded: index === innerIsExpanded,
96
- disabled: disabled || el.props.disabled
97
- });
99
+ }, (Array.isArray(children) ? children : [children]).filter(function (child) {
100
+ return child.type === AccordionGroupAccordion;
101
+ }).map(function (accordion, index) {
102
+ return /*#__PURE__*/_react["default"].createElement(AccordionGroupAccordionContext.Provider, {
103
+ value: _objectSpread({
104
+ index: index
105
+ }, value)
106
+ }, accordion);
98
107
  })));
99
108
  };
100
109
 
110
+ DxcAccordionGroup.Accordion = AccordionGroupAccordion;
111
+
101
112
  var calculateWidth = function calculateWidth(margin) {
102
113
  return "calc(100% - ".concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
103
114
  };
104
115
 
105
- var AccordionGroupContainer = _styledComponents["default"].div(_templateObject(), function (props) {
116
+ var AccordionGroupContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-block;\n width: ", ";\n\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n cursor: ", ";\n\n & > :not(div:last-child) {\n & > div:first-child {\n border-radius: 0;\n border-bottom: ", ";\n border-color: ", ";\n\n & > .Mui-expanded {\n border-radius: 0;\n }\n & > .MuiButtonBase-root {\n border-radius: 0;\n }\n }\n }\n\n & > div:first-child {\n & > div:first-child {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n border-top-left-radius: ", ";\n border-top-right-radius: ", ";\n border-bottom: ", ";\n border-color: ", ";\n\n & > .Mui-expanded {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n border-top-left-radius: ", ";\n border-top-right-radius: ", ";\n }\n & > .MuiButtonBase-root {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n border-top-left-radius: ", ";\n border-top-right-radius: ", ";\n }\n }\n }\n\n & > div:last-child {\n & > div:first-child {\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n\n & > .Mui-expanded {\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n }\n & > .MuiButtonBase-root {\n border-bottom-left-radius: ", ";\n border-bottom-right-radius: ", ";\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n }\n }\n }\n"])), function (props) {
106
117
  return calculateWidth(props.margin);
107
118
  }, function (_ref3) {
108
119
  var margin = _ref3.margin;
@@ -120,7 +131,7 @@ var AccordionGroupContainer = _styledComponents["default"].div(_templateObject()
120
131
  var margin = _ref7.margin;
121
132
  return margin && (0, _typeof2["default"])(margin) === "object" && margin.left ? _variables.spaces[margin.left] : "";
122
133
  }, function (props) {
123
- return props.disabled && "not-allowed" || "pointer";
134
+ return props.disabled ? "not-allowed" : "pointer";
124
135
  }, function (props) {
125
136
  return "".concat(props.theme.accordionGroupSeparatorBorderThickness, " ").concat(props.theme.accordionGroupSeparatorBorderStyle);
126
137
  }, function (props) {
@@ -155,32 +166,5 @@ var AccordionGroupContainer = _styledComponents["default"].div(_templateObject()
155
166
  return props.theme.borderRadius;
156
167
  });
157
168
 
158
- DxcAccordionGroup.propTypes = {
159
- disabled: _propTypes["default"].bool,
160
- onActiveChange: _propTypes["default"].func,
161
- indexActive: _propTypes["default"].number,
162
- children: _propTypes["default"].arrayOf(_propTypes["default"].shape({
163
- label: _propTypes["default"].string,
164
- icon: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].func]),
165
- iconSrc: _propTypes["default"].string,
166
- iconPosition: _propTypes["default"].oneOf(["before", "after"]),
167
- assistiveText: _propTypes["default"].string,
168
- disabled: _propTypes["default"].bool,
169
- children: _propTypes["default"].element,
170
- padding: _propTypes["default"].oneOfType([_propTypes["default"].shape({
171
- top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
172
- bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
173
- left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
174
- right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
175
- }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))])
176
- })),
177
- margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
178
- top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
179
- bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
180
- left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
181
- right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
182
- }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))])
183
- };
184
- DxcAccordionGroup.Accordion = Accordion;
185
169
  var _default = DxcAccordionGroup;
186
170
  exports["default"] = _default;
@@ -0,0 +1,225 @@
1
+ import React from "react";
2
+ import DxcAccordionGroup from "./AccordionGroup";
3
+ import Title from "../../.storybook/components/Title";
4
+ import ExampleContainer from "../../.storybook/components/ExampleContainer";
5
+
6
+ export default {
7
+ title: "Accordion group",
8
+ component: DxcAccordionGroup,
9
+ };
10
+
11
+ export const Chromatic = () => (
12
+ <>
13
+ <Title title="States" theme="light" level={2} />
14
+ <ExampleContainer>
15
+ <Title title="Default" theme="light" level={4} />
16
+ <DxcAccordionGroup>
17
+ <DxcAccordionGroup.Accordion label="Accordion1" assistiveText="Assistive text" padding="medium">
18
+ <div>
19
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
20
+ leo lobortis eget.
21
+ </div>
22
+ </DxcAccordionGroup.Accordion>
23
+ <DxcAccordionGroup.Accordion label="Accordion2" assistiveText="Assistive text" padding="medium">
24
+ <div>
25
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
26
+ leo lobortis eget.
27
+ </div>
28
+ </DxcAccordionGroup.Accordion>
29
+ <DxcAccordionGroup.Accordion label="Accordion2" assistiveText="Assistive text" padding="medium">
30
+ <div>
31
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
32
+ leo lobortis eget.
33
+ </div>
34
+ </DxcAccordionGroup.Accordion>
35
+ </DxcAccordionGroup>
36
+ </ExampleContainer>
37
+ <ExampleContainer>
38
+ <Title title="Expanded" theme="light" level={4} />
39
+ <DxcAccordionGroup indexActive={1}>
40
+ <DxcAccordionGroup.Accordion label="Accordion1" padding="medium">
41
+ <div>
42
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
43
+ dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
44
+ ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
45
+ nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
46
+ anim id est laborum.
47
+ </div>
48
+ </DxcAccordionGroup.Accordion>
49
+ <DxcAccordionGroup.Accordion label="Accordion2" padding="medium">
50
+ <div>
51
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
52
+ leo lobortis eget.
53
+ </div>
54
+ </DxcAccordionGroup.Accordion>
55
+ <DxcAccordionGroup.Accordion label="Accordion2" padding="medium">
56
+ <div>
57
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
58
+ leo lobortis eget.
59
+ </div>
60
+ </DxcAccordionGroup.Accordion>
61
+ </DxcAccordionGroup>
62
+ </ExampleContainer>
63
+ <ExampleContainer>
64
+ <Title title="Disabled" theme="light" level={4} />
65
+ <DxcAccordionGroup disabled>
66
+ <DxcAccordionGroup.Accordion label="Accordion1" padding="medium">
67
+ <div>
68
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
69
+ dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
70
+ ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
71
+ nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
72
+ anim id est laborum.
73
+ </div>
74
+ </DxcAccordionGroup.Accordion>
75
+ <DxcAccordionGroup.Accordion label="Accordion2" padding="medium">
76
+ <div>
77
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
78
+ leo lobortis eget.
79
+ </div>
80
+ </DxcAccordionGroup.Accordion>
81
+ </DxcAccordionGroup>
82
+ </ExampleContainer>
83
+ <Title title="Margins" theme="light" level={2} />
84
+ <ExampleContainer>
85
+ <Title title="Xxsmall" theme="light" level={4} />
86
+ <DxcAccordionGroup margin="xxsmall">
87
+ <DxcAccordionGroup.Accordion label="Accordion1" padding="medium">
88
+ <div>
89
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
90
+ dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
91
+ ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
92
+ nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
93
+ anim id est laborum.
94
+ </div>
95
+ </DxcAccordionGroup.Accordion>
96
+ <DxcAccordionGroup.Accordion label="Accordion2" padding="medium">
97
+ <div>
98
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
99
+ leo lobortis eget.
100
+ </div>
101
+ </DxcAccordionGroup.Accordion>
102
+ </DxcAccordionGroup>
103
+ </ExampleContainer>
104
+ <ExampleContainer>
105
+ <Title title="Xsmall" theme="light" level={4} />
106
+ <DxcAccordionGroup margin="xsmall">
107
+ <DxcAccordionGroup.Accordion label="Accordion1" padding="medium">
108
+ <div>
109
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
110
+ dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
111
+ ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
112
+ nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
113
+ anim id est laborum.
114
+ </div>
115
+ </DxcAccordionGroup.Accordion>
116
+ <DxcAccordionGroup.Accordion label="Accordion2" padding="medium">
117
+ <div>
118
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
119
+ leo lobortis eget.
120
+ </div>
121
+ </DxcAccordionGroup.Accordion>
122
+ </DxcAccordionGroup>
123
+ </ExampleContainer>
124
+ <ExampleContainer>
125
+ <Title title="Small" theme="light" level={4} />
126
+ <DxcAccordionGroup margin="small">
127
+ <DxcAccordionGroup.Accordion label="Accordion1" padding="medium">
128
+ <div>
129
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
130
+ dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
131
+ ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
132
+ nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
133
+ anim id est laborum.
134
+ </div>
135
+ </DxcAccordionGroup.Accordion>
136
+ <DxcAccordionGroup.Accordion label="Accordion2" padding="medium">
137
+ <div>
138
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
139
+ leo lobortis eget.
140
+ </div>
141
+ </DxcAccordionGroup.Accordion>
142
+ </DxcAccordionGroup>
143
+ </ExampleContainer>
144
+ <ExampleContainer>
145
+ <Title title="Medium" theme="light" level={4} />
146
+ <DxcAccordionGroup margin="medium">
147
+ <DxcAccordionGroup.Accordion label="Accordion1" padding="medium">
148
+ <div>
149
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
150
+ dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
151
+ ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
152
+ nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
153
+ anim id est laborum.
154
+ </div>
155
+ </DxcAccordionGroup.Accordion>
156
+ <DxcAccordionGroup.Accordion label="Accordion2" padding="medium">
157
+ <div>
158
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
159
+ leo lobortis eget.
160
+ </div>
161
+ </DxcAccordionGroup.Accordion>
162
+ </DxcAccordionGroup>
163
+ </ExampleContainer>
164
+ <ExampleContainer>
165
+ <Title title="Large" theme="light" level={4} />
166
+ <DxcAccordionGroup margin="large">
167
+ <DxcAccordionGroup.Accordion label="Accordion1" padding="medium">
168
+ <div>
169
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
170
+ dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
171
+ ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
172
+ nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
173
+ anim id est laborum.
174
+ </div>
175
+ </DxcAccordionGroup.Accordion>
176
+ <DxcAccordionGroup.Accordion label="Accordion2" padding="medium">
177
+ <div>
178
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
179
+ leo lobortis eget.
180
+ </div>
181
+ </DxcAccordionGroup.Accordion>
182
+ </DxcAccordionGroup>
183
+ </ExampleContainer>
184
+ <ExampleContainer>
185
+ <Title title="Xlarge" theme="light" level={4} />
186
+ <DxcAccordionGroup margin="xlarge">
187
+ <DxcAccordionGroup.Accordion label="Accordion1" padding="medium">
188
+ <div>
189
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
190
+ dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
191
+ ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
192
+ nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
193
+ anim id est laborum.
194
+ </div>
195
+ </DxcAccordionGroup.Accordion>
196
+ <DxcAccordionGroup.Accordion label="Accordion2" padding="medium">
197
+ <div>
198
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
199
+ leo lobortis eget.
200
+ </div>
201
+ </DxcAccordionGroup.Accordion>
202
+ </DxcAccordionGroup>
203
+ </ExampleContainer>
204
+ <ExampleContainer>
205
+ <Title title="Xxlarge" theme="light" level={4} />
206
+ <DxcAccordionGroup margin="xxlarge">
207
+ <DxcAccordionGroup.Accordion label="Accordion1" padding="medium">
208
+ <div>
209
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et
210
+ dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
211
+ ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat
212
+ nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit
213
+ anim id est laborum.
214
+ </div>
215
+ </DxcAccordionGroup.Accordion>
216
+ <DxcAccordionGroup.Accordion label="Accordion2" padding="medium">
217
+ <div>
218
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
219
+ leo lobortis eget.
220
+ </div>
221
+ </DxcAccordionGroup.Accordion>
222
+ </DxcAccordionGroup>
223
+ </ExampleContainer>
224
+ </>
225
+ );
@@ -0,0 +1,72 @@
1
+ /// <reference types="react" />
2
+ declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
+ declare type Margin = {
4
+ top?: Space;
5
+ bottom?: Space;
6
+ left?: Space;
7
+ right?: Space;
8
+ };
9
+ declare type Padding = {
10
+ top?: Space;
11
+ bottom?: Space;
12
+ left?: Space;
13
+ right?: Space;
14
+ };
15
+ declare type SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
16
+ export declare type AccordionPropsType = {
17
+ /**
18
+ * The panel label.
19
+ */
20
+ label: string;
21
+ /**
22
+ * Element used as the icon that will be placed next to panel label.
23
+ */
24
+ icon?: SVG;
25
+ /**
26
+ * @deprecated URL of the icon that will be placed next to panel label.
27
+ */
28
+ iconSrc?: string;
29
+ /**
30
+ * Assistive text to be placed on the right side of the panel.
31
+ */
32
+ assistiveText?: string;
33
+ /**
34
+ * If true, the component will be disabled.
35
+ */
36
+ disabled?: boolean;
37
+ /**
38
+ * Size of the padding to be applied to the custom area ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
39
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different padding sizes.
40
+ */
41
+ padding?: Space | Padding;
42
+ /**
43
+ * The expanded panel of the accordion. This area can be used to render
44
+ * custom content.
45
+ */
46
+ children: React.ReactNode;
47
+ };
48
+ declare type Props = {
49
+ /**
50
+ * The index of the active accordion. If undefined, the component will be uncontrolled and the active accordion will be managed internally by the component.
51
+ * If null, the component will be controlled and all accordions will be closed.
52
+ */
53
+ indexActive?: number;
54
+ /**
55
+ * If true, the component will be disabled.
56
+ */
57
+ disabled?: boolean;
58
+ /**
59
+ * This function will be called when the user clicks on an accordion. The index of the clicked accordion will be passed as a parameter.
60
+ */
61
+ onActiveChange?: (indexActive: number) => void;
62
+ /**
63
+ * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
64
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
65
+ */
66
+ margin?: Space | Margin;
67
+ /**
68
+ * Customized accordion(s) that are allowed inside an Accordion Group.
69
+ */
70
+ children: React.ReactElement<AccordionPropsType>[] | React.ReactElement<AccordionPropsType>;
71
+ };
72
+ export default Props;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import AlertPropsType from "./types";
3
+ declare const DxcAlert: ({ type, mode, inlineText, onClose, children, margin, size, tabIndex, }: AlertPropsType) => JSX.Element;
4
+ export default DxcAlert;