@dxc-technology/halstack-react 0.0.0-de7c6b0 → 0.0.0-dec566a
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/BackgroundColorContext.d.ts +1 -10
- package/BackgroundColorContext.js +4 -21
- package/HalstackContext.d.ts +52 -139
- package/HalstackContext.js +11 -36
- package/README.md +47 -0
- package/accordion/Accordion.js +31 -84
- package/accordion/Accordion.stories.tsx +5 -50
- package/accordion/Accordion.test.js +18 -33
- package/accordion/types.d.ts +6 -6
- package/accordion-group/AccordionGroup.d.ts +2 -3
- package/accordion-group/AccordionGroup.js +17 -44
- package/accordion-group/AccordionGroup.stories.tsx +1 -1
- package/accordion-group/AccordionGroup.test.js +42 -60
- package/accordion-group/AccordionGroupAccordion.js +11 -23
- package/accordion-group/AccordionGroupContext.d.ts +3 -0
- package/accordion-group/AccordionGroupContext.js +8 -0
- package/accordion-group/types.d.ts +7 -7
- package/action-icon/ActionIcon.d.ts +4 -0
- package/action-icon/ActionIcon.js +48 -0
- package/action-icon/ActionIcon.stories.tsx +41 -0
- package/action-icon/ActionIcon.test.js +64 -0
- package/action-icon/types.d.ts +26 -0
- package/alert/Alert.js +29 -118
- package/alert/Alert.test.js +28 -45
- package/alert/types.d.ts +5 -5
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +141 -43
- package/badge/Badge.stories.tsx +210 -0
- package/badge/Badge.test.js +30 -0
- package/badge/types.d.ts +52 -3
- package/bleed/Bleed.js +13 -21
- package/bleed/types.d.ts +2 -2
- package/box/Box.js +11 -33
- package/box/Box.test.js +1 -6
- package/box/types.d.ts +3 -3
- package/bulleted-list/BulletedList.js +22 -55
- package/bulleted-list/BulletedList.stories.tsx +2 -93
- package/bulleted-list/types.d.ts +5 -5
- package/button/Button.d.ts +1 -1
- package/button/Button.js +68 -100
- package/button/Button.stories.tsx +33 -132
- package/button/Button.test.js +19 -16
- package/button/types.d.ts +9 -5
- package/card/Card.js +21 -44
- package/card/Card.test.js +10 -21
- package/card/types.d.ts +5 -5
- package/checkbox/Checkbox.js +85 -120
- package/checkbox/Checkbox.stories.tsx +16 -54
- package/checkbox/Checkbox.test.js +107 -63
- package/checkbox/types.d.ts +8 -4
- package/chip/Chip.js +12 -31
- package/chip/Chip.stories.tsx +1 -1
- package/chip/Chip.test.js +15 -28
- package/chip/types.d.ts +4 -4
- package/common/coreTokens.d.ts +105 -14
- package/common/coreTokens.js +41 -24
- package/common/utils.js +2 -8
- package/common/variables.d.ts +52 -139
- package/common/variables.js +63 -157
- package/container/Container.d.ts +4 -0
- package/container/Container.js +194 -0
- package/container/Container.stories.tsx +214 -0
- package/container/types.d.ts +74 -0
- package/contextual-menu/ContextualMenu.d.ts +7 -0
- package/contextual-menu/ContextualMenu.js +71 -0
- package/contextual-menu/ContextualMenu.stories.tsx +182 -0
- package/contextual-menu/ContextualMenu.test.js +71 -0
- package/contextual-menu/MenuItemAction.d.ts +4 -0
- package/contextual-menu/MenuItemAction.js +46 -0
- package/contextual-menu/types.d.ts +22 -0
- package/contextual-menu/types.js +5 -0
- package/date-input/Calendar.js +15 -59
- package/date-input/DateInput.js +50 -96
- package/date-input/DateInput.stories.tsx +11 -30
- package/date-input/DateInput.test.js +674 -701
- package/date-input/DatePicker.js +11 -42
- package/date-input/Icons.d.ts +6 -6
- package/date-input/Icons.js +6 -23
- package/date-input/YearPicker.js +8 -34
- package/date-input/types.d.ts +28 -22
- package/dialog/Dialog.js +13 -40
- package/dialog/Dialog.stories.tsx +170 -0
- package/dialog/Dialog.test.js +125 -187
- package/dialog/types.d.ts +18 -13
- package/divider/Divider.d.ts +4 -0
- package/divider/Divider.js +36 -0
- package/divider/Divider.stories.tsx +223 -0
- package/divider/Divider.test.js +38 -0
- package/divider/types.d.ts +21 -0
- package/divider/types.js +5 -0
- package/dropdown/Dropdown.js +59 -128
- package/dropdown/Dropdown.stories.tsx +5 -16
- package/dropdown/Dropdown.test.js +391 -378
- package/dropdown/DropdownMenu.js +8 -19
- package/dropdown/DropdownMenuItem.js +11 -20
- package/dropdown/types.d.ts +20 -24
- package/file-input/FileInput.js +180 -248
- package/file-input/FileInput.stories.tsx +1 -1
- package/file-input/FileInput.test.js +356 -354
- package/file-input/FileItem.js +14 -41
- package/file-input/types.d.ts +10 -10
- package/flex/Flex.js +25 -39
- package/flex/types.d.ts +6 -6
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +70 -102
- package/footer/Footer.stories.tsx +37 -6
- package/footer/Footer.test.js +21 -33
- package/footer/Icons.d.ts +3 -2
- package/footer/Icons.js +66 -7
- package/footer/types.d.ts +25 -21
- package/grid/Grid.d.ts +1 -1
- package/grid/Grid.js +2 -17
- package/grid/Grid.stories.tsx +38 -38
- package/grid/types.d.ts +10 -10
- package/header/Header.d.ts +1 -1
- package/header/Header.js +28 -84
- package/header/Header.test.js +12 -25
- package/header/Icons.d.ts +2 -2
- package/header/Icons.js +2 -7
- package/header/types.d.ts +7 -8
- package/heading/Heading.js +9 -31
- package/heading/Heading.test.js +70 -87
- package/heading/types.d.ts +7 -7
- package/icon/Icon.d.ts +4 -0
- package/icon/Icon.js +33 -0
- package/icon/Icon.stories.tsx +28 -0
- package/icon/types.d.ts +4 -0
- package/icon/types.js +5 -0
- package/image/Image.d.ts +4 -0
- package/image/Image.js +70 -0
- package/image/Image.stories.tsx +129 -0
- package/image/types.d.ts +72 -0
- package/image/types.js +5 -0
- package/inset/Inset.js +13 -21
- package/inset/types.d.ts +2 -2
- package/layout/ApplicationLayout.d.ts +2 -2
- package/layout/ApplicationLayout.js +29 -66
- package/layout/ApplicationLayout.stories.tsx +1 -1
- package/layout/Icons.d.ts +8 -5
- package/layout/Icons.js +51 -59
- package/layout/types.d.ts +3 -3
- package/link/Link.js +21 -42
- package/link/Link.test.js +23 -41
- package/link/types.d.ts +14 -14
- package/main.d.ts +8 -4
- package/main.js +39 -59
- package/nav-tabs/NavTabs.d.ts +1 -2
- package/nav-tabs/NavTabs.js +19 -48
- package/nav-tabs/NavTabs.stories.tsx +7 -5
- package/nav-tabs/NavTabs.test.js +38 -44
- package/nav-tabs/NavTabsContext.d.ts +3 -0
- package/nav-tabs/NavTabsContext.js +8 -0
- package/nav-tabs/Tab.js +24 -52
- package/nav-tabs/types.d.ts +9 -9
- package/number-input/NumberInput.js +46 -36
- package/number-input/NumberInput.stories.tsx +42 -26
- package/number-input/NumberInput.test.js +859 -412
- package/number-input/NumberInputContext.d.ts +3 -4
- package/number-input/NumberInputContext.js +3 -14
- package/number-input/types.d.ts +17 -5
- package/package.json +30 -28
- package/paginator/Icons.d.ts +5 -5
- package/paginator/Icons.js +5 -19
- package/paginator/Paginator.js +15 -43
- package/paginator/Paginator.test.js +224 -207
- package/paginator/types.d.ts +3 -3
- package/paragraph/Paragraph.js +3 -19
- package/paragraph/Paragraph.stories.tsx +0 -17
- package/password-input/Icons.d.ts +6 -0
- package/password-input/Icons.js +35 -0
- package/password-input/PasswordInput.js +57 -126
- package/password-input/PasswordInput.stories.tsx +1 -33
- package/password-input/PasswordInput.test.js +157 -140
- package/password-input/types.d.ts +8 -7
- package/progress-bar/ProgressBar.js +21 -53
- package/progress-bar/{ProgressBar.stories.jsx → ProgressBar.stories.tsx} +1 -1
- package/progress-bar/ProgressBar.test.js +35 -52
- package/progress-bar/types.d.ts +3 -3
- package/quick-nav/QuickNav.js +4 -27
- package/quick-nav/QuickNav.stories.tsx +1 -1
- package/quick-nav/types.d.ts +10 -10
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +22 -54
- package/radio-group/RadioGroup.js +37 -83
- package/radio-group/RadioGroup.stories.tsx +10 -10
- package/radio-group/RadioGroup.test.js +504 -470
- package/radio-group/types.d.ts +8 -8
- package/resultset-table/Icons.d.ts +7 -0
- package/{resultsetTable → resultset-table}/Icons.js +1 -5
- package/resultset-table/ResultsetTable.d.ts +7 -0
- package/{resultsetTable → resultset-table}/ResultsetTable.js +44 -69
- package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +106 -5
- package/{resultsetTable → resultset-table}/ResultsetTable.test.js +148 -92
- package/{resultsetTable → resultset-table}/types.d.ts +44 -11
- package/resultset-table/types.js +5 -0
- package/select/Icons.d.ts +7 -7
- package/select/Icons.js +1 -5
- package/select/Listbox.js +13 -39
- package/select/Option.js +17 -27
- package/select/Select.js +87 -163
- package/select/Select.stories.tsx +3 -3
- package/select/Select.test.js +1946 -1804
- package/select/types.d.ts +14 -15
- package/sidenav/Icons.d.ts +4 -4
- package/sidenav/Icons.js +1 -5
- package/sidenav/Sidenav.js +29 -70
- package/sidenav/Sidenav.test.js +3 -10
- package/{layout → sidenav}/SidenavContext.d.ts +1 -1
- package/{layout → sidenav}/SidenavContext.js +3 -9
- package/sidenav/types.d.ts +18 -18
- package/slider/Slider.js +68 -125
- package/slider/Slider.test.js +107 -103
- package/slider/types.d.ts +4 -4
- package/spinner/Spinner.js +16 -54
- package/spinner/Spinner.test.js +25 -34
- package/spinner/types.d.ts +3 -3
- package/status-light/StatusLight.d.ts +4 -0
- package/status-light/StatusLight.js +51 -0
- package/status-light/StatusLight.stories.tsx +74 -0
- package/status-light/StatusLight.test.js +25 -0
- package/status-light/types.d.ts +17 -0
- package/status-light/types.js +5 -0
- package/switch/Switch.js +49 -97
- package/switch/Switch.stories.tsx +0 -34
- package/switch/Switch.test.js +51 -96
- package/switch/types.d.ts +4 -4
- package/table/DropdownTheme.js +62 -0
- package/table/Table.d.ts +6 -2
- package/table/Table.js +76 -33
- package/table/{Table.stories.jsx → Table.stories.tsx} +297 -2
- package/table/Table.test.js +93 -6
- package/table/types.d.ts +34 -6
- package/tabs/Tab.js +17 -33
- package/tabs/Tabs.js +52 -129
- package/tabs/Tabs.stories.tsx +1 -1
- package/tabs/Tabs.test.js +62 -118
- package/tabs/types.d.ts +19 -19
- package/tag/Tag.js +21 -51
- package/tag/Tag.test.js +19 -30
- package/tag/types.d.ts +7 -7
- package/text-input/Suggestion.js +9 -26
- package/text-input/Suggestions.d.ts +1 -1
- package/text-input/Suggestions.js +19 -67
- package/text-input/TextInput.js +221 -327
- package/text-input/TextInput.stories.tsx +49 -153
- package/text-input/TextInput.test.js +1227 -1194
- package/text-input/types.d.ts +25 -17
- package/textarea/Textarea.js +67 -109
- package/textarea/{Textarea.stories.jsx → Textarea.stories.tsx} +58 -100
- package/textarea/Textarea.test.js +150 -179
- package/textarea/types.d.ts +9 -5
- package/toggle-group/ToggleGroup.js +90 -107
- package/toggle-group/ToggleGroup.stories.tsx +7 -4
- package/toggle-group/ToggleGroup.test.js +68 -87
- package/toggle-group/types.d.ts +26 -17
- package/typography/Typography.js +4 -13
- package/typography/types.d.ts +1 -1
- package/useTheme.d.ts +49 -136
- package/useTheme.js +1 -8
- package/useTranslatedLabels.js +1 -7
- package/utils/BaseTypography.d.ts +2 -2
- package/utils/BaseTypography.js +16 -30
- package/utils/FocusLock.js +25 -39
- package/wizard/Wizard.js +14 -49
- package/wizard/Wizard.test.js +53 -80
- package/wizard/types.d.ts +7 -7
- package/common/OpenSans.css +0 -69
- package/common/fonts/OpenSans-Bold.ttf +0 -0
- package/common/fonts/OpenSans-BoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBold.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-Italic.ttf +0 -0
- package/common/fonts/OpenSans-Light.ttf +0 -0
- package/common/fonts/OpenSans-LightItalic.ttf +0 -0
- package/common/fonts/OpenSans-Regular.ttf +0 -0
- package/common/fonts/OpenSans-SemiBold.ttf +0 -0
- package/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
- package/number-input/numberInputContextTypes.d.ts +0 -19
- package/resultsetTable/Icons.d.ts +0 -7
- package/resultsetTable/ResultsetTable.d.ts +0 -4
- package/slider/Slider.stories.tsx +0 -240
- package/text-input/Icons.d.ts +0 -8
- package/text-input/Icons.js +0 -60
- /package/{resultsetTable → action-icon}/types.js +0 -0
- /package/{number-input/numberInputContextTypes.js → container/types.js} +0 -0
- /package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +0 -0
package/grid/types.d.ts
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type Spaces = "0rem" | "0.125rem" | "0.25rem" | "0.5rem" | "1rem" | "1.5rem" | "2rem" | "3rem" | "4rem" | "5rem";
|
|
3
|
+
type Gap = {
|
|
4
4
|
rowGap: Spaces;
|
|
5
5
|
columnGap?: Spaces;
|
|
6
6
|
} | {
|
|
7
7
|
rowGap?: Spaces;
|
|
8
8
|
columnGap: Spaces;
|
|
9
9
|
} | Spaces;
|
|
10
|
-
|
|
10
|
+
type GridCell = {
|
|
11
11
|
start: number | string;
|
|
12
12
|
end: number | string;
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
type PlaceSelfValues = "auto" | "start" | "end" | "center" | "stretch" | "baseline";
|
|
15
|
+
type PlaceContentValues = "normal" | "start" | "end" | "center" | "stretch" | "space-between" | "space-around" | "space-evenly" | "baseline";
|
|
16
|
+
type PlaceItemsValues = "normal" | "start" | "end" | "center" | "stretch" | "baseline";
|
|
17
|
+
type PlaceObject<Type, Suffix extends string> = {
|
|
18
18
|
[Property in keyof Type as `${string & Property}${Capitalize<string & Suffix>}`]: Type[Property];
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
type PlaceGeneric<PlaceValues, Element extends string> = PlaceObject<{
|
|
21
21
|
justify?: PlaceValues;
|
|
22
22
|
align: PlaceValues;
|
|
23
23
|
}, Element> | PlaceObject<{
|
|
24
24
|
justify: PlaceValues;
|
|
25
25
|
align?: PlaceValues;
|
|
26
26
|
}, Element> | PlaceValues;
|
|
27
|
-
export
|
|
27
|
+
export type GridItemProps = {
|
|
28
28
|
/**
|
|
29
29
|
* Sets the name of an item so that it can be referenced by a template created with the grid-template-areas property.
|
|
30
30
|
*/
|
|
@@ -56,7 +56,7 @@ export declare type GridItemProps = {
|
|
|
56
56
|
*/
|
|
57
57
|
children: React.ReactNode;
|
|
58
58
|
};
|
|
59
|
-
|
|
59
|
+
type Props = GridItemProps & {
|
|
60
60
|
/**
|
|
61
61
|
* Sets the grid-auto-columns CSS property.
|
|
62
62
|
*
|
package/header/Header.d.ts
CHANGED
|
@@ -3,6 +3,6 @@ import DxcDropdown from "../dropdown/Dropdown";
|
|
|
3
3
|
import HeaderPropsType from "./types";
|
|
4
4
|
declare const DxcHeader: {
|
|
5
5
|
({ underlined, content, responsiveContent, onClick, margin, tabIndex, }: HeaderPropsType): JSX.Element;
|
|
6
|
-
Dropdown: (props: React.ComponentProps<typeof DxcDropdown>) => JSX.Element;
|
|
6
|
+
Dropdown: (props: React.ComponentProps<typeof DxcDropdown>) => React.JSX.Element;
|
|
7
7
|
};
|
|
8
8
|
export default DxcHeader;
|
package/header/Header.js
CHANGED
|
@@ -1,42 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports["default"] = void 0;
|
|
11
|
-
|
|
12
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
|
-
|
|
14
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
-
|
|
16
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
17
|
-
|
|
18
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
-
|
|
20
12
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
21
|
-
|
|
22
13
|
var _Dropdown = _interopRequireDefault(require("../dropdown/Dropdown"));
|
|
23
|
-
|
|
24
14
|
var _Icons = require("./Icons");
|
|
25
|
-
|
|
26
15
|
var _variables = require("../common/variables");
|
|
27
|
-
|
|
28
16
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
29
|
-
|
|
30
17
|
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
31
|
-
|
|
32
|
-
var _BackgroundColorContext = _interopRequireWildcard(require("../BackgroundColorContext"));
|
|
33
|
-
|
|
34
18
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15;
|
|
35
|
-
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(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; }
|
|
39
|
-
|
|
19
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
20
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
40
21
|
var closeIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
41
22
|
xmlns: "http://www.w3.org/2000/svg",
|
|
42
23
|
viewBox: "0 0 24 24",
|
|
@@ -45,7 +26,6 @@ var closeIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
|
45
26
|
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
46
27
|
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"
|
|
47
28
|
}));
|
|
48
|
-
|
|
49
29
|
var hamburgerIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
50
30
|
xmlns: "http://www.w3.org/2000/svg",
|
|
51
31
|
viewBox: "0 0 24 24",
|
|
@@ -54,60 +34,46 @@ var hamburgerIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
|
54
34
|
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
55
35
|
d: "M3,8H21a1,1,0,0,0,0-2H3A1,1,0,0,0,3,8Zm18,8H3a1,1,0,0,0,0,2H21a1,1,0,0,0,0-2Zm0-5H3a1,1,0,0,0,0,2H21a1,1,0,0,0,0-2Z"
|
|
56
36
|
}));
|
|
57
|
-
|
|
58
37
|
var Dropdown = function Dropdown(props) {
|
|
59
38
|
return /*#__PURE__*/_react["default"].createElement(HeaderDropdown, null, /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], props));
|
|
60
39
|
};
|
|
61
|
-
|
|
62
40
|
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"])));
|
|
63
|
-
|
|
64
41
|
var getLogoElement = function getLogoElement(themeInput, logoLabel) {
|
|
65
42
|
if (!themeInput) return _Icons.dxcLogo;else if (typeof themeInput === "string") return /*#__PURE__*/_react["default"].createElement(LogoImg, {
|
|
66
43
|
alt: logoLabel,
|
|
67
44
|
src: themeInput
|
|
68
45
|
});else return themeInput;
|
|
69
46
|
};
|
|
70
|
-
|
|
71
47
|
var Content = function Content(_ref) {
|
|
72
48
|
var isResponsive = _ref.isResponsive,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return isResponsive ? /*#__PURE__*/_react["default"].createElement(MenuContent, {
|
|
78
|
-
backgroundType: backgroundType
|
|
79
|
-
}, responsiveContent(handleMenu)) : /*#__PURE__*/_react["default"].createElement(ContentContainer, {
|
|
80
|
-
backgroundType: backgroundType
|
|
81
|
-
}, content);
|
|
49
|
+
responsiveContent = _ref.responsiveContent,
|
|
50
|
+
handleMenu = _ref.handleMenu,
|
|
51
|
+
content = _ref.content;
|
|
52
|
+
return isResponsive ? /*#__PURE__*/_react["default"].createElement(MenuContent, null, responsiveContent(handleMenu)) : /*#__PURE__*/_react["default"].createElement(ContentContainer, null, content);
|
|
82
53
|
};
|
|
83
|
-
|
|
84
54
|
var DxcHeader = function DxcHeader(_ref2) {
|
|
85
55
|
var _ref2$underlined = _ref2.underlined,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
56
|
+
underlined = _ref2$underlined === void 0 ? false : _ref2$underlined,
|
|
57
|
+
content = _ref2.content,
|
|
58
|
+
responsiveContent = _ref2.responsiveContent,
|
|
59
|
+
onClick = _ref2.onClick,
|
|
60
|
+
margin = _ref2.margin,
|
|
61
|
+
_ref2$tabIndex = _ref2.tabIndex,
|
|
62
|
+
tabIndex = _ref2$tabIndex === void 0 ? 0 : _ref2$tabIndex;
|
|
93
63
|
var colorsTheme = (0, _useTheme["default"])();
|
|
94
64
|
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
95
65
|
var ref = (0, _react.useRef)(null);
|
|
96
|
-
|
|
97
66
|
var _useState = (0, _react.useState)(false),
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
67
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
68
|
+
isResponsive = _useState2[0],
|
|
69
|
+
setIsResponsive = _useState2[1];
|
|
102
70
|
var _useState3 = (0, _react.useState)(false),
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
71
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
72
|
+
isMenuVisible = _useState4[0],
|
|
73
|
+
setIsMenuVisible = _useState4[1];
|
|
107
74
|
var handleResize = (0, _react.useCallback)(function () {
|
|
108
75
|
setIsResponsive(window.matchMedia("(max-width: ".concat(_variables.responsiveSizes.medium, "rem)")).matches);
|
|
109
76
|
}, []);
|
|
110
|
-
|
|
111
77
|
var handleMenu = function handleMenu() {
|
|
112
78
|
if (isResponsive && !isMenuVisible) {
|
|
113
79
|
setIsMenuVisible(!isMenuVisible);
|
|
@@ -115,7 +81,6 @@ var DxcHeader = function DxcHeader(_ref2) {
|
|
|
115
81
|
setIsMenuVisible(!isMenuVisible);
|
|
116
82
|
}
|
|
117
83
|
};
|
|
118
|
-
|
|
119
84
|
var headerLogo = (0, _react.useMemo)(function () {
|
|
120
85
|
return getLogoElement(colorsTheme.header.logo, translatedLabels.formFields.logoAlternativeText);
|
|
121
86
|
}, [colorsTheme.header.logo]);
|
|
@@ -152,32 +117,26 @@ var DxcHeader = function DxcHeader(_ref2) {
|
|
|
152
117
|
onClick: handleMenu,
|
|
153
118
|
"aria-label": translatedLabels.header.closeIcon,
|
|
154
119
|
title: translatedLabels.header.closeIcon
|
|
155
|
-
}, closeIcon)), /*#__PURE__*/_react["default"].createElement(
|
|
156
|
-
color: colorsTheme.header.menuBackgroundColor
|
|
157
|
-
}, /*#__PURE__*/_react["default"].createElement(Content, {
|
|
120
|
+
}, closeIcon)), /*#__PURE__*/_react["default"].createElement(Content, {
|
|
158
121
|
isResponsive: isResponsive,
|
|
159
122
|
responsiveContent: responsiveContent,
|
|
160
123
|
handleMenu: handleMenu,
|
|
161
124
|
content: content
|
|
162
|
-
}))
|
|
125
|
+
})), /*#__PURE__*/_react["default"].createElement(Overlay, {
|
|
163
126
|
onClick: handleMenu,
|
|
164
127
|
hasVisibility: isMenuVisible
|
|
165
|
-
})), !isResponsive && /*#__PURE__*/_react["default"].createElement(
|
|
166
|
-
color: colorsTheme.header.backgroundColor
|
|
167
|
-
}, /*#__PURE__*/_react["default"].createElement(Content, {
|
|
128
|
+
})), !isResponsive && /*#__PURE__*/_react["default"].createElement(Content, {
|
|
168
129
|
isResponsive: isResponsive,
|
|
169
130
|
responsiveContent: responsiveContent,
|
|
170
131
|
handleMenu: handleMenu,
|
|
171
132
|
content: content
|
|
172
|
-
})))
|
|
133
|
+
})));
|
|
173
134
|
};
|
|
174
|
-
|
|
175
135
|
DxcHeader.Dropdown = Dropdown;
|
|
176
|
-
|
|
177
136
|
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) {
|
|
178
137
|
return props.theme.minHeight;
|
|
179
138
|
}, function (props) {
|
|
180
|
-
return props.margin
|
|
139
|
+
return props.margin ? _variables.spaces[props.margin] : "0px";
|
|
181
140
|
}, function (props) {
|
|
182
141
|
return "".concat(props.theme.paddingTop, " ").concat(props.theme.paddingRight, " ").concat(props.theme.paddingBottom, " ").concat(props.theme.paddingLeft);
|
|
183
142
|
}, function (props) {
|
|
@@ -185,29 +144,23 @@ var HeaderContainer = _styledComponents["default"].header(_templateObject2 || (_
|
|
|
185
144
|
}, function (props) {
|
|
186
145
|
return props.underlined && "".concat(props.theme.underlinedThickness, " ").concat(props.theme.underlinedStyle, " ").concat(props.theme.underlinedColor);
|
|
187
146
|
});
|
|
188
|
-
|
|
189
147
|
var LogoAnchor = _styledComponents["default"].a(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n ", ";\n"])), function (props) {
|
|
190
148
|
return props.interactuable ? "cursor: pointer" : "cursor: default; outline:none;";
|
|
191
149
|
});
|
|
192
|
-
|
|
193
150
|
var LogoImg = _styledComponents["default"].img(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n max-height: ", ";\n width: ", ";\n"])), function (props) {
|
|
194
151
|
return props.theme.logoHeight;
|
|
195
152
|
}, function (props) {
|
|
196
153
|
return props.theme.logoWidth;
|
|
197
154
|
});
|
|
198
|
-
|
|
199
155
|
var LogoContainer = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n max-height: ", ";\n width: ", ";\n vertical-align: middle;\n"])), function (props) {
|
|
200
156
|
return props.theme.logoHeight;
|
|
201
157
|
}, function (props) {
|
|
202
158
|
return props.theme.logoWidth;
|
|
203
159
|
});
|
|
204
|
-
|
|
205
160
|
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"])));
|
|
206
|
-
|
|
207
161
|
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 color: ", ";\n"])), function (props) {
|
|
208
|
-
return props.
|
|
162
|
+
return props.theme.contentColor;
|
|
209
163
|
});
|
|
210
|
-
|
|
211
164
|
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) {
|
|
212
165
|
return props.theme.hamburguerHoverColor;
|
|
213
166
|
}, function (props) {
|
|
@@ -227,9 +180,7 @@ var HamburguerTrigger = _styledComponents["default"].button(_templateObject8 ||
|
|
|
227
180
|
}, function (props) {
|
|
228
181
|
return props.theme.hamburguerFontColor;
|
|
229
182
|
});
|
|
230
|
-
|
|
231
183
|
var MainContainer = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-grow: 1;\n"])));
|
|
232
|
-
|
|
233
184
|
var ResponsiveMenu = _styledComponents["default"].div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n background-color: ", ";\n position: fixed;\n top: 0;\n right: 0;\n z-index: ", ";\n\n @media (max-width: ", "rem) and (min-width: ", "rem) {\n width: ", ";\n }\n\n @media (not((max-width: ", "rem) and (min-width: ", "rem))) {\n width: ", ";\n }\n\n height: 100vh;\n padding: 20px;\n transform: ", ";\n opacity: ", ";\n transition-property: transform, opacity;\n transition-duration: 0.6s;\n transition-timing-function: ease-in-out;\n box-sizing: border-box;\n"])), function (props) {
|
|
234
185
|
return props.theme.menuBackgroundColor;
|
|
235
186
|
}, function (props) {
|
|
@@ -243,23 +194,18 @@ var ResponsiveMenu = _styledComponents["default"].div(_templateObject10 || (_tem
|
|
|
243
194
|
}, function (props) {
|
|
244
195
|
return props.hasVisibility ? "1" : "0.96";
|
|
245
196
|
});
|
|
246
|
-
|
|
247
197
|
var ResponsiveLogoContainer = _styledComponents["default"].div(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["\n max-height: ", ";\n width: ", ";\n display: flex;\n"])), function (props) {
|
|
248
198
|
return props.theme.logoHeight;
|
|
249
199
|
}, function (props) {
|
|
250
200
|
return props.theme.logoWidth;
|
|
251
201
|
});
|
|
252
|
-
|
|
253
202
|
var ResponsiveIconsContainer = _styledComponents["default"].div(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n"])));
|
|
254
|
-
|
|
255
203
|
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) {
|
|
256
204
|
return props.theme.hamburguerFocusColor;
|
|
257
205
|
});
|
|
258
|
-
|
|
259
206
|
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) {
|
|
260
|
-
return props.
|
|
207
|
+
return props.theme.contentColor;
|
|
261
208
|
});
|
|
262
|
-
|
|
263
209
|
var Overlay = _styledComponents["default"].div(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2["default"])(["\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background-color: ", ";\n opacity: ", " !important;\n visibility: ", ";\n opacity: ", ";\n\n @media (max-width: ", "rem) {\n display: none;\n }\n\n transition: opacity 0.2s 0.2s ease-in-out;\n z-index: ", ";\n"])), function (props) {
|
|
264
210
|
return props.theme.overlayColor;
|
|
265
211
|
}, function (props) {
|
|
@@ -271,6 +217,4 @@ var Overlay = _styledComponents["default"].div(_templateObject15 || (_templateOb
|
|
|
271
217
|
}, _variables.responsiveSizes.small, function (props) {
|
|
272
218
|
return props.theme.overlayZindex;
|
|
273
219
|
});
|
|
274
|
-
|
|
275
|
-
var _default = DxcHeader;
|
|
276
|
-
exports["default"] = _default;
|
|
220
|
+
var _default = exports["default"] = DxcHeader;
|
package/header/Header.test.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _react = _interopRequireDefault(require("react"));
|
|
6
|
-
|
|
7
5
|
var _react2 = require("@testing-library/react");
|
|
8
|
-
|
|
9
6
|
var _Header = _interopRequireDefault(require("./Header.tsx"));
|
|
10
|
-
|
|
11
7
|
describe("Header component tests", function () {
|
|
12
8
|
beforeAll(function () {
|
|
13
9
|
Object.defineProperty(window, "matchMedia", {
|
|
@@ -21,22 +17,17 @@ describe("Header component tests", function () {
|
|
|
21
17
|
});
|
|
22
18
|
test("Header renders with default logo", function () {
|
|
23
19
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Header["default"], null)),
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
getByTitle = _render.getByTitle;
|
|
26
21
|
expect(getByTitle("DXC Logo")).toBeTruthy();
|
|
27
22
|
});
|
|
28
23
|
test("Call correct function on logo click", function () {
|
|
29
24
|
var onClick = jest.fn();
|
|
30
|
-
|
|
31
25
|
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Header["default"], {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
onClick: onClick
|
|
27
|
+
})),
|
|
28
|
+
getByTitle = _render2.getByTitle;
|
|
36
29
|
var logo = getByTitle("DXC Logo");
|
|
37
|
-
|
|
38
30
|
_react2.fireEvent.click(logo);
|
|
39
|
-
|
|
40
31
|
expect(onClick).toHaveBeenCalled();
|
|
41
32
|
});
|
|
42
33
|
test("Header renders with correct children", function () {
|
|
@@ -45,12 +36,10 @@ describe("Header component tests", function () {
|
|
|
45
36
|
configurable: true,
|
|
46
37
|
value: 1024
|
|
47
38
|
});
|
|
48
|
-
|
|
49
39
|
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Header["default"], {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
40
|
+
content: /*#__PURE__*/_react["default"].createElement("p", null, "header-child-text")
|
|
41
|
+
})),
|
|
42
|
+
getByText = _render3.getByText;
|
|
54
43
|
expect(getByText("header-child-text")).toBeTruthy();
|
|
55
44
|
});
|
|
56
45
|
test("Header renders menu button in mobile", function () {
|
|
@@ -66,14 +55,12 @@ describe("Header component tests", function () {
|
|
|
66
55
|
};
|
|
67
56
|
})
|
|
68
57
|
});
|
|
69
|
-
|
|
70
58
|
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Header["default"], {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
59
|
+
responsiveContent: function responsiveContent() {
|
|
60
|
+
return /*#__PURE__*/_react["default"].createElement("p", null, "header-child-text");
|
|
61
|
+
}
|
|
62
|
+
})),
|
|
63
|
+
getByText = _render4.getByText;
|
|
77
64
|
expect(getByText("Menu")).toBeTruthy();
|
|
78
65
|
});
|
|
79
66
|
});
|
package/header/Icons.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const dxcLogo: JSX.Element;
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare const dxcLogo: React.JSX.Element;
|
package/header/Icons.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.dxcLogo = void 0;
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
|
-
var dxcLogo = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
9
|
+
var dxcLogo = exports.dxcLogo = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
13
10
|
xmlns: "http://www.w3.org/2000/svg",
|
|
14
11
|
width: "73",
|
|
15
12
|
height: "40",
|
|
@@ -29,6 +26,4 @@ var dxcLogo = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
|
29
26
|
d: "M75.836-76.712a8.975,8.975,0,0,1,2.246-3.9,8.393,8.393,0,0,1,6.058-2.457h9.824v-5.67H84.139a14.611,14.611,0,0,0-10.232,4.221,14.509,14.509,0,0,0-3.076,4.536,11.913,11.913,0,0,0-.973,3.271Zm0,4.325a8.978,8.978,0,0,0,2.246,3.9,8.394,8.394,0,0,0,6.058,2.457h9.824v5.67H84.139A14.611,14.611,0,0,1,73.907-64.58a14.506,14.506,0,0,1-3.076-4.536,11.91,11.91,0,0,1-.973-3.271ZM57.522-69.832l-7.5,9.473H42.581L53.818-74.55,42.581-88.739H50.02l7.5,9.472,7.5-9.472h7.439L61.225-74.55l11.237,14.19H65.023Zm-12.336-6.88a11.935,11.935,0,0,0-.973-3.271,14.515,14.515,0,0,0-3.076-4.536A14.612,14.612,0,0,0,30.9-88.739H21.081v5.67H30.9a8.394,8.394,0,0,1,6.058,2.457,8.978,8.978,0,0,1,2.246,3.9Zm0,4.325a11.932,11.932,0,0,1-.973,3.271,14.511,14.511,0,0,1-3.076,4.536A14.611,14.611,0,0,1,30.9-60.359H21.081v-5.67H30.9a8.4,8.4,0,0,0,6.058-2.457,8.981,8.981,0,0,0,2.246-3.9h5.978",
|
|
30
27
|
transform: "translate(-21.049 88.739)",
|
|
31
28
|
fill: "#603494"
|
|
32
|
-
}))));
|
|
33
|
-
|
|
34
|
-
exports.dxcLogo = dxcLogo;
|
|
29
|
+
}))));
|
package/header/types.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
type Props = {
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Whether a contrast line should appear at the bottom of the header.
|
|
6
6
|
*/
|
|
7
7
|
underlined?: boolean;
|
|
8
8
|
/**
|
|
9
|
-
* Content
|
|
9
|
+
* Content shown in the header. Take into account that the component applies styles
|
|
10
10
|
* for the first child in the content, so we recommend the use of React.Fragment
|
|
11
11
|
* to be applied correctly. Otherwise, the styles can be modified.
|
|
12
12
|
*/
|
|
13
13
|
content?: React.ReactNode;
|
|
14
14
|
/**
|
|
15
|
-
* Content
|
|
15
|
+
* Content shown in responsive version. It receives the close menu handler that can
|
|
16
16
|
* be used to add that functionality when a element is clicked.
|
|
17
17
|
*/
|
|
18
18
|
responsiveContent?: (closeHandler: () => void) => React.ReactNode;
|
|
@@ -21,12 +21,11 @@ declare type Props = {
|
|
|
21
21
|
*/
|
|
22
22
|
onClick?: () => void;
|
|
23
23
|
/**
|
|
24
|
-
* Size of the bottom margin to be applied to the header
|
|
25
|
-
* ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
24
|
+
* Size of the bottom margin to be applied to the header.
|
|
26
25
|
*/
|
|
27
26
|
margin?: Space;
|
|
28
27
|
/**
|
|
29
|
-
* Value of the tabindex for all
|
|
28
|
+
* Value of the tabindex for all interactive elements, except those inside the
|
|
30
29
|
* custom area.
|
|
31
30
|
*/
|
|
32
31
|
tabIndex?: number;
|
package/heading/Heading.js
CHANGED
|
@@ -1,46 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports["default"] = void 0;
|
|
11
|
-
|
|
12
9
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
|
-
|
|
14
10
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
|
-
|
|
16
11
|
var _react = _interopRequireDefault(require("react"));
|
|
17
|
-
|
|
18
12
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
|
-
|
|
20
13
|
var _variables = require("../common/variables");
|
|
21
|
-
|
|
22
14
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
23
|
-
|
|
24
15
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(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; }
|
|
29
|
-
|
|
16
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
30
18
|
var DxcHeading = function DxcHeading(_ref) {
|
|
31
19
|
var _ref$level = _ref.level,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
20
|
+
level = _ref$level === void 0 ? 1 : _ref$level,
|
|
21
|
+
_ref$text = _ref.text,
|
|
22
|
+
text = _ref$text === void 0 ? "" : _ref$text,
|
|
23
|
+
as = _ref.as,
|
|
24
|
+
weight = _ref.weight,
|
|
25
|
+
margin = _ref.margin;
|
|
38
26
|
var colorsTheme = (0, _useTheme["default"])();
|
|
39
|
-
|
|
40
27
|
var checkValidAs = function checkValidAs() {
|
|
41
28
|
if (as === "h1" || as === "h2" || as === "h3" || as === "h4" || as === "h5") return as;
|
|
42
29
|
};
|
|
43
|
-
|
|
44
30
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
45
31
|
theme: colorsTheme.heading
|
|
46
32
|
}, /*#__PURE__*/_react["default"].createElement(HeadingContainer, {
|
|
@@ -62,7 +48,6 @@ var DxcHeading = function DxcHeading(_ref) {
|
|
|
62
48
|
weight: weight
|
|
63
49
|
}, text)));
|
|
64
50
|
};
|
|
65
|
-
|
|
66
51
|
var HeadingContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
67
52
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
68
53
|
}, function (props) {
|
|
@@ -74,7 +59,6 @@ var HeadingContainer = _styledComponents["default"].div(_templateObject || (_tem
|
|
|
74
59
|
}, function (props) {
|
|
75
60
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
76
61
|
});
|
|
77
|
-
|
|
78
62
|
var HeadingLevel1 = _styledComponents["default"].h1(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-style: ", ";\n font-size: ", ";\n line-height: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n color: ", ";\n margin: 0;\n"])), function (props) {
|
|
79
63
|
return props.theme.level1FontFamily;
|
|
80
64
|
}, function (props) {
|
|
@@ -90,7 +74,6 @@ var HeadingLevel1 = _styledComponents["default"].h1(_templateObject2 || (_templa
|
|
|
90
74
|
}, function (props) {
|
|
91
75
|
return props.theme.level1FontColor;
|
|
92
76
|
});
|
|
93
|
-
|
|
94
77
|
var HeadingLevel2 = _styledComponents["default"].h2(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-style: ", ";\n font-size: ", ";\n line-height: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n color: ", ";\n margin: 0;\n"])), function (props) {
|
|
95
78
|
return props.theme.level2FontFamily;
|
|
96
79
|
}, function (props) {
|
|
@@ -106,7 +89,6 @@ var HeadingLevel2 = _styledComponents["default"].h2(_templateObject3 || (_templa
|
|
|
106
89
|
}, function (props) {
|
|
107
90
|
return props.theme.level2FontColor;
|
|
108
91
|
});
|
|
109
|
-
|
|
110
92
|
var HeadingLevel3 = _styledComponents["default"].h3(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-style: ", ";\n font-size: ", ";\n line-height: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n color: ", ";\n margin: 0;\n"])), function (props) {
|
|
111
93
|
return props.theme.level3FontFamily;
|
|
112
94
|
}, function (props) {
|
|
@@ -122,7 +104,6 @@ var HeadingLevel3 = _styledComponents["default"].h3(_templateObject4 || (_templa
|
|
|
122
104
|
}, function (props) {
|
|
123
105
|
return props.theme.level3FontColor;
|
|
124
106
|
});
|
|
125
|
-
|
|
126
107
|
var HeadingLevel4 = _styledComponents["default"].h4(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-style: ", ";\n font-size: ", ";\n line-height: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n color: ", ";\n margin: 0;\n"])), function (props) {
|
|
127
108
|
return props.theme.level4FontFamily;
|
|
128
109
|
}, function (props) {
|
|
@@ -138,7 +119,6 @@ var HeadingLevel4 = _styledComponents["default"].h4(_templateObject5 || (_templa
|
|
|
138
119
|
}, function (props) {
|
|
139
120
|
return props.theme.level4FontColor;
|
|
140
121
|
});
|
|
141
|
-
|
|
142
122
|
var HeadingLevel5 = _styledComponents["default"].h5(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-style: ", ";\n font-size: ", ";\n line-height: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n color: ", ";\n margin: 0;\n"])), function (props) {
|
|
143
123
|
return props.theme.level5FontFamily;
|
|
144
124
|
}, function (props) {
|
|
@@ -154,6 +134,4 @@ var HeadingLevel5 = _styledComponents["default"].h5(_templateObject6 || (_templa
|
|
|
154
134
|
}, function (props) {
|
|
155
135
|
return props.theme.level5FontColor;
|
|
156
136
|
});
|
|
157
|
-
|
|
158
|
-
var _default = DxcHeading;
|
|
159
|
-
exports["default"] = _default;
|
|
137
|
+
var _default = exports["default"] = DxcHeading;
|