@hitachivantara/uikit-react-core 3.62.5 → 3.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/dist/AppSwitcher/Action/Action.d.ts +75 -0
- package/dist/AppSwitcher/Action/Action.js +304 -0
- package/dist/AppSwitcher/Action/Action.js.map +1 -0
- package/dist/AppSwitcher/Action/index.d.ts +2 -0
- package/dist/AppSwitcher/Action/index.js +14 -0
- package/dist/AppSwitcher/Action/index.js.map +1 -0
- package/dist/AppSwitcher/Action/styles.js +60 -0
- package/dist/AppSwitcher/Action/styles.js.map +1 -0
- package/dist/AppSwitcher/AppSwitcher.d.ts +67 -0
- package/dist/AppSwitcher/AppSwitcher.js +282 -0
- package/dist/AppSwitcher/AppSwitcher.js.map +1 -0
- package/dist/AppSwitcher/TitleWithTooltip.js +76 -0
- package/dist/AppSwitcher/TitleWithTooltip.js.map +1 -0
- package/dist/AppSwitcher/index.d.ts +5 -0
- package/dist/AppSwitcher/index.js +24 -0
- package/dist/AppSwitcher/index.js.map +1 -0
- package/dist/AppSwitcher/styles.js +95 -0
- package/dist/AppSwitcher/styles.js.map +1 -0
- package/dist/Avatar/Avatar.d.ts +4 -0
- package/dist/Avatar/Avatar.js +19 -8
- package/dist/Avatar/Avatar.js.map +1 -1
- package/dist/Chart/chartPlotlyOverrides.js +2 -2
- package/dist/Chart/chartPlotlyOverrides.js.map +1 -1
- package/dist/FileUploader/File/styles.js +2 -1
- package/dist/FileUploader/File/styles.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/legacy/AppSwitcher/Action/Action.d.ts +75 -0
- package/dist/legacy/AppSwitcher/Action/Action.js +259 -0
- package/dist/legacy/AppSwitcher/Action/Action.js.map +1 -0
- package/dist/legacy/AppSwitcher/Action/index.d.ts +2 -0
- package/dist/legacy/AppSwitcher/Action/index.js +3 -0
- package/dist/legacy/AppSwitcher/Action/index.js.map +1 -0
- package/dist/legacy/AppSwitcher/Action/styles.js +52 -0
- package/dist/legacy/AppSwitcher/Action/styles.js.map +1 -0
- package/dist/legacy/AppSwitcher/AppSwitcher.d.ts +67 -0
- package/dist/legacy/AppSwitcher/AppSwitcher.js +260 -0
- package/dist/legacy/AppSwitcher/AppSwitcher.js.map +1 -0
- package/dist/legacy/AppSwitcher/TitleWithTooltip.js +45 -0
- package/dist/legacy/AppSwitcher/TitleWithTooltip.js.map +1 -0
- package/dist/legacy/AppSwitcher/index.d.ts +5 -0
- package/dist/legacy/AppSwitcher/index.js +3 -0
- package/dist/legacy/AppSwitcher/index.js.map +1 -0
- package/dist/legacy/AppSwitcher/styles.js +78 -0
- package/dist/legacy/AppSwitcher/styles.js.map +1 -0
- package/dist/legacy/Avatar/Avatar.d.ts +4 -0
- package/dist/legacy/Avatar/Avatar.js +19 -8
- package/dist/legacy/Avatar/Avatar.js.map +1 -1
- package/dist/legacy/Chart/chartPlotlyOverrides.js +2 -2
- package/dist/legacy/Chart/chartPlotlyOverrides.js.map +1 -1
- package/dist/legacy/FileUploader/File/styles.js +2 -1
- package/dist/legacy/FileUploader/File/styles.js.map +1 -1
- package/dist/legacy/index.d.ts +3 -0
- package/dist/legacy/index.js +1 -0
- package/dist/legacy/index.js.map +1 -1
- package/dist/modern/AppSwitcher/Action/Action.d.ts +75 -0
- package/dist/modern/AppSwitcher/Action/Action.js +242 -0
- package/dist/modern/AppSwitcher/Action/Action.js.map +1 -0
- package/dist/modern/AppSwitcher/Action/index.d.ts +2 -0
- package/dist/modern/AppSwitcher/Action/index.js +3 -0
- package/dist/modern/AppSwitcher/Action/index.js.map +1 -0
- package/dist/modern/AppSwitcher/Action/styles.js +50 -0
- package/dist/modern/AppSwitcher/Action/styles.js.map +1 -0
- package/dist/modern/AppSwitcher/AppSwitcher.d.ts +67 -0
- package/dist/modern/AppSwitcher/AppSwitcher.js +254 -0
- package/dist/modern/AppSwitcher/AppSwitcher.js.map +1 -0
- package/dist/modern/AppSwitcher/TitleWithTooltip.js +41 -0
- package/dist/modern/AppSwitcher/TitleWithTooltip.js.map +1 -0
- package/dist/modern/AppSwitcher/index.d.ts +5 -0
- package/dist/modern/AppSwitcher/index.js +3 -0
- package/dist/modern/AppSwitcher/index.js.map +1 -0
- package/dist/modern/AppSwitcher/styles.js +67 -0
- package/dist/modern/AppSwitcher/styles.js.map +1 -0
- package/dist/modern/Avatar/Avatar.d.ts +4 -0
- package/dist/modern/Avatar/Avatar.js +20 -9
- package/dist/modern/Avatar/Avatar.js.map +1 -1
- package/dist/modern/Chart/chartPlotlyOverrides.js +2 -2
- package/dist/modern/Chart/chartPlotlyOverrides.js.map +1 -1
- package/dist/modern/FileUploader/File/styles.js +2 -1
- package/dist/modern/FileUploader/File/styles.js.map +1 -1
- package/dist/modern/index.d.ts +3 -0
- package/dist/modern/index.js +1 -0
- package/dist/modern/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const styles = theme => ({
|
|
2
|
+
root: {
|
|
3
|
+
width: "100%",
|
|
4
|
+
maxWidth: 280,
|
|
5
|
+
minHeight: 52,
|
|
6
|
+
marginRight: theme.hv.spacing.sm
|
|
7
|
+
},
|
|
8
|
+
disabled: {},
|
|
9
|
+
selected: {},
|
|
10
|
+
typography: {
|
|
11
|
+
display: "flex",
|
|
12
|
+
justifyContent: "flex-start",
|
|
13
|
+
alignItems: "center",
|
|
14
|
+
width: "100%",
|
|
15
|
+
minHeight: 52,
|
|
16
|
+
padding: `6px ${theme.hv.spacing.xs}px`,
|
|
17
|
+
border: "none",
|
|
18
|
+
borderLeft: `solid 2px ${theme.hv.palette.accent.acce1}`,
|
|
19
|
+
cursor: "pointer",
|
|
20
|
+
textDecoration: "inherit",
|
|
21
|
+
color: "inherit",
|
|
22
|
+
backgroundColor: "inherit",
|
|
23
|
+
"$disabled &": {
|
|
24
|
+
cursor: "not-allowed"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
icon: {
|
|
28
|
+
display: "flex",
|
|
29
|
+
minWidth: 40,
|
|
30
|
+
justifyContent: "center"
|
|
31
|
+
},
|
|
32
|
+
title: {
|
|
33
|
+
flexGrow: 1,
|
|
34
|
+
margin: `0 ${theme.hv.spacing.xs}px`,
|
|
35
|
+
textAlign: "left",
|
|
36
|
+
overflow: "hidden",
|
|
37
|
+
whiteSpace: "nowrap",
|
|
38
|
+
textOverflow: "ellipsis",
|
|
39
|
+
color: "inherit"
|
|
40
|
+
},
|
|
41
|
+
iconInfo: {
|
|
42
|
+
minWidth: 32
|
|
43
|
+
},
|
|
44
|
+
iconUrl: {
|
|
45
|
+
width: 32
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export default styles;
|
|
50
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/AppSwitcher/Action/styles.js"],"names":["styles","theme","root","width","maxWidth","minHeight","marginRight","hv","spacing","sm","disabled","selected","typography","display","justifyContent","alignItems","padding","xs","border","borderLeft","palette","accent","acce1","cursor","textDecoration","color","backgroundColor","icon","minWidth","title","flexGrow","margin","textAlign","overflow","whiteSpace","textOverflow","iconInfo","iconUrl"],"mappings":"AAAA,MAAMA,MAAM,GAAIC,KAAD,KAAY;AACzBC,EAAAA,IAAI,EAAE;AACJC,IAAAA,KAAK,EAAE,MADH;AAEJC,IAAAA,QAAQ,EAAE,GAFN;AAGJC,IAAAA,SAAS,EAAE,EAHP;AAIJC,IAAAA,WAAW,EAAEL,KAAK,CAACM,EAAN,CAASC,OAAT,CAAiBC;AAJ1B,GADmB;AAOzBC,EAAAA,QAAQ,EAAE,EAPe;AAQzBC,EAAAA,QAAQ,EAAE,EARe;AAUzBC,EAAAA,UAAU,EAAE;AACVC,IAAAA,OAAO,EAAE,MADC;AAEVC,IAAAA,cAAc,EAAE,YAFN;AAGVC,IAAAA,UAAU,EAAE,QAHF;AAKVZ,IAAAA,KAAK,EAAE,MALG;AAMVE,IAAAA,SAAS,EAAE,EAND;AAQVW,IAAAA,OAAO,EAAG,OAAMf,KAAK,CAACM,EAAN,CAASC,OAAT,CAAiBS,EAAG,IAR1B;AAUVC,IAAAA,MAAM,EAAE,MAVE;AAWVC,IAAAA,UAAU,EAAG,aAAYlB,KAAK,CAACM,EAAN,CAASa,OAAT,CAAiBC,MAAjB,CAAwBC,KAAM,EAX7C;AAaVC,IAAAA,MAAM,EAAE,SAbE;AAeVC,IAAAA,cAAc,EAAE,SAfN;AAgBVC,IAAAA,KAAK,EAAE,SAhBG;AAiBVC,IAAAA,eAAe,EAAE,SAjBP;AAmBV,mBAAe;AACbH,MAAAA,MAAM,EAAE;AADK;AAnBL,GAVa;AAkCzBI,EAAAA,IAAI,EAAE;AACJd,IAAAA,OAAO,EAAE,MADL;AAEJe,IAAAA,QAAQ,EAAE,EAFN;AAGJd,IAAAA,cAAc,EAAE;AAHZ,GAlCmB;AAwCzBe,EAAAA,KAAK,EAAE;AACLC,IAAAA,QAAQ,EAAE,CADL;AAELC,IAAAA,MAAM,EAAG,KAAI9B,KAAK,CAACM,EAAN,CAASC,OAAT,CAAiBS,EAAG,IAF5B;AAILe,IAAAA,SAAS,EAAE,MAJN;AAMLC,IAAAA,QAAQ,EAAE,QANL;AAOLC,IAAAA,UAAU,EAAE,QAPP;AAQLC,IAAAA,YAAY,EAAE,UART;AAULV,IAAAA,KAAK,EAAE;AAVF,GAxCkB;AAqDzBW,EAAAA,QAAQ,EAAE;AACRR,IAAAA,QAAQ,EAAE;AADF,GArDe;AAyDzBS,EAAAA,OAAO,EAAE;AACPlC,IAAAA,KAAK,EAAE;AADA;AAzDgB,CAAZ,CAAf;;AA8DA,eAAeH,MAAf","sourcesContent":["const styles = (theme) => ({\n root: {\n width: \"100%\",\n maxWidth: 280,\n minHeight: 52,\n marginRight: theme.hv.spacing.sm,\n },\n disabled: {},\n selected: {},\n\n typography: {\n display: \"flex\",\n justifyContent: \"flex-start\",\n alignItems: \"center\",\n\n width: \"100%\",\n minHeight: 52,\n\n padding: `6px ${theme.hv.spacing.xs}px`,\n\n border: \"none\",\n borderLeft: `solid 2px ${theme.hv.palette.accent.acce1}`,\n\n cursor: \"pointer\",\n\n textDecoration: \"inherit\",\n color: \"inherit\",\n backgroundColor: \"inherit\",\n\n \"$disabled &\": {\n cursor: \"not-allowed\",\n },\n },\n\n icon: {\n display: \"flex\",\n minWidth: 40,\n justifyContent: \"center\",\n },\n\n title: {\n flexGrow: 1,\n margin: `0 ${theme.hv.spacing.xs}px`,\n\n textAlign: \"left\",\n\n overflow: \"hidden\",\n whiteSpace: \"nowrap\",\n textOverflow: \"ellipsis\",\n\n color: \"inherit\",\n },\n\n iconInfo: {\n minWidth: 32,\n },\n\n iconUrl: {\n width: 32,\n },\n});\n\nexport default styles;\n"],"file":"styles.js"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { StandardProps } from "@material-ui/core";
|
|
3
|
+
|
|
4
|
+
import { HvAppSwitcherActionApplication } from "./Action";
|
|
5
|
+
|
|
6
|
+
export type HvAppSwitcherClassKey =
|
|
7
|
+
| "root"
|
|
8
|
+
| "single"
|
|
9
|
+
| "dual"
|
|
10
|
+
| "fluid"
|
|
11
|
+
| "title"
|
|
12
|
+
| "actionsContainer"
|
|
13
|
+
| "footerContainer"
|
|
14
|
+
| "closed"
|
|
15
|
+
| "open"
|
|
16
|
+
| "item"
|
|
17
|
+
| "itemSelected"
|
|
18
|
+
| "itemDisabled"
|
|
19
|
+
| "itemTrigger"
|
|
20
|
+
| "itemIcon"
|
|
21
|
+
| "itemTitle"
|
|
22
|
+
| "itemInfoIcon";
|
|
23
|
+
|
|
24
|
+
export interface HvAppSwitcherProps
|
|
25
|
+
extends StandardProps<React.HTMLAttributes<HTMLElement>, HvAppSwitcherClassKey> {
|
|
26
|
+
/**
|
|
27
|
+
* Number of columns to render. One, two, or whatever fits the component's width.
|
|
28
|
+
*/
|
|
29
|
+
layout?: "single" | "dual" | "fluid";
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Title to be displayed on the header of the component.
|
|
33
|
+
*/
|
|
34
|
+
title?: string;
|
|
35
|
+
/**
|
|
36
|
+
* The list of applications to be used to render the actions on the component.
|
|
37
|
+
*/
|
|
38
|
+
applications: HvAppSwitcherActionApplication[];
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Triggered when an action is clicked.
|
|
42
|
+
*/
|
|
43
|
+
onActionClickedCallback?: (
|
|
44
|
+
event: MouseEvent,
|
|
45
|
+
application?: HvAppSwitcherActionApplication
|
|
46
|
+
) => void;
|
|
47
|
+
/**
|
|
48
|
+
* Must return a boolean stating if the action element is selected or not.
|
|
49
|
+
*/
|
|
50
|
+
isActionSelectedCallback?: (application?: HvAppSwitcherActionApplication) => boolean;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Element to be added to the header container, if none is provided a label with the title will be added.
|
|
54
|
+
*/
|
|
55
|
+
header?: string | React.ReactNode;
|
|
56
|
+
/**
|
|
57
|
+
* Element to be added to the footer container.
|
|
58
|
+
*/
|
|
59
|
+
footer?: string | React.ReactNode;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Flag stating if the panel is opened or closed.
|
|
63
|
+
*/
|
|
64
|
+
isOpen?: boolean;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export default function HvAppSwitcher(props: HvAppSwitcherProps): JSX.Element | null;
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { deprecatedPropType, withStyles } from "@material-ui/core";
|
|
5
|
+
import { HvListContainer } from "..";
|
|
6
|
+
import styles from "./styles";
|
|
7
|
+
import TitleWithTooltip from "./TitleWithTooltip";
|
|
8
|
+
import Action from "./Action";
|
|
9
|
+
|
|
10
|
+
const AppSwitcher = props => {
|
|
11
|
+
const {
|
|
12
|
+
id,
|
|
13
|
+
className,
|
|
14
|
+
classes,
|
|
15
|
+
layout = "single",
|
|
16
|
+
title,
|
|
17
|
+
applications,
|
|
18
|
+
onActionClickedCallback = () => {},
|
|
19
|
+
isActionSelectedCallback = () => false,
|
|
20
|
+
header,
|
|
21
|
+
footer,
|
|
22
|
+
isOpen
|
|
23
|
+
} = props;
|
|
24
|
+
|
|
25
|
+
const actionClicked = (event, application) => {
|
|
26
|
+
onActionClickedCallback === null || onActionClickedCallback === void 0 ? void 0 : onActionClickedCallback(event, application);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const panelActions = applications.map(application => {
|
|
30
|
+
if (application.name) {
|
|
31
|
+
return /*#__PURE__*/React.createElement(Action, {
|
|
32
|
+
key: application.id || `${application.name}_${application.url}`,
|
|
33
|
+
application: application,
|
|
34
|
+
onClickCallback: actionClicked,
|
|
35
|
+
isSelectedCallback: isActionSelectedCallback,
|
|
36
|
+
classes: {
|
|
37
|
+
root: classes.item,
|
|
38
|
+
selected: classes.itemSelected,
|
|
39
|
+
disabled: classes.itemDisabled,
|
|
40
|
+
typography: classes.itemTrigger,
|
|
41
|
+
icon: classes.itemIcon,
|
|
42
|
+
title: classes.itemTitle,
|
|
43
|
+
iconInfo: classes.itemInfoIcon
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return undefined;
|
|
49
|
+
});
|
|
50
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
51
|
+
id: id,
|
|
52
|
+
className: clsx(className, classes.root, classes[layout], isOpen === false && classes.closed, isOpen && classes.open)
|
|
53
|
+
}, header && /*#__PURE__*/React.createElement("div", {
|
|
54
|
+
className: classes.title
|
|
55
|
+
}, header) || title && /*#__PURE__*/React.createElement(TitleWithTooltip, {
|
|
56
|
+
className: classes.title,
|
|
57
|
+
title: title
|
|
58
|
+
}), /*#__PURE__*/React.createElement(HvListContainer, {
|
|
59
|
+
disableGutters: true,
|
|
60
|
+
className: classes.actionsContainer
|
|
61
|
+
}, panelActions), footer && /*#__PURE__*/React.createElement("div", {
|
|
62
|
+
className: classes.footerContainer
|
|
63
|
+
}, footer));
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
process.env.NODE_ENV !== "production" ? AppSwitcher.propTypes = {
|
|
67
|
+
/**
|
|
68
|
+
* Identifier to be applied to the root element.
|
|
69
|
+
*/
|
|
70
|
+
id: PropTypes.string,
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Class names to be applied to the root element.
|
|
74
|
+
*/
|
|
75
|
+
className: PropTypes.string,
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* A Jss Object used to override or extend the styles applied.
|
|
79
|
+
*/
|
|
80
|
+
classes: PropTypes.shape({
|
|
81
|
+
/**
|
|
82
|
+
* Styles applied to the component root class.
|
|
83
|
+
*/
|
|
84
|
+
root: PropTypes.string,
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Styles applied to the component root class when in single layout mode.
|
|
88
|
+
*/
|
|
89
|
+
single: PropTypes.string,
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Styles applied to the component root class when in single dual mode.
|
|
93
|
+
*/
|
|
94
|
+
dual: PropTypes.string,
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Styles applied to the component root class when in single fluid mode.
|
|
98
|
+
*/
|
|
99
|
+
fluid: PropTypes.string,
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Styles applied to the title element.
|
|
103
|
+
*/
|
|
104
|
+
title: PropTypes.string,
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Styles applied to the actions container.
|
|
108
|
+
*/
|
|
109
|
+
actionsContainer: PropTypes.string,
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Styles applied to the footer container.
|
|
113
|
+
*/
|
|
114
|
+
footerContainer: PropTypes.string,
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Styles applied to the panel when closed.
|
|
118
|
+
*/
|
|
119
|
+
closed: PropTypes.string,
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Styles applied to the panel when open.
|
|
123
|
+
*/
|
|
124
|
+
open: PropTypes.string,
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Styles applied to the action item root.
|
|
128
|
+
*/
|
|
129
|
+
item: PropTypes.string,
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Styles applied to the action item when selected.
|
|
133
|
+
*/
|
|
134
|
+
itemSelected: PropTypes.string,
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Styles applied to the action item when disabled.
|
|
138
|
+
*/
|
|
139
|
+
itemDisabled: PropTypes.string,
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Styles applied to the action item typography.
|
|
143
|
+
*/
|
|
144
|
+
itemTrigger: PropTypes.string,
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Styles applied to the action item icon.
|
|
148
|
+
*/
|
|
149
|
+
itemIcon: PropTypes.string,
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Styles applied to the action item title.
|
|
153
|
+
*/
|
|
154
|
+
itemTitle: PropTypes.string,
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Styles applied to the action item info icon.
|
|
158
|
+
*/
|
|
159
|
+
itemInfoIcon: PropTypes.string
|
|
160
|
+
}).isRequired,
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Number of columns to render. One, two, or whatever fits the component's width.
|
|
164
|
+
*/
|
|
165
|
+
layout: PropTypes.oneOf(["single", "dual", "fluid"]),
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Title to be displayed on the header of the component.
|
|
169
|
+
*/
|
|
170
|
+
title: PropTypes.string,
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* The list of applications to be used to render the actions on the component.
|
|
174
|
+
*/
|
|
175
|
+
applications: PropTypes.arrayOf(PropTypes.shape({
|
|
176
|
+
/**
|
|
177
|
+
* Id of the application.
|
|
178
|
+
*/
|
|
179
|
+
id: PropTypes.string,
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Name of the application, this is the value that will be displayed on the component.
|
|
183
|
+
*/
|
|
184
|
+
name: PropTypes.string.isRequired,
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* URL with the icon location to be used to represent the application.
|
|
188
|
+
* iconUrl will only be used if no iconElement is provided.
|
|
189
|
+
*/
|
|
190
|
+
iconUrl: PropTypes.string,
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Element to be added as the icon representing the application.
|
|
194
|
+
* The iconElement will be the primary option to be displayed.
|
|
195
|
+
*/
|
|
196
|
+
iconElement: PropTypes.element,
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Small description of the application.
|
|
200
|
+
*/
|
|
201
|
+
description: PropTypes.string,
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* URL where the application is accesible.
|
|
205
|
+
*/
|
|
206
|
+
url: PropTypes.string,
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Defines if the application should be opened in the same tab or in a new one.
|
|
210
|
+
*/
|
|
211
|
+
target: PropTypes.oneOf(["_top", "_blank"]),
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* If true, the item will be disabled.
|
|
215
|
+
*/
|
|
216
|
+
disabled: PropTypes.bool,
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* True when the application is selected, false otherwise.
|
|
220
|
+
*/
|
|
221
|
+
isSelected: PropTypes.bool
|
|
222
|
+
})).isRequired,
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Triggered when an action is clicked.
|
|
226
|
+
*/
|
|
227
|
+
onActionClickedCallback: PropTypes.func,
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Must return a boolean stating if the action element is selected or not.
|
|
231
|
+
*/
|
|
232
|
+
isActionSelectedCallback: PropTypes.func,
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Element to be added to the header container, if none is provided a label with the title will be added.
|
|
236
|
+
*/
|
|
237
|
+
header: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Element to be added to the footer container.
|
|
241
|
+
*/
|
|
242
|
+
footer: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Flag stating if the panel is opened or closed.
|
|
246
|
+
*
|
|
247
|
+
* @deprecated This logic should be external, i.e. using the HvAppSwitcher inside a Drawer component.
|
|
248
|
+
*/
|
|
249
|
+
isOpen: deprecatedPropType(PropTypes.bool)
|
|
250
|
+
} : void 0;
|
|
251
|
+
export default withStyles(styles, {
|
|
252
|
+
name: "HvAppSwitcher"
|
|
253
|
+
})(AppSwitcher);
|
|
254
|
+
//# sourceMappingURL=AppSwitcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/AppSwitcher/AppSwitcher.js"],"names":["React","PropTypes","clsx","deprecatedPropType","withStyles","HvListContainer","styles","TitleWithTooltip","Action","AppSwitcher","props","id","className","classes","layout","title","applications","onActionClickedCallback","isActionSelectedCallback","header","footer","isOpen","actionClicked","event","application","panelActions","map","name","url","root","item","selected","itemSelected","disabled","itemDisabled","typography","itemTrigger","icon","itemIcon","itemTitle","iconInfo","itemInfoIcon","undefined","closed","open","actionsContainer","footerContainer","propTypes","string","shape","single","dual","fluid","isRequired","oneOf","arrayOf","iconUrl","iconElement","element","description","target","bool","isSelected","func","oneOfType","node"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,IAAP,MAAiB,MAAjB;AACA,SAASC,kBAAT,EAA6BC,UAA7B,QAA+C,mBAA/C;AAEA,SAASC,eAAT,QAAgC,IAAh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S,CAAC4D,IAAX;AA9JJ,CAAxB;AAiKA,eAAezD,UAAU,CAACE,MAAD,EAAS;AAAEqB,EAAAA,IAAI,EAAE;AAAR,CAAT,CAAV,CAA8ClB,WAA9C,CAAf","sourcesContent":["import React from \"react\";\nimport PropTypes from \"prop-types\";\n\nimport clsx from \"clsx\";\nimport { deprecatedPropType, withStyles } from \"@material-ui/core\";\n\nimport { HvListContainer } from \"..\";\n\nimport styles from \"./styles\";\n\nimport TitleWithTooltip from \"./TitleWithTooltip\";\nimport Action from \"./Action\";\n\nconst AppSwitcher = (props) => {\n const {\n id,\n\n className,\n classes,\n\n layout = \"single\",\n\n title,\n applications,\n\n onActionClickedCallback = () => {},\n isActionSelectedCallback = () => false,\n\n header,\n footer,\n\n isOpen,\n } = props;\n\n const actionClicked = (event, application) => {\n onActionClickedCallback?.(event, application);\n };\n\n const panelActions = applications.map((application) => {\n if (application.name) {\n return (\n <Action\n key={application.id || `${application.name}_${application.url}`}\n application={application}\n onClickCallback={actionClicked}\n isSelectedCallback={isActionSelectedCallback}\n classes={{\n root: classes.item,\n selected: classes.itemSelected,\n disabled: classes.itemDisabled,\n typography: classes.itemTrigger,\n icon: classes.itemIcon,\n title: classes.itemTitle,\n iconInfo: classes.itemInfoIcon,\n }}\n />\n );\n }\n\n return undefined;\n });\n\n return (\n <div\n id={id}\n className={clsx(className, classes.root, classes[layout], {\n [classes.closed]: isOpen === false,\n [classes.open]: isOpen,\n })}\n >\n {(header && <div className={classes.title}>{header}</div>) ||\n (title && <TitleWithTooltip className={classes.title} title={title} />)}\n <HvListContainer disableGutters className={classes.actionsContainer}>\n {panelActions}\n </HvListContainer>\n {footer && <div className={classes.footerContainer}>{footer}</div>}\n </div>\n );\n};\n\nAppSwitcher.propTypes = {\n /**\n * Identifier to be applied to the root element.\n */\n id: PropTypes.string,\n\n /**\n * Class names to be applied to the root element.\n */\n className: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the component root class.\n */\n root: PropTypes.string,\n /**\n * Styles applied to the component root class when in single layout mode.\n */\n single: PropTypes.string,\n /**\n * Styles applied to the component root class when in single dual mode.\n */\n dual: PropTypes.string,\n /**\n * Styles applied to the component root class when in single fluid mode.\n */\n fluid: PropTypes.string,\n /**\n * Styles applied to the title element.\n */\n title: PropTypes.string,\n /**\n * Styles applied to the actions container.\n */\n actionsContainer: PropTypes.string,\n /**\n * Styles applied to the footer container.\n */\n footerContainer: PropTypes.string,\n /**\n * Styles applied to the panel when closed.\n */\n closed: PropTypes.string,\n /**\n * Styles applied to the panel when open.\n */\n open: PropTypes.string,\n /**\n * Styles applied to the action item root.\n */\n item: PropTypes.string,\n /**\n * Styles applied to the action item when selected.\n */\n itemSelected: PropTypes.string,\n /**\n * Styles applied to the action item when disabled.\n */\n itemDisabled: PropTypes.string,\n /**\n * Styles applied to the action item typography.\n */\n itemTrigger: PropTypes.string,\n /**\n * Styles applied to the action item icon.\n */\n itemIcon: PropTypes.string,\n /**\n * Styles applied to the action item title.\n */\n itemTitle: PropTypes.string,\n /**\n * Styles applied to the action item info icon.\n */\n itemInfoIcon: PropTypes.string,\n }).isRequired,\n\n /**\n * Number of columns to render. One, two, or whatever fits the component's width.\n */\n layout: PropTypes.oneOf([\"single\", \"dual\", \"fluid\"]),\n\n /**\n * Title to be displayed on the header of the component.\n */\n title: PropTypes.string,\n /**\n * The list of applications to be used to render the actions on the component.\n */\n applications: PropTypes.arrayOf(\n PropTypes.shape({\n /**\n * Id of the application.\n */\n id: PropTypes.string,\n /**\n * Name of the application, this is the value that will be displayed on the component.\n */\n name: PropTypes.string.isRequired,\n /**\n * URL with the icon location to be used to represent the application.\n * iconUrl will only be used if no iconElement is provided.\n */\n iconUrl: PropTypes.string,\n /**\n * Element to be added as the icon representing the application.\n * The iconElement will be the primary option to be displayed.\n */\n iconElement: PropTypes.element,\n /**\n * Small description of the application.\n */\n description: PropTypes.string,\n /**\n * URL where the application is accesible.\n */\n url: PropTypes.string,\n /**\n * Defines if the application should be opened in the same tab or in a new one.\n */\n target: PropTypes.oneOf([\"_top\", \"_blank\"]),\n /**\n * If true, the item will be disabled.\n */\n disabled: PropTypes.bool,\n /**\n * True when the application is selected, false otherwise.\n */\n isSelected: PropTypes.bool,\n })\n ).isRequired,\n\n /**\n * Triggered when an action is clicked.\n */\n onActionClickedCallback: PropTypes.func,\n /**\n * Must return a boolean stating if the action element is selected or not.\n */\n isActionSelectedCallback: PropTypes.func,\n\n /**\n * Element to be added to the header container, if none is provided a label with the title will be added.\n */\n header: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),\n /**\n * Element to be added to the footer container.\n */\n footer: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),\n\n /**\n * Flag stating if the panel is opened or closed.\n *\n * @deprecated This logic should be external, i.e. using the HvAppSwitcher inside a Drawer component.\n */\n isOpen: deprecatedPropType(PropTypes.bool),\n};\n\nexport default withStyles(styles, { name: \"HvAppSwitcher\" })(AppSwitcher);\n"],"file":"AppSwitcher.js"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
|
2
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import { HvTooltip, HvTypography } from "..";
|
|
5
|
+
|
|
6
|
+
const TitleWithTooltip = ({
|
|
7
|
+
className,
|
|
8
|
+
title
|
|
9
|
+
}) => {
|
|
10
|
+
const [isOverflowed, setIsOverflowed] = useState(false);
|
|
11
|
+
const textRef = useRef();
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (textRef !== null && textRef !== void 0 && textRef.current) {
|
|
14
|
+
setIsOverflowed(textRef.current.scrollWidth > textRef.current.clientWidth || textRef.current.scrollHeight > textRef.current.clientHeight);
|
|
15
|
+
}
|
|
16
|
+
}, []);
|
|
17
|
+
return /*#__PURE__*/React.createElement(HvTooltip, {
|
|
18
|
+
disableHoverListener: !isOverflowed,
|
|
19
|
+
placement: "top-start",
|
|
20
|
+
title: /*#__PURE__*/React.createElement(HvTypography, null, title)
|
|
21
|
+
}, /*#__PURE__*/React.createElement(HvTypography, {
|
|
22
|
+
variant: "highlightText",
|
|
23
|
+
component: "span",
|
|
24
|
+
ref: textRef,
|
|
25
|
+
className: className
|
|
26
|
+
}, title));
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
process.env.NODE_ENV !== "production" ? TitleWithTooltip.propTypes = {
|
|
30
|
+
/**
|
|
31
|
+
* Class names to be applied to the root element.
|
|
32
|
+
*/
|
|
33
|
+
className: PropTypes.string,
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Title to be displayed.
|
|
37
|
+
*/
|
|
38
|
+
title: PropTypes.string
|
|
39
|
+
} : void 0;
|
|
40
|
+
export default TitleWithTooltip;
|
|
41
|
+
//# sourceMappingURL=TitleWithTooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/AppSwitcher/TitleWithTooltip.js"],"names":["React","useEffect","useRef","useState","PropTypes","HvTooltip","HvTypography","TitleWithTooltip","className","title","isOverflowed","setIsOverflowed","textRef","current","scrollWidth","clientWidth","scrollHeight","clientHeight","propTypes","string"],"mappings":";AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,MAA3B,EAAmCC,QAAnC,QAAmD,OAAnD;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,SAASC,SAAT,EAAoBC,YAApB,QAAwC,IAAxC;;AAEA,MAAMC,gBAAgB,GAAG,CAAC;AAAEC,EAAAA,SAAF;AAAaC,EAAAA;AAAb,CAAD,KAA0B;AACjD,QAAM,CAACC,YAAD,EAAeC,eAAf,IAAkCR,QAAQ,CAAC,KAAD,CAAhD;AACA,QAAMS,OAAO,GAAGV,MAAM,EAAtB;AAEAD,EAAAA,SAAS,CAAC,MAAM;AACd,QAAIW,OAAJ,aAAIA,OAAJ,eAAIA,OAAO,CAAEC,OAAb,EAAsB;AACpBF,MAAAA,eAAe,CACbC,OAAO,CAACC,OAAR,CAAgBC,WAAhB,GAA8BF,OAAO,CAACC,OAAR,CAAgBE,WAA9C,IACEH,OAAO,CAACC,OAAR,CAAgBG,YAAhB,GAA+BJ,OAAO,CAACC,OAAR,CAAgBI,YAFpC,CAAf;AAID;AACF,GAPQ,EAON,EAPM,CAAT;AASA,sBACE,oBAAC,SAAD;AACE,IAAA,oBAAoB,EAAE,CAACP,YADzB;AAEE,IAAA,SAAS,EAAC,WAFZ;AAGE,IAAA,KAAK,eAAE,oBAAC,YAAD,QAAeD,KAAf;AAHT,kBAKE,oBAAC,YAAD;AAAc,IAAA,OAAO,EAAC,eAAtB;AAAsC,IAAA,SAAS,EAAC,MAAhD;AAAuD,IAAA,GAAG,EAAEG,OAA5D;AAAqE,IAAA,SAAS,EAAEJ;AAAhF,KACGC,KADH,CALF,CADF;AAWD,CAxBD;;AA0BA,wCAAAF,gBAAgB,CAACW,SAAjB,GAA6B;AAC3B;AACF;AACA;AACEV,EAAAA,SAAS,EAAEJ,SAAS,CAACe,MAJM;;AAK3B;AACF;AACA;AACEV,EAAAA,KAAK,EAAEL,SAAS,CAACe;AARU,CAA7B;AAWA,eAAeZ,gBAAf","sourcesContent":["import React, { useEffect, useRef, useState } from \"react\";\nimport PropTypes from \"prop-types\";\n\nimport { HvTooltip, HvTypography } from \"..\";\n\nconst TitleWithTooltip = ({ className, title }) => {\n const [isOverflowed, setIsOverflowed] = useState(false);\n const textRef = useRef();\n\n useEffect(() => {\n if (textRef?.current) {\n setIsOverflowed(\n textRef.current.scrollWidth > textRef.current.clientWidth ||\n textRef.current.scrollHeight > textRef.current.clientHeight\n );\n }\n }, []);\n\n return (\n <HvTooltip\n disableHoverListener={!isOverflowed}\n placement=\"top-start\"\n title={<HvTypography>{title}</HvTypography>}\n >\n <HvTypography variant=\"highlightText\" component=\"span\" ref={textRef} className={className}>\n {title}\n </HvTypography>\n </HvTooltip>\n );\n};\n\nTitleWithTooltip.propTypes = {\n /**\n * Class names to be applied to the root element.\n */\n className: PropTypes.string,\n /**\n * Title to be displayed.\n */\n title: PropTypes.string,\n};\n\nexport default TitleWithTooltip;\n"],"file":"TitleWithTooltip.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/AppSwitcher/index.js"],"names":["default","HvAppSwitcherAction"],"mappings":"AAAA,SAASA,OAAT,QAAwB,eAAxB;AACA,SAASA,OAAO,IAAIC,mBAApB,QAA+C,UAA/C","sourcesContent":["export { default } from \"./AppSwitcher\";\nexport { default as HvAppSwitcherAction } from \"./Action\";\n"],"file":"index.js"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
|
|
7
|
+
const styles = theme => ({
|
|
8
|
+
root: {
|
|
9
|
+
display: "flex",
|
|
10
|
+
flexDirection: "column",
|
|
11
|
+
overflow: "hidden",
|
|
12
|
+
// we need to play with the 4px because of the focus ring
|
|
13
|
+
padding: `${theme.hv.spacing.sm - 4}px 0 ${theme.hv.spacing.sm - 4}px ${theme.hv.spacing.sm - 4}px`,
|
|
14
|
+
backgroundColor: theme.hv.palette.atmosphere.atmo1
|
|
15
|
+
},
|
|
16
|
+
single: {
|
|
17
|
+
width: 320
|
|
18
|
+
},
|
|
19
|
+
dual: {
|
|
20
|
+
width: 620
|
|
21
|
+
},
|
|
22
|
+
fluid: {},
|
|
23
|
+
closed: {
|
|
24
|
+
display: "none"
|
|
25
|
+
},
|
|
26
|
+
open: {
|
|
27
|
+
zIndex: "1200",
|
|
28
|
+
position: "absolute",
|
|
29
|
+
top: "50px",
|
|
30
|
+
overflowX: "hidden",
|
|
31
|
+
boxShadow: theme.hv.shadows[1]
|
|
32
|
+
},
|
|
33
|
+
title: {
|
|
34
|
+
minHeight: 36,
|
|
35
|
+
// we need to play with the 4px because of the focus ring
|
|
36
|
+
padding: `4px ${theme.hv.spacing.sm}px ${theme.hv.spacing.sm - 4}px 4px`,
|
|
37
|
+
overflow: "hidden",
|
|
38
|
+
whiteSpace: "nowrap",
|
|
39
|
+
textOverflow: "ellipsis"
|
|
40
|
+
},
|
|
41
|
+
actionsContainer: {
|
|
42
|
+
display: "flex",
|
|
43
|
+
flexWrap: "wrap",
|
|
44
|
+
justifyContent: "flex-start",
|
|
45
|
+
overflowY: "auto",
|
|
46
|
+
// we need to play with the 4px because of the focus ring
|
|
47
|
+
padding: "4px 0 4px 4px"
|
|
48
|
+
},
|
|
49
|
+
footerContainer: _objectSpread({
|
|
50
|
+
display: "flex",
|
|
51
|
+
alignItems: "center",
|
|
52
|
+
marginTop: "auto",
|
|
53
|
+
height: 52,
|
|
54
|
+
// we need to play with the 4px because of the focus ring
|
|
55
|
+
padding: `${theme.hv.spacing.sm - 4}px ${theme.hv.spacing.sm + 4}px 4px 4px`
|
|
56
|
+
}, theme.hv.typography.highlightText),
|
|
57
|
+
item: {},
|
|
58
|
+
itemSelected: {},
|
|
59
|
+
itemDisabled: {},
|
|
60
|
+
itemTypography: {},
|
|
61
|
+
itemIcon: {},
|
|
62
|
+
itemTitle: {},
|
|
63
|
+
itemInfo: {}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export default styles;
|
|
67
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/AppSwitcher/styles.js"],"names":["styles","theme","root","display","flexDirection","overflow","padding","hv","spacing","sm","backgroundColor","palette","atmosphere","atmo1","single","width","dual","fluid","closed","open","zIndex","position","top","overflowX","boxShadow","shadows","title","minHeight","whiteSpace","textOverflow","actionsContainer","flexWrap","justifyContent","overflowY","footerContainer","alignItems","marginTop","height","typography","highlightText","item","itemSelected","itemDisabled","itemTypography","itemIcon","itemTitle","itemInfo"],"mappings":";;;;;;AAAA,MAAMA,MAAM,GAAIC,KAAD,KAAY;AACzBC,EAAAA,IAAI,EAAE;AACJC,IAAAA,OAAO,EAAE,MADL;AAEJC,IAAAA,aAAa,EAAE,QAFX;AAIJC,IAAAA,QAAQ,EAAE,QAJN;AAMJ;AACAC,IAAAA,OAAO,EAAG,GAAEL,KAAK,CAACM,EAAN,CAASC,OAAT,CAAiBC,EAAjB,GAAsB,CAAE,QAAOR,KAAK,CAACM,EAAN,CAASC,OAAT,CAAiBC,EAAjB,GAAsB,CAAE,MACjER,KAAK,CAACM,EAAN,CAASC,OAAT,CAAiBC,EAAjB,GAAsB,CACvB,IATG;AAWJC,IAAAA,eAAe,EAAET,KAAK,CAACM,EAAN,CAASI,OAAT,CAAiBC,UAAjB,CAA4BC;AAXzC,GADmB;AAezBC,EAAAA,MAAM,EAAE;AACNC,IAAAA,KAAK,EAAE;AADD,GAfiB;AAkBzBC,EAAAA,IAAI,EAAE;AACJD,IAAAA,KAAK,EAAE;AADH,GAlBmB;AAqBzBE,EAAAA,KAAK,EAAE,EArBkB;AAuBzBC,EAAAA,MAAM,EAAE;AACNf,IAAAA,OAAO,EAAE;AADH,GAvBiB;AA0BzBgB,EAAAA,IAAI,EAAE;AACJC,IAAAA,MAAM,EAAE,MADJ;AAEJC,IAAAA,QAAQ,EAAE,UAFN;AAGJC,IAAAA,GAAG,EAAE,MA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C,EAAAA,SAAS,EAAE,EA3Ec;AA4EzBC,EAAAA,QAAQ,EAAE;AA5Ee,CAAZ,CAAf;;AA+EA,eAAe9C,MAAf","sourcesContent":["const styles = (theme) => ({\n root: {\n display: \"flex\",\n flexDirection: \"column\",\n\n overflow: \"hidden\",\n\n // we need to play with the 4px because of the focus ring\n padding: `${theme.hv.spacing.sm - 4}px 0 ${theme.hv.spacing.sm - 4}px ${\n theme.hv.spacing.sm - 4\n }px`,\n\n backgroundColor: theme.hv.palette.atmosphere.atmo1,\n },\n\n single: {\n width: 320,\n },\n dual: {\n width: 620,\n },\n fluid: {},\n\n closed: {\n display: \"none\",\n },\n open: {\n zIndex: \"1200\",\n position: \"absolute\",\n top: \"50px\",\n overflowX: \"hidden\",\n boxShadow: theme.hv.shadows[1],\n },\n\n title: {\n minHeight: 36,\n\n // we need to play with the 4px because of the focus ring\n padding: `4px ${theme.hv.spacing.sm}px ${theme.hv.spacing.sm - 4}px 4px`,\n\n overflow: \"hidden\",\n whiteSpace: \"nowrap\",\n textOverflow: \"ellipsis\",\n },\n\n actionsContainer: {\n display: \"flex\",\n flexWrap: \"wrap\",\n justifyContent: \"flex-start\",\n\n overflowY: \"auto\",\n\n // we need to play with the 4px because of the focus ring\n padding: \"4px 0 4px 4px\",\n },\n\n footerContainer: {\n display: \"flex\",\n alignItems: \"center\",\n\n marginTop: \"auto\",\n\n height: 52,\n\n // we need to play with the 4px because of the focus ring\n padding: `${theme.hv.spacing.sm - 4}px ${theme.hv.spacing.sm + 4}px 4px 4px`,\n\n ...theme.hv.typography.highlightText,\n },\n\n item: {},\n itemSelected: {},\n itemDisabled: {},\n itemTypography: {},\n itemIcon: {},\n itemTitle: {},\n itemInfo: {},\n});\n\nexport default styles;\n"],"file":"styles.js"}
|
|
@@ -76,6 +76,10 @@ export interface HvAvatarProps
|
|
|
76
76
|
* A string representing the color of the avatar badge.
|
|
77
77
|
*/
|
|
78
78
|
badge?: "sema0" | HvSemanticColorKeys | HvAtmosphereColorKeys;
|
|
79
|
+
/**
|
|
80
|
+
* Attributes applied to the container element.
|
|
81
|
+
*/
|
|
82
|
+
containerProps: object;
|
|
79
83
|
}
|
|
80
84
|
|
|
81
85
|
export default function HvAvatar(props: HvAvatarProps): JSX.Element | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
const _excluded = ["className", "style", "classes", "children", "component", "size", "backgroundColor", "color", "src", "srcSet", "sizes", "alt", "imgProps", "status", "badge", "variant"];
|
|
4
|
+
const _excluded = ["className", "style", "classes", "children", "component", "size", "backgroundColor", "color", "src", "srcSet", "sizes", "alt", "imgProps", "status", "badge", "variant", "containerProps"];
|
|
5
5
|
|
|
6
6
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
7
|
|
|
@@ -65,7 +65,8 @@ const HvAvatar = props => {
|
|
|
65
65
|
imgProps,
|
|
66
66
|
status,
|
|
67
67
|
badge,
|
|
68
|
-
variant = "circular"
|
|
68
|
+
variant = "circular",
|
|
69
|
+
containerProps
|
|
69
70
|
} = props,
|
|
70
71
|
others = _objectWithoutProperties(props, _excluded); // S, M and L are now deprecated, this intends to normalize the size to the new norm of XS, SM, MD, LG and XL
|
|
71
72
|
|
|
@@ -121,12 +122,17 @@ const HvAvatar = props => {
|
|
|
121
122
|
}
|
|
122
123
|
|
|
123
124
|
const badgeColor = getColor(theme, badge, theme.hv.palette.semantic.sema1);
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
125
|
+
/**
|
|
126
|
+
* Note: on the next major release this should be updated. the `others` prop should be
|
|
127
|
+
* used in the container instead of the `containerProps` and a new `avatarProps`
|
|
128
|
+
* should be created to pass on any props down to the avatar component. This wasn't
|
|
129
|
+
* done now in order to not break the current API. Also, consider using the `root` class
|
|
130
|
+
* on the container element as it makes more semantic sense.
|
|
131
|
+
*/
|
|
132
|
+
|
|
133
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
134
|
+
className: classes.container
|
|
135
|
+
}, containerProps), /*#__PURE__*/React.createElement("div", {
|
|
130
136
|
className: clsx(classes.status, classes[variant], classes[normalizedSize]),
|
|
131
137
|
style: statusInlineStyle
|
|
132
138
|
}, badge && /*#__PURE__*/React.createElement("div", {
|
|
@@ -294,7 +300,12 @@ process.env.NODE_ENV !== "production" ? HvAvatar.propTypes = {
|
|
|
294
300
|
/**
|
|
295
301
|
* A string representing the color of the avatar badge.
|
|
296
302
|
*/
|
|
297
|
-
badge: PropTypes.string
|
|
303
|
+
badge: PropTypes.string,
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Attributes applied to the container element.
|
|
307
|
+
*/
|
|
308
|
+
containerProps: PropTypes.instanceOf(Object)
|
|
298
309
|
} : void 0;
|
|
299
310
|
export default withStyles(styles, {
|
|
300
311
|
name: "HvAvatar"
|