@dxc-technology/halstack-react 10.0.0 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HalstackContext.d.ts +8 -0
- package/README.md +47 -0
- package/common/variables.d.ts +8 -0
- package/common/variables.js +8 -0
- package/footer/Footer.stories.tsx +8 -7
- package/image/Image.d.ts +4 -0
- package/image/Image.js +85 -0
- package/image/Image.stories.tsx +127 -0
- package/image/types.d.ts +72 -0
- package/layout/ApplicationLayout.js +11 -11
- package/layout/ApplicationLayout.stories.tsx +1 -1
- package/layout/Icons.d.ts +7 -4
- package/layout/Icons.js +52 -56
- package/main.d.ts +2 -1
- package/main.js +8 -0
- package/number-input/NumberInput.d.ts +7 -0
- package/number-input/NumberInput.js +6 -4
- package/number-input/NumberInput.test.js +278 -95
- package/package.json +2 -2
- package/password-input/Icons.d.ts +6 -0
- package/password-input/Icons.js +39 -0
- package/password-input/PasswordInput.js +35 -82
- package/password-input/PasswordInput.stories.tsx +1 -0
- package/password-input/PasswordInput.test.js +27 -34
- package/select/Select.stories.tsx +3 -3
- package/select/Select.test.js +4 -4
- package/text-input/TextInput.js +61 -77
- package/toggle-group/ToggleGroup.js +79 -56
- package/toggle-group/ToggleGroup.stories.tsx +6 -3
- package/toggle-group/ToggleGroup.test.js +37 -23
- package/toggle-group/types.d.ts +22 -13
- package/useTheme.d.ts +8 -0
- package/number-input/NumberInputContext.d.ts +0 -4
- package/number-input/NumberInputContext.js +0 -19
- package/number-input/numberInputContextTypes.d.ts +0 -19
- /package/{number-input/numberInputContextTypes.js → image/types.js} +0 -0
package/HalstackContext.d.ts
CHANGED
|
@@ -490,6 +490,14 @@ declare const HalstackContext: React.Context<DeepPartial<{
|
|
|
490
490
|
level5LineHeight: string;
|
|
491
491
|
level5LetterSpacing: string;
|
|
492
492
|
};
|
|
493
|
+
image: {
|
|
494
|
+
captionFontColor: string;
|
|
495
|
+
captionFontFamily: string;
|
|
496
|
+
captionFontSize: string;
|
|
497
|
+
captionFontStyle: string;
|
|
498
|
+
captionFontWeight: string;
|
|
499
|
+
captionLineHeight: string;
|
|
500
|
+
};
|
|
493
501
|
link: {
|
|
494
502
|
fontColor: string;
|
|
495
503
|
fontFamily: string;
|
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://developer.dxc.com/halstack/">
|
|
3
|
+
<img src="website/screens/common/images/halstack_logo.svg" alt="Halstack Design System logo" />
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<h1 align="center">Halstack Design System</h1>
|
|
8
|
+
|
|
9
|
+
Halstack is an Open Source Design System built and maintained by DXC Technology with the purpose of providing all the necessary tools for designing and implementing accessible, intuitive and consistent User Experiences with React.
|
|
10
|
+
|
|
11
|
+
## How to start
|
|
12
|
+
|
|
13
|
+
You can start using Halstack right now:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm i @dxc-technology/halstack-react
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Usage
|
|
20
|
+
|
|
21
|
+
```jsx
|
|
22
|
+
import React from "react";
|
|
23
|
+
import { DxcButton, DxcTextInput } from "@dxc-technology/halstack-react";
|
|
24
|
+
|
|
25
|
+
const App = () => (
|
|
26
|
+
<>
|
|
27
|
+
<DxcTextInput label="Enter your name" />
|
|
28
|
+
<DxcButton label="Submit" type="submit" />
|
|
29
|
+
</>
|
|
30
|
+
);
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Where to start
|
|
34
|
+
|
|
35
|
+
Learn everything you need to know about Halstack principles and components on the [official documentation site](https://developer.dxc.com/halstack/).
|
|
36
|
+
|
|
37
|
+
## Contributing
|
|
38
|
+
|
|
39
|
+
Any feedback is always welcome in Halstack!
|
|
40
|
+
|
|
41
|
+
Before opening a new issue, pull request or discussion, please read carefully and respect our [contribution guidelines](https://github.com/dxc-technology/halstack-react/wiki/Contributing).
|
|
42
|
+
|
|
43
|
+
## Thanks
|
|
44
|
+
|
|
45
|
+
<a href="https://www.chromatic.com/"><img src="https://user-images.githubusercontent.com/321738/84662277-e3db4f80-af1b-11ea-88f5-91d67a5e59f6.png" width="153" height="30" alt="Chromatic" /></a>
|
|
46
|
+
|
|
47
|
+
Thanks to [Chromatic](https://www.chromatic.com/) for providing the visual testing platform that helps us review UI changes and catch visual regressions.
|
package/common/variables.d.ts
CHANGED
|
@@ -488,6 +488,14 @@ export declare const componentTokens: {
|
|
|
488
488
|
level5LineHeight: string;
|
|
489
489
|
level5LetterSpacing: string;
|
|
490
490
|
};
|
|
491
|
+
image: {
|
|
492
|
+
captionFontColor: string;
|
|
493
|
+
captionFontFamily: string;
|
|
494
|
+
captionFontSize: string;
|
|
495
|
+
captionFontStyle: string;
|
|
496
|
+
captionFontWeight: string;
|
|
497
|
+
captionLineHeight: string;
|
|
498
|
+
};
|
|
491
499
|
link: {
|
|
492
500
|
fontColor: string;
|
|
493
501
|
fontFamily: string;
|
package/common/variables.js
CHANGED
|
@@ -499,6 +499,14 @@ var componentTokens = {
|
|
|
499
499
|
level5LineHeight: _coreTokens["default"].type_leading_normal,
|
|
500
500
|
level5LetterSpacing: _coreTokens["default"].type_spacing_wide_01
|
|
501
501
|
},
|
|
502
|
+
image: {
|
|
503
|
+
captionFontColor: _coreTokens["default"].color_grey_900,
|
|
504
|
+
captionFontFamily: _coreTokens["default"].type_sans,
|
|
505
|
+
captionFontSize: _coreTokens["default"].type_scale_02,
|
|
506
|
+
captionFontStyle: _coreTokens["default"].type_normal,
|
|
507
|
+
captionFontWeight: _coreTokens["default"].type_regular,
|
|
508
|
+
captionLineHeight: _coreTokens["default"].type_leading_normal
|
|
509
|
+
},
|
|
502
510
|
link: {
|
|
503
511
|
fontColor: _coreTokens["default"].color_blue_800,
|
|
504
512
|
fontFamily: _coreTokens["default"].inherit,
|
|
@@ -29,16 +29,17 @@ const social = [
|
|
|
29
29
|
title: "Linkedin",
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
|
-
href: "https://
|
|
32
|
+
href: "https://x.com/dxctechnology",
|
|
33
33
|
logo: (
|
|
34
|
-
<svg viewBox="0 0
|
|
34
|
+
<svg width="256" height="256" viewBox="0 0 256 256" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
35
|
+
<rect width="256" height="256" rx="40" fill="white" />
|
|
35
36
|
<path
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
d="M140.192 118.205L187.848 64H176.556L135.158 111.056L102.117 64H64L113.975 135.163L64 192H75.2914L118.982 142.296L153.883 192H192L140.192 118.205ZM124.722 135.787L119.65 128.697L79.3634 72.3294H96.7094L129.232 117.837L134.282 124.927L176.551 184.076H159.205L124.722 135.787Z"
|
|
38
|
+
fill="#0F1419"
|
|
38
39
|
/>
|
|
39
40
|
</svg>
|
|
40
41
|
),
|
|
41
|
-
title: "
|
|
42
|
+
title: "X",
|
|
42
43
|
},
|
|
43
44
|
{
|
|
44
45
|
href: "https://www.facebook.com/DXCTechnology/",
|
|
@@ -75,8 +76,8 @@ const bottom = [
|
|
|
75
76
|
text: "Linkedin",
|
|
76
77
|
},
|
|
77
78
|
{
|
|
78
|
-
href: "https://
|
|
79
|
-
text: "
|
|
79
|
+
href: "https://x.com/dxctechnology",
|
|
80
|
+
text: "X",
|
|
80
81
|
},
|
|
81
82
|
{
|
|
82
83
|
href: "https://www.facebook.com/DXCTechnology/",
|
package/image/Image.d.ts
ADDED
package/image/Image.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = void 0;
|
|
11
|
+
|
|
12
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
|
|
16
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
17
|
+
|
|
18
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
19
|
+
|
|
20
|
+
var _BaseTypography = _interopRequireDefault(require("../utils/BaseTypography"));
|
|
21
|
+
|
|
22
|
+
var _templateObject;
|
|
23
|
+
|
|
24
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
|
+
|
|
26
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
+
|
|
28
|
+
var CaptionWrapper = function CaptionWrapper(_ref) {
|
|
29
|
+
var condition = _ref.condition,
|
|
30
|
+
wrapper = _ref.wrapper,
|
|
31
|
+
children = _ref.children;
|
|
32
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, condition ? wrapper(children) : children);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var DxcImage = function DxcImage(_ref2) {
|
|
36
|
+
var alt = _ref2.alt,
|
|
37
|
+
caption = _ref2.caption,
|
|
38
|
+
_ref2$lazyLoading = _ref2.lazyLoading,
|
|
39
|
+
lazyLoading = _ref2$lazyLoading === void 0 ? false : _ref2$lazyLoading,
|
|
40
|
+
src = _ref2.src,
|
|
41
|
+
srcSet = _ref2.srcSet,
|
|
42
|
+
sizes = _ref2.sizes,
|
|
43
|
+
width = _ref2.width,
|
|
44
|
+
height = _ref2.height,
|
|
45
|
+
objectFit = _ref2.objectFit,
|
|
46
|
+
objectPosition = _ref2.objectPosition,
|
|
47
|
+
onLoad = _ref2.onLoad,
|
|
48
|
+
onError = _ref2.onError;
|
|
49
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
50
|
+
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
51
|
+
theme: colorsTheme.image
|
|
52
|
+
}, /*#__PURE__*/_react["default"].createElement(CaptionWrapper, {
|
|
53
|
+
condition: caption != undefined,
|
|
54
|
+
wrapper: function wrapper(children) {
|
|
55
|
+
return /*#__PURE__*/_react["default"].createElement(Figure, null, children, /*#__PURE__*/_react["default"].createElement(_BaseTypography["default"], {
|
|
56
|
+
as: "figcaption",
|
|
57
|
+
color: colorsTheme.image.captionFontColor,
|
|
58
|
+
fontFamily: colorsTheme.image.captionFontFamily,
|
|
59
|
+
fontSize: colorsTheme.image.captionFontSize,
|
|
60
|
+
fontStyle: colorsTheme.image.captionFontStyle,
|
|
61
|
+
fontWeight: colorsTheme.image.captionFontWeight,
|
|
62
|
+
lineHeight: colorsTheme.image.captionLineHeight
|
|
63
|
+
}, caption));
|
|
64
|
+
}
|
|
65
|
+
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
66
|
+
alt: alt,
|
|
67
|
+
loading: lazyLoading ? "lazy" : undefined,
|
|
68
|
+
onLoad: onLoad,
|
|
69
|
+
onError: onError,
|
|
70
|
+
src: src,
|
|
71
|
+
srcSet: srcSet,
|
|
72
|
+
sizes: sizes,
|
|
73
|
+
style: {
|
|
74
|
+
objectFit: objectFit,
|
|
75
|
+
objectPosition: objectPosition,
|
|
76
|
+
width: width,
|
|
77
|
+
height: height
|
|
78
|
+
}
|
|
79
|
+
})));
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
var Figure = _styledComponents["default"].figure(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n gap: 1rem;\n width: fit-content;\n margin: 0;\n padding: 0;\n"])));
|
|
83
|
+
|
|
84
|
+
var _default = DxcImage;
|
|
85
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import DxcImage from "./Image";
|
|
3
|
+
import Title from "../../.storybook/components/Title";
|
|
4
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
+
import { DxcFlex, DxcInset, DxcParagraph } from "../main";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: "Image",
|
|
9
|
+
component: DxcImage,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const Chromatic = () => (
|
|
13
|
+
<>
|
|
14
|
+
<Title title="Image component" theme="light" level={2} />
|
|
15
|
+
<ExampleContainer>
|
|
16
|
+
<Title title="Simple image" theme="light" level={4} />
|
|
17
|
+
<DxcImage
|
|
18
|
+
alt="Example image"
|
|
19
|
+
width="100%"
|
|
20
|
+
src="https://images.ctfassets.net/hrltx12pl8hq/5596z2BCR9KmT1KeRBrOQa/4070fd4e2f1a13f71c2c46afeb18e41c/shutterstock_451077043-hero1.jpg"
|
|
21
|
+
/>
|
|
22
|
+
</ExampleContainer>
|
|
23
|
+
<ExampleContainer>
|
|
24
|
+
<Title title="Image with text" theme="light" level={4} />
|
|
25
|
+
<DxcParagraph>
|
|
26
|
+
Lorem ipsum dolor sit amet consectetur. Tincidunt sed pharetra mollis duis volutpat urna. Hendrerit aliquet et
|
|
27
|
+
arcu purus. Sodales elementum sollicitudin consequat elementum tortor. Lectus eget cursus ut ac pharetra
|
|
28
|
+
lobortis integer eu. Potenti amet ac id risus ac nunc orci nibh. Tempus vitae vitae aenean arcu. Nibh tristique
|
|
29
|
+
porta dui enim eget tristique rutrum. Quisque faucibus suscipit nibh est sed. Netus venenatis congue diam in dui
|
|
30
|
+
morbi dignissim lorem. Urna aliquet sem in tincidunt. Nunc arcu nec fringilla enim purus ut justo nisi. Vel mus
|
|
31
|
+
ut ornare faucibus blandit diam sit vestibulum massa. Semper nullam sit sagittis hendrerit augue. In fermentum
|
|
32
|
+
metus proin arcu faucibus proin nibh sit. Vel integer sed enim in sed vel nec ut vitae. Commodo sagittis
|
|
33
|
+
volutpat id lorem.
|
|
34
|
+
</DxcParagraph>
|
|
35
|
+
<DxcInset top="2rem" bottom="2rem">
|
|
36
|
+
<DxcImage
|
|
37
|
+
alt="Ratatouille is a great movie"
|
|
38
|
+
caption="Ratatouille with a smile on his face."
|
|
39
|
+
src="https://hips.hearstapps.com/es.h-cdn.co/fotoes/images/cinefilia/por-que-ratatouille-nos-sigue-enamorando-10-anos-despues/136444706-1-esl-ES/Por-que-Ratatouille-nos-sigue-enamorando-10-anos-despues.jpg"
|
|
40
|
+
/>
|
|
41
|
+
</DxcInset>
|
|
42
|
+
<DxcParagraph>
|
|
43
|
+
Lorem ipsum dolor sit amet consectetur. Tincidunt sed pharetra mollis duis volutpat urna. Hendrerit aliquet et
|
|
44
|
+
arcu purus. Sodales elementum sollicitudin consequat elementum tortor. Lectus eget cursus ut ac pharetra
|
|
45
|
+
lobortis integer eu. Potenti amet ac id risus ac nunc orci nibh. Tempus vitae vitae aenean arcu. Nibh tristique
|
|
46
|
+
porta dui enim eget tristique rutrum. Quisque faucibus suscipit nibh est sed. Netus venenatis congue diam in dui
|
|
47
|
+
morbi dignissim lorem. Urna aliquet sem in tincidunt. Nunc arcu nec fringilla enim purus ut justo nisi. Vel mus
|
|
48
|
+
ut ornare faucibus blandit diam sit vestibulum massa. Semper nullam sit sagittis hendrerit augue. In fermentum
|
|
49
|
+
metus proin arcu faucibus proin nibh sit. Vel integer sed enim in sed vel nec ut vitae. Commodo sagittis
|
|
50
|
+
volutpat id lorem.
|
|
51
|
+
</DxcParagraph>
|
|
52
|
+
</ExampleContainer>
|
|
53
|
+
<ExampleContainer>
|
|
54
|
+
<Title title="Example image" theme="light" level={4} />
|
|
55
|
+
<DxcFlex gap="1rem">
|
|
56
|
+
<DxcImage
|
|
57
|
+
alt="Camera pic"
|
|
58
|
+
caption="Picture of a camera and the sunset."
|
|
59
|
+
width="500px"
|
|
60
|
+
src="https://assets.entrepreneur.com/content/3x2/2000/20191009140007-GettyImages-1053962188.jpeg"
|
|
61
|
+
/>
|
|
62
|
+
<DxcParagraph>
|
|
63
|
+
Lorem ipsum dolor sit amet consectetur. Tincidunt sed pharetra mollis duis volutpat urna. Hendrerit aliquet et
|
|
64
|
+
arcu purus. Sodales elementum sollicitudin consequat elementum tortor. Lectus eget cursus ut ac pharetra
|
|
65
|
+
lobortis integer eu. Potenti amet ac id risus ac nunc orci nibh. Tempus vitae vitae aenean arcu. Nibh
|
|
66
|
+
tristique porta dui enim eget tristique rutrum. Quisque faucibus suscipit nibh est sed. Netus venenatis congue
|
|
67
|
+
diam in dui morbi dignissim lorem. Urna aliquet sem in tincidunt. Nunc arcu nec fringilla enim purus ut justo
|
|
68
|
+
nisi. Vel mus ut ornare faucibus blandit diam sit vestibulum massa. Semper nullam sit sagittis hendrerit
|
|
69
|
+
augue. In fermentum metus proin arcu faucibus proin nibh sit. Vel integer sed enim in sed vel nec ut vitae.
|
|
70
|
+
Commodo sagittis volutpat id lorem. Lorem ipsum dolor sit amet consectetur. Tincidunt sed pharetra mollis duis
|
|
71
|
+
volutpat urna. Hendrerit aliquet et arcu purus. Sodales elementum sollicitudin consequat elementum tortor.
|
|
72
|
+
Lectus eget cursus ut ac pharetra lobortis integer eu. Potenti amet ac id risus ac nunc orci nibh. Tempus
|
|
73
|
+
vitae vitae aenean arcu. Nibh tristique porta dui enim eget tristique rutrum. Quisque faucibus suscipit nibh
|
|
74
|
+
est sed. Netus venenatis congue diam in dui morbi dignissim lorem. Urna aliquet sem in tincidunt. Nunc arcu
|
|
75
|
+
nec fringilla enim purus ut justo nisi. Vel mus ut ornare faucibus blandit diam sit vestibulum massa. Semper
|
|
76
|
+
nullam sit sagittis hendrerit augue. In fermentum metus proin arcu faucibus proin nibh sit. Vel integer sed
|
|
77
|
+
enim in sed vel nec ut vitae. Commodo sagittis volutpat id lorem.
|
|
78
|
+
</DxcParagraph>
|
|
79
|
+
</DxcFlex>
|
|
80
|
+
</ExampleContainer>
|
|
81
|
+
<ExampleContainer>
|
|
82
|
+
<Title title="Object position" theme="light" level={4} />
|
|
83
|
+
<DxcImage
|
|
84
|
+
alt="Moon pic"
|
|
85
|
+
caption="Picture of the moon."
|
|
86
|
+
width="250px"
|
|
87
|
+
src="https://interactive-examples.mdn.mozilla.net/media/examples/moon.jpg"
|
|
88
|
+
objectPosition="right top"
|
|
89
|
+
objectFit="none"
|
|
90
|
+
/>
|
|
91
|
+
</ExampleContainer>
|
|
92
|
+
<ExampleContainer>
|
|
93
|
+
<Title title="Object fit: contain" theme="light" level={4} />
|
|
94
|
+
<div style={{ display: "flex", width: "fit-content", border: "1px solid #000", padding: "0.5rem" }}>
|
|
95
|
+
<DxcImage
|
|
96
|
+
alt="Dog pic"
|
|
97
|
+
src="https://cc-prod.scene7.com/is/image/CCProdAuthor/What-is-Stock-Photography_P1_mobile?$pjpeg$&jpegSize=200&wid=720"
|
|
98
|
+
width="200px"
|
|
99
|
+
height="200px"
|
|
100
|
+
objectFit="contain"
|
|
101
|
+
caption="Pretty dog."
|
|
102
|
+
/>
|
|
103
|
+
</div>
|
|
104
|
+
</ExampleContainer>
|
|
105
|
+
<ExampleContainer>
|
|
106
|
+
<Title title="Object fit: cover" theme="light" level={4} />
|
|
107
|
+
<div style={{ width: "75%", height: "300px" }}>
|
|
108
|
+
<DxcImage
|
|
109
|
+
alt="Spaceship pic"
|
|
110
|
+
src="https://media.istockphoto.com/id/1344443930/es/foto/lanzamiento-de-cohetes-del-transbordador-espacial-en-el-cielo-y-nubes-al-espacio-exterior.jpg?s=612x612&w=0&k=20&c=CO2A96GnnWvJsgZuj9WfYCVIBVzicnQDfnzwD1nomN0="
|
|
111
|
+
objectFit="cover"
|
|
112
|
+
width="50%"
|
|
113
|
+
height="100%"
|
|
114
|
+
objectPosition="0px 0px"
|
|
115
|
+
/>
|
|
116
|
+
<DxcImage
|
|
117
|
+
alt="Spaceship pic"
|
|
118
|
+
src="https://media.istockphoto.com/id/1344443930/es/foto/lanzamiento-de-cohetes-del-transbordador-espacial-en-el-cielo-y-nubes-al-espacio-exterior.jpg?s=612x612&w=0&k=20&c=CO2A96GnnWvJsgZuj9WfYCVIBVzicnQDfnzwD1nomN0="
|
|
119
|
+
objectFit="cover"
|
|
120
|
+
width="50%"
|
|
121
|
+
height="100%"
|
|
122
|
+
objectPosition="0px 0px"
|
|
123
|
+
/>
|
|
124
|
+
</div>
|
|
125
|
+
</ExampleContainer>
|
|
126
|
+
</>
|
|
127
|
+
);
|
package/image/types.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Props = {
|
|
3
|
+
/**
|
|
4
|
+
* Alternative text description displayed when the specified image is not loaded.
|
|
5
|
+
*
|
|
6
|
+
* See MDN: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt
|
|
7
|
+
* See W3C alt decision tree: https://www.w3.org/WAI/tutorials/images/decision-tree/
|
|
8
|
+
*/
|
|
9
|
+
alt: string;
|
|
10
|
+
/**
|
|
11
|
+
* Image legend with a descriptive purpose. It is placed below the image and is complementary to the alt attribute,
|
|
12
|
+
* which is required regardless of the presence of the caption or not.
|
|
13
|
+
*/
|
|
14
|
+
caption?: string;
|
|
15
|
+
/**
|
|
16
|
+
* If true, the image will be loaded only when it is visible on the screen (lazy loading).
|
|
17
|
+
* Otherwise and by default, the image will be loaded as soon as the component is mounted (eager loading).
|
|
18
|
+
*/
|
|
19
|
+
lazyLoading?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* URL of the image. This prop is required and must be valid.
|
|
22
|
+
*/
|
|
23
|
+
src: string;
|
|
24
|
+
/**
|
|
25
|
+
* List of one or more strings separated by commas indicating a set of possible images for the user agent to use.
|
|
26
|
+
*
|
|
27
|
+
* See MDN: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/srcset
|
|
28
|
+
*/
|
|
29
|
+
srcSet?: string;
|
|
30
|
+
/**
|
|
31
|
+
* One or more strings separated by commas, indicating a set of source sizes.
|
|
32
|
+
* If the srcSet attribute is absent or contains no values with a width descriptor,
|
|
33
|
+
* then this attribute has no effect.
|
|
34
|
+
*
|
|
35
|
+
* See MDN: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/sizes
|
|
36
|
+
*/
|
|
37
|
+
sizes?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Sets the rendered width of the image.
|
|
40
|
+
*/
|
|
41
|
+
width?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Sets the rendered height of the image.
|
|
44
|
+
*/
|
|
45
|
+
height?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Sets the object-fit CSS property.
|
|
48
|
+
*
|
|
49
|
+
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit
|
|
50
|
+
*/
|
|
51
|
+
objectFit?: "contain" | "cover" | "fill" | "none" | "scale-down";
|
|
52
|
+
/**
|
|
53
|
+
* Sets the object-position CSS property.
|
|
54
|
+
*
|
|
55
|
+
* See MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/object-position
|
|
56
|
+
*/
|
|
57
|
+
objectPosition?: string;
|
|
58
|
+
/**
|
|
59
|
+
* This function will be called when the image is loaded.
|
|
60
|
+
*/
|
|
61
|
+
onLoad?: React.ReactEventHandler<HTMLImageElement>;
|
|
62
|
+
/**
|
|
63
|
+
* This function will be called when the image fails to load.
|
|
64
|
+
*/
|
|
65
|
+
onError?: React.ReactEventHandler<HTMLImageElement>;
|
|
66
|
+
};
|
|
67
|
+
export declare type CaptionWrapperProps = {
|
|
68
|
+
condition: boolean;
|
|
69
|
+
wrapper: (children: React.ReactNode) => JSX.Element;
|
|
70
|
+
children: React.ReactNode;
|
|
71
|
+
};
|
|
72
|
+
export default Props;
|
|
@@ -25,7 +25,7 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
25
25
|
|
|
26
26
|
var _variables = require("../common/variables");
|
|
27
27
|
|
|
28
|
-
var _Icons = require("./Icons");
|
|
28
|
+
var _Icons = _interopRequireDefault(require("./Icons"));
|
|
29
29
|
|
|
30
30
|
var _SidenavContext = require("./SidenavContext");
|
|
31
31
|
|
|
@@ -57,23 +57,23 @@ var defaultFooter = function defaultFooter() {
|
|
|
57
57
|
href: "https://www.linkedin.com/company/dxctechnology",
|
|
58
58
|
text: "Linkedin"
|
|
59
59
|
}, {
|
|
60
|
-
href: "https://
|
|
61
|
-
text: "
|
|
60
|
+
href: "https://x.com/dxctechnology",
|
|
61
|
+
text: "X"
|
|
62
62
|
}, {
|
|
63
63
|
href: "https://www.facebook.com/DXCTechnology/",
|
|
64
64
|
text: "Facebook"
|
|
65
65
|
}],
|
|
66
66
|
socialLinks: [{
|
|
67
67
|
href: "https://www.linkedin.com/company/dxctechnology",
|
|
68
|
-
logo: _Icons.linkedinLogo,
|
|
68
|
+
logo: _Icons["default"].linkedinLogo,
|
|
69
69
|
title: "Linkedin"
|
|
70
70
|
}, {
|
|
71
|
-
href: "https://
|
|
72
|
-
logo: _Icons.
|
|
73
|
-
title: "
|
|
71
|
+
href: "https://x.com/dxctechnology",
|
|
72
|
+
logo: _Icons["default"].xLogo,
|
|
73
|
+
title: "X"
|
|
74
74
|
}, {
|
|
75
75
|
href: "https://www.facebook.com/DXCTechnology/",
|
|
76
|
-
logo: _Icons.facebookLogo,
|
|
76
|
+
logo: _Icons["default"].facebookLogo,
|
|
77
77
|
title: "Facebook"
|
|
78
78
|
}]
|
|
79
79
|
});
|
|
@@ -122,7 +122,7 @@ var DxcApplicationLayout = function DxcApplicationLayout(_ref2) {
|
|
|
122
122
|
});
|
|
123
123
|
};
|
|
124
124
|
|
|
125
|
-
(0, _react.
|
|
125
|
+
(0, _react.useEffect)(function () {
|
|
126
126
|
handleResize();
|
|
127
127
|
window.addEventListener("resize", handleResize);
|
|
128
128
|
return function () {
|
|
@@ -140,7 +140,7 @@ var DxcApplicationLayout = function DxcApplicationLayout(_ref2) {
|
|
|
140
140
|
onClick: handleSidenavVisibility,
|
|
141
141
|
"aria-label": visibilityToggleLabel ? undefined : translatedLabels.applicationLayout.visibilityToggleTitle,
|
|
142
142
|
title: translatedLabels.applicationLayout.visibilityToggleTitle
|
|
143
|
-
}, _Icons.hamburgerIcon, visibilityToggleLabel)), /*#__PURE__*/_react["default"].createElement(BodyContainer, null, /*#__PURE__*/_react["default"].createElement(_SidenavContext.SidenavContextProvider, {
|
|
143
|
+
}, _Icons["default"].hamburgerIcon, visibilityToggleLabel)), /*#__PURE__*/_react["default"].createElement(BodyContainer, null, /*#__PURE__*/_react["default"].createElement(_SidenavContext.SidenavContextProvider, {
|
|
144
144
|
value: setIsSidenavVisibleResponsive
|
|
145
145
|
}, sidenav && (isResponsive ? isSidenavVisibleResponsive : true) && /*#__PURE__*/_react["default"].createElement(SidenavContainer, null, sidenav)), /*#__PURE__*/_react["default"].createElement(MainContainer, null, /*#__PURE__*/_react["default"].createElement(MainContentContainer, null, main), footerContent)));
|
|
146
146
|
};
|
|
@@ -155,7 +155,7 @@ var HeaderContainer = _styledComponents["default"].div(_templateObject2 || (_tem
|
|
|
155
155
|
|
|
156
156
|
var VisibilityToggle = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n position: fixed;\n top: 64px;\n left: 0;\n right: 0;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n padding: 4px 16px;\n width: 100%;\n background-color: #f2f2f2;\n user-select: none;\n z-index: 2;\n"])));
|
|
157
157
|
|
|
158
|
-
var HamburgerTrigger = _styledComponents["default"].button(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n gap: 10px;\n border: 0px solid transparent;\n border-radius: 2px;\n padding: 12px 4px;\n background-color: transparent;\n box-shadow: 0 0 0 2px transparent;\n font-family: Open Sans, sans-serif;\n font-weight: 600;\n font-size: 14px;\n color: #000;\n cursor: pointer;\n :active {\n background-color: #cccccc;\n }\n :focus,\n :focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px #0095ff;\n }\n & > svg {\n height: 20px;\n width: 20px;\n }\n"])));
|
|
158
|
+
var HamburgerTrigger = _styledComponents["default"].button(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n gap: 10px;\n border: 0px solid transparent;\n border-radius: 2px;\n padding: 12px 4px;\n background-color: transparent;\n box-shadow: 0 0 0 2px transparent;\n font-family: Open Sans, sans-serif;\n font-weight: 600;\n font-size: 14px;\n color: #000;\n cursor: pointer;\n\n :active {\n background-color: #cccccc;\n }\n :focus,\n :focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px #0095ff;\n }\n & > svg {\n height: 20px;\n width: 20px;\n }\n"])));
|
|
159
159
|
|
|
160
160
|
var BodyContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n flex: 1;\n"])));
|
|
161
161
|
|
|
@@ -4,7 +4,7 @@ import Title from "../../.storybook/components/Title";
|
|
|
4
4
|
import { INITIAL_VIEWPORTS } from "@storybook/addon-viewport";
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
|
-
title: "Application Layout
|
|
7
|
+
title: "Application Layout",
|
|
8
8
|
component: DxcApplicationLayout,
|
|
9
9
|
parameters: {
|
|
10
10
|
viewport: {
|
package/layout/Icons.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
declare const layoutIcons: {
|
|
3
|
+
facebookLogo: JSX.Element;
|
|
4
|
+
xLogo: JSX.Element;
|
|
5
|
+
linkedinLogo: JSX.Element;
|
|
6
|
+
hamburgerIcon: JSX.Element;
|
|
7
|
+
};
|
|
8
|
+
export default layoutIcons;
|
package/layout/Icons.js
CHANGED
|
@@ -5,62 +5,58 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports
|
|
8
|
+
exports["default"] = void 0;
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}, /*#__PURE__*/_react["default"].createElement("
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
d: "M3 18V16H21V18ZM3 13V11H21V13ZM3 8V6H21V8Z"
|
|
64
|
-
}));
|
|
65
|
-
|
|
66
|
-
exports.hamburgerIcon = hamburgerIcon;
|
|
12
|
+
var layoutIcons = {
|
|
13
|
+
facebookLogo: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
14
|
+
version: "1.1",
|
|
15
|
+
id: "Capa_1",
|
|
16
|
+
x: "0px",
|
|
17
|
+
y: "0px",
|
|
18
|
+
width: "438.536px",
|
|
19
|
+
height: "438.536px",
|
|
20
|
+
viewBox: "0 0 438.536 438.536",
|
|
21
|
+
fill: "#FFFFFF"
|
|
22
|
+
}, /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("path", {
|
|
23
|
+
d: "M414.41,24.123C398.333,8.042,378.963,0,356.315,0H82.228C59.58,0,40.21,8.042,24.126,24.123 C8.045,40.207,0.003,59.576,0.003,82.225v274.084c0,22.647,8.042,42.018,24.123,58.102c16.084,16.084,35.454,24.126,58.102,24.126 h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225 C438.532,59.576,430.49,40.204,414.41,24.123z M373.155,225.548h-49.963V406.84h-74.802V225.548H210.99V163.02h37.401v-37.402 c0-26.838,6.283-47.107,18.843-60.813c12.559-13.706,33.304-20.555,62.242-20.555h49.963v62.526h-31.401 c-10.663,0-17.467,1.853-20.417,5.568c-2.949,3.711-4.428,10.23-4.428,19.558v31.119h56.534L373.155,225.548z"
|
|
24
|
+
}))),
|
|
25
|
+
xLogo: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
26
|
+
width: "256",
|
|
27
|
+
height: "256",
|
|
28
|
+
viewBox: "0 0 256 256",
|
|
29
|
+
fill: "none",
|
|
30
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
31
|
+
}, /*#__PURE__*/_react["default"].createElement("rect", {
|
|
32
|
+
width: "256",
|
|
33
|
+
height: "256",
|
|
34
|
+
rx: "40",
|
|
35
|
+
fill: "white"
|
|
36
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
37
|
+
d: "M140.192 118.205L187.848 64H176.556L135.158 111.056L102.117 64H64L113.975 135.163L64 192H75.2914L118.982 142.296L153.883 192H192L140.192 118.205ZM124.722 135.787L119.65 128.697L79.3634 72.3294H96.7094L129.232 117.837L134.282 124.927L176.551 184.076H159.205L124.722 135.787Z",
|
|
38
|
+
fill: "#0F1419"
|
|
39
|
+
})),
|
|
40
|
+
linkedinLogo: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
41
|
+
version: "1.1",
|
|
42
|
+
id: "Capa_1",
|
|
43
|
+
x: "0px",
|
|
44
|
+
y: "0px",
|
|
45
|
+
width: "438.536px",
|
|
46
|
+
height: "438.536px",
|
|
47
|
+
viewBox: "0 0 438.536 438.536",
|
|
48
|
+
fill: "#FFFFFF"
|
|
49
|
+
}, /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("path", {
|
|
50
|
+
d: "M414.41,24.123C398.333,8.042,378.963,0,356.315,0H82.228C59.58,0,40.21,8.042,24.126,24.123 C8.045,40.207,0.003,59.576,0.003,82.225v274.084c0,22.647,8.042,42.018,24.123,58.102c16.084,16.084,35.454,24.126,58.102,24.126 h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225 C438.532,59.576,430.49,40.204,414.41,24.123z M133.618,367.157H67.666V169.016h65.952V367.157z M127.626,132.332 c-6.851,6.567-15.893,9.851-27.124,9.851h-0.288c-10.848,0-19.648-3.284-26.407-9.851c-6.76-6.567-10.138-14.703-10.138-24.41 c0-9.897,3.476-18.083,10.421-24.556c6.95-6.471,15.942-9.708,26.98-9.708c11.039,0,19.89,3.237,26.553,9.708 c6.661,6.473,10.088,14.659,10.277,24.556C137.899,117.625,134.477,125.761,127.626,132.332z M370.873,367.157h-65.952v-105.92 c0-29.879-11.036-44.823-33.116-44.823c-8.374,0-15.42,2.331-21.128,6.995c-5.715,4.661-9.996,10.324-12.847,16.991 c-1.335,3.422-1.999,8.75-1.999,15.981v110.775h-65.952c0.571-119.529,0.571-185.579,0-198.142h65.952v27.974 c13.867-21.681,33.558-32.544,59.101-32.544c22.84,0,41.21,7.52,55.104,22.554c13.895,15.037,20.841,37.214,20.841,66.519v113.64 H370.873z"
|
|
51
|
+
}))),
|
|
52
|
+
hamburgerIcon: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
53
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
54
|
+
height: "24",
|
|
55
|
+
width: "24",
|
|
56
|
+
viewBox: "0 0 24 24"
|
|
57
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
58
|
+
d: "M3 18V16H21V18ZM3 13V11H21V13ZM3 8V6H21V8Z"
|
|
59
|
+
}))
|
|
60
|
+
};
|
|
61
|
+
var _default = layoutIcons;
|
|
62
|
+
exports["default"] = _default;
|