@dxc-technology/halstack-react 0.0.0-9bd9511 → 0.0.0-9c20370
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 +3 -3
- package/BackgroundColorContext.js +12 -2
- package/HalstackContext.d.ts +1330 -7
- package/HalstackContext.js +84 -67
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +74 -55
- package/accordion/Accordion.stories.tsx +3 -101
- package/accordion/Accordion.test.js +34 -19
- package/accordion/types.d.ts +4 -16
- package/accordion-group/AccordionGroup.d.ts +4 -3
- package/accordion-group/AccordionGroup.js +49 -42
- package/accordion-group/AccordionGroup.stories.tsx +77 -76
- package/accordion-group/AccordionGroup.test.js +62 -54
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +43 -0
- package/accordion-group/types.d.ts +6 -18
- package/alert/Alert.js +47 -20
- package/alert/Alert.test.js +46 -29
- package/alert/types.d.ts +3 -3
- package/badge/Badge.js +14 -2
- package/badge/types.d.ts +1 -1
- package/bleed/Bleed.js +21 -13
- package/bleed/Bleed.stories.tsx +1 -0
- package/bleed/types.d.ts +2 -2
- package/box/Box.d.ts +1 -1
- package/box/Box.js +33 -33
- package/box/Box.stories.tsx +25 -53
- package/box/Box.test.js +7 -2
- package/box/types.d.ts +3 -15
- package/bulleted-list/BulletedList.js +36 -9
- package/bulleted-list/BulletedList.stories.tsx +7 -1
- package/bulleted-list/types.d.ts +32 -5
- package/button/Button.d.ts +1 -1
- package/button/Button.js +83 -71
- package/button/Button.stories.tsx +4 -4
- package/button/Button.test.js +28 -8
- package/button/types.d.ts +8 -4
- package/card/Card.d.ts +1 -1
- package/card/Card.js +67 -62
- package/card/Card.stories.tsx +12 -42
- package/card/Card.test.js +22 -11
- package/card/types.d.ts +4 -10
- package/checkbox/Checkbox.js +71 -27
- package/checkbox/Checkbox.test.js +60 -33
- package/checkbox/types.d.ts +4 -4
- package/chip/Chip.js +51 -48
- package/chip/Chip.stories.tsx +25 -17
- package/chip/Chip.test.js +29 -17
- package/chip/types.d.ts +4 -4
- package/common/OpenSans.css +68 -80
- package/common/coreTokens.d.ts +146 -0
- package/common/coreTokens.js +167 -0
- package/common/utils.d.ts +1 -0
- package/common/utils.js +8 -3
- package/common/variables.d.ts +226 -175
- package/common/variables.js +956 -1133
- package/date-input/Calendar.js +55 -12
- package/date-input/DateInput.js +82 -35
- package/date-input/DateInput.test.js +351 -164
- package/date-input/DatePicker.js +38 -8
- package/date-input/Icons.js +12 -0
- package/date-input/YearPicker.js +30 -5
- package/date-input/types.d.ts +7 -7
- package/dialog/Dialog.d.ts +1 -1
- package/dialog/Dialog.js +83 -86
- package/dialog/Dialog.stories.tsx +127 -221
- package/dialog/Dialog.test.js +331 -18
- package/dialog/types.d.ts +1 -14
- package/dropdown/Dropdown.js +86 -32
- package/dropdown/Dropdown.test.js +211 -104
- package/dropdown/DropdownMenu.js +22 -8
- package/dropdown/DropdownMenuItem.js +15 -6
- package/dropdown/types.d.ts +8 -8
- package/file-input/FileInput.js +218 -134
- package/file-input/FileInput.test.js +343 -331
- package/file-input/FileItem.js +39 -12
- package/file-input/types.d.ts +10 -10
- package/flex/Flex.js +39 -25
- package/flex/Flex.stories.tsx +35 -26
- package/flex/types.d.ts +74 -9
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +80 -68
- package/footer/Footer.stories.tsx +12 -89
- package/footer/Footer.test.js +47 -40
- package/footer/Icons.js +4 -0
- package/footer/types.d.ts +15 -17
- package/grid/Grid.d.ts +7 -0
- package/grid/Grid.js +91 -0
- package/grid/Grid.stories.tsx +219 -0
- package/grid/types.d.ts +115 -0
- package/header/Header.d.ts +4 -3
- package/header/Header.js +72 -55
- package/header/Header.stories.tsx +7 -71
- package/header/Header.test.js +26 -13
- package/header/Icons.js +4 -0
- package/header/types.d.ts +2 -16
- package/heading/Heading.js +28 -7
- package/heading/Heading.test.js +88 -71
- package/heading/types.d.ts +3 -3
- package/inset/Inset.js +21 -13
- package/inset/Inset.stories.tsx +2 -1
- package/inset/types.d.ts +2 -2
- package/layout/ApplicationLayout.d.ts +5 -5
- package/layout/ApplicationLayout.js +57 -15
- package/layout/Icons.js +10 -0
- package/layout/SidenavContext.d.ts +1 -1
- package/layout/SidenavContext.js +4 -0
- package/layout/types.d.ts +5 -6
- package/link/Link.js +41 -21
- package/link/Link.test.js +42 -26
- package/link/types.d.ts +4 -4
- package/main.d.ts +2 -1
- package/main.js +55 -0
- package/nav-tabs/NavTabs.d.ts +2 -2
- package/nav-tabs/NavTabs.js +43 -16
- package/nav-tabs/NavTabs.stories.tsx +14 -0
- package/nav-tabs/NavTabs.test.js +44 -37
- package/nav-tabs/Tab.js +71 -45
- package/nav-tabs/types.d.ts +10 -11
- package/number-input/NumberInput.js +30 -20
- package/number-input/NumberInput.test.js +249 -113
- package/number-input/NumberInputContext.js +5 -0
- package/number-input/numberInputContextTypes.d.ts +1 -1
- package/number-input/types.d.ts +4 -4
- package/package.json +7 -7
- package/paginator/Icons.js +10 -0
- package/paginator/Paginator.js +39 -17
- package/paginator/Paginator.test.js +156 -104
- package/paginator/types.d.ts +1 -1
- package/paragraph/Paragraph.d.ts +3 -4
- package/paragraph/Paragraph.js +18 -8
- package/password-input/PasswordInput.js +51 -22
- package/password-input/PasswordInput.test.js +94 -51
- package/password-input/types.d.ts +4 -4
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +39 -14
- package/progress-bar/ProgressBar.test.js +53 -36
- package/progress-bar/types.d.ts +4 -3
- package/quick-nav/QuickNav.js +24 -2
- package/quick-nav/types.d.ts +2 -2
- package/radio-group/Radio.js +53 -22
- package/radio-group/RadioGroup.js +84 -41
- package/radio-group/RadioGroup.test.js +288 -186
- package/radio-group/types.d.ts +4 -4
- package/resultsetTable/Icons.js +3 -0
- package/resultsetTable/ResultsetTable.js +56 -21
- package/resultsetTable/ResultsetTable.test.js +75 -42
- package/resultsetTable/types.d.ts +5 -5
- package/select/Icons.js +3 -0
- package/select/Listbox.js +35 -10
- package/select/Option.js +24 -8
- package/select/Select.js +143 -56
- package/select/Select.test.js +839 -456
- package/select/types.d.ts +12 -12
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +51 -0
- package/sidenav/Sidenav.d.ts +2 -2
- package/sidenav/Sidenav.js +116 -104
- package/sidenav/Sidenav.stories.tsx +60 -60
- package/sidenav/Sidenav.test.js +10 -3
- package/sidenav/types.d.ts +26 -23
- package/slider/Slider.js +84 -38
- package/slider/Slider.test.js +104 -76
- package/slider/types.d.ts +4 -4
- package/spinner/Spinner.js +51 -28
- package/spinner/Spinner.stories.jsx +28 -28
- package/spinner/Spinner.test.js +35 -26
- package/spinner/types.d.ts +3 -3
- package/switch/Switch.js +66 -24
- package/switch/Switch.test.js +97 -52
- package/switch/types.d.ts +4 -4
- package/table/Table.js +22 -4
- package/table/Table.test.js +7 -2
- package/table/types.d.ts +3 -3
- package/tabs/Tab.js +39 -22
- package/tabs/Tabs.js +131 -62
- package/tabs/Tabs.test.js +122 -67
- package/tabs/types.d.ts +8 -8
- package/tag/Tag.js +54 -27
- package/tag/Tag.test.js +31 -20
- package/tag/types.d.ts +7 -7
- package/text-input/Icons.js +3 -0
- package/text-input/Suggestion.js +24 -8
- package/text-input/Suggestions.js +36 -11
- package/text-input/TextInput.js +144 -59
- package/text-input/TextInput.stories.tsx +1 -1
- package/text-input/TextInput.test.js +858 -539
- package/text-input/types.d.ts +9 -9
- package/textarea/Textarea.js +73 -38
- package/textarea/Textarea.test.js +173 -98
- package/textarea/types.d.ts +4 -4
- package/toggle-group/ToggleGroup.d.ts +2 -2
- package/toggle-group/ToggleGroup.js +59 -21
- package/toggle-group/ToggleGroup.test.js +72 -40
- package/toggle-group/types.d.ts +11 -11
- package/typography/Typography.d.ts +2 -2
- package/typography/Typography.js +23 -110
- package/typography/Typography.stories.tsx +1 -1
- package/typography/types.d.ts +1 -1
- package/useTheme.d.ts +1234 -1
- package/useTheme.js +6 -0
- package/useTranslatedLabels.d.ts +84 -2
- package/useTranslatedLabels.js +5 -0
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +108 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +138 -0
- package/wizard/Wizard.js +47 -13
- package/wizard/Wizard.test.js +81 -54
- package/wizard/types.d.ts +7 -8
- package/card/ice-cream.jpg +0 -0
- package/translatedLabelsType.d.ts +0 -82
- /package/{translatedLabelsType.js → grid/types.js} +0 -0
package/select/types.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
-
type Margin = {
|
|
2
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
declare type Margin = {
|
|
4
4
|
top?: Space;
|
|
5
5
|
bottom?: Space;
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
-
type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
10
|
-
type OptionGroup = {
|
|
9
|
+
declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
10
|
+
declare type OptionGroup = {
|
|
11
11
|
/**
|
|
12
12
|
* Label of the group to be shown in the select's listbox.
|
|
13
13
|
*/
|
|
@@ -17,7 +17,7 @@ type OptionGroup = {
|
|
|
17
17
|
*/
|
|
18
18
|
options: Option[];
|
|
19
19
|
};
|
|
20
|
-
type Option = {
|
|
20
|
+
declare type Option = {
|
|
21
21
|
/**
|
|
22
22
|
* Element used as the icon that will be placed before the option label.
|
|
23
23
|
* It can be a url of an image or an inline SVG. If the url option
|
|
@@ -36,7 +36,7 @@ type Option = {
|
|
|
36
36
|
*/
|
|
37
37
|
value: string;
|
|
38
38
|
};
|
|
39
|
-
type CommonProps = {
|
|
39
|
+
declare type CommonProps = {
|
|
40
40
|
/**
|
|
41
41
|
* Text to be placed above the select.
|
|
42
42
|
*/
|
|
@@ -101,7 +101,7 @@ type CommonProps = {
|
|
|
101
101
|
*/
|
|
102
102
|
tabIndex?: number;
|
|
103
103
|
};
|
|
104
|
-
type SingleSelect = CommonProps & {
|
|
104
|
+
declare type SingleSelect = CommonProps & {
|
|
105
105
|
/**
|
|
106
106
|
* If true, the select component will support multiple selected options.
|
|
107
107
|
* In that case, value will be an array of strings with each selected
|
|
@@ -137,7 +137,7 @@ type SingleSelect = CommonProps & {
|
|
|
137
137
|
error?: string;
|
|
138
138
|
}) => void;
|
|
139
139
|
};
|
|
140
|
-
type MultipleSelect = CommonProps & {
|
|
140
|
+
declare type MultipleSelect = CommonProps & {
|
|
141
141
|
/**
|
|
142
142
|
* If true, the select component will support multiple selected options.
|
|
143
143
|
* In that case, value will be an array of strings with each selected
|
|
@@ -173,11 +173,11 @@ type MultipleSelect = CommonProps & {
|
|
|
173
173
|
error?: string;
|
|
174
174
|
}) => void;
|
|
175
175
|
};
|
|
176
|
-
type Props = SingleSelect | MultipleSelect;
|
|
176
|
+
declare type Props = SingleSelect | MultipleSelect;
|
|
177
177
|
/**
|
|
178
178
|
* Single option of the select component.
|
|
179
179
|
*/
|
|
180
|
-
export type OptionProps = {
|
|
180
|
+
export declare type OptionProps = {
|
|
181
181
|
id: string;
|
|
182
182
|
option: Option;
|
|
183
183
|
onClick: (option: Option) => void;
|
|
@@ -190,7 +190,7 @@ export type OptionProps = {
|
|
|
190
190
|
/**
|
|
191
191
|
* Listbox from the select component.
|
|
192
192
|
*/
|
|
193
|
-
export type ListboxProps = {
|
|
193
|
+
export declare type ListboxProps = {
|
|
194
194
|
id: string;
|
|
195
195
|
currentValue: string | string[];
|
|
196
196
|
options: Option[] | OptionGroup[];
|
|
@@ -206,5 +206,5 @@ export type ListboxProps = {
|
|
|
206
206
|
/**
|
|
207
207
|
* Reference to the select component.
|
|
208
208
|
*/
|
|
209
|
-
export type RefType = HTMLDivElement;
|
|
209
|
+
export declare type RefType = HTMLDivElement;
|
|
210
210
|
export default Props;
|
package/sidenav/Icons.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var icons = {
|
|
13
|
+
collapsedIcon: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
14
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
15
|
+
height: "24px",
|
|
16
|
+
viewBox: "0 0 24 24",
|
|
17
|
+
width: "24px",
|
|
18
|
+
fill: "currentColor"
|
|
19
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
20
|
+
d: "M0 0h24v24H0z",
|
|
21
|
+
fill: "none"
|
|
22
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
23
|
+
d: "M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"
|
|
24
|
+
})),
|
|
25
|
+
collapsableIcon: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
26
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
27
|
+
height: "24px",
|
|
28
|
+
viewBox: "0 0 24 24",
|
|
29
|
+
width: "24px",
|
|
30
|
+
fill: "currentColor"
|
|
31
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
32
|
+
d: "M0 0h24v24H0z",
|
|
33
|
+
fill: "none"
|
|
34
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
35
|
+
d: "M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"
|
|
36
|
+
})),
|
|
37
|
+
externalLinkIcon: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
38
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
39
|
+
height: "24",
|
|
40
|
+
viewBox: "0 0 24 24",
|
|
41
|
+
width: "24",
|
|
42
|
+
fill: "currentColor"
|
|
43
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
44
|
+
d: "M0 0h24v24H0z",
|
|
45
|
+
fill: "none"
|
|
46
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
47
|
+
d: "M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"
|
|
48
|
+
}))
|
|
49
|
+
};
|
|
50
|
+
var _default = icons;
|
|
51
|
+
exports["default"] = _default;
|
package/sidenav/Sidenav.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import SidenavPropsType, { SidenavGroupPropsType, SidenavLinkPropsType, SidenavSectionPropsType, SidenavTitlePropsType } from "./types.js";
|
|
3
3
|
declare const DxcSidenav: {
|
|
4
|
-
({
|
|
4
|
+
({ title, children }: SidenavPropsType): JSX.Element;
|
|
5
5
|
Section: ({ children }: SidenavSectionPropsType) => JSX.Element;
|
|
6
|
-
Group: ({
|
|
6
|
+
Group: ({ title, collapsable, icon, children }: SidenavGroupPropsType) => JSX.Element;
|
|
7
7
|
Link: React.ForwardRefExoticComponent<SidenavLinkPropsType & React.RefAttributes<HTMLAnchorElement>>;
|
|
8
8
|
Title: ({ children }: SidenavTitlePropsType) => JSX.Element;
|
|
9
9
|
};
|
package/sidenav/Sidenav.js
CHANGED
|
@@ -1,138 +1,140 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
8
10
|
exports["default"] = void 0;
|
|
11
|
+
|
|
9
12
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
+
|
|
10
14
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
+
|
|
11
16
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
17
|
+
|
|
12
18
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
19
|
+
|
|
13
20
|
var _react = _interopRequireWildcard(require("react"));
|
|
21
|
+
|
|
14
22
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
23
|
+
|
|
15
24
|
var _variables = require("../common/variables");
|
|
25
|
+
|
|
16
26
|
var _SidenavContext = require("../layout/SidenavContext");
|
|
27
|
+
|
|
17
28
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
29
|
+
|
|
18
30
|
var _BackgroundColorContext = require("../BackgroundColorContext");
|
|
31
|
+
|
|
19
32
|
var _Flex = _interopRequireDefault(require("../flex/Flex"));
|
|
33
|
+
|
|
20
34
|
var _Bleed = _interopRequireDefault(require("../bleed/Bleed"));
|
|
21
|
-
|
|
22
|
-
var
|
|
35
|
+
|
|
36
|
+
var _Icons = _interopRequireDefault(require("./Icons"));
|
|
37
|
+
|
|
38
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
39
|
+
|
|
40
|
+
var _excluded = ["href", "newWindow", "selected", "icon", "onClick", "tabIndex", "children"];
|
|
41
|
+
|
|
23
42
|
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); }
|
|
43
|
+
|
|
24
44
|
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
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
27
|
-
height: "24px",
|
|
28
|
-
viewBox: "0 0 24 24",
|
|
29
|
-
width: "24px",
|
|
30
|
-
fill: "currentColor"
|
|
31
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
32
|
-
d: "M0 0h24v24H0z",
|
|
33
|
-
fill: "none"
|
|
34
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
35
|
-
d: "M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"
|
|
36
|
-
}));
|
|
37
|
-
var collapsableIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
38
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
39
|
-
height: "24px",
|
|
40
|
-
viewBox: "0 0 24 24",
|
|
41
|
-
width: "24px",
|
|
42
|
-
fill: "currentColor"
|
|
43
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
44
|
-
d: "M0 0h24v24H0z",
|
|
45
|
-
fill: "none"
|
|
46
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
47
|
-
d: "M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"
|
|
48
|
-
}));
|
|
49
|
-
var externalLinkIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
50
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
51
|
-
height: "24",
|
|
52
|
-
viewBox: "0 0 24 24",
|
|
53
|
-
width: "24",
|
|
54
|
-
fill: "currentColor"
|
|
55
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
56
|
-
d: "M0 0h24v24H0z",
|
|
57
|
-
fill: "none"
|
|
58
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
59
|
-
d: "M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"
|
|
60
|
-
}));
|
|
45
|
+
|
|
61
46
|
var DxcSidenav = function DxcSidenav(_ref) {
|
|
62
|
-
var
|
|
63
|
-
|
|
47
|
+
var title = _ref.title,
|
|
48
|
+
children = _ref.children;
|
|
64
49
|
var colorsTheme = (0, _useTheme["default"])();
|
|
65
50
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
66
|
-
theme: colorsTheme
|
|
51
|
+
theme: colorsTheme.sidenav
|
|
67
52
|
}, /*#__PURE__*/_react["default"].createElement(SidenavContainer, null, /*#__PURE__*/_react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
|
|
68
|
-
color: colorsTheme
|
|
53
|
+
color: colorsTheme.sidenav.backgroundColor
|
|
69
54
|
}, title, /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
70
55
|
direction: "column",
|
|
71
56
|
gap: "1rem"
|
|
72
|
-
},
|
|
73
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, child, index !== _react["default"].Children.count(children) - 1 && /*#__PURE__*/_react["default"].createElement(Divider, null));
|
|
74
|
-
})))));
|
|
57
|
+
}, children))));
|
|
75
58
|
};
|
|
59
|
+
|
|
76
60
|
var Title = function Title(_ref2) {
|
|
77
61
|
var children = _ref2.children;
|
|
78
62
|
return /*#__PURE__*/_react["default"].createElement(_Bleed["default"], {
|
|
79
63
|
horizontal: "1rem"
|
|
80
64
|
}, /*#__PURE__*/_react["default"].createElement(SidenavTitle, null, children));
|
|
81
65
|
};
|
|
66
|
+
|
|
82
67
|
var Section = function Section(_ref3) {
|
|
83
68
|
var children = _ref3.children;
|
|
84
|
-
return /*#__PURE__*/_react["default"].createElement(_Bleed["default"], {
|
|
69
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Bleed["default"], {
|
|
85
70
|
horizontal: "1rem"
|
|
86
71
|
}, /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
87
72
|
direction: "column"
|
|
88
|
-
}, children));
|
|
73
|
+
}, children)), /*#__PURE__*/_react["default"].createElement(Divider, null));
|
|
89
74
|
};
|
|
75
|
+
|
|
76
|
+
var GroupContext = /*#__PURE__*/_react["default"].createContext(null);
|
|
77
|
+
|
|
90
78
|
var Group = function Group(_ref4) {
|
|
91
|
-
var
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
79
|
+
var title = _ref4.title,
|
|
80
|
+
_ref4$collapsable = _ref4.collapsable,
|
|
81
|
+
collapsable = _ref4$collapsable === void 0 ? false : _ref4$collapsable,
|
|
82
|
+
icon = _ref4.icon,
|
|
83
|
+
children = _ref4.children;
|
|
84
|
+
|
|
96
85
|
var _useState = (0, _react.useState)(false),
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
107
|
-
|
|
86
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
87
|
+
collapsed = _useState2[0],
|
|
88
|
+
setCollapsed = _useState2[1];
|
|
89
|
+
|
|
90
|
+
var _useState3 = (0, _react.useState)(false),
|
|
91
|
+
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
92
|
+
isSelected = _useState4[0],
|
|
93
|
+
changeIsSelected = _useState4[1];
|
|
94
|
+
|
|
95
|
+
return /*#__PURE__*/_react["default"].createElement(GroupContext.Provider, {
|
|
96
|
+
value: changeIsSelected
|
|
97
|
+
}, /*#__PURE__*/_react["default"].createElement(SidenavGroup, null, collapsable && title ? /*#__PURE__*/_react["default"].createElement(SidenavGroupTitleButton, {
|
|
108
98
|
"aria-expanded": !collapsed,
|
|
109
99
|
onClick: function onClick() {
|
|
110
100
|
return setCollapsed(!collapsed);
|
|
111
101
|
},
|
|
112
|
-
selectedGroup:
|
|
113
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
102
|
+
selectedGroup: collapsed && isSelected
|
|
103
|
+
}, /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
104
|
+
alignItems: "center",
|
|
105
|
+
gap: "0.5rem"
|
|
106
|
+
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
114
107
|
src: icon
|
|
115
|
-
}) : icon, title), collapsed ? collapsedIcon : collapsableIcon) : title && /*#__PURE__*/_react["default"].createElement(SidenavGroupTitle, null, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
108
|
+
}) : icon, title), collapsed ? _Icons["default"].collapsedIcon : _Icons["default"].collapsableIcon) : title && /*#__PURE__*/_react["default"].createElement(SidenavGroupTitle, null, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
116
109
|
src: icon
|
|
117
|
-
}) : icon, title), !collapsed && children);
|
|
110
|
+
}) : icon, title), !collapsed && children));
|
|
118
111
|
};
|
|
112
|
+
|
|
119
113
|
var Link = /*#__PURE__*/(0, _react.forwardRef)(function (_ref5, ref) {
|
|
120
114
|
var href = _ref5.href,
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
115
|
+
_ref5$newWindow = _ref5.newWindow,
|
|
116
|
+
newWindow = _ref5$newWindow === void 0 ? false : _ref5$newWindow,
|
|
117
|
+
_ref5$selected = _ref5.selected,
|
|
118
|
+
selected = _ref5$selected === void 0 ? false : _ref5$selected,
|
|
119
|
+
icon = _ref5.icon,
|
|
120
|
+
onClick = _ref5.onClick,
|
|
121
|
+
_ref5$tabIndex = _ref5.tabIndex,
|
|
122
|
+
tabIndex = _ref5$tabIndex === void 0 ? 0 : _ref5$tabIndex,
|
|
123
|
+
children = _ref5.children,
|
|
124
|
+
otherProps = (0, _objectWithoutProperties2["default"])(_ref5, _excluded);
|
|
125
|
+
var changeIsGroupSelected = (0, _react.useContext)(GroupContext);
|
|
131
126
|
var setIsSidenavVisibleResponsive = (0, _SidenavContext.useResponsiveSidenavVisibility)();
|
|
127
|
+
|
|
132
128
|
var handleClick = function handleClick($event) {
|
|
133
129
|
onClick === null || onClick === void 0 ? void 0 : onClick($event);
|
|
134
130
|
setIsSidenavVisibleResponsive === null || setIsSidenavVisibleResponsive === void 0 ? void 0 : setIsSidenavVisibleResponsive(false);
|
|
135
131
|
};
|
|
132
|
+
|
|
133
|
+
(0, _react.useEffect)(function () {
|
|
134
|
+
changeIsGroupSelected === null || changeIsGroupSelected === void 0 ? void 0 : changeIsGroupSelected(function (isGroupSelected) {
|
|
135
|
+
return !isGroupSelected ? selected : isGroupSelected;
|
|
136
|
+
});
|
|
137
|
+
}, [selected, changeIsGroupSelected]);
|
|
136
138
|
return /*#__PURE__*/_react["default"].createElement(SidenavLink, (0, _extends2["default"])({
|
|
137
139
|
selected: selected,
|
|
138
140
|
href: href ? href : undefined,
|
|
@@ -140,18 +142,23 @@ var Link = /*#__PURE__*/(0, _react.forwardRef)(function (_ref5, ref) {
|
|
|
140
142
|
ref: ref,
|
|
141
143
|
tabIndex: tabIndex,
|
|
142
144
|
onClick: handleClick
|
|
143
|
-
}, otherProps), /*#__PURE__*/_react["default"].createElement(
|
|
145
|
+
}, otherProps), /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
146
|
+
alignItems: "center",
|
|
147
|
+
gap: "0.5rem"
|
|
148
|
+
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
144
149
|
src: icon
|
|
145
|
-
}) : icon, children), newWindow && externalLinkIcon);
|
|
150
|
+
}) : icon, children), newWindow && _Icons["default"].externalLinkIcon);
|
|
146
151
|
});
|
|
147
|
-
|
|
152
|
+
|
|
153
|
+
var SidenavContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n width: 280px;\n @media (max-width: ", "rem) {\n width: 100vw;\n }\n padding: 2rem 1rem;\n background-color: ", ";\n\n overflow-y: auto;\n overflow-x: hidden;\n ::-webkit-scrollbar {\n width: 2px;\n }\n ::-webkit-scrollbar-track {\n background-color: ", ";\n border-radius: 3px;\n }\n ::-webkit-scrollbar-thumb {\n background-color: ", ";\n border-radius: 3px;\n }\n"])), _variables.responsiveSizes.medium, function (props) {
|
|
148
154
|
return props.theme.backgroundColor;
|
|
149
|
-
},
|
|
155
|
+
}, function (props) {
|
|
150
156
|
return props.theme.scrollBarTrackColor;
|
|
151
157
|
}, function (props) {
|
|
152
158
|
return props.theme.scrollBarThumbColor;
|
|
153
159
|
});
|
|
154
|
-
|
|
160
|
+
|
|
161
|
+
var SidenavTitle = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n padding: 0.5rem 1.2rem;\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n font-size: ", ";\n color: ", ";\n letter-spacing: ", ";\n text-transform: ", ";\n"])), function (props) {
|
|
155
162
|
return props.theme.titleFontFamily;
|
|
156
163
|
}, function (props) {
|
|
157
164
|
return props.theme.titleFontStyle;
|
|
@@ -161,14 +168,17 @@ var SidenavTitle = _styledComponents["default"].div(_templateObject2 || (_templa
|
|
|
161
168
|
return props.theme.titleFontSize;
|
|
162
169
|
}, function (props) {
|
|
163
170
|
return props.theme.titleFontColor;
|
|
164
|
-
}, function (props) {
|
|
165
|
-
return props.theme.titleFontTextTransform;
|
|
166
171
|
}, function (props) {
|
|
167
172
|
return props.theme.titleFontLetterSpacing;
|
|
173
|
+
}, function (props) {
|
|
174
|
+
return props.theme.titleFontTextTransform;
|
|
168
175
|
});
|
|
169
|
-
|
|
170
|
-
var
|
|
171
|
-
|
|
176
|
+
|
|
177
|
+
var Divider = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n width: 100%;\n height: 1px;\n background-color: #999999;\n\n &:last-child {\n display: none;\n }\n"])));
|
|
178
|
+
|
|
179
|
+
var SidenavGroup = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n a {\n padding: 0.5rem 1.2rem 0.5rem 2.25rem;\n }\n"])));
|
|
180
|
+
|
|
181
|
+
var SidenavGroupTitle = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.5rem 1.2rem;\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n font-size: ", ";\n\n img,\n svg {\n height: 16px;\n width: 16px;\n }\n"])), function (props) {
|
|
172
182
|
return props.theme.groupTitleFontFamily;
|
|
173
183
|
}, function (props) {
|
|
174
184
|
return props.theme.groupTitleFontStyle;
|
|
@@ -177,7 +187,8 @@ var SidenavGroupTitle = _styledComponents["default"].span(_templateObject5 || (_
|
|
|
177
187
|
}, function (props) {
|
|
178
188
|
return props.theme.groupTitleFontSize;
|
|
179
189
|
});
|
|
180
|
-
|
|
190
|
+
|
|
191
|
+
var SidenavGroupTitleButton = _styledComponents["default"].button(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n all: unset;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n padding: 0.5rem 1.2rem;\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n font-size: ", ";\n cursor: pointer;\n\n ", "\n\n &:focus, &:focus-visible {\n outline: 2px solid ", ";\n outline-offset: -2px;\n }\n &:hover {\n ", "\n }\n &:active {\n color: #fff;\n background-color: ", ";\n }\n\n img,\n svg {\n height: 16px;\n width: 16px;\n }\n"])), function (props) {
|
|
181
192
|
return props.theme.groupTitleFontFamily;
|
|
182
193
|
}, function (props) {
|
|
183
194
|
return props.theme.groupTitleFontStyle;
|
|
@@ -186,23 +197,16 @@ var SidenavGroupTitleButton = _styledComponents["default"].button(_templateObjec
|
|
|
186
197
|
}, function (props) {
|
|
187
198
|
return props.theme.groupTitleFontSize;
|
|
188
199
|
}, function (props) {
|
|
189
|
-
return props.theme.
|
|
190
|
-
}, function (props) {
|
|
191
|
-
return props.selectedGroup ? "color: ".concat(props.theme.groupTitleSelectedHoverFontColor, "; background: ").concat(props.theme.groupTitleSelectedHoverBackgroundColor, ";") : "color: ".concat(props.theme.groupTitleFontColor, "; background: ").concat(props.theme.groupTitleHoverBackgroundColor, ";");
|
|
200
|
+
return props.selectedGroup ? "color: ".concat(props.theme.groupTitleSelectedFontColor, "; background-color: ").concat(props.theme.groupTitleSelectedBackgroundColor, ";") : "color: ".concat(props.theme.groupTitleFontColor, "; background-color: transparent;");
|
|
192
201
|
}, function (props) {
|
|
193
|
-
return props.theme.
|
|
202
|
+
return props.theme.linkFocusColor;
|
|
194
203
|
}, function (props) {
|
|
195
|
-
return props.theme.groupTitleFontColor;
|
|
204
|
+
return props.selectedGroup ? "color: ".concat(props.theme.groupTitleSelectedHoverFontColor, "; background-color: ").concat(props.theme.groupTitleSelectedHoverBackgroundColor, ";") : "color: ".concat(props.theme.groupTitleFontColor, "; background-color: ").concat(props.theme.groupTitleHoverBackgroundColor, ";");
|
|
196
205
|
}, function (props) {
|
|
197
|
-
return props.selectedGroup ? "
|
|
206
|
+
return props.selectedGroup ? "#333" : props.theme.groupTitleActiveBackgroundColor;
|
|
198
207
|
});
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}, function (props) {
|
|
202
|
-
return props.theme.linkFontTextTransform;
|
|
203
|
-
}, function (props) {
|
|
204
|
-
return props.theme.linkTextDecoration;
|
|
205
|
-
}, function (props) {
|
|
208
|
+
|
|
209
|
+
var SidenavLink = _styledComponents["default"].a(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 0.5rem;\n padding: 0.5rem 1.2rem;\n box-shadow: 0 0 0 2px transparent;\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n font-size: ", ";\n letter-spacing: ", ";\n text-transform: ", ";\n text-decoration: ", ";\n cursor: pointer;\n\n ", "\n\n &:focus, &:focus-visible {\n outline: 2px solid ", ";\n outline-offset: -2px;\n }\n &:hover {\n ", "\n }\n &:active {\n color: #fff;\n background-color: ", ";\n outline: 2px solid #0095ff;\n outline-offset: -2px;\n }\n\n img,\n svg {\n height: 16px;\n width: 16px;\n }\n"])), function (props) {
|
|
206
210
|
return props.theme.linkFontFamily;
|
|
207
211
|
}, function (props) {
|
|
208
212
|
return props.theme.linkFontStyle;
|
|
@@ -211,13 +215,21 @@ var SidenavLink = _styledComponents["default"].a(_templateObject7 || (_templateO
|
|
|
211
215
|
}, function (props) {
|
|
212
216
|
return props.theme.linkFontSize;
|
|
213
217
|
}, function (props) {
|
|
214
|
-
return props.
|
|
218
|
+
return props.theme.linkFontLetterSpacing;
|
|
215
219
|
}, function (props) {
|
|
216
|
-
return props.
|
|
220
|
+
return props.theme.linkFontTextTransform;
|
|
221
|
+
}, function (props) {
|
|
222
|
+
return props.theme.linkTextDecoration;
|
|
223
|
+
}, function (props) {
|
|
224
|
+
return props.selected ? "color: ".concat(props.theme.linkSelectedFontColor, "; background-color: ").concat(props.theme.linkSelectedBackgroundColor, ";") : "color: ".concat(props.theme.linkFontColor, "; background-color: transparent;");
|
|
217
225
|
}, function (props) {
|
|
218
226
|
return props.theme.linkFocusColor;
|
|
227
|
+
}, function (props) {
|
|
228
|
+
return props.selected ? "color: ".concat(props.theme.linkSelectedHoverFontColor, "; background-color: ").concat(props.theme.linkSelectedHoverBackgroundColor, ";") : "color: ".concat(props.theme.linkFontColor, "; background-color: ").concat(props.theme.linkHoverBackgroundColor, ";");
|
|
229
|
+
}, function (props) {
|
|
230
|
+
return props.selected ? "#333" : "#4d4d4d";
|
|
219
231
|
});
|
|
220
|
-
|
|
232
|
+
|
|
221
233
|
DxcSidenav.Section = Section;
|
|
222
234
|
DxcSidenav.Group = Group;
|
|
223
235
|
DxcSidenav.Link = Link;
|