@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,52 @@
|
|
|
1
|
+
var styles = function styles(theme) {
|
|
2
|
+
return {
|
|
3
|
+
root: {
|
|
4
|
+
width: "100%",
|
|
5
|
+
maxWidth: 280,
|
|
6
|
+
minHeight: 52,
|
|
7
|
+
marginRight: theme.hv.spacing.sm
|
|
8
|
+
},
|
|
9
|
+
disabled: {},
|
|
10
|
+
selected: {},
|
|
11
|
+
typography: {
|
|
12
|
+
display: "flex",
|
|
13
|
+
justifyContent: "flex-start",
|
|
14
|
+
alignItems: "center",
|
|
15
|
+
width: "100%",
|
|
16
|
+
minHeight: 52,
|
|
17
|
+
padding: "6px ".concat(theme.hv.spacing.xs, "px"),
|
|
18
|
+
border: "none",
|
|
19
|
+
borderLeft: "solid 2px ".concat(theme.hv.palette.accent.acce1),
|
|
20
|
+
cursor: "pointer",
|
|
21
|
+
textDecoration: "inherit",
|
|
22
|
+
color: "inherit",
|
|
23
|
+
backgroundColor: "inherit",
|
|
24
|
+
"$disabled &": {
|
|
25
|
+
cursor: "not-allowed"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
icon: {
|
|
29
|
+
display: "flex",
|
|
30
|
+
minWidth: 40,
|
|
31
|
+
justifyContent: "center"
|
|
32
|
+
},
|
|
33
|
+
title: {
|
|
34
|
+
flexGrow: 1,
|
|
35
|
+
margin: "0 ".concat(theme.hv.spacing.xs, "px"),
|
|
36
|
+
textAlign: "left",
|
|
37
|
+
overflow: "hidden",
|
|
38
|
+
whiteSpace: "nowrap",
|
|
39
|
+
textOverflow: "ellipsis",
|
|
40
|
+
color: "inherit"
|
|
41
|
+
},
|
|
42
|
+
iconInfo: {
|
|
43
|
+
minWidth: 32
|
|
44
|
+
},
|
|
45
|
+
iconUrl: {
|
|
46
|
+
width: 32
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default styles;
|
|
52
|
+
//# 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,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,IAAI,EAAE;AACJC,MAAAA,KAAK,EAAE,MADH;AAEJC,MAAAA,QAAQ,EAAE,GAFN;AAGJC,MAAAA,SAAS,EAAE,EAHP;AAIJC,MAAAA,WAAW,EAAEL,KAAK,CAACM,EAAN,CAASC,OAAT,CAAiBC;AAJ1B,KADmB;AAOzBC,IAAAA,QAAQ,EAAE,EAPe;AAQzBC,IAAAA,QAAQ,EAAE,EARe;AAUzBC,IAAAA,UAAU,EAAE;AACVC,MAAAA,OAAO,EAAE,MADC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.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,260 @@
|
|
|
1
|
+
import "core-js/modules/es.array.map.js";
|
|
2
|
+
import "core-js/modules/es.function.name.js";
|
|
3
|
+
import "core-js/modules/es.array.concat.js";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import PropTypes from "prop-types";
|
|
6
|
+
import clsx from "clsx";
|
|
7
|
+
import { deprecatedPropType, withStyles } from "@material-ui/core";
|
|
8
|
+
import { HvListContainer } from "..";
|
|
9
|
+
import styles from "./styles";
|
|
10
|
+
import TitleWithTooltip from "./TitleWithTooltip";
|
|
11
|
+
import Action from "./Action";
|
|
12
|
+
|
|
13
|
+
var AppSwitcher = function AppSwitcher(props) {
|
|
14
|
+
var id = props.id,
|
|
15
|
+
className = props.className,
|
|
16
|
+
classes = props.classes,
|
|
17
|
+
_props$layout = props.layout,
|
|
18
|
+
layout = _props$layout === void 0 ? "single" : _props$layout,
|
|
19
|
+
title = props.title,
|
|
20
|
+
applications = props.applications,
|
|
21
|
+
_props$onActionClicke = props.onActionClickedCallback,
|
|
22
|
+
onActionClickedCallback = _props$onActionClicke === void 0 ? function () {} : _props$onActionClicke,
|
|
23
|
+
_props$isActionSelect = props.isActionSelectedCallback,
|
|
24
|
+
isActionSelectedCallback = _props$isActionSelect === void 0 ? function () {
|
|
25
|
+
return false;
|
|
26
|
+
} : _props$isActionSelect,
|
|
27
|
+
header = props.header,
|
|
28
|
+
footer = props.footer,
|
|
29
|
+
isOpen = props.isOpen;
|
|
30
|
+
|
|
31
|
+
var actionClicked = function actionClicked(event, application) {
|
|
32
|
+
onActionClickedCallback === null || onActionClickedCallback === void 0 ? void 0 : onActionClickedCallback(event, application);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var panelActions = applications.map(function (application) {
|
|
36
|
+
if (application.name) {
|
|
37
|
+
return /*#__PURE__*/React.createElement(Action, {
|
|
38
|
+
key: application.id || "".concat(application.name, "_").concat(application.url),
|
|
39
|
+
application: application,
|
|
40
|
+
onClickCallback: actionClicked,
|
|
41
|
+
isSelectedCallback: isActionSelectedCallback,
|
|
42
|
+
classes: {
|
|
43
|
+
root: classes.item,
|
|
44
|
+
selected: classes.itemSelected,
|
|
45
|
+
disabled: classes.itemDisabled,
|
|
46
|
+
typography: classes.itemTrigger,
|
|
47
|
+
icon: classes.itemIcon,
|
|
48
|
+
title: classes.itemTitle,
|
|
49
|
+
iconInfo: classes.itemInfoIcon
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return undefined;
|
|
55
|
+
});
|
|
56
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
57
|
+
id: id,
|
|
58
|
+
className: clsx(className, classes.root, classes[layout], isOpen === false && classes.closed, isOpen && classes.open)
|
|
59
|
+
}, header && /*#__PURE__*/React.createElement("div", {
|
|
60
|
+
className: classes.title
|
|
61
|
+
}, header) || title && /*#__PURE__*/React.createElement(TitleWithTooltip, {
|
|
62
|
+
className: classes.title,
|
|
63
|
+
title: title
|
|
64
|
+
}), /*#__PURE__*/React.createElement(HvListContainer, {
|
|
65
|
+
disableGutters: true,
|
|
66
|
+
className: classes.actionsContainer
|
|
67
|
+
}, panelActions), footer && /*#__PURE__*/React.createElement("div", {
|
|
68
|
+
className: classes.footerContainer
|
|
69
|
+
}, footer));
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
process.env.NODE_ENV !== "production" ? AppSwitcher.propTypes = {
|
|
73
|
+
/**
|
|
74
|
+
* Identifier to be applied to the root element.
|
|
75
|
+
*/
|
|
76
|
+
id: PropTypes.string,
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Class names to be applied to the root element.
|
|
80
|
+
*/
|
|
81
|
+
className: PropTypes.string,
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* A Jss Object used to override or extend the styles applied.
|
|
85
|
+
*/
|
|
86
|
+
classes: PropTypes.shape({
|
|
87
|
+
/**
|
|
88
|
+
* Styles applied to the component root class.
|
|
89
|
+
*/
|
|
90
|
+
root: PropTypes.string,
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Styles applied to the component root class when in single layout mode.
|
|
94
|
+
*/
|
|
95
|
+
single: PropTypes.string,
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Styles applied to the component root class when in single dual mode.
|
|
99
|
+
*/
|
|
100
|
+
dual: PropTypes.string,
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Styles applied to the component root class when in single fluid mode.
|
|
104
|
+
*/
|
|
105
|
+
fluid: PropTypes.string,
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Styles applied to the title element.
|
|
109
|
+
*/
|
|
110
|
+
title: PropTypes.string,
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Styles applied to the actions container.
|
|
114
|
+
*/
|
|
115
|
+
actionsContainer: PropTypes.string,
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Styles applied to the footer container.
|
|
119
|
+
*/
|
|
120
|
+
footerContainer: PropTypes.string,
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Styles applied to the panel when closed.
|
|
124
|
+
*/
|
|
125
|
+
closed: PropTypes.string,
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Styles applied to the panel when open.
|
|
129
|
+
*/
|
|
130
|
+
open: PropTypes.string,
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Styles applied to the action item root.
|
|
134
|
+
*/
|
|
135
|
+
item: PropTypes.string,
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Styles applied to the action item when selected.
|
|
139
|
+
*/
|
|
140
|
+
itemSelected: PropTypes.string,
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Styles applied to the action item when disabled.
|
|
144
|
+
*/
|
|
145
|
+
itemDisabled: PropTypes.string,
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Styles applied to the action item typography.
|
|
149
|
+
*/
|
|
150
|
+
itemTrigger: PropTypes.string,
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Styles applied to the action item icon.
|
|
154
|
+
*/
|
|
155
|
+
itemIcon: PropTypes.string,
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Styles applied to the action item title.
|
|
159
|
+
*/
|
|
160
|
+
itemTitle: PropTypes.string,
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Styles applied to the action item info icon.
|
|
164
|
+
*/
|
|
165
|
+
itemInfoIcon: PropTypes.string
|
|
166
|
+
}).isRequired,
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Number of columns to render. One, two, or whatever fits the component's width.
|
|
170
|
+
*/
|
|
171
|
+
layout: PropTypes.oneOf(["single", "dual", "fluid"]),
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Title to be displayed on the header of the component.
|
|
175
|
+
*/
|
|
176
|
+
title: PropTypes.string,
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* The list of applications to be used to render the actions on the component.
|
|
180
|
+
*/
|
|
181
|
+
applications: PropTypes.arrayOf(PropTypes.shape({
|
|
182
|
+
/**
|
|
183
|
+
* Id of the application.
|
|
184
|
+
*/
|
|
185
|
+
id: PropTypes.string,
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Name of the application, this is the value that will be displayed on the component.
|
|
189
|
+
*/
|
|
190
|
+
name: PropTypes.string.isRequired,
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* URL with the icon location to be used to represent the application.
|
|
194
|
+
* iconUrl will only be used if no iconElement is provided.
|
|
195
|
+
*/
|
|
196
|
+
iconUrl: PropTypes.string,
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Element to be added as the icon representing the application.
|
|
200
|
+
* The iconElement will be the primary option to be displayed.
|
|
201
|
+
*/
|
|
202
|
+
iconElement: PropTypes.element,
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Small description of the application.
|
|
206
|
+
*/
|
|
207
|
+
description: PropTypes.string,
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* URL where the application is accesible.
|
|
211
|
+
*/
|
|
212
|
+
url: PropTypes.string,
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Defines if the application should be opened in the same tab or in a new one.
|
|
216
|
+
*/
|
|
217
|
+
target: PropTypes.oneOf(["_top", "_blank"]),
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* If true, the item will be disabled.
|
|
221
|
+
*/
|
|
222
|
+
disabled: PropTypes.bool,
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* True when the application is selected, false otherwise.
|
|
226
|
+
*/
|
|
227
|
+
isSelected: PropTypes.bool
|
|
228
|
+
})).isRequired,
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Triggered when an action is clicked.
|
|
232
|
+
*/
|
|
233
|
+
onActionClickedCallback: PropTypes.func,
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Must return a boolean stating if the action element is selected or not.
|
|
237
|
+
*/
|
|
238
|
+
isActionSelectedCallback: PropTypes.func,
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Element to be added to the header container, if none is provided a label with the title will be added.
|
|
242
|
+
*/
|
|
243
|
+
header: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Element to be added to the footer container.
|
|
247
|
+
*/
|
|
248
|
+
footer: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Flag stating if the panel is opened or closed.
|
|
252
|
+
*
|
|
253
|
+
* @deprecated This logic should be external, i.e. using the HvAppSwitcher inside a Drawer component.
|
|
254
|
+
*/
|
|
255
|
+
isOpen: deprecatedPropType(PropTypes.bool)
|
|
256
|
+
} : void 0;
|
|
257
|
+
export default withStyles(styles, {
|
|
258
|
+
name: "HvAppSwitcher"
|
|
259
|
+
})(AppSwitcher);
|
|
260
|
+
//# 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,IAAhC;AAEA,OAAOC,MAAP,MAAmB,UAAnB;AAEA,OAAOC,gBAAP,MAA6B,oBAA7B;AACA,OAAOC,MAAP,MAAmB,UAAnB;;AAEA,IAAMC,WAAW,GAAG,SAAdA,WAAc,CAACC,KAAD,EAAW;AAC7B,MACEC,EADF,GAkBID,KAlBJ,CACEC,EADF;AAAA,MAGEC,SAHF,GAkBIF,KAlBJ,CAGEE,SAHF;AAAA,MAIEC,OAJF,GAkBIH,KAlBJ,CAIEG,OAJF;AAAA,sBAkBIH,KAlBJ,CAMEI,MANF;AAAA,MAMEA,MANF,8BAMW,QANX;AAAA,MAQEC,KARF,GAkBIL,KAlBJ,CAQEK,KARF;AAAA,MASEC,YATF,GAkBIN,KAlBJ,CASEM,YATF;AAAA,8BAkBIN,KAlBJ,CAWEO,uBAXF;AAAA,MAWEA,uBAXF,sCAW4B,YAAM,CAAE,CAXpC;AAAA,8BAkBIP,KAlBJ,CAYEQ,wBAZF;AAAA,MAYEA,wBAZF,sCAY6B;AAAA,WAAM,KAAN;AAAA,GAZ7B;AAAA,MAcEC,MAdF,GAkBIT,KAlBJ,CAcES,MAdF;AAAA,MAeEC,MAfF,GAkBIV,KAlBJ,CAeEU,MAfF;AAAA,MAiBEC,MAjBF,GAkBIX,KAlBJ,CAiBEW,MAjBF;;AAoB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d;AACN;AACA;AACMY,IAAAA,MAAM,EAAE3D,SAAS,CAACqD,KAAV,CAAgB,CAAC,MAAD,EAAS,QAAT,CAAhB,CA9BM;;AA+Bd;AACN;AACA;AACMrB,IAAAA,QAAQ,EAAEhC,SAAS,CAAC4D,IAlCN;;AAmCd;AACN;AACA;AACMC,IAAAA,UAAU,EAAE7D,SAAS,CAAC4D;AAtCR,GAAhB,CADY,EAyCZR,UArIoB;;AAuItB;AACF;AACA;AACEpC,EAAAA,uBAAuB,EAAEhB,SAAS,CAAC8D,IA1Ib;;AA2ItB;AACF;AACA;AACE7C,EAAAA,wBAAwB,EAAEjB,SAAS,CAAC8D,IA9Id;;AAgJtB;AACF;AACA;AACE5C,EAAAA,MAAM,EAAElB,SAAS,CAAC+D,SAAV,CAAoB,CAAC/D,SAAS,CAAC+C,MAAX,EAAmB/C,SAAS,CAACgE,IAA7B,CAApB,CAnJc;;AAoJtB;AACF;AACA;AACE7C,EAAAA,MAAM,EAAEnB,SAAS,CAAC+D,SAAV,CAAoB,CAAC/D,SAAS,CAAC+C,MAAX,EAAmB/C,SAAS,CAACgE,IAA7B,CAApB,CAvJc;;AAyJtB;AACF;AACA;AACA;AACA;AACE5C,EAAAA,MAAM,EAAElB,kBAAkB,CAACF,SAAS,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,45 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import React, { useEffect, useRef, useState } from "react";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import { HvTooltip, HvTypography } from "..";
|
|
5
|
+
|
|
6
|
+
var TitleWithTooltip = function TitleWithTooltip(_ref) {
|
|
7
|
+
var className = _ref.className,
|
|
8
|
+
title = _ref.title;
|
|
9
|
+
|
|
10
|
+
var _useState = useState(false),
|
|
11
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
12
|
+
isOverflowed = _useState2[0],
|
|
13
|
+
setIsOverflowed = _useState2[1];
|
|
14
|
+
|
|
15
|
+
var textRef = useRef();
|
|
16
|
+
useEffect(function () {
|
|
17
|
+
if (textRef !== null && textRef !== void 0 && textRef.current) {
|
|
18
|
+
setIsOverflowed(textRef.current.scrollWidth > textRef.current.clientWidth || textRef.current.scrollHeight > textRef.current.clientHeight);
|
|
19
|
+
}
|
|
20
|
+
}, []);
|
|
21
|
+
return /*#__PURE__*/React.createElement(HvTooltip, {
|
|
22
|
+
disableHoverListener: !isOverflowed,
|
|
23
|
+
placement: "top-start",
|
|
24
|
+
title: /*#__PURE__*/React.createElement(HvTypography, null, title)
|
|
25
|
+
}, /*#__PURE__*/React.createElement(HvTypography, {
|
|
26
|
+
variant: "highlightText",
|
|
27
|
+
component: "span",
|
|
28
|
+
ref: textRef,
|
|
29
|
+
className: className
|
|
30
|
+
}, title));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
process.env.NODE_ENV !== "production" ? TitleWithTooltip.propTypes = {
|
|
34
|
+
/**
|
|
35
|
+
* Class names to be applied to the root element.
|
|
36
|
+
*/
|
|
37
|
+
className: PropTypes.string,
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Title to be displayed.
|
|
41
|
+
*/
|
|
42
|
+
title: PropTypes.string
|
|
43
|
+
} : void 0;
|
|
44
|
+
export default TitleWithTooltip;
|
|
45
|
+
//# 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,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAmB,OAA0B;AAAA,MAAvBC,SAAuB,QAAvBA,SAAuB;AAAA,MAAZC,KAAY,QAAZA,KAAY;;AACjD,kBAAwCN,QAAQ,CAAC,KAAD,CAAhD;AAAA;AAAA,MAAOO,YAAP;AAAA,MAAqBC,eAArB;;AACA,MAAMC,OAAO,GAAGV,MAAM,EAAtB;AAEAD,EAAAA,SAAS,CAAC,YAAM;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,78 @@
|
|
|
1
|
+
import "core-js/modules/es.object.keys.js";
|
|
2
|
+
import "core-js/modules/es.symbol.js";
|
|
3
|
+
import "core-js/modules/es.array.filter.js";
|
|
4
|
+
import "core-js/modules/es.object.to-string.js";
|
|
5
|
+
import "core-js/modules/es.object.get-own-property-descriptor.js";
|
|
6
|
+
import "core-js/modules/web.dom-collections.for-each.js";
|
|
7
|
+
import "core-js/modules/es.object.get-own-property-descriptors.js";
|
|
8
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
|
+
|
|
10
|
+
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; }
|
|
11
|
+
|
|
12
|
+
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; }
|
|
13
|
+
|
|
14
|
+
import "core-js/modules/es.array.concat.js";
|
|
15
|
+
|
|
16
|
+
var styles = function styles(theme) {
|
|
17
|
+
return {
|
|
18
|
+
root: {
|
|
19
|
+
display: "flex",
|
|
20
|
+
flexDirection: "column",
|
|
21
|
+
overflow: "hidden",
|
|
22
|
+
// we need to play with the 4px because of the focus ring
|
|
23
|
+
padding: "".concat(theme.hv.spacing.sm - 4, "px 0 ").concat(theme.hv.spacing.sm - 4, "px ").concat(theme.hv.spacing.sm - 4, "px"),
|
|
24
|
+
backgroundColor: theme.hv.palette.atmosphere.atmo1
|
|
25
|
+
},
|
|
26
|
+
single: {
|
|
27
|
+
width: 320
|
|
28
|
+
},
|
|
29
|
+
dual: {
|
|
30
|
+
width: 620
|
|
31
|
+
},
|
|
32
|
+
fluid: {},
|
|
33
|
+
closed: {
|
|
34
|
+
display: "none"
|
|
35
|
+
},
|
|
36
|
+
open: {
|
|
37
|
+
zIndex: "1200",
|
|
38
|
+
position: "absolute",
|
|
39
|
+
top: "50px",
|
|
40
|
+
overflowX: "hidden",
|
|
41
|
+
boxShadow: theme.hv.shadows[1]
|
|
42
|
+
},
|
|
43
|
+
title: {
|
|
44
|
+
minHeight: 36,
|
|
45
|
+
// we need to play with the 4px because of the focus ring
|
|
46
|
+
padding: "4px ".concat(theme.hv.spacing.sm, "px ").concat(theme.hv.spacing.sm - 4, "px 4px"),
|
|
47
|
+
overflow: "hidden",
|
|
48
|
+
whiteSpace: "nowrap",
|
|
49
|
+
textOverflow: "ellipsis"
|
|
50
|
+
},
|
|
51
|
+
actionsContainer: {
|
|
52
|
+
display: "flex",
|
|
53
|
+
flexWrap: "wrap",
|
|
54
|
+
justifyContent: "flex-start",
|
|
55
|
+
overflowY: "auto",
|
|
56
|
+
// we need to play with the 4px because of the focus ring
|
|
57
|
+
padding: "4px 0 4px 4px"
|
|
58
|
+
},
|
|
59
|
+
footerContainer: _objectSpread({
|
|
60
|
+
display: "flex",
|
|
61
|
+
alignItems: "center",
|
|
62
|
+
marginTop: "auto",
|
|
63
|
+
height: 52,
|
|
64
|
+
// we need to play with the 4px because of the focus ring
|
|
65
|
+
padding: "".concat(theme.hv.spacing.sm - 4, "px ").concat(theme.hv.spacing.sm + 4, "px 4px 4px")
|
|
66
|
+
}, theme.hv.typography.highlightText),
|
|
67
|
+
item: {},
|
|
68
|
+
itemSelected: {},
|
|
69
|
+
itemDisabled: {},
|
|
70
|
+
itemTypography: {},
|
|
71
|
+
itemIcon: {},
|
|
72
|
+
itemTitle: {},
|
|
73
|
+
itemInfo: {}
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export default styles;
|
|
78
|
+
//# 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,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,IAAI,EAAE;AACJC,MAAAA,OAAO,EAAE,MADL;AAEJC,MAAAA,aAAa,EAAE,QAFX;AAIJC,MAAAA,QAAQ,EAAE,QAJN;AAMJ;AACAC,MAAAA,OAAO,YAAKL,KAAK,CAACM,EAAN,CAASC,OAAT,CAAiBC,EAAjB,GAAsB,CAA3B,kBAAoCR,KAAK,CAACM,EAAN,CAASC,OAAT,CAAiBC,EAAjB,GAAsB,CAA1D,gBACLR,KAAK,CAACM,EAAN,CAASC,OAAT,CAAiBC,EAAjB,GAAsB,CADjB,OAPH;AAWJC,MAAAA,eAAe,EAAET,KAAK,CAACM,EAAN,CAASI,OAAT,CAAiBC,UAAjB,CAA4BC;AAXzC,KADmB;AAezBC,IAAAA,MAAM,EAAE;AACNC,MAAAA,KAAK,EAAE;AADD,KAfiB;AAkBzBC,IAAAA,IAAI,EAAE;AACJD,MAAAA,KAAK,EAAE;AADH,KAlBmB;AAqBzBE,IAAAA,KAAK,EAAE,EArBkB;AAuBzBC,IAAAA,MAAM,EAAE;AACNf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AAuEzBC,IAAAA,YAAY,EAAE,EAvEW;AAwEzBC,IAAAA,YAAY,EAAE,EAxEW;AAyEzBC,IAAAA,cAAc,EAAE,EAzES;AA0EzBC,IAAAA,QAAQ,EAAE,EA1Ee;AA2EzBC,IAAAA,SAAS,EAAE,EA3Ec;AA4EzBC,IAAAA,QAAQ,EAAE;AA5Ee,GAAZ;AAAA,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;
|
|
@@ -9,7 +9,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
9
9
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
10
10
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
11
11
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
12
|
-
var _excluded = ["className", "style", "classes", "children", "component", "size", "backgroundColor", "color", "src", "srcSet", "sizes", "alt", "imgProps", "status", "badge", "variant"];
|
|
12
|
+
var _excluded = ["className", "style", "classes", "children", "component", "size", "backgroundColor", "color", "src", "srcSet", "sizes", "alt", "imgProps", "status", "badge", "variant", "containerProps"];
|
|
13
13
|
|
|
14
14
|
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; }
|
|
15
15
|
|
|
@@ -78,6 +78,7 @@ var HvAvatar = function HvAvatar(props) {
|
|
|
78
78
|
badge = props.badge,
|
|
79
79
|
_props$variant = props.variant,
|
|
80
80
|
variant = _props$variant === void 0 ? "circular" : _props$variant,
|
|
81
|
+
containerProps = props.containerProps,
|
|
81
82
|
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
|
|
82
83
|
|
|
83
84
|
|
|
@@ -134,12 +135,17 @@ var HvAvatar = function HvAvatar(props) {
|
|
|
134
135
|
}
|
|
135
136
|
|
|
136
137
|
var badgeColor = getColor(theme, badge, theme.hv.palette.semantic.sema1);
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
138
|
+
/**
|
|
139
|
+
* Note: on the next major release this should be updated. the `others` prop should be
|
|
140
|
+
* used in the container instead of the `containerProps` and a new `avatarProps`
|
|
141
|
+
* should be created to pass on any props down to the avatar component. This wasn't
|
|
142
|
+
* done now in order to not break the current API. Also, consider using the `root` class
|
|
143
|
+
* on the container element as it makes more semantic sense.
|
|
144
|
+
*/
|
|
145
|
+
|
|
146
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
147
|
+
className: classes.container
|
|
148
|
+
}, containerProps), /*#__PURE__*/React.createElement("div", {
|
|
143
149
|
className: clsx(classes.status, classes[variant], classes[normalizedSize]),
|
|
144
150
|
style: statusInlineStyle
|
|
145
151
|
}, badge && /*#__PURE__*/React.createElement("div", {
|
|
@@ -307,7 +313,12 @@ process.env.NODE_ENV !== "production" ? HvAvatar.propTypes = {
|
|
|
307
313
|
/**
|
|
308
314
|
* A string representing the color of the avatar badge.
|
|
309
315
|
*/
|
|
310
|
-
badge: PropTypes.string
|
|
316
|
+
badge: PropTypes.string,
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Attributes applied to the container element.
|
|
320
|
+
*/
|
|
321
|
+
containerProps: PropTypes.instanceOf(Object)
|
|
311
322
|
} : void 0;
|
|
312
323
|
export default withStyles(styles, {
|
|
313
324
|
name: "HvAvatar"
|