@dxc-technology/halstack-react 0.0.0-d20b360 → 0.0.0-d238e47
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.
- package/alert/Alert.stories.tsx +170 -0
- package/alert/types.d.ts +1 -1
- package/box/Box.d.ts +4 -0
- package/box/Box.js +4 -30
- package/box/{Box.stories.jsx → Box.stories.tsx} +0 -0
- package/box/types.d.ts +43 -0
- package/box/types.js +5 -0
- package/button/Button.d.ts +1 -1
- package/button/Button.js +7 -10
- package/button/Button.stories.tsx +217 -234
- package/button/types.d.ts +11 -11
- package/card/Card.js +4 -5
- package/card/Card.stories.tsx +201 -0
- package/card/ice-cream.jpg +0 -0
- package/card/types.d.ts +4 -6
- package/checkbox/types.d.ts +1 -1
- package/chip/Chip.stories.tsx +121 -0
- package/common/variables.js +29 -21
- package/date-input/DateInput.stories.tsx +138 -0
- package/dialog/Dialog.stories.tsx +212 -0
- package/file-input/FileInput.d.ts +4 -0
- package/file-input/FileInput.js +7 -28
- package/file-input/FileItem.d.ts +14 -0
- package/file-input/FileItem.js +4 -15
- package/file-input/types.d.ts +87 -0
- package/file-input/types.js +5 -0
- package/footer/types.d.ts +1 -1
- package/header/Header.stories.tsx +162 -0
- package/header/types.d.ts +4 -2
- package/heading/Heading.d.ts +4 -0
- package/heading/Heading.js +6 -23
- package/heading/Heading.stories.tsx +53 -0
- package/heading/types.d.ts +33 -0
- package/heading/types.js +5 -0
- package/link/Link.d.ts +3 -0
- package/link/Link.js +3 -25
- package/link/Link.stories.tsx +146 -0
- package/link/types.d.ts +74 -0
- package/link/types.js +5 -0
- package/number-input/NumberInput.d.ts +4 -0
- package/number-input/NumberInput.js +2 -44
- package/number-input/{NumberInput.stories.jsx → NumberInput.stories.tsx} +0 -0
- package/number-input/NumberInputContext.d.ts +4 -0
- package/number-input/NumberInputContext.js +5 -2
- package/number-input/numberInputContextTypes.d.ts +19 -0
- package/number-input/numberInputContextTypes.js +5 -0
- package/number-input/types.d.ts +117 -0
- package/number-input/types.js +5 -0
- package/package.json +1 -1
- package/password-input/PasswordInput.d.ts +4 -0
- package/password-input/PasswordInput.js +0 -37
- package/password-input/{PasswordInput.stories.jsx → PasswordInput.stories.tsx} +1 -1
- package/password-input/types.d.ts +105 -0
- package/password-input/types.js +5 -0
- package/progress-bar/ProgressBar.stories.jsx +58 -0
- package/radio/types.d.ts +2 -2
- package/resultsetTable/ResultsetTable.d.ts +4 -0
- package/resultsetTable/ResultsetTable.js +0 -25
- package/resultsetTable/types.d.ts +63 -0
- package/resultsetTable/types.js +5 -0
- package/select/Select.stories.tsx +572 -0
- package/sidenav/Sidenav.d.ts +9 -0
- package/sidenav/Sidenav.js +4 -13
- package/sidenav/Sidenav.stories.tsx +165 -0
- package/sidenav/types.d.ts +50 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.d.ts +1 -1
- package/slider/Slider.js +41 -30
- package/slider/Slider.stories.tsx +177 -0
- package/slider/types.d.ts +2 -7
- package/spinner/Spinner.d.ts +4 -0
- package/spinner/Spinner.js +0 -17
- package/spinner/types.d.ts +32 -0
- package/spinner/types.js +5 -0
- package/switch/Switch.js +2 -2
- package/switch/Switch.stories.tsx +160 -0
- package/table/Table.d.ts +4 -0
- package/table/Table.js +1 -1
- package/table/types.d.ts +21 -0
- package/table/types.js +5 -0
- package/tabs/Tabs.js +3 -1
- package/tabs/types.d.ts +2 -3
- package/tag/Tag.d.ts +4 -0
- package/tag/Tag.js +20 -35
- package/tag/Tag.stories.tsx +145 -0
- package/tag/types.d.ts +60 -0
- package/tag/types.js +5 -0
- package/text-input/TextInput.d.ts +4 -0
- package/text-input/TextInput.js +4 -44
- package/text-input/types.d.ts +157 -0
- package/text-input/types.js +5 -0
- package/toggle-group/ToggleGroup.stories.tsx +178 -0
- package/wizard/Wizard.d.ts +4 -0
- package/wizard/Wizard.js +11 -51
- package/wizard/Wizard.stories.jsx +224 -0
- package/wizard/types.d.ts +64 -0
- package/wizard/types.js +5 -0
- package/box/index.d.ts +0 -25
- package/file-input/index.d.ts +0 -81
- package/heading/index.d.ts +0 -17
- package/link/index.d.ts +0 -23
- package/number-input/index.d.ts +0 -113
- package/password-input/index.d.ts +0 -94
- package/resultsetTable/index.d.ts +0 -19
- package/sidenav/index.d.ts +0 -13
- package/spinner/index.d.ts +0 -17
- package/table/index.d.ts +0 -13
- package/tag/index.d.ts +0 -24
- package/text-input/index.d.ts +0 -135
- package/wizard/index.d.ts +0 -18
package/heading/Heading.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 _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
|
-
|
|
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(
|
|
49
|
+
as: checkValidAs(),
|
|
55
50
|
weight: weight
|
|
56
51
|
}, text) : level === 2 ? /*#__PURE__*/_react["default"].createElement(HeadingLevel2, {
|
|
57
|
-
as: checkValidAs(
|
|
52
|
+
as: checkValidAs(),
|
|
58
53
|
weight: weight
|
|
59
54
|
}, text) : level === 3 ? /*#__PURE__*/_react["default"].createElement(HeadingLevel3, {
|
|
60
|
-
as: checkValidAs(
|
|
55
|
+
as: checkValidAs(),
|
|
61
56
|
weight: weight
|
|
62
57
|
}, text) : level === 4 ? /*#__PURE__*/_react["default"].createElement(HeadingLevel4, {
|
|
63
|
-
as: checkValidAs(
|
|
58
|
+
as: checkValidAs(),
|
|
64
59
|
weight: weight
|
|
65
60
|
}, text) : /*#__PURE__*/_react["default"].createElement(HeadingLevel5, {
|
|
66
|
-
as: checkValidAs(
|
|
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;
|
package/heading/types.js
ADDED
package/link/Link.d.ts
ADDED
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,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"));
|
|
@@ -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
|
|
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
|
|
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
|
|
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;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import DxcLink from "./Link";
|
|
3
|
+
import Title from "../../.storybook/components/Title";
|
|
4
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Link",
|
|
8
|
+
component: DxcLink,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const icon = (
|
|
12
|
+
<svg viewBox="0 0 24 24" enable-background="new 0 0 24 24" fill="currentColor">
|
|
13
|
+
<g id="Bounding_Box">
|
|
14
|
+
<rect fill="none" width="24" height="24" />
|
|
15
|
+
</g>
|
|
16
|
+
<g id="Master">
|
|
17
|
+
<path d="M19,9.3V4h-3v2.6L12,3L2,12h3v8h5v-6h4v6h5v-8h3L19,9.3z M10,10c0-1.1,0.9-2,2-2s2,0.9,2,2H10z" />
|
|
18
|
+
</g>
|
|
19
|
+
</svg>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export const Chromatic = () => (
|
|
23
|
+
<>
|
|
24
|
+
<Title title="With anchor" theme="light" level={2} />
|
|
25
|
+
<ExampleContainer>
|
|
26
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
27
|
+
<DxcLink text="Test" disabled></DxcLink>
|
|
28
|
+
<Title title="Icon before" theme="light" level={4} />
|
|
29
|
+
<DxcLink text="Test" href="https://www.google.com" icon={icon} iconPosition="before"></DxcLink>
|
|
30
|
+
<Title title="Icon after" theme="light" level={4} />
|
|
31
|
+
<DxcLink text="Test" href="https://www.youtube.com/" icon={icon} iconPosition="after"></DxcLink>
|
|
32
|
+
</ExampleContainer>
|
|
33
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
34
|
+
<Title title="With link hovered" theme="light" level={4} />
|
|
35
|
+
<DxcLink text="Test" href="https://www.dxc.com"></DxcLink>
|
|
36
|
+
</ExampleContainer>
|
|
37
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
38
|
+
<Title title="With link focused" theme="light" level={4} />
|
|
39
|
+
<DxcLink text="Test" href="https://www.dxc.com"></DxcLink>
|
|
40
|
+
</ExampleContainer>
|
|
41
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
42
|
+
<Title title="With link active" theme="light" level={4} />
|
|
43
|
+
<DxcLink text="Test" href="https://www.dxc.com"></DxcLink>
|
|
44
|
+
</ExampleContainer>
|
|
45
|
+
<ExampleContainer pseudoState="pseudo-visited">
|
|
46
|
+
<Title title="With link visited" theme="light" level={4} />
|
|
47
|
+
<DxcLink text="Test" href="https://www.amazon.com"></DxcLink>
|
|
48
|
+
</ExampleContainer>
|
|
49
|
+
<ExampleContainer>
|
|
50
|
+
<Title title="Inherit color" theme="light" level={4} />
|
|
51
|
+
This is a <DxcLink text="Test" inheritColor={true}></DxcLink>.
|
|
52
|
+
</ExampleContainer>
|
|
53
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
54
|
+
<Title title="With brackets and focus" theme="light" level={4} />
|
|
55
|
+
This is a (<DxcLink text="Test" inheritColor={true}></DxcLink>).
|
|
56
|
+
</ExampleContainer>
|
|
57
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
58
|
+
<Title title="Long text with hover" theme="light" level={4} />
|
|
59
|
+
Lorem <DxcLink text="Test" href="https://www.google.com"></DxcLink> ipsum dolor sit amet, consectetur adipiscing
|
|
60
|
+
elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
|
|
61
|
+
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
|
|
62
|
+
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
|
|
63
|
+
in culpa qui officia deserunt mollit anim id est laborum.
|
|
64
|
+
</ExampleContainer>
|
|
65
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
66
|
+
<Title title="Long text with focus" theme="light" level={4} />
|
|
67
|
+
Lorem <DxcLink text="Test" href="https://www.google.com"></DxcLink> ipsum dolor sit amet, consectetur adipiscing
|
|
68
|
+
elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
|
|
69
|
+
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
|
|
70
|
+
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt
|
|
71
|
+
in culpa qui officia deserunt mollit anim id est laborum.
|
|
72
|
+
</ExampleContainer>
|
|
73
|
+
<Title title="With button" theme="light" level={2} />
|
|
74
|
+
<ExampleContainer>
|
|
75
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
76
|
+
<DxcLink text="Test" onClick={() => {}} disabled></DxcLink>
|
|
77
|
+
<Title title="Icon before" theme="light" level={4} />
|
|
78
|
+
<DxcLink text="Test" onClick={() => {}} href="https://www.google.com" icon={icon} iconPosition="before"></DxcLink>
|
|
79
|
+
<Title title="Icon after" theme="light" level={4} />
|
|
80
|
+
<DxcLink
|
|
81
|
+
text="Test"
|
|
82
|
+
onClick={() => {}}
|
|
83
|
+
href="https://www.youtube.com/"
|
|
84
|
+
icon={icon}
|
|
85
|
+
iconPosition="after"
|
|
86
|
+
></DxcLink>
|
|
87
|
+
</ExampleContainer>
|
|
88
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
89
|
+
<Title title="With link hovered" theme="light" level={4} />
|
|
90
|
+
<DxcLink text="Test" onClick={() => {}} href="https://www.dxc.com"></DxcLink>
|
|
91
|
+
</ExampleContainer>
|
|
92
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
93
|
+
<Title title="With link focused" theme="light" level={4} />
|
|
94
|
+
<DxcLink text="Test" onClick={() => {}} href="https://www.dxc.com"></DxcLink>
|
|
95
|
+
</ExampleContainer>
|
|
96
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
97
|
+
<Title title="With link active" theme="light" level={4} />
|
|
98
|
+
<DxcLink text="Test" onClick={() => {}} href="https://www.dxc.com"></DxcLink>
|
|
99
|
+
</ExampleContainer>
|
|
100
|
+
<ExampleContainer pseudoState="pseudo-visited">
|
|
101
|
+
<Title title="With link visited" theme="light" level={4} />
|
|
102
|
+
<DxcLink text="Test" onClick={() => {}} href="https://www.amazon.com"></DxcLink>
|
|
103
|
+
</ExampleContainer>
|
|
104
|
+
<ExampleContainer>
|
|
105
|
+
<Title title="Inherit color" theme="light" level={4} />
|
|
106
|
+
This is a <DxcLink text="Test" onClick={() => {}} inheritColor={true}></DxcLink>.
|
|
107
|
+
</ExampleContainer>
|
|
108
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
109
|
+
<Title title="With brackets and focus" theme="light" level={4} />
|
|
110
|
+
This is a (<DxcLink text="Test" onClick={() => {}} inheritColor={true}></DxcLink>).
|
|
111
|
+
</ExampleContainer>
|
|
112
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
113
|
+
<Title title="Long text with hover" theme="light" level={4} />
|
|
114
|
+
Lorem <DxcLink text="Test" onClick={() => {}} href="https://www.google.com"></DxcLink> ipsum dolor sit amet,
|
|
115
|
+
consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
|
|
116
|
+
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
|
|
117
|
+
in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
|
|
118
|
+
non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
|
119
|
+
</ExampleContainer>
|
|
120
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
121
|
+
<Title title="Long text with focus" theme="light" level={4} />
|
|
122
|
+
Lorem <DxcLink text="Test" onClick={() => {}} href="https://www.google.com"></DxcLink> ipsum dolor sit amet,
|
|
123
|
+
consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
|
|
124
|
+
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
|
|
125
|
+
in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
|
|
126
|
+
non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
|
127
|
+
</ExampleContainer>
|
|
128
|
+
<Title title="Margins" theme="light" level={2} />
|
|
129
|
+
<ExampleContainer>
|
|
130
|
+
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
131
|
+
<DxcLink text="Test" margin="xxsmall" href="https://www.facebook.com/"></DxcLink>
|
|
132
|
+
<Title title="Xsmall margin" theme="light" level={4} />
|
|
133
|
+
<DxcLink text="Test" margin="xsmall" href="https://www.linkedin.com/"></DxcLink>
|
|
134
|
+
<Title title="Small margin" theme="light" level={4} />
|
|
135
|
+
<DxcLink text="Test" margin="small" href="https://www.linkedin.com/"></DxcLink>
|
|
136
|
+
<Title title="Medium margin" theme="light" level={4} />
|
|
137
|
+
<DxcLink text="Test" margin="medium" href="https://www.linkedin.com/"></DxcLink>
|
|
138
|
+
<Title title="Large margin" theme="light" level={4} />
|
|
139
|
+
<DxcLink text="Test" margin="large" href="https://www.linkedin.com/"></DxcLink>
|
|
140
|
+
<Title title="Xlarge margin" theme="light" level={4} />
|
|
141
|
+
<DxcLink text="Test" margin="xlarge" href="https://www.linkedin.com/"></DxcLink>
|
|
142
|
+
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
143
|
+
<DxcLink text="Test" margin="xxlarge" href="https://www.linkedin.com/"></DxcLink>
|
|
144
|
+
</ExampleContainer>
|
|
145
|
+
</>
|
|
146
|
+
);
|
package/link/types.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
declare type Margin = {
|
|
4
|
+
top?: Space;
|
|
5
|
+
bottom?: Space;
|
|
6
|
+
left?: Space;
|
|
7
|
+
right?: Space;
|
|
8
|
+
};
|
|
9
|
+
declare type LinkCommonProps = {
|
|
10
|
+
/**
|
|
11
|
+
* If true, the color is inherited from parent.
|
|
12
|
+
*/
|
|
13
|
+
inheritColor?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* If true, the link is disabled.
|
|
16
|
+
*/
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* @Deprecated Source of the icon.
|
|
20
|
+
*/
|
|
21
|
+
iconSrc?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Indicates the position of the icon in the component.
|
|
24
|
+
*/
|
|
25
|
+
iconPosition?: "before" | "after";
|
|
26
|
+
/**
|
|
27
|
+
* Page to be opened when the user clicks on the link.
|
|
28
|
+
*/
|
|
29
|
+
href?: string;
|
|
30
|
+
/**
|
|
31
|
+
* If true, the page is opened in a new browser tab.
|
|
32
|
+
*/
|
|
33
|
+
newWindow?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* If defined, the link will be displayed as a button. This
|
|
36
|
+
* function will be called when the user clicks the link.
|
|
37
|
+
*/
|
|
38
|
+
onClick?: () => void;
|
|
39
|
+
/**
|
|
40
|
+
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
41
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
42
|
+
*/
|
|
43
|
+
margin?: Space | Margin;
|
|
44
|
+
/**
|
|
45
|
+
* Value of the tabindex.
|
|
46
|
+
*/
|
|
47
|
+
tabIndex?: number;
|
|
48
|
+
};
|
|
49
|
+
export declare type LinkTextProps = LinkCommonProps & {
|
|
50
|
+
/**
|
|
51
|
+
* Link text.
|
|
52
|
+
*/
|
|
53
|
+
text: string;
|
|
54
|
+
/**
|
|
55
|
+
* Element used as the icon that will be placed next to the link text.
|
|
56
|
+
*/
|
|
57
|
+
icon?: SVG;
|
|
58
|
+
};
|
|
59
|
+
export declare type LinkIconProps = LinkCommonProps & {
|
|
60
|
+
/**
|
|
61
|
+
* Link text.
|
|
62
|
+
*/
|
|
63
|
+
text?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Element used as the icon that will be placed next to the link text.
|
|
66
|
+
*/
|
|
67
|
+
icon: SVG;
|
|
68
|
+
};
|
|
69
|
+
declare type Overload = {
|
|
70
|
+
(props: LinkTextProps): JSX.Element;
|
|
71
|
+
(props: LinkIconProps): JSX.Element;
|
|
72
|
+
};
|
|
73
|
+
declare type SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
|
|
74
|
+
export default Overload;
|
package/link/types.js
ADDED
|
@@ -7,22 +7,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = void 0;
|
|
9
9
|
|
|
10
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
-
|
|
12
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
11
|
|
|
14
12
|
var _react = _interopRequireDefault(require("react"));
|
|
15
13
|
|
|
16
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
-
|
|
18
14
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
19
15
|
|
|
20
16
|
var _TextInput = _interopRequireDefault(require("../text-input/TextInput"));
|
|
21
17
|
|
|
22
18
|
var _NumberInputContext = _interopRequireDefault(require("./NumberInputContext"));
|
|
23
19
|
|
|
24
|
-
var _variables = require("../common/variables.js");
|
|
25
|
-
|
|
26
20
|
var _templateObject;
|
|
27
21
|
|
|
28
22
|
var DxcNumberInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
@@ -45,7 +39,8 @@ var DxcNumberInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, r
|
|
|
45
39
|
suffix = _ref$suffix === void 0 ? "" : _ref$suffix,
|
|
46
40
|
min = _ref.min,
|
|
47
41
|
max = _ref.max,
|
|
48
|
-
step = _ref.step,
|
|
42
|
+
_ref$step = _ref.step,
|
|
43
|
+
step = _ref$step === void 0 ? 1 : _ref$step,
|
|
49
44
|
onChange = _ref.onChange,
|
|
50
45
|
onBlur = _ref.onBlur,
|
|
51
46
|
_ref$error = _ref.error,
|
|
@@ -85,44 +80,7 @@ var DxcNumberInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, r
|
|
|
85
80
|
})));
|
|
86
81
|
});
|
|
87
82
|
|
|
88
|
-
var sizes = {
|
|
89
|
-
small: "240px",
|
|
90
|
-
medium: "360px",
|
|
91
|
-
large: "480px",
|
|
92
|
-
fillParent: "100%"
|
|
93
|
-
};
|
|
94
|
-
|
|
95
83
|
var NumberInputContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n // Chrome, Safari, Edge, Opera\n input::-webkit-outer-spin-button,\n input::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n // Firefox\n input[type=\"number\"] {\n -moz-appearance: textfield;\n }\n"])));
|
|
96
84
|
|
|
97
|
-
DxcNumberInput.propTypes = {
|
|
98
|
-
label: _propTypes["default"].string,
|
|
99
|
-
name: _propTypes["default"].string,
|
|
100
|
-
value: _propTypes["default"].string,
|
|
101
|
-
helperText: _propTypes["default"].string,
|
|
102
|
-
placeholder: _propTypes["default"].string,
|
|
103
|
-
error: _propTypes["default"].string,
|
|
104
|
-
disabled: _propTypes["default"].bool,
|
|
105
|
-
optional: _propTypes["default"].bool,
|
|
106
|
-
prefix: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].shape({
|
|
107
|
-
type: _propTypes["default"].oneOf(["svg"])
|
|
108
|
-
})]),
|
|
109
|
-
suffix: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].shape({
|
|
110
|
-
type: _propTypes["default"].oneOf(["svg"])
|
|
111
|
-
})]),
|
|
112
|
-
min: _propTypes["default"].number,
|
|
113
|
-
max: _propTypes["default"].number,
|
|
114
|
-
step: _propTypes["default"].number,
|
|
115
|
-
onChange: _propTypes["default"].func,
|
|
116
|
-
onBlur: _propTypes["default"].func,
|
|
117
|
-
autocomplete: _propTypes["default"].string,
|
|
118
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
119
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
120
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
121
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
122
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
123
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
124
|
-
size: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(sizes))),
|
|
125
|
-
tabIndex: _propTypes["default"].number
|
|
126
|
-
};
|
|
127
85
|
var _default = DxcNumberInput;
|
|
128
86
|
exports["default"] = _default;
|
|
File without changes
|
|
@@ -9,8 +9,11 @@ exports["default"] = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
var defaultState = {
|
|
13
|
+
stepNumber: 1
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
var NumberInputContext = /*#__PURE__*/_react["default"].createContext(defaultState);
|
|
14
17
|
|
|
15
18
|
var _default = NumberInputContext;
|
|
16
19
|
exports["default"] = _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare type Props = {
|
|
2
|
+
/**
|
|
3
|
+
* Type of the input.
|
|
4
|
+
*/
|
|
5
|
+
typeNumber?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Minimum value allowed by the number input.
|
|
8
|
+
*/
|
|
9
|
+
minNumber?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Maximum value allowed by the number input.
|
|
12
|
+
*/
|
|
13
|
+
maxNumber?: number;
|
|
14
|
+
/**
|
|
15
|
+
* The step interval to use when using the up and down arrows to adjust the value.
|
|
16
|
+
*/
|
|
17
|
+
stepNumber?: number;
|
|
18
|
+
};
|
|
19
|
+
export default Props;
|