@dxc-technology/halstack-react 0.0.0-5aa300b → 0.0.0-5b43b04
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.js +86 -45
- package/accordion/Accordion.stories.tsx +51 -2
- package/alert/Alert.stories.tsx +28 -0
- package/box/Box.stories.tsx +15 -0
- package/button/Button.stories.tsx +100 -9
- package/checkbox/Checkbox.stories.tsx +52 -0
- package/chip/Chip.js +8 -2
- package/chip/Chip.stories.tsx +55 -0
- package/common/variables.js +163 -137
- package/date-input/Calendar.d.ts +1 -1
- package/date-input/Calendar.js +43 -43
- package/date-input/DateInput.js +74 -32
- package/date-input/DateInput.stories.tsx +183 -30
- package/date-input/DateInput.test.js +120 -37
- package/date-input/DatePicker.js +38 -52
- package/date-input/Icons.d.ts +6 -0
- package/date-input/Icons.js +75 -0
- package/date-input/YearPicker.d.ts +1 -1
- package/date-input/YearPicker.js +23 -12
- package/date-input/types.d.ts +6 -8
- package/dialog/Dialog.js +1 -3
- package/dialog/Dialog.stories.tsx +42 -20
- package/dropdown/Dropdown.js +0 -1
- package/dropdown/Dropdown.stories.tsx +200 -82
- package/dropdown/DropdownMenu.js +8 -18
- package/dropdown/DropdownMenuItem.js +4 -15
- package/file-input/FileInput.stories.tsx +85 -2
- package/footer/Footer.stories.tsx +91 -0
- package/header/Header.js +18 -20
- package/header/Header.stories.tsx +149 -6
- package/link/Link.stories.tsx +60 -0
- package/package.json +1 -1
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +17 -10
- package/progress-bar/ProgressBar.js +4 -4
- package/progress-bar/ProgressBar.stories.jsx +35 -2
- package/quick-nav/QuickNav.stories.tsx +14 -0
- package/radio-group/RadioGroup.stories.tsx +131 -18
- package/resultsetTable/ResultsetTable.test.js +17 -22
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +5 -34
- package/select/Option.js +3 -14
- package/select/Select.js +43 -24
- package/select/Select.stories.tsx +475 -187
- package/select/Select.test.js +17 -22
- package/select/types.d.ts +2 -2
- package/sidenav/Sidenav.stories.tsx +93 -0
- package/slider/Slider.stories.tsx +57 -0
- package/spinner/Spinner.stories.jsx +27 -1
- package/switch/Switch.stories.tsx +33 -0
- package/table/Table.stories.jsx +80 -1
- package/tabs/Tabs.stories.tsx +38 -0
- package/tabs-nav/NavTabs.js +1 -1
- package/tabs-nav/Tab.js +30 -9
- package/tag/Tag.stories.tsx +14 -1
- package/text-input/TextInput.stories.tsx +69 -0
- package/textarea/Textarea.stories.jsx +60 -1
- package/toggle-group/ToggleGroup.stories.tsx +42 -0
- package/wizard/Wizard.stories.tsx +20 -0
package/dropdown/DropdownMenu.js
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
@@ -13,18 +11,12 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
|
|
|
13
11
|
|
|
14
12
|
var _react = _interopRequireDefault(require("react"));
|
|
15
13
|
|
|
16
|
-
var _styledComponents =
|
|
17
|
-
|
|
18
|
-
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
14
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
19
15
|
|
|
20
16
|
var _DropdownMenuItem = _interopRequireDefault(require("./DropdownMenuItem"));
|
|
21
17
|
|
|
22
18
|
var _templateObject;
|
|
23
19
|
|
|
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
20
|
var DropdownMenu = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
29
21
|
var id = _ref.id,
|
|
30
22
|
dropdownTriggerId = _ref.dropdownTriggerId,
|
|
@@ -34,12 +26,10 @@ var DropdownMenu = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
34
26
|
onKeyDown = _ref.onKeyDown,
|
|
35
27
|
options = _ref.options,
|
|
36
28
|
styles = _ref.styles;
|
|
37
|
-
|
|
38
|
-
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
39
|
-
theme: colorsTheme.dropdown
|
|
40
|
-
}, /*#__PURE__*/_react["default"].createElement(DropdownMenuContainer, {
|
|
29
|
+
return /*#__PURE__*/_react["default"].createElement(DropdownMenuContainer, {
|
|
41
30
|
onMouseDown: function onMouseDown(event) {
|
|
42
|
-
// Prevent the onBlur event from closing menu when clicking on the menu since
|
|
31
|
+
// Prevent the onBlur event from closing menu when clicking on the menu since
|
|
32
|
+
// it is implemented with a Portal and the menu is not a direct child of the container
|
|
43
33
|
event.preventDefault();
|
|
44
34
|
},
|
|
45
35
|
onKeyDown: onKeyDown,
|
|
@@ -49,8 +39,8 @@ var DropdownMenu = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
49
39
|
"aria-orientation": "vertical",
|
|
50
40
|
"aria-activedescendant": "option-".concat(visualFocusIndex),
|
|
51
41
|
tabIndex: -1,
|
|
52
|
-
|
|
53
|
-
|
|
42
|
+
ref: ref,
|
|
43
|
+
style: styles
|
|
54
44
|
}, options.map(function (option, index) {
|
|
55
45
|
return /*#__PURE__*/_react["default"].createElement(_DropdownMenuItem["default"], {
|
|
56
46
|
id: "option-".concat(index),
|
|
@@ -60,10 +50,10 @@ var DropdownMenu = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
60
50
|
onClick: menuItemOnClick,
|
|
61
51
|
option: option
|
|
62
52
|
});
|
|
63
|
-
}))
|
|
53
|
+
}));
|
|
64
54
|
});
|
|
65
55
|
|
|
66
|
-
var DropdownMenuContainer = _styledComponents["default"].ul(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n max-height: 230px;\n overflow-y: auto;\n padding: 0;\n margin: 0;\n background-color: ", ";\n border-width: ", ";\n border-style: ", ";\n border-color: ", ";\n border-radius: ", ";\n border-top-right-radius: 0;\n border-top-left-radius: 0;\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);\n outline: none;\n"])), function (props) {
|
|
56
|
+
var DropdownMenuContainer = _styledComponents["default"].ul(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n max-height: 230px;\n min-width: min-content;\n overflow-y: auto;\n padding: 0;\n margin: 0;\n background-color: ", ";\n border-width: ", ";\n border-style: ", ";\n border-color: ", ";\n border-radius: ", ";\n border-top-right-radius: 0;\n border-top-left-radius: 0;\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);\n outline: none;\n"])), function (props) {
|
|
67
57
|
return props.theme.optionBackgroundColor;
|
|
68
58
|
}, function (props) {
|
|
69
59
|
return props.theme.borderThickness;
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
@@ -13,26 +11,17 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
|
|
|
13
11
|
|
|
14
12
|
var _react = _interopRequireDefault(require("react"));
|
|
15
13
|
|
|
16
|
-
var _styledComponents =
|
|
17
|
-
|
|
18
|
-
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
14
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
19
15
|
|
|
20
16
|
var _templateObject, _templateObject2, _templateObject3;
|
|
21
17
|
|
|
22
|
-
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); }
|
|
23
|
-
|
|
24
|
-
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; }
|
|
25
|
-
|
|
26
18
|
var DropdownMenuItem = function DropdownMenuItem(_ref) {
|
|
27
19
|
var id = _ref.id,
|
|
28
20
|
visuallyFocused = _ref.visuallyFocused,
|
|
29
21
|
iconPosition = _ref.iconPosition,
|
|
30
22
|
_onClick = _ref.onClick,
|
|
31
23
|
option = _ref.option;
|
|
32
|
-
|
|
33
|
-
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
34
|
-
theme: colorsTheme.dropdown
|
|
35
|
-
}, /*#__PURE__*/_react["default"].createElement(DropdownMenuItemContainer, {
|
|
24
|
+
return /*#__PURE__*/_react["default"].createElement(DropdownMenuItemContainer, {
|
|
36
25
|
visuallyFocused: visuallyFocused,
|
|
37
26
|
onClick: function onClick() {
|
|
38
27
|
_onClick(option.value);
|
|
@@ -46,7 +35,7 @@ var DropdownMenuItem = function DropdownMenuItem(_ref) {
|
|
|
46
35
|
role: typeof option.icon === "string" ? undefined : "img"
|
|
47
36
|
}, typeof option.icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
48
37
|
src: option.icon
|
|
49
|
-
}) : option.icon), iconPosition === "before" && /*#__PURE__*/_react["default"].createElement(DropdownMenuItemLabel, null, option.label))
|
|
38
|
+
}) : option.icon), iconPosition === "before" && /*#__PURE__*/_react["default"].createElement(DropdownMenuItemLabel, null, option.label));
|
|
50
39
|
};
|
|
51
40
|
|
|
52
41
|
var DropdownMenuItemContainer = _styledComponents["default"].li(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n align-items: center;\n gap: ", ";\n min-height: 36px;\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n cursor: pointer;\n\n ", "\n &:hover {\n background-color: ", ";\n }\n &:active {\n background-color: ", ";\n }\n"])), function (props) {
|
|
@@ -67,7 +56,7 @@ var DropdownMenuItemContainer = _styledComponents["default"].li(_templateObject
|
|
|
67
56
|
return props.theme.activeOptionBackgroundColor;
|
|
68
57
|
});
|
|
69
58
|
|
|
70
|
-
var DropdownMenuItemLabel = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.5rem;\n color: ", ";\n"])), function (props) {
|
|
59
|
+
var DropdownMenuItemLabel = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: 1.5rem;\n color: ", ";\n white-space: nowrap;\n"])), function (props) {
|
|
71
60
|
return props.theme.optionFontFamily;
|
|
72
61
|
}, function (props) {
|
|
73
62
|
return props.theme.optionFontSize;
|
|
@@ -3,13 +3,14 @@ import DxcFileInput from "./FileInput";
|
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
5
|
import FileItem from "./FileItem";
|
|
6
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
6
7
|
|
|
7
8
|
export default {
|
|
8
9
|
title: "File input",
|
|
9
10
|
component: DxcFileInput,
|
|
10
11
|
};
|
|
11
12
|
|
|
12
|
-
const picPreview = "https://cdn.mos.cms.futurecdn.net/CAZ6JXi6huSuN4QGE627NR.jpg"
|
|
13
|
+
const picPreview = "https://cdn.mos.cms.futurecdn.net/CAZ6JXi6huSuN4QGE627NR.jpg";
|
|
13
14
|
|
|
14
15
|
const file1 = new File(["file1"], "file.pdf", { type: "text/plain" });
|
|
15
16
|
const file2 = new File(["file2"], "file2.mp3", {
|
|
@@ -63,6 +64,12 @@ const filesExamples = [
|
|
|
63
64
|
},
|
|
64
65
|
];
|
|
65
66
|
|
|
67
|
+
const opinionatedTheme = {
|
|
68
|
+
fileInput: {
|
|
69
|
+
fontColor: "#000000",
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
66
73
|
export const Chromatic = () => (
|
|
67
74
|
<>
|
|
68
75
|
<Title title="File item states" theme="light" level={2} />
|
|
@@ -529,7 +536,83 @@ export const Chromatic = () => (
|
|
|
529
536
|
mode="dropzone"
|
|
530
537
|
margin="xxlarge"
|
|
531
538
|
/>
|
|
532
|
-
|
|
539
|
+
</ExampleContainer>
|
|
540
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
541
|
+
<ExampleContainer>
|
|
542
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
543
|
+
<Title title="Single file" theme="light" level={4} />
|
|
544
|
+
<DxcFileInput
|
|
545
|
+
label="File input"
|
|
546
|
+
helperText="Please select files"
|
|
547
|
+
value={fileExample}
|
|
548
|
+
multiple={false}
|
|
549
|
+
callbackFile={() => {}}
|
|
550
|
+
/>
|
|
551
|
+
</HalstackProvider>
|
|
552
|
+
</ExampleContainer>
|
|
553
|
+
<ExampleContainer>
|
|
554
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
555
|
+
<Title title="Invalid single file" theme="light" level={4} />
|
|
556
|
+
<DxcFileInput
|
|
557
|
+
label="File input"
|
|
558
|
+
helperText="Please select files"
|
|
559
|
+
value={fileExampleError}
|
|
560
|
+
multiple={false}
|
|
561
|
+
callbackFile={() => {}}
|
|
562
|
+
/>
|
|
563
|
+
</HalstackProvider>
|
|
564
|
+
</ExampleContainer>
|
|
565
|
+
<ExampleContainer>
|
|
566
|
+
<Title title="Single file" theme="light" level={4} />
|
|
567
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
568
|
+
<DxcFileInput
|
|
569
|
+
mode="filedrop"
|
|
570
|
+
label="File input"
|
|
571
|
+
helperText="Please select files"
|
|
572
|
+
value={fileExample}
|
|
573
|
+
multiple={false}
|
|
574
|
+
callbackFile={() => {}}
|
|
575
|
+
/>
|
|
576
|
+
</HalstackProvider>
|
|
577
|
+
</ExampleContainer>
|
|
578
|
+
<ExampleContainer>
|
|
579
|
+
<Title title="Invalid single file" theme="light" level={4} />
|
|
580
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
581
|
+
<DxcFileInput
|
|
582
|
+
mode="filedrop"
|
|
583
|
+
label="File input"
|
|
584
|
+
helperText="Please select files"
|
|
585
|
+
value={fileExampleError}
|
|
586
|
+
multiple={false}
|
|
587
|
+
callbackFile={() => {}}
|
|
588
|
+
/>
|
|
589
|
+
</HalstackProvider>
|
|
590
|
+
</ExampleContainer>
|
|
591
|
+
<ExampleContainer>
|
|
592
|
+
<Title title="Single file" theme="light" level={4} />
|
|
593
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
594
|
+
<DxcFileInput
|
|
595
|
+
label="File input"
|
|
596
|
+
helperText="Please select files"
|
|
597
|
+
mode="dropzone"
|
|
598
|
+
value={fileExample}
|
|
599
|
+
callbackFile={() => {}}
|
|
600
|
+
multiple={false}
|
|
601
|
+
/>
|
|
602
|
+
</HalstackProvider>
|
|
603
|
+
</ExampleContainer>
|
|
604
|
+
<ExampleContainer>
|
|
605
|
+
<Title title="Invalid single file" theme="light" level={4} />{" "}
|
|
606
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
607
|
+
<DxcFileInput
|
|
608
|
+
label="File input"
|
|
609
|
+
helperText="Please select files"
|
|
610
|
+
mode="dropzone"
|
|
611
|
+
value={fileExampleError}
|
|
612
|
+
callbackFile={() => {}}
|
|
613
|
+
multiple={false}
|
|
614
|
+
/>
|
|
615
|
+
</HalstackProvider>
|
|
533
616
|
</ExampleContainer>
|
|
534
617
|
</>
|
|
535
618
|
);
|
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import DxcFooter from "./Footer";
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
5
6
|
|
|
6
7
|
const social = [
|
|
7
8
|
{
|
|
@@ -85,6 +86,86 @@ export default {
|
|
|
85
86
|
component: DxcFooter,
|
|
86
87
|
};
|
|
87
88
|
|
|
89
|
+
const opinionatedTheme = {
|
|
90
|
+
footer: {
|
|
91
|
+
baseColor: "#000000",
|
|
92
|
+
fontColor: "#ffffff",
|
|
93
|
+
accentColor: "#0095ff",
|
|
94
|
+
logo: (
|
|
95
|
+
<svg id="g10" xmlns="http://www.w3.org/2000/svg" width="280.781" height="32" viewBox="0 0 280.781 32">
|
|
96
|
+
<g id="g12">
|
|
97
|
+
<path
|
|
98
|
+
id="path14"
|
|
99
|
+
d="M171.5-54.124v12.539h-3.6V-54.124h-4.973v-3.191h13.54v3.191H171.5"
|
|
100
|
+
transform="translate(-68.528 65.45)"
|
|
101
|
+
fill="#fff"
|
|
102
|
+
/>
|
|
103
|
+
<path
|
|
104
|
+
id="path16"
|
|
105
|
+
d="M189.96-41.585V-57.315h12.326v3.079h-8.753v3.191h7.7v3.078h-7.7v3.3h8.87v3.078H189.96"
|
|
106
|
+
transform="translate(-77.56 65.45)"
|
|
107
|
+
fill="#fff"
|
|
108
|
+
/>
|
|
109
|
+
<path
|
|
110
|
+
id="path18"
|
|
111
|
+
d="M223.558-41.438a8.1,8.1,0,0,1-8.382-8.1v-.045a8.161,8.161,0,0,1,8.522-8.146,8.6,8.6,0,0,1,6.444,2.431l-2.289,2.543a6.133,6.133,0,0,0-4.178-1.778,4.743,4.743,0,0,0-4.738,4.905v.045a4.752,4.752,0,0,0,4.738,4.95,6,6,0,0,0,4.295-1.845l2.288,2.228a8.491,8.491,0,0,1-6.7,2.813"
|
|
112
|
+
transform="translate(-86.019 65.583)"
|
|
113
|
+
fill="#fff"
|
|
114
|
+
/>
|
|
115
|
+
<path
|
|
116
|
+
id="path20"
|
|
117
|
+
d="M254.988-41.585V-47.9h-6.63v6.315h-3.6V-57.315h3.6v6.225h6.63v-6.225h3.594v15.731h-3.594"
|
|
118
|
+
transform="translate(-95.903 65.45)"
|
|
119
|
+
fill="#fff"
|
|
120
|
+
/>
|
|
121
|
+
<path
|
|
122
|
+
id="path22"
|
|
123
|
+
d="M285.991-41.585l-7.914-10v10h-3.549V-57.315h3.316l7.657,9.685v-9.685h3.549v15.731h-3.058"
|
|
124
|
+
transform="translate(-105.869 65.45)"
|
|
125
|
+
fill="#fff"
|
|
126
|
+
/>
|
|
127
|
+
<path
|
|
128
|
+
id="path24"
|
|
129
|
+
d="M317.2-49.583a4.869,4.869,0,0,0-4.949-4.95,4.793,4.793,0,0,0-4.9,4.905v.045a4.869,4.869,0,0,0,4.949,4.95,4.793,4.793,0,0,0,4.9-4.905Zm-4.949,8.145c-5.043,0-8.661-3.623-8.661-8.1v-.045c0-4.478,3.666-8.146,8.708-8.146s8.66,3.623,8.66,8.1v.045c0,4.477-3.664,8.145-8.708,8.145"
|
|
130
|
+
transform="translate(-115.631 65.583)"
|
|
131
|
+
fill="#fff"
|
|
132
|
+
/>
|
|
133
|
+
<path
|
|
134
|
+
id="path26"
|
|
135
|
+
d="M336.786-41.585V-57.315h3.6v12.584h8.148v3.146H336.786"
|
|
136
|
+
transform="translate(-126.654 65.45)"
|
|
137
|
+
fill="#fff"
|
|
138
|
+
/>
|
|
139
|
+
<path
|
|
140
|
+
id="path28"
|
|
141
|
+
d="M372.78-49.583a4.87,4.87,0,0,0-4.949-4.95,4.794,4.794,0,0,0-4.9,4.905v.045a4.869,4.869,0,0,0,4.949,4.95,4.794,4.794,0,0,0,4.9-4.905Zm-4.949,8.145c-5.043,0-8.662-3.623-8.662-8.1v-.045c0-4.478,3.666-8.146,8.708-8.146s8.661,3.623,8.661,8.1v.045c0,4.477-3.666,8.145-8.708,8.145"
|
|
142
|
+
transform="translate(-135.016 65.583)"
|
|
143
|
+
fill="#fff"
|
|
144
|
+
/>
|
|
145
|
+
<path
|
|
146
|
+
id="path30"
|
|
147
|
+
d="M399.735-41.438c-5.09,0-8.592-3.443-8.592-8.1v-.045a8.243,8.243,0,0,1,8.568-8.146,9.18,9.18,0,0,1,6.42,2.16l-2.265,2.634a6.141,6.141,0,0,0-4.272-1.6,4.807,4.807,0,0,0-4.692,4.905v.045a4.8,4.8,0,0,0,4.949,4.995,5.89,5.89,0,0,0,3.384-.945v-2.25h-3.618v-2.992h7.1v6.841a10.837,10.837,0,0,1-6.98,2.5"
|
|
148
|
+
transform="translate(-145.284 65.583)"
|
|
149
|
+
fill="#fff"
|
|
150
|
+
/>
|
|
151
|
+
<path
|
|
152
|
+
id="path32"
|
|
153
|
+
d="M428.664-47.855v6.27h-3.6v-6.2l-6.28-9.528h4.2L426.89-51l3.968-6.315h4.085l-6.28,9.46"
|
|
154
|
+
transform="translate(-154.162 65.45)"
|
|
155
|
+
fill="#fff"
|
|
156
|
+
/>
|
|
157
|
+
<path
|
|
158
|
+
id="path34"
|
|
159
|
+
d="M84.218-55.737a10.063,10.063,0,0,1,2.589-4.4,9.792,9.792,0,0,1,6.985-2.77h11.328V-69.3H93.792a17.041,17.041,0,0,0-11.8,4.759,16.344,16.344,0,0,0-3.547,5.115,13.247,13.247,0,0,0-1.122,3.688Zm0,4.877a10.065,10.065,0,0,0,2.589,4.4,9.793,9.793,0,0,0,6.985,2.77h11.328V-37.3H93.792a17.042,17.042,0,0,1-11.8-4.759,16.339,16.339,0,0,1-3.547-5.114,13.251,13.251,0,0,1-1.122-3.688ZM63.1-47.98,54.45-37.3H45.873l12.957-16-12.957-16H54.45L63.1-58.619l8.65-10.68h8.578l-12.957,16,12.957,16H71.749ZM48.875-55.737a13.212,13.212,0,0,0-1.122-3.688,16.359,16.359,0,0,0-3.546-5.115,17.043,17.043,0,0,0-11.8-4.759H21.08v6.393H32.408a9.79,9.79,0,0,1,6.985,2.77,10.072,10.072,0,0,1,2.59,4.4Zm0,4.877a13.215,13.215,0,0,1-1.122,3.688,16.353,16.353,0,0,1-3.546,5.114,17.044,17.044,0,0,1-11.8,4.759H21.08v-6.393H32.408a9.791,9.791,0,0,0,6.985-2.77,10.074,10.074,0,0,0,2.59-4.4h6.892"
|
|
160
|
+
transform="translate(-21.08 69.298)"
|
|
161
|
+
fill="#fff"
|
|
162
|
+
/>
|
|
163
|
+
</g>
|
|
164
|
+
</svg>
|
|
165
|
+
),
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
|
|
88
169
|
export const Chromatic = () => (
|
|
89
170
|
<>
|
|
90
171
|
<ExampleContainer>
|
|
@@ -133,5 +214,15 @@ export const Chromatic = () => (
|
|
|
133
214
|
<Title title="Xxlarge padding" theme="light" level={4} />
|
|
134
215
|
<DxcFooter padding="xxlarge"></DxcFooter>
|
|
135
216
|
</ExampleContainer>
|
|
217
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
218
|
+
<ExampleContainer>
|
|
219
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
220
|
+
<DxcFooter copyright="Copyright" socialLinks={social} bottomLinks={bottom}>
|
|
221
|
+
<div>
|
|
222
|
+
<a href="https://www.linkedin.com/company/dxctechnology">Linkedin</a>
|
|
223
|
+
</div>
|
|
224
|
+
</DxcFooter>
|
|
225
|
+
</HalstackProvider>
|
|
226
|
+
</ExampleContainer>
|
|
136
227
|
</>
|
|
137
228
|
);
|
package/header/Header.js
CHANGED
|
@@ -39,14 +39,11 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
39
39
|
|
|
40
40
|
var closeIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
41
41
|
xmlns: "http://www.w3.org/2000/svg",
|
|
42
|
-
height: "24",
|
|
43
42
|
viewBox: "0 0 24 24",
|
|
43
|
+
height: "24",
|
|
44
44
|
width: "24"
|
|
45
45
|
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
46
|
-
d: "
|
|
47
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
48
|
-
d: "M0 0h24v24H0z",
|
|
49
|
-
fill: "none"
|
|
46
|
+
d: "M6.4 19 5 17.6l5.6-5.6L5 6.4 6.4 5l5.6 5.6L17.6 5 19 6.4 13.4 12l5.6 5.6-1.4 1.4-5.6-5.6Z"
|
|
50
47
|
}));
|
|
51
48
|
|
|
52
49
|
var hamburgerIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
@@ -62,7 +59,7 @@ var Dropdown = function Dropdown(props) {
|
|
|
62
59
|
return /*#__PURE__*/_react["default"].createElement(HeaderDropdown, null, /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], props));
|
|
63
60
|
};
|
|
64
61
|
|
|
65
|
-
var HeaderDropdown = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n button {\n background-color: transparent;\n :hover {\n background-color: transparent;\n }\n }\n"])));
|
|
62
|
+
var HeaderDropdown = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n button {\n background-color: transparent;\n :hover {\n background-color: transparent;\n }\n }\n"])));
|
|
66
63
|
|
|
67
64
|
var getLogoElement = function getLogoElement(themeInput, logoLabel) {
|
|
68
65
|
if (!themeInput) return _Icons.dxcLogo;else if (typeof themeInput === "string") return /*#__PURE__*/_react["default"].createElement(LogoImg, {
|
|
@@ -110,9 +107,9 @@ var DxcHeader = function DxcHeader(_ref2) {
|
|
|
110
107
|
isMenuVisible = _useState4[0],
|
|
111
108
|
setIsMenuVisible = _useState4[1];
|
|
112
109
|
|
|
113
|
-
var handleResize = function
|
|
110
|
+
var handleResize = (0, _react.useCallback)(function () {
|
|
114
111
|
setIsResponsive(window.matchMedia("(max-width: ".concat(_variables.responsiveSizes.medium, "rem)")).matches);
|
|
115
|
-
};
|
|
112
|
+
}, []);
|
|
116
113
|
|
|
117
114
|
var handleMenu = function handleMenu() {
|
|
118
115
|
if (isResponsive && !isMenuVisible) {
|
|
@@ -134,7 +131,7 @@ var DxcHeader = function DxcHeader(_ref2) {
|
|
|
134
131
|
return function () {
|
|
135
132
|
window.removeEventListener("resize", handleResize);
|
|
136
133
|
};
|
|
137
|
-
}, []);
|
|
134
|
+
}, [handleResize]);
|
|
138
135
|
(0, _react.useEffect)(function () {
|
|
139
136
|
!isResponsive && setIsMenuVisible(false);
|
|
140
137
|
}, [isResponsive]);
|
|
@@ -158,7 +155,8 @@ var DxcHeader = function DxcHeader(_ref2) {
|
|
|
158
155
|
}, /*#__PURE__*/_react["default"].createElement(ResponsiveIconsContainer, null, /*#__PURE__*/_react["default"].createElement(ResponsiveLogoContainer, null, headerResponsiveLogo), /*#__PURE__*/_react["default"].createElement(CloseAction, {
|
|
159
156
|
tabIndex: tabIndex,
|
|
160
157
|
onClick: handleMenu,
|
|
161
|
-
"aria-label": translatedLabels.header.closeIcon
|
|
158
|
+
"aria-label": translatedLabels.header.closeIcon,
|
|
159
|
+
title: translatedLabels.header.closeIcon
|
|
162
160
|
}, closeIcon)), /*#__PURE__*/_react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
|
|
163
161
|
color: colorsTheme.header.menuBackgroundColor
|
|
164
162
|
}, /*#__PURE__*/_react["default"].createElement(Content, {
|
|
@@ -183,7 +181,9 @@ var DxcHeader = function DxcHeader(_ref2) {
|
|
|
183
181
|
|
|
184
182
|
DxcHeader.Dropdown = Dropdown;
|
|
185
183
|
|
|
186
|
-
var HeaderContainer = _styledComponents["default"].header(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
184
|
+
var HeaderContainer = _styledComponents["default"].header(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n min-height: ", ";\n margin-bottom: ", ";\n padding: ", ";\n background-color: ", ";\n border-bottom: ", ";\n"])), function (props) {
|
|
185
|
+
return props.theme.minHeight;
|
|
186
|
+
}, function (props) {
|
|
187
187
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
188
188
|
}, function (props) {
|
|
189
189
|
return "".concat(props.theme.paddingTop, " ").concat(props.theme.paddingRight, " ").concat(props.theme.paddingBottom, " ").concat(props.theme.paddingLeft);
|
|
@@ -191,12 +191,10 @@ var HeaderContainer = _styledComponents["default"].header(_templateObject2 || (_
|
|
|
191
191
|
return props.theme.backgroundColor;
|
|
192
192
|
}, function (props) {
|
|
193
193
|
return props.underlined && "".concat(props.theme.underlinedThickness, " ").concat(props.theme.underlinedStyle, " ").concat(props.theme.underlinedColor);
|
|
194
|
-
}, function (props) {
|
|
195
|
-
return props.theme.minHeight;
|
|
196
194
|
});
|
|
197
195
|
|
|
198
196
|
var LogoAnchor = _styledComponents["default"].a(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n ", ";\n"])), function (props) {
|
|
199
|
-
return props.interactuable ? "cursor: pointer" : "cursor: default; outline:none";
|
|
197
|
+
return props.interactuable ? "cursor: pointer" : "cursor: default; outline:none;";
|
|
200
198
|
});
|
|
201
199
|
|
|
202
200
|
var LogoImg = _styledComponents["default"].img(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n max-height: ", ";\n width: ", ";\n"])), function (props) {
|
|
@@ -211,7 +209,7 @@ var LogoContainer = _styledComponents["default"].div(_templateObject5 || (_templ
|
|
|
211
209
|
return props.theme.logoWidth;
|
|
212
210
|
});
|
|
213
211
|
|
|
214
|
-
var ChildContainer = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
212
|
+
var ChildContainer = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: flex-end;\n flex-grow: 1;\n width: calc(100% - 186px);\n padding: ", ";\n padding-top: ", ";\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n"])), function (props) {
|
|
215
213
|
return props.padding && (0, _typeof2["default"])(props.padding) !== "object" ? _variables.spaces[props.padding] : "0px";
|
|
216
214
|
}, function (props) {
|
|
217
215
|
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.top ? _variables.spaces[props.padding.top] : "";
|
|
@@ -223,9 +221,7 @@ var ChildContainer = _styledComponents["default"].div(_templateObject6 || (_temp
|
|
|
223
221
|
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.left ? _variables.spaces[props.padding.left] : "";
|
|
224
222
|
});
|
|
225
223
|
|
|
226
|
-
var ContentContainer = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
227
|
-
return props.backgroundType === "dark" ? props.theme.contentColorOnDark : props.theme.contentColor;
|
|
228
|
-
}, function (props) {
|
|
224
|
+
var ContentContainer = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n flex-grow: 1;\n justify-content: flex-end;\n width: calc(100% - 186px);\n padding: ", ";\n padding-top: ", ";\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n color: ", ";\n"])), function (props) {
|
|
229
225
|
return props.padding && (0, _typeof2["default"])(props.padding) !== "object" ? _variables.spaces[props.padding] : "0px";
|
|
230
226
|
}, function (props) {
|
|
231
227
|
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.top ? _variables.spaces[props.padding.top] : "";
|
|
@@ -235,6 +231,8 @@ var ContentContainer = _styledComponents["default"].div(_templateObject7 || (_te
|
|
|
235
231
|
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.bottom ? _variables.spaces[props.padding.bottom] : "";
|
|
236
232
|
}, function (props) {
|
|
237
233
|
return props.padding && (0, _typeof2["default"])(props.padding) === "object" && props.padding.left ? _variables.spaces[props.padding.left] : "";
|
|
234
|
+
}, function (props) {
|
|
235
|
+
return props.backgroundType === "dark" ? props.theme.contentColorOnDark : props.theme.contentColor;
|
|
238
236
|
});
|
|
239
237
|
|
|
240
238
|
var HamburguerTrigger = _styledComponents["default"].button(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n width: 54px;\n cursor: pointer;\n border: 1px solid transparent;\n border-radius: 2px;\n background-color: transparent;\n :hover {\n background-color: ", ";\n }\n &:focus {\n outline: ", " auto 1px;\n }\n & > svg {\n fill: ", ";\n }\n font-family: ", ";\n font-style: ", ";\n font-size: ", ";\n text-transform: ", ";\n font-weight: ", ";\n color: ", ";\n"])), function (props) {
|
|
@@ -281,11 +279,11 @@ var ResponsiveLogoContainer = _styledComponents["default"].div(_templateObject11
|
|
|
281
279
|
|
|
282
280
|
var ResponsiveIconsContainer = _styledComponents["default"].div(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n"])));
|
|
283
281
|
|
|
284
|
-
var CloseAction = _styledComponents["default"].button(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
282
|
+
var CloseAction = _styledComponents["default"].button(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: center;\n align-content: center;\n padding: 6px;\n border: unset;\n border-radius: 2px;\n background-color: transparent;\n cursor: pointer;\n\n :focus,\n :focus-visible {\n outline: ", " auto 1px;\n }\n\n svg {\n height: 24px;\n width: 24px;\n }\n"])), function (props) {
|
|
285
283
|
return props.theme.hamburguerFocusColor;
|
|
286
284
|
});
|
|
287
285
|
|
|
288
|
-
var MenuContent = _styledComponents["default"].div(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
286
|
+
var MenuContent = _styledComponents["default"].div(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n height: 100%;\n color: ", ";\n"])), function (props) {
|
|
289
287
|
return props.backgroundType === "dark" ? props.theme.contentColorOnDark : props.theme.contentColor;
|
|
290
288
|
});
|
|
291
289
|
|