@wso2/oxygen-ui 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AppSwitcher/AppSwitcher.d.ts +15 -1
- package/dist/components/AppSwitcher/AppSwitcherApp.d.ts +35 -4
- package/dist/components/AppSwitcher/AppSwitcherFooter.d.ts +14 -24
- package/dist/components/AppSwitcher/AppSwitcherSection.d.ts +27 -1
- package/dist/components/AppSwitcher/brand.d.ts +4 -3
- package/dist/components/AppSwitcher/context.d.ts +4 -0
- package/dist/components/AppSwitcher/index.d.ts +1 -1
- package/dist/components/AppSwitcher/url.d.ts +24 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/index.js +282 -160
- package/dist/index.js.map +4 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -472,7 +472,7 @@ var init_createOxygenTheme = __esm({
|
|
|
472
472
|
// package.json
|
|
473
473
|
var package_default = {
|
|
474
474
|
name: "@wso2/oxygen-ui",
|
|
475
|
-
version: "0.
|
|
475
|
+
version: "0.15.0",
|
|
476
476
|
description: "WSO2 Oxygen UI | Design System - Powered with Material-UI component library with TypeScript support",
|
|
477
477
|
type: "module",
|
|
478
478
|
main: "./dist/index.js",
|
|
@@ -3926,157 +3926,64 @@ var AppSwitcherTrigger = React14.forwardRef(
|
|
|
3926
3926
|
AppSwitcherTrigger.displayName = "AppSwitcher.Trigger";
|
|
3927
3927
|
|
|
3928
3928
|
// src/components/AppSwitcher/AppSwitcherSection.tsx
|
|
3929
|
-
import * as React15 from "react";
|
|
3930
|
-
import Box13 from "@mui/material/Box";
|
|
3931
|
-
import Typography8 from "@mui/material/Typography";
|
|
3932
|
-
import { styled as styled24 } from "@mui/material/styles";
|
|
3933
|
-
import { jsx as jsx37, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3934
|
-
var AppSwitcherSectionRoot = styled24(Box13, {
|
|
3935
|
-
name: "MuiAppSwitcher",
|
|
3936
|
-
slot: "Section"
|
|
3937
|
-
})(({ theme }) => ({
|
|
3938
|
-
padding: theme.spacing(2)
|
|
3939
|
-
}));
|
|
3940
|
-
var AppSwitcherSectionLabel = styled24(Typography8, {
|
|
3941
|
-
name: "MuiAppSwitcher",
|
|
3942
|
-
slot: "SectionLabel"
|
|
3943
|
-
})(({ theme }) => ({
|
|
3944
|
-
color: (theme.vars || theme).palette.text.secondary,
|
|
3945
|
-
fontSize: theme.typography.caption.fontSize,
|
|
3946
|
-
fontWeight: theme.typography.fontWeightBold,
|
|
3947
|
-
// Wide tracking so the headings read as quiet labels rather than as titles.
|
|
3948
|
-
letterSpacing: "0.1em",
|
|
3949
|
-
textTransform: "uppercase",
|
|
3950
|
-
marginBottom: theme.spacing(1.5)
|
|
3951
|
-
}));
|
|
3952
|
-
var AppSwitcherSectionGrid = styled24("ul", {
|
|
3953
|
-
name: "MuiAppSwitcher",
|
|
3954
|
-
slot: "SectionGrid",
|
|
3955
|
-
shouldForwardProp: (prop) => prop !== "ownerState"
|
|
3956
|
-
})(({ theme, ownerState }) => ({
|
|
3957
|
-
display: "grid",
|
|
3958
|
-
gap: theme.spacing(1.5),
|
|
3959
|
-
gridTemplateColumns: "1fr",
|
|
3960
|
-
listStyle: "none",
|
|
3961
|
-
margin: 0,
|
|
3962
|
-
padding: 0,
|
|
3963
|
-
[theme.breakpoints.up("sm")]: {
|
|
3964
|
-
gridTemplateColumns: `repeat(${ownerState.columns}, minmax(0, 1fr))`
|
|
3965
|
-
},
|
|
3966
|
-
"& > li": {
|
|
3967
|
-
display: "contents"
|
|
3968
|
-
}
|
|
3969
|
-
}));
|
|
3970
|
-
var AppSwitcherSection = ({
|
|
3971
|
-
children,
|
|
3972
|
-
label,
|
|
3973
|
-
columns = 3
|
|
3974
|
-
}) => {
|
|
3975
|
-
const labelId = React15.useId();
|
|
3976
|
-
const gridRef = React15.useRef(null);
|
|
3977
|
-
const handleKeyDown = (event) => {
|
|
3978
|
-
var _a, _b;
|
|
3979
|
-
const keys = ["ArrowRight", "ArrowLeft", "ArrowDown", "ArrowUp", "Home", "End"];
|
|
3980
|
-
if (!keys.includes(event.key)) {
|
|
3981
|
-
return;
|
|
3982
|
-
}
|
|
3983
|
-
const cards = Array.from(
|
|
3984
|
-
(_b = (_a = gridRef.current) == null ? void 0 : _a.querySelectorAll("[data-app-switcher-app]")) != null ? _b : []
|
|
3985
|
-
);
|
|
3986
|
-
if (cards.length === 0) {
|
|
3987
|
-
return;
|
|
3988
|
-
}
|
|
3989
|
-
const currentIndex = cards.indexOf(document.activeElement);
|
|
3990
|
-
if (currentIndex === -1) {
|
|
3991
|
-
return;
|
|
3992
|
-
}
|
|
3993
|
-
const firstTop = cards[0].getBoundingClientRect().top;
|
|
3994
|
-
const perRow = Math.max(
|
|
3995
|
-
1,
|
|
3996
|
-
cards.filter((card) => card.getBoundingClientRect().top === firstTop).length
|
|
3997
|
-
);
|
|
3998
|
-
let nextIndex = currentIndex;
|
|
3999
|
-
switch (event.key) {
|
|
4000
|
-
case "ArrowRight":
|
|
4001
|
-
nextIndex = currentIndex + 1;
|
|
4002
|
-
break;
|
|
4003
|
-
case "ArrowLeft":
|
|
4004
|
-
nextIndex = currentIndex - 1;
|
|
4005
|
-
break;
|
|
4006
|
-
case "ArrowDown":
|
|
4007
|
-
nextIndex = currentIndex + perRow;
|
|
4008
|
-
break;
|
|
4009
|
-
case "ArrowUp":
|
|
4010
|
-
nextIndex = currentIndex - perRow;
|
|
4011
|
-
break;
|
|
4012
|
-
case "Home":
|
|
4013
|
-
nextIndex = 0;
|
|
4014
|
-
break;
|
|
4015
|
-
case "End":
|
|
4016
|
-
nextIndex = cards.length - 1;
|
|
4017
|
-
break;
|
|
4018
|
-
default:
|
|
4019
|
-
break;
|
|
4020
|
-
}
|
|
4021
|
-
if (nextIndex < 0 || nextIndex >= cards.length) {
|
|
4022
|
-
return;
|
|
4023
|
-
}
|
|
4024
|
-
event.preventDefault();
|
|
4025
|
-
cards[nextIndex].focus();
|
|
4026
|
-
};
|
|
4027
|
-
return /* @__PURE__ */ jsxs11(AppSwitcherSectionRoot, { children: [
|
|
4028
|
-
label && /* @__PURE__ */ jsx37(AppSwitcherSectionLabel, { id: labelId, children: label }),
|
|
4029
|
-
/* @__PURE__ */ jsx37(
|
|
4030
|
-
AppSwitcherSectionGrid,
|
|
4031
|
-
{
|
|
4032
|
-
ref: gridRef,
|
|
4033
|
-
ownerState: { columns },
|
|
4034
|
-
role: "list",
|
|
4035
|
-
"aria-labelledby": label ? labelId : void 0,
|
|
4036
|
-
onKeyDown: handleKeyDown,
|
|
4037
|
-
children: React15.Children.map(
|
|
4038
|
-
children,
|
|
4039
|
-
(child) => React15.isValidElement(child) ? /* @__PURE__ */ jsx37("li", { children: child }) : child
|
|
4040
|
-
)
|
|
4041
|
-
}
|
|
4042
|
-
)
|
|
4043
|
-
] });
|
|
4044
|
-
};
|
|
4045
|
-
AppSwitcherSection.displayName = "AppSwitcher.Section";
|
|
4046
|
-
|
|
4047
|
-
// src/components/AppSwitcher/AppSwitcherApp.tsx
|
|
4048
3929
|
import * as React16 from "react";
|
|
4049
3930
|
import Box14 from "@mui/material/Box";
|
|
3931
|
+
import Skeleton from "@mui/material/Skeleton";
|
|
3932
|
+
import Typography9 from "@mui/material/Typography";
|
|
3933
|
+
import { styled as styled25 } from "@mui/material/styles";
|
|
3934
|
+
|
|
3935
|
+
// src/components/AppSwitcher/AppSwitcherApp.tsx
|
|
3936
|
+
import * as React15 from "react";
|
|
3937
|
+
import Box13 from "@mui/material/Box";
|
|
4050
3938
|
import Card2 from "@mui/material/Card";
|
|
4051
3939
|
import ButtonBase2 from "@mui/material/ButtonBase";
|
|
3940
|
+
import CircularProgress from "@mui/material/CircularProgress";
|
|
4052
3941
|
import Tooltip4 from "@mui/material/Tooltip";
|
|
4053
|
-
import
|
|
4054
|
-
import { styled as
|
|
3942
|
+
import Typography8 from "@mui/material/Typography";
|
|
3943
|
+
import { styled as styled24 } from "@mui/material/styles";
|
|
4055
3944
|
|
|
4056
3945
|
// src/components/AppSwitcher/brand.ts
|
|
4057
3946
|
var APP_SWITCHER_BRAND = {
|
|
4058
3947
|
/** Full-strength WSO2 orange. Decorative surfaces only. */
|
|
4059
3948
|
main: "#FF7300",
|
|
4060
3949
|
/**
|
|
4061
|
-
* Darker orange reserved for the focus ring
|
|
4062
|
-
* surface is required. Do not swap it back to
|
|
3950
|
+
* Darker orange reserved for the focus ring and the current app's border,
|
|
3951
|
+
* where 3:1 against the card surface is required. Do not swap it back to
|
|
3952
|
+
* `main`.
|
|
4063
3953
|
*/
|
|
4064
3954
|
focus: "#E56800",
|
|
4065
3955
|
/** Faded orange for the mark of a platform that is not yet available. */
|
|
4066
3956
|
surfaceMark: "#FFC199"
|
|
4067
3957
|
};
|
|
4068
3958
|
|
|
3959
|
+
// src/components/AppSwitcher/url.ts
|
|
3960
|
+
var SAFE_PROTOCOLS = /* @__PURE__ */ new Set(["http:", "https:"]);
|
|
3961
|
+
var RELATIVE_BASE = "http://relative.invalid";
|
|
3962
|
+
var isSafeAppUrl = (url) => {
|
|
3963
|
+
try {
|
|
3964
|
+
return SAFE_PROTOCOLS.has(new URL(url, RELATIVE_BASE).protocol);
|
|
3965
|
+
} catch (e) {
|
|
3966
|
+
return false;
|
|
3967
|
+
}
|
|
3968
|
+
};
|
|
3969
|
+
|
|
4069
3970
|
// src/components/AppSwitcher/AppSwitcherApp.tsx
|
|
4070
3971
|
import { WSO2 } from "@wso2/oxygen-ui-icons-react";
|
|
4071
|
-
import { jsx as
|
|
4072
|
-
var
|
|
3972
|
+
import { jsx as jsx37, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3973
|
+
var DEFAULT_UNAVAILABLE_LABEL = "Coming soon";
|
|
3974
|
+
var APP_CARD_HEIGHT = {
|
|
3975
|
+
platform: 13,
|
|
3976
|
+
manage: 9
|
|
3977
|
+
};
|
|
3978
|
+
var AppSwitcherAppRoot = styled24(Card2, {
|
|
4073
3979
|
name: "MuiAppSwitcher",
|
|
4074
3980
|
slot: "App",
|
|
4075
3981
|
shouldForwardProp: (prop) => prop !== "ownerState"
|
|
4076
3982
|
})(({ theme, ownerState }) => {
|
|
4077
3983
|
const accent = APP_SWITCHER_BRAND.main;
|
|
4078
3984
|
const manage = ownerState.tone === "manage";
|
|
4079
|
-
|
|
3985
|
+
const interactive = !ownerState.disabled && !ownerState.busy;
|
|
3986
|
+
return __spreadProps(__spreadValues(__spreadValues(__spreadValues({
|
|
4080
3987
|
display: "flex",
|
|
4081
3988
|
flexDirection: "column",
|
|
4082
3989
|
alignItems: "center",
|
|
@@ -4089,7 +3996,7 @@ var AppSwitcherAppRoot = styled25(Card2, {
|
|
|
4089
3996
|
// A fixed height rather than a floor, so every card in the switcher is the
|
|
4090
3997
|
// same size whether its name runs to one line or two. The name itself is
|
|
4091
3998
|
// clamped to two lines, so nothing can outgrow the box.
|
|
4092
|
-
height: theme.spacing(
|
|
3999
|
+
height: theme.spacing(APP_CARD_HEIGHT[ownerState.tone]),
|
|
4093
4000
|
padding: manage ? theme.spacing(1, 1) : theme.spacing(1.25, 1),
|
|
4094
4001
|
textAlign: "center",
|
|
4095
4002
|
// A navigable card renders as an `<a>`, which underlines its text by
|
|
@@ -4110,9 +4017,16 @@ var AppSwitcherAppRoot = styled25(Card2, {
|
|
|
4110
4017
|
borderColor: (theme.vars || theme).palette.divider,
|
|
4111
4018
|
backgroundColor: (theme.vars || theme).palette.action.hover
|
|
4112
4019
|
}
|
|
4020
|
+
}), ownerState.current && {
|
|
4021
|
+
"&.MuiCard-root": {
|
|
4022
|
+
borderColor: APP_SWITCHER_BRAND.focus
|
|
4023
|
+
}
|
|
4024
|
+
}), ownerState.busy && {
|
|
4025
|
+
cursor: "progress"
|
|
4113
4026
|
}), {
|
|
4114
|
-
"&:hover": __spreadValues({},
|
|
4115
|
-
|
|
4027
|
+
"&:hover": __spreadValues({}, interactive && {
|
|
4028
|
+
// Keep the current border on hover; `accent` would lower its contrast.
|
|
4029
|
+
borderColor: ownerState.current ? APP_SWITCHER_BRAND.focus : accent,
|
|
4116
4030
|
boxShadow: theme.shadows[2],
|
|
4117
4031
|
transform: "translateY(-2px)"
|
|
4118
4032
|
}),
|
|
@@ -4133,7 +4047,7 @@ var AppSwitcherAppRoot = styled25(Card2, {
|
|
|
4133
4047
|
}
|
|
4134
4048
|
});
|
|
4135
4049
|
});
|
|
4136
|
-
var AppSwitcherAppIcon =
|
|
4050
|
+
var AppSwitcherAppIcon = styled24(Box13, {
|
|
4137
4051
|
name: "MuiAppSwitcher",
|
|
4138
4052
|
slot: "AppIcon",
|
|
4139
4053
|
shouldForwardProp: (prop) => prop !== "ownerState"
|
|
@@ -4161,7 +4075,7 @@ var AppSwitcherAppIcon = styled25(Box14, {
|
|
|
4161
4075
|
}
|
|
4162
4076
|
});
|
|
4163
4077
|
});
|
|
4164
|
-
var AppSwitcherAppName =
|
|
4078
|
+
var AppSwitcherAppName = styled24(Typography8, {
|
|
4165
4079
|
name: "MuiAppSwitcher",
|
|
4166
4080
|
slot: "AppName",
|
|
4167
4081
|
shouldForwardProp: (prop) => prop !== "ownerState"
|
|
@@ -4185,40 +4099,66 @@ var AppSwitcherAppName = styled25(Typography9, {
|
|
|
4185
4099
|
WebkitLineClamp: ownerState.tone === "manage" ? 1 : 2,
|
|
4186
4100
|
overflow: "hidden"
|
|
4187
4101
|
}));
|
|
4188
|
-
var
|
|
4102
|
+
var isModifiedClick = (event) => event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;
|
|
4103
|
+
var AppSwitcherApp = React15.forwardRef(
|
|
4189
4104
|
function AppSwitcherApp2({
|
|
4105
|
+
id,
|
|
4190
4106
|
name,
|
|
4191
4107
|
url,
|
|
4192
4108
|
icon,
|
|
4193
4109
|
tone: toneProp,
|
|
4194
|
-
disabled = false,
|
|
4195
|
-
tooltip,
|
|
4110
|
+
disabled: disabledProp = false,
|
|
4111
|
+
tooltip: tooltipProp,
|
|
4196
4112
|
component,
|
|
4197
4113
|
componentProps,
|
|
4198
|
-
target
|
|
4114
|
+
target: targetProp,
|
|
4115
|
+
current: currentProp,
|
|
4116
|
+
busy = false,
|
|
4199
4117
|
onClick
|
|
4200
4118
|
}, ref) {
|
|
4201
|
-
|
|
4119
|
+
var _a;
|
|
4120
|
+
const inFooter = React15.useContext(AppSwitcherFooterContext);
|
|
4202
4121
|
const tone = toneProp != null ? toneProp : inFooter ? "manage" : "platform";
|
|
4122
|
+
const switcher = React15.useContext(AppSwitcherContext);
|
|
4123
|
+
const current = currentProp != null ? currentProp : id !== void 0 && id === (switcher == null ? void 0 : switcher.currentAppId);
|
|
4124
|
+
const normalizedUrl = typeof url === "string" && url.trim() === "" ? null : url;
|
|
4125
|
+
const unsafeUrl = Boolean(normalizedUrl) && !isSafeAppUrl(normalizedUrl);
|
|
4126
|
+
const safeUrl = unsafeUrl ? void 0 : normalizedUrl || void 0;
|
|
4127
|
+
React15.useEffect(() => {
|
|
4128
|
+
if (unsafeUrl) {
|
|
4129
|
+
console.warn(
|
|
4130
|
+
`AppSwitcher.App: ignored the url of "${name}" because only http:, https: and relative URLs are allowed. The card renders disabled.`
|
|
4131
|
+
);
|
|
4132
|
+
}
|
|
4133
|
+
}, [unsafeUrl, name]);
|
|
4134
|
+
const unavailable = normalizedUrl === null && !onClick && !component;
|
|
4135
|
+
const disabled = disabledProp || unavailable || unsafeUrl;
|
|
4136
|
+
const tooltip = tooltipProp != null ? tooltipProp : unavailable ? (_a = switcher == null ? void 0 : switcher.unavailableLabel) != null ? _a : DEFAULT_UNAVAILABLE_LABEL : void 0;
|
|
4137
|
+
const target = targetProp != null ? targetProp : current ? "_self" : "_blank";
|
|
4138
|
+
const effectiveTarget = typeof (componentProps == null ? void 0 : componentProps.target) === "string" ? componentProps.target : target;
|
|
4203
4139
|
const handleClick = (event) => {
|
|
4204
|
-
if (disabled) {
|
|
4140
|
+
if (disabled || busy) {
|
|
4205
4141
|
event.preventDefault();
|
|
4206
4142
|
return;
|
|
4207
4143
|
}
|
|
4208
4144
|
onClick == null ? void 0 : onClick(event);
|
|
4145
|
+
if (current && effectiveTarget !== "_blank" && !isModifiedClick(event)) {
|
|
4146
|
+
switcher == null ? void 0 : switcher.handleClose();
|
|
4147
|
+
}
|
|
4209
4148
|
};
|
|
4210
|
-
const ownerState = { disabled, tone };
|
|
4211
|
-
const
|
|
4212
|
-
const
|
|
4213
|
-
const
|
|
4149
|
+
const ownerState = { disabled, tone, current, busy };
|
|
4150
|
+
const markSize = tone === "manage" ? 16 : 32;
|
|
4151
|
+
const canNavigate = !disabled && !busy;
|
|
4152
|
+
const renderAsLink = Boolean(safeUrl) && canNavigate;
|
|
4153
|
+
const linkProps = __spreadValues(__spreadValues({}, safeUrl && { href: safeUrl }), effectiveTarget && { target: effectiveTarget });
|
|
4214
4154
|
const relProps = effectiveTarget === "_blank" ? { rel: "noopener noreferrer" } : {};
|
|
4215
|
-
const anchorProps = component &&
|
|
4155
|
+
const anchorProps = component && canNavigate ? __spreadValues(__spreadValues(__spreadValues({ component }, componentProps), linkProps), relProps) : renderAsLink ? __spreadValues(__spreadValues({ component: "a" }, linkProps), relProps) : { component: ButtonBase2 };
|
|
4216
4156
|
const handleKeyDown = (event) => {
|
|
4217
|
-
if (disabled && (event.key === "Enter" || event.key === " ")) {
|
|
4157
|
+
if ((disabled || busy) && (event.key === "Enter" || event.key === " ")) {
|
|
4218
4158
|
event.preventDefault();
|
|
4219
4159
|
}
|
|
4220
4160
|
};
|
|
4221
|
-
const card = /* @__PURE__ */
|
|
4161
|
+
const card = /* @__PURE__ */ jsxs11(
|
|
4222
4162
|
AppSwitcherAppRoot,
|
|
4223
4163
|
__spreadProps(__spreadValues({}, anchorProps), {
|
|
4224
4164
|
ref,
|
|
@@ -4228,17 +4168,176 @@ var AppSwitcherApp = React16.forwardRef(
|
|
|
4228
4168
|
onKeyDown: handleKeyDown,
|
|
4229
4169
|
"data-app-switcher-app": "",
|
|
4230
4170
|
"aria-disabled": disabled ? "true" : void 0,
|
|
4171
|
+
"aria-busy": busy ? "true" : void 0,
|
|
4172
|
+
"aria-current": current ? "page" : void 0,
|
|
4231
4173
|
children: [
|
|
4232
|
-
/* @__PURE__ */
|
|
4233
|
-
|
|
4174
|
+
/* @__PURE__ */ jsx37(AppSwitcherAppIcon, { ownerState, "aria-hidden": "true", children: busy ? (
|
|
4175
|
+
// Same size as the mark, so the card does not reflow.
|
|
4176
|
+
/* @__PURE__ */ jsx37(CircularProgress, { color: "inherit", size: markSize, thickness: 5 })
|
|
4177
|
+
) : icon != null ? icon : /* @__PURE__ */ jsx37(WSO2, { size: markSize }) }),
|
|
4178
|
+
/* @__PURE__ */ jsx37(AppSwitcherAppName, { ownerState, children: name })
|
|
4234
4179
|
]
|
|
4235
4180
|
})
|
|
4236
4181
|
);
|
|
4237
|
-
return tooltip ? /* @__PURE__ */
|
|
4182
|
+
return tooltip ? /* @__PURE__ */ jsx37(Tooltip4, { title: tooltip, describeChild: true, children: card }) : card;
|
|
4238
4183
|
}
|
|
4239
4184
|
);
|
|
4240
4185
|
AppSwitcherApp.displayName = "AppSwitcher.App";
|
|
4241
4186
|
|
|
4187
|
+
// src/components/AppSwitcher/AppSwitcherSection.tsx
|
|
4188
|
+
import { jsx as jsx38, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4189
|
+
var AppSwitcherSectionRoot = styled25(Box14, {
|
|
4190
|
+
name: "MuiAppSwitcher",
|
|
4191
|
+
slot: "Section"
|
|
4192
|
+
})(({ theme }) => ({
|
|
4193
|
+
padding: theme.spacing(2)
|
|
4194
|
+
}));
|
|
4195
|
+
var AppSwitcherSectionLabel = styled25(Typography9, {
|
|
4196
|
+
name: "MuiAppSwitcher",
|
|
4197
|
+
slot: "SectionLabel"
|
|
4198
|
+
})(({ theme }) => ({
|
|
4199
|
+
color: (theme.vars || theme).palette.text.secondary,
|
|
4200
|
+
fontSize: theme.typography.caption.fontSize,
|
|
4201
|
+
fontWeight: theme.typography.fontWeightBold,
|
|
4202
|
+
// Wide tracking so the headings read as quiet labels rather than as titles.
|
|
4203
|
+
letterSpacing: "0.1em",
|
|
4204
|
+
textTransform: "uppercase",
|
|
4205
|
+
marginBottom: theme.spacing(1.5)
|
|
4206
|
+
}));
|
|
4207
|
+
var AppSwitcherSectionGrid = styled25("ul", {
|
|
4208
|
+
name: "MuiAppSwitcher",
|
|
4209
|
+
slot: "SectionGrid",
|
|
4210
|
+
shouldForwardProp: (prop) => prop !== "ownerState"
|
|
4211
|
+
})(({ theme, ownerState }) => ({
|
|
4212
|
+
display: "grid",
|
|
4213
|
+
gap: theme.spacing(1.5),
|
|
4214
|
+
gridTemplateColumns: "1fr",
|
|
4215
|
+
listStyle: "none",
|
|
4216
|
+
margin: 0,
|
|
4217
|
+
padding: 0,
|
|
4218
|
+
[theme.breakpoints.up("sm")]: {
|
|
4219
|
+
gridTemplateColumns: `repeat(${ownerState.columns}, minmax(0, 1fr))`
|
|
4220
|
+
},
|
|
4221
|
+
"& > li": {
|
|
4222
|
+
display: "contents"
|
|
4223
|
+
}
|
|
4224
|
+
}));
|
|
4225
|
+
var AppSwitcherAppSkeleton = styled25(Skeleton, {
|
|
4226
|
+
name: "MuiAppSwitcher",
|
|
4227
|
+
slot: "AppSkeleton",
|
|
4228
|
+
shouldForwardProp: (prop) => prop !== "ownerState"
|
|
4229
|
+
})(({ theme, ownerState }) => ({
|
|
4230
|
+
width: "100%",
|
|
4231
|
+
height: theme.spacing(APP_CARD_HEIGHT[ownerState.tone]),
|
|
4232
|
+
// The pulse is decoration; the placeholder alone signals loading.
|
|
4233
|
+
"@media (prefers-reduced-motion: reduce)": {
|
|
4234
|
+
animation: "none"
|
|
4235
|
+
}
|
|
4236
|
+
}));
|
|
4237
|
+
var renderAppItems = (items, { missingUrlIsUnavailable }) => items.map((_a, index) => {
|
|
4238
|
+
var _b = _a, { key, url } = _b, item = __objRest(_b, ["key", "url"]);
|
|
4239
|
+
var _a2, _b2;
|
|
4240
|
+
return /* @__PURE__ */ jsx38(
|
|
4241
|
+
AppSwitcherApp,
|
|
4242
|
+
__spreadProps(__spreadValues({}, item), {
|
|
4243
|
+
url: url === void 0 && missingUrlIsUnavailable ? null : url
|
|
4244
|
+
}),
|
|
4245
|
+
(_b2 = (_a2 = item.id) != null ? _a2 : key) != null ? _b2 : index
|
|
4246
|
+
);
|
|
4247
|
+
});
|
|
4248
|
+
var AppSwitcherSection = ({
|
|
4249
|
+
children,
|
|
4250
|
+
apps,
|
|
4251
|
+
label,
|
|
4252
|
+
columns = 3,
|
|
4253
|
+
loading = false,
|
|
4254
|
+
loadingCount
|
|
4255
|
+
}) => {
|
|
4256
|
+
const labelId = React16.useId();
|
|
4257
|
+
const inFooter = React16.useContext(AppSwitcherFooterContext);
|
|
4258
|
+
const tone = inFooter ? "manage" : "platform";
|
|
4259
|
+
const gridRef = React16.useRef(null);
|
|
4260
|
+
const handleKeyDown = (event) => {
|
|
4261
|
+
var _a, _b;
|
|
4262
|
+
const keys = ["ArrowRight", "ArrowLeft", "ArrowDown", "ArrowUp", "Home", "End"];
|
|
4263
|
+
if (!keys.includes(event.key)) {
|
|
4264
|
+
return;
|
|
4265
|
+
}
|
|
4266
|
+
const cards = Array.from(
|
|
4267
|
+
(_b = (_a = gridRef.current) == null ? void 0 : _a.querySelectorAll("[data-app-switcher-app]")) != null ? _b : []
|
|
4268
|
+
);
|
|
4269
|
+
if (cards.length === 0) {
|
|
4270
|
+
return;
|
|
4271
|
+
}
|
|
4272
|
+
const currentIndex = cards.indexOf(document.activeElement);
|
|
4273
|
+
if (currentIndex === -1) {
|
|
4274
|
+
return;
|
|
4275
|
+
}
|
|
4276
|
+
const firstTop = cards[0].getBoundingClientRect().top;
|
|
4277
|
+
const perRow = Math.max(
|
|
4278
|
+
1,
|
|
4279
|
+
cards.filter((card) => card.getBoundingClientRect().top === firstTop).length
|
|
4280
|
+
);
|
|
4281
|
+
let nextIndex = currentIndex;
|
|
4282
|
+
switch (event.key) {
|
|
4283
|
+
case "ArrowRight":
|
|
4284
|
+
nextIndex = currentIndex + 1;
|
|
4285
|
+
break;
|
|
4286
|
+
case "ArrowLeft":
|
|
4287
|
+
nextIndex = currentIndex - 1;
|
|
4288
|
+
break;
|
|
4289
|
+
case "ArrowDown":
|
|
4290
|
+
nextIndex = currentIndex + perRow;
|
|
4291
|
+
break;
|
|
4292
|
+
case "ArrowUp":
|
|
4293
|
+
nextIndex = currentIndex - perRow;
|
|
4294
|
+
break;
|
|
4295
|
+
case "Home":
|
|
4296
|
+
nextIndex = 0;
|
|
4297
|
+
break;
|
|
4298
|
+
case "End":
|
|
4299
|
+
nextIndex = cards.length - 1;
|
|
4300
|
+
break;
|
|
4301
|
+
default:
|
|
4302
|
+
break;
|
|
4303
|
+
}
|
|
4304
|
+
if (nextIndex < 0 || nextIndex >= cards.length) {
|
|
4305
|
+
return;
|
|
4306
|
+
}
|
|
4307
|
+
event.preventDefault();
|
|
4308
|
+
cards[nextIndex].focus();
|
|
4309
|
+
};
|
|
4310
|
+
const content = loading ? Array.from({ length: loadingCount != null ? loadingCount : columns }, (_, index) => /* @__PURE__ */ jsx38(
|
|
4311
|
+
AppSwitcherAppSkeleton,
|
|
4312
|
+
{
|
|
4313
|
+
ownerState: { tone },
|
|
4314
|
+
variant: "rounded",
|
|
4315
|
+
"aria-hidden": "true",
|
|
4316
|
+
"data-app-switcher-skeleton": ""
|
|
4317
|
+
},
|
|
4318
|
+
index
|
|
4319
|
+
)) : children != null ? children : apps && renderAppItems(apps, { missingUrlIsUnavailable: true });
|
|
4320
|
+
return /* @__PURE__ */ jsxs12(AppSwitcherSectionRoot, { children: [
|
|
4321
|
+
label && /* @__PURE__ */ jsx38(AppSwitcherSectionLabel, { id: labelId, children: label }),
|
|
4322
|
+
/* @__PURE__ */ jsx38(
|
|
4323
|
+
AppSwitcherSectionGrid,
|
|
4324
|
+
{
|
|
4325
|
+
ref: gridRef,
|
|
4326
|
+
ownerState: { columns },
|
|
4327
|
+
role: "list",
|
|
4328
|
+
"aria-labelledby": label ? labelId : void 0,
|
|
4329
|
+
"aria-busy": loading ? "true" : void 0,
|
|
4330
|
+
onKeyDown: handleKeyDown,
|
|
4331
|
+
children: React16.Children.map(
|
|
4332
|
+
content,
|
|
4333
|
+
(child) => React16.isValidElement(child) ? /* @__PURE__ */ jsx38("li", { children: child }) : child
|
|
4334
|
+
)
|
|
4335
|
+
}
|
|
4336
|
+
)
|
|
4337
|
+
] });
|
|
4338
|
+
};
|
|
4339
|
+
AppSwitcherSection.displayName = "AppSwitcher.Section";
|
|
4340
|
+
|
|
4242
4341
|
// src/components/AppSwitcher/AppSwitcherFooter.tsx
|
|
4243
4342
|
import * as React17 from "react";
|
|
4244
4343
|
import Box15 from "@mui/material/Box";
|
|
@@ -4258,16 +4357,24 @@ var AppSwitcherFooter = ({
|
|
|
4258
4357
|
children,
|
|
4259
4358
|
links,
|
|
4260
4359
|
label = "Manage",
|
|
4261
|
-
columns = 3
|
|
4360
|
+
columns = 3,
|
|
4361
|
+
loading = false,
|
|
4362
|
+
loadingCount
|
|
4262
4363
|
}) => {
|
|
4263
|
-
const cards = children != null ? children : links
|
|
4264
|
-
|
|
4265
|
-
return /* @__PURE__ */ jsx39(AppSwitcherApp, __spreadValues({}, link), key);
|
|
4266
|
-
});
|
|
4267
|
-
if (React17.Children.toArray(cards).length === 0) {
|
|
4364
|
+
const cards = children != null ? children : links && renderAppItems(links, { missingUrlIsUnavailable: false });
|
|
4365
|
+
if (!loading && React17.Children.toArray(cards).length === 0) {
|
|
4268
4366
|
return null;
|
|
4269
4367
|
}
|
|
4270
|
-
return /* @__PURE__ */ jsx39(AppSwitcherFooterRoot, { children: /* @__PURE__ */ jsx39(AppSwitcherFooterContext.Provider, { value: true, children: /* @__PURE__ */ jsx39(
|
|
4368
|
+
return /* @__PURE__ */ jsx39(AppSwitcherFooterRoot, { children: /* @__PURE__ */ jsx39(AppSwitcherFooterContext.Provider, { value: true, children: /* @__PURE__ */ jsx39(
|
|
4369
|
+
AppSwitcherSection,
|
|
4370
|
+
{
|
|
4371
|
+
label,
|
|
4372
|
+
columns,
|
|
4373
|
+
loading,
|
|
4374
|
+
loadingCount,
|
|
4375
|
+
children: cards
|
|
4376
|
+
}
|
|
4377
|
+
) }) });
|
|
4271
4378
|
};
|
|
4272
4379
|
AppSwitcherFooter.displayName = "AppSwitcher.Footer";
|
|
4273
4380
|
|
|
@@ -4288,7 +4395,14 @@ var AppSwitcherRoot = styled27(Popover2, {
|
|
|
4288
4395
|
}
|
|
4289
4396
|
}
|
|
4290
4397
|
}));
|
|
4291
|
-
var AppSwitcher = ({
|
|
4398
|
+
var AppSwitcher = ({
|
|
4399
|
+
children,
|
|
4400
|
+
width = 460,
|
|
4401
|
+
"aria-label": ariaLabelProp,
|
|
4402
|
+
sx,
|
|
4403
|
+
currentAppId,
|
|
4404
|
+
unavailableLabel
|
|
4405
|
+
}) => {
|
|
4292
4406
|
const [anchorEl, setAnchorEl] = React18.useState(null);
|
|
4293
4407
|
const open = Boolean(anchorEl);
|
|
4294
4408
|
const popoverId = React18.useId();
|
|
@@ -4301,8 +4415,16 @@ var AppSwitcher = ({ children, width = 460, "aria-label": ariaLabelProp, sx }) =
|
|
|
4301
4415
|
}, []);
|
|
4302
4416
|
const ariaLabel = typeof ariaLabelProp === "string" && ariaLabelProp.trim().length > 0 ? ariaLabelProp : "Applications";
|
|
4303
4417
|
const contextValue = React18.useMemo(
|
|
4304
|
-
() => ({
|
|
4305
|
-
|
|
4418
|
+
() => ({
|
|
4419
|
+
open,
|
|
4420
|
+
anchorEl,
|
|
4421
|
+
popoverId,
|
|
4422
|
+
handleOpen,
|
|
4423
|
+
handleClose,
|
|
4424
|
+
currentAppId,
|
|
4425
|
+
unavailableLabel
|
|
4426
|
+
}),
|
|
4427
|
+
[open, anchorEl, popoverId, handleOpen, handleClose, currentAppId, unavailableLabel]
|
|
4306
4428
|
);
|
|
4307
4429
|
const childrenArray = React18.Children.toArray(children);
|
|
4308
4430
|
const triggerChild = childrenArray.find(
|
|
@@ -7980,7 +8102,7 @@ var ListingTableCompound = Object.assign(ListingTable, {
|
|
|
7980
8102
|
var ListingTable_default = ListingTableCompound;
|
|
7981
8103
|
|
|
7982
8104
|
// src/animations/ParticleBackground/ParticleBackground.tsx
|
|
7983
|
-
import { useEffect as
|
|
8105
|
+
import { useEffect as useEffect8, useRef as useRef4 } from "react";
|
|
7984
8106
|
import { useColorScheme as useColorScheme4 } from "@mui/material/styles";
|
|
7985
8107
|
import { jsx as jsx115 } from "react/jsx-runtime";
|
|
7986
8108
|
var ParticleBackground = ({
|
|
@@ -7996,7 +8118,7 @@ var ParticleBackground = ({
|
|
|
7996
8118
|
}) => {
|
|
7997
8119
|
const canvasRef = useRef4(null);
|
|
7998
8120
|
const { mode } = useColorScheme4();
|
|
7999
|
-
|
|
8121
|
+
useEffect8(() => {
|
|
8000
8122
|
const canvas = canvasRef.current;
|
|
8001
8123
|
if (!canvas) return;
|
|
8002
8124
|
const ctx = canvas.getContext("2d", { alpha: true });
|