@mrktg-common/internal-ui 1.16.0 → 1.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Modal.d.ts CHANGED
@@ -3,6 +3,8 @@ export type TModalSize = 'sm' | 'md' | 'lg';
3
3
  export interface IModalProps {
4
4
  open: boolean;
5
5
  title: string;
6
+ /** Короткий статус рядом с заголовком: Badge или Env («Connected before», «Draft»). В имя окна не входит; действия — в футер. */
7
+ titleAside?: ReactNode;
6
8
  subtitle?: ReactNode;
7
9
  size?: TModalSize;
8
10
  /** Ширина не из набора размеров (окно события расписания, 600). */
@@ -23,4 +25,4 @@ export interface IModalProps {
23
25
  * Окно для коротких решений и маленьких форм. Фокус не выходит из окна; Esc и клик по фону закрывают,
24
26
  * если onClose задан. Cancel в футере — secondary, главная кнопка называет действие.
25
27
  */
26
- export declare function Modal({ open, title, subtitle, size, width, onClose, footer, footerStart, flush, bodyStyle, initialFocus, children }: IModalProps): import("react").JSX.Element | null;
28
+ export declare function Modal({ open, title, titleAside, subtitle, size, width, onClose, footer, footerStart, flush, bodyStyle, initialFocus, children }: IModalProps): import("react").JSX.Element | null;
package/dist/Modal.js CHANGED
@@ -4,15 +4,21 @@ import { useEffect, useId, useRef } from 'react';
4
4
  import { X } from 'lucide-react';
5
5
  import { cx } from './cx.js';
6
6
  import { FixedPortal } from './portal.js';
7
+ import { devError } from './devWarn.js';
7
8
  const FOCUSABLE = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
8
9
  /**
9
10
  * Окно для коротких решений и маленьких форм. Фокус не выходит из окна; Esc и клик по фону закрывают,
10
11
  * если onClose задан. Cancel в футере — secondary, главная кнопка называет действие.
11
12
  */
12
- export function Modal({ open, title, subtitle, size = 'md', width, onClose, footer, footerStart, flush = false, bodyStyle, initialFocus, children }) {
13
+ export function Modal({ open, title, titleAside, subtitle, size = 'md', width, onClose, footer, footerStart, flush = false, bodyStyle, initialFocus, children }) {
13
14
  const modalRef = useRef(null);
14
15
  const titleId = useId();
15
16
  const previous = useRef(null);
17
+ const asideRef = useRef(null);
18
+ useEffect(() => {
19
+ if (asideRef.current?.querySelector('button, a[href]'))
20
+ devError('Modal: titleAside is a status, not an action; put buttons and links in the footer.');
21
+ });
16
22
  useEffect(() => {
17
23
  if (!open)
18
24
  return;
@@ -62,5 +68,5 @@ export function Modal({ open, title, subtitle, size = 'md', width, onClose, foot
62
68
  if (event.target === event.currentTarget)
63
69
  onClose?.();
64
70
  };
65
- return (_jsx(FixedPortal, { children: _jsx("div", { className: "overlay is-fixed", onMouseDown: closeOnOverlay, children: _jsxs("div", { ref: modalRef, className: cx('modal', `modal-${size}`), style: width === undefined ? undefined : { maxWidth: width }, role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown: trapFocus, children: [_jsxs("div", { className: "modal-head", children: [_jsxs("div", { className: "modal-heading", children: [_jsx("h2", { className: "modal-title", id: titleId, children: title }), subtitle !== undefined && _jsx("span", { className: "modal-sub", children: subtitle })] }), onClose !== null && (_jsx("button", { type: "button", className: "btn btn-ghost btn-sm btn-icon", "aria-label": "Close", onClick: onClose, children: _jsx(X, { className: "ic", "aria-hidden": true }) }))] }), _jsx("div", { className: cx('modal-body', flush && 'flush'), style: bodyStyle, children: children }), footer !== undefined && (_jsxs("div", { className: "modal-foot", children: [typeof footerStart === 'string' ? _jsx("span", { className: "start", children: footerStart }) : footerStart !== undefined && _jsx("div", { className: "start", children: footerStart }), footer] }))] }) }) }));
71
+ return (_jsx(FixedPortal, { children: _jsx("div", { className: "overlay is-fixed", onMouseDown: closeOnOverlay, children: _jsxs("div", { ref: modalRef, className: cx('modal', `modal-${size}`), style: width === undefined ? undefined : { maxWidth: width }, role: "dialog", "aria-modal": "true", "aria-labelledby": titleId, tabIndex: -1, onKeyDown: trapFocus, children: [_jsxs("div", { className: "modal-head", children: [_jsxs("div", { className: "modal-heading", children: [titleAside === undefined ? (_jsx("h2", { className: "modal-title", id: titleId, children: title })) : (_jsxs("div", { className: "modal-title-row", children: [_jsx("h2", { className: "modal-title", id: titleId, children: title }), _jsx("div", { ref: asideRef, className: "modal-title-aside", children: titleAside })] })), subtitle !== undefined && _jsx("span", { className: "modal-sub", children: subtitle })] }), onClose !== null && (_jsx("button", { type: "button", className: "btn btn-ghost btn-sm btn-icon", "aria-label": "Close", onClick: onClose, children: _jsx(X, { className: "ic", "aria-hidden": true }) }))] }), _jsx("div", { className: cx('modal-body', flush && 'flush'), style: bodyStyle, children: children }), footer !== undefined && (_jsxs("div", { className: "modal-foot", children: [typeof footerStart === 'string' ? _jsx("span", { className: "start", children: footerStart }) : footerStart !== undefined && _jsx("div", { className: "start", children: footerStart }), footer] }))] }) }) }));
66
72
  }
@@ -429,6 +429,11 @@
429
429
  .modal-heading { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
430
430
  .modal-title { margin: 0; font-size: var(--text-lg); font-weight: 600; }
431
431
  .modal-sub { font-size: var(--text-sm); color: var(--text-muted); }
432
+ /* 1.17: a short status next to the title (Badge, Env tag). Centred on the title line, 8 px after it; when the title and
433
+ the aside don't fit on one line, the aside moves under the title. Outside the h2: not part of the window's name. */
434
+ .modal-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--space-2); min-width: 0; }
435
+ .modal-title-row > .modal-title { min-width: 0; overflow-wrap: anywhere; }
436
+ .modal-title-aside { display: inline-flex; align-items: center; gap: var(--space-1); flex-shrink: 0; }
432
437
  .modal-body { flex: 1; display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-5); overflow-y: auto; }
433
438
  .modal-body.flush { padding: 0; gap: 0; }
434
439
  .modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrktg-common/internal-ui",
3
- "version": "1.16.0",
3
+ "version": "1.17.0",
4
4
  "description": "Общий интерфейс внутренних инструментов маркетинга (Landings Admin, LP Constructor): токены, классы компонентов и тонкие React-обёртки над ними.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -2,7 +2,7 @@
2
2
  "name": "Internal ui",
3
3
  "version": 1,
4
4
  "meta": {
5
- "release": "1.16.0",
5
+ "release": "1.17.0",
6
6
  "source": "lp-constructor src/styles/tokens.css + Landings Admin admin.css, merged 2026-10-12"
7
7
  },
8
8
  "color": {