@dxc-technology/halstack-react 0.0.0-d5ae9d7 → 0.0.0-d618bea

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 (216) hide show
  1. package/BackgroundColorContext.d.ts +10 -0
  2. package/BackgroundColorContext.js +1 -3
  3. package/ThemeContext.d.ts +15 -0
  4. package/ThemeContext.js +5 -8
  5. package/V3Select/V3Select.js +2 -2
  6. package/V3Textarea/V3Textarea.js +2 -2
  7. package/accordion/Accordion.d.ts +2 -2
  8. package/accordion/Accordion.js +2 -2
  9. package/accordion/types.d.ts +1 -1
  10. package/accordion-group/AccordionGroup.d.ts +7 -0
  11. package/accordion-group/AccordionGroup.js +59 -73
  12. package/accordion-group/AccordionGroup.stories.tsx +225 -0
  13. package/accordion-group/types.d.ts +72 -0
  14. package/accordion-group/types.js +5 -0
  15. package/alert/Alert.js +2 -2
  16. package/alert/Alert.stories.tsx +170 -0
  17. package/alert/types.d.ts +1 -1
  18. package/badge/Badge.js +1 -1
  19. package/box/Box.d.ts +4 -0
  20. package/box/Box.js +6 -32
  21. package/box/Box.stories.tsx +132 -0
  22. package/box/types.d.ts +43 -0
  23. package/box/types.js +5 -0
  24. package/button/Button.d.ts +1 -1
  25. package/button/Button.js +9 -12
  26. package/button/Button.stories.tsx +217 -234
  27. package/button/types.d.ts +11 -11
  28. package/card/Card.d.ts +4 -0
  29. package/card/Card.js +17 -53
  30. package/card/Card.stories.tsx +201 -0
  31. package/card/ice-cream.jpg +0 -0
  32. package/card/types.d.ts +67 -0
  33. package/card/types.js +5 -0
  34. package/checkbox/Checkbox.js +2 -2
  35. package/checkbox/Checkbox.stories.tsx +192 -0
  36. package/checkbox/types.d.ts +3 -4
  37. package/chip/Chip.d.ts +4 -0
  38. package/chip/Chip.js +1 -23
  39. package/chip/Chip.stories.tsx +121 -0
  40. package/chip/types.d.ts +53 -0
  41. package/chip/types.js +5 -0
  42. package/common/variables.js +45 -38
  43. package/date/Date.js +1 -1
  44. package/date-input/DateInput.js +4 -7
  45. package/date-input/DateInput.stories.tsx +138 -0
  46. package/dialog/Dialog.d.ts +4 -0
  47. package/dialog/Dialog.js +6 -25
  48. package/dialog/Dialog.stories.tsx +212 -0
  49. package/dialog/types.d.ts +43 -0
  50. package/dialog/types.js +5 -0
  51. package/dropdown/Dropdown.d.ts +4 -0
  52. package/dropdown/Dropdown.js +8 -41
  53. package/dropdown/types.d.ts +89 -0
  54. package/dropdown/types.js +5 -0
  55. package/file-input/FileInput.d.ts +4 -0
  56. package/file-input/FileInput.js +65 -76
  57. package/file-input/FileItem.d.ts +14 -0
  58. package/file-input/FileItem.js +12 -21
  59. package/file-input/types.d.ts +112 -0
  60. package/file-input/types.js +5 -0
  61. package/footer/Footer.d.ts +4 -0
  62. package/footer/Footer.js +11 -42
  63. package/footer/Footer.stories.tsx +151 -0
  64. package/footer/types.d.ts +65 -0
  65. package/footer/types.js +5 -0
  66. package/header/Header.d.ts +7 -0
  67. package/header/Header.js +28 -30
  68. package/header/Header.stories.tsx +162 -0
  69. package/header/Icons.js +2 -27
  70. package/header/types.d.ts +47 -0
  71. package/header/types.js +5 -0
  72. package/heading/Heading.d.ts +4 -0
  73. package/heading/Heading.js +7 -24
  74. package/heading/Heading.stories.tsx +53 -0
  75. package/heading/types.d.ts +33 -0
  76. package/heading/types.js +5 -0
  77. package/input-text/InputText.js +2 -2
  78. package/layout/ApplicationLayout.d.ts +10 -0
  79. package/layout/ApplicationLayout.js +8 -18
  80. package/layout/ApplicationLayout.stories.tsx +171 -0
  81. package/layout/types.d.ts +57 -0
  82. package/layout/types.js +5 -0
  83. package/link/Link.d.ts +3 -0
  84. package/link/Link.js +4 -26
  85. package/link/Link.stories.tsx +146 -0
  86. package/link/types.d.ts +74 -0
  87. package/link/types.js +5 -0
  88. package/list/List.d.ts +7 -0
  89. package/list/List.js +37 -0
  90. package/list/List.stories.tsx +70 -0
  91. package/main.d.ts +7 -3
  92. package/main.js +34 -2
  93. package/number-input/NumberInput.d.ts +4 -0
  94. package/number-input/NumberInput.js +5 -50
  95. package/number-input/NumberInput.stories.tsx +115 -0
  96. package/number-input/NumberInputContext.d.ts +4 -0
  97. package/number-input/NumberInputContext.js +5 -2
  98. package/number-input/numberInputContextTypes.d.ts +19 -0
  99. package/number-input/numberInputContextTypes.js +5 -0
  100. package/number-input/types.d.ts +117 -0
  101. package/number-input/types.js +5 -0
  102. package/package.json +1 -1
  103. package/paginator/Paginator.js +2 -8
  104. package/paginator/Paginator.stories.tsx +63 -0
  105. package/password-input/PasswordInput.d.ts +4 -0
  106. package/password-input/PasswordInput.js +19 -55
  107. package/password-input/{PasswordInput.stories.jsx → PasswordInput.stories.tsx} +1 -1
  108. package/password-input/types.d.ts +107 -0
  109. package/password-input/types.js +5 -0
  110. package/progress-bar/ProgressBar.d.ts +4 -0
  111. package/progress-bar/ProgressBar.js +5 -23
  112. package/progress-bar/ProgressBar.stories.jsx +58 -0
  113. package/progress-bar/types.d.ts +37 -0
  114. package/progress-bar/types.js +5 -0
  115. package/radio/Radio.js +2 -2
  116. package/radio/Radio.stories.tsx +192 -0
  117. package/radio/types.d.ts +2 -2
  118. package/resultsetTable/ResultsetTable.d.ts +4 -0
  119. package/resultsetTable/ResultsetTable.js +4 -27
  120. package/resultsetTable/types.d.ts +67 -0
  121. package/resultsetTable/types.js +5 -0
  122. package/row/Row.d.ts +11 -0
  123. package/row/Row.js +124 -0
  124. package/row/Row.stories.tsx +223 -0
  125. package/select/Select.js +15 -17
  126. package/select/Select.stories.tsx +572 -0
  127. package/select/index.d.ts +4 -4
  128. package/sidenav/Sidenav.d.ts +9 -0
  129. package/sidenav/Sidenav.js +6 -15
  130. package/sidenav/Sidenav.stories.tsx +165 -0
  131. package/sidenav/types.d.ts +50 -0
  132. package/sidenav/types.js +5 -0
  133. package/slider/Slider.d.ts +4 -0
  134. package/slider/Slider.js +61 -84
  135. package/slider/Slider.stories.tsx +177 -0
  136. package/slider/types.d.ts +78 -0
  137. package/slider/types.js +5 -0
  138. package/spinner/Spinner.d.ts +4 -0
  139. package/spinner/Spinner.js +8 -25
  140. package/spinner/Spinner.stories.jsx +102 -0
  141. package/spinner/types.d.ts +32 -0
  142. package/spinner/types.js +5 -0
  143. package/stack/Stack.d.ts +10 -0
  144. package/stack/Stack.js +94 -0
  145. package/stack/Stack.stories.tsx +150 -0
  146. package/switch/Switch.js +4 -4
  147. package/switch/Switch.stories.tsx +160 -0
  148. package/table/Table.d.ts +4 -0
  149. package/table/Table.js +3 -3
  150. package/table/Table.stories.jsx +276 -0
  151. package/table/types.d.ts +21 -0
  152. package/table/types.js +5 -0
  153. package/tabs/Tabs.d.ts +4 -0
  154. package/tabs/Tabs.js +9 -55
  155. package/tabs/Tabs.stories.tsx +121 -0
  156. package/tabs/types.d.ts +70 -0
  157. package/tabs/types.js +5 -0
  158. package/tag/Tag.d.ts +4 -0
  159. package/tag/Tag.js +21 -36
  160. package/tag/Tag.stories.tsx +145 -0
  161. package/tag/types.d.ts +60 -0
  162. package/tag/types.js +5 -0
  163. package/text/Text.d.ts +7 -0
  164. package/text/Text.js +30 -0
  165. package/text/Text.stories.tsx +19 -0
  166. package/text-input/TextInput.d.ts +4 -0
  167. package/text-input/TextInput.js +42 -81
  168. package/text-input/TextInput.stories.tsx +456 -0
  169. package/text-input/types.d.ts +159 -0
  170. package/text-input/types.js +5 -0
  171. package/textarea/Textarea.js +29 -32
  172. package/textarea/Textarea.stories.jsx +135 -0
  173. package/textarea/index.d.ts +18 -8
  174. package/toggle/Toggle.js +1 -1
  175. package/toggle-group/ToggleGroup.d.ts +4 -0
  176. package/toggle-group/ToggleGroup.js +8 -34
  177. package/toggle-group/ToggleGroup.stories.tsx +178 -0
  178. package/toggle-group/types.d.ts +84 -0
  179. package/toggle-group/types.js +5 -0
  180. package/upload/buttons-upload/ButtonsUpload.js +2 -2
  181. package/upload/dragAndDropArea/DragAndDropArea.js +2 -2
  182. package/upload/file-upload/FileToUpload.js +1 -1
  183. package/upload/files-upload/FilesToUpload.js +1 -1
  184. package/upload/transaction/Transaction.js +2 -2
  185. package/upload/transactions/Transactions.js +1 -1
  186. package/useTheme.d.ts +2 -0
  187. package/useTheme.js +1 -1
  188. package/wizard/Wizard.d.ts +4 -0
  189. package/wizard/Wizard.js +13 -53
  190. package/wizard/Wizard.stories.jsx +224 -0
  191. package/wizard/types.d.ts +64 -0
  192. package/wizard/types.js +5 -0
  193. package/accordion-group/index.d.ts +0 -16
  194. package/box/index.d.ts +0 -25
  195. package/card/index.d.ts +0 -22
  196. package/chip/index.d.ts +0 -22
  197. package/dialog/index.d.ts +0 -18
  198. package/dropdown/index.d.ts +0 -26
  199. package/file-input/index.d.ts +0 -81
  200. package/footer/index.d.ts +0 -25
  201. package/header/index.d.ts +0 -25
  202. package/heading/index.d.ts +0 -17
  203. package/link/index.d.ts +0 -23
  204. package/number-input/index.d.ts +0 -113
  205. package/password-input/index.d.ts +0 -94
  206. package/progress-bar/index.d.ts +0 -18
  207. package/resultsetTable/index.d.ts +0 -19
  208. package/sidenav/index.d.ts +0 -13
  209. package/slider/index.d.ts +0 -29
  210. package/spinner/index.d.ts +0 -17
  211. package/table/index.d.ts +0 -13
  212. package/tabs/index.d.ts +0 -19
  213. package/tag/index.d.ts +0 -24
  214. package/text-input/index.d.ts +0 -135
  215. package/toggle-group/index.d.ts +0 -21
  216. package/wizard/index.d.ts +0 -18
@@ -9,8 +9,6 @@ Object.defineProperty(exports, "__esModule", {
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"));
@@ -19,11 +17,9 @@ var _react = _interopRequireDefault(require("react"));
19
17
 
20
18
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
21
19
 
22
- var _propTypes = _interopRequireDefault(require("prop-types"));
23
-
24
20
  var _variables = require("../common/variables.js");
25
21
 
26
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
22
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
27
23
 
28
24
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
29
25
 
@@ -37,8 +33,7 @@ var DxcHeading = function DxcHeading(_ref) {
37
33
  _ref$text = _ref.text,
38
34
  text = _ref$text === void 0 ? "" : _ref$text,
39
35
  as = _ref.as,
40
- _ref$weight = _ref.weight,
41
- weight = _ref$weight === void 0 ? "" : _ref$weight,
36
+ weight = _ref.weight,
42
37
  margin = _ref.margin;
43
38
  var colorsTheme = (0, _useTheme["default"])();
44
39
 
@@ -51,19 +46,19 @@ var DxcHeading = function DxcHeading(_ref) {
51
46
  }, /*#__PURE__*/_react["default"].createElement(HeadingContainer, {
52
47
  margin: margin
53
48
  }, level === 1 ? /*#__PURE__*/_react["default"].createElement(HeadingLevel1, {
54
- as: checkValidAs(as),
49
+ as: checkValidAs(),
55
50
  weight: weight
56
51
  }, text) : level === 2 ? /*#__PURE__*/_react["default"].createElement(HeadingLevel2, {
57
- as: checkValidAs(as),
52
+ as: checkValidAs(),
58
53
  weight: weight
59
54
  }, text) : level === 3 ? /*#__PURE__*/_react["default"].createElement(HeadingLevel3, {
60
- as: checkValidAs(as),
55
+ as: checkValidAs(),
61
56
  weight: weight
62
57
  }, text) : level === 4 ? /*#__PURE__*/_react["default"].createElement(HeadingLevel4, {
63
- as: checkValidAs(as),
58
+ as: checkValidAs(),
64
59
  weight: weight
65
60
  }, text) : /*#__PURE__*/_react["default"].createElement(HeadingLevel5, {
66
- as: checkValidAs(as),
61
+ as: checkValidAs(),
67
62
  weight: weight
68
63
  }, text)));
69
64
  };
@@ -160,17 +155,5 @@ var HeadingLevel5 = _styledComponents["default"].h5(_templateObject6 || (_templa
160
155
  return props.theme.level5FontColor;
161
156
  });
162
157
 
163
- DxcHeading.propTypes = {
164
- level: _propTypes["default"].number,
165
- text: _propTypes["default"].string,
166
- as: _propTypes["default"].oneOf(["h1", "h2", "h3", "h4", "h5"]),
167
- weight: _propTypes["default"].oneOf(["light", "normal", "bold", ""]),
168
- margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
169
- top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
170
- bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
171
- left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
172
- right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
173
- }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))])
174
- };
175
158
  var _default = DxcHeading;
176
159
  exports["default"] = _default;
@@ -0,0 +1,53 @@
1
+ import React from "react";
2
+ import DxcHeading from "./Heading";
3
+ import Title from "../../.storybook/components/Title";
4
+ import ExampleContainer from "../../.storybook/components/ExampleContainer";
5
+
6
+ export default {
7
+ title: "Heading",
8
+ component: DxcHeading,
9
+ };
10
+
11
+ export const Chromatic = () => (
12
+ <>
13
+ <Title title="Levels" theme="light" level={2} />
14
+ <ExampleContainer>
15
+ <Title title="Level 1" theme="light" level={4} />
16
+ <DxcHeading text="Heading for sections within the page" />
17
+ <Title title="Level 2" theme="light" level={4} />
18
+ <DxcHeading text="Heading for sections within the page" level={2} />
19
+ <Title title="Level 3" theme="light" level={4} />
20
+ <DxcHeading text="Heading for sections within the page" level={3} />
21
+ <Title title="Level 4" theme="light" level={4} />
22
+ <DxcHeading text="Heading for sections within the page" level={4} />
23
+ <Title title="Level 5" theme="light" level={4} />
24
+ <DxcHeading text="Heading for sections within the page" level={5} />
25
+ </ExampleContainer>
26
+ <Title title="Weights" theme="light" level={2} />
27
+ <ExampleContainer>
28
+ <Title title="'light' Weight" theme="light" level={4} />
29
+ <DxcHeading text="Heading for sections within the page" level={2} weight="light" />
30
+ <Title title="'normal' Weight" theme="light" level={4} />
31
+ <DxcHeading text="Heading for sections within the page" level={4} weight="normal" />
32
+ <Title title="'bold' Weight" theme="light" level={4} />
33
+ <DxcHeading text="Heading for sections within the page" weight="bold" />
34
+ </ExampleContainer>
35
+ <Title title="Margins" theme="light" level={2} />
36
+ <ExampleContainer>
37
+ <Title title="Xxsmall" theme="light" level={4} />
38
+ <DxcHeading text="Xxsmall" margin="xxsmall" />
39
+ <Title title="Xsmall" theme="light" level={4} />
40
+ <DxcHeading text="Xsmall" margin="xsmall" />
41
+ <Title title="Small" theme="light" level={4} />
42
+ <DxcHeading text="Small" margin="small" />
43
+ <Title title="Medium" theme="light" level={4} />
44
+ <DxcHeading text="Medium" margin="medium" />
45
+ <Title title="Large" theme="light" level={4} />
46
+ <DxcHeading text="Large" margin="large" />
47
+ <Title title="Xlarge" theme="light" level={4} />
48
+ <DxcHeading text="Xlarge" margin="xlarge" />
49
+ <Title title="Xxlarge" theme="light" level={4} />
50
+ <DxcHeading text="Xxlarge" margin="xxlarge" />
51
+ </ExampleContainer>
52
+ </>
53
+ );
@@ -0,0 +1,33 @@
1
+ declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
2
+ declare type Margin = {
3
+ top?: Space;
4
+ bottom?: Space;
5
+ left?: Space;
6
+ right?: Space;
7
+ };
8
+ declare type Props = {
9
+ /**
10
+ * Defines the heading level from 1 to 5. The styles of the heading are applied according to the level.
11
+ * The html tag of the heading will be the one specified in the 'as' prop.
12
+ * If 'as' is not specified, the html tag of the heading is the one specified in the 'level' prop.
13
+ */
14
+ level?: 1 | 2 | 3 | 4 | 5;
15
+ /**
16
+ * Heading text.
17
+ */
18
+ text: string;
19
+ /**
20
+ * Specifies the html tag of the heading.
21
+ */
22
+ as?: "h1" | "h2" | "h3" | "h4" | "h5";
23
+ /**
24
+ * Modifies the default weight of the heading.
25
+ */
26
+ weight?: "light" | "normal" | "bold";
27
+ /**
28
+ * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
29
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
30
+ */
31
+ margin?: Space | Margin;
32
+ };
33
+ export default Props;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -39,11 +39,11 @@ var _variables = require("../common/variables.js");
39
39
 
40
40
  var _utils = require("../common/utils.js");
41
41
 
42
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
42
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
43
43
 
44
44
  var _Icons = _interopRequireDefault(require("./Icons"));
45
45
 
46
- var _BackgroundColorContext = _interopRequireWildcard(require("../BackgroundColorContext.js"));
46
+ var _BackgroundColorContext = _interopRequireWildcard(require("../BackgroundColorContext"));
47
47
 
48
48
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
49
49
 
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import AppLayoutPropsType, { AppLayoutFooterPropsType, AppLayoutMainPropsType, AppLayoutHeaderPropsType } from "./types";
3
+ declare const DxcApplicationLayout: {
4
+ ({ children }: AppLayoutPropsType): JSX.Element;
5
+ Header: ({ children }: AppLayoutHeaderPropsType) => JSX.Element;
6
+ Main: ({ children }: AppLayoutMainPropsType) => JSX.Element;
7
+ Footer: ({ children }: AppLayoutFooterPropsType) => JSX.Element;
8
+ SideNav: (props: any) => JSX.Element;
9
+ };
10
+ export default DxcApplicationLayout;
@@ -21,13 +21,11 @@ var _main = require("../main");
21
21
 
22
22
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
23
23
 
24
- var _propTypes = _interopRequireDefault(require("prop-types"));
25
-
26
24
  var _variables = require("../common/variables.js");
27
25
 
28
26
  var _Icons = require("./Icons");
29
27
 
30
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
28
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
31
29
 
32
30
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
33
31
 
@@ -55,23 +53,14 @@ var Footer = function Footer(_ref3) {
55
53
  };
56
54
 
57
55
  var SideNav = function SideNav(props) {
58
- var displayArrow = props.displayArrow,
59
- mode = props.mode,
56
+ var _props$displayArrow = props.displayArrow,
57
+ displayArrow = _props$displayArrow === void 0 ? true : _props$displayArrow,
58
+ _props$mode = props.mode,
59
+ mode = _props$mode === void 0 ? "overlay" : _props$mode,
60
60
  childProps = (0, _objectWithoutProperties2["default"])(props, _excluded);
61
61
  return /*#__PURE__*/_react["default"].createElement(_main.DxcSidenav, childProps, childProps.children);
62
62
  };
63
63
 
64
- SideNav.propTypes = {
65
- mode: _propTypes["default"].oneOf(["overlay", "push", ""]),
66
- displayArrow: _propTypes["default"].bool,
67
- padding: _propTypes["default"].oneOfType([_propTypes["default"].shape({
68
- top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
69
- bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
70
- left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
71
- right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
72
- })])
73
- };
74
-
75
64
  var defaultFooter = function defaultFooter() {
76
65
  return /*#__PURE__*/_react["default"].createElement(_main.DxcFooter, {
77
66
  copyright: "\xA9 DXC Technology ".concat(year, "\u200B\u200B\u200B\u200B. All rights reserved."),
@@ -120,7 +109,7 @@ var DxcApplicationLayout = function DxcApplicationLayout(_ref4) {
120
109
  isSideNavVisible = _useState2[0],
121
110
  setIsSideNavVisible = _useState2[1];
122
111
 
123
- var _useState3 = (0, _react.useState)(),
112
+ var _useState3 = (0, _react.useState)(false),
124
113
  _useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
125
114
  isResponsive = _useState4[0],
126
115
  setIsResponsive = _useState4[1];
@@ -149,7 +138,7 @@ var DxcApplicationLayout = function DxcApplicationLayout(_ref4) {
149
138
 
150
139
  var handleResize = function handleResize(width) {
151
140
  if (width) {
152
- if (width <= _variables.responsiveSizes.tablet ? setIsResponsive(true) : setIsResponsive(false)) ;
141
+ setIsResponsive(width <= _variables.responsiveSizes.tablet);
153
142
  setIsSideNavVisible(true);
154
143
  }
155
144
  };
@@ -180,6 +169,7 @@ var DxcApplicationLayout = function DxcApplicationLayout(_ref4) {
180
169
  }, /*#__PURE__*/_react["default"].createElement(HeaderContainer, null, header), /*#__PURE__*/_react["default"].createElement(BodyContainer, null, /*#__PURE__*/_react["default"].createElement(ContentContainer, null, /*#__PURE__*/_react["default"].createElement(SideNavArrowContainer, {
181
170
  isSideNavVisible: isSideNavVisible
182
171
  }, sideNav, /*#__PURE__*/_react["default"].createElement(ArrowContainer, null, sideNav && (displayArrow || isResponsive) && /*#__PURE__*/_react["default"].createElement(ArrowTrigger, {
172
+ role: "button",
183
173
  tabIndex: 0,
184
174
  onClick: handleSidenav,
185
175
  isSideNavVisible: isSideNavVisible
@@ -0,0 +1,171 @@
1
+ import React from "react";
2
+ import DxcApplicationLayout from "./ApplicationLayout";
3
+ import DxcSidenav from "../sidenav/Sidenav";
4
+ import Title from "../../.storybook/components/Title";
5
+ import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport';
6
+ import { userEvent, within, waitFor } from "@storybook/testing-library";
7
+
8
+ export default {
9
+ title: "Application Layout ",
10
+ component: DxcApplicationLayout,
11
+ parameters: {
12
+ viewport: {
13
+ viewports: INITIAL_VIEWPORTS,
14
+ }
15
+ }
16
+ };
17
+
18
+ export const DefaultApplicationLayout = () => (
19
+ <>
20
+ <DxcApplicationLayout>
21
+ <DxcApplicationLayout.Main>
22
+ <Title title="Default application layout" theme="light" level={4} />
23
+ <p>Main Content</p>
24
+ <p>Main Content</p>
25
+ <p>Main Content</p>
26
+ <p>Main Content</p>
27
+ </DxcApplicationLayout.Main>
28
+ </DxcApplicationLayout>
29
+ </>
30
+ );
31
+
32
+ export const ApplicationLayoutWithDefaultSidenav = () => (
33
+ <>
34
+ <DxcApplicationLayout>
35
+ <DxcApplicationLayout.SideNav>
36
+ <DxcSidenav.Title>Application layout with sidenav</DxcSidenav.Title>
37
+ <p>SideNav Content</p>
38
+ <p>SideNav Content</p>
39
+ <p>SideNav Content</p>
40
+ <p>SideNav Content</p>
41
+ <p>SideNav Content</p>
42
+ </DxcApplicationLayout.SideNav>
43
+ <DxcApplicationLayout.Main>
44
+ <p>Main Content</p>
45
+ <p>Main Content</p>
46
+ <p>Main Content</p>
47
+ <p>Main Content</p>
48
+ </DxcApplicationLayout.Main>
49
+ </DxcApplicationLayout>
50
+ </>
51
+ );
52
+
53
+ export const ApplicationLayoutWithPushSidenav = () => (
54
+ <>
55
+ <DxcApplicationLayout>
56
+ <DxcApplicationLayout.SideNav mode="push">
57
+ <DxcSidenav.Title>Application layout with push sidenav</DxcSidenav.Title>
58
+ <p>SideNav Content</p>
59
+ <p>SideNav Content</p>
60
+ <p>SideNav Content</p>
61
+ <p>SideNav Content</p>
62
+ <p>SideNav Content</p>
63
+ </DxcApplicationLayout.SideNav>
64
+ <DxcApplicationLayout.Main>
65
+ <p>Main Content</p>
66
+ <p>Main Content</p>
67
+ <p>Main Content</p>
68
+ <p>Main Content</p>
69
+ </DxcApplicationLayout.Main>
70
+ </DxcApplicationLayout>
71
+ </>
72
+ );
73
+
74
+ export const ApplicationLayoutWithArrowSidenav = () => (
75
+ <>
76
+ <DxcApplicationLayout>
77
+ <DxcApplicationLayout.SideNav mode="overlay" displayArrow>
78
+ <DxcSidenav.Title>Application layout with push sidenav</DxcSidenav.Title>
79
+ <p>SideNav Content</p>
80
+ <p>SideNav Content</p>
81
+ <p>SideNav Content</p>
82
+ <p>SideNav Content</p>
83
+ <p>SideNav Content</p>
84
+ </DxcApplicationLayout.SideNav>
85
+ <DxcApplicationLayout.Main>
86
+ <p>Main Content</p>
87
+ <p>Main Content</p>
88
+ <p>Main Content</p>
89
+ <p>Main Content</p>
90
+ </DxcApplicationLayout.Main>
91
+ </DxcApplicationLayout>
92
+ </>
93
+ );
94
+
95
+ export const ApplicationLayoutWithResponsiveSidenav = () => (
96
+ <>
97
+ <DxcApplicationLayout>
98
+ <DxcApplicationLayout.SideNav>
99
+ <DxcSidenav.Title>Application layout with push sidenav</DxcSidenav.Title>
100
+ <p>SideNav Content</p>
101
+ <p>SideNav Content</p>
102
+ <p>SideNav Content</p>
103
+ <p>SideNav Content</p>
104
+ <p>SideNav Content</p>
105
+ </DxcApplicationLayout.SideNav>
106
+ <DxcApplicationLayout.Main>
107
+ <p>Main Content</p>
108
+ <p>Main Content</p>
109
+ <p>Main Content</p>
110
+ <p>Main Content</p>
111
+ </DxcApplicationLayout.Main>
112
+ </DxcApplicationLayout>
113
+ </>
114
+ );
115
+
116
+ ApplicationLayoutWithResponsiveSidenav.parameters = {
117
+ viewport: {
118
+ defaultViewport: 'pixel',
119
+ },
120
+ };
121
+
122
+ export const ApplicationLayoutWithCustomHeader = () => (
123
+ <>
124
+ <DxcApplicationLayout>
125
+ <DxcApplicationLayout.Header> <p>Custom Header</p> </DxcApplicationLayout.Header>
126
+ <DxcApplicationLayout.SideNav>
127
+ <DxcSidenav.Title>Application layout with push sidenav</DxcSidenav.Title>
128
+ <p>SideNav Content</p>
129
+ <p>SideNav Content</p>
130
+ <p>SideNav Content</p>
131
+ <p>SideNav Content</p>
132
+ <p>SideNav Content</p>
133
+ </DxcApplicationLayout.SideNav>
134
+ <DxcApplicationLayout.Main>
135
+ <p>Main Content</p>
136
+ <p>Main Content</p>
137
+ <p>Main Content</p>
138
+ <p>Main Content</p>
139
+ </DxcApplicationLayout.Main>
140
+ </DxcApplicationLayout>
141
+ </>
142
+ );
143
+
144
+ export const ApplicationLayoutWithCustomFooter = () => (
145
+ <>
146
+ <DxcApplicationLayout>
147
+ <DxcApplicationLayout.SideNav>
148
+ <DxcSidenav.Title>Application layout with push sidenav</DxcSidenav.Title>
149
+ <p>SideNav Content</p>
150
+ <p>SideNav Content</p>
151
+ <p>SideNav Content</p>
152
+ <p>SideNav Content</p>
153
+ <p>SideNav Content</p>
154
+ </DxcApplicationLayout.SideNav>
155
+ <DxcApplicationLayout.Main>
156
+ <p>Main Content</p>
157
+ <p>Main Content</p>
158
+ <p>Main Content</p>
159
+ <p>Main Content</p>
160
+ </DxcApplicationLayout.Main>
161
+ <DxcApplicationLayout.Footer> <p>Custom Footer</p> </DxcApplicationLayout.Footer>
162
+ </DxcApplicationLayout>
163
+ </>
164
+ );
165
+
166
+ export const ApplicationLayoutWithClosingSidenav = ApplicationLayoutWithArrowSidenav.bind({});
167
+ ApplicationLayoutWithClosingSidenav.play = async ({ canvasElement }) => {
168
+ const canvas = within(canvasElement);
169
+ const arrow = canvas.getByRole("button");
170
+ await userEvent.click(arrow);
171
+ };
@@ -0,0 +1,57 @@
1
+ /// <reference types="react" />
2
+ declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
+ declare type Padding = {
4
+ top?: Space;
5
+ bottom?: Space;
6
+ left?: Space;
7
+ right?: Space;
8
+ };
9
+ declare type ChildrenType = AppLayoutHeaderPropsType | AppLayoutMainPropsType | AppLayoutFooterPropsType | AppLayoutSidenavPropsType;
10
+ export declare type AppLayoutHeaderPropsType = {
11
+ /**
12
+ * Everything between this tags will be displayed as a header, at the top of the screen.
13
+ * This is optional and if it is not specified, the DxcHeader will be shown by default.
14
+ */
15
+ children?: React.ReactNode;
16
+ };
17
+ export declare type AppLayoutMainPropsType = {
18
+ /**
19
+ * Everything between the tags will be displayed as the content of the main part of the application.
20
+ */
21
+ children: React.ReactNode;
22
+ };
23
+ export declare type AppLayoutFooterPropsType = {
24
+ /**
25
+ * Everything between the tags will be displayed as a footer, at the bottom of the screen.
26
+ * This is optional and if it is not specified, the DxcFooter will be shown by default.
27
+ */
28
+ children?: React.ReactNode;
29
+ };
30
+ export declare type AppLayoutSidenavPropsType = {
31
+ /**
32
+ * Size of the padding to be applied to the custom area ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
33
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different padding sizes.
34
+ */
35
+ padding?: Space | Padding;
36
+ /**
37
+ * The area inside the sidenav. This area can be used to render custom content.
38
+ */
39
+ children: React.ReactNode;
40
+ /**
41
+ * If false, the arrow button is hidden.
42
+ * In lower resolutions the arrow will be always displayed.
43
+ */
44
+ displayArrow?: boolean;
45
+ /**
46
+ * Default action over the content of the page, overlay the content or push to the right ('push' | 'overlay').
47
+ * In lower resolutions the mode will always be overlay.
48
+ */
49
+ mode: "push" | "overlay";
50
+ };
51
+ declare type AppLayoutPropsType = {
52
+ /**
53
+ * The area inside the sidenav. This area can be used to render custom content.
54
+ */
55
+ children: React.ReactElement<ChildrenType> | React.ReactElement<ChildrenType>[];
56
+ };
57
+ export default AppLayoutPropsType;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
package/link/Link.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import Overload from "./types";
2
+ declare const DxcLink: Overload;
3
+ export default DxcLink;
package/link/Link.js CHANGED
@@ -9,8 +9,6 @@ Object.defineProperty(exports, "__esModule", {
9
9
  });
10
10
  exports["default"] = void 0;
11
11
 
12
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
-
14
12
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
15
13
 
16
14
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
@@ -19,11 +17,9 @@ var _react = _interopRequireDefault(require("react"));
19
17
 
20
18
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
21
19
 
22
- var _propTypes = _interopRequireDefault(require("prop-types"));
23
-
24
20
  var _variables = require("../common/variables.js");
25
21
 
26
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
22
+ var _useTheme = _interopRequireDefault(require("../useTheme"));
27
23
 
28
24
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
29
25
 
@@ -93,7 +89,7 @@ var DxcLinkContainer = _styledComponents["default"].div(_templateObject || (_tem
93
89
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
94
90
  });
95
91
 
96
- var StyledLink = _styledComponents["default"].a(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n ", "\n\n text-decoration-color: transparent;\n ", "\n\n &:visited {\n color: ", ";\n &:hover {\n ", "\n }\n }\n &:hover {\n ", "\n }\n &:focus {\n outline-color: ", ";\n outline-width: 2px;\n ", "\n }\n &:active {\n ", "\n }\n"])), function (props) {
92
+ var StyledLink = _styledComponents["default"].a(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n ", "\n\n text-decoration-color: transparent;\n ", "\n\n &:visited {\n color: ", ";\n &:hover {\n ", "\n }\n }\n &:hover {\n ", "\n }\n &:focus {\n border-radius: 2px;\n outline: 2px solid ", ";\n ", "\n }\n &:active {\n ", "\n }\n"])), function (props) {
97
93
  return props.inheritColor ? "inherit" : !props.disabled ? props.theme.fontColor : props.theme.disabledColor;
98
94
  }, function (props) {
99
95
  return props.disabled ? "pointer-events: none;" : "";
@@ -113,7 +109,7 @@ var StyledLink = _styledComponents["default"].a(_templateObject2 || (_templateOb
113
109
  return "color: ".concat(props.theme.activeFontColor, " !important;\n border-bottom-color: ").concat(props.theme.activeUnderlineColor, " !important;");
114
110
  });
115
111
 
116
- var StyledButton = _styledComponents["default"].button(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n font-family: inherit;\n text-decoration-color: transparent;\n\n ", "\n ", "\n color: ", ";\n ", "\n\n &:hover {\n ", "\n }\n &:focus {\n outline-color: ", ";\n outline-width: 2px;\n outline-offset: 1px;\n ", "\n }\n &:active {\n ", "\n }\n"])), function (props) {
112
+ var StyledButton = _styledComponents["default"].button(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n font-family: inherit;\n text-decoration-color: transparent;\n\n ", "\n ", "\n color: ", ";\n ", "\n\n &:hover {\n ", "\n }\n &:focus {\n border-radius: 2px;\n outline: 2px solid ", ";\n ", "\n }\n &:active {\n ", "\n }\n"])), function (props) {
117
113
  return "padding-bottom: ".concat(props.theme.underlineSpacing, ";\n border-bottom: ").concat(props.theme.underlineThickness, " ").concat(props.theme.underlineStyle, " transparent;");
118
114
  }, function (props) {
119
115
  return props.disabled && "cursor: default;";
@@ -153,7 +149,7 @@ var LinkIcon = _styledComponents["default"].img(_templateObject5 || (_templateOb
153
149
  return "".concat(props.iconPosition === "before" ? "margin-right" : "margin-left", ": ").concat(props.theme.iconSpacing);
154
150
  });
155
151
 
156
- var LinkIconContainer = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n ", ";\n overflow: hidden;\n \n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
152
+ var LinkIconContainer = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n ", ";\n overflow: hidden;\n\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
157
153
  return props.theme.iconSize;
158
154
  }, function (props) {
159
155
  return props.theme.iconSize;
@@ -161,23 +157,5 @@ var LinkIconContainer = _styledComponents["default"].div(_templateObject6 || (_t
161
157
  return "".concat(props.iconPosition === "before" ? "margin-right" : "margin-left", ": ").concat(props.theme.iconSpacing);
162
158
  });
163
159
 
164
- DxcLink.propTypes = {
165
- inheritColor: _propTypes["default"].bool,
166
- disabled: _propTypes["default"].bool,
167
- icon: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].func]),
168
- iconSrc: _propTypes["default"].string,
169
- iconPosition: _propTypes["default"].oneOf(["after", "before"]),
170
- href: _propTypes["default"].string,
171
- onClick: _propTypes["default"].func,
172
- margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
173
- top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
174
- bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
175
- left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
176
- right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
177
- }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
178
- newWindow: _propTypes["default"].bool,
179
- text: _propTypes["default"].string,
180
- tabIndex: _propTypes["default"].number
181
- };
182
160
  var _default = DxcLink;
183
161
  exports["default"] = _default;