@wso2/oxygen-ui 0.5.0 → 0.6.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/.ai/AGENTS.md +17 -15
- package/.ai/components.md +706 -73
- package/.ai/migration.md +4 -2
- package/.ai/patterns.md +20 -8
- package/.ai/theming.md +15 -2
- package/.claude/components.md +706 -73
- package/.claude/migration.md +4 -2
- package/.claude/patterns.md +20 -8
- package/.claude/skills/oxygen-component/SKILL.md +12 -6
- package/.claude/skills/oxygen-migrate/SKILL.md +5 -2
- package/.claude/skills/oxygen-sync/SKILL.md +157 -0
- package/.claude/theming.md +15 -2
- package/bin/cli.js +32 -19
- package/dist/index.js +121 -101
- package/dist/index.js.map +3 -3
- package/dist/utils/pxToRem.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -130,7 +130,7 @@ var __objRest = (source, exclude) => {
|
|
|
130
130
|
// package.json
|
|
131
131
|
var package_default = {
|
|
132
132
|
name: "@wso2/oxygen-ui",
|
|
133
|
-
version: "0.
|
|
133
|
+
version: "0.6.0",
|
|
134
134
|
description: "WSO2 Oxygen UI | Design System - Powered with Material-UI component library with TypeScript support",
|
|
135
135
|
type: "module",
|
|
136
136
|
main: "./dist/index.js",
|
|
@@ -274,56 +274,66 @@ function formatRelativeTime(date) {
|
|
|
274
274
|
}
|
|
275
275
|
|
|
276
276
|
// src/utils/pxToRem.ts
|
|
277
|
-
var pxToRem = (size) => `${size /
|
|
277
|
+
var pxToRem = (size) => `${size / 16}rem`;
|
|
278
278
|
|
|
279
279
|
// src/styles/Themes/OxygenThemeBase.ts
|
|
280
|
+
var OxygenUIPrimitives = {
|
|
281
|
+
fontSize: 14,
|
|
282
|
+
primaryColor: "#ff7300",
|
|
283
|
+
secondaryColor: "#757575"
|
|
284
|
+
};
|
|
280
285
|
var OxygenThemeBase = extendTheme({
|
|
281
286
|
cssVarPrefix: "oxygen",
|
|
282
287
|
colorSchemeSelector: "data-color-scheme",
|
|
283
288
|
typography: {
|
|
284
289
|
fontFamily: "'Inter Variable', sans-serif",
|
|
285
290
|
fontWeightRegular: 400,
|
|
286
|
-
fontSize:
|
|
291
|
+
fontSize: OxygenUIPrimitives.fontSize,
|
|
287
292
|
h1: {
|
|
288
|
-
fontSize: pxToRem(
|
|
293
|
+
fontSize: pxToRem(OxygenUIPrimitives.fontSize + 14),
|
|
289
294
|
fontWeight: 400
|
|
290
295
|
},
|
|
291
296
|
h2: {
|
|
292
|
-
fontSize: pxToRem(
|
|
297
|
+
fontSize: pxToRem(OxygenUIPrimitives.fontSize + 10),
|
|
293
298
|
fontWeight: 400
|
|
294
299
|
},
|
|
295
300
|
h3: {
|
|
296
|
-
fontSize: pxToRem(
|
|
301
|
+
fontSize: pxToRem(OxygenUIPrimitives.fontSize + 8),
|
|
297
302
|
fontWeight: 400
|
|
298
303
|
},
|
|
299
304
|
h4: {
|
|
300
|
-
fontSize: pxToRem(
|
|
305
|
+
fontSize: pxToRem(OxygenUIPrimitives.fontSize + 6),
|
|
301
306
|
fontWeight: 400
|
|
302
307
|
},
|
|
303
308
|
h5: {
|
|
304
|
-
fontSize: pxToRem(
|
|
309
|
+
fontSize: pxToRem(OxygenUIPrimitives.fontSize + 2),
|
|
305
310
|
fontWeight: 400
|
|
306
311
|
},
|
|
307
312
|
h6: {
|
|
308
|
-
fontSize: pxToRem(
|
|
313
|
+
fontSize: pxToRem(OxygenUIPrimitives.fontSize),
|
|
309
314
|
fontWeight: 500
|
|
310
315
|
},
|
|
311
316
|
subtitle1: {
|
|
312
|
-
fontSize: pxToRem(
|
|
317
|
+
fontSize: pxToRem(OxygenUIPrimitives.fontSize + 4)
|
|
313
318
|
},
|
|
314
319
|
subtitle2: {
|
|
315
|
-
fontSize: pxToRem(
|
|
320
|
+
fontSize: pxToRem(OxygenUIPrimitives.fontSize),
|
|
316
321
|
fontWeight: 400
|
|
317
322
|
},
|
|
318
323
|
body1: {
|
|
319
|
-
fontSize: pxToRem(
|
|
324
|
+
fontSize: pxToRem(OxygenUIPrimitives.fontSize)
|
|
320
325
|
},
|
|
321
326
|
body2: {
|
|
322
|
-
fontSize: pxToRem(
|
|
327
|
+
fontSize: pxToRem(OxygenUIPrimitives.fontSize - 1),
|
|
328
|
+
// Will use by the labels in the components
|
|
323
329
|
fontWeight: 400
|
|
324
330
|
},
|
|
331
|
+
button: {
|
|
332
|
+
fontSize: pxToRem(OxygenUIPrimitives.fontSize),
|
|
333
|
+
fontWeight: 500
|
|
334
|
+
},
|
|
325
335
|
caption: {
|
|
326
|
-
fontSize: pxToRem(
|
|
336
|
+
fontSize: pxToRem(OxygenUIPrimitives.fontSize - 3),
|
|
327
337
|
fontWeight: 400
|
|
328
338
|
}
|
|
329
339
|
},
|
|
@@ -332,11 +342,11 @@ var OxygenThemeBase = extendTheme({
|
|
|
332
342
|
light: {
|
|
333
343
|
palette: {
|
|
334
344
|
primary: {
|
|
335
|
-
main:
|
|
345
|
+
main: OxygenUIPrimitives.primaryColor,
|
|
336
346
|
contrastText: "#ffffff"
|
|
337
347
|
},
|
|
338
348
|
secondary: {
|
|
339
|
-
main:
|
|
349
|
+
main: OxygenUIPrimitives.secondaryColor,
|
|
340
350
|
contrastText: "#ffffff"
|
|
341
351
|
},
|
|
342
352
|
background: {
|
|
@@ -348,11 +358,11 @@ var OxygenThemeBase = extendTheme({
|
|
|
348
358
|
dark: {
|
|
349
359
|
palette: {
|
|
350
360
|
primary: {
|
|
351
|
-
main:
|
|
361
|
+
main: OxygenUIPrimitives.primaryColor,
|
|
352
362
|
contrastText: "#ffffff"
|
|
353
363
|
},
|
|
354
364
|
secondary: {
|
|
355
|
-
main:
|
|
365
|
+
main: OxygenUIPrimitives.secondaryColor,
|
|
356
366
|
contrastText: "#ffffff"
|
|
357
367
|
},
|
|
358
368
|
background: {
|
|
@@ -2440,15 +2450,11 @@ var PageTitleHeaderStyled = styled8(Typography, {
|
|
|
2440
2450
|
})(({ theme }) => {
|
|
2441
2451
|
var _a;
|
|
2442
2452
|
return {
|
|
2443
|
-
fontWeight: 500,
|
|
2444
|
-
fontSize: "1.5rem",
|
|
2445
|
-
lineHeight: 1.334,
|
|
2446
|
-
letterSpacing: "0em",
|
|
2447
2453
|
color: ((_a = theme.vars) == null ? void 0 : _a.palette.text.primary) || theme.palette.text.primary
|
|
2448
2454
|
};
|
|
2449
2455
|
});
|
|
2450
2456
|
var PageTitleHeader = (_a) => {
|
|
2451
|
-
var _b = _a, { children, variant = "
|
|
2457
|
+
var _b = _a, { children, variant = "h1" } = _b, props = __objRest(_b, ["children", "variant"]);
|
|
2452
2458
|
return /* @__PURE__ */ jsx13(PageTitleHeaderStyled, __spreadProps(__spreadValues({ variant }, props), { children }));
|
|
2453
2459
|
};
|
|
2454
2460
|
PageTitleHeader.displayName = "PageTitle.Header";
|
|
@@ -3223,7 +3229,7 @@ Header.Spacer = HeaderSpacer;
|
|
|
3223
3229
|
Header.displayName = "Header";
|
|
3224
3230
|
|
|
3225
3231
|
// src/components/Sidebar/Sidebar.tsx
|
|
3226
|
-
import * as
|
|
3232
|
+
import * as React15 from "react";
|
|
3227
3233
|
import Box17 from "@mui/material/Box";
|
|
3228
3234
|
import { styled as styled34 } from "@mui/material/styles";
|
|
3229
3235
|
|
|
@@ -3364,7 +3370,7 @@ var SidebarCategory = ({
|
|
|
3364
3370
|
SidebarCategory.displayName = "SidebarCategory";
|
|
3365
3371
|
|
|
3366
3372
|
// src/components/Sidebar/SidebarItem.tsx
|
|
3367
|
-
import * as
|
|
3373
|
+
import * as React13 from "react";
|
|
3368
3374
|
import Box14 from "@mui/material/Box";
|
|
3369
3375
|
import List2 from "@mui/material/List";
|
|
3370
3376
|
import ListItem from "@mui/material/ListItem";
|
|
@@ -3395,6 +3401,7 @@ var SidebarItemProvider = ({ value, children }) => {
|
|
|
3395
3401
|
};
|
|
3396
3402
|
|
|
3397
3403
|
// src/components/Sidebar/SidebarItemIcon.tsx
|
|
3404
|
+
import * as React12 from "react";
|
|
3398
3405
|
import ListItemIcon from "@mui/material/ListItemIcon";
|
|
3399
3406
|
import { styled as styled25 } from "@mui/material/styles";
|
|
3400
3407
|
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
@@ -3412,14 +3419,18 @@ var SidebarItemIcon = ({
|
|
|
3412
3419
|
children,
|
|
3413
3420
|
sx
|
|
3414
3421
|
}) => {
|
|
3422
|
+
var _a;
|
|
3415
3423
|
const { collapsed } = useSidebar();
|
|
3416
3424
|
const { isActive } = useSidebarItemContext();
|
|
3425
|
+
const iconWithSize = React12.isValidElement(children) ? React12.cloneElement(children, __spreadProps(__spreadValues({}, children.props), {
|
|
3426
|
+
size: (_a = children.props.size) != null ? _a : 20
|
|
3427
|
+
})) : children;
|
|
3417
3428
|
return /* @__PURE__ */ jsx36(
|
|
3418
3429
|
SidebarItemIconRoot,
|
|
3419
3430
|
{
|
|
3420
3431
|
ownerState: { collapsed, isActive },
|
|
3421
3432
|
sx,
|
|
3422
|
-
children
|
|
3433
|
+
children: iconWithSize
|
|
3423
3434
|
}
|
|
3424
3435
|
);
|
|
3425
3436
|
};
|
|
@@ -3504,6 +3515,7 @@ var SidebarItemButton = styled28(ListItemButton, {
|
|
|
3504
3515
|
borderRadius: theme.shape.borderRadius,
|
|
3505
3516
|
marginLeft: theme.spacing(1),
|
|
3506
3517
|
marginRight: theme.spacing(1),
|
|
3518
|
+
color: (theme.vars || theme).palette.text.primary,
|
|
3507
3519
|
transition: theme.transitions.create(["padding-left", "padding-right"], {
|
|
3508
3520
|
easing: theme.transitions.easing.sharp,
|
|
3509
3521
|
duration: ownerState.collapsed ? theme.transitions.duration.leavingScreen : theme.transitions.duration.enteringScreen
|
|
@@ -3561,9 +3573,9 @@ var CHILD_DISPLAY_NAMES = [
|
|
|
3561
3573
|
var separateChildren2 = (children) => {
|
|
3562
3574
|
const composableChildren = [];
|
|
3563
3575
|
const nestedItems = [];
|
|
3564
|
-
|
|
3576
|
+
React13.Children.toArray(children).forEach((child) => {
|
|
3565
3577
|
var _a;
|
|
3566
|
-
if (
|
|
3578
|
+
if (React13.isValidElement(child)) {
|
|
3567
3579
|
const displayName = (_a = child.type) == null ? void 0 : _a.displayName;
|
|
3568
3580
|
if (displayName && CHILD_DISPLAY_NAMES.includes(displayName)) {
|
|
3569
3581
|
composableChildren.push(child);
|
|
@@ -3578,9 +3590,9 @@ var separateChildren2 = (children) => {
|
|
|
3578
3590
|
};
|
|
3579
3591
|
var getTooltipLabel = (children) => {
|
|
3580
3592
|
let tooltipLabel = "";
|
|
3581
|
-
|
|
3593
|
+
React13.Children.forEach(children, (child) => {
|
|
3582
3594
|
var _a;
|
|
3583
|
-
if (
|
|
3595
|
+
if (React13.isValidElement(child)) {
|
|
3584
3596
|
const displayName = (_a = child.type) == null ? void 0 : _a.displayName;
|
|
3585
3597
|
const props = child.props;
|
|
3586
3598
|
if (displayName === "SidebarItemLabel" && props.children) {
|
|
@@ -3593,9 +3605,9 @@ var getTooltipLabel = (children) => {
|
|
|
3593
3605
|
var extractItemContent = (itemChildren) => {
|
|
3594
3606
|
let icon = null;
|
|
3595
3607
|
let label = "";
|
|
3596
|
-
|
|
3608
|
+
React13.Children.forEach(itemChildren, (child) => {
|
|
3597
3609
|
var _a;
|
|
3598
|
-
if (
|
|
3610
|
+
if (React13.isValidElement(child)) {
|
|
3599
3611
|
const displayName = (_a = child.type) == null ? void 0 : _a.displayName;
|
|
3600
3612
|
const props = child.props;
|
|
3601
3613
|
if (displayName === "SidebarItemIcon") {
|
|
@@ -3618,16 +3630,16 @@ var SidebarItem = ({
|
|
|
3618
3630
|
const hasNestedItems = nestedItems.length > 0;
|
|
3619
3631
|
const isActive = activeItem === id;
|
|
3620
3632
|
const isExpanded = expandedMenus[id] || false;
|
|
3621
|
-
const hasActiveChild =
|
|
3633
|
+
const hasActiveChild = React13.useMemo(() => {
|
|
3622
3634
|
if (!hasNestedItems || !activeItem) return false;
|
|
3623
3635
|
return nestedItems.some((child) => {
|
|
3624
|
-
if (
|
|
3636
|
+
if (React13.isValidElement(child)) {
|
|
3625
3637
|
return child.props.id === activeItem;
|
|
3626
3638
|
}
|
|
3627
3639
|
return false;
|
|
3628
3640
|
});
|
|
3629
3641
|
}, [hasNestedItems, nestedItems, activeItem]);
|
|
3630
|
-
const [popoverAnchor, setPopoverAnchor] =
|
|
3642
|
+
const [popoverAnchor, setPopoverAnchor] = React13.useState(null);
|
|
3631
3643
|
const popoverOpen = Boolean(popoverAnchor);
|
|
3632
3644
|
const contextValue = {
|
|
3633
3645
|
id,
|
|
@@ -3702,7 +3714,7 @@ var SidebarItem = ({
|
|
|
3702
3714
|
}
|
|
3703
3715
|
},
|
|
3704
3716
|
children: /* @__PURE__ */ jsx39(SidebarItemPopoverList, { disablePadding: true, children: nestedItems.map((child, index) => {
|
|
3705
|
-
if (
|
|
3717
|
+
if (React13.isValidElement(child)) {
|
|
3706
3718
|
const childProps = child.props;
|
|
3707
3719
|
const { icon, label } = extractItemContent(childProps.children);
|
|
3708
3720
|
const isItemActive = activeItem === childProps.id;
|
|
@@ -3724,8 +3736,8 @@ var SidebarItem = ({
|
|
|
3724
3736
|
}
|
|
3725
3737
|
),
|
|
3726
3738
|
hasNestedItems && !collapsed && /* @__PURE__ */ jsx39(Collapse, { in: isExpanded, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ jsx39(List2, { disablePadding: true, children: nestedItems.map((child, index) => {
|
|
3727
|
-
if (
|
|
3728
|
-
return
|
|
3739
|
+
if (React13.isValidElement(child)) {
|
|
3740
|
+
return React13.cloneElement(child, {
|
|
3729
3741
|
key: child.key || index,
|
|
3730
3742
|
depth: depth + 1
|
|
3731
3743
|
});
|
|
@@ -3760,7 +3772,7 @@ var SidebarFooter = ({
|
|
|
3760
3772
|
};
|
|
3761
3773
|
|
|
3762
3774
|
// src/components/Sidebar/SidebarUser.tsx
|
|
3763
|
-
import * as
|
|
3775
|
+
import * as React14 from "react";
|
|
3764
3776
|
import Box16 from "@mui/material/Box";
|
|
3765
3777
|
import ListItemButton2 from "@mui/material/ListItemButton";
|
|
3766
3778
|
import Tooltip4 from "@mui/material/Tooltip";
|
|
@@ -3885,9 +3897,9 @@ var SidebarUserTextContainer = styled33(Box16, {
|
|
|
3885
3897
|
var separateChildren3 = (children) => {
|
|
3886
3898
|
let avatarChild = null;
|
|
3887
3899
|
const textChildren = [];
|
|
3888
|
-
|
|
3900
|
+
React14.Children.forEach(children, (child) => {
|
|
3889
3901
|
var _a;
|
|
3890
|
-
if (
|
|
3902
|
+
if (React14.isValidElement(child)) {
|
|
3891
3903
|
const displayName = (_a = child.type) == null ? void 0 : _a.displayName;
|
|
3892
3904
|
if (displayName === "SidebarUserAvatar") {
|
|
3893
3905
|
avatarChild = child;
|
|
@@ -3900,9 +3912,9 @@ var separateChildren3 = (children) => {
|
|
|
3900
3912
|
};
|
|
3901
3913
|
var getTooltipText = (children) => {
|
|
3902
3914
|
let tooltipText = "";
|
|
3903
|
-
|
|
3915
|
+
React14.Children.forEach(children, (child) => {
|
|
3904
3916
|
var _a;
|
|
3905
|
-
if (
|
|
3917
|
+
if (React14.isValidElement(child)) {
|
|
3906
3918
|
const displayName = (_a = child.type) == null ? void 0 : _a.displayName;
|
|
3907
3919
|
const props = child.props;
|
|
3908
3920
|
if (displayName === "SidebarUserName" && props.children) {
|
|
@@ -3971,7 +3983,7 @@ var Sidebar = ({
|
|
|
3971
3983
|
collapsedWidth = COLLAPSED_SIDEBAR_WIDTH,
|
|
3972
3984
|
sx
|
|
3973
3985
|
}) => {
|
|
3974
|
-
const contextValue =
|
|
3986
|
+
const contextValue = React15.useMemo(
|
|
3975
3987
|
() => ({
|
|
3976
3988
|
collapsed,
|
|
3977
3989
|
activeItem,
|
|
@@ -3999,15 +4011,15 @@ Sidebar.UserEmail = SidebarUserEmail;
|
|
|
3999
4011
|
Sidebar.displayName = "Sidebar";
|
|
4000
4012
|
|
|
4001
4013
|
// src/components/NotificationPanel/NotificationPanel.tsx
|
|
4002
|
-
import * as
|
|
4014
|
+
import * as React21 from "react";
|
|
4003
4015
|
import Drawer from "@mui/material/Drawer";
|
|
4004
4016
|
import { styled as styled50 } from "@mui/material/styles";
|
|
4005
4017
|
|
|
4006
4018
|
// src/components/NotificationPanel/context.ts
|
|
4007
|
-
import * as
|
|
4008
|
-
var NotificationPanelContext =
|
|
4019
|
+
import * as React16 from "react";
|
|
4020
|
+
var NotificationPanelContext = React16.createContext(null);
|
|
4009
4021
|
var useNotificationPanel = () => {
|
|
4010
|
-
const context =
|
|
4022
|
+
const context = React16.useContext(NotificationPanelContext);
|
|
4011
4023
|
if (!context) {
|
|
4012
4024
|
throw new Error(
|
|
4013
4025
|
"NotificationPanel compound components must be used within NotificationPanel"
|
|
@@ -4017,7 +4029,7 @@ var useNotificationPanel = () => {
|
|
|
4017
4029
|
};
|
|
4018
4030
|
|
|
4019
4031
|
// src/components/NotificationPanel/NotificationHeader.tsx
|
|
4020
|
-
import * as
|
|
4032
|
+
import * as React17 from "react";
|
|
4021
4033
|
import Box18 from "@mui/material/Box";
|
|
4022
4034
|
import { styled as styled35 } from "@mui/material/styles";
|
|
4023
4035
|
import { jsx as jsx46, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
@@ -4042,9 +4054,9 @@ var NotificationHeaderContent = styled35(Box18, {
|
|
|
4042
4054
|
var separateChildren4 = (children) => {
|
|
4043
4055
|
const leftChildren = [];
|
|
4044
4056
|
let closeChild = null;
|
|
4045
|
-
|
|
4057
|
+
React17.Children.forEach(children, (child) => {
|
|
4046
4058
|
var _a;
|
|
4047
|
-
if (
|
|
4059
|
+
if (React17.isValidElement(child)) {
|
|
4048
4060
|
const displayName = (_a = child.type) == null ? void 0 : _a.displayName;
|
|
4049
4061
|
if (displayName === "NotificationHeaderClose") {
|
|
4050
4062
|
closeChild = child;
|
|
@@ -4283,7 +4295,7 @@ var NotificationActions = ({
|
|
|
4283
4295
|
};
|
|
4284
4296
|
|
|
4285
4297
|
// src/components/NotificationPanel/NotificationList.tsx
|
|
4286
|
-
import * as
|
|
4298
|
+
import * as React18 from "react";
|
|
4287
4299
|
import Box22 from "@mui/material/Box";
|
|
4288
4300
|
import List3 from "@mui/material/List";
|
|
4289
4301
|
import Divider6 from "@mui/material/Divider";
|
|
@@ -4301,15 +4313,15 @@ var NotificationList = ({
|
|
|
4301
4313
|
showDividers = true,
|
|
4302
4314
|
sx
|
|
4303
4315
|
}) => {
|
|
4304
|
-
const childArray =
|
|
4305
|
-
return /* @__PURE__ */ jsx53(NotificationListRoot, { sx, children: /* @__PURE__ */ jsx53(List3, { disablePadding: true, children: childArray.map((child, index) => /* @__PURE__ */ jsxs18(
|
|
4316
|
+
const childArray = React18.Children.toArray(children);
|
|
4317
|
+
return /* @__PURE__ */ jsx53(NotificationListRoot, { sx, children: /* @__PURE__ */ jsx53(List3, { disablePadding: true, children: childArray.map((child, index) => /* @__PURE__ */ jsxs18(React18.Fragment, { children: [
|
|
4306
4318
|
child,
|
|
4307
4319
|
showDividers && index < childArray.length - 1 && /* @__PURE__ */ jsx53(Divider6, {})
|
|
4308
4320
|
] }, index)) }) });
|
|
4309
4321
|
};
|
|
4310
4322
|
|
|
4311
4323
|
// src/components/NotificationPanel/NotificationItem.tsx
|
|
4312
|
-
import * as
|
|
4324
|
+
import * as React20 from "react";
|
|
4313
4325
|
import Box23 from "@mui/material/Box";
|
|
4314
4326
|
import ListItem2 from "@mui/material/ListItem";
|
|
4315
4327
|
import ListItemButton3 from "@mui/material/ListItemButton";
|
|
@@ -4355,11 +4367,11 @@ var getNotificationTypeProps = (type) => {
|
|
|
4355
4367
|
};
|
|
4356
4368
|
|
|
4357
4369
|
// src/components/NotificationPanel/NotificationItemContext.tsx
|
|
4358
|
-
import * as
|
|
4370
|
+
import * as React19 from "react";
|
|
4359
4371
|
import { jsx as jsx54 } from "react/jsx-runtime";
|
|
4360
|
-
var NotificationItemContext =
|
|
4372
|
+
var NotificationItemContext = React19.createContext(null);
|
|
4361
4373
|
var useNotificationItemContext = () => {
|
|
4362
|
-
const context =
|
|
4374
|
+
const context = React19.useContext(NotificationItemContext);
|
|
4363
4375
|
if (!context) {
|
|
4364
4376
|
throw new Error(
|
|
4365
4377
|
"useNotificationItemContext must be used within a NotificationItem component"
|
|
@@ -4413,9 +4425,9 @@ var separateChildren5 = (children) => {
|
|
|
4413
4425
|
let messageChild = null;
|
|
4414
4426
|
let timestampChild = null;
|
|
4415
4427
|
let actionChild = null;
|
|
4416
|
-
|
|
4428
|
+
React20.Children.forEach(children, (child) => {
|
|
4417
4429
|
var _a;
|
|
4418
|
-
if (
|
|
4430
|
+
if (React20.isValidElement(child)) {
|
|
4419
4431
|
const displayName = (_a = child.type) == null ? void 0 : _a.displayName;
|
|
4420
4432
|
switch (displayName) {
|
|
4421
4433
|
case "NotificationItemAvatar":
|
|
@@ -4720,7 +4732,7 @@ var NotificationPanel = ({
|
|
|
4720
4732
|
variant = "temporary",
|
|
4721
4733
|
sx
|
|
4722
4734
|
}) => {
|
|
4723
|
-
const contextValue =
|
|
4735
|
+
const contextValue = React21.useMemo(() => ({ onClose }), [onClose]);
|
|
4724
4736
|
const ownerState = { width };
|
|
4725
4737
|
return /* @__PURE__ */ jsx62(NotificationPanelContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx62(
|
|
4726
4738
|
NotificationPanelRoot,
|
|
@@ -4753,7 +4765,7 @@ NotificationPanel.EmptyState = NotificationEmptyState;
|
|
|
4753
4765
|
NotificationPanel.displayName = "NotificationPanel";
|
|
4754
4766
|
|
|
4755
4767
|
// src/components/Footer/Footer.tsx
|
|
4756
|
-
import * as
|
|
4768
|
+
import * as React22 from "react";
|
|
4757
4769
|
import Box26 from "@mui/material/Box";
|
|
4758
4770
|
import { styled as styled54 } from "@mui/material/styles";
|
|
4759
4771
|
|
|
@@ -4872,11 +4884,11 @@ var FooterRight = styled54(Box26, {
|
|
|
4872
4884
|
flexWrap: "wrap"
|
|
4873
4885
|
}));
|
|
4874
4886
|
var Footer = ({ children, sx }) => {
|
|
4875
|
-
const childrenArray =
|
|
4887
|
+
const childrenArray = React22.Children.toArray(children);
|
|
4876
4888
|
const leftChildren = [];
|
|
4877
4889
|
const rightChildren = [];
|
|
4878
4890
|
childrenArray.forEach((child) => {
|
|
4879
|
-
if (
|
|
4891
|
+
if (React22.isValidElement(child)) {
|
|
4880
4892
|
if (child.type === FooterCopyright || child.type === FooterVersion || child.type === FooterDivider) {
|
|
4881
4893
|
leftChildren.push(child);
|
|
4882
4894
|
} else if (child.type === FooterLink) {
|
|
@@ -4896,14 +4908,14 @@ Footer.Divider = FooterDivider;
|
|
|
4896
4908
|
Footer.displayName = "Footer";
|
|
4897
4909
|
|
|
4898
4910
|
// src/components/UserMenu/UserMenu.tsx
|
|
4899
|
-
import * as
|
|
4911
|
+
import * as React26 from "react";
|
|
4900
4912
|
import Menu2 from "@mui/material/Menu";
|
|
4901
4913
|
|
|
4902
4914
|
// src/components/UserMenu/UserMenuContext.tsx
|
|
4903
|
-
import * as
|
|
4904
|
-
var UserMenuContext =
|
|
4915
|
+
import * as React23 from "react";
|
|
4916
|
+
var UserMenuContext = React23.createContext(void 0);
|
|
4905
4917
|
var useUserMenu = () => {
|
|
4906
|
-
const context =
|
|
4918
|
+
const context = React23.useContext(UserMenuContext);
|
|
4907
4919
|
if (!context) {
|
|
4908
4920
|
throw new Error("UserMenu sub-components must be used within a UserMenu component");
|
|
4909
4921
|
}
|
|
@@ -5075,6 +5087,7 @@ var UserMenuHeader = ({ name, email, avatar, role }) => {
|
|
|
5075
5087
|
UserMenuHeader.displayName = "UserMenu.Header";
|
|
5076
5088
|
|
|
5077
5089
|
// src/components/UserMenu/UserMenuItem.tsx
|
|
5090
|
+
import * as React24 from "react";
|
|
5078
5091
|
import MenuItem3 from "@mui/material/MenuItem";
|
|
5079
5092
|
import ListItemIcon3 from "@mui/material/ListItemIcon";
|
|
5080
5093
|
import ListItemText4 from "@mui/material/ListItemText";
|
|
@@ -5104,13 +5117,16 @@ var UserMenuItem = ({
|
|
|
5104
5117
|
badge,
|
|
5105
5118
|
onClick
|
|
5106
5119
|
}) => {
|
|
5120
|
+
var _a;
|
|
5107
5121
|
const { handleClose } = useUserMenu();
|
|
5108
5122
|
const handleClick = () => {
|
|
5109
5123
|
handleClose();
|
|
5110
5124
|
onClick == null ? void 0 : onClick();
|
|
5111
5125
|
};
|
|
5112
5126
|
return /* @__PURE__ */ jsxs25(StyledMenuItem2, { onClick: handleClick, children: [
|
|
5113
|
-
icon && /* @__PURE__ */ jsx70(ListItemIcon3, { children: icon }),
|
|
5127
|
+
icon && /* @__PURE__ */ jsx70(ListItemIcon3, { children: React24.isValidElement(icon) ? React24.cloneElement(icon, __spreadProps(__spreadValues({}, icon.props), {
|
|
5128
|
+
size: (_a = icon.props.size) != null ? _a : 18
|
|
5129
|
+
})) : icon }),
|
|
5114
5130
|
/* @__PURE__ */ jsx70(ListItemText4, { primary: label }),
|
|
5115
5131
|
/* @__PURE__ */ jsxs25(Box28, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: [
|
|
5116
5132
|
badge && /* @__PURE__ */ jsx70(
|
|
@@ -5128,6 +5144,7 @@ var UserMenuItem = ({
|
|
|
5128
5144
|
UserMenuItem.displayName = "UserMenu.Item";
|
|
5129
5145
|
|
|
5130
5146
|
// src/components/UserMenu/UserMenuLogout.tsx
|
|
5147
|
+
import * as React25 from "react";
|
|
5131
5148
|
import MenuItem4 from "@mui/material/MenuItem";
|
|
5132
5149
|
import ListItemIcon4 from "@mui/material/ListItemIcon";
|
|
5133
5150
|
import ListItemText5 from "@mui/material/ListItemText";
|
|
@@ -5153,13 +5170,16 @@ var UserMenuLogout = ({
|
|
|
5153
5170
|
label = "Log out",
|
|
5154
5171
|
onClick
|
|
5155
5172
|
}) => {
|
|
5173
|
+
var _a;
|
|
5156
5174
|
const { handleClose } = useUserMenu();
|
|
5157
5175
|
const handleClick = () => {
|
|
5158
5176
|
handleClose();
|
|
5159
5177
|
onClick == null ? void 0 : onClick();
|
|
5160
5178
|
};
|
|
5161
5179
|
return /* @__PURE__ */ jsxs26(StyledLogoutItem, { onClick: handleClick, children: [
|
|
5162
|
-
icon && /* @__PURE__ */ jsx71(ListItemIcon4, { children: icon }),
|
|
5180
|
+
icon && /* @__PURE__ */ jsx71(ListItemIcon4, { children: React25.isValidElement(icon) ? React25.cloneElement(icon, __spreadProps(__spreadValues({}, icon.props), {
|
|
5181
|
+
size: (_a = icon.props.size) != null ? _a : 18
|
|
5182
|
+
})) : icon }),
|
|
5163
5183
|
/* @__PURE__ */ jsx71(ListItemText5, { primary: label })
|
|
5164
5184
|
] });
|
|
5165
5185
|
};
|
|
@@ -5174,7 +5194,7 @@ UserMenuDivider.displayName = "UserMenu.Divider";
|
|
|
5174
5194
|
// src/components/UserMenu/UserMenu.tsx
|
|
5175
5195
|
import { jsx as jsx73, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
5176
5196
|
var UserMenu = ({ children }) => {
|
|
5177
|
-
const [anchorEl, setAnchorEl] =
|
|
5197
|
+
const [anchorEl, setAnchorEl] = React26.useState(null);
|
|
5178
5198
|
const open = Boolean(anchorEl);
|
|
5179
5199
|
const handleOpen = (event) => {
|
|
5180
5200
|
setAnchorEl(event.currentTarget);
|
|
@@ -5182,12 +5202,12 @@ var UserMenu = ({ children }) => {
|
|
|
5182
5202
|
const handleClose = () => {
|
|
5183
5203
|
setAnchorEl(null);
|
|
5184
5204
|
};
|
|
5185
|
-
const childrenArray =
|
|
5205
|
+
const childrenArray = React26.Children.toArray(children);
|
|
5186
5206
|
const triggerChild = childrenArray.find(
|
|
5187
|
-
(child) =>
|
|
5207
|
+
(child) => React26.isValidElement(child) && child.type === UserMenuTrigger
|
|
5188
5208
|
);
|
|
5189
5209
|
const menuChildren = childrenArray.filter(
|
|
5190
|
-
(child) =>
|
|
5210
|
+
(child) => React26.isValidElement(child) && child.type !== UserMenuTrigger
|
|
5191
5211
|
);
|
|
5192
5212
|
return /* @__PURE__ */ jsxs27(UserMenuContext.Provider, { value: { open, anchorEl, handleOpen, handleClose }, children: [
|
|
5193
5213
|
triggerChild,
|
|
@@ -5221,7 +5241,7 @@ UserMenu.Divider = UserMenuDivider;
|
|
|
5221
5241
|
UserMenu.displayName = "UserMenu";
|
|
5222
5242
|
|
|
5223
5243
|
// src/components/NotificationBanner/NotificationBanner.tsx
|
|
5224
|
-
import * as
|
|
5244
|
+
import * as React27 from "react";
|
|
5225
5245
|
import Alert from "@mui/material/Alert";
|
|
5226
5246
|
import AlertTitle from "@mui/material/AlertTitle";
|
|
5227
5247
|
import Collapse2 from "@mui/material/Collapse";
|
|
@@ -5277,8 +5297,8 @@ var NotificationBanner = ({
|
|
|
5277
5297
|
onDismiss,
|
|
5278
5298
|
sx
|
|
5279
5299
|
}) => {
|
|
5280
|
-
const [isVisible, setIsVisible] =
|
|
5281
|
-
|
|
5300
|
+
const [isVisible, setIsVisible] = React27.useState(visible);
|
|
5301
|
+
React27.useEffect(() => {
|
|
5282
5302
|
setIsVisible(visible);
|
|
5283
5303
|
}, [visible]);
|
|
5284
5304
|
const handleDismiss = () => {
|
|
@@ -5439,7 +5459,7 @@ var Form = {
|
|
|
5439
5459
|
};
|
|
5440
5460
|
|
|
5441
5461
|
// src/components/AppShell/AppShell.tsx
|
|
5442
|
-
import * as
|
|
5462
|
+
import * as React28 from "react";
|
|
5443
5463
|
import Box35 from "@mui/material/Box";
|
|
5444
5464
|
|
|
5445
5465
|
// src/layouts/Layout.tsx
|
|
@@ -5592,9 +5612,9 @@ var extractSlots = (children) => {
|
|
|
5592
5612
|
footer: null,
|
|
5593
5613
|
notificationPanel: null
|
|
5594
5614
|
};
|
|
5595
|
-
|
|
5615
|
+
React28.Children.forEach(children, (child) => {
|
|
5596
5616
|
var _a;
|
|
5597
|
-
if (
|
|
5617
|
+
if (React28.isValidElement(child)) {
|
|
5598
5618
|
const displayName = (_a = child.type) == null ? void 0 : _a.displayName;
|
|
5599
5619
|
const childProps = child.props;
|
|
5600
5620
|
switch (displayName) {
|
|
@@ -5817,14 +5837,14 @@ import IconButton7 from "@mui/material/IconButton";
|
|
|
5817
5837
|
import { Search as Search3, X as X4 } from "@wso2/oxygen-ui-icons-react";
|
|
5818
5838
|
|
|
5819
5839
|
// src/components/ListingTable/context.ts
|
|
5820
|
-
import * as
|
|
5821
|
-
var ListingTableContext =
|
|
5840
|
+
import * as React29 from "react";
|
|
5841
|
+
var ListingTableContext = React29.createContext(null);
|
|
5822
5842
|
ListingTableContext.displayName = "ListingTableContext";
|
|
5823
5843
|
var useListingTable = () => {
|
|
5824
|
-
return
|
|
5844
|
+
return React29.useContext(ListingTableContext);
|
|
5825
5845
|
};
|
|
5826
5846
|
var useListingTableRequired = () => {
|
|
5827
|
-
const context =
|
|
5847
|
+
const context = React29.useContext(ListingTableContext);
|
|
5828
5848
|
if (!context) {
|
|
5829
5849
|
throw new Error(
|
|
5830
5850
|
"useListingTableRequired must be used within a ListingTable.Provider. Use useListingTable() for optional context access."
|
|
@@ -6575,37 +6595,37 @@ function useThemeContent(contentMap, fallback) {
|
|
|
6575
6595
|
var useThemeContent_default = useThemeContent;
|
|
6576
6596
|
|
|
6577
6597
|
// src/hooks/useAppShell/useAppShell.ts
|
|
6578
|
-
import * as
|
|
6598
|
+
import * as React30 from "react";
|
|
6579
6599
|
var useAppShell = (options = {}) => {
|
|
6580
6600
|
const {
|
|
6581
6601
|
initialCollapsed = false,
|
|
6582
6602
|
initialActiveItem = "dashboard"
|
|
6583
6603
|
} = options;
|
|
6584
|
-
const [state, setState] =
|
|
6604
|
+
const [state, setState] = React30.useState({
|
|
6585
6605
|
sidebarCollapsed: initialCollapsed,
|
|
6586
6606
|
notificationPanelOpen: false,
|
|
6587
6607
|
activeMenuItem: initialActiveItem,
|
|
6588
6608
|
expandedMenus: {}
|
|
6589
6609
|
});
|
|
6590
|
-
const toggleSidebar =
|
|
6610
|
+
const toggleSidebar = React30.useCallback(() => {
|
|
6591
6611
|
setState((prev) => __spreadProps(__spreadValues({}, prev), { sidebarCollapsed: !prev.sidebarCollapsed }));
|
|
6592
6612
|
}, []);
|
|
6593
|
-
const toggleNotificationPanel =
|
|
6613
|
+
const toggleNotificationPanel = React30.useCallback(() => {
|
|
6594
6614
|
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
6595
6615
|
notificationPanelOpen: !prev.notificationPanelOpen
|
|
6596
6616
|
}));
|
|
6597
6617
|
}, []);
|
|
6598
|
-
const setActiveMenuItem =
|
|
6618
|
+
const setActiveMenuItem = React30.useCallback((id) => {
|
|
6599
6619
|
setState((prev) => __spreadProps(__spreadValues({}, prev), { activeMenuItem: id }));
|
|
6600
6620
|
}, []);
|
|
6601
|
-
const toggleMenu =
|
|
6621
|
+
const toggleMenu = React30.useCallback((id) => {
|
|
6602
6622
|
setState((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
6603
6623
|
expandedMenus: __spreadProps(__spreadValues({}, prev.expandedMenus), {
|
|
6604
6624
|
[id]: !prev.expandedMenus[id]
|
|
6605
6625
|
})
|
|
6606
6626
|
}));
|
|
6607
6627
|
}, []);
|
|
6608
|
-
const actions =
|
|
6628
|
+
const actions = React30.useMemo(
|
|
6609
6629
|
() => ({
|
|
6610
6630
|
toggleSidebar,
|
|
6611
6631
|
toggleNotificationPanel,
|
|
@@ -6626,44 +6646,44 @@ var useAppShell = (options = {}) => {
|
|
|
6626
6646
|
};
|
|
6627
6647
|
|
|
6628
6648
|
// src/hooks/useNotifications/useNotifications.ts
|
|
6629
|
-
import * as
|
|
6649
|
+
import * as React31 from "react";
|
|
6630
6650
|
var generateId = () => {
|
|
6631
6651
|
return `notif-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
6632
6652
|
};
|
|
6633
6653
|
var useNotifications = (options = {}) => {
|
|
6634
6654
|
const { initialNotifications = [] } = options;
|
|
6635
|
-
const [notifications, setNotifications] =
|
|
6655
|
+
const [notifications, setNotifications] = React31.useState(
|
|
6636
6656
|
initialNotifications
|
|
6637
6657
|
);
|
|
6638
|
-
const markRead =
|
|
6658
|
+
const markRead = React31.useCallback((id) => {
|
|
6639
6659
|
setNotifications(
|
|
6640
6660
|
(prev) => prev.map((n) => n.id === id ? __spreadProps(__spreadValues({}, n), { read: true }) : n)
|
|
6641
6661
|
);
|
|
6642
6662
|
}, []);
|
|
6643
|
-
const dismiss =
|
|
6663
|
+
const dismiss = React31.useCallback((id) => {
|
|
6644
6664
|
setNotifications((prev) => prev.filter((n) => n.id !== id));
|
|
6645
6665
|
}, []);
|
|
6646
|
-
const markAllRead =
|
|
6666
|
+
const markAllRead = React31.useCallback(() => {
|
|
6647
6667
|
setNotifications((prev) => prev.map((n) => __spreadProps(__spreadValues({}, n), { read: true })));
|
|
6648
6668
|
}, []);
|
|
6649
|
-
const clearAll =
|
|
6669
|
+
const clearAll = React31.useCallback(() => {
|
|
6650
6670
|
setNotifications([]);
|
|
6651
6671
|
}, []);
|
|
6652
|
-
const add =
|
|
6672
|
+
const add = React31.useCallback((notification) => {
|
|
6653
6673
|
const newNotification = __spreadProps(__spreadValues({}, notification), {
|
|
6654
6674
|
id: generateId()
|
|
6655
6675
|
});
|
|
6656
6676
|
setNotifications((prev) => [newNotification, ...prev]);
|
|
6657
6677
|
}, []);
|
|
6658
|
-
const unreadCount =
|
|
6678
|
+
const unreadCount = React31.useMemo(
|
|
6659
6679
|
() => notifications.filter((n) => !n.read).length,
|
|
6660
6680
|
[notifications]
|
|
6661
6681
|
);
|
|
6662
|
-
const unreadNotifications =
|
|
6682
|
+
const unreadNotifications = React31.useMemo(
|
|
6663
6683
|
() => notifications.filter((n) => !n.read),
|
|
6664
6684
|
[notifications]
|
|
6665
6685
|
);
|
|
6666
|
-
const actions =
|
|
6686
|
+
const actions = React31.useMemo(
|
|
6667
6687
|
() => ({
|
|
6668
6688
|
markRead,
|
|
6669
6689
|
dismiss,
|