@manuscripts/style-guide 3.8.2 → 3.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/cjs/components/Dialog.js +4 -2
  2. package/dist/cjs/components/StyledModal.js +28 -10
  3. package/dist/cjs/components/icons/profile-avatar.js +1 -1
  4. package/dist/cjs/index.js +0 -1
  5. package/dist/cjs/mui/components/Avatar/Avatar.js +50 -0
  6. package/dist/cjs/mui/components/Avatar/index.js +32 -0
  7. package/dist/cjs/mui/components/Typography/Typography.js +29 -32
  8. package/dist/cjs/mui/index.js +1 -0
  9. package/dist/cjs/mui/theme/theme.js +7 -0
  10. package/dist/es/components/Dialog.js +5 -3
  11. package/dist/es/components/StyledModal.js +29 -11
  12. package/dist/es/components/icons/profile-avatar.js +1 -1
  13. package/dist/es/index.js +0 -1
  14. package/dist/es/mui/components/Avatar/Avatar.js +43 -0
  15. package/dist/{types/components/SystemUserAvatar.d.ts → es/mui/components/Avatar/index.js} +2 -9
  16. package/dist/es/mui/components/Typography/Typography.js +28 -31
  17. package/dist/es/mui/index.js +1 -0
  18. package/dist/es/mui/theme/theme.js +7 -0
  19. package/dist/types/components/Dialog.d.ts +3 -0
  20. package/dist/types/components/StyledModal.d.ts +2 -2
  21. package/dist/types/index.d.ts +0 -1
  22. package/dist/types/mui/components/Avatar/Avatar.d.ts +24 -0
  23. package/dist/types/{components/Avatar.d.ts → mui/components/Avatar/index.d.ts} +2 -11
  24. package/dist/types/mui/components/Typography/Typography.d.ts +1 -1
  25. package/dist/types/mui/index.d.ts +1 -0
  26. package/package.json +1 -1
  27. package/dist/cjs/components/Avatar.js +0 -73
  28. package/dist/cjs/components/SystemUserAvatar.js +0 -40
  29. package/dist/es/components/Avatar.js +0 -66
  30. package/dist/es/components/SystemUserAvatar.js +0 -33
@@ -107,6 +107,7 @@ class Dialog extends react_1.default.Component {
107
107
  this.state = {
108
108
  primaryActionDisabled: true,
109
109
  };
110
+ this.Parent = this.props.portaled ? StyledModal_1.StyledModal : StyledModal_1.StyledModalContent;
110
111
  this.renderButtons = (props, disabled) => ((0, jsx_runtime_1.jsx)(ButtonsContainer, { children: props.actions.secondary ? (!props.actions.primary.isDestructive ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SecondaryAction, { action: props.actions.secondary.action, hasForm: !!this.props.confirmFieldText, title: props.actions.secondary.title, variant: props.actions.secondary.variant ?? 'default' }), (0, jsx_runtime_1.jsx)(PrimaryAction, { action: props.actions.primary.action, disabled: disabled, title: props.actions.primary.title || 'Dismiss' })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(PrimaryAction, { action: props.actions.primary.action, disabled: disabled, isDestructive: true, hasForm: !!this.props.confirmFieldText, title: props.actions.primary.title || 'Dismiss' }), (0, jsx_runtime_1.jsx)(SecondaryAction, { action: props.actions.secondary.action, title: props.actions.secondary.title, variant: props.actions.secondary.variant ?? 'default' })] }))) : ((0, jsx_runtime_1.jsx)(PrimaryAction, { action: props.actions.primary.action, disabled: disabled, isDestructive: props.actions.primary.isDestructive, hasForm: !!this.props.confirmFieldText, title: props.actions.primary.title || 'Dismiss' })) }));
111
112
  this.checkInputValue = (event) => {
112
113
  const testingVal = this.props.confirmFieldText && this.props.confirmFieldText.toUpperCase();
@@ -129,9 +130,10 @@ class Dialog extends react_1.default.Component {
129
130
  this.setDisabledBtnState(!!this.props.confirmFieldText);
130
131
  }
131
132
  render() {
132
- const { actions, isOpen, header, message, category, children, confirmFieldText, className, } = this.props;
133
+ const { actions, isOpen, header, message, category, children, confirmFieldText, className, onExited } = this.props;
133
134
  const { primaryActionDisabled } = this.state;
134
- return ((0, jsx_runtime_1.jsx)(StyledModal_1.StyledModal, { isOpen: isOpen, onRequestClose: actions.onClose, shouldCloseOnOverlayClick: true, className: className, children: (0, jsx_runtime_1.jsxs)(exports.DialogModalBody, { children: [(0, jsx_runtime_1.jsxs)(HeaderContainer, { children: [category === Category.error && ((0, jsx_runtime_1.jsx)(Icon, { children: (0, jsx_runtime_1.jsx)(icons_1.AttentionRedIcon, {}) })), category === Category.warning && ((0, jsx_runtime_1.jsx)(Icon, { children: (0, jsx_runtime_1.jsx)(icons_1.AttentionOrangeIcon, {}) })), category === Category.success && ((0, jsx_runtime_1.jsx)(Icon, { children: (0, jsx_runtime_1.jsx)(icons_1.AttentionGreenIcon, {}) })), header] }), (0, jsx_runtime_1.jsxs)(exports.MessageContainer, { children: [message, confirmFieldText && ((0, jsx_runtime_1.jsx)("form", { id: "formDialog", onSubmit: this.handleSubmit, children: (0, jsx_runtime_1.jsx)(ConfirmationTextField, { autoFocus: true, onChange: this.checkInputValue, placeholder: 'Please type: ' + confirmFieldText, required: true }) })), children] }), this.renderButtons(this.props, primaryActionDisabled)] }) }));
135
+ const { Parent } = this;
136
+ return ((0, jsx_runtime_1.jsx)(Parent, { isOpen: isOpen, onRequestClose: actions.onClose, shouldCloseOnOverlayClick: true, className: className, onExited: onExited, children: (0, jsx_runtime_1.jsxs)(exports.DialogModalBody, { children: [(0, jsx_runtime_1.jsxs)(HeaderContainer, { children: [category === Category.error && ((0, jsx_runtime_1.jsx)(Icon, { children: (0, jsx_runtime_1.jsx)(icons_1.AttentionRedIcon, {}) })), category === Category.warning && ((0, jsx_runtime_1.jsx)(Icon, { children: (0, jsx_runtime_1.jsx)(icons_1.AttentionOrangeIcon, {}) })), category === Category.success && ((0, jsx_runtime_1.jsx)(Icon, { children: (0, jsx_runtime_1.jsx)(icons_1.AttentionGreenIcon, {}) })), header] }), (0, jsx_runtime_1.jsxs)(exports.MessageContainer, { children: [message, confirmFieldText && ((0, jsx_runtime_1.jsx)("form", { id: "formDialog", onSubmit: this.handleSubmit, children: (0, jsx_runtime_1.jsx)(ConfirmationTextField, { autoFocus: true, onChange: this.checkInputValue, placeholder: 'Please type: ' + confirmFieldText, required: true }) })), children] }), this.renderButtons(this.props, primaryActionDisabled)] }) }));
135
137
  }
136
138
  }
137
139
  exports.Dialog = Dialog;
@@ -40,12 +40,18 @@ const react_dom_1 = require("react-dom");
40
40
  const styled_components_1 = __importStar(require("styled-components"));
41
41
  const Button_1 = require("./Button");
42
42
  const Sidebar_1 = require("./Sidebar");
43
- const StyledModalContent = ({ isOpen, onRequestClose, shouldCloseOnOverlayClick = true, hideOverlay = false, pointerEventsOnBackdrop, children, className, style, ariaLabelledby, id, }) => {
43
+ const StyledModalContent = ({ isOpen, onRequestClose, shouldCloseOnOverlayClick = true, hideOverlay = false, pointerEventsOnBackdrop, children, className, style, ariaLabelledby, id, onExited, }) => {
44
44
  const dialogRef = (0, react_1.useRef)(null);
45
45
  const closedByCancelRef = (0, react_1.useRef)(false);
46
+ const [visible, setVisible] = (0, react_1.useState)(false);
47
+ (0, react_1.useLayoutEffect)(() => {
48
+ if (isOpen) {
49
+ setVisible(true);
50
+ }
51
+ }, [isOpen]);
46
52
  (0, react_1.useEffect)(() => {
47
53
  const dialog = dialogRef.current;
48
- if (!dialog) {
54
+ if (!dialog || !visible) {
49
55
  return;
50
56
  }
51
57
  if (isOpen && !dialog.open) {
@@ -57,9 +63,14 @@ const StyledModalContent = ({ isOpen, onRequestClose, shouldCloseOnOverlayClick
57
63
  }
58
64
  }
59
65
  else if (!isOpen && dialog.open) {
66
+ const timeout = setTimeout(() => {
67
+ setVisible(false);
68
+ onExited?.();
69
+ }, TRANSITION_TIME + 50);
60
70
  dialog.close();
71
+ return () => clearTimeout(timeout);
61
72
  }
62
- }, [isOpen]);
73
+ }, [isOpen, setVisible, visible]);
63
74
  (0, react_1.useEffect)(() => {
64
75
  const dialog = dialogRef.current;
65
76
  if (!dialog) {
@@ -71,7 +82,10 @@ const StyledModalContent = ({ isOpen, onRequestClose, shouldCloseOnOverlayClick
71
82
  }
72
83
  closedByCancelRef.current = false;
73
84
  };
74
- const listener = () => handleNativeClose(isOpen);
85
+ const listener = (e) => {
86
+ e.preventDefault();
87
+ handleNativeClose(isOpen);
88
+ };
75
89
  dialog.addEventListener('close', listener);
76
90
  return () => dialog.removeEventListener('close', listener);
77
91
  }, [isOpen, onRequestClose]);
@@ -92,6 +106,9 @@ const StyledModalContent = ({ isOpen, onRequestClose, shouldCloseOnOverlayClick
92
106
  onRequestClose?.();
93
107
  }
94
108
  };
109
+ if (!visible) {
110
+ return null;
111
+ }
95
112
  return ((0, jsx_runtime_1.jsx)(Dialog, { ref: dialogRef, onClick: (e) => {
96
113
  e.stopPropagation();
97
114
  handleBackdropClick(e);
@@ -102,6 +119,7 @@ const StyledModal = (props) => {
102
119
  return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(exports.StyledModalContent, { ...props }), document.body);
103
120
  };
104
121
  exports.StyledModal = StyledModal;
122
+ const TRANSITION_TIME = 500;
105
123
  const Dialog = styled_components_1.default.dialog `
106
124
  background: transparent;
107
125
  border: none;
@@ -112,9 +130,9 @@ const Dialog = styled_components_1.default.dialog `
112
130
  z-index: 100;
113
131
  opacity: 1;
114
132
  transition:
115
- opacity 0.5s ease-in-out,
116
- display 0.5s ease allow-discrete,
117
- overlay 0.5s ease allow-discrete;
133
+ opacity ${TRANSITION_TIME}ms ease-in-out,
134
+ display ${TRANSITION_TIME}ms ease allow-discrete,
135
+ overlay ${TRANSITION_TIME}ms ease allow-discrete;
118
136
 
119
137
  &:not([open]) {
120
138
  opacity: 0;
@@ -145,9 +163,9 @@ const Dialog = styled_components_1.default.dialog `
145
163
  opacity: 1;
146
164
  pointer-events: ${(props) => props.$pointerEventsOnBackdrop || 'auto'};
147
165
  transition:
148
- opacity 0.5s ease-in-out,
149
- display 0.5s ease allow-discrete,
150
- overlay 0.5s ease allow-discrete;
166
+ opacity ${TRANSITION_TIME}ms ease-in-out,
167
+ display ${TRANSITION_TIME}ms ease allow-discrete,
168
+ overlay ${TRANSITION_TIME}ms ease allow-discrete;
151
169
  }
152
170
 
153
171
  &:not([open])::backdrop {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const jsx_runtime_1 = require("react/jsx-runtime");
4
- const ProfileAvatarIcon = (props) => ((0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "44", height: "44", viewBox: "0 0 32 32", fill: "none", ...props, children: (0, jsx_runtime_1.jsx)("path", { d: "M16 0C24.837 0 32 7.163 32 16C32 24.837 24.837 32 16 32C7.163 32 0 24.837 0 16C0 7.163 7.163 0 16 0ZM16 17.585C14.7258 17.585 13.4651 17.8457 12.2954 18.351C11.1257 18.8563 10.0718 19.5956 9.19841 20.5234C8.32504 21.4512 7.65073 22.5478 7.21694 23.7459C6.78315 24.944 6.59907 26.2181 6.676 27.49C9.31009 29.6338 12.6038 30.802 16 30.797C19.396 30.802 22.6896 29.6342 25.324 27.491C25.4009 26.2191 25.2168 24.945 24.7831 23.7469C24.3493 22.5488 23.675 21.4522 22.8016 20.5244C21.9282 19.5966 20.8743 18.8573 19.7046 18.352C18.5349 17.8467 17.2742 17.586 16 17.586V17.585ZM16 1.203C7.828 1.203 1.203 7.828 1.203 16C1.203 20.03 2.815 23.685 5.429 26.354C5.672 21.779 8.82 17.976 13.062 16.753C12.0228 16.1131 11.2209 15.1516 10.778 14.0145C10.3351 12.8773 10.2754 11.6267 10.608 10.4526C10.9406 9.27843 11.6473 8.24491 12.6208 7.509C13.5943 6.7731 14.7814 6.37501 16.0018 6.37522C17.2221 6.37543 18.4091 6.77391 19.3823 7.51015C20.3556 8.24639 21.0619 9.28015 21.3941 10.4544C21.7263 11.6287 21.6662 12.8793 21.2229 14.0163C20.7796 15.1533 19.9774 16.1145 18.938 16.754C23.18 17.976 26.328 21.779 26.571 26.354C29.2842 23.5912 30.802 19.8723 30.797 16C30.797 7.828 24.172 1.203 16 1.203ZM16 7.621C15.4219 7.61225 14.8479 7.71854 14.3113 7.93369C13.7747 8.14885 13.2863 8.46857 12.8744 8.87426C12.4625 9.27994 12.1355 9.76349 11.9122 10.2968C11.6889 10.83 11.574 11.4024 11.574 11.9805C11.574 12.5586 11.6889 13.131 11.9122 13.6642C12.1355 14.1975 12.4625 14.6811 12.8744 15.0867C13.2863 15.4924 13.7747 15.8122 14.3113 16.0273C14.8479 16.2425 15.4219 16.3488 16 16.34C17.1448 16.3227 18.2368 15.8557 19.0402 15.0401C19.8436 14.2244 20.294 13.1254 20.294 11.9805C20.294 10.8356 19.8436 9.73663 19.0402 8.92095C18.2368 8.10527 17.1448 7.63834 16 7.621Z", fill: "#6E6E6E" }) }));
4
+ const ProfileAvatarIcon = (props) => ((0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "44", height: "44", viewBox: "0 0 32 32", fill: "none", ...props, display: "block", children: (0, jsx_runtime_1.jsx)("path", { d: "M16 0C24.837 0 32 7.163 32 16C32 24.837 24.837 32 16 32C7.163 32 0 24.837 0 16C0 7.163 7.163 0 16 0ZM16 17.585C14.7258 17.585 13.4651 17.8457 12.2954 18.351C11.1257 18.8563 10.0718 19.5956 9.19841 20.5234C8.32504 21.4512 7.65073 22.5478 7.21694 23.7459C6.78315 24.944 6.59907 26.2181 6.676 27.49C9.31009 29.6338 12.6038 30.802 16 30.797C19.396 30.802 22.6896 29.6342 25.324 27.491C25.4009 26.2191 25.2168 24.945 24.7831 23.7469C24.3493 22.5488 23.675 21.4522 22.8016 20.5244C21.9282 19.5966 20.8743 18.8573 19.7046 18.352C18.5349 17.8467 17.2742 17.586 16 17.586V17.585ZM16 1.203C7.828 1.203 1.203 7.828 1.203 16C1.203 20.03 2.815 23.685 5.429 26.354C5.672 21.779 8.82 17.976 13.062 16.753C12.0228 16.1131 11.2209 15.1516 10.778 14.0145C10.3351 12.8773 10.2754 11.6267 10.608 10.4526C10.9406 9.27843 11.6473 8.24491 12.6208 7.509C13.5943 6.7731 14.7814 6.37501 16.0018 6.37522C17.2221 6.37543 18.4091 6.77391 19.3823 7.51015C20.3556 8.24639 21.0619 9.28015 21.3941 10.4544C21.7263 11.6287 21.6662 12.8793 21.2229 14.0163C20.7796 15.1533 19.9774 16.1145 18.938 16.754C23.18 17.976 26.328 21.779 26.571 26.354C29.2842 23.5912 30.802 19.8723 30.797 16C30.797 7.828 24.172 1.203 16 1.203ZM16 7.621C15.4219 7.61225 14.8479 7.71854 14.3113 7.93369C13.7747 8.14885 13.2863 8.46857 12.8744 8.87426C12.4625 9.27994 12.1355 9.76349 11.9122 10.2968C11.6889 10.83 11.574 11.4024 11.574 11.9805C11.574 12.5586 11.6889 13.131 11.9122 13.6642C12.1355 14.1975 12.4625 14.6811 12.8744 15.0867C13.2863 15.4924 13.7747 15.8122 14.3113 16.0273C14.8479 16.2425 15.4219 16.3488 16 16.34C17.1448 16.3227 18.2368 15.8557 19.0402 15.0401C19.8436 14.2244 20.294 13.1254 20.294 11.9805C20.294 10.8356 19.8436 9.73663 19.0402 8.92095C18.2368 8.10527 17.1448 7.63834 16 7.621Z", fill: "currentColor" }) }));
5
5
  exports.default = ProfileAvatarIcon;
package/dist/cjs/index.js CHANGED
@@ -62,7 +62,6 @@ __exportStar(require("./components/ContextMenu"), exports);
62
62
  __exportStar(require("./components/RadioButton"), exports);
63
63
  var RadioGroup_1 = require("./components/RadioGroup");
64
64
  Object.defineProperty(exports, "StyledRadioGroup", { enumerable: true, get: function () { return RadioGroup_1.StyledRadioGroup; } });
65
- __exportStar(require("./components/Avatar"), exports);
66
65
  __exportStar(require("./components/Dialog"), exports);
67
66
  __exportStar(require("./components/DraggableModal"), exports);
68
67
  __exportStar(require("./components/Checkbox"), exports);
@@ -0,0 +1,50 @@
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.Avatar = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const Avatar_1 = __importDefault(require("@mui/material/Avatar"));
9
+ const styles_1 = require("@mui/material/styles");
10
+ const icons_1 = require("../../../components/icons");
11
+ const INITIALS_PALETTE = [
12
+ '#1a9bc7',
13
+ '#31a056',
14
+ '#e65100',
15
+ '#6a1b9a',
16
+ '#c62828',
17
+ '#1565c0',
18
+ '#558b2f',
19
+ '#00695c',
20
+ ];
21
+ const getInitials = (name) => {
22
+ const words = name.trim().split(/\s+/);
23
+ if (words.length === 1) {
24
+ return words[0].slice(0, 2).toUpperCase();
25
+ }
26
+ return (words[0][0] + words[words.length - 1][0]).toUpperCase();
27
+ };
28
+ const Avatar = ({ size, name, color, opacity = 1, src, alt, ...rest }) => {
29
+ const initials = name ? getInitials(name) : undefined;
30
+ const initialsBg = name
31
+ ? INITIALS_PALETTE[name.charCodeAt(0) % INITIALS_PALETTE.length]
32
+ : undefined;
33
+ return ((0, jsx_runtime_1.jsx)(AvatarRoot, { ...rest, src: src, alt: alt ?? name, ownerState: { size, opacity, initialsBg, initials: !!initials, color }, children: initials ?? (0, jsx_runtime_1.jsx)(icons_1.ProfileIcon, { height: size, width: size }) }));
34
+ };
35
+ exports.Avatar = Avatar;
36
+ const AvatarRoot = (0, styles_1.styled)(Avatar_1.default)(({ theme, ownerState }) => ({
37
+ width: ownerState.size,
38
+ height: ownerState.size,
39
+ fontSize: Math.round(ownerState.size * 0.4),
40
+ opacity: ownerState.opacity,
41
+ backgroundColor: ownerState.initialsBg ?? 'transparent',
42
+ color: ownerState.initials
43
+ ? theme.palette.common.white
44
+ : ownerState.color || theme.palette.grey[700],
45
+ ...(!ownerState.initials && {
46
+ '&:hover': {
47
+ color: ownerState.color || theme.palette.info.main,
48
+ },
49
+ }),
50
+ }));
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ /*!
3
+ * © 2026 Atypon Systems LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ var desc = Object.getOwnPropertyDescriptor(m, k);
20
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
+ desc = { enumerable: true, get: function() { return m[k]; } };
22
+ }
23
+ Object.defineProperty(o, k2, desc);
24
+ }) : (function(o, m, k, k2) {
25
+ if (k2 === undefined) k2 = k;
26
+ o[k2] = m[k];
27
+ }));
28
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
29
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ __exportStar(require("./Avatar"), exports);
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Typography = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const Typography_1 = __importDefault(require("@mui/material/Typography"));
9
+ const styles_1 = require("@mui/material/styles");
9
10
  const variantMap = {
10
11
  h1: 'h1',
11
12
  h2: 'h2',
@@ -13,36 +14,32 @@ const variantMap = {
13
14
  body: 'body1',
14
15
  caption: 'caption',
15
16
  };
16
- const colorMap = {
17
- primary: 'text.primary',
18
- secondary: 'text.secondary',
19
- muted: 'text.disabled',
20
- };
21
- const fontWeightMap = {
22
- regular: 400,
23
- medium: 500,
24
- bold: 700,
25
- };
26
- const Typography = ({ variant = 'body', color = 'primary', fontWeight, italic, uppercase, clamp, sx, ...rest }) => {
27
- const resolvedWeight = fontWeight === undefined
28
- ? undefined
29
- : typeof fontWeight === 'number'
30
- ? fontWeight
31
- : fontWeightMap[fontWeight];
32
- return ((0, jsx_runtime_1.jsx)(Typography_1.default, { variant: variantMap[variant], sx: [
33
- {
34
- color: colorMap[color],
35
- ...(resolvedWeight !== undefined && { fontWeight: resolvedWeight }),
36
- ...(italic && { fontStyle: 'italic' }),
37
- ...(uppercase && { textTransform: 'uppercase' }),
38
- ...(clamp && {
39
- display: '-webkit-box',
40
- overflow: 'hidden',
41
- WebkitLineClamp: clamp,
42
- WebkitBoxOrient: 'vertical',
43
- }),
44
- },
45
- ...(Array.isArray(sx) ? sx : sx ? [sx] : []),
46
- ], ...rest }));
47
- };
17
+ const Typography = ({ variant = 'body', color = 'primary', fontWeight, italic, uppercase, clamp, ...rest }) => ((0, jsx_runtime_1.jsx)(TypographyRoot, { ...rest, variant: variantMap[variant], ownerState: { color, fontWeight, italic, uppercase, clamp } }));
48
18
  exports.Typography = Typography;
19
+ const TypographyRoot = (0, styles_1.styled)(Typography_1.default)(({ theme, ownerState }) => {
20
+ const fontWeight = ownerState.fontWeight === undefined
21
+ ? undefined
22
+ : typeof ownerState.fontWeight === 'number'
23
+ ? ownerState.fontWeight
24
+ : {
25
+ regular: theme.typography.fontWeightRegular,
26
+ medium: theme.typography.fontWeightMedium,
27
+ bold: theme.typography.fontWeightBold,
28
+ }[ownerState.fontWeight];
29
+ return {
30
+ color: {
31
+ primary: theme.palette.text.primary,
32
+ secondary: theme.palette.text.secondary,
33
+ muted: theme.palette.text.disabled,
34
+ }[ownerState.color],
35
+ ...(fontWeight !== undefined && { fontWeight }),
36
+ ...(ownerState.italic && { fontStyle: 'italic' }),
37
+ ...(ownerState.uppercase && { textTransform: 'uppercase' }),
38
+ ...(ownerState.clamp && {
39
+ display: '-webkit-box',
40
+ overflow: 'hidden',
41
+ WebkitLineClamp: ownerState.clamp,
42
+ WebkitBoxOrient: 'vertical',
43
+ }),
44
+ };
45
+ });
@@ -30,6 +30,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
30
30
  };
31
31
  Object.defineProperty(exports, "__esModule", { value: true });
32
32
  __exportStar(require("./theme"), exports);
33
+ __exportStar(require("./components/Avatar"), exports);
33
34
  __exportStar(require("./components/Button"), exports);
34
35
  __exportStar(require("./components/IconButton"), exports);
35
36
  __exportStar(require("./components/InspectorToggleButton"), exports);
@@ -97,6 +97,13 @@ exports.muiTheme = (0, styles_1.createTheme)({
97
97
  },
98
98
  },
99
99
  },
100
+ MuiAvatar: {
101
+ styleOverrides: {
102
+ root: {
103
+ fontWeight: 700,
104
+ },
105
+ },
106
+ },
100
107
  MuiIconButton: {
101
108
  styleOverrides: {
102
109
  root: {
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import styled from 'styled-components';
4
4
  import { ButtonGroup, PrimaryButton, SecondaryButton } from './Button';
5
5
  import { AttentionGreenIcon, AttentionOrangeIcon, AttentionRedIcon, } from './icons';
6
- import { StyledModal } from './StyledModal';
6
+ import { StyledModal, StyledModalContent } from './StyledModal';
7
7
  import { TextField } from './TextField';
8
8
  const Icon = styled.div `
9
9
  margin-right: 6px;
@@ -101,6 +101,7 @@ export class Dialog extends React.Component {
101
101
  this.state = {
102
102
  primaryActionDisabled: true,
103
103
  };
104
+ this.Parent = this.props.portaled ? StyledModal : StyledModalContent;
104
105
  this.renderButtons = (props, disabled) => (_jsx(ButtonsContainer, { children: props.actions.secondary ? (!props.actions.primary.isDestructive ? (_jsxs(_Fragment, { children: [_jsx(SecondaryAction, { action: props.actions.secondary.action, hasForm: !!this.props.confirmFieldText, title: props.actions.secondary.title, variant: props.actions.secondary.variant ?? 'default' }), _jsx(PrimaryAction, { action: props.actions.primary.action, disabled: disabled, title: props.actions.primary.title || 'Dismiss' })] })) : (_jsxs(_Fragment, { children: [_jsx(PrimaryAction, { action: props.actions.primary.action, disabled: disabled, isDestructive: true, hasForm: !!this.props.confirmFieldText, title: props.actions.primary.title || 'Dismiss' }), _jsx(SecondaryAction, { action: props.actions.secondary.action, title: props.actions.secondary.title, variant: props.actions.secondary.variant ?? 'default' })] }))) : (_jsx(PrimaryAction, { action: props.actions.primary.action, disabled: disabled, isDestructive: props.actions.primary.isDestructive, hasForm: !!this.props.confirmFieldText, title: props.actions.primary.title || 'Dismiss' })) }));
105
106
  this.checkInputValue = (event) => {
106
107
  const testingVal = this.props.confirmFieldText && this.props.confirmFieldText.toUpperCase();
@@ -123,8 +124,9 @@ export class Dialog extends React.Component {
123
124
  this.setDisabledBtnState(!!this.props.confirmFieldText);
124
125
  }
125
126
  render() {
126
- const { actions, isOpen, header, message, category, children, confirmFieldText, className, } = this.props;
127
+ const { actions, isOpen, header, message, category, children, confirmFieldText, className, onExited } = this.props;
127
128
  const { primaryActionDisabled } = this.state;
128
- return (_jsx(StyledModal, { isOpen: isOpen, onRequestClose: actions.onClose, shouldCloseOnOverlayClick: true, className: className, children: _jsxs(DialogModalBody, { children: [_jsxs(HeaderContainer, { children: [category === Category.error && (_jsx(Icon, { children: _jsx(AttentionRedIcon, {}) })), category === Category.warning && (_jsx(Icon, { children: _jsx(AttentionOrangeIcon, {}) })), category === Category.success && (_jsx(Icon, { children: _jsx(AttentionGreenIcon, {}) })), header] }), _jsxs(MessageContainer, { children: [message, confirmFieldText && (_jsx("form", { id: "formDialog", onSubmit: this.handleSubmit, children: _jsx(ConfirmationTextField, { autoFocus: true, onChange: this.checkInputValue, placeholder: 'Please type: ' + confirmFieldText, required: true }) })), children] }), this.renderButtons(this.props, primaryActionDisabled)] }) }));
129
+ const { Parent } = this;
130
+ return (_jsx(Parent, { isOpen: isOpen, onRequestClose: actions.onClose, shouldCloseOnOverlayClick: true, className: className, onExited: onExited, children: _jsxs(DialogModalBody, { children: [_jsxs(HeaderContainer, { children: [category === Category.error && (_jsx(Icon, { children: _jsx(AttentionRedIcon, {}) })), category === Category.warning && (_jsx(Icon, { children: _jsx(AttentionOrangeIcon, {}) })), category === Category.success && (_jsx(Icon, { children: _jsx(AttentionGreenIcon, {}) })), header] }), _jsxs(MessageContainer, { children: [message, confirmFieldText && (_jsx("form", { id: "formDialog", onSubmit: this.handleSubmit, children: _jsx(ConfirmationTextField, { autoFocus: true, onChange: this.checkInputValue, placeholder: 'Please type: ' + confirmFieldText, required: true }) })), children] }), this.renderButtons(this.props, primaryActionDisabled)] }) }));
129
131
  }
130
132
  }
@@ -1,15 +1,21 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useEffect, useRef } from 'react';
2
+ import { useEffect, useLayoutEffect, useRef, useState, } from 'react';
3
3
  import { createPortal } from 'react-dom';
4
4
  import styled, { css } from 'styled-components';
5
5
  import { RoundIconButton } from './Button';
6
6
  import { SidebarStyles } from './Sidebar';
7
- export const StyledModalContent = ({ isOpen, onRequestClose, shouldCloseOnOverlayClick = true, hideOverlay = false, pointerEventsOnBackdrop, children, className, style, ariaLabelledby, id, }) => {
7
+ export const StyledModalContent = ({ isOpen, onRequestClose, shouldCloseOnOverlayClick = true, hideOverlay = false, pointerEventsOnBackdrop, children, className, style, ariaLabelledby, id, onExited, }) => {
8
8
  const dialogRef = useRef(null);
9
9
  const closedByCancelRef = useRef(false);
10
+ const [visible, setVisible] = useState(false);
11
+ useLayoutEffect(() => {
12
+ if (isOpen) {
13
+ setVisible(true);
14
+ }
15
+ }, [isOpen]);
10
16
  useEffect(() => {
11
17
  const dialog = dialogRef.current;
12
- if (!dialog) {
18
+ if (!dialog || !visible) {
13
19
  return;
14
20
  }
15
21
  if (isOpen && !dialog.open) {
@@ -21,9 +27,14 @@ export const StyledModalContent = ({ isOpen, onRequestClose, shouldCloseOnOverla
21
27
  }
22
28
  }
23
29
  else if (!isOpen && dialog.open) {
30
+ const timeout = setTimeout(() => {
31
+ setVisible(false);
32
+ onExited?.();
33
+ }, TRANSITION_TIME + 50);
24
34
  dialog.close();
35
+ return () => clearTimeout(timeout);
25
36
  }
26
- }, [isOpen]);
37
+ }, [isOpen, setVisible, visible]);
27
38
  useEffect(() => {
28
39
  const dialog = dialogRef.current;
29
40
  if (!dialog) {
@@ -35,7 +46,10 @@ export const StyledModalContent = ({ isOpen, onRequestClose, shouldCloseOnOverla
35
46
  }
36
47
  closedByCancelRef.current = false;
37
48
  };
38
- const listener = () => handleNativeClose(isOpen);
49
+ const listener = (e) => {
50
+ e.preventDefault();
51
+ handleNativeClose(isOpen);
52
+ };
39
53
  dialog.addEventListener('close', listener);
40
54
  return () => dialog.removeEventListener('close', listener);
41
55
  }, [isOpen, onRequestClose]);
@@ -56,6 +70,9 @@ export const StyledModalContent = ({ isOpen, onRequestClose, shouldCloseOnOverla
56
70
  onRequestClose?.();
57
71
  }
58
72
  };
73
+ if (!visible) {
74
+ return null;
75
+ }
59
76
  return (_jsx(Dialog, { ref: dialogRef, onClick: (e) => {
60
77
  e.stopPropagation();
61
78
  handleBackdropClick(e);
@@ -64,6 +81,7 @@ export const StyledModalContent = ({ isOpen, onRequestClose, shouldCloseOnOverla
64
81
  export const StyledModal = (props) => {
65
82
  return createPortal(_jsx(StyledModalContent, { ...props }), document.body);
66
83
  };
84
+ const TRANSITION_TIME = 500;
67
85
  const Dialog = styled.dialog `
68
86
  background: transparent;
69
87
  border: none;
@@ -74,9 +92,9 @@ const Dialog = styled.dialog `
74
92
  z-index: 100;
75
93
  opacity: 1;
76
94
  transition:
77
- opacity 0.5s ease-in-out,
78
- display 0.5s ease allow-discrete,
79
- overlay 0.5s ease allow-discrete;
95
+ opacity ${TRANSITION_TIME}ms ease-in-out,
96
+ display ${TRANSITION_TIME}ms ease allow-discrete,
97
+ overlay ${TRANSITION_TIME}ms ease allow-discrete;
80
98
 
81
99
  &:not([open]) {
82
100
  opacity: 0;
@@ -107,9 +125,9 @@ const Dialog = styled.dialog `
107
125
  opacity: 1;
108
126
  pointer-events: ${(props) => props.$pointerEventsOnBackdrop || 'auto'};
109
127
  transition:
110
- opacity 0.5s ease-in-out,
111
- display 0.5s ease allow-discrete,
112
- overlay 0.5s ease allow-discrete;
128
+ opacity ${TRANSITION_TIME}ms ease-in-out,
129
+ display ${TRANSITION_TIME}ms ease allow-discrete,
130
+ overlay ${TRANSITION_TIME}ms ease allow-discrete;
113
131
  }
114
132
 
115
133
  &:not([open])::backdrop {
@@ -1,3 +1,3 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- const ProfileAvatarIcon = (props) => (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "44", height: "44", viewBox: "0 0 32 32", fill: "none", ...props, children: _jsx("path", { d: "M16 0C24.837 0 32 7.163 32 16C32 24.837 24.837 32 16 32C7.163 32 0 24.837 0 16C0 7.163 7.163 0 16 0ZM16 17.585C14.7258 17.585 13.4651 17.8457 12.2954 18.351C11.1257 18.8563 10.0718 19.5956 9.19841 20.5234C8.32504 21.4512 7.65073 22.5478 7.21694 23.7459C6.78315 24.944 6.59907 26.2181 6.676 27.49C9.31009 29.6338 12.6038 30.802 16 30.797C19.396 30.802 22.6896 29.6342 25.324 27.491C25.4009 26.2191 25.2168 24.945 24.7831 23.7469C24.3493 22.5488 23.675 21.4522 22.8016 20.5244C21.9282 19.5966 20.8743 18.8573 19.7046 18.352C18.5349 17.8467 17.2742 17.586 16 17.586V17.585ZM16 1.203C7.828 1.203 1.203 7.828 1.203 16C1.203 20.03 2.815 23.685 5.429 26.354C5.672 21.779 8.82 17.976 13.062 16.753C12.0228 16.1131 11.2209 15.1516 10.778 14.0145C10.3351 12.8773 10.2754 11.6267 10.608 10.4526C10.9406 9.27843 11.6473 8.24491 12.6208 7.509C13.5943 6.7731 14.7814 6.37501 16.0018 6.37522C17.2221 6.37543 18.4091 6.77391 19.3823 7.51015C20.3556 8.24639 21.0619 9.28015 21.3941 10.4544C21.7263 11.6287 21.6662 12.8793 21.2229 14.0163C20.7796 15.1533 19.9774 16.1145 18.938 16.754C23.18 17.976 26.328 21.779 26.571 26.354C29.2842 23.5912 30.802 19.8723 30.797 16C30.797 7.828 24.172 1.203 16 1.203ZM16 7.621C15.4219 7.61225 14.8479 7.71854 14.3113 7.93369C13.7747 8.14885 13.2863 8.46857 12.8744 8.87426C12.4625 9.27994 12.1355 9.76349 11.9122 10.2968C11.6889 10.83 11.574 11.4024 11.574 11.9805C11.574 12.5586 11.6889 13.131 11.9122 13.6642C12.1355 14.1975 12.4625 14.6811 12.8744 15.0867C13.2863 15.4924 13.7747 15.8122 14.3113 16.0273C14.8479 16.2425 15.4219 16.3488 16 16.34C17.1448 16.3227 18.2368 15.8557 19.0402 15.0401C19.8436 14.2244 20.294 13.1254 20.294 11.9805C20.294 10.8356 19.8436 9.73663 19.0402 8.92095C18.2368 8.10527 17.1448 7.63834 16 7.621Z", fill: "#6E6E6E" }) }));
2
+ const ProfileAvatarIcon = (props) => (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "44", height: "44", viewBox: "0 0 32 32", fill: "none", ...props, display: "block", children: _jsx("path", { d: "M16 0C24.837 0 32 7.163 32 16C32 24.837 24.837 32 16 32C7.163 32 0 24.837 0 16C0 7.163 7.163 0 16 0ZM16 17.585C14.7258 17.585 13.4651 17.8457 12.2954 18.351C11.1257 18.8563 10.0718 19.5956 9.19841 20.5234C8.32504 21.4512 7.65073 22.5478 7.21694 23.7459C6.78315 24.944 6.59907 26.2181 6.676 27.49C9.31009 29.6338 12.6038 30.802 16 30.797C19.396 30.802 22.6896 29.6342 25.324 27.491C25.4009 26.2191 25.2168 24.945 24.7831 23.7469C24.3493 22.5488 23.675 21.4522 22.8016 20.5244C21.9282 19.5966 20.8743 18.8573 19.7046 18.352C18.5349 17.8467 17.2742 17.586 16 17.586V17.585ZM16 1.203C7.828 1.203 1.203 7.828 1.203 16C1.203 20.03 2.815 23.685 5.429 26.354C5.672 21.779 8.82 17.976 13.062 16.753C12.0228 16.1131 11.2209 15.1516 10.778 14.0145C10.3351 12.8773 10.2754 11.6267 10.608 10.4526C10.9406 9.27843 11.6473 8.24491 12.6208 7.509C13.5943 6.7731 14.7814 6.37501 16.0018 6.37522C17.2221 6.37543 18.4091 6.77391 19.3823 7.51015C20.3556 8.24639 21.0619 9.28015 21.3941 10.4544C21.7263 11.6287 21.6662 12.8793 21.2229 14.0163C20.7796 15.1533 19.9774 16.1145 18.938 16.754C23.18 17.976 26.328 21.779 26.571 26.354C29.2842 23.5912 30.802 19.8723 30.797 16C30.797 7.828 24.172 1.203 16 1.203ZM16 7.621C15.4219 7.61225 14.8479 7.71854 14.3113 7.93369C13.7747 8.14885 13.2863 8.46857 12.8744 8.87426C12.4625 9.27994 12.1355 9.76349 11.9122 10.2968C11.6889 10.83 11.574 11.4024 11.574 11.9805C11.574 12.5586 11.6889 13.131 11.9122 13.6642C12.1355 14.1975 12.4625 14.6811 12.8744 15.0867C13.2863 15.4924 13.7747 15.8122 14.3113 16.0273C14.8479 16.2425 15.4219 16.3488 16 16.34C17.1448 16.3227 18.2368 15.8557 19.0402 15.0401C19.8436 14.2244 20.294 13.1254 20.294 11.9805C20.294 10.8356 19.8436 9.73663 19.0402 8.92095C18.2368 8.10527 17.1448 7.63834 16 7.621Z", fill: "currentColor" }) }));
3
3
  export default ProfileAvatarIcon;
package/dist/es/index.js CHANGED
@@ -21,7 +21,6 @@ export * from './components/Button';
21
21
  export * from './components/ContextMenu';
22
22
  export * from './components/RadioButton';
23
23
  export { StyledRadioGroup, } from './components/RadioGroup';
24
- export * from './components/Avatar';
25
24
  export * from './components/Dialog';
26
25
  export * from './components/DraggableModal';
27
26
  export * from './components/Checkbox';
@@ -0,0 +1,43 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import MuiAvatar from '@mui/material/Avatar';
3
+ import { styled } from '@mui/material/styles';
4
+ import { ProfileIcon } from '../../../components/icons';
5
+ const INITIALS_PALETTE = [
6
+ '#1a9bc7',
7
+ '#31a056',
8
+ '#e65100',
9
+ '#6a1b9a',
10
+ '#c62828',
11
+ '#1565c0',
12
+ '#558b2f',
13
+ '#00695c',
14
+ ];
15
+ const getInitials = (name) => {
16
+ const words = name.trim().split(/\s+/);
17
+ if (words.length === 1) {
18
+ return words[0].slice(0, 2).toUpperCase();
19
+ }
20
+ return (words[0][0] + words[words.length - 1][0]).toUpperCase();
21
+ };
22
+ export const Avatar = ({ size, name, color, opacity = 1, src, alt, ...rest }) => {
23
+ const initials = name ? getInitials(name) : undefined;
24
+ const initialsBg = name
25
+ ? INITIALS_PALETTE[name.charCodeAt(0) % INITIALS_PALETTE.length]
26
+ : undefined;
27
+ return (_jsx(AvatarRoot, { ...rest, src: src, alt: alt ?? name, ownerState: { size, opacity, initialsBg, initials: !!initials, color }, children: initials ?? _jsx(ProfileIcon, { height: size, width: size }) }));
28
+ };
29
+ const AvatarRoot = styled(MuiAvatar)(({ theme, ownerState }) => ({
30
+ width: ownerState.size,
31
+ height: ownerState.size,
32
+ fontSize: Math.round(ownerState.size * 0.4),
33
+ opacity: ownerState.opacity,
34
+ backgroundColor: ownerState.initialsBg ?? 'transparent',
35
+ color: ownerState.initials
36
+ ? theme.palette.common.white
37
+ : ownerState.color || theme.palette.grey[700],
38
+ ...(!ownerState.initials && {
39
+ '&:hover': {
40
+ color: ownerState.color || theme.palette.info.main,
41
+ },
42
+ }),
43
+ }));
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * © 2019 Atypon Systems LLC
2
+ * © 2026 Atypon Systems LLC
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -13,11 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import React from 'react';
17
- interface SystemUserAvatarProps {
18
- src?: string;
19
- size: number;
20
- color?: string;
21
- }
22
- export declare const Avatar: React.FC<SystemUserAvatarProps>;
23
- export {};
16
+ export * from './Avatar';
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import MuiTypography from '@mui/material/Typography';
3
+ import { styled } from '@mui/material/styles';
3
4
  const variantMap = {
4
5
  h1: 'h1',
5
6
  h2: 'h2',
@@ -7,35 +8,31 @@ const variantMap = {
7
8
  body: 'body1',
8
9
  caption: 'caption',
9
10
  };
10
- const colorMap = {
11
- primary: 'text.primary',
12
- secondary: 'text.secondary',
13
- muted: 'text.disabled',
14
- };
15
- const fontWeightMap = {
16
- regular: 400,
17
- medium: 500,
18
- bold: 700,
19
- };
20
- export const Typography = ({ variant = 'body', color = 'primary', fontWeight, italic, uppercase, clamp, sx, ...rest }) => {
21
- const resolvedWeight = fontWeight === undefined
11
+ export const Typography = ({ variant = 'body', color = 'primary', fontWeight, italic, uppercase, clamp, ...rest }) => (_jsx(TypographyRoot, { ...rest, variant: variantMap[variant], ownerState: { color, fontWeight, italic, uppercase, clamp } }));
12
+ const TypographyRoot = styled(MuiTypography)(({ theme, ownerState }) => {
13
+ const fontWeight = ownerState.fontWeight === undefined
22
14
  ? undefined
23
- : typeof fontWeight === 'number'
24
- ? fontWeight
25
- : fontWeightMap[fontWeight];
26
- return (_jsx(MuiTypography, { variant: variantMap[variant], sx: [
27
- {
28
- color: colorMap[color],
29
- ...(resolvedWeight !== undefined && { fontWeight: resolvedWeight }),
30
- ...(italic && { fontStyle: 'italic' }),
31
- ...(uppercase && { textTransform: 'uppercase' }),
32
- ...(clamp && {
33
- display: '-webkit-box',
34
- overflow: 'hidden',
35
- WebkitLineClamp: clamp,
36
- WebkitBoxOrient: 'vertical',
37
- }),
38
- },
39
- ...(Array.isArray(sx) ? sx : sx ? [sx] : []),
40
- ], ...rest }));
41
- };
15
+ : typeof ownerState.fontWeight === 'number'
16
+ ? ownerState.fontWeight
17
+ : {
18
+ regular: theme.typography.fontWeightRegular,
19
+ medium: theme.typography.fontWeightMedium,
20
+ bold: theme.typography.fontWeightBold,
21
+ }[ownerState.fontWeight];
22
+ return {
23
+ color: {
24
+ primary: theme.palette.text.primary,
25
+ secondary: theme.palette.text.secondary,
26
+ muted: theme.palette.text.disabled,
27
+ }[ownerState.color],
28
+ ...(fontWeight !== undefined && { fontWeight }),
29
+ ...(ownerState.italic && { fontStyle: 'italic' }),
30
+ ...(ownerState.uppercase && { textTransform: 'uppercase' }),
31
+ ...(ownerState.clamp && {
32
+ display: '-webkit-box',
33
+ overflow: 'hidden',
34
+ WebkitLineClamp: ownerState.clamp,
35
+ WebkitBoxOrient: 'vertical',
36
+ }),
37
+ };
38
+ });
@@ -14,6 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export * from './theme';
17
+ export * from './components/Avatar';
17
18
  export * from './components/Button';
18
19
  export * from './components/IconButton';
19
20
  export * from './components/InspectorToggleButton';
@@ -94,6 +94,13 @@ export const muiTheme = createTheme({
94
94
  },
95
95
  },
96
96
  },
97
+ MuiAvatar: {
98
+ styleOverrides: {
99
+ root: {
100
+ fontWeight: 700,
101
+ },
102
+ },
103
+ },
97
104
  MuiIconButton: {
98
105
  styleOverrides: {
99
106
  root: {
@@ -40,6 +40,8 @@ interface DialogProps {
40
40
  message: string | React.ReactElement;
41
41
  className?: string;
42
42
  children?: React.ReactNode;
43
+ portaled?: boolean;
44
+ onExited?: () => void;
43
45
  }
44
46
  export declare enum Category {
45
47
  error = "error",
@@ -50,6 +52,7 @@ export declare enum Category {
50
52
  export declare class Dialog extends React.Component<DialogProps, DialogState> {
51
53
  state: DialogState;
52
54
  componentDidMount(): void;
55
+ Parent: React.FC<import("./StyledModal").StyledModalProps>;
53
56
  render(): React.JSX.Element;
54
57
  private renderButtons;
55
58
  private checkInputValue;
@@ -14,9 +14,10 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import React from 'react';
17
- interface StyledModalProps {
17
+ export interface StyledModalProps {
18
18
  isOpen: boolean;
19
19
  onRequestClose?: (e?: Event) => void;
20
+ onExited?: () => void;
20
21
  shouldCloseOnOverlayClick?: boolean;
21
22
  hideOverlay?: boolean;
22
23
  pointerEventsOnBackdrop?: 'all' | 'none' | 'auto';
@@ -549,4 +550,3 @@ export declare const ModalCardBody: import("styled-components/dist/types").IStyl
549
550
  $width?: number | string;
550
551
  }, never>>> & string;
551
552
  export declare const ModalTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never> & Partial<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>>> & string;
552
- export {};
@@ -22,7 +22,6 @@ export * from './components/Button';
22
22
  export * from './components/ContextMenu';
23
23
  export * from './components/RadioButton';
24
24
  export { StyledRadioGroup, type StyledRadioGroupOption, type StyledRadioGroupProps, } from './components/RadioGroup';
25
- export * from './components/Avatar';
26
25
  export * from './components/Dialog';
27
26
  export * from './components/DraggableModal';
28
27
  export * from './components/Checkbox';
@@ -0,0 +1,24 @@
1
+ /*!
2
+ * © 2026 Atypon Systems LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { AvatarProps as MuiAvatarProps } from '@mui/material/Avatar';
17
+ import React from 'react';
18
+ export interface AvatarProps extends Omit<MuiAvatarProps, 'children' | 'color'> {
19
+ size: number;
20
+ name?: string;
21
+ color?: string;
22
+ opacity?: number;
23
+ }
24
+ export declare const Avatar: ({ size, name, color, opacity, src, alt, ...rest }: AvatarProps) => React.JSX.Element;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * © 2019 Atypon Systems LLC
2
+ * © 2026 Atypon Systems LLC
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -13,13 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import React from 'react';
17
- interface AvatarProps {
18
- src?: string;
19
- size: number;
20
- color?: string;
21
- opacity?: number;
22
- name?: string;
23
- }
24
- export declare const Avatar: React.FC<AvatarProps>;
25
- export {};
16
+ export * from './Avatar';
@@ -26,4 +26,4 @@ export interface TypographyProps extends Omit<MuiTypographyProps, 'variant' | 'c
26
26
  uppercase?: boolean;
27
27
  clamp?: 2 | 3;
28
28
  }
29
- export declare const Typography: ({ variant, color, fontWeight, italic, uppercase, clamp, sx, ...rest }: TypographyProps) => React.JSX.Element;
29
+ export declare const Typography: ({ variant, color, fontWeight, italic, uppercase, clamp, ...rest }: TypographyProps) => React.JSX.Element;
@@ -14,6 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export * from './theme';
17
+ export * from './components/Avatar';
17
18
  export * from './components/Button';
18
19
  export * from './components/IconButton';
19
20
  export * from './components/InspectorToggleButton';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@manuscripts/style-guide",
3
3
  "description": "Shared components for Manuscripts applications",
4
- "version": "3.8.2",
4
+ "version": "3.8.4",
5
5
  "repository": "github:Atypon-OpenSource/manuscripts-style-guide",
6
6
  "license": "Apache-2.0",
7
7
  "main": "dist/cjs",
@@ -1,73 +0,0 @@
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.Avatar = void 0;
7
- const jsx_runtime_1 = require("react/jsx-runtime");
8
- const react_1 = require("react");
9
- const styled_components_1 = __importDefault(require("styled-components"));
10
- const icons_1 = require("./icons");
11
- const INITIALS_PALETTE = [
12
- '#1a9bc7',
13
- '#31a056',
14
- '#e65100',
15
- '#6a1b9a',
16
- '#c62828',
17
- '#1565c0',
18
- '#558b2f',
19
- '#00695c',
20
- ];
21
- const getInitials = (name) => {
22
- const words = name.trim().split(/\s+/);
23
- if (words.length === 1) {
24
- return words[0].slice(0, 2).toUpperCase();
25
- }
26
- return (words[0][0] + words[words.length - 1][0]).toUpperCase();
27
- };
28
- const AvatarContainer = styled_components_1.default.div `
29
- display: flex;
30
- align-items: center;
31
- justify-content: center;
32
- position: relative;
33
- opacity: ${(props) => props.$opacity};
34
- `;
35
- const RoundedImage = styled_components_1.default.img `
36
- width: ${(props) => props.$size}px;
37
- height: ${(props) => props.$size}px;
38
- border-radius: 50%;
39
- align-items: center;
40
- justify-content: center;
41
- `;
42
- const StyledAvatar = (0, styled_components_1.default)(icons_1.ProfileIcon) `
43
- path {
44
- fill: ${(props) => props.$color || props.theme.colors.text.secondary};
45
- }
46
-
47
- &:hover path {
48
- fill: ${(props) => props.$color || props.theme.colors.text.info};
49
- }
50
- `;
51
- const InitialsCircle = styled_components_1.default.div `
52
- width: ${(props) => props.$size}px;
53
- height: ${(props) => props.$size}px;
54
- border-radius: 50%;
55
- background: ${(props) => props.$bg};
56
- color: #ffffff;
57
- font-weight: bold;
58
- font-size: ${(props) => Math.round(props.$size * 0.4)}px;
59
- display: flex;
60
- align-items: center;
61
- justify-content: center;
62
- user-select: none;
63
- flex-shrink: 0;
64
- `;
65
- const Avatar = (props) => {
66
- const [srcError, setSrcError] = (0, react_1.useState)(false);
67
- const handleSrcError = (0, react_1.useCallback)(() => {
68
- setSrcError(true);
69
- }, []);
70
- const showInitials = (!props.src || srcError) && !!props.name;
71
- return ((0, jsx_runtime_1.jsx)(AvatarContainer, { "$opacity": props.opacity || 1, children: props.src && !srcError ? ((0, jsx_runtime_1.jsx)(RoundedImage, { src: props.src, "$size": props.size, onError: handleSrcError })) : showInitials ? ((0, jsx_runtime_1.jsx)(InitialsCircle, { "$size": props.size, "$bg": INITIALS_PALETTE[props.name.charCodeAt(0) % INITIALS_PALETTE.length], children: getInitials(props.name) })) : ((0, jsx_runtime_1.jsx)(StyledAvatar, { height: props.size, width: props.size, "$color": props.color })) }));
72
- };
73
- exports.Avatar = Avatar;
@@ -1,40 +0,0 @@
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.Avatar = void 0;
7
- const jsx_runtime_1 = require("react/jsx-runtime");
8
- const react_1 = require("react");
9
- const styled_components_1 = __importDefault(require("styled-components"));
10
- const icons_1 = require("./icons");
11
- const SystemUserAvatarContainer = styled_components_1.default.div `
12
- display: flex;
13
- align-items: center;
14
- justify-content: center;
15
- position: relative;
16
- `;
17
- const RoundedImage = styled_components_1.default.img `
18
- width: ${(props) => props.$size}px;
19
- height: ${(props) => props.$size}px;
20
- border-radius: 50%;
21
- align-items: center;
22
- justify-content: center;
23
- `;
24
- const StyledAvatar = (0, styled_components_1.default)(icons_1.SystemUserAvatarIcon) `
25
- path {
26
- fill: ${(props) => props.$color || props.theme.colors.text.secondary};
27
- }
28
-
29
- &:hover path {
30
- fill: ${(props) => props.$color || props.theme.colors.text.info};
31
- }
32
- `;
33
- const Avatar = (props) => {
34
- const [srcError, setSrcError] = (0, react_1.useState)(false);
35
- const handleSrcError = (0, react_1.useCallback)(() => {
36
- setSrcError(true);
37
- }, []);
38
- return ((0, jsx_runtime_1.jsx)(SystemUserAvatarContainer, { children: props.src && !srcError ? ((0, jsx_runtime_1.jsx)(RoundedImage, { src: props.src, "$size": props.size, onError: handleSrcError })) : ((0, jsx_runtime_1.jsx)(StyledAvatar, { height: props.size, width: props.size, "$color": props.color })) }));
39
- };
40
- exports.Avatar = Avatar;
@@ -1,66 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useCallback, useState } from 'react';
3
- import styled from 'styled-components';
4
- import { ProfileIcon } from './icons';
5
- const INITIALS_PALETTE = [
6
- '#1a9bc7',
7
- '#31a056',
8
- '#e65100',
9
- '#6a1b9a',
10
- '#c62828',
11
- '#1565c0',
12
- '#558b2f',
13
- '#00695c',
14
- ];
15
- const getInitials = (name) => {
16
- const words = name.trim().split(/\s+/);
17
- if (words.length === 1) {
18
- return words[0].slice(0, 2).toUpperCase();
19
- }
20
- return (words[0][0] + words[words.length - 1][0]).toUpperCase();
21
- };
22
- const AvatarContainer = styled.div `
23
- display: flex;
24
- align-items: center;
25
- justify-content: center;
26
- position: relative;
27
- opacity: ${(props) => props.$opacity};
28
- `;
29
- const RoundedImage = styled.img `
30
- width: ${(props) => props.$size}px;
31
- height: ${(props) => props.$size}px;
32
- border-radius: 50%;
33
- align-items: center;
34
- justify-content: center;
35
- `;
36
- const StyledAvatar = styled(ProfileIcon) `
37
- path {
38
- fill: ${(props) => props.$color || props.theme.colors.text.secondary};
39
- }
40
-
41
- &:hover path {
42
- fill: ${(props) => props.$color || props.theme.colors.text.info};
43
- }
44
- `;
45
- const InitialsCircle = styled.div `
46
- width: ${(props) => props.$size}px;
47
- height: ${(props) => props.$size}px;
48
- border-radius: 50%;
49
- background: ${(props) => props.$bg};
50
- color: #ffffff;
51
- font-weight: bold;
52
- font-size: ${(props) => Math.round(props.$size * 0.4)}px;
53
- display: flex;
54
- align-items: center;
55
- justify-content: center;
56
- user-select: none;
57
- flex-shrink: 0;
58
- `;
59
- export const Avatar = (props) => {
60
- const [srcError, setSrcError] = useState(false);
61
- const handleSrcError = useCallback(() => {
62
- setSrcError(true);
63
- }, []);
64
- const showInitials = (!props.src || srcError) && !!props.name;
65
- return (_jsx(AvatarContainer, { "$opacity": props.opacity || 1, children: props.src && !srcError ? (_jsx(RoundedImage, { src: props.src, "$size": props.size, onError: handleSrcError })) : showInitials ? (_jsx(InitialsCircle, { "$size": props.size, "$bg": INITIALS_PALETTE[props.name.charCodeAt(0) % INITIALS_PALETTE.length], children: getInitials(props.name) })) : (_jsx(StyledAvatar, { height: props.size, width: props.size, "$color": props.color })) }));
66
- };
@@ -1,33 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useCallback, useState } from 'react';
3
- import styled from 'styled-components';
4
- import { SystemUserAvatarIcon } from './icons';
5
- const SystemUserAvatarContainer = styled.div `
6
- display: flex;
7
- align-items: center;
8
- justify-content: center;
9
- position: relative;
10
- `;
11
- const RoundedImage = styled.img `
12
- width: ${(props) => props.$size}px;
13
- height: ${(props) => props.$size}px;
14
- border-radius: 50%;
15
- align-items: center;
16
- justify-content: center;
17
- `;
18
- const StyledAvatar = styled(SystemUserAvatarIcon) `
19
- path {
20
- fill: ${(props) => props.$color || props.theme.colors.text.secondary};
21
- }
22
-
23
- &:hover path {
24
- fill: ${(props) => props.$color || props.theme.colors.text.info};
25
- }
26
- `;
27
- export const Avatar = (props) => {
28
- const [srcError, setSrcError] = useState(false);
29
- const handleSrcError = useCallback(() => {
30
- setSrcError(true);
31
- }, []);
32
- return (_jsx(SystemUserAvatarContainer, { children: props.src && !srcError ? (_jsx(RoundedImage, { src: props.src, "$size": props.size, onError: handleSrcError })) : (_jsx(StyledAvatar, { height: props.size, width: props.size, "$color": props.color })) }));
33
- };