@kwirthmagnify/kwirth-common-front 0.5.43 → 0.5.45

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.
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.HelpButton = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const material_1 = require("@mui/material");
9
- const icons_material_1 = require("@mui/icons-material");
9
+ const HelpOutline_1 = __importDefault(require("@mui/icons-material/HelpOutline"));
10
10
  // Botón de ayuda reutilizable para dialogs de configuración: abre la guía (docsify) en un NUEVO tab en
11
11
  // una sección concreta, deep-link vía hash routing (p.ej. …/#/admin/06-sla-settings). `section` puede
12
12
  // llevar ancla de heading (…?id=slug). Pensado para la barra de título de un dialog.
@@ -38,6 +38,6 @@ const HelpButton = ({ docsUrl, section }) => {
38
38
  };
39
39
  return (react_1.default.createElement(material_1.Tooltip, { arrow: true, title: 'Open the guide for this section' },
40
40
  react_1.default.createElement(material_1.IconButton, { size: 'small', "aria-label": 'help', onClick: open },
41
- react_1.default.createElement(icons_material_1.HelpOutline, { fontSize: 'small' }))));
41
+ react_1.default.createElement(HelpOutline_1.default, { fontSize: 'small' }))));
42
42
  };
43
43
  exports.HelpButton = HelpButton;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { ENotifyLevel } from '@kwirthmagnify/kwirth-common';
3
+ export interface INotification {
4
+ channelId: string | undefined;
5
+ text: string;
6
+ level: ENotifyLevel;
7
+ timestamp: Date;
8
+ }
9
+ interface MenuNotificationProps {
10
+ anchorParent: HTMLElement | null;
11
+ notifications: INotification[];
12
+ onClose: () => void;
13
+ onRefresh: () => void;
14
+ renderIcon?: (channelId: string | undefined) => React.ReactNode;
15
+ }
16
+ declare const MenuNotification: React.FC<MenuNotificationProps>;
17
+ export { MenuNotification };
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.MenuNotification = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const material_1 = require("@mui/material");
9
+ const kwirthicons_1 = require("./kwirthicons");
10
+ const kwirth_common_1 = require("@kwirthmagnify/kwirth-common");
11
+ const MenuNotification = ({ anchorParent, onClose, notifications, onRefresh, renderIcon }) => {
12
+ const getSeverityColor = (level) => {
13
+ const colors = {
14
+ [kwirth_common_1.ENotifyLevel.ERROR]: 'error.main',
15
+ [kwirth_common_1.ENotifyLevel.WARNING]: 'warning.main',
16
+ [kwirth_common_1.ENotifyLevel.SUCCESS]: 'success.main',
17
+ [kwirth_common_1.ENotifyLevel.INFO]: 'info.main',
18
+ };
19
+ return colors[level];
20
+ };
21
+ const onDelete = (index) => {
22
+ notifications.splice(index, 1);
23
+ onRefresh();
24
+ };
25
+ const onClear = () => {
26
+ while (notifications.length > 0)
27
+ notifications.splice(0, 1);
28
+ onClose();
29
+ };
30
+ return (react_1.default.createElement(material_1.Popover, { anchorEl: anchorParent, open: true, onClose: onClose, anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, transformOrigin: { vertical: 'top', horizontal: 'right' }, PaperProps: { sx: { width: 400, maxHeight: 500 } } },
31
+ react_1.default.createElement(material_1.Box, { sx: { p: 2, display: 'flex', alignItems: 'center', gap: 1 } },
32
+ react_1.default.createElement(material_1.Typography, { variant: 'subtitle1', sx: { fontWeight: 700, flexGrow: 1 } }, "Notifications"),
33
+ notifications.length > 0 && react_1.default.createElement(material_1.Button, { size: 'small', color: 'error', startIcon: react_1.default.createElement(kwirthicons_1.DeleteSweep, null), onClick: onClear, sx: { fontSize: '0.75rem' } }, "Clear"),
34
+ react_1.default.createElement(material_1.Chip, { label: notifications.length, size: 'small' })),
35
+ react_1.default.createElement(material_1.Divider, null),
36
+ react_1.default.createElement(material_1.List, { sx: { p: 0 } }, notifications.length > 0 ? (notifications.sort((a, b) => b.timestamp.getTime() - a.timestamp.getTime()).map((msg, index) => (react_1.default.createElement(material_1.ListItem, { key: index, divider: true, secondaryAction: react_1.default.createElement(material_1.IconButton, { edge: 'end', size: 'small', onClick: () => onDelete(index) },
37
+ react_1.default.createElement(kwirthicons_1.Close, { fontSize: 'small' })) },
38
+ react_1.default.createElement(material_1.Stack, { direction: 'row', alignItems: 'start' },
39
+ react_1.default.createElement("span", { style: { marginTop: 2 } }, renderIcon ? renderIcon(msg.channelId) : react_1.default.createElement(kwirthicons_1.Notifications, { sx: { fontSize: 20, opacity: 0.5 } })),
40
+ react_1.default.createElement(material_1.ListItemText, { primary: msg.text, primaryTypographyProps: { variant: 'body2', sx: { pr: 2, pl: 1 } }, secondary: react_1.default.createElement(material_1.Box, { component: 'span', sx: { display: 'flex', justifyContent: 'space-between', mt: 0.5 } },
41
+ react_1.default.createElement(material_1.Typography, { variant: 'caption', sx: { color: getSeverityColor(msg.level), fontWeight: 'bold', pl: 1 } }, msg.level),
42
+ react_1.default.createElement(material_1.Typography, { variant: 'caption', color: 'text.secondary' }, msg.timestamp.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }))) }))))))
43
+ :
44
+ (react_1.default.createElement(material_1.Box, { sx: { p: 4, textAlign: 'center' } },
45
+ react_1.default.createElement(kwirthicons_1.NotificationsOff, { sx: { opacity: 0.2, fontSize: 40, mb: 1 } }),
46
+ react_1.default.createElement(material_1.Typography, { variant: 'body2', color: 'text.secondary' }, "No new notifications."))))));
47
+ };
48
+ exports.MenuNotification = MenuNotification;
package/dist/index.d.ts CHANGED
@@ -125,6 +125,8 @@ export { HelpButton } from './HelpButton';
125
125
  export type { IHelpButtonProps } from './HelpButton';
126
126
  export { DialogTitleHelp } from './DialogTitleHelp';
127
127
  export type { IDialogTitleHelpProps } from './DialogTitleHelp';
128
+ export { MenuNotification } from './MenuNotification';
129
+ export type { INotification } from './MenuNotification';
128
130
  export interface ITabSummary {
129
131
  name: string;
130
132
  description: string;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DialogTitleHelp = exports.HelpButton = exports.UserPicker = exports.MsgBoxWaitCancel = exports.MsgBoxWait = exports.MsgBoxYesNoCancel = exports.MsgBoxYesNo = exports.MsgBoxOkCancel = exports.MsgBoxOkError = exports.MsgBoxOkWarning = exports.MsgBoxOk = exports.MsgBoxButtons = exports.MiniGauge = exports.MarkdownViewer = exports.cleanANSI = exports.MetricDefinition = exports.ERemoteConnState = exports.ENotifyLevel = exports.EChannelRefreshAction = exports.useKeyboard = void 0;
3
+ exports.MenuNotification = exports.DialogTitleHelp = exports.HelpButton = exports.UserPicker = exports.MsgBoxWaitCancel = exports.MsgBoxWait = exports.MsgBoxYesNoCancel = exports.MsgBoxYesNo = exports.MsgBoxOkCancel = exports.MsgBoxOkError = exports.MsgBoxOkWarning = exports.MsgBoxOk = exports.MsgBoxButtons = exports.MiniGauge = exports.MarkdownViewer = exports.cleanANSI = exports.MetricDefinition = exports.ERemoteConnState = exports.ENotifyLevel = exports.EChannelRefreshAction = exports.useKeyboard = void 0;
4
4
  const react_1 = require("react");
5
5
  const kwirth_common_1 = require("@kwirthmagnify/kwirth-common");
6
6
  Object.defineProperty(exports, "EChannelRefreshAction", { enumerable: true, get: function () { return kwirth_common_1.EChannelRefreshAction; } });
@@ -66,3 +66,5 @@ var HelpButton_1 = require("./HelpButton");
66
66
  Object.defineProperty(exports, "HelpButton", { enumerable: true, get: function () { return HelpButton_1.HelpButton; } });
67
67
  var DialogTitleHelp_1 = require("./DialogTitleHelp");
68
68
  Object.defineProperty(exports, "DialogTitleHelp", { enumerable: true, get: function () { return DialogTitleHelp_1.DialogTitleHelp; } });
69
+ var MenuNotification_1 = require("./MenuNotification");
70
+ Object.defineProperty(exports, "MenuNotification", { enumerable: true, get: function () { return MenuNotification_1.MenuNotification; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kwirthmagnify/kwirth-common-front",
3
- "version": "0.5.43",
3
+ "version": "0.5.45",
4
4
  "description": "Frontend channel interfaces for Kwirth plugins and channels",
5
5
  "scripts": {
6
6
  "build": "del .\\dist\\* /s /q && tsc"
@@ -18,7 +18,7 @@
18
18
  "author": "Julio Fernandez",
19
19
  "license": "ISC",
20
20
  "dependencies": {
21
- "@kwirthmagnify/kwirth-common": "^0.5.29",
21
+ "@kwirthmagnify/kwirth-common": "^0.5.40",
22
22
  "react-markdown": "^10.1.0"
23
23
  },
24
24
  "peerDependencies": {