@dxc-technology/halstack-react 0.0.0-84c9364 → 0.0.0-850ec24

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.
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import FileInputPropsType from "./types";
3
+ declare const DxcFileInput: ({ name, mode, label, helperText, accept, minSize, maxSize, showPreview, multiple, disabled, callbackFile, value, margin, tabIndex, }: FileInputPropsType) => JSX.Element;
4
+ export default DxcFileInput;
@@ -23,8 +23,6 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
23
23
 
24
24
  var _react = _interopRequireWildcard(require("react"));
25
25
 
26
- var _propTypes = _interopRequireDefault(require("prop-types"));
27
-
28
26
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
29
27
 
30
28
  var _uuid = require("uuid");
@@ -103,7 +101,8 @@ var DxcFileInput = function DxcFileInput(_ref) {
103
101
  callbackFile = _ref.callbackFile,
104
102
  value = _ref.value,
105
103
  margin = _ref.margin,
106
- tabIndex = _ref.tabIndex;
104
+ _ref$tabIndex = _ref.tabIndex,
105
+ tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
107
106
 
108
107
  var _useState = (0, _react.useState)(false),
109
108
  _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
@@ -329,8 +328,7 @@ var DxcFileInput = function DxcFileInput(_ref) {
329
328
  theme: colorsTheme.fileInput
330
329
  }, /*#__PURE__*/_react["default"].createElement(FileInputContainer, {
331
330
  margin: margin,
332
- name: name,
333
- tabIndex: tabIndex
331
+ name: name
334
332
  }, /*#__PURE__*/_react["default"].createElement(Label, {
335
333
  htmlFor: fileInputId,
336
334
  disabled: disabled
@@ -368,7 +366,8 @@ var DxcFileInput = function DxcFileInput(_ref) {
368
366
  numFiles: files.length,
369
367
  preview: file.preview,
370
368
  type: file.file.type,
371
- onDelete: onDelete
369
+ onDelete: onDelete,
370
+ tabIndex: tabIndex
372
371
  })));
373
372
  })) : /*#__PURE__*/_react["default"].createElement(Container, null, /*#__PURE__*/_react["default"].createElement(DragDropArea, {
374
373
  isDragging: isDragging,
@@ -408,7 +407,8 @@ var DxcFileInput = function DxcFileInput(_ref) {
408
407
  numFiles: files.length,
409
408
  preview: file.preview,
410
409
  type: file.file.type,
411
- onDelete: onDelete
410
+ onDelete: onDelete,
411
+ tabIndex: tabIndex
412
412
  }));
413
413
  }))));
414
414
  };
@@ -507,26 +507,5 @@ var ErrorMessage = _styledComponents["default"].div(_templateObject11 || (_templ
507
507
  return props.theme.errorMessageLineHeight;
508
508
  });
509
509
 
510
- DxcFileInput.propTypes = {
511
- name: _propTypes["default"].string,
512
- mode: _propTypes["default"].oneOf(["file", "filedrop", "dropzone"]),
513
- label: _propTypes["default"].string,
514
- helperText: _propTypes["default"].string,
515
- accept: _propTypes["default"].array,
516
- maxSize: _propTypes["default"].number,
517
- minSize: _propTypes["default"].number,
518
- multiple: _propTypes["default"].bool,
519
- showPreview: _propTypes["default"].bool,
520
- disabled: _propTypes["default"].bool,
521
- callbackFile: _propTypes["default"].func,
522
- value: _propTypes["default"].array,
523
- tabIndex: _propTypes["default"].number,
524
- margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
525
- top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
526
- bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
527
- left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
528
- right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
529
- }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))])
530
- };
531
510
  var _default = DxcFileInput;
532
511
  exports["default"] = _default;
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ declare const FileItem: ({ mode, multiple, name, error, showPreview, preview, type, numFiles, onDelete, tabIndex, }: {
3
+ mode: any;
4
+ multiple: any;
5
+ name?: string;
6
+ error?: string;
7
+ showPreview: any;
8
+ preview: any;
9
+ type: any;
10
+ numFiles: any;
11
+ onDelete: any;
12
+ tabIndex: any;
13
+ }) => JSX.Element;
14
+ export default FileItem;
@@ -13,8 +13,6 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
13
13
 
14
14
  var _react = _interopRequireDefault(require("react"));
15
15
 
16
- var _propTypes = _interopRequireDefault(require("prop-types"));
17
-
18
16
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
19
17
 
20
18
  var _useTheme = _interopRequireDefault(require("../useTheme.js"));
@@ -59,7 +57,8 @@ var FileItem = function FileItem(_ref) {
59
57
  preview = _ref.preview,
60
58
  type = _ref.type,
61
59
  numFiles = _ref.numFiles,
62
- onDelete = _ref.onDelete;
60
+ onDelete = _ref.onDelete,
61
+ tabIndex = _ref.tabIndex;
63
62
  var colorsTheme = (0, _useTheme["default"])();
64
63
  var isImage = type.includes("image");
65
64
 
@@ -104,7 +103,8 @@ var FileItem = function FileItem(_ref) {
104
103
  onClick: function onClick() {
105
104
  return onDelete(name);
106
105
  },
107
- "aria-label": "Remove ".concat(name)
106
+ "aria-label": "Remove ".concat(name),
107
+ tabIndex: tabIndex
108
108
  }, deleteIcon)), error && (multiple || numFiles > 1) && /*#__PURE__*/_react["default"].createElement(ErrorMessage, null, error))));
109
109
  };
110
110
 
@@ -178,16 +178,5 @@ var ErrorMessage = _styledComponents["default"].span(_templateObject10 || (_temp
178
178
  return props.theme.errorMessageLineHeight;
179
179
  });
180
180
 
181
- FileItem.propTypes = {
182
- mode: _propTypes["default"].string,
183
- multiple: _propTypes["default"].bool,
184
- name: _propTypes["default"].string,
185
- type: _propTypes["default"].string,
186
- showPreview: _propTypes["default"]["boolean"],
187
- numFiles: _propTypes["default"].number,
188
- preview: _propTypes["default"].string,
189
- error: _propTypes["default"].string,
190
- onDelete: _propTypes["default"].func
191
- };
192
181
  var _default = FileItem;
193
182
  exports["default"] = _default;
@@ -0,0 +1,87 @@
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 FileData = {
9
+ /**
10
+ * Selected file.
11
+ */
12
+ file: File;
13
+ /**
14
+ * Error of the file. If it is defined, it will be shown and the file item will be mark as invalid.
15
+ */
16
+ error?: string;
17
+ /**
18
+ * Preview of the file.
19
+ */
20
+ preview?: string;
21
+ };
22
+ declare type Props = {
23
+ /**
24
+ * Name attribute.
25
+ */
26
+ name?: string;
27
+ /**
28
+ * Text to be placed above the component.
29
+ */
30
+ label?: string;
31
+ /**
32
+ * Uses one of the available file input modes:
33
+ * 'file': Files are selected by clicking the button and selecting it through the file explorer.
34
+ * 'filedrop': Files can be selected by clicking the button and selecting it through the file explorer or by dropping them inside the drag and drop area.
35
+ * 'dropzone': Files can be selected by clicking the button and selecting it through the file explorer or by dropping them inside the drag and drop area.
36
+ * The drag and drop area of this mode is bigger than the one of the filedrop mode.
37
+ */
38
+ mode?: "file" | "filedrop" | "dropzone";
39
+ /**
40
+ * Helper text to be placed above the component.
41
+ */
42
+ helperText?: string;
43
+ /**
44
+ * The file types that the component accepts. Its value must be one of all the possible values of the HTML file input's accept attribute.
45
+ */
46
+ accept?: string;
47
+ /**
48
+ * An array of files representing the selected files.
49
+ */
50
+ value: FileData[];
51
+ /**
52
+ * The minimum file size (in bytes) allowed. If the size of the file does not comply the minSize, the file will have an error.
53
+ */
54
+ minSize?: number;
55
+ /**
56
+ * The maximum file size (in bytes) allowed. If the size of the file does not comply the maxSize, the file will have an error.
57
+ */
58
+ maxSize?: number;
59
+ /**
60
+ * If true, if the file is an image, a preview of it will be shown. If not, an icon refering to the file type will be shown.
61
+ */
62
+ showPreview?: boolean;
63
+ /**
64
+ * If true, the component allows multiple file items and will show all of them. If false, only one file will be shown, and if there is already one
65
+ * file selected and a new one is chosen, it will be replaced by the new selected one.
66
+ */
67
+ multiple?: boolean;
68
+ /**
69
+ * If true, the component will be disabled.
70
+ */
71
+ disabled?: boolean;
72
+ /**
73
+ * This function will be called when the user selects or drops a file. The list of files will be sent as a parameter.
74
+ * In this function, the files can be updated or returned as they come. These files must be passed to the value in order to be shown.
75
+ */
76
+ callbackFile: (files: FileData[]) => void;
77
+ /**
78
+ * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
79
+ * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
80
+ */
81
+ margin?: Space | Margin;
82
+ /**
83
+ * Value of the tabindex attribute.
84
+ */
85
+ tabIndex?: number;
86
+ };
87
+ export default Props;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
package/footer/types.d.ts CHANGED
@@ -38,7 +38,7 @@ declare type FooterPropsType = {
38
38
  * The center section of the footer. Can be used to render custom
39
39
  * content in this area.
40
40
  */
41
- children: React.ReactNode;
41
+ children?: React.ReactNode;
42
42
  /**
43
43
  * The text that will be displayed as copyright disclaimer.
44
44
  */
@@ -0,0 +1,162 @@
1
+ import React from "react";
2
+ import DxcHeader from "./Header";
3
+ import Title from "../../.storybook/components/Title";
4
+ import ExampleContainer from "../../.storybook/components/ExampleContainer";
5
+ import { userEvent, waitFor, within } from "@storybook/testing-library";
6
+
7
+ export default {
8
+ title: "Header",
9
+ component: DxcHeader,
10
+ };
11
+
12
+ const options: any = [
13
+ {
14
+ value: 1,
15
+ label: "Amazon",
16
+ },
17
+ ];
18
+
19
+ export const Chromatic = () => (
20
+ <>
21
+ <ExampleContainer>
22
+ <Title title="Default with dropdown" theme="light" level={4} />
23
+ <DxcHeader content={<DxcHeader.Dropdown options={options} label="Default Dropdown" />} />
24
+ </ExampleContainer>
25
+ <ExampleContainer>
26
+ <Title title="Underlined with text" theme="light" level={4} />
27
+ <DxcHeader underlined content={<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>} />
28
+ </ExampleContainer>
29
+ <ExampleContainer>
30
+ <Title title="Responsive" theme="light" level={4} />
31
+ <div style={{ width: "400px" }}>
32
+ <DxcHeader
33
+ responsiveContent={(closeHandler) => <DxcHeader.Dropdown options={options} label="Default Dropdown" />}
34
+ underlined
35
+ />
36
+ </div>
37
+ </ExampleContainer>
38
+ <Title title="Margins" theme="light" level={2} />
39
+ <ExampleContainer>
40
+ <Title title="Xxsmall margin" theme="light" level={4} />
41
+ <DxcHeader underlined margin="xxsmall" />
42
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
43
+ </ExampleContainer>
44
+ <ExampleContainer>
45
+ <Title title="Xsmall margin" theme="light" level={4} />
46
+ <DxcHeader underlined margin="xsmall" />
47
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
48
+ </ExampleContainer>
49
+ <ExampleContainer>
50
+ <Title title="Small margin" theme="light" level={4} />
51
+ <DxcHeader underlined margin="small" />
52
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
53
+ </ExampleContainer>
54
+ <ExampleContainer>
55
+ <Title title="Medium margin" theme="light" level={4} />
56
+ <DxcHeader underlined margin="medium" />
57
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
58
+ </ExampleContainer>
59
+ <ExampleContainer>
60
+ <Title title="Large margin" theme="light" level={4} />
61
+ <DxcHeader underlined margin="large" />
62
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
63
+ </ExampleContainer>
64
+ <ExampleContainer>
65
+ <Title title="Xlarge margin" theme="light" level={4} />
66
+ <DxcHeader underlined margin="xlarge" />
67
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
68
+ </ExampleContainer>
69
+ <ExampleContainer>
70
+ <Title title="Xxlarge margin" theme="light" level={4} />
71
+ <DxcHeader underlined margin="xxlarge" />
72
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras felis.</p>
73
+ </ExampleContainer>
74
+
75
+ <Title title="Paddings" theme="light" level={2} />
76
+ <ExampleContainer>
77
+ <Title title="Xxsmall padding" theme="light" level={4} />
78
+ <DxcHeader underlined padding="xxsmall" />
79
+ </ExampleContainer>
80
+ <ExampleContainer>
81
+ <Title title="Xsmall padding" theme="light" level={4} />
82
+ <DxcHeader underlined padding="xsmall" />
83
+ </ExampleContainer>
84
+ <ExampleContainer>
85
+ <Title title="Small padding" theme="light" level={4} />
86
+ <DxcHeader underlined padding="small" />
87
+ </ExampleContainer>
88
+ <ExampleContainer>
89
+ <Title title="Medium padding" theme="light" level={4} />
90
+ <DxcHeader underlined padding="medium" />
91
+ </ExampleContainer>
92
+ <ExampleContainer>
93
+ <Title title="Large padding" theme="light" level={4} />
94
+ <DxcHeader underlined padding="large" />
95
+ </ExampleContainer>
96
+ <ExampleContainer>
97
+ <Title title="Xlarge padding" theme="light" level={4} />
98
+ <DxcHeader underlined padding="xlarge" />
99
+ </ExampleContainer>
100
+ <ExampleContainer>
101
+ <Title title="Xxlarge padding" theme="light" level={4} />
102
+ <DxcHeader underlined padding="xxlarge" />
103
+ </ExampleContainer>
104
+ </>
105
+ );
106
+
107
+ const RespHeader = () => (
108
+ <ExampleContainer>
109
+ <Title title="Responsive" theme="light" level={4} />
110
+ <div style={{ maxWidth: "400px" }}>
111
+ <DxcHeader
112
+ responsiveContent={(closeHandler) => <DxcHeader.Dropdown options={options} label="Default Dropdown" />}
113
+ underlined
114
+ />
115
+ </div>
116
+ </ExampleContainer>
117
+ );
118
+
119
+ const RespHeaderFocus = () => (
120
+ <ExampleContainer pseudoState="pseudo-focus">
121
+ <Title title="Responsive" theme="light" level={4} />
122
+ <div style={{ maxWidth: "400px" }}>
123
+ <DxcHeader
124
+ responsiveContent={(closeHandler) => <p>Lorem ipsum dolor sit amet.</p>}
125
+ underlined
126
+ />
127
+ </div>
128
+ </ExampleContainer>
129
+ );
130
+
131
+ const RespHeaderHover = () => (
132
+ <ExampleContainer pseudoState="pseudo-hover">
133
+ <Title title="Responsive" theme="light" level={4} />
134
+ <div style={{ maxWidth: "400px" }}>
135
+ <DxcHeader
136
+ responsiveContent={(closeHandler) => <p>Lorem ipsum dolor sit amet.</p>}
137
+ underlined
138
+ />
139
+ </div>
140
+ </ExampleContainer>
141
+ );
142
+
143
+ export const ResponsiveHeader = RespHeader.bind({});
144
+ ResponsiveHeader.play = async ({ canvasElement }) => {
145
+ const canvas = within(canvasElement);
146
+ await waitFor(() => canvas.findByText("Menu"));
147
+ await userEvent.click(canvas.getByText("Menu"));
148
+ };
149
+
150
+ export const ResponsiveHeaderFocus = RespHeaderFocus.bind({});
151
+ ResponsiveHeaderFocus.play = async ({ canvasElement }) => {
152
+ const canvas = within(canvasElement);
153
+ await waitFor(() => canvas.findByText("Menu"));
154
+ await userEvent.click(canvas.getByText("Menu"));
155
+ };
156
+
157
+ export const ResponsiveHeaderHover = RespHeaderHover.bind({});
158
+ ResponsiveHeaderHover.play = async ({ canvasElement }) => {
159
+ const canvas = within(canvasElement);
160
+ await waitFor(() => canvas.findByText("Menu"));
161
+ await userEvent.click(canvas.getByText("Menu"));
162
+ };
package/header/types.d.ts CHANGED
@@ -27,11 +27,13 @@ declare type Props = {
27
27
  */
28
28
  onClick?: () => void;
29
29
  /**
30
- * Size of the bottom margin to be applied to the header.
30
+ * Size of the bottom margin to be applied to the header
31
+ * ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
31
32
  */
32
33
  margin?: Space;
33
34
  /**
34
- * Size of the padding to be applied to the custom area of the component.
35
+ * Size of the padding to be applied to the custom area of the component
36
+ * ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
35
37
  * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in
36
38
  * order to specify different padding sizes.
37
39
  */
@@ -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,8 +17,6 @@ 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
22
  var _useTheme = _interopRequireDefault(require("../useTheme.js"));
@@ -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
+ });
package/link/Link.js CHANGED
@@ -89,7 +89,7 @@ var DxcLinkContainer = _styledComponents["default"].div(_templateObject || (_tem
89
89
  return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
90
90
  });
91
91
 
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 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) {
93
93
  return props.inheritColor ? "inherit" : !props.disabled ? props.theme.fontColor : props.theme.disabledColor;
94
94
  }, function (props) {
95
95
  return props.disabled ? "pointer-events: none;" : "";
@@ -109,7 +109,7 @@ var StyledLink = _styledComponents["default"].a(_templateObject2 || (_templateOb
109
109
  return "color: ".concat(props.theme.activeFontColor, " !important;\n border-bottom-color: ").concat(props.theme.activeUnderlineColor, " !important;");
110
110
  });
111
111
 
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 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) {
113
113
  return "padding-bottom: ".concat(props.theme.underlineSpacing, ";\n border-bottom: ").concat(props.theme.underlineThickness, " ").concat(props.theme.underlineStyle, " transparent;");
114
114
  }, function (props) {
115
115
  return props.disabled && "cursor: default;";