@dxc-technology/halstack-react 10.1.0 → 11.0.0

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 (210) hide show
  1. package/BackgroundColorContext.d.ts +2 -2
  2. package/BackgroundColorContext.js +5 -17
  3. package/HalstackContext.d.ts +18 -6
  4. package/HalstackContext.js +9 -34
  5. package/accordion/Accordion.js +21 -58
  6. package/accordion/Accordion.stories.tsx +1 -15
  7. package/accordion/Accordion.test.js +18 -33
  8. package/accordion/types.d.ts +5 -5
  9. package/accordion-group/AccordionGroup.js +15 -42
  10. package/accordion-group/AccordionGroup.stories.tsx +1 -1
  11. package/accordion-group/AccordionGroup.test.js +42 -60
  12. package/accordion-group/AccordionGroupAccordion.js +9 -21
  13. package/accordion-group/types.d.ts +6 -6
  14. package/alert/Alert.js +14 -46
  15. package/alert/Alert.test.js +28 -45
  16. package/alert/types.d.ts +5 -5
  17. package/badge/Badge.js +4 -17
  18. package/badge/types.d.ts +1 -1
  19. package/bleed/Bleed.js +13 -21
  20. package/bleed/types.d.ts +2 -2
  21. package/box/Box.js +10 -29
  22. package/box/Box.test.js +1 -6
  23. package/box/types.d.ts +3 -3
  24. package/bulleted-list/BulletedList.js +7 -33
  25. package/bulleted-list/BulletedList.stories.tsx +1 -91
  26. package/bulleted-list/types.d.ts +5 -5
  27. package/button/Button.js +23 -46
  28. package/button/Button.stories.tsx +5 -86
  29. package/button/Button.test.js +11 -21
  30. package/button/types.d.ts +4 -4
  31. package/card/Card.js +21 -44
  32. package/card/Card.test.js +10 -21
  33. package/card/types.d.ts +5 -5
  34. package/checkbox/Checkbox.js +81 -111
  35. package/checkbox/Checkbox.stories.tsx +16 -54
  36. package/checkbox/Checkbox.test.js +107 -63
  37. package/checkbox/types.d.ts +8 -4
  38. package/chip/Chip.js +12 -31
  39. package/chip/Chip.test.js +15 -28
  40. package/chip/types.d.ts +4 -4
  41. package/common/coreTokens.js +1 -2
  42. package/common/utils.js +2 -8
  43. package/common/variables.d.ts +15 -6
  44. package/common/variables.js +17 -15
  45. package/date-input/Calendar.js +13 -57
  46. package/date-input/DateInput.js +50 -96
  47. package/date-input/DateInput.stories.tsx +11 -30
  48. package/date-input/DateInput.test.js +674 -701
  49. package/date-input/DatePicker.js +11 -42
  50. package/date-input/Icons.d.ts +6 -6
  51. package/date-input/Icons.js +6 -23
  52. package/date-input/YearPicker.js +8 -34
  53. package/date-input/types.d.ts +27 -21
  54. package/dialog/Dialog.js +11 -35
  55. package/dialog/Dialog.test.js +125 -187
  56. package/dialog/types.d.ts +18 -13
  57. package/dropdown/Dropdown.js +39 -93
  58. package/dropdown/Dropdown.test.js +391 -378
  59. package/dropdown/DropdownMenu.js +8 -19
  60. package/dropdown/DropdownMenuItem.js +5 -17
  61. package/dropdown/types.d.ts +17 -19
  62. package/file-input/FileInput.js +131 -220
  63. package/file-input/FileInput.stories.tsx +1 -1
  64. package/file-input/FileInput.test.js +293 -342
  65. package/file-input/FileItem.js +12 -39
  66. package/file-input/types.d.ts +9 -9
  67. package/flex/Flex.js +25 -39
  68. package/flex/types.d.ts +6 -6
  69. package/footer/Footer.js +9 -39
  70. package/footer/Footer.test.js +18 -32
  71. package/footer/Icons.d.ts +2 -2
  72. package/footer/Icons.js +2 -7
  73. package/footer/types.d.ts +13 -13
  74. package/grid/Grid.js +1 -16
  75. package/grid/types.d.ts +10 -10
  76. package/header/Header.d.ts +1 -1
  77. package/header/Header.js +19 -64
  78. package/header/Header.test.js +12 -25
  79. package/header/Icons.d.ts +2 -2
  80. package/header/Icons.js +2 -7
  81. package/header/types.d.ts +5 -7
  82. package/heading/Heading.js +9 -31
  83. package/heading/Heading.test.js +70 -87
  84. package/heading/types.d.ts +7 -7
  85. package/image/Image.d.ts +2 -2
  86. package/image/Image.js +17 -32
  87. package/image/types.d.ts +2 -2
  88. package/inset/Inset.js +13 -21
  89. package/inset/types.d.ts +2 -2
  90. package/layout/ApplicationLayout.d.ts +1 -1
  91. package/layout/ApplicationLayout.js +14 -54
  92. package/layout/Icons.d.ts +5 -5
  93. package/layout/Icons.js +1 -5
  94. package/layout/SidenavContext.d.ts +1 -1
  95. package/layout/SidenavContext.js +3 -9
  96. package/layout/types.d.ts +3 -3
  97. package/link/Link.js +21 -42
  98. package/link/Link.test.js +23 -41
  99. package/link/types.d.ts +14 -14
  100. package/main.d.ts +1 -1
  101. package/main.js +3 -52
  102. package/nav-tabs/NavTabs.js +11 -43
  103. package/nav-tabs/NavTabs.stories.tsx +1 -1
  104. package/nav-tabs/NavTabs.test.js +36 -43
  105. package/nav-tabs/Tab.js +16 -45
  106. package/nav-tabs/types.d.ts +9 -9
  107. package/number-input/NumberInput.d.ts +1 -1
  108. package/number-input/NumberInput.js +24 -35
  109. package/number-input/NumberInput.stories.tsx +42 -26
  110. package/number-input/NumberInput.test.js +682 -577
  111. package/number-input/types.d.ts +11 -5
  112. package/package.json +27 -25
  113. package/paginator/Icons.d.ts +5 -5
  114. package/paginator/Icons.js +5 -19
  115. package/paginator/Paginator.js +14 -39
  116. package/paginator/Paginator.test.js +224 -207
  117. package/paginator/types.d.ts +3 -3
  118. package/paragraph/Paragraph.js +3 -14
  119. package/paragraph/Paragraph.stories.tsx +0 -17
  120. package/password-input/Icons.d.ts +3 -3
  121. package/password-input/Icons.js +1 -5
  122. package/password-input/PasswordInput.js +26 -48
  123. package/password-input/PasswordInput.stories.tsx +1 -33
  124. package/password-input/PasswordInput.test.js +153 -129
  125. package/password-input/types.d.ts +8 -7
  126. package/progress-bar/ProgressBar.js +16 -42
  127. package/progress-bar/{ProgressBar.stories.jsx → ProgressBar.stories.tsx} +1 -1
  128. package/progress-bar/ProgressBar.test.js +35 -52
  129. package/progress-bar/types.d.ts +3 -3
  130. package/quick-nav/QuickNav.js +4 -27
  131. package/quick-nav/QuickNav.stories.tsx +1 -1
  132. package/quick-nav/types.d.ts +10 -10
  133. package/radio-group/Radio.d.ts +1 -1
  134. package/radio-group/Radio.js +22 -54
  135. package/radio-group/RadioGroup.js +37 -83
  136. package/radio-group/RadioGroup.stories.tsx +10 -10
  137. package/radio-group/RadioGroup.test.js +504 -470
  138. package/radio-group/types.d.ts +8 -8
  139. package/resultset-table/Icons.d.ts +7 -0
  140. package/{resultsetTable → resultset-table}/Icons.js +1 -5
  141. package/{resultsetTable → resultset-table}/ResultsetTable.js +22 -58
  142. package/{resultsetTable → resultset-table}/ResultsetTable.test.js +72 -92
  143. package/{resultsetTable → resultset-table}/types.d.ts +7 -7
  144. package/select/Icons.d.ts +7 -7
  145. package/select/Icons.js +1 -5
  146. package/select/Listbox.js +13 -39
  147. package/select/Option.js +9 -26
  148. package/select/Select.js +54 -138
  149. package/select/Select.test.js +1902 -1796
  150. package/select/types.d.ts +14 -15
  151. package/sidenav/Icons.d.ts +4 -4
  152. package/sidenav/Icons.js +1 -5
  153. package/sidenav/Sidenav.js +24 -63
  154. package/sidenav/Sidenav.test.js +3 -10
  155. package/sidenav/types.d.ts +18 -18
  156. package/slider/Slider.js +38 -86
  157. package/slider/Slider.test.js +107 -103
  158. package/slider/types.d.ts +4 -4
  159. package/spinner/Spinner.js +10 -40
  160. package/spinner/Spinner.test.js +25 -34
  161. package/spinner/types.d.ts +3 -3
  162. package/switch/Switch.js +26 -69
  163. package/switch/Switch.stories.tsx +0 -34
  164. package/switch/Switch.test.js +51 -96
  165. package/switch/types.d.ts +4 -4
  166. package/table/Table.js +4 -23
  167. package/table/Table.test.js +1 -6
  168. package/table/types.d.ts +8 -8
  169. package/tabs/Tab.js +10 -29
  170. package/tabs/Tabs.js +48 -124
  171. package/tabs/Tabs.test.js +62 -118
  172. package/tabs/types.d.ts +19 -19
  173. package/tag/Tag.js +21 -51
  174. package/tag/Tag.test.js +19 -30
  175. package/tag/types.d.ts +7 -7
  176. package/text-input/Icons.d.ts +5 -5
  177. package/text-input/Icons.js +1 -5
  178. package/text-input/Suggestion.js +9 -26
  179. package/text-input/Suggestions.d.ts +1 -1
  180. package/text-input/Suggestions.js +12 -57
  181. package/text-input/TextInput.js +128 -193
  182. package/text-input/TextInput.stories.tsx +48 -152
  183. package/text-input/TextInput.test.js +1210 -1194
  184. package/text-input/types.d.ts +25 -17
  185. package/textarea/Textarea.js +60 -96
  186. package/textarea/{Textarea.stories.jsx → Textarea.stories.tsx} +58 -99
  187. package/textarea/Textarea.test.js +150 -179
  188. package/textarea/types.d.ts +9 -5
  189. package/toggle-group/ToggleGroup.js +20 -57
  190. package/toggle-group/ToggleGroup.stories.tsx +1 -1
  191. package/toggle-group/ToggleGroup.test.js +48 -81
  192. package/toggle-group/types.d.ts +10 -10
  193. package/typography/Typography.js +4 -13
  194. package/typography/types.d.ts +1 -1
  195. package/useTheme.d.ts +12 -3
  196. package/useTheme.js +1 -8
  197. package/useTranslatedLabels.js +1 -7
  198. package/utils/BaseTypography.d.ts +2 -2
  199. package/utils/BaseTypography.js +16 -30
  200. package/utils/FocusLock.js +12 -36
  201. package/wizard/Wizard.js +14 -49
  202. package/wizard/Wizard.test.js +53 -80
  203. package/wizard/types.d.ts +6 -6
  204. package/resultsetTable/Icons.d.ts +0 -7
  205. package/slider/Slider.stories.tsx +0 -240
  206. /package/{resultsetTable → resultset-table}/ResultsetTable.d.ts +0 -0
  207. /package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +0 -0
  208. /package/{resultsetTable → resultset-table}/types.js +0 -0
  209. /package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +0 -0
  210. /package/table/{Table.stories.jsx → Table.stories.tsx} +0 -0
package/select/types.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import React from "react";
2
- declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
- declare type Margin = {
2
+ type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
+ type Margin = {
4
4
  top?: Space;
5
5
  bottom?: Space;
6
6
  left?: Space;
7
7
  right?: Space;
8
8
  };
9
- declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
10
- declare type OptionGroup = {
9
+ type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
10
+ type OptionGroup = {
11
11
  /**
12
12
  * Label of the group to be shown in the select's listbox.
13
13
  */
@@ -17,7 +17,7 @@ declare type OptionGroup = {
17
17
  */
18
18
  options: Option[];
19
19
  };
20
- declare type Option = {
20
+ type Option = {
21
21
  /**
22
22
  * Element used as the icon that will be placed before the option label.
23
23
  * It can be a url of an image or an inline SVG. If the url option
@@ -36,7 +36,7 @@ declare type Option = {
36
36
  */
37
37
  value: string;
38
38
  };
39
- declare type CommonProps = {
39
+ type CommonProps = {
40
40
  /**
41
41
  * Text to be placed above the select.
42
42
  */
@@ -45,9 +45,8 @@ declare type CommonProps = {
45
45
  * Name attribute of the input element. This attribute will allow users
46
46
  * to find the component's value during the submit event. In this event,
47
47
  * the component's value will always be a regular string, for both single
48
- * and multiple selection modes, been in the first one a single option
49
- * value and in the multiple variant more than one option value,
50
- * separated by commas.
48
+ * and multiple selection modes, being a single option value in the first case
49
+ * and more than one value when multiple selection is available, separated by commas.
51
50
  */
52
51
  name?: string;
53
52
  /**
@@ -101,7 +100,7 @@ declare type CommonProps = {
101
100
  */
102
101
  tabIndex?: number;
103
102
  };
104
- declare type SingleSelect = CommonProps & {
103
+ type SingleSelect = CommonProps & {
105
104
  /**
106
105
  * If true, the select component will support multiple selected options.
107
106
  * In that case, value will be an array of strings with each selected
@@ -137,7 +136,7 @@ declare type SingleSelect = CommonProps & {
137
136
  error?: string;
138
137
  }) => void;
139
138
  };
140
- declare type MultipleSelect = CommonProps & {
139
+ type MultipleSelect = CommonProps & {
141
140
  /**
142
141
  * If true, the select component will support multiple selected options.
143
142
  * In that case, value will be an array of strings with each selected
@@ -173,11 +172,11 @@ declare type MultipleSelect = CommonProps & {
173
172
  error?: string;
174
173
  }) => void;
175
174
  };
176
- declare type Props = SingleSelect | MultipleSelect;
175
+ type Props = SingleSelect | MultipleSelect;
177
176
  /**
178
177
  * Single option of the select component.
179
178
  */
180
- export declare type OptionProps = {
179
+ export type OptionProps = {
181
180
  id: string;
182
181
  option: Option;
183
182
  onClick: (option: Option) => void;
@@ -190,7 +189,7 @@ export declare type OptionProps = {
190
189
  /**
191
190
  * Listbox from the select component.
192
191
  */
193
- export declare type ListboxProps = {
192
+ export type ListboxProps = {
194
193
  id: string;
195
194
  currentValue: string | string[];
196
195
  options: Option[] | OptionGroup[];
@@ -206,5 +205,5 @@ export declare type ListboxProps = {
206
205
  /**
207
206
  * Reference to the select component.
208
207
  */
209
- export declare type RefType = HTMLDivElement;
208
+ export type RefType = HTMLDivElement;
210
209
  export default Props;
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  declare const icons: {
3
- collapsedIcon: JSX.Element;
4
- collapsableIcon: JSX.Element;
5
- externalLinkIcon: JSX.Element;
3
+ collapsedIcon: React.JSX.Element;
4
+ collapsableIcon: React.JSX.Element;
5
+ externalLinkIcon: React.JSX.Element;
6
6
  };
7
7
  export default icons;
package/sidenav/Icons.js CHANGED
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports["default"] = void 0;
9
-
10
8
  var _react = _interopRequireDefault(require("react"));
11
-
12
9
  var icons = {
13
10
  collapsedIcon: /*#__PURE__*/_react["default"].createElement("svg", {
14
11
  xmlns: "http://www.w3.org/2000/svg",
@@ -47,5 +44,4 @@ var icons = {
47
44
  d: "M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"
48
45
  }))
49
46
  };
50
- var _default = icons;
51
- exports["default"] = _default;
47
+ var _default = exports["default"] = icons;
@@ -1,51 +1,31 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports["default"] = void 0;
11
-
12
9
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
-
14
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
15
-
16
11
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
17
-
18
12
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
19
-
20
13
  var _react = _interopRequireWildcard(require("react"));
21
-
22
14
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
23
-
24
15
  var _variables = require("../common/variables");
25
-
26
16
  var _SidenavContext = require("../layout/SidenavContext");
27
-
28
17
  var _useTheme = _interopRequireDefault(require("../useTheme"));
29
-
30
18
  var _BackgroundColorContext = require("../BackgroundColorContext");
31
-
32
19
  var _Flex = _interopRequireDefault(require("../flex/Flex"));
33
-
34
20
  var _Bleed = _interopRequireDefault(require("../bleed/Bleed"));
35
-
36
21
  var _Icons = _interopRequireDefault(require("./Icons"));
37
-
38
22
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
39
-
40
23
  var _excluded = ["href", "newWindow", "selected", "icon", "onClick", "tabIndex", "children"];
41
-
42
- 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); }
43
-
44
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(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; }
45
-
24
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
25
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
46
26
  var DxcSidenav = function DxcSidenav(_ref) {
47
27
  var title = _ref.title,
48
- children = _ref.children;
28
+ children = _ref.children;
49
29
  var colorsTheme = (0, _useTheme["default"])();
50
30
  return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
51
31
  theme: colorsTheme.sidenav
@@ -56,14 +36,12 @@ var DxcSidenav = function DxcSidenav(_ref) {
56
36
  gap: "1rem"
57
37
  }, children))));
58
38
  };
59
-
60
39
  var Title = function Title(_ref2) {
61
40
  var children = _ref2.children;
62
41
  return /*#__PURE__*/_react["default"].createElement(_Bleed["default"], {
63
42
  horizontal: "1rem"
64
43
  }, /*#__PURE__*/_react["default"].createElement(SidenavTitle, null, children));
65
44
  };
66
-
67
45
  var Section = function Section(_ref3) {
68
46
  var children = _ref3.children;
69
47
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Bleed["default"], {
@@ -72,26 +50,21 @@ var Section = function Section(_ref3) {
72
50
  direction: "column"
73
51
  }, children)), /*#__PURE__*/_react["default"].createElement(Divider, null));
74
52
  };
75
-
76
53
  var GroupContext = /*#__PURE__*/_react["default"].createContext(null);
77
-
78
54
  var Group = function Group(_ref4) {
79
55
  var title = _ref4.title,
80
- _ref4$collapsable = _ref4.collapsable,
81
- collapsable = _ref4$collapsable === void 0 ? false : _ref4$collapsable,
82
- icon = _ref4.icon,
83
- children = _ref4.children;
84
-
56
+ _ref4$collapsable = _ref4.collapsable,
57
+ collapsable = _ref4$collapsable === void 0 ? false : _ref4$collapsable,
58
+ icon = _ref4.icon,
59
+ children = _ref4.children;
85
60
  var _useState = (0, _react.useState)(false),
86
- _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
87
- collapsed = _useState2[0],
88
- setCollapsed = _useState2[1];
89
-
61
+ _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
62
+ collapsed = _useState2[0],
63
+ setCollapsed = _useState2[1];
90
64
  var _useState3 = (0, _react.useState)(false),
91
- _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
92
- isSelected = _useState4[0],
93
- changeIsSelected = _useState4[1];
94
-
65
+ _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
66
+ isSelected = _useState4[0],
67
+ changeIsSelected = _useState4[1];
95
68
  return /*#__PURE__*/_react["default"].createElement(GroupContext.Provider, {
96
69
  value: changeIsSelected
97
70
  }, /*#__PURE__*/_react["default"].createElement(SidenavGroup, null, collapsable && title ? /*#__PURE__*/_react["default"].createElement(SidenavGroupTitleButton, {
@@ -109,27 +82,24 @@ var Group = function Group(_ref4) {
109
82
  src: icon
110
83
  }) : icon, title), !collapsed && children));
111
84
  };
112
-
113
85
  var Link = /*#__PURE__*/(0, _react.forwardRef)(function (_ref5, ref) {
114
86
  var href = _ref5.href,
115
- _ref5$newWindow = _ref5.newWindow,
116
- newWindow = _ref5$newWindow === void 0 ? false : _ref5$newWindow,
117
- _ref5$selected = _ref5.selected,
118
- selected = _ref5$selected === void 0 ? false : _ref5$selected,
119
- icon = _ref5.icon,
120
- onClick = _ref5.onClick,
121
- _ref5$tabIndex = _ref5.tabIndex,
122
- tabIndex = _ref5$tabIndex === void 0 ? 0 : _ref5$tabIndex,
123
- children = _ref5.children,
124
- otherProps = (0, _objectWithoutProperties2["default"])(_ref5, _excluded);
87
+ _ref5$newWindow = _ref5.newWindow,
88
+ newWindow = _ref5$newWindow === void 0 ? false : _ref5$newWindow,
89
+ _ref5$selected = _ref5.selected,
90
+ selected = _ref5$selected === void 0 ? false : _ref5$selected,
91
+ icon = _ref5.icon,
92
+ onClick = _ref5.onClick,
93
+ _ref5$tabIndex = _ref5.tabIndex,
94
+ tabIndex = _ref5$tabIndex === void 0 ? 0 : _ref5$tabIndex,
95
+ children = _ref5.children,
96
+ otherProps = (0, _objectWithoutProperties2["default"])(_ref5, _excluded);
125
97
  var changeIsGroupSelected = (0, _react.useContext)(GroupContext);
126
98
  var setIsSidenavVisibleResponsive = (0, _SidenavContext.useResponsiveSidenavVisibility)();
127
-
128
99
  var handleClick = function handleClick($event) {
129
100
  onClick === null || onClick === void 0 ? void 0 : onClick($event);
130
101
  setIsSidenavVisibleResponsive === null || setIsSidenavVisibleResponsive === void 0 ? void 0 : setIsSidenavVisibleResponsive(false);
131
102
  };
132
-
133
103
  (0, _react.useEffect)(function () {
134
104
  changeIsGroupSelected === null || changeIsGroupSelected === void 0 ? void 0 : changeIsGroupSelected(function (isGroupSelected) {
135
105
  return !isGroupSelected ? selected : isGroupSelected;
@@ -149,7 +119,6 @@ var Link = /*#__PURE__*/(0, _react.forwardRef)(function (_ref5, ref) {
149
119
  src: icon
150
120
  }) : icon, children), newWindow && _Icons["default"].externalLinkIcon);
151
121
  });
152
-
153
122
  var SidenavContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n width: 280px;\n @media (max-width: ", "rem) {\n width: 100vw;\n }\n padding: 2rem 1rem;\n background-color: ", ";\n\n overflow-y: auto;\n overflow-x: hidden;\n ::-webkit-scrollbar {\n width: 2px;\n }\n ::-webkit-scrollbar-track {\n background-color: ", ";\n border-radius: 3px;\n }\n ::-webkit-scrollbar-thumb {\n background-color: ", ";\n border-radius: 3px;\n }\n"])), _variables.responsiveSizes.medium, function (props) {
154
123
  return props.theme.backgroundColor;
155
124
  }, function (props) {
@@ -157,7 +126,6 @@ var SidenavContainer = _styledComponents["default"].div(_templateObject || (_tem
157
126
  }, function (props) {
158
127
  return props.theme.scrollBarThumbColor;
159
128
  });
160
-
161
129
  var SidenavTitle = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n padding: 0.5rem 1.2rem;\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n font-size: ", ";\n color: ", ";\n letter-spacing: ", ";\n text-transform: ", ";\n"])), function (props) {
162
130
  return props.theme.titleFontFamily;
163
131
  }, function (props) {
@@ -173,11 +141,8 @@ var SidenavTitle = _styledComponents["default"].div(_templateObject2 || (_templa
173
141
  }, function (props) {
174
142
  return props.theme.titleFontTextTransform;
175
143
  });
176
-
177
144
  var Divider = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n width: 100%;\n height: 1px;\n background-color: #999999;\n\n &:last-child {\n display: none;\n }\n"])));
178
-
179
145
  var SidenavGroup = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n a {\n padding: 0.5rem 1.2rem 0.5rem 2.25rem;\n }\n"])));
180
-
181
146
  var SidenavGroupTitle = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.5rem 1.2rem;\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n font-size: ", ";\n\n img,\n svg {\n height: 16px;\n width: 16px;\n }\n"])), function (props) {
182
147
  return props.theme.groupTitleFontFamily;
183
148
  }, function (props) {
@@ -187,7 +152,6 @@ var SidenavGroupTitle = _styledComponents["default"].span(_templateObject5 || (_
187
152
  }, function (props) {
188
153
  return props.theme.groupTitleFontSize;
189
154
  });
190
-
191
155
  var SidenavGroupTitleButton = _styledComponents["default"].button(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n all: unset;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n padding: 0.5rem 1.2rem;\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n font-size: ", ";\n cursor: pointer;\n\n ", "\n\n &:focus, &:focus-visible {\n outline: 2px solid ", ";\n outline-offset: -2px;\n }\n &:hover {\n ", "\n }\n &:active {\n color: #fff;\n background-color: ", ";\n }\n\n img,\n svg {\n height: 16px;\n width: 16px;\n }\n"])), function (props) {
192
156
  return props.theme.groupTitleFontFamily;
193
157
  }, function (props) {
@@ -205,7 +169,6 @@ var SidenavGroupTitleButton = _styledComponents["default"].button(_templateObjec
205
169
  }, function (props) {
206
170
  return props.selectedGroup ? "#333" : props.theme.groupTitleActiveBackgroundColor;
207
171
  });
208
-
209
172
  var SidenavLink = _styledComponents["default"].a(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.5rem;\n padding: 0.5rem 1.2rem;\n box-shadow: 0 0 0 2px transparent;\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n font-size: ", ";\n letter-spacing: ", ";\n text-transform: ", ";\n text-decoration: ", ";\n cursor: pointer;\n\n ", "\n\n &:focus, &:focus-visible {\n outline: 2px solid ", ";\n outline-offset: -2px;\n }\n &:hover {\n ", "\n }\n &:active {\n color: #fff;\n background-color: ", ";\n outline: 2px solid #0095ff;\n outline-offset: -2px;\n }\n\n img,\n svg {\n height: 16px;\n width: 16px;\n }\n"])), function (props) {
210
173
  return props.theme.linkFontFamily;
211
174
  }, function (props) {
@@ -229,10 +192,8 @@ var SidenavLink = _styledComponents["default"].a(_templateObject7 || (_templateO
229
192
  }, function (props) {
230
193
  return props.selected ? "#333" : "#4d4d4d";
231
194
  });
232
-
233
195
  DxcSidenav.Section = Section;
234
196
  DxcSidenav.Group = Group;
235
197
  DxcSidenav.Link = Link;
236
198
  DxcSidenav.Title = Title;
237
- var _default = DxcSidenav;
238
- exports["default"] = _default;
199
+ var _default = exports["default"] = DxcSidenav;
@@ -1,20 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _react = _interopRequireDefault(require("react"));
6
-
7
5
  var _react2 = require("@testing-library/react");
8
-
9
6
  var _Sidenav = _interopRequireDefault(require("./Sidenav.tsx"));
10
-
11
7
  describe("Sidenav component tests", function () {
12
8
  test("Sidenav renders anchors and Section correctly", function () {
13
9
  var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Sidenav["default"], null, /*#__PURE__*/_react["default"].createElement(_Sidenav["default"].Section, null, /*#__PURE__*/_react["default"].createElement("p", null, "nav-content-test"), /*#__PURE__*/_react["default"].createElement(_Sidenav["default"].Link, {
14
- href: "#"
15
- }, "Link")))),
16
- getByText = _render.getByText;
17
-
10
+ href: "#"
11
+ }, "Link")))),
12
+ getByText = _render.getByText;
18
13
  expect(getByText("nav-content-test")).toBeTruthy();
19
14
  var link = getByText("Link");
20
15
  expect(link.closest("a").getAttribute("href")).toBe("#");
@@ -36,9 +31,7 @@ describe("Sidenav component tests", function () {
36
31
  }, "Lorem ipsum")))));
37
32
  expect(sidenav.getByText("Collapsable")).toBeTruthy();
38
33
  expect(sidenav.getAllByRole("button")[0].getAttribute("aria-expanded")).toBe("true");
39
-
40
34
  _react2.fireEvent.click(sidenav.getByText("Collapsable"));
41
-
42
35
  expect(sidenav.getAllByRole("button")[0].getAttribute("aria-expanded")).toBe("false");
43
36
  });
44
37
  });
@@ -1,28 +1,18 @@
1
1
  /// <reference types="react" />
2
- declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
3
- declare type SidenavPropsType = {
4
- /**
5
- * The area assigned to render the sidenav title. It is highly recommended to use the sidenav title.
6
- */
7
- title?: React.ReactNode;
8
- /**
9
- * The area inside the sidenav. This area can be used to render the content inside the sidenav.
10
- */
11
- children: React.ReactNode;
12
- };
13
- export declare type SidenavTitlePropsType = {
2
+ type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
3
+ export type SidenavTitlePropsType = {
14
4
  /**
15
5
  * The area inside the sidenav title. This area can be used to render custom content.
16
6
  */
17
7
  children: React.ReactNode;
18
8
  };
19
- export declare type SidenavSectionPropsType = {
9
+ export type SidenavSectionPropsType = {
20
10
  /**
21
11
  * The area inside the sidenav section. This area can be used to render sidenav groups, links and custom content.
22
12
  */
23
13
  children: React.ReactNode;
24
14
  };
25
- export declare type SidenavGroupPropsType = {
15
+ export type SidenavGroupPropsType = {
26
16
  /**
27
17
  * The title of the sidenav group.
28
18
  */
@@ -41,7 +31,7 @@ export declare type SidenavGroupPropsType = {
41
31
  */
42
32
  children: React.ReactNode;
43
33
  };
44
- export declare type SidenavLinkPropsType = {
34
+ export type SidenavLinkPropsType = {
45
35
  /**
46
36
  * Page to be opened when the user clicks on the link.
47
37
  */
@@ -63,14 +53,24 @@ export declare type SidenavLinkPropsType = {
63
53
  /**
64
54
  * This function will be called when the user clicks the link and the event will be passed to this function.
65
55
  */
66
- onClick?: ($event: React.MouseEvent<HTMLAnchorElement>) => void;
56
+ onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
57
+ /**
58
+ * The area inside the sidenav link.
59
+ */
60
+ children: React.ReactNode;
67
61
  /**
68
62
  * Value of the tabindex.
69
63
  */
70
64
  tabIndex?: number;
65
+ };
66
+ type Props = {
71
67
  /**
72
- * The area inside the sidenav link.
68
+ * The area assigned to render the sidenav title. It is highly recommended to use the sidenav title.
69
+ */
70
+ title?: React.ReactNode;
71
+ /**
72
+ * The area inside the sidenav. This area can be used to render the content inside the sidenav.
73
73
  */
74
74
  children: React.ReactNode;
75
75
  };
76
- export default SidenavPropsType;
76
+ export default Props;