@hitachivantara/uikit-react-core 3.62.6 → 3.64.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.
Files changed (185) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/dist/AppSwitcher/Action/Action.d.ts +75 -0
  3. package/dist/AppSwitcher/Action/Action.js +304 -0
  4. package/dist/AppSwitcher/Action/Action.js.map +1 -0
  5. package/dist/AppSwitcher/Action/index.d.ts +2 -0
  6. package/dist/AppSwitcher/Action/index.js +14 -0
  7. package/dist/AppSwitcher/Action/index.js.map +1 -0
  8. package/dist/AppSwitcher/Action/styles.js +60 -0
  9. package/dist/AppSwitcher/Action/styles.js.map +1 -0
  10. package/dist/AppSwitcher/AppSwitcher.d.ts +67 -0
  11. package/dist/AppSwitcher/AppSwitcher.js +282 -0
  12. package/dist/AppSwitcher/AppSwitcher.js.map +1 -0
  13. package/dist/AppSwitcher/TitleWithTooltip.js +76 -0
  14. package/dist/AppSwitcher/TitleWithTooltip.js.map +1 -0
  15. package/dist/AppSwitcher/index.d.ts +5 -0
  16. package/dist/AppSwitcher/index.js +24 -0
  17. package/dist/AppSwitcher/index.js.map +1 -0
  18. package/dist/AppSwitcher/styles.js +95 -0
  19. package/dist/AppSwitcher/styles.js.map +1 -0
  20. package/dist/Chart/chartPlotlyOverrides.js +2 -2
  21. package/dist/Chart/chartPlotlyOverrides.js.map +1 -1
  22. package/dist/FileUploader/File/styles.js +2 -1
  23. package/dist/FileUploader/File/styles.js.map +1 -1
  24. package/dist/SimpleGrid/SimpleGrid.d.ts +17 -0
  25. package/dist/SimpleGrid/SimpleGrid.js +73 -0
  26. package/dist/SimpleGrid/SimpleGrid.js.map +1 -0
  27. package/dist/SimpleGrid/index.d.ts +2 -0
  28. package/dist/SimpleGrid/index.js +16 -0
  29. package/dist/SimpleGrid/index.js.map +1 -0
  30. package/dist/SimpleGrid/styles.js +99 -0
  31. package/dist/SimpleGrid/styles.js.map +1 -0
  32. package/dist/TimePicker/PeriodPicker/PeriodPicker.js +112 -0
  33. package/dist/TimePicker/PeriodPicker/PeriodPicker.js.map +1 -0
  34. package/dist/TimePicker/PeriodPicker/index.js +21 -0
  35. package/dist/TimePicker/PeriodPicker/index.js.map +1 -0
  36. package/dist/TimePicker/PeriodPicker/styles.js +32 -0
  37. package/dist/TimePicker/PeriodPicker/styles.js.map +1 -0
  38. package/dist/TimePicker/TimePicker.d.ts +140 -0
  39. package/dist/TimePicker/TimePicker.js +748 -0
  40. package/dist/TimePicker/TimePicker.js.map +1 -0
  41. package/dist/TimePicker/UnitTimePicker/UnitTimePicker.js +243 -0
  42. package/dist/TimePicker/UnitTimePicker/UnitTimePicker.js.map +1 -0
  43. package/dist/TimePicker/UnitTimePicker/index.js +21 -0
  44. package/dist/TimePicker/UnitTimePicker/index.js.map +1 -0
  45. package/dist/TimePicker/UnitTimePicker/styles.js +75 -0
  46. package/dist/TimePicker/UnitTimePicker/styles.js.map +1 -0
  47. package/dist/TimePicker/enums.js +43 -0
  48. package/dist/TimePicker/enums.js.map +1 -0
  49. package/dist/TimePicker/index.d.ts +2 -0
  50. package/dist/TimePicker/index.js +16 -0
  51. package/dist/TimePicker/index.js.map +1 -0
  52. package/dist/TimePicker/styles.js +134 -0
  53. package/dist/TimePicker/styles.js.map +1 -0
  54. package/dist/TimePicker/timePickerConverter.js +90 -0
  55. package/dist/TimePicker/timePickerConverter.js.map +1 -0
  56. package/dist/TimePicker/timePickerFormatter.js +81 -0
  57. package/dist/TimePicker/timePickerFormatter.js.map +1 -0
  58. package/dist/TimePicker/timePickerUtils.js +39 -0
  59. package/dist/TimePicker/timePickerUtils.js.map +1 -0
  60. package/dist/index.d.ts +3 -0
  61. package/dist/index.js +9 -0
  62. package/dist/index.js.map +1 -1
  63. package/dist/legacy/AppSwitcher/Action/Action.d.ts +75 -0
  64. package/dist/legacy/AppSwitcher/Action/Action.js +259 -0
  65. package/dist/legacy/AppSwitcher/Action/Action.js.map +1 -0
  66. package/dist/legacy/AppSwitcher/Action/index.d.ts +2 -0
  67. package/dist/legacy/AppSwitcher/Action/index.js +3 -0
  68. package/dist/legacy/AppSwitcher/Action/index.js.map +1 -0
  69. package/dist/legacy/AppSwitcher/Action/styles.js +52 -0
  70. package/dist/legacy/AppSwitcher/Action/styles.js.map +1 -0
  71. package/dist/legacy/AppSwitcher/AppSwitcher.d.ts +67 -0
  72. package/dist/legacy/AppSwitcher/AppSwitcher.js +260 -0
  73. package/dist/legacy/AppSwitcher/AppSwitcher.js.map +1 -0
  74. package/dist/legacy/AppSwitcher/TitleWithTooltip.js +45 -0
  75. package/dist/legacy/AppSwitcher/TitleWithTooltip.js.map +1 -0
  76. package/dist/legacy/AppSwitcher/index.d.ts +5 -0
  77. package/dist/legacy/AppSwitcher/index.js +3 -0
  78. package/dist/legacy/AppSwitcher/index.js.map +1 -0
  79. package/dist/legacy/AppSwitcher/styles.js +78 -0
  80. package/dist/legacy/AppSwitcher/styles.js.map +1 -0
  81. package/dist/legacy/Chart/chartPlotlyOverrides.js +2 -2
  82. package/dist/legacy/Chart/chartPlotlyOverrides.js.map +1 -1
  83. package/dist/legacy/FileUploader/File/styles.js +2 -1
  84. package/dist/legacy/FileUploader/File/styles.js.map +1 -1
  85. package/dist/legacy/SimpleGrid/SimpleGrid.d.ts +17 -0
  86. package/dist/legacy/SimpleGrid/SimpleGrid.js +59 -0
  87. package/dist/legacy/SimpleGrid/SimpleGrid.js.map +1 -0
  88. package/dist/legacy/SimpleGrid/index.d.ts +2 -0
  89. package/dist/legacy/SimpleGrid/index.js +2 -0
  90. package/dist/legacy/SimpleGrid/index.js.map +1 -0
  91. package/dist/legacy/SimpleGrid/styles.js +81 -0
  92. package/dist/legacy/SimpleGrid/styles.js.map +1 -0
  93. package/dist/legacy/TimePicker/PeriodPicker/PeriodPicker.js +78 -0
  94. package/dist/legacy/TimePicker/PeriodPicker/PeriodPicker.js.map +1 -0
  95. package/dist/legacy/TimePicker/PeriodPicker/index.js +7 -0
  96. package/dist/legacy/TimePicker/PeriodPicker/index.js.map +1 -0
  97. package/dist/legacy/TimePicker/PeriodPicker/styles.js +24 -0
  98. package/dist/legacy/TimePicker/PeriodPicker/styles.js.map +1 -0
  99. package/dist/legacy/TimePicker/TimePicker.d.ts +140 -0
  100. package/dist/legacy/TimePicker/TimePicker.js +696 -0
  101. package/dist/legacy/TimePicker/TimePicker.js.map +1 -0
  102. package/dist/legacy/TimePicker/UnitTimePicker/UnitTimePicker.js +206 -0
  103. package/dist/legacy/TimePicker/UnitTimePicker/UnitTimePicker.js.map +1 -0
  104. package/dist/legacy/TimePicker/UnitTimePicker/index.js +7 -0
  105. package/dist/legacy/TimePicker/UnitTimePicker/index.js.map +1 -0
  106. package/dist/legacy/TimePicker/UnitTimePicker/styles.js +58 -0
  107. package/dist/legacy/TimePicker/UnitTimePicker/styles.js.map +1 -0
  108. package/dist/legacy/TimePicker/enums.js +33 -0
  109. package/dist/legacy/TimePicker/enums.js.map +1 -0
  110. package/dist/legacy/TimePicker/index.d.ts +2 -0
  111. package/dist/legacy/TimePicker/index.js +2 -0
  112. package/dist/legacy/TimePicker/index.js.map +1 -0
  113. package/dist/legacy/TimePicker/styles.js +117 -0
  114. package/dist/legacy/TimePicker/styles.js.map +1 -0
  115. package/dist/legacy/TimePicker/timePickerConverter.js +71 -0
  116. package/dist/legacy/TimePicker/timePickerConverter.js.map +1 -0
  117. package/dist/legacy/TimePicker/timePickerFormatter.js +66 -0
  118. package/dist/legacy/TimePicker/timePickerFormatter.js.map +1 -0
  119. package/dist/legacy/TimePicker/timePickerUtils.js +29 -0
  120. package/dist/legacy/TimePicker/timePickerUtils.js.map +1 -0
  121. package/dist/legacy/index.d.ts +3 -0
  122. package/dist/legacy/index.js +1 -0
  123. package/dist/legacy/index.js.map +1 -1
  124. package/dist/modern/AppSwitcher/Action/Action.d.ts +75 -0
  125. package/dist/modern/AppSwitcher/Action/Action.js +242 -0
  126. package/dist/modern/AppSwitcher/Action/Action.js.map +1 -0
  127. package/dist/modern/AppSwitcher/Action/index.d.ts +2 -0
  128. package/dist/modern/AppSwitcher/Action/index.js +3 -0
  129. package/dist/modern/AppSwitcher/Action/index.js.map +1 -0
  130. package/dist/modern/AppSwitcher/Action/styles.js +50 -0
  131. package/dist/modern/AppSwitcher/Action/styles.js.map +1 -0
  132. package/dist/modern/AppSwitcher/AppSwitcher.d.ts +67 -0
  133. package/dist/modern/AppSwitcher/AppSwitcher.js +254 -0
  134. package/dist/modern/AppSwitcher/AppSwitcher.js.map +1 -0
  135. package/dist/modern/AppSwitcher/TitleWithTooltip.js +41 -0
  136. package/dist/modern/AppSwitcher/TitleWithTooltip.js.map +1 -0
  137. package/dist/modern/AppSwitcher/index.d.ts +5 -0
  138. package/dist/modern/AppSwitcher/index.js +3 -0
  139. package/dist/modern/AppSwitcher/index.js.map +1 -0
  140. package/dist/modern/AppSwitcher/styles.js +67 -0
  141. package/dist/modern/AppSwitcher/styles.js.map +1 -0
  142. package/dist/modern/Chart/chartPlotlyOverrides.js +2 -2
  143. package/dist/modern/Chart/chartPlotlyOverrides.js.map +1 -1
  144. package/dist/modern/FileUploader/File/styles.js +2 -1
  145. package/dist/modern/FileUploader/File/styles.js.map +1 -1
  146. package/dist/modern/SimpleGrid/SimpleGrid.d.ts +17 -0
  147. package/dist/modern/SimpleGrid/SimpleGrid.js +60 -0
  148. package/dist/modern/SimpleGrid/SimpleGrid.js.map +1 -0
  149. package/dist/modern/SimpleGrid/index.d.ts +2 -0
  150. package/dist/modern/SimpleGrid/index.js +2 -0
  151. package/dist/modern/SimpleGrid/index.js.map +1 -0
  152. package/dist/modern/SimpleGrid/styles.js +68 -0
  153. package/dist/modern/SimpleGrid/styles.js.map +1 -0
  154. package/dist/modern/TimePicker/PeriodPicker/PeriodPicker.js +75 -0
  155. package/dist/modern/TimePicker/PeriodPicker/PeriodPicker.js.map +1 -0
  156. package/dist/modern/TimePicker/PeriodPicker/index.js +7 -0
  157. package/dist/modern/TimePicker/PeriodPicker/index.js.map +1 -0
  158. package/dist/modern/TimePicker/PeriodPicker/styles.js +22 -0
  159. package/dist/modern/TimePicker/PeriodPicker/styles.js.map +1 -0
  160. package/dist/modern/TimePicker/TimePicker.d.ts +140 -0
  161. package/dist/modern/TimePicker/TimePicker.js +659 -0
  162. package/dist/modern/TimePicker/TimePicker.js.map +1 -0
  163. package/dist/modern/TimePicker/UnitTimePicker/UnitTimePicker.js +191 -0
  164. package/dist/modern/TimePicker/UnitTimePicker/UnitTimePicker.js.map +1 -0
  165. package/dist/modern/TimePicker/UnitTimePicker/index.js +7 -0
  166. package/dist/modern/TimePicker/UnitTimePicker/index.js.map +1 -0
  167. package/dist/modern/TimePicker/UnitTimePicker/styles.js +49 -0
  168. package/dist/modern/TimePicker/UnitTimePicker/styles.js.map +1 -0
  169. package/dist/modern/TimePicker/enums.js +32 -0
  170. package/dist/modern/TimePicker/enums.js.map +1 -0
  171. package/dist/modern/TimePicker/index.d.ts +2 -0
  172. package/dist/modern/TimePicker/index.js +2 -0
  173. package/dist/modern/TimePicker/index.js.map +1 -0
  174. package/dist/modern/TimePicker/styles.js +108 -0
  175. package/dist/modern/TimePicker/styles.js.map +1 -0
  176. package/dist/modern/TimePicker/timePickerConverter.js +66 -0
  177. package/dist/modern/TimePicker/timePickerConverter.js.map +1 -0
  178. package/dist/modern/TimePicker/timePickerFormatter.js +65 -0
  179. package/dist/modern/TimePicker/timePickerFormatter.js.map +1 -0
  180. package/dist/modern/TimePicker/timePickerUtils.js +27 -0
  181. package/dist/modern/TimePicker/timePickerUtils.js.map +1 -0
  182. package/dist/modern/index.d.ts +3 -0
  183. package/dist/modern/index.js +1 -0
  184. package/dist/modern/index.js.map +1 -1
  185. package/package.json +4 -4
@@ -0,0 +1,259 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+
4
+ 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; }
5
+
6
+ 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; }
7
+
8
+ import "core-js/modules/es.function.name.js";
9
+ import "core-js/modules/es.symbol.js";
10
+ import "core-js/modules/es.symbol.description.js";
11
+ import "core-js/modules/es.regexp.exec.js";
12
+ import "core-js/modules/es.string.split.js";
13
+ import "core-js/modules/es.object.keys.js";
14
+ import "core-js/modules/es.array.filter.js";
15
+ import "core-js/modules/es.object.to-string.js";
16
+ import "core-js/modules/es.object.get-own-property-descriptor.js";
17
+ import "core-js/modules/web.dom-collections.for-each.js";
18
+ import "core-js/modules/es.object.get-own-property-descriptors.js";
19
+ import React, { useState } from "react";
20
+ import PropTypes from "prop-types";
21
+ import clsx from "clsx";
22
+ import { useTheme, withStyles } from "@material-ui/core";
23
+ import { Info } from "@hitachivantara/uikit-react-icons";
24
+ import { HvTypography, HvAvatar, HvTooltip, HvListItem } from "../..";
25
+ import styles from "./styles";
26
+ import TitleWithTooltip from "../TitleWithTooltip";
27
+
28
+ var getColor = function getColor(theme, color, defaultColor) {
29
+ return theme.palette[color] || color || defaultColor;
30
+ };
31
+
32
+ var Action = function Action(props) {
33
+ var id = props.id,
34
+ className = props.className,
35
+ classes = props.classes,
36
+ application = props.application,
37
+ _props$onClickCallbac = props.onClickCallback,
38
+ onClickCallback = _props$onClickCallbac === void 0 ? function () {} : _props$onClickCallbac,
39
+ _props$isSelectedCall = props.isSelectedCallback,
40
+ isSelectedCallback = _props$isSelectedCall === void 0 ? function () {
41
+ return false;
42
+ } : _props$isSelectedCall;
43
+ var name = application.name,
44
+ description = application.description,
45
+ disabled = application.disabled,
46
+ iconElement = application.iconElement,
47
+ iconUrl = application.iconUrl,
48
+ url = application.url,
49
+ target = application.target;
50
+ var theme = useTheme();
51
+ var color = disabled ? theme.hv.palette.atmosphere.atmo5 : getColor(theme, application.color, theme.hv.palette.accent.acce1);
52
+
53
+ var _useState = useState(true),
54
+ _useState2 = _slicedToArray(_useState, 2),
55
+ validIconUrl = _useState2[0],
56
+ setValidIconUrl = _useState2[1];
57
+
58
+ var renderApplicationIcon = function renderApplicationIcon() {
59
+ if (iconElement) {
60
+ return iconElement;
61
+ }
62
+
63
+ if (iconUrl && validIconUrl) {
64
+ return /*#__PURE__*/React.createElement("img", {
65
+ className: classes.iconUrl,
66
+ src: iconUrl,
67
+ onError: function onError() {
68
+ setValidIconUrl(false);
69
+ },
70
+ alt: description
71
+ });
72
+ }
73
+
74
+ var brokenTitle = name.split(" ");
75
+ var initials = brokenTitle[0].substring(0, 1) + (brokenTitle[1] ? brokenTitle[1].substring(0, 1) : "");
76
+ return /*#__PURE__*/React.createElement(HvAvatar, {
77
+ size: "SM",
78
+ backgroundColor: color,
79
+ variant: "square"
80
+ }, initials);
81
+ };
82
+
83
+ var isSelected = isSelectedCallback(application);
84
+ /**
85
+ * Handles the onClick event and triggers the appropriate callback if it exists.
86
+ */
87
+
88
+ var handleOnClick = function handleOnClick(event) {
89
+ if (disabled) {
90
+ event.preventDefault();
91
+ return;
92
+ }
93
+
94
+ onClickCallback === null || onClickCallback === void 0 ? void 0 : onClickCallback(event, _objectSpread(_objectSpread({}, application), {}, {
95
+ isSelected: isSelected
96
+ }));
97
+ };
98
+
99
+ var isLink = url != null;
100
+ return /*#__PURE__*/React.createElement(HvListItem, {
101
+ id: id,
102
+ interactive: true,
103
+ tabIndex: 0,
104
+ selected: isSelected,
105
+ disabled: disabled,
106
+ className: clsx(className, classes.root, disabled && classes.disabled, isSelected && classes.selected)
107
+ }, /*#__PURE__*/React.createElement(HvTypography, {
108
+ component: isLink ? "a" : "button",
109
+ href: isLink ? url : undefined,
110
+ target: isLink ? target || "_top" : undefined,
111
+ className: classes.typography,
112
+ onClick: handleOnClick,
113
+ style: {
114
+ borderColor: color
115
+ }
116
+ }, /*#__PURE__*/React.createElement("div", {
117
+ className: classes.icon
118
+ }, renderApplicationIcon()), /*#__PURE__*/React.createElement(TitleWithTooltip, {
119
+ title: name,
120
+ className: classes.title
121
+ }), description && /*#__PURE__*/React.createElement(HvTooltip, {
122
+ disableFocusListener: true,
123
+ disableTouchListener: true,
124
+ title: /*#__PURE__*/React.createElement(HvTypography, null, description)
125
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Info, {
126
+ className: classes.iconInfo,
127
+ role: "img",
128
+ "aria-label": description
129
+ })))));
130
+ };
131
+
132
+ process.env.NODE_ENV !== "production" ? Action.propTypes = {
133
+ /**
134
+ * Identifier to be applied to the root element.
135
+ */
136
+ id: PropTypes.string,
137
+
138
+ /**
139
+ * Class names to be applied to the root element.
140
+ */
141
+ className: PropTypes.string,
142
+
143
+ /**
144
+ * A Jss object used to override or extend the component styles.
145
+ */
146
+ classes: PropTypes.shape({
147
+ /**
148
+ * Styles applied to the component root class.
149
+ */
150
+ root: PropTypes.string,
151
+
152
+ /**
153
+ * Styles applied to the component root class when disabled.
154
+ */
155
+ disabled: PropTypes.string,
156
+
157
+ /**
158
+ * Styles applied to the typography element.
159
+ */
160
+ typography: PropTypes.string,
161
+
162
+ /**
163
+ * Styles applied to the component root class when selected.
164
+ */
165
+ selected: PropTypes.string,
166
+
167
+ /**
168
+ * Styles applied to the icon container.
169
+ */
170
+ icon: PropTypes.string,
171
+
172
+ /**
173
+ * Styles applied to the icon.
174
+ */
175
+ iconUrl: PropTypes.string,
176
+
177
+ /**
178
+ * Styles applied to the action title element.
179
+ */
180
+ title: PropTypes.string,
181
+
182
+ /**
183
+ * Styles applied to the info icon element.
184
+ */
185
+ iconInfo: PropTypes.string
186
+ }).isRequired,
187
+
188
+ /**
189
+ * The application data to be used to render the Action object.
190
+ */
191
+ application: PropTypes.shape({
192
+ /**
193
+ * Id of the application.
194
+ */
195
+ id: PropTypes.string,
196
+
197
+ /**
198
+ * Name of the application, this is the value that will be displayed on the component.
199
+ */
200
+ name: PropTypes.string.isRequired,
201
+
202
+ /**
203
+ * The color to be applied to the item's border and to the default icon.
204
+ * You can use either an HEX or color name from the palette.
205
+ */
206
+ color: PropTypes.string,
207
+
208
+ /**
209
+ * URL with the icon location to be used to represent the application.
210
+ * iconUrl will only be used if no iconElement is provided.
211
+ */
212
+ iconUrl: PropTypes.string,
213
+
214
+ /**
215
+ * Element to be added as the icon representing the application.
216
+ * The iconElement will be the primary option to be displayed.
217
+ */
218
+ iconElement: PropTypes.element,
219
+
220
+ /**
221
+ * Small description of the application.
222
+ */
223
+ description: PropTypes.string,
224
+
225
+ /**
226
+ * URL where the application is accessible.
227
+ */
228
+ url: PropTypes.string,
229
+
230
+ /**
231
+ * Defines if the application should be opened in the same tab or in a new one.
232
+ */
233
+ target: PropTypes.oneOf(["_top", "_blank"]),
234
+
235
+ /**
236
+ * If true, the item will be disabled.
237
+ */
238
+ disabled: PropTypes.bool,
239
+
240
+ /**
241
+ * True when the application is selected, false otherwise.
242
+ */
243
+ isSelected: PropTypes.bool
244
+ }).isRequired,
245
+
246
+ /**
247
+ * Callback triggered when the action is clicked.
248
+ */
249
+ onClickCallback: PropTypes.func,
250
+
251
+ /**
252
+ * Must return a boolean stating if the action element is selected or not.
253
+ */
254
+ isSelectedCallback: PropTypes.func
255
+ } : void 0;
256
+ export default withStyles(styles, {
257
+ name: "HvAppSwitcherAction"
258
+ })(Action);
259
+ //# sourceMappingURL=Action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/AppSwitcher/Action/Action.js"],"names":["React","useState","PropTypes","clsx","useTheme","withStyles","Info","HvTypography","HvAvatar","HvTooltip","HvListItem","styles","TitleWithTooltip","getColor","theme","color","defaultColor","palette","Action","props","id","className","classes","application","onClickCallback","isSelectedCallback","name","description","disabled","iconElement","iconUrl","url","target","hv","atmosphere","atmo5","accent","acce1","validIconUrl","setValidIconUrl","renderApplicationIcon","brokenTitle","split","initials","substring","isSelected","handleOnClick","event","preventDefault","isLink","root","selected","undefined","typography","borderColor","icon","title","iconInfo","propTypes","string","shape","isRequired","element","oneOf","bool","func"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,QAAgC,OAAhC;AACA,OAAOC,SAAP,MAAsB,YAAtB;AAEA,OAAOC,IAAP,MAAiB,MAAjB;AACA,SAASC,QAAT,EAAmBC,UAAnB,QAAqC,mBAArC;AAEA,SAASC,IAAT,QAAqB,mCAArB;AACA,SAASC,YAAT,EAAuBC,QAAvB,EAAiCC,SAAjC,EAA4CC,UAA5C,QAA8D,OAA9D;AAEA,OAAOC,MAAP,MAAmB,UAAnB;AAEA,OAAOC,gBAAP,MAA6B,qBAA7B;;AAEA,IAAMC,QAAQ,GAAG,SAAXA,QAAW,CAACC,KAAD,EAAQC,KAAR,EAAeC,YAAf;AAAA,SAAgCF,KAAK,CAACG,OAAN,CAAcF,KAAd,KAAwBA,KAAxB,IAAiCC,YAAjE;AAAA,CAAjB;;AAEA,IAAME,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD,EAAW;AACxB,MACEC,EADF,GAOID,KAPJ,CACEC,EADF;AAAA,MAEEC,SAFF,GAOIF,KAPJ,CAEEE,SAFF;AAAA,MAGEC,OAHF,GAOIH,KAPJ,CAGEG,OAHF;AAAA,MAIEC,WAJF,GAOIJ,KAPJ,CAIEI,WAJF;AAAA,8BAOIJ,KAPJ,CAKEK,eALF;AAAA,MAKEA,eALF,sCAKoB,YAAM,CAAE,CAL5B;AAAA,8BAOIL,KAPJ,CAMEM,kBANF;AAAA,MAMEA,kBANF,sCAMuB;AAAA,WAAM,KAAN;AAAA,GANvB;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5D,UAAU,CAACM,MAAD,EAAS;AAAEe,EAAAA,IAAI,EAAE;AAAR,CAAT,CAAV,CAAoDR,MAApD,CAAf","sourcesContent":["import React, { useState } from \"react\";\nimport PropTypes from \"prop-types\";\n\nimport clsx from \"clsx\";\nimport { useTheme, withStyles } from \"@material-ui/core\";\n\nimport { Info } from \"@hitachivantara/uikit-react-icons\";\nimport { HvTypography, HvAvatar, HvTooltip, HvListItem } from \"../..\";\n\nimport styles from \"./styles\";\n\nimport TitleWithTooltip from \"../TitleWithTooltip\";\n\nconst getColor = (theme, color, defaultColor) => theme.palette[color] || color || defaultColor;\n\nconst Action = (props) => {\n const {\n id,\n className,\n classes,\n application,\n onClickCallback = () => {},\n isSelectedCallback = () => false,\n } = props;\n\n const { name, description, disabled, iconElement, iconUrl, url, target } = application;\n\n const theme = useTheme();\n const color = disabled\n ? theme.hv.palette.atmosphere.atmo5\n : getColor(theme, application.color, theme.hv.palette.accent.acce1);\n\n const [validIconUrl, setValidIconUrl] = useState(true);\n\n const renderApplicationIcon = () => {\n if (iconElement) {\n return iconElement;\n }\n\n if (iconUrl && validIconUrl) {\n return (\n <img\n className={classes.iconUrl}\n src={iconUrl}\n onError={() => {\n setValidIconUrl(false);\n }}\n alt={description}\n />\n );\n }\n\n const brokenTitle = name.split(\" \");\n const initials =\n brokenTitle[0].substring(0, 1) + (brokenTitle[1] ? brokenTitle[1].substring(0, 1) : \"\");\n\n return (\n <HvAvatar size=\"SM\" backgroundColor={color} variant=\"square\">\n {initials}\n </HvAvatar>\n );\n };\n\n const isSelected = isSelectedCallback(application);\n\n /**\n * Handles the onClick event and triggers the appropriate callback if it exists.\n */\n const handleOnClick = (event) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n\n onClickCallback?.(event, { ...application, isSelected });\n };\n\n const isLink = url != null;\n\n return (\n <HvListItem\n id={id}\n interactive\n tabIndex={0}\n selected={isSelected}\n disabled={disabled}\n className={clsx(className, classes.root, {\n [classes.disabled]: disabled,\n [classes.selected]: isSelected,\n })}\n >\n <HvTypography\n component={isLink ? \"a\" : \"button\"}\n href={isLink ? url : undefined}\n target={isLink ? target || \"_top\" : undefined}\n className={classes.typography}\n onClick={handleOnClick}\n style={{ borderColor: color }}\n >\n <div className={classes.icon}>{renderApplicationIcon()}</div>\n\n <TitleWithTooltip title={name} className={classes.title} />\n\n {description && (\n <HvTooltip\n disableFocusListener\n disableTouchListener\n title={<HvTypography>{description}</HvTypography>}\n >\n <div>\n <Info className={classes.iconInfo} role=\"img\" aria-label={description} />\n </div>\n </HvTooltip>\n )}\n </HvTypography>\n </HvListItem>\n );\n};\n\nAction.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 component styles.\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 disabled.\n */\n disabled: PropTypes.string,\n /**\n * Styles applied to the typography element.\n */\n typography: PropTypes.string,\n /**\n * Styles applied to the component root class when selected.\n */\n selected: PropTypes.string,\n /**\n * Styles applied to the icon container.\n */\n icon: PropTypes.string,\n /**\n * Styles applied to the icon.\n */\n iconUrl: PropTypes.string,\n /**\n * Styles applied to the action title element.\n */\n title: PropTypes.string,\n /**\n * Styles applied to the info icon element.\n */\n iconInfo: PropTypes.string,\n }).isRequired,\n\n /**\n * The application data to be used to render the Action object.\n */\n application: 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 * The color to be applied to the item's border and to the default icon.\n * You can use either an HEX or color name from the palette.\n */\n color: PropTypes.string,\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 accessible.\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 }).isRequired,\n\n /**\n * Callback triggered when the action is clicked.\n */\n onClickCallback: PropTypes.func,\n /**\n * Must return a boolean stating if the action element is selected or not.\n */\n isSelectedCallback: PropTypes.func,\n};\n\nexport default withStyles(styles, { name: \"HvAppSwitcherAction\" })(Action);\n"],"file":"Action.js"}
@@ -0,0 +1,2 @@
1
+ export { default } from "./Action";
2
+ export * from "./Action";
@@ -0,0 +1,3 @@
1
+ import Action from "./Action";
2
+ export default Action;
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/AppSwitcher/Action/index.js"],"names":["Action"],"mappings":"AAAA,OAAOA,MAAP,MAAmB,UAAnB;AAEA,eAAeA,MAAf","sourcesContent":["import Action from \"./Action\";\n\nexport default Action;\n"],"file":"index.js"}
@@ -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;AAEVC,MAAAA,cAAc,EAAE,YAFN;AAGVC,MAAAA,UAAU,EAAE,QAHF;AAKVZ,MAAAA,KAAK,EAAE,MALG;AAMVE,MAAAA,SAAS,EAAE,EAND;AAQVW,MAAAA,OAAO,gBAASf,KAAK,CAACM,EAAN,CAASC,OAAT,CAAiBS,EAA1B,OARG;AAUVC,MAAAA,MAAM,EAAE,MAVE;AAWVC,MAAAA,UAAU,sBAAelB,KAAK,CAACM,EAAN,CAASa,OAAT,CAAiBC,MAAjB,CAAwBC,KAAvC,CAXA;AAaVC,MAAAA,MAAM,EAAE,SAbE;AAeVC,MAAAA,cAAc,EAAE,SAfN;AAgBVC,MAAAA,KAAK,EAAE,SAhBG;AAiBVC,MAAAA,eAAe,EAAE,SAjBP;AAmBV,qBAAe;AACbH,QAAAA,MAAM,EAAE;AADK;AAnBL,KAVa;AAkCzBI,IAAAA,IAAI,EAAE;AACJd,MAAAA,OAAO,EAAE,MADL;AAEJe,MAAAA,QAAQ,EAAE,EAFN;AAGJd,MAAAA,cAAc,EAAE;AAHZ,KAlCmB;AAwCzBe,IAAAA,KAAK,EAAE;AACLC,MAAAA,QAAQ,EAAE,CADL;AAELC,MAAAA,MAAM,cAAO9B,KAAK,CAACM,EAAN,CAASC,OAAT,CAAiBS,EAAxB,OAFD;AAILe,MAAAA,SAAS,EAAE,MAJN;AAMLC,MAAAA,QAAQ,EAAE,QANL;AAOLC,MAAAA,UAAU,EAAE,QAPP;AAQLC,MAAAA,YAAY,EAAE,UART;AAULV,MAAAA,KAAK,EAAE;AAVF,KAxCkB;AAqDzBW,IAAAA,QAAQ,EAAE;AACRR,MAAAA,QAAQ,EAAE;AADF,KArDe;AAyDzBS,IAAAA,OAAO,EAAE;AACPlC,MAAAA,KAAK,EAAE;AADA;AAzDgB,GAAZ;AAAA,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,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