@digital-ai/dot-components 2.5.1 → 2.5.3

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/index.umd.js CHANGED
@@ -1587,7 +1587,7 @@
1587
1587
  enabled: true,
1588
1588
  created_date: '2022-11-30T23:28:01.662721+00:00',
1589
1589
  modified_date: '2022-11-30T23:28:01.662721+00:00',
1590
- name: 'Agility',
1590
+ name: 'Agility 1',
1591
1591
  url: 'https://digital.ai/products/agility/',
1592
1592
  description: '',
1593
1593
  alternate_label: nullStr,
@@ -1602,7 +1602,7 @@
1602
1602
  enabled: true,
1603
1603
  created_date: '2022-11-30T23:32:00.979159+00:00',
1604
1604
  modified_date: '2022-11-30T23:32:00.979159+00:00',
1605
- name: 'Contininuous Testing',
1605
+ name: 'Continuous Testing 1',
1606
1606
  url: 'https://digital.ai/products/continuous-testing/',
1607
1607
  description: '',
1608
1608
  alternate_label: nullStr,
@@ -1617,7 +1617,7 @@
1617
1617
  enabled: true,
1618
1618
  created_date: '2022-12-30T23:32:00.979159+00:00',
1619
1619
  modified_date: '2022-12-30T23:32:00.979159+00:00',
1620
- name: 'Contininuous Testing 2',
1620
+ name: 'Continuous Testing 2',
1621
1621
  url: 'https://digital.ai/products/continuous-testing/',
1622
1622
  description: '',
1623
1623
  alternate_label: nullStr,
@@ -1996,750 +1996,647 @@
1996
1996
  }), void 0);
1997
1997
  });
1998
1998
 
1999
- var rootClassName$X = 'dot-icon-btn';
2000
- var StyledIconButton = styled__default["default"](material.IconButton).withConfig({
2001
- displayName: "IconButtonstyles__StyledIconButton",
2002
- componentId: "eko0kb-0"
1999
+ var rootClassName$X = 'dot-link';
2000
+ var StyledLink = styled__default["default"](material.Link).withConfig({
2001
+ displayName: "Linkstyles__StyledLink",
2002
+ componentId: "sc-1lpmaww-0"
2003
2003
  })(templateObject_2$Y || (templateObject_2$Y = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function () {
2004
- return styled.css(templateObject_1$10 || (templateObject_1$10 = __makeTemplateObject(["\n &.", " {\n font-size: inherit;\n padding: 10px;\n\n .dot-icon.MuiIcon-fontSizeSmall {\n padding: 1px;\n }\n\n &.MuiIconButton-sizeSmall {\n padding: 3px;\n }\n\n &.ripple-disabled {\n &:hover, &:active, &:focus {\n background: ", ";\n }\n }\n "], ["\n &.", " {\n font-size: inherit;\n padding: 10px;\n\n .dot-icon.MuiIcon-fontSizeSmall {\n padding: 1px;\n }\n\n &.MuiIconButton-sizeSmall {\n padding: 3px;\n }\n\n &.ripple-disabled {\n &:hover, &:active, &:focus {\n background: ", ";\n }\n }\n "])), rootClassName$X, hoverGray);
2004
+ return styled.css(templateObject_1$10 || (templateObject_1$10 = __makeTemplateObject(["\n &.", " {\n cursor: pointer;\n\n &:hover :not(.MuiLink-underlineHover) {\n text-decoration: none;\n }\n }\n "], ["\n &.", " {\n cursor: pointer;\n\n &:hover :not(.MuiLink-underlineHover) {\n text-decoration: none;\n }\n }\n "])), rootClassName$X);
2005
2005
  });
2006
2006
  var templateObject_1$10, templateObject_2$Y;
2007
2007
 
2008
- var DotIconButton = function DotIconButton(_a) {
2008
+ var DotLink = function DotLink(_a) {
2009
2009
  var ariaLabel = _a.ariaLabel,
2010
+ children = _a.children,
2010
2011
  className = _a.className,
2011
2012
  _b = _a.color,
2012
- color = _b === void 0 ? 'inherit' : _b,
2013
+ color = _b === void 0 ? 'primary' : _b,
2013
2014
  dataTestId = _a["data-testid"],
2014
- _c = _a.disabled,
2015
- disabled = _c === void 0 ? false : _c,
2016
- _d = _a.disableRipple,
2017
- disableRipple = _d === void 0 ? false : _d,
2018
- iconId = _a.iconId,
2019
- _e = _a.iconSize,
2020
- iconSize = _e === void 0 ? 'small' : _e,
2015
+ href = _a.href,
2021
2016
  onClick = _a.onClick,
2017
+ onMouseEnter = _a.onMouseEnter,
2018
+ onPointerDown = _a.onPointerDown,
2019
+ _c = _a.rel,
2020
+ rel = _c === void 0 ? 'noreferrer' : _c,
2021
+ _d = _a.tabIndex,
2022
+ tabIndex = _d === void 0 ? 0 : _d,
2023
+ target = _a.target,
2022
2024
  tooltip = _a.tooltip,
2023
- _f = _a.size,
2024
- size = _f === void 0 ? 'medium' : _f;
2025
- var rippleClassName = disableRipple ? 'ripple-disabled' : '';
2026
- var rootClasses = useStylesWithRootClass(rootClassName$X, rippleClassName, className);
2025
+ underline = _a.underline;
2026
+ var rootClasses = useStylesWithRootClass(rootClassName$X, className);
2027
+ var handleKeyPress = function handleKeyPress(event) {
2028
+ if (onClick && event.key === 'Enter') {
2029
+ event.preventDefault();
2030
+ onClick(event);
2031
+ }
2032
+ };
2027
2033
  return jsxRuntime.jsx(DotTooltip, __assign({
2028
- "data-testid": "icon-button-tooltip",
2029
2034
  title: tooltip
2030
2035
  }, {
2031
- children: jsxRuntime.jsx(StyledIconButton, __assign({
2036
+ children: jsxRuntime.jsx(StyledLink, __assign({
2032
2037
  "aria-label": ariaLabel,
2033
2038
  classes: {
2034
2039
  root: rootClasses
2035
2040
  },
2036
2041
  color: color,
2037
2042
  "data-testid": dataTestId,
2038
- disableRipple: disableRipple,
2039
- disabled: disabled,
2040
- onClick: function (event) {
2041
- return onClick && onClick(event);
2042
- },
2043
- size: size
2043
+ href: href,
2044
+ onClick: onClick,
2045
+ onKeyPress: handleKeyPress,
2046
+ onMouseEnter: onMouseEnter,
2047
+ onPointerDown: onPointerDown,
2048
+ rel: rel,
2049
+ tabIndex: tabIndex,
2050
+ target: target,
2051
+ underline: underline
2044
2052
  }, {
2045
- children: jsxRuntime.jsx(DotIcon, {
2046
- "data-testid": "button-icon",
2047
- fontSize: iconSize,
2048
- iconId: iconId
2049
- }, void 0)
2053
+ children: children
2050
2054
  }), void 0)
2051
2055
  }), void 0);
2052
2056
  };
2053
2057
 
2054
- var DotInputLabel = function DotInputLabel(_a) {
2055
- var dataTestId = _a["data-testid"],
2056
- _b = _a.disabled,
2057
- disabled = _b === void 0 ? false : _b,
2058
- _c = _a.error,
2059
- error = _c === void 0 ? false : _c,
2060
- id = _a.id,
2061
- label = _a.label,
2062
- required = _a.required;
2063
- return jsxRuntime.jsx(StyledInputLabel, __assign({
2064
- "data-testid": dataTestId,
2065
- classes: {
2066
- root: labelClassName
2067
- },
2068
- disabled: disabled,
2069
- error: error,
2070
- htmlFor: id,
2071
- required: required,
2072
- shrink: false,
2073
- variant: "outlined"
2074
- }, {
2075
- children: jsxRuntime.jsx(DotTypography, __assign({
2076
- variant: "subtitle2"
2077
- }, {
2078
- children: label
2079
- }), void 0)
2080
- }), void 0);
2058
+ var rootClassName$W = 'dot-list';
2059
+ var listItemRootClass = 'dot-list-item';
2060
+ var nestedListClassName = 'dot-nested-list';
2061
+ var nestedDrawerClassName = 'dot-nested-drawer';
2062
+ var StyledList = styled__default["default"](material.List).withConfig({
2063
+ displayName: "Liststyles__StyledList",
2064
+ componentId: "wxwqwr-0"
2065
+ })(templateObject_2$X || (templateObject_2$X = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
2066
+ var theme = _a.theme;
2067
+ return styled.css(templateObject_1$$ || (templateObject_1$$ = __makeTemplateObject(["\n &.", " {\n background: ", ";\n\n .dot-icon {\n color: ", ";\n }\n\n &.", " .", " {\n padding-left: ", ";\n }\n\n .MuiListSubheader-root {\n padding: 0;\n\n .MuiTypography-root {\n padding: ", ";\n }\n }\n }\n "], ["\n &.", " {\n background: ", ";\n\n .dot-icon {\n color: ", ";\n }\n\n &.", " .", " {\n padding-left: ", ";\n }\n\n .MuiListSubheader-root {\n padding: 0;\n\n .MuiTypography-root {\n padding: ", ";\n }\n }\n }\n "])), rootClassName$W, theme.palette.layer.n0, theme.palette.layer.n700, nestedListClassName, listItemRootClass, theme.spacing(4), theme.spacing(1));
2068
+ });
2069
+ var templateObject_1$$, templateObject_2$X;
2070
+
2071
+ var getChevronIcon = function getChevronIcon(nestedListType, isOpened) {
2072
+ if (nestedListType !== 'expandable') {
2073
+ return 'chevron-right';
2074
+ }
2075
+ if (isOpened) {
2076
+ return 'chevron-up';
2077
+ }
2078
+ return 'chevron-down';
2081
2079
  };
2082
2080
 
2083
- var DELAY_MS = 300;
2084
- var EndAdornment = function EndAdornment(_a) {
2085
- var endAdornmentTooltip = _a.endAdornmentTooltip,
2086
- error = _a.error,
2087
- dataTestId = _a.dataTestId,
2088
- endIcon = _a.endIcon,
2089
- success = _a.success,
2090
- warning = _a.warning;
2091
- var renderIcon = function renderIcon(iconType) {
2092
- return jsxRuntime.jsx(DotIcon, {
2093
- "data-testid": dataTestId && dataTestId + "-" + iconType + "-icon",
2094
- iconId: iconType + "-solid"
2095
- }, void 0);
2096
- };
2097
- var errorIcon = error && renderIcon('error');
2098
- var successIcon = success && renderIcon('check');
2099
- var warningIcon = warning && renderIcon('warning');
2100
- var endAdornmentIcon = endIcon || errorIcon || warningIcon || successIcon;
2101
- var styledAdornment = jsxRuntime.jsx(StyledAdornment, __assign({
2102
- className: adornmentIconClassName + " end",
2103
- position: "end"
2081
+ var flyoutListItemClassName = 'dot-flyout-list-item';
2082
+ var flyoutItemLinkClassName = 'dot-flyout-item-link';
2083
+ var listItemLinkClassName = 'dot-list-item-link';
2084
+ var StyledListItem = styled__default["default"](material.ListItem).withConfig({
2085
+ displayName: "ListItemstyles__StyledListItem",
2086
+ componentId: "sc-1fawh8v-0"
2087
+ })(templateObject_2$W || (templateObject_2$W = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
2088
+ var theme = _a.theme;
2089
+ return styled.css(templateObject_1$_ || (templateObject_1$_ = __makeTemplateObject(["\n &.", " {\n &.", " {\n padding: 0;\n }\n\n p.MuiTypography-root {\n margin-bottom: 0;\n }\n\n .", " {\n align-items: center;\n display: flex;\n flex-grow: 2;\n }\n\n .", " .MuiIcon-root {\n margin-right: ", ";\n }\n\n .dot-icon i:before {\n color: ", ";\n }\n }\n "], ["\n &.", " {\n &.", " {\n padding: 0;\n }\n\n p.MuiTypography-root {\n margin-bottom: 0;\n }\n\n .", " {\n align-items: center;\n display: flex;\n flex-grow: 2;\n }\n\n .", " .MuiIcon-root {\n margin-right: ", ";\n }\n\n .dot-icon i:before {\n color: ", ";\n }\n }\n "])), listItemRootClass, flyoutListItemClassName, listItemLinkClassName, flyoutItemLinkClassName, theme.spacing(4), theme.palette.text.primary);
2090
+ });
2091
+ var templateObject_1$_, templateObject_2$W;
2092
+
2093
+ var rootClassName$V = 'dot-progress';
2094
+ var StyledCircularProgress = styled__default["default"](material.CircularProgress).withConfig({
2095
+ displayName: "Progressstyles__StyledCircularProgress",
2096
+ componentId: "sc-1gs77rb-0"
2097
+ })(templateObject_1$Z || (templateObject_1$Z = __makeTemplateObject(["\n &.", " {\n &.MuiCircularProgress-colorSecondary {\n color: #649a3d;\n }\n }\n"], ["\n &.", " {\n &.MuiCircularProgress-colorSecondary {\n color: #649a3d;\n }\n }\n"])), rootClassName$V);
2098
+ var templateObject_1$Z;
2099
+
2100
+ var DotProgress = function DotProgress(_a) {
2101
+ var ariaLabel = _a.ariaLabel,
2102
+ _b = _a.color,
2103
+ color = _b === void 0 ? 'secondary' : _b,
2104
+ className = _a.className,
2105
+ dataTestId = _a["data-testid"],
2106
+ _c = _a.size,
2107
+ size = _c === void 0 ? 40 : _c,
2108
+ _d = _a.thickness,
2109
+ thickness = _d === void 0 ? 3.6 : _d,
2110
+ _e = _a.tooltip,
2111
+ tooltip = _e === void 0 ? 'loading data' : _e,
2112
+ value = _a.value,
2113
+ _f = _a.variant,
2114
+ variant = _f === void 0 ? 'indeterminate' : _f;
2115
+ var rootClasses = useStylesWithRootClass(rootClassName$V, className);
2116
+ return jsxRuntime.jsx(DotTooltip, __assign({
2117
+ title: tooltip
2104
2118
  }, {
2105
- children: endAdornmentIcon
2119
+ children: jsxRuntime.jsx(StyledCircularProgress, {
2120
+ "aria-label": ariaLabel,
2121
+ classes: {
2122
+ root: rootClasses
2123
+ },
2124
+ color: color,
2125
+ "data-testid": dataTestId,
2126
+ size: size,
2127
+ thickness: thickness,
2128
+ value: value,
2129
+ variant: variant
2130
+ }, void 0)
2106
2131
  }), void 0);
2107
- return endAdornmentTooltip ? jsxRuntime.jsx(DotTooltip, __assign({
2108
- title: endAdornmentTooltip
2109
- }, {
2110
- children: styledAdornment
2111
- }), void 0) : styledAdornment;
2112
2132
  };
2113
- var getInitialState = function getInitialState(value) {
2114
- return {
2115
- inputValue: value || ''
2116
- };
2133
+
2134
+ var levelBottom = -1;
2135
+ var levelFirst = 1;
2136
+ var levelSecond = 10;
2137
+ var levelThird = 100;
2138
+ var levelFourth = 1000;
2139
+ var levelTop = 9999;
2140
+
2141
+ var variables = /*#__PURE__*/Object.freeze({
2142
+ __proto__: null,
2143
+ levelBottom: levelBottom,
2144
+ levelFirst: levelFirst,
2145
+ levelSecond: levelSecond,
2146
+ levelThird: levelThird,
2147
+ levelFourth: levelFourth,
2148
+ levelTop: levelTop
2149
+ });
2150
+
2151
+ var rootClassName$U = 'dot-popper';
2152
+ var StyledPopper$1 = styled__default["default"](material.Popper).withConfig({
2153
+ displayName: "Popperstyles__StyledPopper",
2154
+ componentId: "sd1h8p-0"
2155
+ })(templateObject_2$V || (templateObject_2$V = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
2156
+ var theme = _a.theme;
2157
+ return styled.css(templateObject_1$Y || (templateObject_1$Y = __makeTemplateObject(["\n &.", " {\n font-family: ", ";\n font-size: ", "px;\n }\n "], ["\n &.", " {\n font-family: ", ";\n font-size: ", "px;\n }\n "])), rootClassName$U, theme.typography.fontFamily, theme.typography.body1.fontSize);
2158
+ });
2159
+ var templateObject_1$Y, templateObject_2$V;
2160
+
2161
+ var flyoutMenuClassName = 'dot-flyout-menu';
2162
+ var rootClassName$T = 'dot-menu';
2163
+ var getListMaxHeight = function getListMaxHeight(maxHeight) {
2164
+ return isString$1(maxHeight) ? maxHeight : maxHeight + "px";
2117
2165
  };
2118
- var DotInputText = function DotInputText(_a) {
2119
- var _b = _a.autoComplete,
2120
- autoComplete = _b === void 0 ? 'off' : _b,
2121
- autoFocus = _a.autoFocus,
2122
- className = _a.className,
2123
- defaultValue = _a.defaultValue,
2124
- dataTestId = _a["data-testid"],
2125
- _c = _a.disabled,
2126
- disabled = _c === void 0 ? false : _c,
2127
- _d = _a.error,
2128
- error = _d === void 0 ? false : _d,
2129
- endAdornmentTooltip = _a.endAdornmentTooltip,
2130
- _e = _a.fullWidth,
2131
- fullWidth = _e === void 0 ? true : _e,
2132
- hasDebounce = _a.hasDebounce,
2133
- helperText = _a.helperText,
2134
- endIcon = _a.endIcon,
2135
- id = _a.id,
2136
- inputRef = _a.inputRef,
2137
- label = _a.label,
2138
- maxRows = _a.maxRows,
2139
- minRows = _a.minRows,
2140
- _f = _a.multiline,
2141
- multiline = _f === void 0 ? false : _f,
2142
- name = _a.name,
2143
- onBlur = _a.onBlur,
2144
- onChange = _a.onChange,
2145
- onFocus = _a.onFocus,
2146
- onKeyDown = _a.onKeyDown,
2147
- onMouseUp = _a.onMouseUp,
2148
- persistentLabel = _a.persistentLabel,
2149
- placeholder = _a.placeholder,
2150
- _g = _a.readOnly,
2151
- readOnly = _g === void 0 ? false : _g,
2152
- _h = _a.required,
2153
- required = _h === void 0 ? false : _h,
2154
- shrink = _a.shrink,
2155
- startIcon = _a.startIcon,
2156
- _j = _a.size,
2157
- size = _j === void 0 ? 'small' : _j,
2158
- success = _a.success,
2159
- _k = _a.type,
2160
- type = _k === void 0 ? 'text' : _k,
2161
- value = _a.value,
2162
- _l = _a.warning,
2163
- warning = _l === void 0 ? false : _l;
2164
- var hasError = error && errorClassName;
2165
- var hasWarning = !error && warning && warningClassName;
2166
- var hasSuccess = !error && !warning && success && successClassName;
2167
- var hasEndAdornmentIcon = endIcon || error || hasWarning || hasSuccess;
2168
- // This state is used only with debounce feature enabled
2169
- var _m = React.useState(hasDebounce && getInitialState(value)),
2170
- inputTextState = _m[0],
2171
- setInputTextState = _m[1];
2172
- var rootStyles = useStylesWithRootClass(rootClassName$10, hasError, hasWarning, hasSuccess, readOnly ? 'read-only' : '');
2173
- // Used to control text value from the consumer component
2174
- // when debounce feature is enabled
2175
- React.useEffect(function () {
2176
- if (hasDebounce && value !== inputTextState.inputValue) {
2177
- setInputTextState(getInitialState(value));
2178
- }
2179
- }, [value]);
2180
- // Improve performance by avoiding callback execution
2181
- // on each keystroke (if debounce feature is active)
2182
- React.useEffect(function () {
2183
- // Do not proceed if debounce feature is turned
2184
- // off or there is no event defined
2185
- if (!hasDebounce || !inputTextState || !inputTextState.changeEvent || !onChange) return;
2186
- var handler = setTimeout(function () {
2187
- onChange(inputTextState.changeEvent);
2188
- }, DELAY_MS);
2189
- return function () {
2190
- return clearTimeout(handler);
2191
- };
2192
- }, [inputTextState]);
2193
- var handleChange = function handleChange(e) {
2194
- // We need to have control over change event and input value separately
2195
- // so that we can set initial state via 'value' prop (if needed)
2196
- hasDebounce ? setInputTextState({
2197
- changeEvent: e,
2198
- inputValue: e.target.value
2199
- }) : onChange === null || onChange === void 0 ? void 0 : onChange(e);
2200
- };
2201
- var inputTextValue = hasDebounce ? inputTextState.inputValue : value;
2202
- // Don't use default value when debounce feature is enabled because
2203
- // in that case component is controlled
2204
- var defaultInputValue = hasDebounce ? undefined : defaultValue;
2205
- var startAdornmentIcon = function startAdornmentIcon() {
2206
- if (!startIcon) return null;
2207
- return jsxRuntime.jsx(StyledAdornment, __assign({
2208
- className: adornmentIconClassName + " start",
2209
- position: "start"
2210
- }, {
2211
- children: startIcon
2212
- }), void 0);
2213
- };
2214
- var endAdornmentIcon = function endAdornmentIcon() {
2215
- if (!hasEndAdornmentIcon) return null;
2216
- return jsxRuntime.jsx(EndAdornment, __assign({}, {
2217
- endAdornmentTooltip: endAdornmentTooltip,
2218
- error: error,
2219
- dataTestId: dataTestId,
2220
- endIcon: endIcon,
2221
- success: success,
2222
- warning: warning
2223
- }), void 0);
2224
- };
2225
- var wrapperClassName = useStylesWithRootClass(fullWidth !== false ? 'dot-input-text--fullwidth' : '', className);
2226
- return jsxRuntime.jsxs(StyledTextFieldContainer, __assign({
2227
- className: wrapperClassName
2228
- }, {
2229
- children: [persistentLabel && jsxRuntime.jsx(DotInputLabel, __assign({}, {
2230
- disabled: disabled,
2231
- error: error,
2232
- id: id,
2233
- label: label,
2234
- required: required
2235
- }), void 0), jsxRuntime.jsx(StyledTextField, {
2236
- InputProps: {
2237
- startAdornment: startAdornmentIcon(),
2238
- endAdornment: endAdornmentIcon()
2239
- },
2240
- "aria-label": name,
2241
- autoComplete: autoComplete,
2242
- autoFocus: autoFocus,
2243
- classes: {
2244
- root: rootStyles
2245
- },
2246
- defaultValue: defaultInputValue,
2247
- disabled: disabled,
2248
- error: error,
2249
- focused: readOnly ? false : undefined,
2250
- fullWidth: fullWidth,
2251
- helperText: helperText,
2252
- id: id,
2253
- InputLabelProps: {
2254
- shrink: type === 'date' ? true : shrink
2255
- },
2256
- inputProps: {
2257
- 'data-testid': dataTestId,
2258
- className: 'dot-input',
2259
- readOnly: readOnly
2260
- },
2261
- inputRef: inputRef,
2262
- label: persistentLabel ? null : label,
2263
- multiline: multiline,
2264
- name: name,
2265
- onBlur: onBlur,
2266
- onChange: hasDebounce ? handleChange : onChange,
2267
- onFocus: onFocus,
2268
- onKeyDown: onKeyDown,
2269
- onMouseUp: onMouseUp,
2270
- placeholder: placeholder,
2271
- required: required,
2272
- minRows: multiline ? minRows : null,
2273
- maxRows: multiline ? maxRows : null,
2274
- size: size,
2275
- type: type,
2276
- value: inputTextValue,
2277
- variant: "outlined"
2278
- }, void 0)]
2279
- }), void 0);
2280
- };
2281
-
2282
- var rootClassName$W = 'dot-search-input';
2283
- var StyledSearchInput = styled__default["default"].span.withConfig({
2284
- displayName: "SearchInputstyles__StyledSearchInput",
2285
- componentId: "qlwzku-0"
2286
- })(templateObject_2$X || (templateObject_2$X = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function () {
2287
- return styled.css(templateObject_1$$ || (templateObject_1$$ = __makeTemplateObject(["\n &.", " {\n }\n "], ["\n &.", " {\n }\n "])), rootClassName$W);
2166
+ var StyledPopper = styled__default["default"](material.Popper).withConfig({
2167
+ displayName: "Menustyles__StyledPopper",
2168
+ componentId: "sc-134fmqu-0"
2169
+ })(templateObject_2$U || (templateObject_2$U = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
2170
+ var theme = _a.theme;
2171
+ return styled.css(templateObject_1$X || (templateObject_1$X = __makeTemplateObject(["\n &.", " {\n font-family: ", ";\n font-size: ", "px;\n z-index: ", ";\n }\n &.", ", &.", " {\n &.loading .MuiPaper-root {\n align-items: center;\n display: flex;\n justify-content: center;\n min-height: 200px;\n min-width: 200px;\n }\n\n ul,\n .dot-action-item {\n .dot-action-item-text {\n white-space: nowrap;\n overflow-x: hidden;\n text-overflow: ellipsis;\n }\n }\n\n ul {\n box-sizing: content-box;\n min-width: 112px;\n overflow: auto;\n\n /* Conditionally setting 'max-height' with transient prop */\n ", "\n\n .dot-li {\n min-height: auto;\n }\n }\n\n .dot-action-item {\n height: ", ";\n border-top: 1px solid ", ";\n line-height: inherit;\n\n button.dot-button {\n border-radius: ", ";\n justify-content: flex-start;\n height: 100%;\n margin: 0;\n\n &:focus-visible {\n background-color: ", ";\n }\n\n .MuiButton-label {\n gap: ", ";\n\n .MuiButton-startIcon {\n margin-left: 0;\n\n .dot-icon {\n flex-shrink: 0;\n }\n }\n }\n }\n }\n }\n "], ["\n &.", " {\n font-family: ", ";\n font-size: ", "px;\n z-index: ", ";\n }\n &.", ", &.", " {\n &.loading .MuiPaper-root {\n align-items: center;\n display: flex;\n justify-content: center;\n min-height: 200px;\n min-width: 200px;\n }\n\n ul,\n .dot-action-item {\n .dot-action-item-text {\n white-space: nowrap;\n overflow-x: hidden;\n text-overflow: ellipsis;\n }\n }\n\n ul {\n box-sizing: content-box;\n min-width: 112px;\n overflow: auto;\n\n /* Conditionally setting 'max-height' with transient prop */\n ", "\n\n .dot-li {\n min-height: auto;\n }\n }\n\n .dot-action-item {\n height: ", ";\n border-top: 1px solid ", ";\n line-height: inherit;\n\n button.dot-button {\n border-radius: ", ";\n justify-content: flex-start;\n height: 100%;\n margin: 0;\n\n &:focus-visible {\n background-color: ", ";\n }\n\n .MuiButton-label {\n gap: ", ";\n\n .MuiButton-startIcon {\n margin-left: 0;\n\n .dot-icon {\n flex-shrink: 0;\n }\n }\n }\n }\n }\n }\n "])), rootClassName$U, theme.typography.fontFamily, theme.typography.body1.fontSize, levelSecond, rootClassName$T, rootClassName$U, function (_a) {
2172
+ var $maxHeight = _a.$maxHeight;
2173
+ return $maxHeight !== undefined && "\n max-height: " + getListMaxHeight($maxHeight) + ";\n ";
2174
+ }, theme.spacing(7), theme.palette.grey[100], theme.spacing(0, 0, 0.5, 0.5), theme.palette.layer.n100, theme.spacing(3));
2288
2175
  });
2289
- var templateObject_1$$, templateObject_2$X;
2176
+ var templateObject_1$X, templateObject_2$U;
2290
2177
 
2291
- function SearchInput(_a) {
2292
- var dataTestId = _a["data-testid"],
2293
- _b = _a.autoFocus,
2294
- autoFocus = _b === void 0 ? true : _b,
2295
- className = _a.className,
2296
- _c = _a.disabled,
2297
- disabled = _c === void 0 ? false : _c,
2298
- onChange = _a.onChange,
2299
- onClear = _a.onClear,
2300
- _d = _a.placeholder,
2301
- placeholder = _d === void 0 ? 'Search' : _d,
2302
- _e = _a.tooltip,
2303
- tooltip = _e === void 0 ? null : _e,
2304
- value = _a.value;
2305
- var rootClasses = useStylesWithRootClass(rootClassName$W, className);
2306
- var _f = React.useState(value),
2307
- searchText = _f[0],
2308
- setSearchText = _f[1];
2309
- var previousSearchText = '';
2310
- var handleChange = React.useCallback(function (event) {
2311
- previousSearchText = event.target.value;
2312
- setSearchText(event.target.value);
2313
- // Timeout is to give user a chance to finish typing before refreshing data.
2314
- setTimeout(function () {
2315
- if (onChange && event.target.value === previousSearchText) {
2316
- onChange(event.target.value);
2317
- }
2318
- }, 500);
2319
- }, [onChange]);
2320
- var handleClear = React.useCallback(function () {
2321
- setSearchText('');
2322
- onClear && onClear();
2323
- }, [onClear]);
2324
- var searchIcon = jsxRuntime.jsx(DotIcon, {
2325
- className: "search-icon",
2326
- iconId: "search"
2327
- }, void 0);
2328
- var clearSearchIcon = jsxRuntime.jsx(DotIconButton, {
2329
- iconId: "close",
2330
- onClick: handleClear,
2331
- size: "small",
2332
- tooltip: "Clear search text"
2333
- }, void 0);
2334
- return jsxRuntime.jsx(StyledSearchInput, __assign({
2335
- className: rootClasses
2336
- }, {
2337
- children: jsxRuntime.jsx(DotTooltip, __assign({
2338
- placement: "bottom",
2339
- title: tooltip
2340
- }, {
2341
- children: jsxRuntime.jsx(DotInputText, {
2342
- "data-testid": dataTestId,
2343
- autoFocus: autoFocus,
2344
- className: "search-text",
2345
- disabled: disabled,
2346
- endIcon: (searchText === null || searchText === void 0 ? void 0 : searchText.length) > 0 ? clearSearchIcon : null,
2347
- id: "app-instance-search-text",
2348
- name: "app-instance-search-text",
2349
- onChange: handleChange,
2350
- placeholder: placeholder,
2351
- startIcon: searchIcon,
2352
- value: searchText
2353
- }, void 0)
2354
- }), void 0)
2355
- }), void 0);
2356
- }
2178
+ var MENU_ITEM_HEIGHT_NORMAL = 48;
2179
+ var MENU_ITEM_HEIGHT_DENSE = 36;
2180
+ var DEFAULT_MAX_VISIBLE_ITEMS = 7;
2357
2181
 
2358
- var rootClassName$V = 'dot-copy-button';
2359
- var StyledCopyButton = styled__default["default"].span.withConfig({
2360
- displayName: "CopyButtonstyles__StyledCopyButton",
2361
- componentId: "sc-18ff0u-0"
2362
- })(templateObject_2$W || (templateObject_2$W = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
2182
+ var rootClassName$S = 'dot-ul';
2183
+ var listItemClassName$1 = 'dot-li';
2184
+ var listItemWithSubmenuClassName = 'dot-li-with-submenu';
2185
+ var StyledMenuList = styled__default["default"](material.MenuList).withConfig({
2186
+ displayName: "MenuListstyles__StyledMenuList",
2187
+ componentId: "yqdwwg-0"
2188
+ })(templateObject_2$T || (templateObject_2$T = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
2363
2189
  var theme = _a.theme;
2364
- return styled.css(templateObject_1$_ || (templateObject_1$_ = __makeTemplateObject(["\n &.", " {\n .copied-to-clipboard {\n color: ", ";\n }\n }\n "], ["\n &.", " {\n .copied-to-clipboard {\n color: ", ";\n }\n }\n "])), rootClassName$V, theme.palette.success[400]);
2190
+ return styled.css(templateObject_1$W || (templateObject_1$W = __makeTemplateObject(["\n &.", " {\n .dot-li {\n font-size: ", "px;\n justify-content: space-between;\n gap: ", ";\n\n &:hover {\n background: ", ";\n }\n\n &.Mui-selected,\n &.Mui-selected:hover {\n background: ", ";\n }\n\n &.", " {\n padding-right: ", ";\n }\n }\n }\n "], ["\n &.", " {\n .dot-li {\n font-size: ", "px;\n justify-content: space-between;\n gap: ", ";\n\n &:hover {\n background: ", ";\n }\n\n &.Mui-selected,\n &.Mui-selected:hover {\n background: ", ";\n }\n\n &.", " {\n padding-right: ", ";\n }\n }\n }\n "])), rootClassName$S, theme.typography.body1.fontSize, theme.spacing(3), hoverGray, lightSelectedGray, listItemWithSubmenuClassName, theme.spacing(0.5));
2365
2191
  });
2366
- var templateObject_1$_, templateObject_2$W;
2192
+ var templateObject_1$W, templateObject_2$T;
2367
2193
 
2368
- var DotCopyButton = function DotCopyButton(_a) {
2369
- var _b = _a.ariaLabel,
2370
- ariaLabel = _b === void 0 ? 'Copy to clipboard' : _b,
2371
- _c = _a.copiedTooltip,
2372
- copiedTooltip = _c === void 0 ? 'Copied!' : _c,
2373
- _d = _a.copyTooltip,
2374
- copyTooltip = _d === void 0 ? 'Copy to clipboard' : _d,
2375
- _e = _a["data-testid"],
2376
- dataTestId = _e === void 0 ? 'dot-copy-button' : _e,
2377
- value = _a.value;
2378
- var _f = React.useState(false),
2379
- showCopiedIcon = _f[0],
2380
- setShowCopiedIcon = _f[1];
2381
- var copyToClipboard = function copyToClipboard() {
2382
- // The check for navigator.clipboard.writeText is because this function is
2383
- // only supported in secure contexts (https). This will always be the case in
2384
- // production but not when running locally.
2385
- if (!navigator.clipboard || !navigator.clipboard.writeText) {
2386
- console.warn('Copy to clipboard is only supported in secure context (https)', value);
2387
- } else {
2388
- navigator.clipboard.writeText(value);
2389
- }
2390
- };
2391
- var copy = function copy() {
2392
- copyToClipboard();
2393
- setShowCopiedIcon(true);
2394
- setTimeout(function () {
2395
- setShowCopiedIcon(false);
2396
- }, 3000);
2397
- return false;
2398
- };
2399
- return jsxRuntime.jsxs(StyledCopyButton, __assign({
2400
- className: rootClassName$V,
2401
- "data-testid": dataTestId
2402
- }, {
2403
- children: [!showCopiedIcon && jsxRuntime.jsx(DotIconButton, {
2404
- ariaLabel: ariaLabel,
2405
- "data-testid": dataTestId + "-button",
2406
- iconId: "duplicate",
2407
- onClick: copy,
2408
- size: "small",
2409
- tooltip: copyTooltip
2410
- }, void 0), showCopiedIcon && jsxRuntime.jsx(DotIcon, {
2411
- className: "copied-to-clipboard",
2412
- "data-testid": dataTestId + "-icon",
2413
- fontSize: "small",
2414
- iconId: "check-solid",
2415
- tooltip: copiedTooltip
2416
- }, void 0)]
2417
- }), void 0);
2194
+ var getDefaultItemHeight = function getDefaultItemHeight(isDense) {
2195
+ return isDense ? MENU_ITEM_HEIGHT_DENSE : MENU_ITEM_HEIGHT_NORMAL;
2418
2196
  };
2419
-
2420
- var rootClassName$U = 'dot-link';
2421
- var StyledLink = styled__default["default"](material.Link).withConfig({
2422
- displayName: "Linkstyles__StyledLink",
2423
- componentId: "sc-1lpmaww-0"
2424
- })(templateObject_2$V || (templateObject_2$V = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function () {
2425
- return styled.css(templateObject_1$Z || (templateObject_1$Z = __makeTemplateObject(["\n &.", " {\n cursor: pointer;\n\n &:hover :not(.MuiLink-underlineHover) {\n text-decoration: none;\n }\n }\n "], ["\n &.", " {\n cursor: pointer;\n\n &:hover :not(.MuiLink-underlineHover) {\n text-decoration: none;\n }\n }\n "])), rootClassName$U);
2426
- });
2427
- var templateObject_1$Z, templateObject_2$V;
2428
-
2429
- var DotLink = function DotLink(_a) {
2430
- var ariaLabel = _a.ariaLabel,
2431
- children = _a.children,
2432
- className = _a.className,
2433
- _b = _a.color,
2434
- color = _b === void 0 ? 'primary' : _b,
2435
- dataTestId = _a["data-testid"],
2436
- href = _a.href,
2437
- onClick = _a.onClick,
2438
- onMouseEnter = _a.onMouseEnter,
2439
- _c = _a.rel,
2440
- rel = _c === void 0 ? 'noreferrer' : _c,
2441
- _d = _a.tabIndex,
2442
- tabIndex = _d === void 0 ? 0 : _d,
2443
- target = _a.target,
2444
- tooltip = _a.tooltip,
2445
- underline = _a.underline;
2446
- var rootClasses = useStylesWithRootClass(rootClassName$U, className);
2447
- var handleKeyPress = function handleKeyPress(event) {
2448
- if (onClick && event.key === 'Enter') {
2449
- event.preventDefault();
2450
- onClick(event);
2451
- }
2452
- };
2453
- return jsxRuntime.jsx(DotTooltip, __assign({
2454
- title: tooltip
2455
- }, {
2456
- children: jsxRuntime.jsx(StyledLink, __assign({
2457
- "aria-label": ariaLabel,
2458
- classes: {
2459
- root: rootClasses
2460
- },
2461
- color: color,
2462
- "data-testid": dataTestId,
2463
- href: href,
2464
- onClick: onClick,
2465
- onKeyPress: handleKeyPress,
2466
- onMouseEnter: onMouseEnter,
2467
- rel: rel,
2468
- tabIndex: tabIndex,
2469
- target: target,
2470
- underline: underline
2471
- }, {
2472
- children: children
2473
- }), void 0)
2474
- }), void 0);
2475
- };
2476
-
2477
- var img$6 = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20Z' fill='%23279FEA'/%3e%3cpath d='M12.4332 16.3533V14.8333H11.5665V16.3533L10.7432 15.8933L9.85651 16.4033L11.9998 17.6366L14.1932 16.3733L13.3332 15.8766L12.4332 16.3533Z' fill='white'/%3e%3cpath d='M7.99328 10.1866L9.24661 10.9132L9.67995 10.1399L8.36995 9.4299L9.09328 9.01657V8.03323L7.11328 9.18323L7.11661 11.5532L7.99328 11.0566V10.1866Z' fill='white'/%3e%3cpath d='M14.6934 10.9133L15.9934 10.1733L15.99 11.0566L16.8867 11.5599V9.1766L14.81 7.98993L14.7767 8.9566L15.6167 9.45326L14.29 10.0799L14.6934 10.9133Z' fill='white'/%3e%3cpath d='M16.8801 12.5435L16.0001 12.0402V12.0935V13.7068L12.4167 11.6868V7.61015L13.9667 8.49015V7.51682L12.0001 6.35349L9.95006 7.52348V8.52348L11.4967 7.63015V11.6868L8.00006 13.8168V12.0202L7.12006 12.5235V14.8202L8.96672 15.8502L9.86672 15.3335L8.40006 14.5268L12.0001 12.4368L15.5567 14.5035L14.1301 15.3268L15.0567 15.8701L16.8701 14.8268L16.8801 12.5435Z' fill='white'/%3e%3c/svg%3e";
2478
-
2479
- var img$5 = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20Z' fill='%23279FEA'/%3e%3cpath d='M14.1867 11.2667L12.1634 10.0833L10.1367 11.2667V13.62L12.1634 14.7867L14.1867 13.62V11.2667Z' fill='white'/%3e%3cpath d='M8.43666 12.0001L7.47333 11.1501V15.1667L10.41 16.8367V15.7034L8.43666 14.5401V12.0001Z' fill='white'/%3e%3cpath d='M15.8965 12V14.5833L13.9632 15.7033V16.9367L16.8532 15.1533V11.0967L15.8965 12Z' fill='white'/%3e%3cpath d='M12.1565 8.13333L14.7165 9.61333L15.4165 8.89L12.1565 7L8.87988 8.90667L9.57988 9.63333L12.1565 8.13333Z' fill='white'/%3e%3c/svg%3e";
2480
-
2481
- var img$4 = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20Z' fill='%2333D389'/%3e%3cpath d='M17.0033 7.62322H16.4567C16.3925 7.62863 16.3324 7.65679 16.2871 7.70264C16.2419 7.74848 16.2146 7.80898 16.21 7.87322V9.14322C15.7432 8.43248 15.1064 7.84955 14.3572 7.44732C13.6081 7.04509 12.7703 6.8363 11.92 6.83989C11.0845 6.84475 10.2627 7.05243 9.52515 7.44508C8.78763 7.83772 8.15649 8.40359 7.68598 9.09405C7.21547 9.7845 6.91966 10.5789 6.82398 11.4089C6.72831 12.2389 6.83562 13.0798 7.13669 13.8592C7.43777 14.6386 7.92361 15.3332 8.55245 15.8834C9.18128 16.4335 9.93431 16.8227 10.7468 17.0176C11.5593 17.2124 12.4069 17.207 13.2169 17.0019C14.0269 16.7967 14.7749 16.398 15.3967 15.8399C15.4257 15.8182 15.4492 15.79 15.4654 15.7576C15.4816 15.7252 15.49 15.6894 15.49 15.6532C15.49 15.617 15.4816 15.5813 15.4654 15.5489C15.4492 15.5165 15.4257 15.4883 15.3967 15.4666L14.9833 15.0532C14.9369 15.0135 14.8778 14.9917 14.8167 14.9917C14.7556 14.9917 14.6965 15.0135 14.65 15.0532C13.9076 15.7352 12.9312 16.1052 11.9233 16.0866C11.1892 16.087 10.4684 15.8897 9.83687 15.5154C9.20531 15.141 8.68627 14.6034 8.33429 13.9591C7.98231 13.3148 7.81039 12.5876 7.83662 11.8539C7.86284 11.1202 8.08624 10.4071 8.48332 9.78959C8.8804 9.17207 9.4365 8.67292 10.0932 8.34461C10.7499 8.0163 11.4828 7.87095 12.2151 7.92384C12.9474 7.97674 13.6519 8.22592 14.2545 8.6452C14.8572 9.06448 15.3358 9.63837 15.64 10.3066H14.1467C14.0828 10.3112 14.0227 10.3387 13.9774 10.384C13.9321 10.4293 13.9046 10.4893 13.9 10.5532V11.0466C13.9046 11.1104 13.9321 11.1705 13.9774 11.2158C14.0227 11.2611 14.0828 11.2886 14.1467 11.2932H17C17.0639 11.2886 17.124 11.2611 17.1693 11.2158C17.2146 11.1705 17.242 11.1104 17.2467 11.0466V7.87322C17.2422 7.8095 17.2154 7.74942 17.1708 7.70364C17.1263 7.65787 17.0669 7.62938 17.0033 7.62322Z' fill='white'/%3e%3cpath d='M12.1232 9.39987C12.1667 9.39747 12.2077 9.37914 12.2384 9.34839C12.2692 9.31764 12.2875 9.27662 12.2899 9.2332C12.2899 9.2332 12.3399 8.8332 12.3399 8.69987C12.3399 8.56653 12.2499 8.4932 12.1666 8.48987C11.5045 8.45232 10.8457 8.60791 10.2703 8.93771C9.69497 9.26752 9.22779 9.75734 8.92557 10.3477C8.62335 10.938 8.4991 11.6034 8.56792 12.263C8.63675 12.9226 8.89568 13.548 9.31325 14.0632C9.83849 14.7239 10.5905 15.1658 11.4232 15.3032C11.5166 15.3032 11.5999 15.2632 11.6299 15.1365C11.6299 15.1365 11.6999 14.8032 11.7132 14.6832C11.7233 14.639 11.7157 14.5927 11.692 14.554C11.6684 14.5154 11.6305 14.4876 11.5866 14.4765C11.225 14.4227 10.8806 14.2869 10.5795 14.0795C10.2785 13.8721 10.029 13.5986 9.84992 13.2799C9.64046 12.9274 9.51393 12.5318 9.47992 12.1232C9.44986 11.7648 9.49697 11.4042 9.61806 11.0655C9.73915 10.7269 9.93142 10.4181 10.1819 10.1601C10.4324 9.90199 10.7353 9.70061 11.0702 9.56947C11.405 9.43834 11.7641 9.38051 12.1232 9.39987Z' fill='white'/%3e%3cpath d='M13.9433 13.1568C13.96 13.1389 13.9724 13.1175 13.9796 13.0942C13.9868 13.0708 13.9885 13.0461 13.9846 13.0219C13.9808 12.9978 13.9714 12.9749 13.9573 12.9549C13.9432 12.9349 13.9247 12.9185 13.9033 12.9068L13.6133 12.7001C13.5739 12.6762 13.5272 12.6674 13.4818 12.6754C13.4364 12.6833 13.3955 12.7075 13.3666 12.7434C13.2321 12.9033 13.0642 13.0318 12.8747 13.12C12.6853 13.2082 12.4789 13.2538 12.2699 13.2538C12.061 13.2538 11.8546 13.2082 11.6651 13.12C11.4757 13.0318 11.3078 12.9033 11.1733 12.7434C11.1277 12.6913 11.0864 12.6356 11.0499 12.5768C10.9268 12.3776 10.8582 12.1495 10.8512 11.9155C10.8442 11.6814 10.8989 11.4496 11.0099 11.2434C11.0314 11.2102 11.0389 11.1699 11.0308 11.1312C11.0227 11.0925 10.9996 11.0585 10.9666 11.0368L10.6333 10.7901C10.5891 10.7715 10.5396 10.7697 10.4942 10.7851C10.4487 10.8004 10.4105 10.8319 10.3866 10.8734C10.2376 11.1465 10.153 11.45 10.1391 11.7608C10.1253 12.0716 10.1825 12.3815 10.3066 12.6668C10.4127 12.938 10.5831 13.1794 10.8033 13.3701C11.1902 13.7461 11.7104 13.9534 12.2499 13.9468C12.5743 13.9565 12.8964 13.8902 13.1905 13.753C13.4845 13.6158 13.7424 13.4116 13.9433 13.1568Z' fill='white'/%3e%3c/svg%3e";
2482
-
2483
- var img$3 = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20Z' fill='%23279FEA'/%3e%3cpath d='M17.6865 10.0334C17.3062 9.49067 16.7772 9.06934 16.1632 8.82008C15.6426 8.61932 15.0801 8.55138 14.5267 8.62237C13.9733 8.69337 13.4462 8.90108 12.9932 9.22674C12.4991 9.62868 12.0519 10.0849 11.6598 10.5867L11.4232 10.8534L13.0198 11.5434L13.1498 11.4067C13.4002 11.1158 13.6697 10.8419 13.9565 10.5867C14.1891 10.4177 14.4599 10.3085 14.7448 10.269C15.0297 10.2294 15.3199 10.2607 15.5898 10.3601C15.916 10.4798 16.1929 10.7051 16.3765 11.0001C16.5305 11.2108 16.6383 11.4516 16.6932 11.7067C16.7448 11.9619 16.7448 12.2249 16.6932 12.4801C16.6319 12.8145 16.4783 13.125 16.2498 13.3767C16.0471 13.5809 15.7972 13.7319 15.5221 13.8162C15.2471 13.9005 14.9554 13.9156 14.6732 13.8601C14.318 13.7558 13.9714 13.6243 13.6365 13.4667L13.4598 13.3967L12.3032 14.6934L12.6365 14.8367C13.196 15.1144 13.7809 15.3376 14.3832 15.5034C14.841 15.5831 15.3102 15.5706 15.7632 15.4667C16.4116 15.3301 17.0012 14.9945 17.4498 14.5067C17.907 14.0252 18.2099 13.4182 18.3198 12.7634C18.4116 12.2979 18.4116 11.8189 18.3198 11.3534C18.186 10.8803 17.9717 10.4338 17.6865 10.0334Z' fill='white'/%3e%3cpath d='M12.8401 13.0499L11.2468 12.3599L11.1168 12.4966C10.8669 12.7942 10.5962 13.0738 10.3068 13.3332C10.0741 13.5023 9.80337 13.6115 9.51849 13.651C9.2336 13.6905 8.94336 13.6593 8.67345 13.5599C8.35219 13.4397 8.07852 13.2187 7.89345 12.9299C7.74251 12.7191 7.63591 12.4798 7.58012 12.2266C7.51653 11.9342 7.52262 11.6311 7.5979 11.3415C7.67318 11.052 7.81553 10.7842 8.01345 10.5599C8.2156 10.3551 8.46564 10.2039 8.74095 10.1201C9.01626 10.0363 9.30813 10.0225 9.59012 10.0799C9.94807 10.1781 10.2971 10.3063 10.6335 10.4632L10.8101 10.5299L11.9668 9.23324L11.6735 9.11324C11.1141 8.8326 10.5278 8.60924 9.92345 8.44657C9.37154 8.32869 8.79848 8.35611 8.26035 8.52614C7.72222 8.69617 7.23744 9.00299 6.85345 9.41657C6.38782 9.89208 6.08347 10.5019 5.98345 11.1599C5.88532 11.6248 5.88532 12.105 5.98345 12.5699C6.08588 13.0347 6.28211 13.4736 6.56012 13.8599C6.92983 14.4125 7.46217 14.8365 8.08345 15.0732C8.69864 15.3134 9.37049 15.369 10.0168 15.2332C10.4725 15.1299 10.9023 14.9348 11.2801 14.6599C11.7741 14.258 12.2214 13.8018 12.6135 13.2999L12.8401 13.0499Z' fill='white'/%3e%3c/svg%3e";
2484
-
2485
- var img$2 = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20Z' fill='%23F7B731'/%3e%3cpath d='M17.0168 10.4836C16.8598 10.4819 16.704 10.5111 16.5583 10.5697C16.4126 10.6282 16.2799 10.715 16.1679 10.8249C16.0558 10.9348 15.9665 11.0658 15.9051 11.2103C15.8437 11.3548 15.8114 11.51 15.8101 11.667C15.8125 11.8887 15.8759 12.1056 15.9934 12.2936L15.3268 13.0036C15.1062 12.8766 14.8516 12.8214 14.5982 12.8459C14.3449 12.8704 14.1055 12.9733 13.9134 13.1403L13.2168 12.667C13.3204 12.3753 13.3514 12.0627 13.307 11.7564C13.2626 11.45 13.1441 11.1591 12.9619 10.9089C12.7796 10.6587 12.5391 10.4567 12.2611 10.3204C11.9832 10.1842 11.6762 10.1178 11.3668 10.127C10.9257 10.1237 10.4963 10.268 10.1468 10.537L9.2801 9.74364C9.38078 9.56935 9.43368 9.37158 9.43343 9.1703C9.43084 9.01345 9.39725 8.85866 9.33461 8.71484C9.27197 8.57101 9.18151 8.44099 9.06844 8.33225C8.95537 8.22352 8.82191 8.13821 8.67575 8.08124C8.52958 8.02427 8.3736 7.99677 8.21677 8.0003C7.89915 8.00103 7.59426 8.12525 7.36658 8.34671C7.13891 8.56817 7.00628 8.86949 6.99677 9.18697C6.99848 9.34467 7.03153 9.50046 7.09399 9.64528C7.15645 9.7901 7.24707 9.92106 7.36059 10.0305C7.4741 10.14 7.60825 10.2259 7.75524 10.283C7.90222 10.3402 8.0591 10.3676 8.21677 10.3636C8.43906 10.3609 8.65657 10.2987 8.84677 10.1836L9.71343 10.977C9.49991 11.2949 9.3884 11.6704 9.39376 12.0533C9.39912 12.4363 9.5211 12.8085 9.74343 13.1203L9.07677 13.8303C8.87595 13.7162 8.64759 13.6597 8.41677 13.667C8.18607 13.6729 7.96224 13.7467 7.77327 13.8791C7.5843 14.0116 7.43859 14.1968 7.35437 14.4117C7.27015 14.6265 7.25115 14.8615 7.29975 15.087C7.34836 15.3126 7.46241 15.5189 7.62763 15.68C7.79286 15.8411 8.00192 15.9499 8.22867 15.9928C8.45542 16.0357 8.68978 16.0108 8.90244 15.9212C9.11509 15.8315 9.2966 15.6812 9.42425 15.4889C9.5519 15.2967 9.62002 15.0711 9.6201 14.8403C9.61839 14.6452 9.57041 14.4533 9.4801 14.2803L10.1468 13.5703C10.5613 13.8772 11.0792 14.0102 11.5902 13.9411C12.1013 13.872 12.5653 13.6062 12.8834 13.2003L13.5501 13.637C13.5048 13.7597 13.4811 13.8894 13.4801 14.0203C13.4963 14.3289 13.6304 14.6196 13.8546 14.8323C14.0788 15.045 14.376 15.1636 14.6851 15.1636C14.9942 15.1636 15.2914 15.045 15.5156 14.8323C15.7398 14.6196 15.8739 14.3289 15.8901 14.0203C15.8923 13.8081 15.8333 13.5998 15.7201 13.4203L16.3868 12.7103C16.5613 12.81 16.7591 12.8617 16.9601 12.8603C17.1212 12.8706 17.2827 12.8481 17.4348 12.794C17.5869 12.74 17.7264 12.6555 17.8448 12.5458C17.9633 12.4361 18.0581 12.3035 18.1237 12.156C18.1893 12.0085 18.2241 11.8492 18.2261 11.6878C18.2282 11.5264 18.1974 11.3662 18.1356 11.2171C18.0737 11.068 17.9822 10.933 17.8666 10.8203C17.751 10.7077 17.6137 10.6198 17.463 10.5619C17.3123 10.504 17.1514 10.4774 16.9901 10.4836H17.0168ZM11.3501 13.2436C11.1161 13.2377 10.8891 13.163 10.6973 13.0287C10.5056 12.8944 10.3578 12.7065 10.2723 12.4886C10.1868 12.2707 10.1675 12.0325 10.2167 11.8036C10.266 11.5748 10.3816 11.3656 10.5492 11.2021C10.7167 11.0387 10.9288 10.9283 11.1588 10.8848C11.3887 10.8412 11.6264 10.8665 11.8422 10.9574C12.0579 11.0483 12.242 11.2007 12.3714 11.3957C12.5009 11.5907 12.57 11.8196 12.5701 12.0536C12.5657 12.3719 12.4357 12.6756 12.2085 12.8985C11.9812 13.1214 11.6751 13.2454 11.3568 13.2436H11.3501Z' fill='white'/%3e%3c/svg%3e";
2486
-
2487
- var img$1 = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20Z' fill='%23205AB7'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M16.0859 8.30868C16.4108 8.42839 16.6831 8.6593 16.8542 8.96074L16.8628 8.97583L16.8705 8.99134C17.0174 9.28464 17.0775 9.61353 17.0441 9.93936C17.0123 11.03 16.8132 12.1093 16.4535 13.1395L16.4528 13.1415C16.1368 14.0377 15.4456 15.1335 14.6589 16.0108C14.2622 16.4533 13.8228 16.8611 13.3705 17.1668C12.9284 17.4656 12.4155 17.7067 11.8835 17.7262L11.8597 17.7271L11.8358 17.7262C11.291 17.7072 10.7708 17.4701 10.3204 17.1682C9.86244 16.8612 9.42376 16.4516 9.03057 16.0079C8.24999 15.1271 7.57941 14.0321 7.26533 13.1415L7.2645 13.1391C6.90532 12.1083 6.70674 11.0285 6.67566 9.93751C6.64229 9.61177 6.70236 9.28297 6.84922 8.98974L6.85684 8.97453L6.86522 8.95974C7.03585 8.65846 7.30747 8.42744 7.63179 8.30728L11.3874 6.76891C11.4429 6.74689 11.4996 6.7281 11.5571 6.71254C11.7538 6.6514 11.9644 6.6514 12.161 6.71254C12.2186 6.7281 12.2753 6.74693 12.3307 6.76895L12.3374 6.77159L16.0859 8.30868ZM11.9735 7.35255C11.8994 7.32695 11.8188 7.32695 11.7447 7.35255C11.7069 7.36213 11.6698 7.37415 11.6335 7.38855L7.87245 8.92913C7.69157 8.99369 7.53996 9.12117 7.44531 9.28828C7.35196 9.47467 7.31578 9.6845 7.34132 9.89139C7.36791 10.9234 7.55437 11.9449 7.89404 12.9198C8.45396 14.5075 10.3737 17.008 11.8591 17.06C13.2749 17.008 15.2642 14.5075 15.8241 12.9198C16.1642 11.9455 16.3512 10.9245 16.3784 9.89299C16.404 9.6861 16.3678 9.47627 16.2745 9.28988C16.1794 9.12247 16.0272 8.99495 15.8457 8.93073L12.0847 7.38855C12.0484 7.37415 12.0113 7.36213 11.9735 7.35255Z' fill='white'/%3e%3cpath d='M11.8631 8.29559L8.22357 9.77059V10.8904L11.8631 9.33705L15.5025 10.8904V9.77059L11.8631 8.29559Z' fill='white'/%3e%3cpath d='M10.6184 15.718C10.7942 16.0092 11.3957 16.4678 11.8633 16.4774C12.3078 16.4678 12.9324 16.0092 13.108 15.718C13.2835 15.4268 10.4426 15.427 10.6184 15.718Z' fill='white'/%3e%3c/svg%3e";
2488
-
2489
- var img = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='-8 -8 40 40' fill='none' xmlns='http://www.w3.org/2000/svg'%3e %3cpath d='M19.7521 0.348161H20.3976V2.23694H20.7722L20.7752 0.351063H21.4208V0.00290065L19.7521 0V0.348161Z' fill='%232B2B2B'/%3e %3cpath d='M22.31 0.00290065H21.7223V2.23114H22.0785L22.0816 0.438104H22.0877L22.718 2.23404H22.9799L23.6224 0.441005H23.6285L23.6255 2.23404H23.997L24 0.00290065H23.4093L22.8642 1.58994H22.8551L22.31 0.00290065Z' fill='%232B2B2B'/%3e %3cpath d='M16.4863 0C15.3048 0 14.5435 0.713733 14.5435 1.81915L14.5374 8.1557C13.3194 6.89362 11.4893 6.20309 9.34245 6.20019C4.36976 6.19729 0.00609663 10.3636 6.37628e-06 15.1219C-0.00608387 19.8453 4.35149 23.9942 9.32114 24C11.5258 24.0029 13.5904 22.9207 14.6836 21.853C14.8968 23.0135 15.6306 23.6489 16.7726 23.6489C17.7165 23.6489 18.4017 22.9584 18.4047 22.0068L18.4291 1.82495C18.4291 0.734042 17.6496 0.00290135 16.4863 0ZM9.28764 20.0803C6.42218 20.0774 4.08961 17.852 4.09266 15.1161C4.0957 12.383 6.43131 10.1605 9.29677 10.1634C12.1622 10.1663 14.4948 12.3917 14.4918 15.1277C14.4887 17.8607 12.1531 20.0832 9.28764 20.0803Z' fill='%232B2B2B'/%3e %3cpath d='M9.29431 11.7998C7.3363 11.7998 5.74979 13.3143 5.74979 15.1799C5.74979 17.0455 7.3363 18.56 9.29431 18.56C11.2523 18.56 12.8419 17.0455 12.8419 15.1799C12.8419 13.3143 11.2523 11.7998 9.29431 11.7998Z' fill='%23517934'/%3e%3c/svg%3e";
2490
-
2491
- // Takes a appType name and returns its logo as a data url.
2492
- // If appType does not exist the Digital.ai logo is returned.
2493
- var getLogoForAppType = function getLogoForAppType(appType) {
2494
- switch (appType) {
2495
- case 'Release':
2496
- {
2497
- return img$6;
2498
- }
2499
- case 'Deploy':
2500
- {
2501
- return img$5;
2502
- }
2503
- case 'Agility':
2504
- {
2505
- return img$4;
2506
- }
2507
- case 'Continuous Testing':
2508
- {
2509
- return img$3;
2510
- }
2511
- case 'Intelligence':
2512
- {
2513
- return img$2;
2514
- }
2515
- case 'Application Protection':
2516
- {
2517
- return img$1;
2518
- }
2519
- default:
2520
- {
2521
- return img;
2522
- }
2197
+ var calculateItemHeight = function calculateItemHeight(isDense, customItemHeight, menuItemHeight) {
2198
+ // Custom item height must NOT be lower than MENU_ITEM_HEIGHT_DENSE value
2199
+ if (customItemHeight && customItemHeight >= MENU_ITEM_HEIGHT_DENSE) {
2200
+ return customItemHeight;
2523
2201
  }
2524
- };
2525
- var daiAppsHeaderMenuItem = function daiAppsHeaderMenuItem(count) {
2526
- if (count === void 0) {
2527
- count = 0;
2202
+ var itemHeightType = typeof menuItemHeight;
2203
+ if (itemHeightType === 'number' || itemHeightType === 'string') {
2204
+ return menuItemHeight;
2205
+ } else {
2206
+ return getDefaultItemHeight(isDense);
2528
2207
  }
2529
- return {
2530
- children: jsxRuntime.jsxs(DotTypography, __assign({
2531
- className: "dai-apps-title"
2532
- }, {
2533
- children: ["DIGITAL.AI APPLICATIONS", count > 0 ? " (" + count + ")" : '']
2534
- }), "menu-item-dai-apps-title"),
2535
- key: 'dai-apps-title',
2536
- disabled: true,
2537
- divider: true,
2538
- height: 32
2539
- };
2540
2208
  };
2541
- var createMenuItem = function createMenuItem(url, title, subtitle) {
2542
- if (subtitle === void 0) {
2543
- subtitle = null;
2209
+ var getNumberOfVisibleItems = function getNumberOfVisibleItems(numberOfItems, maxVisibleItems) {
2210
+ if (maxVisibleItems && maxVisibleItems > 0) {
2211
+ return maxVisibleItems <= numberOfItems ? maxVisibleItems : numberOfItems;
2544
2212
  }
2545
- return jsxRuntime.jsxs("div", __assign({
2546
- className: "app-menu-item"
2547
- }, {
2548
- children: [jsxRuntime.jsx(DotLink, __assign({
2549
- href: url,
2550
- color: "textPrimary",
2551
- target: "_blank"
2552
- }, {
2553
- children: jsxRuntime.jsxs("div", __assign({
2554
- className: "logo-title"
2555
- }, {
2556
- children: [jsxRuntime.jsx(DotIcon, {
2557
- iconId: "open-new-tab"
2558
- }, void 0), jsxRuntime.jsxs("div", __assign({
2559
- className: "dot-app-switcher-app-title"
2560
- }, {
2561
- children: [jsxRuntime.jsx(DotTypography, __assign({
2562
- variant: "body1"
2563
- }, {
2564
- children: title
2565
- }), void 0), subtitle && jsxRuntime.jsx(DotTypography, __assign({
2566
- variant: "body2"
2567
- }, {
2568
- children: subtitle
2569
- }), void 0)]
2570
- }), void 0)]
2571
- }), void 0)
2572
- }), void 0), jsxRuntime.jsx(DotCopyButton, {
2573
- copyTooltip: "Copy application URL",
2574
- value: url
2575
- }, void 0)]
2576
- }), "app-menu-item-" + title);
2213
+ return DEFAULT_MAX_VISIBLE_ITEMS;
2577
2214
  };
2578
- var createTopLevelMenuItem = function createTopLevelMenuItem(url, logo, title, openNewTab) {
2579
- if (openNewTab === void 0) {
2580
- openNewTab = true;
2215
+ var calculateMaxHeight = function calculateMaxHeight(_a) {
2216
+ var isDense = _a.isDense,
2217
+ maxVisibleItems = _a.maxVisibleItems,
2218
+ menuItems = _a.menuItems,
2219
+ menuItemHeight = _a.menuItemHeight;
2220
+ // if menuItemHeight is "auto" set maxHeight as same
2221
+ if (typeof menuItemHeight === 'string') {
2222
+ return menuItemHeight;
2581
2223
  }
2582
- // Creates an entry in the AppSwitcher at the same level as the AppTypeLabels, used for the Platform link and
2583
- // Empty state current application link
2584
- var target = openNewTab ? '_blank' : '_self';
2585
- return jsxRuntime.jsxs(DotLink, __assign({
2586
- href: url,
2587
- color: "textPrimary",
2588
- target: target
2589
- }, {
2590
- children: [jsxRuntime.jsxs("div", __assign({
2591
- className: "logo-title"
2592
- }, {
2593
- children: [jsxRuntime.jsx(DotAvatar, {
2594
- alt: "app image",
2595
- imageSrc: logo,
2596
- type: "image",
2597
- variant: "circular"
2598
- }, void 0), jsxRuntime.jsx("div", __assign({
2599
- className: "dot-app-switcher-app-title"
2600
- }, {
2601
- children: jsxRuntime.jsx(DotTypography, __assign({
2602
- variant: "body1"
2603
- }, {
2604
- children: title
2605
- }), void 0)
2606
- }), void 0)]
2607
- }), void 0), openNewTab && jsxRuntime.jsx(DotIcon, {
2608
- iconId: "open-new-tab"
2609
- }, void 0)]
2610
- }), "top-menu-item-" + title);
2224
+ // If 'menuItemHeight' is set it will take precedence here
2225
+ var itemHeight = menuItemHeight ? menuItemHeight : getDefaultItemHeight(isDense);
2226
+ var maxHeight = 0;
2227
+ var numberOfVisibleItems = getNumberOfVisibleItems(menuItems.length, maxVisibleItems);
2228
+ var visibleItems = menuItems.slice(0, numberOfVisibleItems);
2229
+ visibleItems.forEach(function (_a) {
2230
+ var height = _a.height;
2231
+ var customItemHeight = height ? height : itemHeight;
2232
+ // + 3 is for bottom margin of menuItem
2233
+ maxHeight += customItemHeight + 3;
2234
+ });
2235
+ return maxHeight;
2611
2236
  };
2612
- var createAppTypeLabel = function createAppTypeLabel(appTypeName, logo, appProps) {
2613
- var logoProps = logo ? {
2614
- imageSrc: logo
2615
- } : {
2616
- iconId: 'collection'
2617
- };
2618
- return jsxRuntime.jsxs("div", __assign({
2619
- className: "logo-title"
2620
- }, {
2621
- children: [jsxRuntime.jsx(DotAvatar, __assign({}, logoProps, {
2622
- alt: "app image",
2623
- type: "image",
2624
- variant: "circular"
2625
- }), void 0), jsxRuntime.jsxs("div", __assign({
2626
- className: "dot-app-switcher-app-title"
2627
- }, {
2628
- children: [jsxRuntime.jsx(DotTypography, __assign({
2629
- variant: "body1"
2630
- }, {
2631
- children: appTypeName
2632
- }), void 0), jsxRuntime.jsxs(DotTypography, __assign({
2633
- variant: "body2"
2634
- }, {
2635
- children: ["Instance (", appProps.length, ")"]
2636
- }), void 0)]
2637
- }), void 0)]
2638
- }), void 0);
2237
+ var checkForSubItems = function checkForSubItems(menuItems) {
2238
+ return menuItems.some(function (menuItem) {
2239
+ return menuItem.items && menuItems.length > 0;
2240
+ });
2639
2241
  };
2640
- var getInstanceStateText = function getInstanceStateText(application) {
2641
- if (application.instance_state === 1) {
2642
- return 'Production instance';
2643
- }
2644
- return 'Non-production instance';
2242
+ var checkIfSubmenu = function checkIfSubmenu(anchorElement) {
2243
+ if (!anchorElement) return false;
2244
+ return anchorElement.classList.contains(listItemWithSubmenuClassName);
2245
+ };
2246
+ var checkIfMenuItemSelected = function checkIfMenuItemSelected(key, selectedKey, activeSubmenu) {
2247
+ return selectedKey === key || activeSubmenu === key;
2248
+ };
2249
+ var checkForAutoFocus = function checkForAutoFocus(autoFocusItem, isFirstItem) {
2250
+ return !!(autoFocusItem && isFirstItem);
2645
2251
  };
2646
2252
 
2647
- var rootClassName$T = 'dot-drawer';
2648
- var StyledDrawer = styled__default["default"](material.Drawer).withConfig({
2649
- displayName: "Drawerstyles__StyledDrawer",
2650
- componentId: "sc-1uiowy0-0"
2651
- })(templateObject_2$U || (templateObject_2$U = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
2652
- var theme = _a.theme;
2653
- return styled.css(templateObject_1$Y || (templateObject_1$Y = __makeTemplateObject(["\n &.", " .MuiBackdrop-root {\n background-color: ", ";\n }\n\n .dot-drawer-paper {\n height: ", ";\n padding: ", ";\n width: ", ";\n }\n "], ["\n &.", " .MuiBackdrop-root {\n background-color: ", ";\n }\n\n .dot-drawer-paper {\n height: ", ";\n padding: ", ";\n width: ", ";\n }\n "])), rootClassName$T, styles.alpha(theme.palette.grey[900], 0.7), function (_a) {
2654
- var height = _a.height,
2655
- anchor = _a.anchor;
2656
- return anchor === 'left' || anchor === 'right' ? '100%' : height;
2657
- }, theme.spacing(2), function (_a) {
2658
- var width = _a.width,
2659
- anchor = _a.anchor;
2660
- return anchor === 'bottom' || anchor === 'top' ? 'auto' : width;
2661
- });
2662
- });
2663
- var templateObject_1$Y, templateObject_2$U;
2664
-
2665
- var rootClassName$S = 'dot-drawer-header';
2666
- var StyleDrawerHeader = styled__default["default"].div.withConfig({
2667
- displayName: "DrawerHeaderstyles__StyleDrawerHeader",
2668
- componentId: "sc-2d2xd3-0"
2669
- })(templateObject_2$T || (templateObject_2$T = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
2670
- var theme = _a.theme;
2671
- return styled.css(templateObject_1$X || (templateObject_1$X = __makeTemplateObject(["\n &.", " {\n padding: ", ";\n display: flex;\n align-items: center;\n .close-button {\n margin-left: auto;\n }\n }\n "], ["\n &.", " {\n padding: ", ";\n display: flex;\n align-items: center;\n .close-button {\n margin-left: auto;\n }\n }\n "])), rootClassName$S, theme.spacing(0, 0, 2));
2672
- });
2673
- var templateObject_1$X, templateObject_2$T;
2674
-
2675
- var DotDrawerHeader = function DotDrawerHeader(_a) {
2676
- var ariaLabel = _a.ariaLabel,
2677
- children = _a.children,
2253
+ /**
2254
+ * Since this component is used inside 'ClickAwayListener',
2255
+ * it needs to be contained within 'forwardRef' function
2256
+ */
2257
+ var DotMenuList = /*#__PURE__*/React.forwardRef(function (_a, ref) {
2258
+ var autoFocusItem = _a.autoFocusItem,
2678
2259
  className = _a.className,
2679
2260
  dataTestId = _a["data-testid"],
2680
- onClose = _a.onClose,
2681
- variant = _a.variant;
2261
+ dense = _a.dense,
2262
+ id = _a.id,
2263
+ maxVisibleItems = _a.maxVisibleItems,
2264
+ menuItemHeight = _a.menuItemHeight,
2265
+ menuItems = _a.menuItems,
2266
+ onItemSelect = _a.onItemSelect,
2267
+ onKeyDown = _a.onKeyDown,
2268
+ onSubMenuCreate = _a.onSubMenuCreate,
2269
+ selectedKey = _a.selectedKey;
2682
2270
  var rootClasses = useStylesWithRootClass(rootClassName$S, className);
2683
- return jsxRuntime.jsxs(StyleDrawerHeader, __assign({
2684
- "aria-label": ariaLabel,
2685
- className: rootClasses,
2686
- "data-testid": dataTestId
2271
+ var _b = React.useState(null),
2272
+ activeSubmenu = _b[0],
2273
+ setActiveSubmenu = _b[1];
2274
+ var _c = React.useState(null),
2275
+ subItemAnchorEl = _c[0],
2276
+ setSubItemAnchorEl = _c[1];
2277
+ var openSubmenu = function openSubmenu(target, itemKey) {
2278
+ // Set new anchor for submenu and active submenu key
2279
+ // so that new submenu can be opened
2280
+ setSubItemAnchorEl(target);
2281
+ setActiveSubmenu(itemKey);
2282
+ };
2283
+ var closeActiveSubmenu = function closeActiveSubmenu() {
2284
+ // We want to clean active submenu state if it exists.
2285
+ // This will make previous submenu disappear when
2286
+ // hovering to item with no submenu items
2287
+ activeSubmenu && setActiveSubmenu(null);
2288
+ };
2289
+ var getMouseEnterHandler = function getMouseEnterHandler(itemKey, hasSubmenu) {
2290
+ return function (event) {
2291
+ hasSubmenu ? openSubmenu(event.currentTarget, itemKey) : closeActiveSubmenu();
2292
+ };
2293
+ };
2294
+ return jsxRuntime.jsx(StyledMenuList, __assign({
2295
+ classes: {
2296
+ root: rootClasses
2297
+ },
2298
+ "data-testid": dataTestId,
2299
+ dense: dense,
2300
+ id: id,
2301
+ onKeyDown: onKeyDown,
2302
+ style: {
2303
+ height: calculateMaxHeight({
2304
+ isDense: dense,
2305
+ maxVisibleItems: maxVisibleItems,
2306
+ menuItems: menuItems,
2307
+ menuItemHeight: menuItemHeight
2308
+ })
2309
+ }
2687
2310
  }, {
2688
- children: [children, variant !== 'permanent' && jsxRuntime.jsx(DotIconButton, {
2689
- className: "close-button",
2690
- iconId: "close",
2691
- onClick: onClose
2692
- }, void 0)]
2311
+ children: menuItems.map(function (item, index) {
2312
+ var itemAriaLabel = item.ariaLabel,
2313
+ children = item.children,
2314
+ classes = item.classes,
2315
+ disabled = item.disabled,
2316
+ divider = item.divider,
2317
+ height = item.height,
2318
+ subItems = item.items,
2319
+ key = item.key;
2320
+ var itemHeight = calculateItemHeight(dense, height, menuItemHeight);
2321
+ var isSelected = checkIfMenuItemSelected(key, selectedKey, activeSubmenu);
2322
+ var isFirstItem = index === 0;
2323
+ var hasSubmenu = !!subItems;
2324
+ var hasAutoFocus = checkForAutoFocus(autoFocusItem, isFirstItem);
2325
+ var menuItemClasses = useStylesWithRootClass(listItemClassName$1, hasSubmenu ? listItemWithSubmenuClassName : '', classes ? classes : '');
2326
+ var handleClick = function handleClick(event) {
2327
+ // Execute select callback only for items which does not have
2328
+ // submenu defined. If there is no menu or handler - prevent
2329
+ // further propagation of the current event so that click on
2330
+ // items with submenu does not close the menu
2331
+ !hasSubmenu && onItemSelect ? onItemSelect(event, key) : event.stopPropagation();
2332
+ };
2333
+ /**
2334
+ * If there is submenu, right arrow icon will be added
2335
+ * and sub-menu will be rendered
2336
+ */
2337
+ return jsxRuntime.jsxs(material.MenuItem, __assign({
2338
+ autoFocus: hasAutoFocus,
2339
+ "aria-label": itemAriaLabel,
2340
+ className: menuItemClasses,
2341
+ disabled: disabled,
2342
+ disableRipple: hasSubmenu,
2343
+ divider: divider,
2344
+ onClick: handleClick,
2345
+ onMouseEnter: getMouseEnterHandler(key, hasSubmenu),
2346
+ ref: ref,
2347
+ style: {
2348
+ height: itemHeight
2349
+ },
2350
+ selected: isSelected
2351
+ }, {
2352
+ children: [children, hasSubmenu && jsxRuntime.jsx(DotIcon, {
2353
+ "data-testid": "dot-item-arrow-icon",
2354
+ iconId: "arrow-right"
2355
+ }, void 0), hasSubmenu && onSubMenuCreate({
2356
+ anchorElement: subItemAnchorEl,
2357
+ isOpened: isSelected,
2358
+ subMenuId: key,
2359
+ subMenuItems: subItems
2360
+ })]
2361
+ }), key);
2362
+ })
2693
2363
  }), void 0);
2694
- };
2695
-
2696
- var rootClassName$R = 'dot-drawer-body';
2697
- var StyleDrawerBody = styled__default["default"].div.withConfig({
2698
- displayName: "DrawerBodystyles__StyleDrawerBody",
2699
- componentId: "sc-1mpmjdk-0"
2700
- })(templateObject_2$S || (templateObject_2$S = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function () {
2701
- return styled.css(templateObject_1$W || (templateObject_1$W = __makeTemplateObject(["\n &.", " {\n display: flex;\n .dot-drawer-close-button {\n align-self: self-start;\n padding: 0;\n margin-left: auto;\n }\n }\n "], ["\n &.", " {\n display: flex;\n .dot-drawer-close-button {\n align-self: self-start;\n padding: 0;\n margin-left: auto;\n }\n }\n "])), rootClassName$R);
2702
2364
  });
2703
- var templateObject_1$W, templateObject_2$S;
2704
2365
 
2705
- var DotDrawerBody = function DotDrawerBody(_a) {
2706
- var ariaLabel = _a.ariaLabel,
2707
- children = _a.children,
2366
+ var DotMenu = function DotMenu(_a) {
2367
+ var anchorEl = _a.anchorEl,
2368
+ ariaLabel = _a.ariaLabel,
2708
2369
  className = _a.className,
2709
2370
  dataTestId = _a["data-testid"],
2710
- headerExists = _a.headerExists,
2711
- onClose = _a.onClose,
2712
- variant = _a.variant;
2713
- var rootClasses = useStylesWithRootClass(rootClassName$R, className);
2714
- return jsxRuntime.jsxs(StyleDrawerBody, __assign({
2371
+ _b = _a.dense,
2372
+ dense = _b === void 0 ? true : _b,
2373
+ disablePortal = _a.disablePortal,
2374
+ id = _a.id,
2375
+ _c = _a.loading,
2376
+ loading = _c === void 0 ? false : _c,
2377
+ _d = _a.maxVisibleItems,
2378
+ maxVisibleItems = _d === void 0 ? DEFAULT_MAX_VISIBLE_ITEMS : _d,
2379
+ menuItemHeight = _a.menuItemHeight,
2380
+ _e = _a.menuItems,
2381
+ menuItems = _e === void 0 ? [] : _e,
2382
+ _f = _a.menuPlacement,
2383
+ menuPlacement = _f === void 0 ? 'bottom' : _f,
2384
+ onLeave = _a.onLeave,
2385
+ onSelect = _a.onSelect,
2386
+ _g = _a.open,
2387
+ open = _g === void 0 ? false : _g,
2388
+ selectedKey = _a.selectedKey;
2389
+ var rootClasses = useStylesWithRootClass(rootClassName$T, className, loading ? 'loading' : '');
2390
+ var isSubmenu = checkIfSubmenu(anchorEl);
2391
+ var hasSubItems = checkForSubItems(menuItems);
2392
+ // Timeout object is customizable when Menu component is either submenu
2393
+ // (it is opened within parent menu) or it contains at least one item which
2394
+ // has sub-items. This is done because when multi-level menu is closing it
2395
+ // will first close the parent and only then child menus - which looks
2396
+ // a bit weird - so here I'm giving it exit value of 0 so that it looks like
2397
+ // they all close at the same time. For "normal" menus, timeout is unnecessary.
2398
+ var timeout = isSubmenu || hasSubItems ? {
2399
+ exit: 0,
2400
+ enter: 300
2401
+ } : undefined;
2402
+ var handleSelect = function handleSelect(event, itemKey) {
2403
+ onLeave && onLeave(event);
2404
+ onSelect && onSelect(event, id, itemKey);
2405
+ };
2406
+ var handleListKeyDown = function handleListKeyDown(event) {
2407
+ if (onLeave && event.key === 'Tab') {
2408
+ event.preventDefault();
2409
+ onLeave(event);
2410
+ }
2411
+ };
2412
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2413
+ var handleClickAway = function handleClickAway(event) {
2414
+ if (onLeave && (!anchorEl || !anchorEl.contains(event.currentTarget))) {
2415
+ onLeave(event);
2416
+ }
2417
+ };
2418
+ return jsxRuntime.jsx(StyledPopper, __assign({
2419
+ anchorEl: anchorEl,
2715
2420
  "aria-label": ariaLabel,
2716
2421
  className: rootClasses,
2717
- "data-testid": dataTestId
2422
+ "data-testid": dataTestId,
2423
+ disablePortal: disablePortal,
2424
+ open: open,
2425
+ placement: menuPlacement,
2426
+ role: undefined,
2427
+ transition: true
2718
2428
  }, {
2719
- children: [children, !headerExists && variant !== 'permanent' && jsxRuntime.jsx(DotIconButton, {
2720
- className: "dot-drawer-close-button",
2721
- iconId: "close",
2722
- onClick: onClose
2723
- }, void 0)]
2429
+ children: function (_a) {
2430
+ var TransitionProps = _a.TransitionProps,
2431
+ placement = _a.placement;
2432
+ return jsxRuntime.jsx(material.Fade, __assign({}, TransitionProps, {
2433
+ style: {
2434
+ transformOrigin: placement === 'bottom' ? 'center top' : 'center bottom'
2435
+ },
2436
+ timeout: timeout
2437
+ }, {
2438
+ children: jsxRuntime.jsx(material.Paper, {
2439
+ children: jsxRuntime.jsx(material.ClickAwayListener, __assign({
2440
+ onClickAway: handleClickAway
2441
+ }, {
2442
+ children: loading ? jsxRuntime.jsx(DotProgress, {
2443
+ "data-testid": "loading-indicator",
2444
+ tooltip: "Loading Data...",
2445
+ value: 20
2446
+ }, void 0) : jsxRuntime.jsx(DotMenuList, {
2447
+ autoFocusItem: open,
2448
+ "data-testid": dataTestId + "-menu",
2449
+ dense: dense,
2450
+ id: id,
2451
+ maxVisibleItems: maxVisibleItems,
2452
+ menuItemHeight: menuItemHeight,
2453
+ menuItems: menuItems,
2454
+ onItemSelect: handleSelect,
2455
+ onKeyDown: handleListKeyDown,
2456
+ onSubMenuCreate: function (_a) {
2457
+ var anchorElement = _a.anchorElement,
2458
+ isOpened = _a.isOpened,
2459
+ subMenuId = _a.subMenuId,
2460
+ subMenuItems = _a.subMenuItems;
2461
+ return jsxRuntime.jsx(DotMenu, {
2462
+ anchorEl: anchorElement,
2463
+ menuPlacement: "right-start",
2464
+ id: subMenuId,
2465
+ menuItems: subMenuItems,
2466
+ open: isOpened,
2467
+ onLeave: onLeave,
2468
+ onSelect: onSelect,
2469
+ selectedKey: selectedKey
2470
+ }, void 0);
2471
+ },
2472
+ selectedKey: selectedKey
2473
+ }, void 0)
2474
+ }), void 0)
2475
+ }, void 0)
2476
+ }), void 0);
2477
+ }
2724
2478
  }), void 0);
2725
2479
  };
2726
2480
 
2727
- var rootClassName$Q = 'dot-drawer-footer';
2728
- var StyleDrawerFooter = styled__default["default"].div.withConfig({
2729
- displayName: "DrawerFooterstyles__StyleDrawerFooter",
2730
- componentId: "sc-1ki05ze-0"
2481
+ var CreateUUID = function CreateUUID() {
2482
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
2483
+ var r = Math.random() * 16 | 0,
2484
+ v = c === 'x' ? r : r & 0x3 | 0x8;
2485
+ return v.toString(16);
2486
+ });
2487
+ };
2488
+
2489
+ var rootClassName$R = 'dot-drawer';
2490
+ var StyledDrawer = styled__default["default"](material.Drawer).withConfig({
2491
+ displayName: "Drawerstyles__StyledDrawer",
2492
+ componentId: "sc-1uiowy0-0"
2493
+ })(templateObject_2$S || (templateObject_2$S = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
2494
+ var theme = _a.theme;
2495
+ return styled.css(templateObject_1$V || (templateObject_1$V = __makeTemplateObject(["\n &.", " .MuiBackdrop-root {\n background-color: ", ";\n }\n\n .dot-drawer-paper {\n height: ", ";\n padding: ", ";\n width: ", ";\n }\n "], ["\n &.", " .MuiBackdrop-root {\n background-color: ", ";\n }\n\n .dot-drawer-paper {\n height: ", ";\n padding: ", ";\n width: ", ";\n }\n "])), rootClassName$R, styles.alpha(theme.palette.grey[900], 0.7), function (_a) {
2496
+ var height = _a.height,
2497
+ anchor = _a.anchor;
2498
+ return anchor === 'left' || anchor === 'right' ? '100%' : height;
2499
+ }, theme.spacing(2), function (_a) {
2500
+ var width = _a.width,
2501
+ anchor = _a.anchor;
2502
+ return anchor === 'bottom' || anchor === 'top' ? 'auto' : width;
2503
+ });
2504
+ });
2505
+ var templateObject_1$V, templateObject_2$S;
2506
+
2507
+ var rootClassName$Q = 'dot-drawer-header';
2508
+ var StyleDrawerHeader = styled__default["default"].div.withConfig({
2509
+ displayName: "DrawerHeaderstyles__StyleDrawerHeader",
2510
+ componentId: "sc-2d2xd3-0"
2731
2511
  })(templateObject_2$R || (templateObject_2$R = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
2732
2512
  var theme = _a.theme;
2733
- return styled.css(templateObject_1$V || (templateObject_1$V = __makeTemplateObject(["\n &.", " {\n padding: ", ";\n }\n "], ["\n &.", " {\n padding: ", ";\n }\n "])), rootClassName$Q, theme.spacing(2, 0, 0));
2513
+ return styled.css(templateObject_1$U || (templateObject_1$U = __makeTemplateObject(["\n &.", " {\n padding: ", ";\n display: flex;\n align-items: center;\n .close-button {\n margin-left: auto;\n }\n }\n "], ["\n &.", " {\n padding: ", ";\n display: flex;\n align-items: center;\n .close-button {\n margin-left: auto;\n }\n }\n "])), rootClassName$Q, theme.spacing(0, 0, 2));
2514
+ });
2515
+ var templateObject_1$U, templateObject_2$R;
2516
+
2517
+ var rootClassName$P = 'dot-icon-btn';
2518
+ var StyledIconButton = styled__default["default"](material.IconButton).withConfig({
2519
+ displayName: "IconButtonstyles__StyledIconButton",
2520
+ componentId: "eko0kb-0"
2521
+ })(templateObject_2$Q || (templateObject_2$Q = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function () {
2522
+ return styled.css(templateObject_1$T || (templateObject_1$T = __makeTemplateObject(["\n &.", " {\n font-size: inherit;\n padding: 10px;\n\n .dot-icon.MuiIcon-fontSizeSmall {\n padding: 1px;\n }\n\n &.MuiIconButton-sizeSmall {\n padding: 3px;\n }\n\n &.ripple-disabled {\n &:hover, &:active, &:focus {\n background: ", ";\n }\n }\n "], ["\n &.", " {\n font-size: inherit;\n padding: 10px;\n\n .dot-icon.MuiIcon-fontSizeSmall {\n padding: 1px;\n }\n\n &.MuiIconButton-sizeSmall {\n padding: 3px;\n }\n\n &.ripple-disabled {\n &:hover, &:active, &:focus {\n background: ", ";\n }\n }\n "])), rootClassName$P, hoverGray);
2523
+ });
2524
+ var templateObject_1$T, templateObject_2$Q;
2525
+
2526
+ var DotIconButton = function DotIconButton(_a) {
2527
+ var ariaLabel = _a.ariaLabel,
2528
+ className = _a.className,
2529
+ _b = _a.color,
2530
+ color = _b === void 0 ? 'inherit' : _b,
2531
+ dataTestId = _a["data-testid"],
2532
+ _c = _a.disabled,
2533
+ disabled = _c === void 0 ? false : _c,
2534
+ _d = _a.disableRipple,
2535
+ disableRipple = _d === void 0 ? false : _d,
2536
+ iconId = _a.iconId,
2537
+ _e = _a.iconSize,
2538
+ iconSize = _e === void 0 ? 'small' : _e,
2539
+ onClick = _a.onClick,
2540
+ tooltip = _a.tooltip,
2541
+ _f = _a.size,
2542
+ size = _f === void 0 ? 'medium' : _f;
2543
+ var rippleClassName = disableRipple ? 'ripple-disabled' : '';
2544
+ var rootClasses = useStylesWithRootClass(rootClassName$P, rippleClassName, className);
2545
+ return jsxRuntime.jsx(DotTooltip, __assign({
2546
+ "data-testid": "icon-button-tooltip",
2547
+ title: tooltip
2548
+ }, {
2549
+ children: jsxRuntime.jsx(StyledIconButton, __assign({
2550
+ "aria-label": ariaLabel,
2551
+ classes: {
2552
+ root: rootClasses
2553
+ },
2554
+ color: color,
2555
+ "data-testid": dataTestId,
2556
+ disableRipple: disableRipple,
2557
+ disabled: disabled,
2558
+ onClick: function (event) {
2559
+ return onClick && onClick(event);
2560
+ },
2561
+ size: size
2562
+ }, {
2563
+ children: jsxRuntime.jsx(DotIcon, {
2564
+ "data-testid": "button-icon",
2565
+ fontSize: iconSize,
2566
+ iconId: iconId
2567
+ }, void 0)
2568
+ }), void 0)
2569
+ }), void 0);
2570
+ };
2571
+
2572
+ var DotDrawerHeader = function DotDrawerHeader(_a) {
2573
+ var ariaLabel = _a.ariaLabel,
2574
+ children = _a.children,
2575
+ className = _a.className,
2576
+ dataTestId = _a["data-testid"],
2577
+ onClose = _a.onClose,
2578
+ variant = _a.variant;
2579
+ var rootClasses = useStylesWithRootClass(rootClassName$Q, className);
2580
+ return jsxRuntime.jsxs(StyleDrawerHeader, __assign({
2581
+ "aria-label": ariaLabel,
2582
+ className: rootClasses,
2583
+ "data-testid": dataTestId
2584
+ }, {
2585
+ children: [children, variant !== 'permanent' && jsxRuntime.jsx(DotIconButton, {
2586
+ className: "close-button",
2587
+ iconId: "close",
2588
+ onClick: onClose
2589
+ }, void 0)]
2590
+ }), void 0);
2591
+ };
2592
+
2593
+ var rootClassName$O = 'dot-drawer-body';
2594
+ var StyleDrawerBody = styled__default["default"].div.withConfig({
2595
+ displayName: "DrawerBodystyles__StyleDrawerBody",
2596
+ componentId: "sc-1mpmjdk-0"
2597
+ })(templateObject_2$P || (templateObject_2$P = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function () {
2598
+ return styled.css(templateObject_1$S || (templateObject_1$S = __makeTemplateObject(["\n &.", " {\n display: flex;\n .dot-drawer-close-button {\n align-self: self-start;\n padding: 0;\n margin-left: auto;\n }\n }\n "], ["\n &.", " {\n display: flex;\n .dot-drawer-close-button {\n align-self: self-start;\n padding: 0;\n margin-left: auto;\n }\n }\n "])), rootClassName$O);
2599
+ });
2600
+ var templateObject_1$S, templateObject_2$P;
2601
+
2602
+ var DotDrawerBody = function DotDrawerBody(_a) {
2603
+ var ariaLabel = _a.ariaLabel,
2604
+ children = _a.children,
2605
+ className = _a.className,
2606
+ dataTestId = _a["data-testid"],
2607
+ headerExists = _a.headerExists,
2608
+ onClose = _a.onClose,
2609
+ variant = _a.variant;
2610
+ var rootClasses = useStylesWithRootClass(rootClassName$O, className);
2611
+ return jsxRuntime.jsxs(StyleDrawerBody, __assign({
2612
+ "aria-label": ariaLabel,
2613
+ className: rootClasses,
2614
+ "data-testid": dataTestId
2615
+ }, {
2616
+ children: [children, !headerExists && variant !== 'permanent' && jsxRuntime.jsx(DotIconButton, {
2617
+ className: "dot-drawer-close-button",
2618
+ iconId: "close",
2619
+ onClick: onClose
2620
+ }, void 0)]
2621
+ }), void 0);
2622
+ };
2623
+
2624
+ var rootClassName$N = 'dot-drawer-footer';
2625
+ var StyleDrawerFooter = styled__default["default"].div.withConfig({
2626
+ displayName: "DrawerFooterstyles__StyleDrawerFooter",
2627
+ componentId: "sc-1ki05ze-0"
2628
+ })(templateObject_2$O || (templateObject_2$O = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
2629
+ var theme = _a.theme;
2630
+ return styled.css(templateObject_1$R || (templateObject_1$R = __makeTemplateObject(["\n &.", " {\n padding: ", ";\n }\n "], ["\n &.", " {\n padding: ", ";\n }\n "])), rootClassName$N, theme.spacing(2, 0, 0));
2734
2631
  });
2735
- var templateObject_1$V, templateObject_2$R;
2632
+ var templateObject_1$R, templateObject_2$O;
2736
2633
 
2737
2634
  var DotDrawerFooter = function DotDrawerFooter(_a) {
2738
2635
  var ariaLabel = _a.ariaLabel,
2739
2636
  children = _a.children,
2740
2637
  className = _a.className,
2741
2638
  dataTestId = _a["data-testid"];
2742
- var rootClasses = useStylesWithRootClass(rootClassName$Q, className);
2639
+ var rootClasses = useStylesWithRootClass(rootClassName$N, className);
2743
2640
  return jsxRuntime.jsx(StyleDrawerFooter, __assign({
2744
2641
  "aria-label": ariaLabel,
2745
2642
  className: rootClasses,
@@ -2778,7 +2675,7 @@
2778
2675
  onClose(event);
2779
2676
  }
2780
2677
  };
2781
- var rootClasses = useStylesWithRootClass(rootClassName$T, className);
2678
+ var rootClasses = useStylesWithRootClass(rootClassName$R, className);
2782
2679
  var headerExists = !!drawerHeaderProps;
2783
2680
  var bodyTestId = drawerBodyProps ? drawerBodyProps["data-testid"] : 'drawer-body';
2784
2681
  return jsxRuntime.jsxs(StyledDrawer, __assign({
@@ -2821,1061 +2718,1274 @@
2821
2718
  }), void 0);
2822
2719
  };
2823
2720
 
2824
- var rootClassName$P = 'dot-app-switcher';
2825
- var StyledAppSwitcher = styled__default["default"](DotDrawer).withConfig({
2826
- displayName: "AppSwitcherstyles__StyledAppSwitcher",
2827
- componentId: "hhxfqg-0"
2828
- })(templateObject_2$Q || (templateObject_2$Q = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
2829
- var theme = _a.theme;
2830
- return styled.css(templateObject_1$U || (templateObject_1$U = __makeTemplateObject(["\n &.", " {\n .app-menu-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n .dot-link,\n .product-menu-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n height: 64px;\n text-decoration: none;\n cursor: pointer;\n }\n .logo-title {\n display: flex;\n align-items: center;\n gap: 24px;\n width: 100%;\n }\n .dot-avatar {\n flex-basis: 40px;\n }\n .dai-apps-title {\n display: flex;\n align-items: center;\n height: 32px;\n padding: ", ";\n background-color: ", ";\n }\n .dot-app-switcher-app-title {\n min-width: 150px;\n }\n .dot-icon {\n flex-basis: content;\n }\n .app-switcher-header {\n .app-switcher-header-title {\n padding-left: ", ";\n display: flex;\n align-items: center;\n }\n display: flex;\n justify-content: space-between;\n align-items: end;\n border-bottom: 1px solid ", ";\n margin: ", ";\n padding-bottom: ", ";\n .app-switcher-label {\n padding-left: ", ";\n }\n }\n .app-switcher-back-button {\n &.dot-button.MuiButton-text {\n padding-left: 0;\n }\n }\n .product-heading {\n display: flex;\n align-items: center;\n gap: 24px;\n padding-bottom: ", ";\n }\n .product-applications {\n width: 100%;\n overflow-y: auto;\n }\n .product-applications-search {\n margin-bottom: ", ";\n }\n }\n "], ["\n &.", " {\n .app-menu-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n .dot-link,\n .product-menu-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n height: 64px;\n text-decoration: none;\n cursor: pointer;\n }\n .logo-title {\n display: flex;\n align-items: center;\n gap: 24px;\n width: 100%;\n }\n .dot-avatar {\n flex-basis: 40px;\n }\n .dai-apps-title {\n display: flex;\n align-items: center;\n height: 32px;\n padding: ", ";\n background-color: ", ";\n }\n .dot-app-switcher-app-title {\n min-width: 150px;\n }\n .dot-icon {\n flex-basis: content;\n }\n .app-switcher-header {\n .app-switcher-header-title {\n padding-left: ", ";\n display: flex;\n align-items: center;\n }\n display: flex;\n justify-content: space-between;\n align-items: end;\n border-bottom: 1px solid ", ";\n margin: ", ";\n padding-bottom: ", ";\n .app-switcher-label {\n padding-left: ", ";\n }\n }\n .app-switcher-back-button {\n &.dot-button.MuiButton-text {\n padding-left: 0;\n }\n }\n .product-heading {\n display: flex;\n align-items: center;\n gap: 24px;\n padding-bottom: ", ";\n }\n .product-applications {\n width: 100%;\n overflow-y: auto;\n }\n .product-applications-search {\n margin-bottom: ", ";\n }\n }\n "])), rootClassName$P, theme.spacing(0, 0, 0, 1), theme.palette.grey[50], theme.spacing(2), theme.palette.grey[200], theme.spacing(0, -2, 2), theme.spacing(1), theme.spacing(3), theme.spacing(3), theme.spacing(3));
2721
+ var fadeIn = styled.keyframes(templateObject_1$Q || (templateObject_1$Q = __makeTemplateObject(["\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n"], ["\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n"])));
2722
+ var StyledDotDrawer = styled__default["default"](DotDrawer).withConfig({
2723
+ displayName: "NestedListstyles__StyledDotDrawer",
2724
+ componentId: "sc-1wwoqos-0"
2725
+ })(templateObject_4$6 || (templateObject_4$6 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
2726
+ var open = _a.open;
2727
+ return styled.css(templateObject_3$8 || (templateObject_3$8 = __makeTemplateObject(["\n &.", " {\n .dot-drawer-paper {\n z-index: ", ";\n animation: ", ";\n }\n }\n "], ["\n &.", " {\n .dot-drawer-paper {\n z-index: ", ";\n animation: ", ";\n }\n }\n "])), nestedDrawerClassName, open ? levelFirst : levelBottom, open && styled.css(templateObject_2$N || (templateObject_2$N = __makeTemplateObject(["\n ", " 0.2s cubic-bezier(1,0,1,.01);\n "], ["\n ", " 0.2s cubic-bezier(1,0,1,.01);\n "])), fadeIn));
2831
2728
  });
2832
- var templateObject_1$U, templateObject_2$Q;
2729
+ var templateObject_1$Q, templateObject_2$N, templateObject_3$8, templateObject_4$6;
2833
2730
 
2834
- var DotAppSwitcherView = function DotAppSwitcherView(_a) {
2835
- var activeApp = _a.activeApp,
2836
- apps = _a.apps,
2837
- className = _a.className,
2838
- _b = _a.noAppTypeLabel,
2839
- noAppTypeLabel = _b === void 0 ? 'Other' : _b,
2840
- platformConsoleUrl = _a.platformConsoleUrl,
2841
- onClose = _a.onClose,
2842
- open = _a.open,
2843
- _c = _a.searchInstancesThreshold,
2844
- searchInstancesThreshold = _c === void 0 ? 5 : _c,
2845
- selectedAppType = _a.selectedAppType,
2846
- _d = _a.yOffset,
2847
- yOffset = _d === void 0 ? 48 : _d,
2848
- _e = _a.zIndex,
2849
- zIndex = _e === void 0 ? 990 : _e;
2850
- var dotCoreApiContext = useDotCoreApiContext();
2851
- var setSelectedAppType = null;
2852
- if (dotCoreApiContext !== null) {
2853
- setSelectedAppType = dotCoreApiContext.setSelectedAppSwitcherAppType;
2854
- }
2855
- var rootClasses = useStylesWithRootClass(rootClassName$P, className);
2856
- var _f = React.useState(),
2857
- appTypeMap = _f[0],
2858
- setAppTypeMap = _f[1];
2859
- var _g = React.useState(),
2860
- appTypeLabels = _g[0],
2861
- setAppTypeLabels = _g[1];
2862
- var _h = React.useState(),
2863
- appTypeMenuItems = _h[0],
2864
- setAppTypeMenuItems = _h[1];
2865
- var _j = React.useState(null),
2866
- selectedAppTypeAlt = _j[0],
2867
- setSelectedAppTypeAlt = _j[1];
2868
- var _k = React.useState(''),
2869
- searchText = _k[0],
2870
- setSearchText = _k[1];
2871
- if (!setSelectedAppType) {
2872
- selectedAppType = selectedAppTypeAlt;
2873
- setSelectedAppType = setSelectedAppTypeAlt;
2731
+ var DEFAULT_TOOLTIP_PLACEMENT = 'top-start';
2732
+ var DotListDivider = function DotListDivider(_a) {
2733
+ var item = _a.item,
2734
+ index = _a.index;
2735
+ if (item.text) {
2736
+ return jsxRuntime.jsx(material.ListSubheader, __assign({
2737
+ disableSticky: true
2738
+ }, {
2739
+ children: jsxRuntime.jsx(DotTypography, __assign({
2740
+ variant: "overline"
2741
+ }, {
2742
+ children: item.text
2743
+ }), void 0)
2744
+ }), void 0);
2874
2745
  }
2875
- var showApps = React.useCallback(function (appType) {
2876
- setSelectedAppType(appType);
2877
- }, []);
2878
- var showAppTypes = React.useCallback(function () {
2879
- setSearchText('');
2880
- setSelectedAppType(null);
2881
- }, []);
2882
- var populateAppTypeMap = React.useCallback(function () {
2883
- var newAppTypeMap = new Map();
2884
- // we'll put Other at the end
2885
- var otherApps = [];
2886
- apps === null || apps === void 0 ? void 0 : apps.forEach(function (app) {
2887
- var instanceStateText = getInstanceStateText(app);
2888
- var children = createMenuItem(app.url, app.name, instanceStateText);
2889
- var searchableContent = app.name + " " + instanceStateText;
2890
- var appTypeName = app.logo_product_name;
2891
- var appTypeApps;
2892
- if (appTypeName) {
2893
- appTypeApps = newAppTypeMap.get(appTypeName);
2894
- if (!appTypeApps) {
2895
- appTypeApps = [];
2896
- newAppTypeMap.set(appTypeName, appTypeApps);
2897
- }
2898
- } else {
2899
- appTypeApps = otherApps;
2900
- }
2901
- appTypeApps.push({
2902
- children: children,
2903
- searchableContent: searchableContent,
2904
- key: app.id,
2905
- height: 64
2906
- });
2907
- });
2908
- var keys = Array.from(newAppTypeMap.keys()).sort();
2909
- var sortedAppTypeMap = new Map();
2910
- for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
2911
- var appType = keys_1[_i];
2912
- sortedAppTypeMap.set(appType, newAppTypeMap.get(appType));
2746
+ return jsxRuntime.jsx(material.Divider, {
2747
+ "aria-hidden": true,
2748
+ "data-testid": "divider-" + index
2749
+ }, void 0);
2750
+ };
2751
+ var DotList = function DotList(_a) {
2752
+ var ariaLabel = _a.ariaLabel,
2753
+ children = _a.children,
2754
+ className = _a.className,
2755
+ _b = _a.component,
2756
+ component = _b === void 0 ? 'ul' : _b,
2757
+ dataTestId = _a["data-testid"],
2758
+ _c = _a.dense,
2759
+ dense = _c === void 0 ? false : _c,
2760
+ _d = _a.disablePadding,
2761
+ disablePadding = _d === void 0 ? false : _d,
2762
+ _e = _a.items,
2763
+ items = _e === void 0 ? [] : _e,
2764
+ _f = _a.menuPlacement,
2765
+ menuPlacement = _f === void 0 ? 'right-start' : _f,
2766
+ _g = _a.nestedDrawerLeftSpacing,
2767
+ nestedDrawerLeftSpacing = _g === void 0 ? 240 : _g,
2768
+ _h = _a.nestedListType,
2769
+ nestedListType = _h === void 0 ? 'expandable' : _h,
2770
+ _j = _a.width,
2771
+ width = _j === void 0 ? 240 : _j;
2772
+ var rootClasses = useStylesWithRootClass(rootClassName$W, className);
2773
+ var listWidth = typeof width === 'number' ? width + "px" : width;
2774
+ var listRef = React.useRef();
2775
+ var _k = React.useState(null),
2776
+ listItemIndex = _k[0],
2777
+ setListItemIndex = _k[1];
2778
+ var updateSelectedListItem = function updateSelectedListItem(currentIndex) {
2779
+ currentIndex === listItemIndex ? setListItemIndex(null) : setListItemIndex(currentIndex);
2780
+ };
2781
+ return jsxRuntime.jsxs(StyledList, __assign({
2782
+ "aria-label": ariaLabel,
2783
+ classes: {
2784
+ root: rootClasses
2785
+ },
2786
+ component: component,
2787
+ "data-testid": dataTestId,
2788
+ dense: dense,
2789
+ disablePadding: disablePadding,
2790
+ ref: listRef,
2791
+ style: {
2792
+ width: listWidth
2913
2793
  }
2914
- var appTypeCount = sortedAppTypeMap.size;
2915
- if (platformConsoleUrl) {
2916
- appTypeCount++;
2917
- }
2918
- if (otherApps.length > 0) {
2919
- sortedAppTypeMap.set(noAppTypeLabel, otherApps);
2920
- }
2921
- setAppTypeMap(sortedAppTypeMap);
2922
- var menuItems = [daiAppsHeaderMenuItem(appTypeCount)];
2923
- if (platformConsoleUrl) {
2924
- var children = createTopLevelMenuItem(platformConsoleUrl, getLogoForAppType('Platform'), 'Digital.ai Platform', !window.location.href.startsWith(platformConsoleUrl));
2925
- menuItems.push({
2926
- children: children,
2927
- key: 'app-switcher-platform-link',
2928
- height: 64
2929
- });
2930
- }
2931
- var newAppTypeLabels = new Map();
2932
- sortedAppTypeMap.forEach(function (singleTypeApps, appTypeName) {
2933
- if ((singleTypeApps === null || singleTypeApps === void 0 ? void 0 : singleTypeApps.length) > 0) {
2934
- var logo = appTypeName === noAppTypeLabel ? null : getLogoForAppType(appTypeName);
2935
- newAppTypeLabels.set(appTypeName, {
2936
- logo: logo,
2937
- singleTypeApps: singleTypeApps
2938
- });
2939
- menuItems.push({
2940
- children: jsxRuntime.jsxs("div", __assign({
2941
- className: "product-menu-item",
2942
- onClick: function () {
2943
- return showApps(appTypeName);
2944
- }
2945
- }, {
2946
- children: [createAppTypeLabel(appTypeName, logo, singleTypeApps), jsxRuntime.jsx(DotIcon, {
2947
- iconId: "chevron-right"
2948
- }, void 0)]
2949
- }), "menu-item-" + appTypeName),
2950
- key: appTypeName,
2951
- height: 64
2952
- });
2794
+ }, {
2795
+ children: [items.map(function (item, index) {
2796
+ var handleListItemClick = function handleListItemClick(e) {
2797
+ var _a;
2798
+ updateSelectedListItem(index);
2799
+ (_a = item.onClick) === null || _a === void 0 ? void 0 : _a.call(item, e);
2800
+ };
2801
+ var handleMenuLeave = function handleMenuLeave(event) {
2802
+ var _a, _b;
2803
+ // Remove index only if clicked element is not found within the list
2804
+ if (!((_a = listRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target))) {
2805
+ setListItemIndex(null);
2806
+ (_b = item.onMenuLeave) === null || _b === void 0 ? void 0 : _b.call(item, event);
2807
+ }
2808
+ };
2809
+ if (item.child) {
2810
+ return jsxRuntime.jsx(React.Fragment, {
2811
+ children: item.child
2812
+ }, "item-child-" + index);
2953
2813
  }
2954
- });
2955
- setAppTypeMenuItems(menuItems);
2956
- setAppTypeLabels(newAppTypeLabels);
2957
- }, [apps]);
2958
- var emptyState = React.useCallback(function () {
2959
- var currentAppMenuItem = createTopLevelMenuItem(window.location.href, getLogoForAppType(activeApp.product), activeApp.name, false);
2960
- setAppTypeMenuItems([daiAppsHeaderMenuItem(), {
2961
- children: currentAppMenuItem,
2962
- key: 'no_applications_configured',
2963
- height: 64,
2964
- disabled: true
2965
- }]);
2966
- }, [activeApp]);
2967
- React.useEffect(function () {
2968
- if ((apps === null || apps === void 0 ? void 0 : apps.length) > 0) {
2969
- populateAppTypeMap();
2970
- } else {
2971
- emptyState();
2972
- }
2973
- }, [apps]);
2974
- var onAppInstanceSearchTextChange = React.useCallback(function (text) {
2975
- setSearchText(text);
2976
- }, []);
2977
- var clearAppInstanceSearchText = React.useCallback(function () {
2978
- setSearchText('');
2979
- }, []);
2980
- var closeHandler = React.useCallback(function (event) {
2981
- setSearchText('');
2982
- onClose && onClose(event);
2983
- }, [onClose]);
2984
- var filteredAppInstances = React.useCallback(function () {
2985
- var _a;
2986
- return (_a = appTypeMap.get(selectedAppType)) === null || _a === void 0 ? void 0 : _a.filter(function (item) {
2987
- var isMatch = !searchText;
2988
- if (searchText) {
2989
- var testStr = isLowerCase(searchText) ? item.searchableContent.toLowerCase() : item.searchableContent;
2990
- isMatch = testStr.indexOf(searchText) >= 0;
2814
+ if (item.divider) {
2815
+ return jsxRuntime.jsx(DotListDivider, {
2816
+ index: index,
2817
+ item: item
2818
+ }, "divider-" + index);
2991
2819
  }
2992
- return isMatch;
2993
- }).map(function (item) {
2994
- return item.children;
2995
- });
2996
- }, [appTypeMap, selectedAppType, searchText]);
2997
- var content = function content() {
2998
- var _a;
2999
- if (selectedAppType && appTypeMap && appTypeLabels) {
3000
- var labelConfig = appTypeLabels.get(selectedAppType);
3001
- return jsxRuntime.jsxs(jsxRuntime.Fragment, {
3002
- children: [jsxRuntime.jsx("span", {
3003
- children: jsxRuntime.jsx(DotButton, __assign({
3004
- className: "app-switcher-back-button",
3005
- type: "text",
3006
- onClick: showAppTypes,
3007
- startIcon: jsxRuntime.jsx(DotIcon, {
3008
- iconId: "back"
3009
- }, void 0)
3010
- }, {
3011
- children: jsxRuntime.jsx("span", {
3012
- children: "Back"
3013
- }, void 0)
3014
- }), void 0)
3015
- }, void 0), jsxRuntime.jsx("div", __assign({
3016
- className: "product-heading"
3017
- }, {
3018
- children: createAppTypeLabel(selectedAppType, labelConfig.logo, labelConfig.singleTypeApps)
3019
- }), void 0), ((_a = appTypeMap === null || appTypeMap === void 0 ? void 0 : appTypeMap.get(selectedAppType)) === null || _a === void 0 ? void 0 : _a.length) >= searchInstancesThreshold && jsxRuntime.jsx("div", {
3020
- children: jsxRuntime.jsx(SearchInput, {
3021
- "data-testid": "app-instance-search-input",
3022
- onChange: onAppInstanceSearchTextChange,
3023
- onClear: clearAppInstanceSearchText,
3024
- value: searchText
3025
- }, void 0)
3026
- }, void 0), jsxRuntime.jsx("div", __assign({
3027
- className: "product-applications"
3028
- }, {
3029
- children: filteredAppInstances()
3030
- }), void 0)]
2820
+ return jsxRuntime.jsx(DotListItem, {
2821
+ className: item.className,
2822
+ component: item.component,
2823
+ "data-testid": dataTestId + "-item-" + index,
2824
+ endIcon: item.endIcon,
2825
+ href: item.href,
2826
+ isOpened: listItemIndex === index,
2827
+ items: item.items,
2828
+ menuPlacement: menuPlacement,
2829
+ nestedDrawerLeftSpacing: nestedDrawerLeftSpacing,
2830
+ nestedListType: nestedListType,
2831
+ onClick: item.href && !item.onClick ? null : handleListItemClick,
2832
+ onMenuLeave: handleMenuLeave,
2833
+ primaryText: item.primaryText,
2834
+ secondaryText: item.secondaryText,
2835
+ selected: item.selected,
2836
+ startIcon: item.startIcon,
2837
+ target: item.target,
2838
+ text: item.text,
2839
+ tooltip: item.tooltip,
2840
+ tooltipPlacement: item.tooltipPlacement || DEFAULT_TOOLTIP_PLACEMENT
2841
+ }, index);
2842
+ }), children]
2843
+ }), void 0);
2844
+ };
2845
+ var DotListItem = function DotListItem(_a) {
2846
+ var ariaLabel = _a.ariaLabel,
2847
+ className = _a.className,
2848
+ _b = _a.component,
2849
+ component = _b === void 0 ? 'li' : _b,
2850
+ dataTestId = _a["data-testid"],
2851
+ _c = _a.divider,
2852
+ divider = _c === void 0 ? false : _c,
2853
+ endIcon = _a.endIcon,
2854
+ href = _a.href,
2855
+ isOpened = _a.isOpened,
2856
+ onClick = _a.onClick,
2857
+ onMenuLeave = _a.onMenuLeave,
2858
+ _d = _a.items,
2859
+ items = _d === void 0 ? [] : _d,
2860
+ menuPlacement = _a.menuPlacement,
2861
+ nestedDrawerLeftSpacing = _a.nestedDrawerLeftSpacing,
2862
+ nestedListType = _a.nestedListType,
2863
+ primaryText = _a.primaryText,
2864
+ secondaryText = _a.secondaryText,
2865
+ selected = _a.selected,
2866
+ startIcon = _a.startIcon,
2867
+ target = _a.target,
2868
+ text = _a.text,
2869
+ tooltip = _a.tooltip,
2870
+ _e = _a.tooltipPlacement,
2871
+ tooltipPlacement = _e === void 0 ? DEFAULT_TOOLTIP_PLACEMENT : _e;
2872
+ var hasChildren = items.length > 0;
2873
+ var isFlyout = nestedListType === 'menu' && hasChildren;
2874
+ var _f = React.useState(null),
2875
+ anchorEl = _f[0],
2876
+ setAnchorEl = _f[1];
2877
+ var showEndIcon = endIcon || hasChildren;
2878
+ var rootClasses = useStylesWithRootClass(listItemRootClass, className, isOpened ? 'open' : '');
2879
+ var toggleOpen = function toggleOpen(event) {
2880
+ return setAnchorEl(event.currentTarget);
2881
+ };
2882
+ var handleClick = function handleClick(event) {
2883
+ onClick === null || onClick === void 0 ? void 0 : onClick(event);
2884
+ toggleOpen(event);
2885
+ };
2886
+ var handleMenuLeave = function handleMenuLeave(event) {
2887
+ return onMenuLeave(event);
2888
+ };
2889
+ var renderListItemText = function renderListItemText() {
2890
+ return primaryText && secondaryText ? jsxRuntime.jsx(material.ListItemText, {
2891
+ primary: primaryText,
2892
+ secondary: secondaryText
2893
+ }, void 0) : jsxRuntime.jsx(DotTypography, __assign({
2894
+ variant: "body1"
2895
+ }, {
2896
+ children: text
2897
+ }), void 0);
2898
+ };
2899
+ var renderListItemEndIcon = function renderListItemEndIcon() {
2900
+ if (hasChildren || !endIcon) {
2901
+ return jsxRuntime.jsx(DotIcon, {
2902
+ iconId: hasChildren && getChevronIcon(nestedListType, isOpened)
3031
2903
  }, void 0);
3032
2904
  }
3033
- return appTypeMenuItems === null || appTypeMenuItems === void 0 ? void 0 : appTypeMenuItems.map(function (item) {
3034
- return item.children;
3035
- });
2905
+ return endIcon;
3036
2906
  };
3037
- var header = {
3038
- className: 'app-switcher-header',
3039
- children: jsxRuntime.jsxs("div", __assign({
3040
- className: "app-switcher-header-title",
3041
- style: {
3042
- marginTop: yOffset + 'px',
3043
- width: '80%'
3044
- }
2907
+ return jsxRuntime.jsxs(jsxRuntime.Fragment, {
2908
+ children: [jsxRuntime.jsx(DotTooltip, __assign({
2909
+ "data-testid": dataTestId + "-tooltip",
2910
+ placement: tooltipPlacement,
2911
+ title: tooltip
3045
2912
  }, {
3046
- children: [jsxRuntime.jsx(DotAvatar, {
3047
- iconId: "apps",
3048
- alt: "app image",
3049
- type: "image",
3050
- variant: "circular"
3051
- }, void 0), jsxRuntime.jsx(DotTypography, __assign({
3052
- className: "app-switcher-label"
2913
+ children: jsxRuntime.jsxs(StyledListItem, __assign({
2914
+ "aria-label": ariaLabel,
2915
+ button: true,
2916
+ classes: {
2917
+ root: rootClasses
2918
+ },
2919
+ component: href && !onClick ? 'a' : component,
2920
+ "data-testid": dataTestId,
2921
+ divider: divider,
2922
+ href: onClick ? null : href,
2923
+ onClick: onClick || !href ? handleClick : null,
2924
+ selected: isFlyout ? isOpened : selected,
2925
+ target: target
3053
2926
  }, {
3054
- children: "App switcher"
3055
- }), void 0)]
3056
- }), void 0)
3057
- };
3058
- return jsxRuntime.jsx(StyledAppSwitcher, __assign({
3059
- className: rootClasses,
3060
- ModalProps: {
3061
- style: {
3062
- zIndex: zIndex
3063
- },
3064
- hideBackdrop: true
3065
- },
3066
- drawerHeaderProps: header,
3067
- variant: "temporary",
3068
- width: "340px",
3069
- open: open,
3070
- onClose: closeHandler
3071
- }, {
3072
- children: content()
3073
- }), void 0);
2927
+ children: [jsxRuntime.jsxs("span", __assign({
2928
+ className: listItemLinkClassName
2929
+ }, {
2930
+ children: [startIcon && jsxRuntime.jsx(material.ListItemIcon, {
2931
+ children: startIcon
2932
+ }, void 0), renderListItemText()]
2933
+ }), void 0), showEndIcon && renderListItemEndIcon()]
2934
+ }), void 0)
2935
+ }), void 0), hasChildren && jsxRuntime.jsx(NestedList, {
2936
+ anchorEl: anchorEl,
2937
+ ariaLabel: "nested list",
2938
+ "data-testid": "nestedList",
2939
+ items: items,
2940
+ menuPlacement: menuPlacement,
2941
+ nestedDrawerLeftSpacing: nestedDrawerLeftSpacing,
2942
+ onMenuLeave: handleMenuLeave,
2943
+ open: isOpened,
2944
+ type: nestedListType
2945
+ }, void 0)]
2946
+ }, void 0);
3074
2947
  };
3075
- var DotAppSwitcher = function DotAppSwitcher(_a) {
3076
- var accountId = _a.accountId,
3077
- _b = _a.includePlatformConsole,
3078
- includePlatformConsole = _b === void 0 ? true : _b,
3079
- onClose = _a.onClose,
3080
- commonProps = __rest(_a, ["accountId", "includePlatformConsole", "onClose"]);
3081
- var _c = useDotCoreApiContext(),
3082
- applications = _c.applications,
3083
- applicationsLoading = _c.applicationsLoading,
3084
- applicationsError = _c.applicationsError,
3085
- loadApplications = _c.loadApplications,
3086
- open = _c.isAppSwitcherOpen,
3087
- platformConsoleUrl = _c.platformConsoleUrl,
3088
- setOpen = _c.setIsAppSwitcherOpen,
3089
- selectedAppType = _c.selectedAppSwitcherAppType,
3090
- setSelectedAppType = _c.setSelectedAppSwitcherAppType;
3091
- React.useEffect(function () {
3092
- if ((!applications || applications.length === 0) && open) {
3093
- loadApplications(accountId);
3094
- }
3095
- }, [accountId, open]);
3096
- if (applicationsError) {
3097
- console.error('Error loading application list in AppSwitcher', applicationsError);
3098
- }
3099
- var closeHandler = React.useCallback(function (event) {
3100
- setOpen(false);
3101
- setSelectedAppType(null);
3102
- onClose && onClose(event);
3103
- }, [onClose]);
3104
- var viewProps = includePlatformConsole ? __assign(__assign({}, commonProps), {
3105
- platformConsoleUrl: platformConsoleUrl
3106
- }) : __assign({}, commonProps);
3107
- if (!applicationsLoading && !applicationsError) {
3108
- return jsxRuntime.jsx(DotAppSwitcherView, __assign({}, viewProps, {
3109
- open: open,
3110
- apps: applications,
3111
- selectedAppType: selectedAppType,
3112
- onClose: closeHandler
2948
+ var NestedList = function NestedList(_a) {
2949
+ var ariaLabel = _a.ariaLabel,
2950
+ anchorEl = _a.anchorEl,
2951
+ dataTestId = _a["data-testid"],
2952
+ items = _a.items,
2953
+ menuPlacement = _a.menuPlacement,
2954
+ nestedDrawerLeftSpacing = _a.nestedDrawerLeftSpacing,
2955
+ onMenuLeave = _a.onMenuLeave,
2956
+ open = _a.open,
2957
+ parentItemIndex = _a.parentItemIndex,
2958
+ type = _a.type;
2959
+ var flyoutItemClasses = useStylesWithRootClass(listItemRootClass, flyoutListItemClassName);
2960
+ var flyoutSpanClasses = useStylesWithRootClass(listItemLinkClassName, flyoutItemLinkClassName);
2961
+ if (type === 'expandable') {
2962
+ return jsxRuntime.jsx(material.Collapse, __assign({
2963
+ in: open,
2964
+ timeout: "auto",
2965
+ unmountOnExit: true
2966
+ }, {
2967
+ children: jsxRuntime.jsx(DotList, {
2968
+ ariaLabel: ariaLabel,
2969
+ className: nestedListClassName,
2970
+ component: "div",
2971
+ "data-testid": dataTestId,
2972
+ disablePadding: true,
2973
+ items: items
2974
+ }, parentItemIndex)
3113
2975
  }), void 0);
3114
2976
  }
3115
- return null;
3116
- };
3117
-
3118
- var rootClassName$O = 'dot-list';
3119
- var listItemRootClass = 'dot-list-item';
3120
- var nestedListClassName = 'dot-nested-list';
3121
- var nestedDrawerClassName = 'dot-nested-drawer';
3122
- var StyledList = styled__default["default"](material.List).withConfig({
3123
- displayName: "Liststyles__StyledList",
3124
- componentId: "wxwqwr-0"
3125
- })(templateObject_2$P || (templateObject_2$P = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
3126
- var theme = _a.theme;
3127
- return styled.css(templateObject_1$T || (templateObject_1$T = __makeTemplateObject(["\n &.", " {\n background: ", ";\n\n .dot-icon {\n color: ", ";\n }\n\n &.", " .", " {\n padding-left: ", ";\n }\n\n .MuiListSubheader-root {\n padding: 0;\n\n .MuiTypography-root {\n padding: ", ";\n }\n }\n }\n "], ["\n &.", " {\n background: ", ";\n\n .dot-icon {\n color: ", ";\n }\n\n &.", " .", " {\n padding-left: ", ";\n }\n\n .MuiListSubheader-root {\n padding: 0;\n\n .MuiTypography-root {\n padding: ", ";\n }\n }\n }\n "])), rootClassName$O, theme.palette.layer.n0, theme.palette.layer.n700, nestedListClassName, listItemRootClass, theme.spacing(4), theme.spacing(1));
3128
- });
3129
- var templateObject_1$T, templateObject_2$P;
3130
-
3131
- var getChevronIcon = function getChevronIcon(nestedListType, isOpened) {
3132
- if (nestedListType !== 'expandable') {
3133
- return 'chevron-right';
2977
+ if (type === 'menu') {
2978
+ var menuItems = items.map(function (item, index) {
2979
+ var href = item.href,
2980
+ target = item.target,
2981
+ onClick = item.onClick,
2982
+ tooltip = item.tooltip,
2983
+ _a = item.tooltipPlacement,
2984
+ tooltipPlacement = _a === void 0 ? DEFAULT_TOOLTIP_PLACEMENT : _a,
2985
+ text = item.text;
2986
+ return {
2987
+ children: jsxRuntime.jsx(DotTooltip, __assign({
2988
+ placement: tooltipPlacement,
2989
+ title: tooltip
2990
+ }, {
2991
+ children: jsxRuntime.jsx(StyledListItem, __assign({
2992
+ className: flyoutItemClasses,
2993
+ component: href && !onClick ? 'a' : null,
2994
+ "data-testid": dataTestId + "-item-" + index,
2995
+ href: href,
2996
+ onClick: onClick,
2997
+ target: target
2998
+ }, {
2999
+ children: jsxRuntime.jsxs("span", __assign({
3000
+ className: flyoutSpanClasses
3001
+ }, {
3002
+ children: [item.startIcon, jsxRuntime.jsx(DotTypography, __assign({
3003
+ variant: "body1"
3004
+ }, {
3005
+ children: text
3006
+ }), void 0)]
3007
+ }), void 0)
3008
+ }), parentItemIndex + "-" + index)
3009
+ }), parentItemIndex + "-" + index + "-tooltip"),
3010
+ classes: '',
3011
+ key: String(index)
3012
+ };
3013
+ });
3014
+ return jsxRuntime.jsx(DotMenu, {
3015
+ anchorEl: anchorEl,
3016
+ ariaLabel: ariaLabel,
3017
+ className: flyoutMenuClassName,
3018
+ "data-testid": dataTestId,
3019
+ id: CreateUUID(),
3020
+ menuItemHeight: "auto",
3021
+ menuItems: menuItems,
3022
+ menuPlacement: menuPlacement,
3023
+ onLeave: onMenuLeave,
3024
+ open: open
3025
+ }, parentItemIndex);
3134
3026
  }
3135
- if (isOpened) {
3136
- return 'chevron-up';
3027
+ if (type === 'drawer') {
3028
+ return jsxRuntime.jsx(StyledDotDrawer, __assign({
3029
+ PaperProps: {
3030
+ style: {
3031
+ left: nestedDrawerLeftSpacing + "px"
3032
+ }
3033
+ },
3034
+ anchor: "left",
3035
+ className: nestedDrawerClassName,
3036
+ "data-testid": "nested-drawer",
3037
+ open: open,
3038
+ variant: "persistent"
3039
+ }, {
3040
+ children: jsxRuntime.jsx(DotList, {
3041
+ ariaLabel: ariaLabel,
3042
+ className: nestedListClassName,
3043
+ component: "div",
3044
+ "data-testid": dataTestId,
3045
+ disablePadding: true,
3046
+ items: items,
3047
+ width: '100%'
3048
+ }, parentItemIndex)
3049
+ }), void 0);
3137
3050
  }
3138
- return 'chevron-down';
3139
3051
  };
3140
3052
 
3141
- var flyoutListItemClassName = 'dot-flyout-list-item';
3142
- var flyoutItemLinkClassName = 'dot-flyout-item-link';
3143
- var listItemLinkClassName = 'dot-list-item-link';
3144
- var StyledListItem = styled__default["default"](material.ListItem).withConfig({
3145
- displayName: "ListItemstyles__StyledListItem",
3146
- componentId: "sc-1fawh8v-0"
3147
- })(templateObject_2$O || (templateObject_2$O = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
3148
- var theme = _a.theme;
3149
- return styled.css(templateObject_1$S || (templateObject_1$S = __makeTemplateObject(["\n &.", " {\n &.", " {\n padding: 0;\n }\n\n p.MuiTypography-root {\n margin-bottom: 0;\n }\n\n .", " {\n align-items: center;\n display: flex;\n flex-grow: 2;\n }\n\n .", " .MuiIcon-root {\n margin-right: ", ";\n }\n\n .dot-icon i:before {\n color: ", ";\n }\n }\n "], ["\n &.", " {\n &.", " {\n padding: 0;\n }\n\n p.MuiTypography-root {\n margin-bottom: 0;\n }\n\n .", " {\n align-items: center;\n display: flex;\n flex-grow: 2;\n }\n\n .", " .MuiIcon-root {\n margin-right: ", ";\n }\n\n .dot-icon i:before {\n color: ", ";\n }\n }\n "])), listItemRootClass, flyoutListItemClassName, listItemLinkClassName, flyoutItemLinkClassName, theme.spacing(4), theme.palette.text.primary);
3150
- });
3151
- var templateObject_1$S, templateObject_2$O;
3152
-
3153
- var rootClassName$N = 'dot-progress';
3154
- var StyledCircularProgress = styled__default["default"](material.CircularProgress).withConfig({
3155
- displayName: "Progressstyles__StyledCircularProgress",
3156
- componentId: "sc-1gs77rb-0"
3157
- })(templateObject_1$R || (templateObject_1$R = __makeTemplateObject(["\n &.", " {\n &.MuiCircularProgress-colorSecondary {\n color: #649a3d;\n }\n }\n"], ["\n &.", " {\n &.MuiCircularProgress-colorSecondary {\n color: #649a3d;\n }\n }\n"])), rootClassName$N);
3158
- var templateObject_1$R;
3159
-
3160
- var DotProgress = function DotProgress(_a) {
3161
- var ariaLabel = _a.ariaLabel,
3162
- _b = _a.color,
3163
- color = _b === void 0 ? 'secondary' : _b,
3164
- className = _a.className,
3165
- dataTestId = _a["data-testid"],
3166
- _c = _a.size,
3167
- size = _c === void 0 ? 40 : _c,
3168
- _d = _a.thickness,
3169
- thickness = _d === void 0 ? 3.6 : _d,
3170
- _e = _a.tooltip,
3171
- tooltip = _e === void 0 ? 'loading data' : _e,
3172
- value = _a.value,
3173
- _f = _a.variant,
3174
- variant = _f === void 0 ? 'indeterminate' : _f;
3175
- var rootClasses = useStylesWithRootClass(rootClassName$N, className);
3176
- return jsxRuntime.jsx(DotTooltip, __assign({
3177
- title: tooltip
3053
+ var DotInputLabel = function DotInputLabel(_a) {
3054
+ var dataTestId = _a["data-testid"],
3055
+ _b = _a.disabled,
3056
+ disabled = _b === void 0 ? false : _b,
3057
+ _c = _a.error,
3058
+ error = _c === void 0 ? false : _c,
3059
+ id = _a.id,
3060
+ label = _a.label,
3061
+ required = _a.required;
3062
+ return jsxRuntime.jsx(StyledInputLabel, __assign({
3063
+ "data-testid": dataTestId,
3064
+ classes: {
3065
+ root: labelClassName
3066
+ },
3067
+ disabled: disabled,
3068
+ error: error,
3069
+ htmlFor: id,
3070
+ required: required,
3071
+ shrink: false,
3072
+ variant: "outlined"
3178
3073
  }, {
3179
- children: jsxRuntime.jsx(StyledCircularProgress, {
3180
- "aria-label": ariaLabel,
3181
- classes: {
3182
- root: rootClasses
3183
- },
3184
- color: color,
3185
- "data-testid": dataTestId,
3186
- size: size,
3187
- thickness: thickness,
3188
- value: value,
3189
- variant: variant
3190
- }, void 0)
3074
+ children: jsxRuntime.jsx(DotTypography, __assign({
3075
+ variant: "subtitle2"
3076
+ }, {
3077
+ children: label
3078
+ }), void 0)
3191
3079
  }), void 0);
3192
3080
  };
3193
3081
 
3194
- var levelBottom = -1;
3195
- var levelFirst = 1;
3196
- var levelSecond = 10;
3197
- var levelThird = 100;
3198
- var levelFourth = 1000;
3199
- var levelTop = 9999;
3200
-
3201
- var variables = /*#__PURE__*/Object.freeze({
3202
- __proto__: null,
3203
- levelBottom: levelBottom,
3204
- levelFirst: levelFirst,
3205
- levelSecond: levelSecond,
3206
- levelThird: levelThird,
3207
- levelFourth: levelFourth,
3208
- levelTop: levelTop
3209
- });
3210
-
3211
- var rootClassName$M = 'dot-popper';
3212
- var StyledPopper$1 = styled__default["default"](material.Popper).withConfig({
3213
- displayName: "Popperstyles__StyledPopper",
3214
- componentId: "sd1h8p-0"
3215
- })(templateObject_2$N || (templateObject_2$N = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
3216
- var theme = _a.theme;
3217
- return styled.css(templateObject_1$Q || (templateObject_1$Q = __makeTemplateObject(["\n &.", " {\n font-family: ", ";\n font-size: ", "px;\n }\n "], ["\n &.", " {\n font-family: ", ";\n font-size: ", "px;\n }\n "])), rootClassName$M, theme.typography.fontFamily, theme.typography.body1.fontSize);
3218
- });
3219
- var templateObject_1$Q, templateObject_2$N;
3220
-
3221
- var flyoutMenuClassName = 'dot-flyout-menu';
3222
- var rootClassName$L = 'dot-menu';
3223
- var getListMaxHeight = function getListMaxHeight(maxHeight) {
3224
- return isString$1(maxHeight) ? maxHeight : maxHeight + "px";
3225
- };
3226
- var StyledPopper = styled__default["default"](material.Popper).withConfig({
3227
- displayName: "Menustyles__StyledPopper",
3228
- componentId: "sc-134fmqu-0"
3229
- })(templateObject_2$M || (templateObject_2$M = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
3230
- var theme = _a.theme;
3231
- return styled.css(templateObject_1$P || (templateObject_1$P = __makeTemplateObject(["\n &.", " {\n font-family: ", ";\n font-size: ", "px;\n z-index: ", ";\n }\n &.", ", &.", " {\n &.loading .MuiPaper-root {\n align-items: center;\n display: flex;\n justify-content: center;\n min-height: 200px;\n min-width: 200px;\n }\n\n ul,\n .dot-action-item {\n .dot-action-item-text {\n white-space: nowrap;\n overflow-x: hidden;\n text-overflow: ellipsis;\n }\n }\n\n ul {\n box-sizing: content-box;\n min-width: 112px;\n overflow: auto;\n\n /* Conditionally setting 'max-height' with transient prop */\n ", "\n\n .dot-li {\n min-height: auto;\n }\n }\n\n .dot-action-item {\n height: ", ";\n border-top: 1px solid ", ";\n line-height: inherit;\n\n button.dot-button {\n border-radius: ", ";\n justify-content: flex-start;\n height: 100%;\n margin: 0;\n\n &:focus-visible {\n background-color: ", ";\n }\n\n .MuiButton-label {\n gap: ", ";\n\n .MuiButton-startIcon {\n margin-left: 0;\n\n .dot-icon {\n flex-shrink: 0;\n }\n }\n }\n }\n }\n }\n "], ["\n &.", " {\n font-family: ", ";\n font-size: ", "px;\n z-index: ", ";\n }\n &.", ", &.", " {\n &.loading .MuiPaper-root {\n align-items: center;\n display: flex;\n justify-content: center;\n min-height: 200px;\n min-width: 200px;\n }\n\n ul,\n .dot-action-item {\n .dot-action-item-text {\n white-space: nowrap;\n overflow-x: hidden;\n text-overflow: ellipsis;\n }\n }\n\n ul {\n box-sizing: content-box;\n min-width: 112px;\n overflow: auto;\n\n /* Conditionally setting 'max-height' with transient prop */\n ", "\n\n .dot-li {\n min-height: auto;\n }\n }\n\n .dot-action-item {\n height: ", ";\n border-top: 1px solid ", ";\n line-height: inherit;\n\n button.dot-button {\n border-radius: ", ";\n justify-content: flex-start;\n height: 100%;\n margin: 0;\n\n &:focus-visible {\n background-color: ", ";\n }\n\n .MuiButton-label {\n gap: ", ";\n\n .MuiButton-startIcon {\n margin-left: 0;\n\n .dot-icon {\n flex-shrink: 0;\n }\n }\n }\n }\n }\n }\n "])), rootClassName$M, theme.typography.fontFamily, theme.typography.body1.fontSize, levelSecond, rootClassName$L, rootClassName$M, function (_a) {
3232
- var $maxHeight = _a.$maxHeight;
3233
- return $maxHeight !== undefined && "\n max-height: " + getListMaxHeight($maxHeight) + ";\n ";
3234
- }, theme.spacing(7), theme.palette.grey[100], theme.spacing(0, 0, 0.5, 0.5), theme.palette.layer.n100, theme.spacing(3));
3235
- });
3236
- var templateObject_1$P, templateObject_2$M;
3237
-
3238
- var MENU_ITEM_HEIGHT_NORMAL = 48;
3239
- var MENU_ITEM_HEIGHT_DENSE = 36;
3240
- var DEFAULT_MAX_VISIBLE_ITEMS = 7;
3241
-
3242
- var rootClassName$K = 'dot-ul';
3243
- var listItemClassName$1 = 'dot-li';
3244
- var listItemWithSubmenuClassName = 'dot-li-with-submenu';
3245
- var StyledMenuList = styled__default["default"](material.MenuList).withConfig({
3246
- displayName: "MenuListstyles__StyledMenuList",
3247
- componentId: "yqdwwg-0"
3248
- })(templateObject_2$L || (templateObject_2$L = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
3249
- var theme = _a.theme;
3250
- return styled.css(templateObject_1$O || (templateObject_1$O = __makeTemplateObject(["\n &.", " {\n .dot-li {\n font-size: ", "px;\n justify-content: space-between;\n gap: ", ";\n\n &:hover {\n background: ", ";\n }\n\n &.Mui-selected,\n &.Mui-selected:hover {\n background: ", ";\n }\n\n &.", " {\n padding-right: ", ";\n }\n }\n }\n "], ["\n &.", " {\n .dot-li {\n font-size: ", "px;\n justify-content: space-between;\n gap: ", ";\n\n &:hover {\n background: ", ";\n }\n\n &.Mui-selected,\n &.Mui-selected:hover {\n background: ", ";\n }\n\n &.", " {\n padding-right: ", ";\n }\n }\n }\n "])), rootClassName$K, theme.typography.body1.fontSize, theme.spacing(3), hoverGray, lightSelectedGray, listItemWithSubmenuClassName, theme.spacing(0.5));
3251
- });
3252
- var templateObject_1$O, templateObject_2$L;
3253
-
3254
- var getDefaultItemHeight = function getDefaultItemHeight(isDense) {
3255
- return isDense ? MENU_ITEM_HEIGHT_DENSE : MENU_ITEM_HEIGHT_NORMAL;
3256
- };
3257
- var calculateItemHeight = function calculateItemHeight(isDense, customItemHeight, menuItemHeight) {
3258
- // Custom item height must NOT be lower than MENU_ITEM_HEIGHT_DENSE value
3259
- if (customItemHeight && customItemHeight >= MENU_ITEM_HEIGHT_DENSE) {
3260
- return customItemHeight;
3261
- }
3262
- var itemHeightType = typeof menuItemHeight;
3263
- if (itemHeightType === 'number' || itemHeightType === 'string') {
3264
- return menuItemHeight;
3265
- } else {
3266
- return getDefaultItemHeight(isDense);
3267
- }
3268
- };
3269
- var getNumberOfVisibleItems = function getNumberOfVisibleItems(numberOfItems, maxVisibleItems) {
3270
- if (maxVisibleItems && maxVisibleItems > 0) {
3271
- return maxVisibleItems <= numberOfItems ? maxVisibleItems : numberOfItems;
3272
- }
3273
- return DEFAULT_MAX_VISIBLE_ITEMS;
3274
- };
3275
- var calculateMaxHeight = function calculateMaxHeight(_a) {
3276
- var isDense = _a.isDense,
3277
- maxVisibleItems = _a.maxVisibleItems,
3278
- menuItems = _a.menuItems,
3279
- menuItemHeight = _a.menuItemHeight;
3280
- // if menuItemHeight is "auto" set maxHeight as same
3281
- if (typeof menuItemHeight === 'string') {
3282
- return menuItemHeight;
3283
- }
3284
- // If 'menuItemHeight' is set it will take precedence here
3285
- var itemHeight = menuItemHeight ? menuItemHeight : getDefaultItemHeight(isDense);
3286
- var maxHeight = 0;
3287
- var numberOfVisibleItems = getNumberOfVisibleItems(menuItems.length, maxVisibleItems);
3288
- var visibleItems = menuItems.slice(0, numberOfVisibleItems);
3289
- visibleItems.forEach(function (_a) {
3290
- var height = _a.height;
3291
- var customItemHeight = height ? height : itemHeight;
3292
- // + 3 is for bottom margin of menuItem
3293
- maxHeight += customItemHeight + 3;
3294
- });
3295
- return maxHeight;
3296
- };
3297
- var checkForSubItems = function checkForSubItems(menuItems) {
3298
- return menuItems.some(function (menuItem) {
3299
- return menuItem.items && menuItems.length > 0;
3300
- });
3301
- };
3302
- var checkIfSubmenu = function checkIfSubmenu(anchorElement) {
3303
- if (!anchorElement) return false;
3304
- return anchorElement.classList.contains(listItemWithSubmenuClassName);
3305
- };
3306
- var checkIfMenuItemSelected = function checkIfMenuItemSelected(key, selectedKey, activeSubmenu) {
3307
- return selectedKey === key || activeSubmenu === key;
3082
+ var DELAY_MS = 300;
3083
+ var EndAdornment = function EndAdornment(_a) {
3084
+ var endAdornmentTooltip = _a.endAdornmentTooltip,
3085
+ error = _a.error,
3086
+ dataTestId = _a.dataTestId,
3087
+ endIcon = _a.endIcon,
3088
+ success = _a.success,
3089
+ warning = _a.warning;
3090
+ var renderIcon = function renderIcon(iconType) {
3091
+ return jsxRuntime.jsx(DotIcon, {
3092
+ "data-testid": dataTestId && dataTestId + "-" + iconType + "-icon",
3093
+ iconId: iconType + "-solid"
3094
+ }, void 0);
3095
+ };
3096
+ var errorIcon = error && renderIcon('error');
3097
+ var successIcon = success && renderIcon('check');
3098
+ var warningIcon = warning && renderIcon('warning');
3099
+ var endAdornmentIcon = endIcon || errorIcon || warningIcon || successIcon;
3100
+ var styledAdornment = jsxRuntime.jsx(StyledAdornment, __assign({
3101
+ className: adornmentIconClassName + " end",
3102
+ position: "end"
3103
+ }, {
3104
+ children: endAdornmentIcon
3105
+ }), void 0);
3106
+ return endAdornmentTooltip ? jsxRuntime.jsx(DotTooltip, __assign({
3107
+ title: endAdornmentTooltip
3108
+ }, {
3109
+ children: styledAdornment
3110
+ }), void 0) : styledAdornment;
3308
3111
  };
3309
- var checkForAutoFocus = function checkForAutoFocus(autoFocusItem, isFirstItem) {
3310
- return !!(autoFocusItem && isFirstItem);
3112
+ var getInitialState = function getInitialState(value) {
3113
+ return {
3114
+ inputValue: value || ''
3115
+ };
3311
3116
  };
3312
-
3313
- /**
3314
- * Since this component is used inside 'ClickAwayListener',
3315
- * it needs to be contained within 'forwardRef' function
3316
- */
3317
- var DotMenuList = /*#__PURE__*/React.forwardRef(function (_a, ref) {
3318
- var autoFocusItem = _a.autoFocusItem,
3117
+ var DotInputText = function DotInputText(_a) {
3118
+ var _b = _a.autoComplete,
3119
+ autoComplete = _b === void 0 ? 'off' : _b,
3120
+ autoFocus = _a.autoFocus,
3319
3121
  className = _a.className,
3122
+ defaultValue = _a.defaultValue,
3320
3123
  dataTestId = _a["data-testid"],
3321
- dense = _a.dense,
3124
+ _c = _a.disabled,
3125
+ disabled = _c === void 0 ? false : _c,
3126
+ _d = _a.error,
3127
+ error = _d === void 0 ? false : _d,
3128
+ endAdornmentTooltip = _a.endAdornmentTooltip,
3129
+ _e = _a.fullWidth,
3130
+ fullWidth = _e === void 0 ? true : _e,
3131
+ hasDebounce = _a.hasDebounce,
3132
+ helperText = _a.helperText,
3133
+ endIcon = _a.endIcon,
3322
3134
  id = _a.id,
3323
- maxVisibleItems = _a.maxVisibleItems,
3324
- menuItemHeight = _a.menuItemHeight,
3325
- menuItems = _a.menuItems,
3326
- onItemSelect = _a.onItemSelect,
3135
+ inputRef = _a.inputRef,
3136
+ label = _a.label,
3137
+ maxRows = _a.maxRows,
3138
+ minRows = _a.minRows,
3139
+ _f = _a.multiline,
3140
+ multiline = _f === void 0 ? false : _f,
3141
+ name = _a.name,
3142
+ onBlur = _a.onBlur,
3143
+ onChange = _a.onChange,
3144
+ onFocus = _a.onFocus,
3327
3145
  onKeyDown = _a.onKeyDown,
3328
- onSubMenuCreate = _a.onSubMenuCreate,
3329
- selectedKey = _a.selectedKey;
3330
- var rootClasses = useStylesWithRootClass(rootClassName$K, className);
3331
- var _b = React.useState(null),
3332
- activeSubmenu = _b[0],
3333
- setActiveSubmenu = _b[1];
3334
- var _c = React.useState(null),
3335
- subItemAnchorEl = _c[0],
3336
- setSubItemAnchorEl = _c[1];
3337
- var openSubmenu = function openSubmenu(target, itemKey) {
3338
- // Set new anchor for submenu and active submenu key
3339
- // so that new submenu can be opened
3340
- setSubItemAnchorEl(target);
3341
- setActiveSubmenu(itemKey);
3342
- };
3343
- var closeActiveSubmenu = function closeActiveSubmenu() {
3344
- // We want to clean active submenu state if it exists.
3345
- // This will make previous submenu disappear when
3346
- // hovering to item with no submenu items
3347
- activeSubmenu && setActiveSubmenu(null);
3348
- };
3349
- var getMouseEnterHandler = function getMouseEnterHandler(itemKey, hasSubmenu) {
3350
- return function (event) {
3351
- hasSubmenu ? openSubmenu(event.currentTarget, itemKey) : closeActiveSubmenu();
3146
+ onMouseUp = _a.onMouseUp,
3147
+ persistentLabel = _a.persistentLabel,
3148
+ placeholder = _a.placeholder,
3149
+ _g = _a.readOnly,
3150
+ readOnly = _g === void 0 ? false : _g,
3151
+ _h = _a.required,
3152
+ required = _h === void 0 ? false : _h,
3153
+ shrink = _a.shrink,
3154
+ startIcon = _a.startIcon,
3155
+ _j = _a.size,
3156
+ size = _j === void 0 ? 'small' : _j,
3157
+ success = _a.success,
3158
+ _k = _a.type,
3159
+ type = _k === void 0 ? 'text' : _k,
3160
+ value = _a.value,
3161
+ _l = _a.warning,
3162
+ warning = _l === void 0 ? false : _l;
3163
+ var hasError = error && errorClassName;
3164
+ var hasWarning = !error && warning && warningClassName;
3165
+ var hasSuccess = !error && !warning && success && successClassName;
3166
+ var hasEndAdornmentIcon = endIcon || error || hasWarning || hasSuccess;
3167
+ // This state is used only with debounce feature enabled
3168
+ var _m = React.useState(hasDebounce && getInitialState(value)),
3169
+ inputTextState = _m[0],
3170
+ setInputTextState = _m[1];
3171
+ var rootStyles = useStylesWithRootClass(rootClassName$10, hasError, hasWarning, hasSuccess, readOnly ? 'read-only' : '');
3172
+ // Used to control text value from the consumer component
3173
+ // when debounce feature is enabled
3174
+ React.useEffect(function () {
3175
+ if (hasDebounce && value !== inputTextState.inputValue) {
3176
+ setInputTextState(getInitialState(value));
3177
+ }
3178
+ }, [value]);
3179
+ // Improve performance by avoiding callback execution
3180
+ // on each keystroke (if debounce feature is active)
3181
+ React.useEffect(function () {
3182
+ // Do not proceed if debounce feature is turned
3183
+ // off or there is no event defined
3184
+ if (!hasDebounce || !inputTextState || !inputTextState.changeEvent || !onChange) return;
3185
+ var handler = setTimeout(function () {
3186
+ onChange(inputTextState.changeEvent);
3187
+ }, DELAY_MS);
3188
+ return function () {
3189
+ return clearTimeout(handler);
3352
3190
  };
3191
+ }, [inputTextState]);
3192
+ var handleChange = function handleChange(e) {
3193
+ // We need to have control over change event and input value separately
3194
+ // so that we can set initial state via 'value' prop (if needed)
3195
+ hasDebounce ? setInputTextState({
3196
+ changeEvent: e,
3197
+ inputValue: e.target.value
3198
+ }) : onChange === null || onChange === void 0 ? void 0 : onChange(e);
3353
3199
  };
3354
- return jsxRuntime.jsx(StyledMenuList, __assign({
3355
- classes: {
3356
- root: rootClasses
3357
- },
3358
- "data-testid": dataTestId,
3359
- dense: dense,
3360
- id: id,
3361
- onKeyDown: onKeyDown,
3362
- style: {
3363
- height: calculateMaxHeight({
3364
- isDense: dense,
3365
- maxVisibleItems: maxVisibleItems,
3366
- menuItems: menuItems,
3367
- menuItemHeight: menuItemHeight
3368
- })
3369
- }
3370
- }, {
3371
- children: menuItems.map(function (item, index) {
3372
- var itemAriaLabel = item.ariaLabel,
3373
- children = item.children,
3374
- classes = item.classes,
3375
- disabled = item.disabled,
3376
- divider = item.divider,
3377
- height = item.height,
3378
- subItems = item.items,
3379
- key = item.key;
3380
- var itemHeight = calculateItemHeight(dense, height, menuItemHeight);
3381
- var isSelected = checkIfMenuItemSelected(key, selectedKey, activeSubmenu);
3382
- var isFirstItem = index === 0;
3383
- var hasSubmenu = !!subItems;
3384
- var hasAutoFocus = checkForAutoFocus(autoFocusItem, isFirstItem);
3385
- var menuItemClasses = useStylesWithRootClass(listItemClassName$1, hasSubmenu ? listItemWithSubmenuClassName : '', classes ? classes : '');
3386
- var handleClick = function handleClick(event) {
3387
- // Execute select callback only for items which does not have
3388
- // submenu defined. If there is no menu or handler - prevent
3389
- // further propagation of the current event so that click on
3390
- // items with submenu does not close the menu
3391
- !hasSubmenu && onItemSelect ? onItemSelect(event, key) : event.stopPropagation();
3392
- };
3393
- /**
3394
- * If there is submenu, right arrow icon will be added
3395
- * and sub-menu will be rendered
3396
- */
3397
- return jsxRuntime.jsxs(material.MenuItem, __assign({
3398
- autoFocus: hasAutoFocus,
3399
- "aria-label": itemAriaLabel,
3400
- className: menuItemClasses,
3401
- disabled: disabled,
3402
- disableRipple: hasSubmenu,
3403
- divider: divider,
3404
- onClick: handleClick,
3405
- onMouseEnter: getMouseEnterHandler(key, hasSubmenu),
3406
- ref: ref,
3407
- style: {
3408
- height: itemHeight
3409
- },
3410
- selected: isSelected
3411
- }, {
3412
- children: [children, hasSubmenu && jsxRuntime.jsx(DotIcon, {
3413
- "data-testid": "dot-item-arrow-icon",
3414
- iconId: "arrow-right"
3415
- }, void 0), hasSubmenu && onSubMenuCreate({
3416
- anchorElement: subItemAnchorEl,
3417
- isOpened: isSelected,
3418
- subMenuId: key,
3419
- subMenuItems: subItems
3420
- })]
3421
- }), key);
3422
- })
3423
- }), void 0);
3424
- });
3425
-
3426
- var DotMenu = function DotMenu(_a) {
3427
- var anchorEl = _a.anchorEl,
3428
- ariaLabel = _a.ariaLabel,
3429
- className = _a.className,
3430
- dataTestId = _a["data-testid"],
3431
- _b = _a.dense,
3432
- dense = _b === void 0 ? true : _b,
3433
- disablePortal = _a.disablePortal,
3434
- id = _a.id,
3435
- _c = _a.loading,
3436
- loading = _c === void 0 ? false : _c,
3437
- _d = _a.maxVisibleItems,
3438
- maxVisibleItems = _d === void 0 ? DEFAULT_MAX_VISIBLE_ITEMS : _d,
3439
- menuItemHeight = _a.menuItemHeight,
3440
- _e = _a.menuItems,
3441
- menuItems = _e === void 0 ? [] : _e,
3442
- _f = _a.menuPlacement,
3443
- menuPlacement = _f === void 0 ? 'bottom' : _f,
3444
- onLeave = _a.onLeave,
3445
- onSelect = _a.onSelect,
3446
- _g = _a.open,
3447
- open = _g === void 0 ? false : _g,
3448
- selectedKey = _a.selectedKey;
3449
- var rootClasses = useStylesWithRootClass(rootClassName$L, className, loading ? 'loading' : '');
3450
- var isSubmenu = checkIfSubmenu(anchorEl);
3451
- var hasSubItems = checkForSubItems(menuItems);
3452
- // Timeout object is customizable when Menu component is either submenu
3453
- // (it is opened within parent menu) or it contains at least one item which
3454
- // has sub-items. This is done because when multi-level menu is closing it
3455
- // will first close the parent and only then child menus - which looks
3456
- // a bit weird - so here I'm giving it exit value of 0 so that it looks like
3457
- // they all close at the same time. For "normal" menus, timeout is unnecessary.
3458
- var timeout = isSubmenu || hasSubItems ? {
3459
- exit: 0,
3460
- enter: 300
3461
- } : undefined;
3462
- var handleSelect = function handleSelect(event, itemKey) {
3463
- onLeave && onLeave(event);
3464
- onSelect && onSelect(event, id, itemKey);
3465
- };
3466
- var handleListKeyDown = function handleListKeyDown(event) {
3467
- if (onLeave && event.key === 'Tab') {
3468
- event.preventDefault();
3469
- onLeave(event);
3470
- }
3200
+ var inputTextValue = hasDebounce ? inputTextState.inputValue : value;
3201
+ // Don't use default value when debounce feature is enabled because
3202
+ // in that case component is controlled
3203
+ var defaultInputValue = hasDebounce ? undefined : defaultValue;
3204
+ var startAdornmentIcon = function startAdornmentIcon() {
3205
+ if (!startIcon) return null;
3206
+ return jsxRuntime.jsx(StyledAdornment, __assign({
3207
+ className: adornmentIconClassName + " start",
3208
+ position: "start"
3209
+ }, {
3210
+ children: startIcon
3211
+ }), void 0);
3471
3212
  };
3472
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3473
- var handleClickAway = function handleClickAway(event) {
3474
- if (onLeave && (!anchorEl || !anchorEl.contains(event.currentTarget))) {
3475
- onLeave(event);
3476
- }
3213
+ var endAdornmentIcon = function endAdornmentIcon() {
3214
+ if (!hasEndAdornmentIcon) return null;
3215
+ return jsxRuntime.jsx(EndAdornment, __assign({}, {
3216
+ endAdornmentTooltip: endAdornmentTooltip,
3217
+ error: error,
3218
+ dataTestId: dataTestId,
3219
+ endIcon: endIcon,
3220
+ success: success,
3221
+ warning: warning
3222
+ }), void 0);
3477
3223
  };
3478
- return jsxRuntime.jsx(StyledPopper, __assign({
3479
- anchorEl: anchorEl,
3480
- "aria-label": ariaLabel,
3481
- className: rootClasses,
3482
- "data-testid": dataTestId,
3483
- disablePortal: disablePortal,
3484
- open: open,
3485
- placement: menuPlacement,
3486
- role: undefined,
3487
- transition: true
3224
+ var wrapperClassName = useStylesWithRootClass(fullWidth !== false ? 'dot-input-text--fullwidth' : '', className);
3225
+ return jsxRuntime.jsxs(StyledTextFieldContainer, __assign({
3226
+ className: wrapperClassName
3488
3227
  }, {
3489
- children: function (_a) {
3490
- var TransitionProps = _a.TransitionProps,
3491
- placement = _a.placement;
3492
- return jsxRuntime.jsx(material.Fade, __assign({}, TransitionProps, {
3493
- style: {
3494
- transformOrigin: placement === 'bottom' ? 'center top' : 'center bottom'
3495
- },
3496
- timeout: timeout
3497
- }, {
3498
- children: jsxRuntime.jsx(material.Paper, {
3499
- children: jsxRuntime.jsx(material.ClickAwayListener, __assign({
3500
- onClickAway: handleClickAway
3501
- }, {
3502
- children: loading ? jsxRuntime.jsx(DotProgress, {
3503
- "data-testid": "loading-indicator",
3504
- tooltip: "Loading Data...",
3505
- value: 20
3506
- }, void 0) : jsxRuntime.jsx(DotMenuList, {
3507
- autoFocusItem: open,
3508
- "data-testid": dataTestId + "-menu",
3509
- dense: dense,
3510
- id: id,
3511
- maxVisibleItems: maxVisibleItems,
3512
- menuItemHeight: menuItemHeight,
3513
- menuItems: menuItems,
3514
- onItemSelect: handleSelect,
3515
- onKeyDown: handleListKeyDown,
3516
- onSubMenuCreate: function (_a) {
3517
- var anchorElement = _a.anchorElement,
3518
- isOpened = _a.isOpened,
3519
- subMenuId = _a.subMenuId,
3520
- subMenuItems = _a.subMenuItems;
3521
- return jsxRuntime.jsx(DotMenu, {
3522
- anchorEl: anchorElement,
3523
- menuPlacement: "right-start",
3524
- id: subMenuId,
3525
- menuItems: subMenuItems,
3526
- open: isOpened,
3527
- onLeave: onLeave,
3528
- onSelect: onSelect,
3529
- selectedKey: selectedKey
3530
- }, void 0);
3531
- },
3532
- selectedKey: selectedKey
3533
- }, void 0)
3534
- }), void 0)
3535
- }, void 0)
3536
- }), void 0);
3537
- }
3228
+ children: [persistentLabel && jsxRuntime.jsx(DotInputLabel, __assign({}, {
3229
+ disabled: disabled,
3230
+ error: error,
3231
+ id: id,
3232
+ label: label,
3233
+ required: required
3234
+ }), void 0), jsxRuntime.jsx(StyledTextField, {
3235
+ InputProps: {
3236
+ startAdornment: startAdornmentIcon(),
3237
+ endAdornment: endAdornmentIcon()
3238
+ },
3239
+ "aria-label": name,
3240
+ autoComplete: autoComplete,
3241
+ autoFocus: autoFocus,
3242
+ classes: {
3243
+ root: rootStyles
3244
+ },
3245
+ defaultValue: defaultInputValue,
3246
+ disabled: disabled,
3247
+ error: error,
3248
+ focused: readOnly ? false : undefined,
3249
+ fullWidth: fullWidth,
3250
+ helperText: helperText,
3251
+ id: id,
3252
+ InputLabelProps: {
3253
+ shrink: type === 'date' ? true : shrink
3254
+ },
3255
+ inputProps: {
3256
+ 'data-testid': dataTestId,
3257
+ className: 'dot-input',
3258
+ readOnly: readOnly
3259
+ },
3260
+ inputRef: inputRef,
3261
+ label: persistentLabel ? null : label,
3262
+ multiline: multiline,
3263
+ name: name,
3264
+ onBlur: onBlur,
3265
+ onChange: hasDebounce ? handleChange : onChange,
3266
+ onFocus: onFocus,
3267
+ onKeyDown: onKeyDown,
3268
+ onMouseUp: onMouseUp,
3269
+ placeholder: placeholder,
3270
+ required: required,
3271
+ minRows: multiline ? minRows : null,
3272
+ maxRows: multiline ? maxRows : null,
3273
+ size: size,
3274
+ type: type,
3275
+ value: inputTextValue,
3276
+ variant: "outlined"
3277
+ }, void 0)]
3538
3278
  }), void 0);
3539
3279
  };
3540
3280
 
3541
- var CreateUUID = function CreateUUID() {
3542
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
3543
- var r = Math.random() * 16 | 0,
3544
- v = c === 'x' ? r : r & 0x3 | 0x8;
3545
- return v.toString(16);
3546
- });
3547
- };
3548
-
3549
- var fadeIn = styled.keyframes(templateObject_1$N || (templateObject_1$N = __makeTemplateObject(["\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n"], ["\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n"])));
3550
- var StyledDotDrawer = styled__default["default"](DotDrawer).withConfig({
3551
- displayName: "NestedListstyles__StyledDotDrawer",
3552
- componentId: "sc-1wwoqos-0"
3553
- })(templateObject_4$6 || (templateObject_4$6 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
3554
- var open = _a.open;
3555
- return styled.css(templateObject_3$8 || (templateObject_3$8 = __makeTemplateObject(["\n &.", " {\n .dot-drawer-paper {\n z-index: ", ";\n animation: ", ";\n }\n }\n "], ["\n &.", " {\n .dot-drawer-paper {\n z-index: ", ";\n animation: ", ";\n }\n }\n "])), nestedDrawerClassName, open ? levelFirst : levelBottom, open && styled.css(templateObject_2$K || (templateObject_2$K = __makeTemplateObject(["\n ", " 0.2s cubic-bezier(1,0,1,.01);\n "], ["\n ", " 0.2s cubic-bezier(1,0,1,.01);\n "])), fadeIn));
3281
+ var rootClassName$M = 'dot-search-input';
3282
+ var StyledSearchInput = styled__default["default"].span.withConfig({
3283
+ displayName: "SearchInputstyles__StyledSearchInput",
3284
+ componentId: "qlwzku-0"
3285
+ })(templateObject_2$M || (templateObject_2$M = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function () {
3286
+ return styled.css(templateObject_1$P || (templateObject_1$P = __makeTemplateObject(["\n &.", " {\n }\n "], ["\n &.", " {\n }\n "])), rootClassName$M);
3556
3287
  });
3557
- var templateObject_1$N, templateObject_2$K, templateObject_3$8, templateObject_4$6;
3288
+ var templateObject_1$P, templateObject_2$M;
3558
3289
 
3559
- var DEFAULT_TOOLTIP_PLACEMENT = 'top-start';
3560
- var DotListDivider = function DotListDivider(_a) {
3561
- var item = _a.item,
3562
- index = _a.index;
3563
- if (item.text) {
3564
- return jsxRuntime.jsx(material.ListSubheader, __assign({
3565
- disableSticky: true
3566
- }, {
3567
- children: jsxRuntime.jsx(DotTypography, __assign({
3568
- variant: "overline"
3569
- }, {
3570
- children: item.text
3571
- }), void 0)
3572
- }), void 0);
3573
- }
3574
- return jsxRuntime.jsx(material.Divider, {
3575
- "aria-hidden": true,
3576
- "data-testid": "divider-" + index
3577
- }, void 0);
3578
- };
3579
- var DotList = function DotList(_a) {
3580
- var ariaLabel = _a.ariaLabel,
3581
- children = _a.children,
3290
+ function SearchInput(_a) {
3291
+ var dataTestId = _a["data-testid"],
3292
+ _b = _a.autoFocus,
3293
+ autoFocus = _b === void 0 ? true : _b,
3582
3294
  className = _a.className,
3583
- _b = _a.component,
3584
- component = _b === void 0 ? 'ul' : _b,
3585
- dataTestId = _a["data-testid"],
3586
- _c = _a.dense,
3587
- dense = _c === void 0 ? false : _c,
3588
- _d = _a.disablePadding,
3589
- disablePadding = _d === void 0 ? false : _d,
3590
- _e = _a.items,
3591
- items = _e === void 0 ? [] : _e,
3592
- _f = _a.menuPlacement,
3593
- menuPlacement = _f === void 0 ? 'right-start' : _f,
3594
- _g = _a.nestedDrawerLeftSpacing,
3595
- nestedDrawerLeftSpacing = _g === void 0 ? 240 : _g,
3596
- _h = _a.nestedListType,
3597
- nestedListType = _h === void 0 ? 'expandable' : _h,
3598
- _j = _a.width,
3599
- width = _j === void 0 ? 240 : _j;
3600
- var rootClasses = useStylesWithRootClass(rootClassName$O, className);
3601
- var listWidth = typeof width === 'number' ? width + "px" : width;
3602
- var listRef = React.useRef();
3603
- var _k = React.useState(null),
3604
- listItemIndex = _k[0],
3605
- setListItemIndex = _k[1];
3606
- var updateSelectedListItem = function updateSelectedListItem(currentIndex) {
3607
- currentIndex === listItemIndex ? setListItemIndex(null) : setListItemIndex(currentIndex);
3608
- };
3609
- return jsxRuntime.jsxs(StyledList, __assign({
3610
- "aria-label": ariaLabel,
3611
- classes: {
3612
- root: rootClasses
3613
- },
3614
- component: component,
3615
- "data-testid": dataTestId,
3616
- dense: dense,
3617
- disablePadding: disablePadding,
3618
- ref: listRef,
3619
- style: {
3620
- width: listWidth
3295
+ _c = _a.disabled,
3296
+ disabled = _c === void 0 ? false : _c,
3297
+ onChange = _a.onChange,
3298
+ onClear = _a.onClear,
3299
+ _d = _a.placeholder,
3300
+ placeholder = _d === void 0 ? 'Search' : _d,
3301
+ _e = _a.tooltip,
3302
+ tooltip = _e === void 0 ? null : _e,
3303
+ value = _a.value;
3304
+ var rootClasses = useStylesWithRootClass(rootClassName$M, className);
3305
+ var _f = React.useState(value),
3306
+ searchText = _f[0],
3307
+ setSearchText = _f[1];
3308
+ var previousSearchText = '';
3309
+ var handleChange = React.useCallback(function (event) {
3310
+ previousSearchText = event.target.value;
3311
+ setSearchText(event.target.value);
3312
+ // Timeout is to give user a chance to finish typing before refreshing data.
3313
+ setTimeout(function () {
3314
+ if (onChange && event.target.value === previousSearchText) {
3315
+ onChange(event.target.value);
3316
+ }
3317
+ }, 500);
3318
+ }, [onChange]);
3319
+ var handleClear = React.useCallback(function () {
3320
+ setSearchText('');
3321
+ onClear && onClear();
3322
+ }, [onClear]);
3323
+ var searchIcon = jsxRuntime.jsx(DotIcon, {
3324
+ className: "search-icon",
3325
+ iconId: "search"
3326
+ }, void 0);
3327
+ var clearSearchIcon = jsxRuntime.jsx(DotIconButton, {
3328
+ iconId: "close",
3329
+ onClick: handleClear,
3330
+ size: "small",
3331
+ tooltip: "Clear search text"
3332
+ }, void 0);
3333
+ return jsxRuntime.jsx(StyledSearchInput, __assign({
3334
+ className: rootClasses
3335
+ }, {
3336
+ children: jsxRuntime.jsx(DotTooltip, __assign({
3337
+ placement: "bottom",
3338
+ title: tooltip
3339
+ }, {
3340
+ children: jsxRuntime.jsx(DotInputText, {
3341
+ "data-testid": dataTestId,
3342
+ autoFocus: autoFocus,
3343
+ className: "search-text",
3344
+ disabled: disabled,
3345
+ endIcon: (searchText === null || searchText === void 0 ? void 0 : searchText.length) > 0 ? clearSearchIcon : null,
3346
+ id: "app-instance-search-text",
3347
+ name: "app-instance-search-text",
3348
+ onChange: handleChange,
3349
+ placeholder: placeholder,
3350
+ startIcon: searchIcon,
3351
+ value: searchText
3352
+ }, void 0)
3353
+ }), void 0)
3354
+ }), void 0);
3355
+ }
3356
+
3357
+ var rootClassName$L = 'dot-copy-button';
3358
+ var StyledCopyButton = styled__default["default"].span.withConfig({
3359
+ displayName: "CopyButtonstyles__StyledCopyButton",
3360
+ componentId: "sc-18ff0u-0"
3361
+ })(templateObject_2$L || (templateObject_2$L = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
3362
+ var theme = _a.theme;
3363
+ return styled.css(templateObject_1$O || (templateObject_1$O = __makeTemplateObject(["\n &.", " {\n .copied-to-clipboard {\n color: ", ";\n }\n }\n "], ["\n &.", " {\n .copied-to-clipboard {\n color: ", ";\n }\n }\n "])), rootClassName$L, theme.palette.success[400]);
3364
+ });
3365
+ var templateObject_1$O, templateObject_2$L;
3366
+
3367
+ var DotCopyButton = function DotCopyButton(_a) {
3368
+ var _b = _a.ariaLabel,
3369
+ ariaLabel = _b === void 0 ? 'Copy to clipboard' : _b,
3370
+ _c = _a.copiedTooltip,
3371
+ copiedTooltip = _c === void 0 ? 'Copied!' : _c,
3372
+ _d = _a.copyTooltip,
3373
+ copyTooltip = _d === void 0 ? 'Copy to clipboard' : _d,
3374
+ _e = _a["data-testid"],
3375
+ dataTestId = _e === void 0 ? 'dot-copy-button' : _e,
3376
+ value = _a.value;
3377
+ var _f = React.useState(false),
3378
+ showCopiedIcon = _f[0],
3379
+ setShowCopiedIcon = _f[1];
3380
+ var copyToClipboard = function copyToClipboard() {
3381
+ // The check for navigator.clipboard.writeText is because this function is
3382
+ // only supported in secure contexts (https). This will always be the case in
3383
+ // production but not when running locally.
3384
+ if (!navigator.clipboard || !navigator.clipboard.writeText) {
3385
+ console.warn('Copy to clipboard is only supported in secure context (https)', value);
3386
+ } else {
3387
+ navigator.clipboard.writeText(value);
3621
3388
  }
3389
+ };
3390
+ var copy = function copy() {
3391
+ copyToClipboard();
3392
+ setShowCopiedIcon(true);
3393
+ setTimeout(function () {
3394
+ setShowCopiedIcon(false);
3395
+ }, 3000);
3396
+ return false;
3397
+ };
3398
+ return jsxRuntime.jsxs(StyledCopyButton, __assign({
3399
+ className: rootClassName$L,
3400
+ "data-testid": dataTestId
3622
3401
  }, {
3623
- children: [items.map(function (item, index) {
3624
- var handleListItemClick = function handleListItemClick(e) {
3625
- var _a;
3626
- updateSelectedListItem(index);
3627
- (_a = item.onClick) === null || _a === void 0 ? void 0 : _a.call(item, e);
3628
- };
3629
- var handleMenuLeave = function handleMenuLeave(event) {
3630
- var _a, _b;
3631
- // Remove index only if clicked element is not found within the list
3632
- if (!((_a = listRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target))) {
3633
- setListItemIndex(null);
3634
- (_b = item.onMenuLeave) === null || _b === void 0 ? void 0 : _b.call(item, event);
3635
- }
3636
- };
3637
- if (item.child) {
3638
- return jsxRuntime.jsx(React.Fragment, {
3639
- children: item.child
3640
- }, "item-child-" + index);
3641
- }
3642
- if (item.divider) {
3643
- return jsxRuntime.jsx(DotListDivider, {
3644
- index: index,
3645
- item: item
3646
- }, "divider-" + index);
3647
- }
3648
- return jsxRuntime.jsx(DotListItem, {
3649
- className: item.className,
3650
- component: item.component,
3651
- "data-testid": dataTestId + "-item-" + index,
3652
- endIcon: item.endIcon,
3653
- href: item.href,
3654
- isOpened: listItemIndex === index,
3655
- items: item.items,
3656
- menuPlacement: menuPlacement,
3657
- nestedDrawerLeftSpacing: nestedDrawerLeftSpacing,
3658
- nestedListType: nestedListType,
3659
- onClick: item.href && !item.onClick ? null : handleListItemClick,
3660
- onMenuLeave: handleMenuLeave,
3661
- primaryText: item.primaryText,
3662
- secondaryText: item.secondaryText,
3663
- selected: item.selected,
3664
- startIcon: item.startIcon,
3665
- target: item.target,
3666
- text: item.text,
3667
- tooltip: item.tooltip,
3668
- tooltipPlacement: item.tooltipPlacement || DEFAULT_TOOLTIP_PLACEMENT
3669
- }, index);
3670
- }), children]
3402
+ children: [!showCopiedIcon && jsxRuntime.jsx(DotIconButton, {
3403
+ ariaLabel: ariaLabel,
3404
+ "data-testid": dataTestId + "-button",
3405
+ iconId: "duplicate",
3406
+ onClick: copy,
3407
+ size: "small",
3408
+ tooltip: copyTooltip
3409
+ }, void 0), showCopiedIcon && jsxRuntime.jsx(DotIcon, {
3410
+ className: "copied-to-clipboard",
3411
+ "data-testid": dataTestId + "-icon",
3412
+ fontSize: "small",
3413
+ iconId: "check-solid",
3414
+ tooltip: copiedTooltip
3415
+ }, void 0)]
3671
3416
  }), void 0);
3672
3417
  };
3673
- var DotListItem = function DotListItem(_a) {
3674
- var ariaLabel = _a.ariaLabel,
3675
- className = _a.className,
3676
- _b = _a.component,
3677
- component = _b === void 0 ? 'li' : _b,
3678
- dataTestId = _a["data-testid"],
3679
- _c = _a.divider,
3680
- divider = _c === void 0 ? false : _c,
3681
- endIcon = _a.endIcon,
3682
- href = _a.href,
3683
- isOpened = _a.isOpened,
3684
- onClick = _a.onClick,
3685
- onMenuLeave = _a.onMenuLeave,
3686
- _d = _a.items,
3687
- items = _d === void 0 ? [] : _d,
3688
- menuPlacement = _a.menuPlacement,
3689
- nestedDrawerLeftSpacing = _a.nestedDrawerLeftSpacing,
3690
- nestedListType = _a.nestedListType,
3691
- primaryText = _a.primaryText,
3692
- secondaryText = _a.secondaryText,
3693
- selected = _a.selected,
3694
- startIcon = _a.startIcon,
3695
- target = _a.target,
3696
- text = _a.text,
3697
- tooltip = _a.tooltip,
3698
- _e = _a.tooltipPlacement,
3699
- tooltipPlacement = _e === void 0 ? DEFAULT_TOOLTIP_PLACEMENT : _e;
3700
- var hasChildren = items.length > 0;
3701
- var isFlyout = nestedListType === 'menu' && hasChildren;
3702
- var _f = React.useState(null),
3703
- anchorEl = _f[0],
3704
- setAnchorEl = _f[1];
3705
- var showEndIcon = endIcon || hasChildren;
3706
- var rootClasses = useStylesWithRootClass(listItemRootClass, className, isOpened ? 'open' : '');
3707
- var toggleOpen = function toggleOpen(event) {
3708
- return setAnchorEl(event.currentTarget);
3709
- };
3710
- var handleClick = function handleClick(event) {
3711
- onClick === null || onClick === void 0 ? void 0 : onClick(event);
3712
- toggleOpen(event);
3418
+
3419
+ var img$6 = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20Z' fill='%23279FEA'/%3e%3cpath d='M12.4332 16.3533V14.8333H11.5665V16.3533L10.7432 15.8933L9.85651 16.4033L11.9998 17.6366L14.1932 16.3733L13.3332 15.8766L12.4332 16.3533Z' fill='white'/%3e%3cpath d='M7.99328 10.1866L9.24661 10.9132L9.67995 10.1399L8.36995 9.4299L9.09328 9.01657V8.03323L7.11328 9.18323L7.11661 11.5532L7.99328 11.0566V10.1866Z' fill='white'/%3e%3cpath d='M14.6934 10.9133L15.9934 10.1733L15.99 11.0566L16.8867 11.5599V9.1766L14.81 7.98993L14.7767 8.9566L15.6167 9.45326L14.29 10.0799L14.6934 10.9133Z' fill='white'/%3e%3cpath d='M16.8801 12.5435L16.0001 12.0402V12.0935V13.7068L12.4167 11.6868V7.61015L13.9667 8.49015V7.51682L12.0001 6.35349L9.95006 7.52348V8.52348L11.4967 7.63015V11.6868L8.00006 13.8168V12.0202L7.12006 12.5235V14.8202L8.96672 15.8502L9.86672 15.3335L8.40006 14.5268L12.0001 12.4368L15.5567 14.5035L14.1301 15.3268L15.0567 15.8701L16.8701 14.8268L16.8801 12.5435Z' fill='white'/%3e%3c/svg%3e";
3420
+
3421
+ var img$5 = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20Z' fill='%23279FEA'/%3e%3cpath d='M14.1867 11.2667L12.1634 10.0833L10.1367 11.2667V13.62L12.1634 14.7867L14.1867 13.62V11.2667Z' fill='white'/%3e%3cpath d='M8.43666 12.0001L7.47333 11.1501V15.1667L10.41 16.8367V15.7034L8.43666 14.5401V12.0001Z' fill='white'/%3e%3cpath d='M15.8965 12V14.5833L13.9632 15.7033V16.9367L16.8532 15.1533V11.0967L15.8965 12Z' fill='white'/%3e%3cpath d='M12.1565 8.13333L14.7165 9.61333L15.4165 8.89L12.1565 7L8.87988 8.90667L9.57988 9.63333L12.1565 8.13333Z' fill='white'/%3e%3c/svg%3e";
3422
+
3423
+ var img$4 = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20Z' fill='%2333D389'/%3e%3cpath d='M17.0033 7.62322H16.4567C16.3925 7.62863 16.3324 7.65679 16.2871 7.70264C16.2419 7.74848 16.2146 7.80898 16.21 7.87322V9.14322C15.7432 8.43248 15.1064 7.84955 14.3572 7.44732C13.6081 7.04509 12.7703 6.8363 11.92 6.83989C11.0845 6.84475 10.2627 7.05243 9.52515 7.44508C8.78763 7.83772 8.15649 8.40359 7.68598 9.09405C7.21547 9.7845 6.91966 10.5789 6.82398 11.4089C6.72831 12.2389 6.83562 13.0798 7.13669 13.8592C7.43777 14.6386 7.92361 15.3332 8.55245 15.8834C9.18128 16.4335 9.93431 16.8227 10.7468 17.0176C11.5593 17.2124 12.4069 17.207 13.2169 17.0019C14.0269 16.7967 14.7749 16.398 15.3967 15.8399C15.4257 15.8182 15.4492 15.79 15.4654 15.7576C15.4816 15.7252 15.49 15.6894 15.49 15.6532C15.49 15.617 15.4816 15.5813 15.4654 15.5489C15.4492 15.5165 15.4257 15.4883 15.3967 15.4666L14.9833 15.0532C14.9369 15.0135 14.8778 14.9917 14.8167 14.9917C14.7556 14.9917 14.6965 15.0135 14.65 15.0532C13.9076 15.7352 12.9312 16.1052 11.9233 16.0866C11.1892 16.087 10.4684 15.8897 9.83687 15.5154C9.20531 15.141 8.68627 14.6034 8.33429 13.9591C7.98231 13.3148 7.81039 12.5876 7.83662 11.8539C7.86284 11.1202 8.08624 10.4071 8.48332 9.78959C8.8804 9.17207 9.4365 8.67292 10.0932 8.34461C10.7499 8.0163 11.4828 7.87095 12.2151 7.92384C12.9474 7.97674 13.6519 8.22592 14.2545 8.6452C14.8572 9.06448 15.3358 9.63837 15.64 10.3066H14.1467C14.0828 10.3112 14.0227 10.3387 13.9774 10.384C13.9321 10.4293 13.9046 10.4893 13.9 10.5532V11.0466C13.9046 11.1104 13.9321 11.1705 13.9774 11.2158C14.0227 11.2611 14.0828 11.2886 14.1467 11.2932H17C17.0639 11.2886 17.124 11.2611 17.1693 11.2158C17.2146 11.1705 17.242 11.1104 17.2467 11.0466V7.87322C17.2422 7.8095 17.2154 7.74942 17.1708 7.70364C17.1263 7.65787 17.0669 7.62938 17.0033 7.62322Z' fill='white'/%3e%3cpath d='M12.1232 9.39987C12.1667 9.39747 12.2077 9.37914 12.2384 9.34839C12.2692 9.31764 12.2875 9.27662 12.2899 9.2332C12.2899 9.2332 12.3399 8.8332 12.3399 8.69987C12.3399 8.56653 12.2499 8.4932 12.1666 8.48987C11.5045 8.45232 10.8457 8.60791 10.2703 8.93771C9.69497 9.26752 9.22779 9.75734 8.92557 10.3477C8.62335 10.938 8.4991 11.6034 8.56792 12.263C8.63675 12.9226 8.89568 13.548 9.31325 14.0632C9.83849 14.7239 10.5905 15.1658 11.4232 15.3032C11.5166 15.3032 11.5999 15.2632 11.6299 15.1365C11.6299 15.1365 11.6999 14.8032 11.7132 14.6832C11.7233 14.639 11.7157 14.5927 11.692 14.554C11.6684 14.5154 11.6305 14.4876 11.5866 14.4765C11.225 14.4227 10.8806 14.2869 10.5795 14.0795C10.2785 13.8721 10.029 13.5986 9.84992 13.2799C9.64046 12.9274 9.51393 12.5318 9.47992 12.1232C9.44986 11.7648 9.49697 11.4042 9.61806 11.0655C9.73915 10.7269 9.93142 10.4181 10.1819 10.1601C10.4324 9.90199 10.7353 9.70061 11.0702 9.56947C11.405 9.43834 11.7641 9.38051 12.1232 9.39987Z' fill='white'/%3e%3cpath d='M13.9433 13.1568C13.96 13.1389 13.9724 13.1175 13.9796 13.0942C13.9868 13.0708 13.9885 13.0461 13.9846 13.0219C13.9808 12.9978 13.9714 12.9749 13.9573 12.9549C13.9432 12.9349 13.9247 12.9185 13.9033 12.9068L13.6133 12.7001C13.5739 12.6762 13.5272 12.6674 13.4818 12.6754C13.4364 12.6833 13.3955 12.7075 13.3666 12.7434C13.2321 12.9033 13.0642 13.0318 12.8747 13.12C12.6853 13.2082 12.4789 13.2538 12.2699 13.2538C12.061 13.2538 11.8546 13.2082 11.6651 13.12C11.4757 13.0318 11.3078 12.9033 11.1733 12.7434C11.1277 12.6913 11.0864 12.6356 11.0499 12.5768C10.9268 12.3776 10.8582 12.1495 10.8512 11.9155C10.8442 11.6814 10.8989 11.4496 11.0099 11.2434C11.0314 11.2102 11.0389 11.1699 11.0308 11.1312C11.0227 11.0925 10.9996 11.0585 10.9666 11.0368L10.6333 10.7901C10.5891 10.7715 10.5396 10.7697 10.4942 10.7851C10.4487 10.8004 10.4105 10.8319 10.3866 10.8734C10.2376 11.1465 10.153 11.45 10.1391 11.7608C10.1253 12.0716 10.1825 12.3815 10.3066 12.6668C10.4127 12.938 10.5831 13.1794 10.8033 13.3701C11.1902 13.7461 11.7104 13.9534 12.2499 13.9468C12.5743 13.9565 12.8964 13.8902 13.1905 13.753C13.4845 13.6158 13.7424 13.4116 13.9433 13.1568Z' fill='white'/%3e%3c/svg%3e";
3424
+
3425
+ var img$3 = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20Z' fill='%23279FEA'/%3e%3cpath d='M17.6865 10.0334C17.3062 9.49067 16.7772 9.06934 16.1632 8.82008C15.6426 8.61932 15.0801 8.55138 14.5267 8.62237C13.9733 8.69337 13.4462 8.90108 12.9932 9.22674C12.4991 9.62868 12.0519 10.0849 11.6598 10.5867L11.4232 10.8534L13.0198 11.5434L13.1498 11.4067C13.4002 11.1158 13.6697 10.8419 13.9565 10.5867C14.1891 10.4177 14.4599 10.3085 14.7448 10.269C15.0297 10.2294 15.3199 10.2607 15.5898 10.3601C15.916 10.4798 16.1929 10.7051 16.3765 11.0001C16.5305 11.2108 16.6383 11.4516 16.6932 11.7067C16.7448 11.9619 16.7448 12.2249 16.6932 12.4801C16.6319 12.8145 16.4783 13.125 16.2498 13.3767C16.0471 13.5809 15.7972 13.7319 15.5221 13.8162C15.2471 13.9005 14.9554 13.9156 14.6732 13.8601C14.318 13.7558 13.9714 13.6243 13.6365 13.4667L13.4598 13.3967L12.3032 14.6934L12.6365 14.8367C13.196 15.1144 13.7809 15.3376 14.3832 15.5034C14.841 15.5831 15.3102 15.5706 15.7632 15.4667C16.4116 15.3301 17.0012 14.9945 17.4498 14.5067C17.907 14.0252 18.2099 13.4182 18.3198 12.7634C18.4116 12.2979 18.4116 11.8189 18.3198 11.3534C18.186 10.8803 17.9717 10.4338 17.6865 10.0334Z' fill='white'/%3e%3cpath d='M12.8401 13.0499L11.2468 12.3599L11.1168 12.4966C10.8669 12.7942 10.5962 13.0738 10.3068 13.3332C10.0741 13.5023 9.80337 13.6115 9.51849 13.651C9.2336 13.6905 8.94336 13.6593 8.67345 13.5599C8.35219 13.4397 8.07852 13.2187 7.89345 12.9299C7.74251 12.7191 7.63591 12.4798 7.58012 12.2266C7.51653 11.9342 7.52262 11.6311 7.5979 11.3415C7.67318 11.052 7.81553 10.7842 8.01345 10.5599C8.2156 10.3551 8.46564 10.2039 8.74095 10.1201C9.01626 10.0363 9.30813 10.0225 9.59012 10.0799C9.94807 10.1781 10.2971 10.3063 10.6335 10.4632L10.8101 10.5299L11.9668 9.23324L11.6735 9.11324C11.1141 8.8326 10.5278 8.60924 9.92345 8.44657C9.37154 8.32869 8.79848 8.35611 8.26035 8.52614C7.72222 8.69617 7.23744 9.00299 6.85345 9.41657C6.38782 9.89208 6.08347 10.5019 5.98345 11.1599C5.88532 11.6248 5.88532 12.105 5.98345 12.5699C6.08588 13.0347 6.28211 13.4736 6.56012 13.8599C6.92983 14.4125 7.46217 14.8365 8.08345 15.0732C8.69864 15.3134 9.37049 15.369 10.0168 15.2332C10.4725 15.1299 10.9023 14.9348 11.2801 14.6599C11.7741 14.258 12.2214 13.8018 12.6135 13.2999L12.8401 13.0499Z' fill='white'/%3e%3c/svg%3e";
3426
+
3427
+ var img$2 = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20Z' fill='%23F7B731'/%3e%3cpath d='M17.0168 10.4836C16.8598 10.4819 16.704 10.5111 16.5583 10.5697C16.4126 10.6282 16.2799 10.715 16.1679 10.8249C16.0558 10.9348 15.9665 11.0658 15.9051 11.2103C15.8437 11.3548 15.8114 11.51 15.8101 11.667C15.8125 11.8887 15.8759 12.1056 15.9934 12.2936L15.3268 13.0036C15.1062 12.8766 14.8516 12.8214 14.5982 12.8459C14.3449 12.8704 14.1055 12.9733 13.9134 13.1403L13.2168 12.667C13.3204 12.3753 13.3514 12.0627 13.307 11.7564C13.2626 11.45 13.1441 11.1591 12.9619 10.9089C12.7796 10.6587 12.5391 10.4567 12.2611 10.3204C11.9832 10.1842 11.6762 10.1178 11.3668 10.127C10.9257 10.1237 10.4963 10.268 10.1468 10.537L9.2801 9.74364C9.38078 9.56935 9.43368 9.37158 9.43343 9.1703C9.43084 9.01345 9.39725 8.85866 9.33461 8.71484C9.27197 8.57101 9.18151 8.44099 9.06844 8.33225C8.95537 8.22352 8.82191 8.13821 8.67575 8.08124C8.52958 8.02427 8.3736 7.99677 8.21677 8.0003C7.89915 8.00103 7.59426 8.12525 7.36658 8.34671C7.13891 8.56817 7.00628 8.86949 6.99677 9.18697C6.99848 9.34467 7.03153 9.50046 7.09399 9.64528C7.15645 9.7901 7.24707 9.92106 7.36059 10.0305C7.4741 10.14 7.60825 10.2259 7.75524 10.283C7.90222 10.3402 8.0591 10.3676 8.21677 10.3636C8.43906 10.3609 8.65657 10.2987 8.84677 10.1836L9.71343 10.977C9.49991 11.2949 9.3884 11.6704 9.39376 12.0533C9.39912 12.4363 9.5211 12.8085 9.74343 13.1203L9.07677 13.8303C8.87595 13.7162 8.64759 13.6597 8.41677 13.667C8.18607 13.6729 7.96224 13.7467 7.77327 13.8791C7.5843 14.0116 7.43859 14.1968 7.35437 14.4117C7.27015 14.6265 7.25115 14.8615 7.29975 15.087C7.34836 15.3126 7.46241 15.5189 7.62763 15.68C7.79286 15.8411 8.00192 15.9499 8.22867 15.9928C8.45542 16.0357 8.68978 16.0108 8.90244 15.9212C9.11509 15.8315 9.2966 15.6812 9.42425 15.4889C9.5519 15.2967 9.62002 15.0711 9.6201 14.8403C9.61839 14.6452 9.57041 14.4533 9.4801 14.2803L10.1468 13.5703C10.5613 13.8772 11.0792 14.0102 11.5902 13.9411C12.1013 13.872 12.5653 13.6062 12.8834 13.2003L13.5501 13.637C13.5048 13.7597 13.4811 13.8894 13.4801 14.0203C13.4963 14.3289 13.6304 14.6196 13.8546 14.8323C14.0788 15.045 14.376 15.1636 14.6851 15.1636C14.9942 15.1636 15.2914 15.045 15.5156 14.8323C15.7398 14.6196 15.8739 14.3289 15.8901 14.0203C15.8923 13.8081 15.8333 13.5998 15.7201 13.4203L16.3868 12.7103C16.5613 12.81 16.7591 12.8617 16.9601 12.8603C17.1212 12.8706 17.2827 12.8481 17.4348 12.794C17.5869 12.74 17.7264 12.6555 17.8448 12.5458C17.9633 12.4361 18.0581 12.3035 18.1237 12.156C18.1893 12.0085 18.2241 11.8492 18.2261 11.6878C18.2282 11.5264 18.1974 11.3662 18.1356 11.2171C18.0737 11.068 17.9822 10.933 17.8666 10.8203C17.751 10.7077 17.6137 10.6198 17.463 10.5619C17.3123 10.504 17.1514 10.4774 16.9901 10.4836H17.0168ZM11.3501 13.2436C11.1161 13.2377 10.8891 13.163 10.6973 13.0287C10.5056 12.8944 10.3578 12.7065 10.2723 12.4886C10.1868 12.2707 10.1675 12.0325 10.2167 11.8036C10.266 11.5748 10.3816 11.3656 10.5492 11.2021C10.7167 11.0387 10.9288 10.9283 11.1588 10.8848C11.3887 10.8412 11.6264 10.8665 11.8422 10.9574C12.0579 11.0483 12.242 11.2007 12.3714 11.3957C12.5009 11.5907 12.57 11.8196 12.5701 12.0536C12.5657 12.3719 12.4357 12.6756 12.2085 12.8985C11.9812 13.1214 11.6751 13.2454 11.3568 13.2436H11.3501Z' fill='white'/%3e%3c/svg%3e";
3428
+
3429
+ var img$1 = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20Z' fill='%23205AB7'/%3e%3cpath fill-rule='evenodd' clip-rule='evenodd' d='M16.0859 8.30868C16.4108 8.42839 16.6831 8.6593 16.8542 8.96074L16.8628 8.97583L16.8705 8.99134C17.0174 9.28464 17.0775 9.61353 17.0441 9.93936C17.0123 11.03 16.8132 12.1093 16.4535 13.1395L16.4528 13.1415C16.1368 14.0377 15.4456 15.1335 14.6589 16.0108C14.2622 16.4533 13.8228 16.8611 13.3705 17.1668C12.9284 17.4656 12.4155 17.7067 11.8835 17.7262L11.8597 17.7271L11.8358 17.7262C11.291 17.7072 10.7708 17.4701 10.3204 17.1682C9.86244 16.8612 9.42376 16.4516 9.03057 16.0079C8.24999 15.1271 7.57941 14.0321 7.26533 13.1415L7.2645 13.1391C6.90532 12.1083 6.70674 11.0285 6.67566 9.93751C6.64229 9.61177 6.70236 9.28297 6.84922 8.98974L6.85684 8.97453L6.86522 8.95974C7.03585 8.65846 7.30747 8.42744 7.63179 8.30728L11.3874 6.76891C11.4429 6.74689 11.4996 6.7281 11.5571 6.71254C11.7538 6.6514 11.9644 6.6514 12.161 6.71254C12.2186 6.7281 12.2753 6.74693 12.3307 6.76895L12.3374 6.77159L16.0859 8.30868ZM11.9735 7.35255C11.8994 7.32695 11.8188 7.32695 11.7447 7.35255C11.7069 7.36213 11.6698 7.37415 11.6335 7.38855L7.87245 8.92913C7.69157 8.99369 7.53996 9.12117 7.44531 9.28828C7.35196 9.47467 7.31578 9.6845 7.34132 9.89139C7.36791 10.9234 7.55437 11.9449 7.89404 12.9198C8.45396 14.5075 10.3737 17.008 11.8591 17.06C13.2749 17.008 15.2642 14.5075 15.8241 12.9198C16.1642 11.9455 16.3512 10.9245 16.3784 9.89299C16.404 9.6861 16.3678 9.47627 16.2745 9.28988C16.1794 9.12247 16.0272 8.99495 15.8457 8.93073L12.0847 7.38855C12.0484 7.37415 12.0113 7.36213 11.9735 7.35255Z' fill='white'/%3e%3cpath d='M11.8631 8.29559L8.22357 9.77059V10.8904L11.8631 9.33705L15.5025 10.8904V9.77059L11.8631 8.29559Z' fill='white'/%3e%3cpath d='M10.6184 15.718C10.7942 16.0092 11.3957 16.4678 11.8633 16.4774C12.3078 16.4678 12.9324 16.0092 13.108 15.718C13.2835 15.4268 10.4426 15.427 10.6184 15.718Z' fill='white'/%3e%3c/svg%3e";
3430
+
3431
+ var img = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='-8 -8 40 40' fill='none' xmlns='http://www.w3.org/2000/svg'%3e %3cpath d='M19.7521 0.348161H20.3976V2.23694H20.7722L20.7752 0.351063H21.4208V0.00290065L19.7521 0V0.348161Z' fill='%232B2B2B'/%3e %3cpath d='M22.31 0.00290065H21.7223V2.23114H22.0785L22.0816 0.438104H22.0877L22.718 2.23404H22.9799L23.6224 0.441005H23.6285L23.6255 2.23404H23.997L24 0.00290065H23.4093L22.8642 1.58994H22.8551L22.31 0.00290065Z' fill='%232B2B2B'/%3e %3cpath d='M16.4863 0C15.3048 0 14.5435 0.713733 14.5435 1.81915L14.5374 8.1557C13.3194 6.89362 11.4893 6.20309 9.34245 6.20019C4.36976 6.19729 0.00609663 10.3636 6.37628e-06 15.1219C-0.00608387 19.8453 4.35149 23.9942 9.32114 24C11.5258 24.0029 13.5904 22.9207 14.6836 21.853C14.8968 23.0135 15.6306 23.6489 16.7726 23.6489C17.7165 23.6489 18.4017 22.9584 18.4047 22.0068L18.4291 1.82495C18.4291 0.734042 17.6496 0.00290135 16.4863 0ZM9.28764 20.0803C6.42218 20.0774 4.08961 17.852 4.09266 15.1161C4.0957 12.383 6.43131 10.1605 9.29677 10.1634C12.1622 10.1663 14.4948 12.3917 14.4918 15.1277C14.4887 17.8607 12.1531 20.0832 9.28764 20.0803Z' fill='%232B2B2B'/%3e %3cpath d='M9.29431 11.7998C7.3363 11.7998 5.74979 13.3143 5.74979 15.1799C5.74979 17.0455 7.3363 18.56 9.29431 18.56C11.2523 18.56 12.8419 17.0455 12.8419 15.1799C12.8419 13.3143 11.2523 11.7998 9.29431 11.7998Z' fill='%23517934'/%3e%3c/svg%3e";
3432
+
3433
+ // Takes a appType name and returns its logo as a data url.
3434
+ // If appType does not exist the Digital.ai logo is returned.
3435
+ var getLogoForAppType = function getLogoForAppType(appType) {
3436
+ switch (appType) {
3437
+ case 'Release':
3438
+ {
3439
+ return img$6;
3440
+ }
3441
+ case 'Deploy':
3442
+ {
3443
+ return img$5;
3444
+ }
3445
+ case 'Agility':
3446
+ {
3447
+ return img$4;
3448
+ }
3449
+ case 'Continuous Testing':
3450
+ {
3451
+ return img$3;
3452
+ }
3453
+ case 'Intelligence':
3454
+ {
3455
+ return img$2;
3456
+ }
3457
+ case 'Application Protection':
3458
+ {
3459
+ return img$1;
3460
+ }
3461
+ default:
3462
+ {
3463
+ return img;
3464
+ }
3465
+ }
3466
+ };
3467
+ var daiAppsHeaderMenuItem = function daiAppsHeaderMenuItem(count) {
3468
+ if (count === void 0) {
3469
+ count = 0;
3470
+ }
3471
+ return sectionHeaderMenuItem('DIGITAL.AI APPLICATIONS', count, true, false);
3472
+ };
3473
+ var sectionHeaderMenuItem = function sectionHeaderMenuItem(title, count, showEmpty, showCount) {
3474
+ if (showEmpty === void 0) {
3475
+ showEmpty = false;
3476
+ }
3477
+ if (showCount === void 0) {
3478
+ showCount = true;
3479
+ }
3480
+ var children = showEmpty || count > 0 ? jsxRuntime.jsxs(DotTypography, __assign({
3481
+ className: "section-title"
3482
+ }, {
3483
+ children: [title, showCount && count > 0 ? " (" + count + ")" : '']
3484
+ }), "menu-item-section-title-" + title) : null;
3485
+ return {
3486
+ children: children,
3487
+ key: "section-header-" + title
3713
3488
  };
3714
- var handleMenuLeave = function handleMenuLeave(event) {
3715
- return onMenuLeave(event);
3489
+ };
3490
+ var createMenuItem = function createMenuItem(url, title, subtitle, onClick) {
3491
+ return jsxRuntime.jsxs("div", __assign({
3492
+ className: "app-menu-item"
3493
+ }, {
3494
+ children: [jsxRuntime.jsx(DotLink, __assign({
3495
+ href: url,
3496
+ color: "textPrimary",
3497
+ target: "_blank",
3498
+ onClick: onClick,
3499
+ onPointerDown: onClick
3500
+ }, {
3501
+ children: jsxRuntime.jsxs("div", __assign({
3502
+ className: "logo-title"
3503
+ }, {
3504
+ children: [jsxRuntime.jsx("div", __assign({
3505
+ className: "start-icon"
3506
+ }, {
3507
+ children: jsxRuntime.jsx(DotIcon, {
3508
+ iconId: "open-new-tab"
3509
+ }, void 0)
3510
+ }), void 0), jsxRuntime.jsxs("div", __assign({
3511
+ className: "dot-app-switcher-app-title"
3512
+ }, {
3513
+ children: [jsxRuntime.jsx(DotTypography, __assign({
3514
+ variant: "body1"
3515
+ }, {
3516
+ children: title
3517
+ }), void 0), subtitle && jsxRuntime.jsx(DotTypography, __assign({
3518
+ variant: "body2"
3519
+ }, {
3520
+ children: subtitle
3521
+ }), void 0)]
3522
+ }), void 0)]
3523
+ }), void 0)
3524
+ }), void 0), jsxRuntime.jsx(DotCopyButton, {
3525
+ copyTooltip: "Copy application URL",
3526
+ value: url
3527
+ }, void 0)]
3528
+ }), "app-menu-item-" + title);
3529
+ };
3530
+ var createTopLevelMenuItem = function createTopLevelMenuItem(url, logo, title, openNewTab) {
3531
+ if (openNewTab === void 0) {
3532
+ openNewTab = true;
3533
+ }
3534
+ // Creates an entry in the AppSwitcher at the same level as the AppTypeLabels, used for the Platform link and
3535
+ // Empty state current application link
3536
+ var target = openNewTab ? '_blank' : '_self';
3537
+ return jsxRuntime.jsxs(DotLink, __assign({
3538
+ href: url,
3539
+ color: "textPrimary",
3540
+ target: target
3541
+ }, {
3542
+ children: [jsxRuntime.jsxs("div", __assign({
3543
+ className: "logo-title"
3544
+ }, {
3545
+ children: [jsxRuntime.jsx(DotAvatar, {
3546
+ alt: "app image",
3547
+ imageSrc: logo,
3548
+ type: "image",
3549
+ variant: "circular"
3550
+ }, void 0), jsxRuntime.jsx("div", __assign({
3551
+ className: "dot-app-switcher-app-title"
3552
+ }, {
3553
+ children: jsxRuntime.jsx(DotTypography, __assign({
3554
+ variant: "body1"
3555
+ }, {
3556
+ children: title
3557
+ }), void 0)
3558
+ }), void 0)]
3559
+ }), void 0), openNewTab && jsxRuntime.jsx(DotIcon, {
3560
+ iconId: "open-new-tab"
3561
+ }, void 0)]
3562
+ }), "top-menu-item-" + title);
3563
+ };
3564
+ var createAppTypeLabel = function createAppTypeLabel(appTypeName, logo, appProps) {
3565
+ var logoProps = logo ? {
3566
+ imageSrc: logo
3567
+ } : {
3568
+ iconId: 'collection'
3716
3569
  };
3717
- var renderListItemText = function renderListItemText() {
3718
- return primaryText && secondaryText ? jsxRuntime.jsx(material.ListItemText, {
3719
- primary: primaryText,
3720
- secondary: secondaryText
3721
- }, void 0) : jsxRuntime.jsx(DotTypography, __assign({
3722
- variant: "body1"
3570
+ return jsxRuntime.jsxs("div", __assign({
3571
+ className: "logo-title"
3572
+ }, {
3573
+ children: [jsxRuntime.jsx(DotAvatar, __assign({}, logoProps, {
3574
+ alt: "app image",
3575
+ type: "image",
3576
+ variant: "circular"
3577
+ }), void 0), jsxRuntime.jsxs("div", __assign({
3578
+ className: "dot-app-switcher-app-title"
3723
3579
  }, {
3724
- children: text
3725
- }), void 0);
3580
+ children: [jsxRuntime.jsx(DotTypography, __assign({
3581
+ variant: "body1"
3582
+ }, {
3583
+ children: appTypeName
3584
+ }), void 0), jsxRuntime.jsxs(DotTypography, __assign({
3585
+ variant: "body2"
3586
+ }, {
3587
+ children: ["Instance (", appProps.length, ")"]
3588
+ }), void 0)]
3589
+ }), void 0)]
3590
+ }), void 0);
3591
+ };
3592
+ var getInstanceStateText = function getInstanceStateText(application) {
3593
+ if (application.instance_state === 1) {
3594
+ return 'Production';
3595
+ }
3596
+ return 'Non-production';
3597
+ };
3598
+ var sortRecentAppInstancesFn = function sortRecentAppInstancesFn(a, b) {
3599
+ var appA = a.application;
3600
+ var appB = b.application;
3601
+ return sortAppInstancesFn(appA, appB);
3602
+ };
3603
+ var sortAppInstancesFn = function sortAppInstancesFn(a, b) {
3604
+ var result = a.name.localeCompare(b.name);
3605
+ if (result === 0) {
3606
+ if (a.instance_state > b.instance_state) {
3607
+ result = -1;
3608
+ } else if (a.instance_state < b.instance_state) {
3609
+ result = 1;
3610
+ }
3611
+ }
3612
+ return result;
3613
+ };
3614
+ var RECENT_INSTANCES_KEY = 'dot-app-switcher-recent-app-instances';
3615
+ var recentAppInstancesSetter = function recentAppInstancesSetter(latestInstance, maxRecentItems
3616
+ //): (RecentAppInstance[]) => RecentAppInstance[])=> {
3617
+ ) {
3618
+ return function (orig) {
3619
+ var lastAccess = Date.now();
3620
+ var isNew = true;
3621
+ var oldestIndex = 0;
3622
+ var oldestAccess = lastAccess;
3623
+ orig.forEach(function (item, index) {
3624
+ if (item.application.id === latestInstance.id) {
3625
+ isNew = false;
3626
+ // don't need to rerender so eventually returning orig
3627
+ item.lastAccess = lastAccess;
3628
+ }
3629
+ if (item.lastAccess < oldestAccess) {
3630
+ oldestIndex = index;
3631
+ oldestAccess = item.lastAccess;
3632
+ }
3633
+ });
3634
+ if (isNew) {
3635
+ var newRecentItem = {
3636
+ application: latestInstance,
3637
+ lastAccess: lastAccess
3638
+ };
3639
+ var newRecent = void 0;
3640
+ if (orig.length >= maxRecentItems) {
3641
+ newRecent = __spreadArray([], orig);
3642
+ newRecent.splice(oldestIndex, 1, newRecentItem);
3643
+ } else {
3644
+ newRecent = __spreadArray(__spreadArray([], orig), [newRecentItem]);
3645
+ }
3646
+ newRecent.sort(sortRecentAppInstancesFn);
3647
+ localStorage.setItem(RECENT_INSTANCES_KEY, JSON.stringify(newRecent));
3648
+ return newRecent;
3649
+ }
3650
+ return orig;
3726
3651
  };
3727
- var renderListItemEndIcon = function renderListItemEndIcon() {
3728
- if (hasChildren || !endIcon) {
3729
- return jsxRuntime.jsx(DotIcon, {
3730
- iconId: hasChildren && getChevronIcon(nestedListType, isOpened)
3731
- }, void 0);
3652
+ };
3653
+
3654
+ var rootClassName$K = 'dot-app-switcher';
3655
+ var StyledAppSwitcher = styled__default["default"](DotDrawer).withConfig({
3656
+ displayName: "AppSwitcherstyles__StyledAppSwitcher",
3657
+ componentId: "hhxfqg-0"
3658
+ })(templateObject_2$K || (templateObject_2$K = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
3659
+ var theme = _a.theme;
3660
+ return styled.css(templateObject_1$N || (templateObject_1$N = __makeTemplateObject(["\n &.", " {\n .dot-drawer-paper {\n padding: 0;\n width: 382px;\n }\n .content {\n padding: ", ";\n overflow-y: auto;\n }\n .app-menu-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n .dot-link,\n .product-menu-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n height: 60px;\n margin-bottom: ", ";\n text-decoration: none;\n cursor: pointer;\n }\n .logo-title {\n display: flex;\n align-items: center;\n gap: 16px;\n width: 100%;\n .start-icon {\n width: 40px;\n display: flex;\n justify-content: space-around;\n align-items: center;\n }\n }\n .dot-avatar {\n flex-basis: 40px;\n }\n .section-title {\n display: flex;\n align-items: center;\n height: 30px;\n padding: ", ";\n margin: ", ";\n border-bottom: 1px solid ", ";\n }\n .dot-app-switcher-app-title {\n min-width: 150px;\n }\n .dot-icon {\n flex-basis: content;\n }\n .app-switcher-header {\n .app-switcher-header-title {\n display: flex;\n align-items: center;\n }\n display: flex;\n justify-content: space-between;\n align-items: end;\n border-bottom: 1px solid ", ";\n padding: ", ";\n .app-switcher-label {\n padding-left: ", ";\n }\n }\n .app-switcher-back-button {\n &.dot-button.MuiButton-text {\n padding-left: 0;\n }\n }\n .product-heading {\n display: flex;\n align-items: center;\n gap: 16px;\n }\n .product-applications {\n margin-top: ", ";\n width: 100%;\n }\n .app-instance-search {\n margin-top: ", ";\n }\n }\n "], ["\n &.", " {\n .dot-drawer-paper {\n padding: 0;\n width: 382px;\n }\n .content {\n padding: ", ";\n overflow-y: auto;\n }\n .app-menu-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n .dot-link,\n .product-menu-item {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n height: 60px;\n margin-bottom: ", ";\n text-decoration: none;\n cursor: pointer;\n }\n .logo-title {\n display: flex;\n align-items: center;\n gap: 16px;\n width: 100%;\n .start-icon {\n width: 40px;\n display: flex;\n justify-content: space-around;\n align-items: center;\n }\n }\n .dot-avatar {\n flex-basis: 40px;\n }\n .section-title {\n display: flex;\n align-items: center;\n height: 30px;\n padding: ", ";\n margin: ", ";\n border-bottom: 1px solid ", ";\n }\n .dot-app-switcher-app-title {\n min-width: 150px;\n }\n .dot-icon {\n flex-basis: content;\n }\n .app-switcher-header {\n .app-switcher-header-title {\n display: flex;\n align-items: center;\n }\n display: flex;\n justify-content: space-between;\n align-items: end;\n border-bottom: 1px solid ", ";\n padding: ", ";\n .app-switcher-label {\n padding-left: ", ";\n }\n }\n .app-switcher-back-button {\n &.dot-button.MuiButton-text {\n padding-left: 0;\n }\n }\n .product-heading {\n display: flex;\n align-items: center;\n gap: 16px;\n }\n .product-applications {\n margin-top: ", ";\n width: 100%;\n }\n .app-instance-search {\n margin-top: ", ";\n }\n }\n "])), rootClassName$K, theme.spacing(0, 2, 1, 2), theme.spacing(1), theme.spacing(0, 0, 0, 2), theme.spacing(0, -2, 0), theme.palette.grey[100], theme.palette.grey[100], theme.spacing(0, 2, 1, 2), theme.spacing(2), theme.spacing(2), theme.spacing(2));
3661
+ });
3662
+ var templateObject_1$N, templateObject_2$K;
3663
+
3664
+ var DotAppSwitcherView = function DotAppSwitcherView(_a) {
3665
+ var activeApp = _a.activeApp,
3666
+ apps = _a.apps,
3667
+ className = _a.className,
3668
+ _b = _a.maxRecentInstances,
3669
+ maxRecentInstances = _b === void 0 ? 5 : _b,
3670
+ _c = _a.noAppTypeLabel,
3671
+ noAppTypeLabel = _c === void 0 ? 'Other' : _c,
3672
+ platformConsoleUrl = _a.platformConsoleUrl,
3673
+ onClose = _a.onClose,
3674
+ open = _a.open,
3675
+ _d = _a.searchInstancesThreshold,
3676
+ searchInstancesThreshold = _d === void 0 ? 5 : _d,
3677
+ selectedAppType = _a.selectedAppType,
3678
+ _e = _a.yOffset,
3679
+ yOffset = _e === void 0 ? 56 : _e,
3680
+ _f = _a.zIndex,
3681
+ zIndex = _f === void 0 ? 990 : _f;
3682
+ var dotCoreApiContext = useDotCoreApiContext();
3683
+ var setSelectedAppType = null;
3684
+ if (dotCoreApiContext !== null) {
3685
+ setSelectedAppType = dotCoreApiContext.setSelectedAppSwitcherAppType;
3686
+ }
3687
+ var rootClasses = useStylesWithRootClass(rootClassName$K, className);
3688
+ var _g = React.useState(),
3689
+ appTypeMap = _g[0],
3690
+ setAppTypeMap = _g[1];
3691
+ var _h = React.useState(),
3692
+ appTypeLabels = _h[0],
3693
+ setAppTypeLabels = _h[1];
3694
+ var _j = React.useState(),
3695
+ appTypeMenuItems = _j[0],
3696
+ setAppTypeMenuItems = _j[1];
3697
+ var _k = React.useState(null),
3698
+ selectedAppTypeAlt = _k[0],
3699
+ setSelectedAppTypeAlt = _k[1];
3700
+ var _l = React.useState(''),
3701
+ searchText = _l[0],
3702
+ setSearchText = _l[1];
3703
+ var cachedRecentItemsJson = localStorage.getItem(RECENT_INSTANCES_KEY);
3704
+ var _m = React.useState(cachedRecentItemsJson ? JSON.parse(cachedRecentItemsJson) : []),
3705
+ recentAppInstances = _m[0],
3706
+ setRecentAppInstances = _m[1];
3707
+ if (!setSelectedAppType) {
3708
+ selectedAppType = selectedAppTypeAlt;
3709
+ setSelectedAppType = setSelectedAppTypeAlt;
3710
+ }
3711
+ var showApps = React.useCallback(function (appType) {
3712
+ setSelectedAppType(appType);
3713
+ }, []);
3714
+ var showAppTypes = React.useCallback(function () {
3715
+ setSearchText('');
3716
+ setSelectedAppType(null);
3717
+ }, []);
3718
+ var populateAppTypeMap = React.useCallback(function () {
3719
+ var newAppTypeMap = new Map();
3720
+ // we'll put Other at the end
3721
+ var otherApps = [];
3722
+ apps === null || apps === void 0 ? void 0 : apps.forEach(function (app) {
3723
+ var instanceStateText = getInstanceStateText(app) + " instance";
3724
+ var children = createMenuItem(app.url, app.name, instanceStateText, function (e) {
3725
+ handleRecentInstance(e, app);
3726
+ });
3727
+ var searchableContent = app.name + " " + instanceStateText;
3728
+ var appTypeName = app.logo_product_name;
3729
+ var appTypeApps;
3730
+ if (appTypeName) {
3731
+ appTypeApps = newAppTypeMap.get(appTypeName);
3732
+ if (!appTypeApps) {
3733
+ appTypeApps = [];
3734
+ newAppTypeMap.set(appTypeName, appTypeApps);
3735
+ }
3736
+ } else {
3737
+ appTypeApps = otherApps;
3738
+ }
3739
+ appTypeApps.push({
3740
+ application: app,
3741
+ children: children,
3742
+ searchableContent: searchableContent,
3743
+ key: app.id
3744
+ });
3745
+ });
3746
+ var keys = Array.from(newAppTypeMap.keys()).sort();
3747
+ var sortedAppTypeMap = new Map();
3748
+ for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
3749
+ var appType = keys_1[_i];
3750
+ var appTypeApps = newAppTypeMap.get(appType);
3751
+ appTypeApps.sort(function (a, b) {
3752
+ return sortAppInstancesFn(a.application, b.application);
3753
+ });
3754
+ sortedAppTypeMap.set(appType, appTypeApps);
3755
+ }
3756
+ var appTypeCount = sortedAppTypeMap.size;
3757
+ if (platformConsoleUrl) {
3758
+ appTypeCount++;
3759
+ }
3760
+ if (otherApps.length > 0) {
3761
+ otherApps.sort(function (a, b) {
3762
+ return sortAppInstancesFn(a.application, b.application);
3763
+ });
3764
+ sortedAppTypeMap.set(noAppTypeLabel, otherApps);
3765
+ }
3766
+ setAppTypeMap(sortedAppTypeMap);
3767
+ var menuItems = [daiAppsHeaderMenuItem(appTypeCount)];
3768
+ if (platformConsoleUrl) {
3769
+ var children = createTopLevelMenuItem(platformConsoleUrl, getLogoForAppType('Platform'), 'Digital.ai Platform', !window.location.href.startsWith(platformConsoleUrl));
3770
+ menuItems.push({
3771
+ children: children,
3772
+ key: 'app-switcher-platform-link'
3773
+ });
3774
+ }
3775
+ var newAppTypeLabels = new Map();
3776
+ sortedAppTypeMap.forEach(function (singleTypeApps, appTypeName) {
3777
+ if ((singleTypeApps === null || singleTypeApps === void 0 ? void 0 : singleTypeApps.length) > 0) {
3778
+ var logo = appTypeName === noAppTypeLabel ? null : getLogoForAppType(appTypeName);
3779
+ newAppTypeLabels.set(appTypeName, {
3780
+ logo: logo,
3781
+ singleTypeApps: singleTypeApps
3782
+ });
3783
+ menuItems.push({
3784
+ children: jsxRuntime.jsxs(DotLink, __assign({
3785
+ className: "product-menu-item",
3786
+ onClick: function () {
3787
+ return showApps(appTypeName);
3788
+ }
3789
+ }, {
3790
+ children: [createAppTypeLabel(appTypeName, logo, singleTypeApps), jsxRuntime.jsx(DotIcon, {
3791
+ iconId: "chevron-right"
3792
+ }, void 0)]
3793
+ }), "menu-item-" + appTypeName),
3794
+ key: appTypeName
3795
+ });
3796
+ }
3797
+ });
3798
+ setAppTypeMenuItems(menuItems);
3799
+ setAppTypeLabels(newAppTypeLabels);
3800
+ }, [apps]);
3801
+ var emptyState = React.useCallback(function () {
3802
+ var currentAppMenuItem = createTopLevelMenuItem(window.location.href, getLogoForAppType(activeApp.product), activeApp.name, false);
3803
+ setAppTypeMenuItems([daiAppsHeaderMenuItem(), {
3804
+ children: currentAppMenuItem,
3805
+ key: 'no_applications_configured'
3806
+ }]);
3807
+ }, [activeApp]);
3808
+ React.useEffect(function () {
3809
+ if ((apps === null || apps === void 0 ? void 0 : apps.length) > 0) {
3810
+ populateAppTypeMap();
3811
+ } else {
3812
+ emptyState();
3813
+ }
3814
+ }, [apps]);
3815
+ var onAppInstanceSearchTextChange = React.useCallback(function (text) {
3816
+ setSearchText(text);
3817
+ }, []);
3818
+ var clearAppInstanceSearchText = React.useCallback(function () {
3819
+ setSearchText('');
3820
+ }, []);
3821
+ var closeHandler = React.useCallback(function (event) {
3822
+ setSearchText('');
3823
+ onClose && onClose(event);
3824
+ }, [onClose]);
3825
+ var filteredAppInstances = React.useCallback(function () {
3826
+ var _a;
3827
+ return (_a = appTypeMap.get(selectedAppType)) === null || _a === void 0 ? void 0 : _a.filter(function (item) {
3828
+ var isMatch = !searchText;
3829
+ if (searchText) {
3830
+ var testStr = isLowerCase(searchText) ? item.searchableContent.toLowerCase() : item.searchableContent;
3831
+ isMatch = testStr.indexOf(searchText) >= 0;
3832
+ }
3833
+ return isMatch;
3834
+ }).map(function (item) {
3835
+ return item.children;
3836
+ });
3837
+ }, [appTypeMap, selectedAppType, searchText]);
3838
+ var handleRecentInstance = React.useCallback(function (event, latestInstance) {
3839
+ // middle button counts; click to open context menu does not
3840
+ if (event.button < 2) {
3841
+ setRecentAppInstances(recentAppInstancesSetter(latestInstance, maxRecentInstances));
3732
3842
  }
3733
- return endIcon;
3734
- };
3735
- return jsxRuntime.jsxs(jsxRuntime.Fragment, {
3736
- children: [jsxRuntime.jsx(DotTooltip, __assign({
3737
- "data-testid": dataTestId + "-tooltip",
3738
- placement: tooltipPlacement,
3739
- title: tooltip
3843
+ }, [recentAppInstances]);
3844
+ var recentAppInstancesSection = jsxRuntime.jsxs(jsxRuntime.Fragment, {
3845
+ children: [sectionHeaderMenuItem('RECENT', recentAppInstances.length).children, jsxRuntime.jsx("div", __assign({
3846
+ className: "product-applications"
3740
3847
  }, {
3741
- children: jsxRuntime.jsxs(StyledListItem, __assign({
3742
- "aria-label": ariaLabel,
3743
- button: true,
3744
- classes: {
3745
- root: rootClasses
3746
- },
3747
- component: href && !onClick ? 'a' : component,
3748
- "data-testid": dataTestId,
3749
- divider: divider,
3750
- href: onClick ? null : href,
3751
- onClick: onClick || !href ? handleClick : null,
3752
- selected: isFlyout ? isOpened : selected,
3753
- target: target
3848
+ children: recentAppInstances.map(function (item) {
3849
+ var app = item.application;
3850
+ return createMenuItem(app.url, app.name, app.logo_product_name + " - " + getInstanceStateText(app), function (e) {
3851
+ handleRecentInstance(e, app);
3852
+ });
3853
+ })
3854
+ }), void 0)]
3855
+ }, void 0);
3856
+ var content = function content() {
3857
+ var _a;
3858
+ if (selectedAppType && appTypeMap && appTypeLabels) {
3859
+ var labelConfig = appTypeLabels.get(selectedAppType);
3860
+ return jsxRuntime.jsxs("div", __assign({
3861
+ className: "content"
3754
3862
  }, {
3755
- children: [jsxRuntime.jsxs("span", __assign({
3756
- className: listItemLinkClassName
3863
+ children: [jsxRuntime.jsx("span", {
3864
+ children: jsxRuntime.jsx(DotButton, __assign({
3865
+ className: "app-switcher-back-button",
3866
+ type: "text",
3867
+ onClick: showAppTypes,
3868
+ startIcon: jsxRuntime.jsx(DotIcon, {
3869
+ iconId: "back"
3870
+ }, void 0)
3871
+ }, {
3872
+ children: jsxRuntime.jsx("span", {
3873
+ children: "Back"
3874
+ }, void 0)
3875
+ }), void 0)
3876
+ }, void 0), jsxRuntime.jsx("div", __assign({
3877
+ className: "product-heading"
3757
3878
  }, {
3758
- children: [startIcon && jsxRuntime.jsx(material.ListItemIcon, {
3759
- children: startIcon
3760
- }, void 0), renderListItemText()]
3761
- }), void 0), showEndIcon && renderListItemEndIcon()]
3762
- }), void 0)
3763
- }), void 0), hasChildren && jsxRuntime.jsx(NestedList, {
3764
- anchorEl: anchorEl,
3765
- ariaLabel: "nested list",
3766
- "data-testid": "nestedList",
3767
- items: items,
3768
- menuPlacement: menuPlacement,
3769
- nestedDrawerLeftSpacing: nestedDrawerLeftSpacing,
3770
- onMenuLeave: handleMenuLeave,
3771
- open: isOpened,
3772
- type: nestedListType
3773
- }, void 0)]
3774
- }, void 0);
3775
- };
3776
- var NestedList = function NestedList(_a) {
3777
- var ariaLabel = _a.ariaLabel,
3778
- anchorEl = _a.anchorEl,
3779
- dataTestId = _a["data-testid"],
3780
- items = _a.items,
3781
- menuPlacement = _a.menuPlacement,
3782
- nestedDrawerLeftSpacing = _a.nestedDrawerLeftSpacing,
3783
- onMenuLeave = _a.onMenuLeave,
3784
- open = _a.open,
3785
- parentItemIndex = _a.parentItemIndex,
3786
- type = _a.type;
3787
- var flyoutItemClasses = useStylesWithRootClass(listItemRootClass, flyoutListItemClassName);
3788
- var flyoutSpanClasses = useStylesWithRootClass(listItemLinkClassName, flyoutItemLinkClassName);
3789
- if (type === 'expandable') {
3790
- return jsxRuntime.jsx(material.Collapse, __assign({
3791
- in: open,
3792
- timeout: "auto",
3793
- unmountOnExit: true
3794
- }, {
3795
- children: jsxRuntime.jsx(DotList, {
3796
- ariaLabel: ariaLabel,
3797
- className: nestedListClassName,
3798
- component: "div",
3799
- "data-testid": dataTestId,
3800
- disablePadding: true,
3801
- items: items
3802
- }, parentItemIndex)
3803
- }), void 0);
3804
- }
3805
- if (type === 'menu') {
3806
- var menuItems = items.map(function (item, index) {
3807
- var href = item.href,
3808
- target = item.target,
3809
- onClick = item.onClick,
3810
- tooltip = item.tooltip,
3811
- _a = item.tooltipPlacement,
3812
- tooltipPlacement = _a === void 0 ? DEFAULT_TOOLTIP_PLACEMENT : _a,
3813
- text = item.text;
3814
- return {
3815
- children: jsxRuntime.jsx(DotTooltip, __assign({
3816
- placement: tooltipPlacement,
3817
- title: tooltip
3879
+ children: createAppTypeLabel(selectedAppType, labelConfig.logo, labelConfig.singleTypeApps)
3880
+ }), void 0), ((_a = appTypeMap === null || appTypeMap === void 0 ? void 0 : appTypeMap.get(selectedAppType)) === null || _a === void 0 ? void 0 : _a.length) >= searchInstancesThreshold && jsxRuntime.jsx("div", __assign({
3881
+ className: "app-instance-search"
3818
3882
  }, {
3819
- children: jsxRuntime.jsx(StyledListItem, __assign({
3820
- className: flyoutItemClasses,
3821
- component: href && !onClick ? 'a' : null,
3822
- "data-testid": dataTestId + "-item-" + index,
3823
- href: href,
3824
- onClick: onClick,
3825
- target: target
3826
- }, {
3827
- children: jsxRuntime.jsxs("span", __assign({
3828
- className: flyoutSpanClasses
3829
- }, {
3830
- children: [item.startIcon, jsxRuntime.jsx(DotTypography, __assign({
3831
- variant: "body1"
3832
- }, {
3833
- children: text
3834
- }), void 0)]
3835
- }), void 0)
3836
- }), parentItemIndex + "-" + index)
3837
- }), parentItemIndex + "-" + index + "-tooltip"),
3838
- classes: '',
3839
- key: String(index)
3840
- };
3841
- });
3842
- return jsxRuntime.jsx(DotMenu, {
3843
- anchorEl: anchorEl,
3844
- ariaLabel: ariaLabel,
3845
- className: flyoutMenuClassName,
3846
- "data-testid": dataTestId,
3847
- id: CreateUUID(),
3848
- menuItemHeight: "auto",
3849
- menuItems: menuItems,
3850
- menuPlacement: menuPlacement,
3851
- onLeave: onMenuLeave,
3852
- open: open
3853
- }, parentItemIndex);
3854
- }
3855
- if (type === 'drawer') {
3856
- return jsxRuntime.jsx(StyledDotDrawer, __assign({
3857
- PaperProps: {
3858
- style: {
3859
- left: nestedDrawerLeftSpacing + "px"
3860
- }
3883
+ children: jsxRuntime.jsx(SearchInput, {
3884
+ "data-testid": "app-instance-search-input",
3885
+ onChange: onAppInstanceSearchTextChange,
3886
+ onClear: clearAppInstanceSearchText,
3887
+ value: searchText
3888
+ }, void 0)
3889
+ }), void 0), jsxRuntime.jsx("div", __assign({
3890
+ className: "product-applications"
3891
+ }, {
3892
+ children: filteredAppInstances()
3893
+ }), void 0)]
3894
+ }), void 0);
3895
+ } else {
3896
+ return jsxRuntime.jsxs("div", __assign({
3897
+ className: "content"
3898
+ }, {
3899
+ children: [jsxRuntime.jsx(DotList, {
3900
+ items: appTypeMenuItems === null || appTypeMenuItems === void 0 ? void 0 : appTypeMenuItems.map(function (item) {
3901
+ return {
3902
+ child: item.children
3903
+ };
3904
+ }),
3905
+ width: "100%"
3906
+ }, void 0), recentAppInstancesSection]
3907
+ }), void 0);
3908
+ }
3909
+ };
3910
+ var header = {
3911
+ className: 'app-switcher-header',
3912
+ children: jsxRuntime.jsxs("div", __assign({
3913
+ className: "app-switcher-header-title",
3914
+ style: {
3915
+ marginTop: yOffset + 'px',
3916
+ width: '80%'
3917
+ }
3918
+ }, {
3919
+ children: [jsxRuntime.jsx(DotAvatar, {
3920
+ iconId: "apps",
3921
+ alt: "app image",
3922
+ type: "image",
3923
+ variant: "circular"
3924
+ }, void 0), jsxRuntime.jsx(DotTypography, __assign({
3925
+ className: "app-switcher-label"
3926
+ }, {
3927
+ children: "App switcher"
3928
+ }), void 0)]
3929
+ }), void 0)
3930
+ };
3931
+ return jsxRuntime.jsx(StyledAppSwitcher, __assign({
3932
+ className: rootClasses,
3933
+ ModalProps: {
3934
+ style: {
3935
+ zIndex: zIndex
3861
3936
  },
3862
- anchor: "left",
3863
- className: nestedDrawerClassName,
3864
- "data-testid": "nested-drawer",
3937
+ hideBackdrop: true
3938
+ },
3939
+ drawerHeaderProps: header,
3940
+ variant: "temporary",
3941
+ width: "340px",
3942
+ open: open,
3943
+ onClose: closeHandler
3944
+ }, {
3945
+ children: content()
3946
+ }), void 0);
3947
+ };
3948
+ var DotAppSwitcher = function DotAppSwitcher(_a) {
3949
+ var accountId = _a.accountId,
3950
+ _b = _a.includePlatformConsole,
3951
+ includePlatformConsole = _b === void 0 ? true : _b,
3952
+ onClose = _a.onClose,
3953
+ commonProps = __rest(_a, ["accountId", "includePlatformConsole", "onClose"]);
3954
+ var _c = useDotCoreApiContext(),
3955
+ applications = _c.applications,
3956
+ applicationsLoading = _c.applicationsLoading,
3957
+ applicationsError = _c.applicationsError,
3958
+ loadApplications = _c.loadApplications,
3959
+ open = _c.isAppSwitcherOpen,
3960
+ platformConsoleUrl = _c.platformConsoleUrl,
3961
+ setOpen = _c.setIsAppSwitcherOpen,
3962
+ selectedAppType = _c.selectedAppSwitcherAppType,
3963
+ setSelectedAppType = _c.setSelectedAppSwitcherAppType;
3964
+ React.useEffect(function () {
3965
+ if ((!applications || applications.length === 0) && open) {
3966
+ loadApplications(accountId);
3967
+ }
3968
+ }, [accountId, open]);
3969
+ if (applicationsError) {
3970
+ console.error('Error loading application list in AppSwitcher', applicationsError);
3971
+ }
3972
+ var closeHandler = React.useCallback(function (event) {
3973
+ setOpen(false);
3974
+ setSelectedAppType(null);
3975
+ onClose && onClose(event);
3976
+ }, [onClose]);
3977
+ var viewProps = includePlatformConsole ? __assign(__assign({}, commonProps), {
3978
+ platformConsoleUrl: platformConsoleUrl
3979
+ }) : __assign({}, commonProps);
3980
+ if (!applicationsLoading && !applicationsError) {
3981
+ return jsxRuntime.jsx(DotAppSwitcherView, __assign({}, viewProps, {
3865
3982
  open: open,
3866
- variant: "persistent"
3867
- }, {
3868
- children: jsxRuntime.jsx(DotList, {
3869
- ariaLabel: ariaLabel,
3870
- className: nestedListClassName,
3871
- component: "div",
3872
- "data-testid": dataTestId,
3873
- disablePadding: true,
3874
- items: items,
3875
- width: '100%'
3876
- }, parentItemIndex)
3983
+ apps: applications,
3984
+ selectedAppType: selectedAppType,
3985
+ onClose: closeHandler
3877
3986
  }), void 0);
3878
3987
  }
3988
+ return null;
3879
3989
  };
3880
3990
 
3881
3991
  var _path$2, _path2$2, _path3, _path4;
@@ -4465,7 +4575,7 @@
4465
4575
  componentId: "j2sgjy-0"
4466
4576
  })(templateObject_2$F || (templateObject_2$F = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
4467
4577
  var theme = _a.theme;
4468
- return styled.css(templateObject_1$I || (templateObject_1$I = __makeTemplateObject(["\n &.", " {\n &.", " .dot-text-field .", " {\n height: 56px;\n padding-left: ", ";\n }\n\n .", " {\n /* Override only top/bottom, but preserve left/right padding */\n padding-top: ", ";\n padding-bottom: ", ";\n }\n\n .dot-chip:first-child {\n margin-left: ", ";\n }\n\n .dot-text-field {\n .", " {\n height: ", ";\n }\n\n .warning-icon {\n color: ", ";\n }\n .error-icon {\n color: ", ";\n }\n }\n }\n "], ["\n &.", " {\n &.", " .dot-text-field .", " {\n height: 56px;\n padding-left: ", ";\n }\n\n .", " {\n /* Override only top/bottom, but preserve left/right padding */\n padding-top: ", ";\n padding-bottom: ", ";\n }\n\n .dot-chip:first-child {\n margin-left: ", ";\n }\n\n .dot-text-field {\n .", " {\n height: ", ";\n }\n\n .warning-icon {\n color: ", ";\n }\n .error-icon {\n color: ", ";\n }\n }\n }\n "])), rootClassName$F, inputMediumClassName, inputRootClassName, theme.spacing(2), inputRootClassName, theme.spacing(0), theme.spacing(0), theme.spacing(0), inputRootClassName, theme.spacing(5), theme.palette.warning.main, theme.palette.error.main);
4578
+ return styled.css(templateObject_1$I || (templateObject_1$I = __makeTemplateObject(["\n &.", " {\n &.", " .dot-text-field .", " {\n height: 56px;\n padding-left: ", ";\n }\n\n .", " {\n /* Override only top/bottom, but preserve left/right padding */\n padding-top: ", ";\n padding-bottom: ", ";\n }\n\n .dot-chip:first-child {\n margin-left: ", ";\n }\n\n .dot-text-field {\n .", " {\n min-height: ", ";\n }\n\n .warning-icon {\n color: ", ";\n }\n .error-icon {\n color: ", ";\n }\n }\n }\n "], ["\n &.", " {\n &.", " .dot-text-field .", " {\n height: 56px;\n padding-left: ", ";\n }\n\n .", " {\n /* Override only top/bottom, but preserve left/right padding */\n padding-top: ", ";\n padding-bottom: ", ";\n }\n\n .dot-chip:first-child {\n margin-left: ", ";\n }\n\n .dot-text-field {\n .", " {\n min-height: ", ";\n }\n\n .warning-icon {\n color: ", ";\n }\n .error-icon {\n color: ", ";\n }\n }\n }\n "])), rootClassName$F, inputMediumClassName, inputRootClassName, theme.spacing(2), inputRootClassName, theme.spacing(0), theme.spacing(0), theme.spacing(0), inputRootClassName, theme.spacing(5), theme.palette.warning.main, theme.palette.error.main);
4469
4579
  });
4470
4580
  var templateObject_1$I, templateObject_2$F;
4471
4581
 
@@ -4706,7 +4816,7 @@
4706
4816
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4707
4817
  var DotPopper = function DotPopper(props) {
4708
4818
  if (!isActionItemDefined) return jsxRuntime.jsx(StyledPopper, __assign({}, props, {
4709
- className: rootClassName$M,
4819
+ className: rootClassName$U,
4710
4820
  disablePortal: disablePortal,
4711
4821
  "$maxHeight": maxHeight
4712
4822
  }), void 0);
@@ -4730,7 +4840,7 @@
4730
4840
  var paperProps = props.children.props;
4731
4841
  var paperChildren = paperProps.children;
4732
4842
  return jsxRuntime.jsx(StyledPopper, __assign({}, props, {
4733
- className: rootClassName$M,
4843
+ className: rootClassName$U,
4734
4844
  disablePortal: disablePortal,
4735
4845
  "$maxHeight": maxHeight
4736
4846
  }, {
@@ -7487,13 +7597,12 @@
7487
7597
  var _j = React.useState(value),
7488
7598
  inputValue = _j[0],
7489
7599
  setInputValue = _j[1];
7490
- var isNotReadOnlyOrEditing = !readOnly && !editing;
7491
7600
  var inputRef = React.useRef();
7492
7601
  var inlineEditRef = React.useRef();
7493
7602
  var isSaveDisabled = checkIfEmptyValue(inputValue);
7494
7603
  var rootClasses = useStylesWithRootClass(rootClassName$m, className, editing ? editModeClassName : '');
7495
7604
  var handleShowTooltip = function handleShowTooltip(visible) {
7496
- if (isNotReadOnlyOrEditing) {
7605
+ if (!editing) {
7497
7606
  setShowTooltip(visible);
7498
7607
  }
7499
7608
  };
@@ -9665,7 +9774,7 @@
9665
9774
  onClickAway = _a.onClickAway,
9666
9775
  open = _a.open,
9667
9776
  placement = _a.placement;
9668
- var rootClasses = useStylesWithRootClass(rootClassName$M, className);
9777
+ var rootClasses = useStylesWithRootClass(rootClassName$U, className);
9669
9778
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
9670
9779
  var handleClickAway = function handleClickAway(event) {
9671
9780
  if (onClickAway && (!anchorEl || !anchorEl.contains(event.currentTarget))) {