@dxc-technology/halstack-react 0.0.0-71a326e → 0.0.0-7303985

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 (222) 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.js +2 -2
  8. package/accordion/Accordion.stories.tsx +300 -0
  9. package/accordion/types.d.ts +2 -2
  10. package/accordion-group/AccordionGroup.js +2 -2
  11. package/accordion-group/AccordionGroup.stories.tsx +225 -0
  12. package/accordion-group/types.d.ts +2 -2
  13. package/alert/Alert.js +2 -2
  14. package/alert/Alert.stories.tsx +170 -0
  15. package/alert/types.d.ts +1 -1
  16. package/badge/Badge.js +1 -1
  17. package/box/Box.d.ts +4 -0
  18. package/box/Box.js +6 -32
  19. package/box/Box.stories.tsx +132 -0
  20. package/box/types.d.ts +43 -0
  21. package/box/types.js +5 -0
  22. package/button/Button.d.ts +1 -1
  23. package/button/Button.js +9 -12
  24. package/button/Button.stories.tsx +217 -234
  25. package/button/types.d.ts +11 -11
  26. package/card/Card.d.ts +4 -0
  27. package/card/Card.js +17 -53
  28. package/card/Card.stories.tsx +201 -0
  29. package/card/ice-cream.jpg +0 -0
  30. package/card/types.d.ts +67 -0
  31. package/card/types.js +5 -0
  32. package/checkbox/Checkbox.js +2 -2
  33. package/checkbox/Checkbox.stories.tsx +192 -0
  34. package/checkbox/types.d.ts +1 -1
  35. package/chip/Chip.d.ts +4 -0
  36. package/chip/Chip.js +5 -27
  37. package/chip/Chip.stories.tsx +121 -0
  38. package/chip/types.d.ts +53 -0
  39. package/chip/types.js +5 -0
  40. package/common/variables.js +49 -44
  41. package/date/Date.js +1 -1
  42. package/date-input/DateInput.js +4 -7
  43. package/date-input/DateInput.stories.tsx +138 -0
  44. package/dialog/Dialog.d.ts +4 -0
  45. package/dialog/Dialog.js +6 -25
  46. package/dialog/Dialog.stories.tsx +212 -0
  47. package/dialog/types.d.ts +43 -0
  48. package/dialog/types.js +5 -0
  49. package/dropdown/Dropdown.d.ts +4 -0
  50. package/dropdown/Dropdown.js +8 -41
  51. package/dropdown/Dropdown.stories.tsx +247 -0
  52. package/dropdown/types.d.ts +89 -0
  53. package/dropdown/types.js +5 -0
  54. package/file-input/FileInput.d.ts +4 -0
  55. package/file-input/FileInput.js +65 -76
  56. package/file-input/FileItem.d.ts +14 -0
  57. package/file-input/FileItem.js +12 -21
  58. package/file-input/types.d.ts +112 -0
  59. package/file-input/types.js +5 -0
  60. package/footer/Footer.d.ts +4 -0
  61. package/footer/Footer.js +15 -52
  62. package/footer/Footer.stories.tsx +130 -0
  63. package/footer/Icons.d.ts +2 -0
  64. package/footer/Icons.js +3 -3
  65. package/footer/types.d.ts +65 -0
  66. package/footer/types.js +5 -0
  67. package/header/Header.d.ts +7 -0
  68. package/header/Header.js +28 -30
  69. package/header/Header.stories.tsx +162 -0
  70. package/header/Icons.d.ts +2 -0
  71. package/header/Icons.js +2 -27
  72. package/header/types.d.ts +47 -0
  73. package/header/types.js +5 -0
  74. package/heading/Heading.d.ts +4 -0
  75. package/heading/Heading.js +7 -24
  76. package/heading/Heading.stories.tsx +53 -0
  77. package/heading/types.d.ts +33 -0
  78. package/heading/types.js +5 -0
  79. package/input-text/InputText.js +2 -2
  80. package/layout/ApplicationLayout.d.ts +10 -0
  81. package/layout/ApplicationLayout.js +8 -18
  82. package/layout/ApplicationLayout.stories.tsx +171 -0
  83. package/layout/types.d.ts +57 -0
  84. package/layout/types.js +5 -0
  85. package/link/Link.d.ts +3 -0
  86. package/link/Link.js +4 -26
  87. package/link/Link.stories.tsx +146 -0
  88. package/link/types.d.ts +74 -0
  89. package/link/types.js +5 -0
  90. package/list/List.d.ts +8 -0
  91. package/list/List.js +47 -0
  92. package/list/List.stories.tsx +85 -0
  93. package/main.d.ts +7 -3
  94. package/main.js +34 -2
  95. package/number-input/NumberInput.d.ts +4 -0
  96. package/number-input/NumberInput.js +5 -50
  97. package/number-input/NumberInput.stories.tsx +115 -0
  98. package/number-input/NumberInputContext.d.ts +4 -0
  99. package/number-input/NumberInputContext.js +5 -2
  100. package/number-input/numberInputContextTypes.d.ts +19 -0
  101. package/number-input/numberInputContextTypes.js +5 -0
  102. package/number-input/types.d.ts +117 -0
  103. package/number-input/types.js +5 -0
  104. package/package.json +1 -1
  105. package/paginator/Paginator.js +2 -8
  106. package/paginator/Paginator.stories.tsx +63 -0
  107. package/password-input/PasswordInput.d.ts +4 -0
  108. package/password-input/PasswordInput.js +19 -55
  109. package/password-input/{PasswordInput.stories.jsx → PasswordInput.stories.tsx} +1 -1
  110. package/password-input/types.d.ts +107 -0
  111. package/password-input/types.js +5 -0
  112. package/progress-bar/ProgressBar.d.ts +4 -0
  113. package/progress-bar/ProgressBar.js +5 -23
  114. package/progress-bar/ProgressBar.stories.jsx +58 -0
  115. package/progress-bar/types.d.ts +37 -0
  116. package/progress-bar/types.js +5 -0
  117. package/radio/Radio.js +2 -2
  118. package/radio/Radio.stories.tsx +192 -0
  119. package/radio/types.d.ts +2 -2
  120. package/resultsetTable/ResultsetTable.d.ts +4 -0
  121. package/resultsetTable/ResultsetTable.js +4 -27
  122. package/resultsetTable/ResultsetTable.stories.tsx +276 -0
  123. package/resultsetTable/types.d.ts +67 -0
  124. package/resultsetTable/types.js +5 -0
  125. package/row/Row.d.ts +11 -0
  126. package/row/Row.js +124 -0
  127. package/row/Row.stories.tsx +223 -0
  128. package/select/Select.js +15 -17
  129. package/select/Select.stories.tsx +572 -0
  130. package/select/index.d.ts +4 -4
  131. package/sidenav/Sidenav.d.ts +9 -0
  132. package/sidenav/Sidenav.js +6 -15
  133. package/sidenav/Sidenav.stories.tsx +165 -0
  134. package/sidenav/types.d.ts +50 -0
  135. package/sidenav/types.js +5 -0
  136. package/slider/Slider.d.ts +4 -0
  137. package/slider/Slider.js +61 -84
  138. package/slider/Slider.stories.tsx +177 -0
  139. package/slider/types.d.ts +78 -0
  140. package/slider/types.js +5 -0
  141. package/spinner/Spinner.d.ts +4 -0
  142. package/spinner/Spinner.js +8 -25
  143. package/spinner/Spinner.stories.jsx +102 -0
  144. package/spinner/types.d.ts +32 -0
  145. package/spinner/types.js +5 -0
  146. package/stack/Stack.d.ts +10 -0
  147. package/stack/Stack.js +94 -0
  148. package/stack/Stack.stories.tsx +150 -0
  149. package/switch/Switch.js +4 -4
  150. package/switch/Switch.stories.tsx +160 -0
  151. package/table/Table.d.ts +4 -0
  152. package/table/Table.js +3 -3
  153. package/table/Table.stories.jsx +276 -0
  154. package/table/types.d.ts +21 -0
  155. package/table/types.js +5 -0
  156. package/tabs/Tabs.d.ts +4 -0
  157. package/tabs/Tabs.js +9 -55
  158. package/tabs/Tabs.stories.tsx +121 -0
  159. package/tabs/types.d.ts +70 -0
  160. package/tabs/types.js +5 -0
  161. package/tag/Tag.d.ts +4 -0
  162. package/tag/Tag.js +21 -36
  163. package/tag/Tag.stories.tsx +145 -0
  164. package/tag/types.d.ts +60 -0
  165. package/tag/types.js +5 -0
  166. package/text/Text.d.ts +7 -0
  167. package/text/Text.js +30 -0
  168. package/text/Text.stories.tsx +19 -0
  169. package/text-input/TextInput.d.ts +4 -0
  170. package/text-input/TextInput.js +42 -81
  171. package/text-input/TextInput.stories.tsx +456 -0
  172. package/text-input/types.d.ts +159 -0
  173. package/text-input/types.js +5 -0
  174. package/textarea/Textarea.d.ts +4 -0
  175. package/textarea/Textarea.js +27 -60
  176. package/textarea/Textarea.stories.jsx +135 -0
  177. package/textarea/types.d.ts +130 -0
  178. package/textarea/types.js +5 -0
  179. package/toggle/Toggle.js +1 -1
  180. package/toggle-group/ToggleGroup.d.ts +4 -0
  181. package/toggle-group/ToggleGroup.js +16 -45
  182. package/toggle-group/ToggleGroup.stories.tsx +173 -0
  183. package/toggle-group/types.d.ts +97 -0
  184. package/toggle-group/types.js +5 -0
  185. package/upload/buttons-upload/ButtonsUpload.js +2 -2
  186. package/upload/dragAndDropArea/DragAndDropArea.js +2 -2
  187. package/upload/file-upload/FileToUpload.js +1 -1
  188. package/upload/files-upload/FilesToUpload.js +1 -1
  189. package/upload/transaction/Transaction.js +2 -2
  190. package/upload/transactions/Transactions.js +1 -1
  191. package/useTheme.d.ts +2 -0
  192. package/useTheme.js +1 -1
  193. package/wizard/Wizard.d.ts +4 -0
  194. package/wizard/Wizard.js +69 -59
  195. package/wizard/Wizard.stories.tsx +224 -0
  196. package/wizard/types.d.ts +60 -0
  197. package/wizard/types.js +5 -0
  198. package/box/index.d.ts +0 -25
  199. package/card/index.d.ts +0 -22
  200. package/chip/index.d.ts +0 -22
  201. package/dialog/index.d.ts +0 -18
  202. package/dropdown/index.d.ts +0 -26
  203. package/file-input/index.d.ts +0 -81
  204. package/footer/index.d.ts +0 -25
  205. package/header/index.d.ts +0 -25
  206. package/heading/index.d.ts +0 -17
  207. package/link/index.d.ts +0 -23
  208. package/number-input/index.d.ts +0 -113
  209. package/password-input/index.d.ts +0 -94
  210. package/progress-bar/index.d.ts +0 -18
  211. package/resultsetTable/index.d.ts +0 -19
  212. package/sidenav/index.d.ts +0 -13
  213. package/slider/index.d.ts +0 -29
  214. package/spinner/index.d.ts +0 -17
  215. package/table/index.d.ts +0 -13
  216. package/tabs/index.d.ts +0 -19
  217. package/tag/index.d.ts +0 -24
  218. package/text-input/index.d.ts +0 -135
  219. package/textarea/index.d.ts +0 -117
  220. package/toggle-group/index.d.ts +0 -21
  221. package/wizard/Icons.js +0 -65
  222. package/wizard/index.d.ts +0 -18
package/header/Icons.js CHANGED
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.hamburgerIcon = exports.dxcLogo = exports.closeIcon = void 0;
8
+ exports.dxcLogo = void 0;
9
9
 
10
10
  var _react = _interopRequireDefault(require("react"));
11
11
 
@@ -31,29 +31,4 @@ var dxcLogo = /*#__PURE__*/_react["default"].createElement("svg", {
31
31
  fill: "#100f0d"
32
32
  }))));
33
33
 
34
- exports.dxcLogo = dxcLogo;
35
-
36
- var closeIcon = /*#__PURE__*/_react["default"].createElement("svg", {
37
- xmlns: "http://www.w3.org/2000/svg",
38
- height: "24",
39
- viewBox: "0 0 24 24",
40
- width: "24"
41
- }, /*#__PURE__*/_react["default"].createElement("path", {
42
- d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
43
- }), /*#__PURE__*/_react["default"].createElement("path", {
44
- d: "M0 0h24v24H0z",
45
- fill: "none"
46
- }));
47
-
48
- exports.closeIcon = closeIcon;
49
-
50
- var hamburgerIcon = /*#__PURE__*/_react["default"].createElement("svg", {
51
- xmlns: "http://www.w3.org/2000/svg",
52
- viewBox: "0 0 24 24",
53
- width: "24",
54
- height: "24"
55
- }, /*#__PURE__*/_react["default"].createElement("path", {
56
- d: "M3,8H21a1,1,0,0,0,0-2H3A1,1,0,0,0,3,8Zm18,8H3a1,1,0,0,0,0,2H21a1,1,0,0,0,0-2Zm0-5H3a1,1,0,0,0,0,2H21a1,1,0,0,0,0-2Z"
57
- }));
58
-
59
- exports.hamburgerIcon = hamburgerIcon;
34
+ exports.dxcLogo = dxcLogo;
@@ -0,0 +1,47 @@
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 Props = {
10
+ /**
11
+ * Wether a contrast line should appear at the bottom of the header.
12
+ */
13
+ underlined?: boolean;
14
+ /**
15
+ * Content showed in the header. Take into account that the component applies styles
16
+ * for the first child in the content, so we recommend the use of React.Fragment
17
+ * to be applied correctly. Otherwise, the styles can be modified.
18
+ */
19
+ content?: React.ReactNode;
20
+ /**
21
+ * Content showed in responsive version. It receives the close menu handler that can
22
+ * be used to add that functionality when a element is clicked.
23
+ */
24
+ responsiveContent?: (closeHandler: () => void) => React.ReactNode;
25
+ /**
26
+ * This function will be called when the user clicks the header logo.
27
+ */
28
+ onClick?: () => void;
29
+ /**
30
+ * Size of the bottom margin to be applied to the header
31
+ * ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
32
+ */
33
+ margin?: Space;
34
+ /**
35
+ * Size of the padding to be applied to the custom area of the component
36
+ * ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
37
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in
38
+ * order to specify different padding sizes.
39
+ */
40
+ padding?: Space | Padding;
41
+ /**
42
+ * Value of the tabindex for all interactuable elements, except those inside the
43
+ * custom area.
44
+ */
45
+ tabIndex?: number;
46
+ };
47
+ 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 HeadingPropsType from "./types";
3
+ declare const DxcHeading: ({ level, text, as, weight, margin }: HeadingPropsType) => JSX.Element;
4
+ export default DxcHeading;
@@ -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;