@mrktg-common/internal-ui 1.4.0 → 1.5.1

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/Badge.d.ts CHANGED
@@ -16,8 +16,8 @@ export type TStatus = 'live' | 'draft' | 'publishing' | 'error' | 'unpublished'
16
16
  export interface IStatusBadgeProps {
17
17
  status: TStatus;
18
18
  /**
19
- * Live вне продакшена (Test, dev-админка) нейтральный с точкой: зелёный только у того,
20
- * что видят снаружи. Для остальных статусов не влияет.
19
+ * @deprecated С 1.5.0 Live зелёный в любом окружении (где живой — говорят Dev-плашка и PROD / TEST),
20
+ * проп ни на что не влияет. Удалить из вызовов; уберётся в следующей мажорной версии.
21
21
  */
22
22
  production?: boolean;
23
23
  /** Подпись вместо стандартной: «Live · v3», «Live on test». */
@@ -25,4 +25,4 @@ export interface IStatusBadgeProps {
25
25
  title?: string;
26
26
  }
27
27
  /** Статус из согласованного набора: у каждого свой знак, набор читается и в оттенках серого. */
28
- export declare function StatusBadge({ status, production, label, title }: IStatusBadgeProps): import("react").JSX.Element;
28
+ export declare function StatusBadge({ status, label, title }: IStatusBadgeProps): import("react").JSX.Element;
package/dist/Badge.js CHANGED
@@ -16,8 +16,7 @@ const STATUS = {
16
16
  'never-published': { tone: 'outline', label: 'Never published' },
17
17
  };
18
18
  /** Статус из согласованного набора: у каждого свой знак, набор читается и в оттенках серого. */
19
- export function StatusBadge({ status, production = true, label, title }) {
19
+ export function StatusBadge({ status, label, title }) {
20
20
  const look = STATUS[status];
21
- const tone = status === 'live' && !production ? 'neutral' : look.tone;
22
- return (_jsx(Badge, { tone: tone, mark: look.mark, icon: look.icon, title: title, children: label ?? look.label }));
21
+ return (_jsx(Badge, { tone: look.tone, mark: look.mark, icon: look.icon, title: title, children: label ?? look.label }));
23
22
  }
package/dist/Table.d.ts CHANGED
@@ -15,6 +15,8 @@ export type TTableColumn<T, K extends string> = {
15
15
  header: ReactNode;
16
16
  /** Ширина колонки (px или %); без неё колонка забирает остаток. */
17
17
  width?: number | string;
18
+ /** Для колонки без width: уже этого таблица не сжимает остаток, а прокручивается. */
19
+ minWidth?: number;
18
20
  sortable?: boolean;
19
21
  /** Направление при первом клике: имена — A→Z, даты — новые сверху. */
20
22
  defaultDirection?: TSortDirection;
@@ -36,7 +38,7 @@ export interface ITableProps<T, K extends string> {
36
38
  rowClassName?: (row: T) => string | undefined;
37
39
  loading?: boolean;
38
40
  skeletonRows?: number;
39
- /** Ширина, уже которой таблица прокручивается внутри рамки, а не страница. */
41
+ /** Ширина, уже которой таблица прокручивается внутри рамки, а не страница. Не меньше суммы колонок, см. tableMinWidth. */
40
42
  minWidth?: number;
41
43
  /** Вместо строк: пусто, ничего не найдено, ошибка. */
42
44
  placeholder?: ReactNode;
@@ -48,6 +50,12 @@ export interface ITableProps<T, K extends string> {
48
50
  loadingLabel?: string;
49
51
  className?: string;
50
52
  }
53
+ /**
54
+ * Минимальная ширина таблицы: фиксированные колонки плюс минимум колонок без ширины, с поправкой на колонки в %.
55
+ * При table-layout: fixed колонка без ширины получает только остаток, и заданный вручную minWidth
56
+ * легко оставляет ей ноль: колонка пропадает.
57
+ */
58
+ export declare function tableMinWidth<T, K extends string>(columns: TTableColumn<T, K>[], minWidth?: number): number;
51
59
  /** Таблица списков: липкая шапка 36, строки 52, сортировка кнопками в заголовках. */
52
60
  export declare function Table<T, K extends string>({ columns, rows, groups, rowKey, sort, onSortChange, onRowClick, rowClassName, loading, skeletonRows, minWidth, placeholder, footer, footerEnd, loadingLabel, 'aria-label': label, className, }: ITableProps<T, K>): import("react").JSX.Element;
53
61
  /** Главный текст ячейки и строка под ним; обе обрезаются с подсказкой, таблица не переносит. */
package/dist/Table.js CHANGED
@@ -4,6 +4,26 @@ import { ArrowDown, ArrowUp } from 'lucide-react';
4
4
  import { cx } from './cx.js';
5
5
  import { Skeleton } from './Skeleton.js';
6
6
  const DEFAULT_SKELETON_ROWS = 7;
7
+ const FLEXIBLE_COLUMN_MIN_WIDTH = 120;
8
+ /**
9
+ * Минимальная ширина таблицы: фиксированные колонки плюс минимум колонок без ширины, с поправкой на колонки в %.
10
+ * При table-layout: fixed колонка без ширины получает только остаток, и заданный вручную minWidth
11
+ * легко оставляет ей ноль: колонка пропадает.
12
+ */
13
+ export function tableMinWidth(columns, minWidth = 0) {
14
+ let fixed = 0;
15
+ let percent = 0;
16
+ for (const column of columns) {
17
+ if (typeof column.width === 'number')
18
+ fixed += column.width;
19
+ else if (typeof column.width === 'string' && column.width.endsWith('%'))
20
+ percent += Number.parseFloat(column.width);
21
+ else if (column.width === undefined)
22
+ fixed += column.minWidth ?? FLEXIBLE_COLUMN_MIN_WIDTH;
23
+ }
24
+ const total = percent > 0 && percent < 100 ? fixed / (1 - percent / 100) : fixed;
25
+ return Math.max(minWidth, Math.ceil(total));
26
+ }
7
27
  const INTERACTIVE = 'a, button, input, select, textarea, label, [role="menu"], [role="listbox"]';
8
28
  /** Таблица списков: липкая шапка 36, строки 52, сортировка кнопками в заголовках. */
9
29
  export function Table({ columns, rows, groups, rowKey, sort, onSortChange, onRowClick, rowClassName, loading = false, skeletonRows = DEFAULT_SKELETON_ROWS, minWidth, placeholder, footer, footerEnd, loadingLabel, 'aria-label': label, className, }) {
@@ -23,7 +43,7 @@ export function Table({ columns, rows, groups, rowKey, sort, onSortChange, onRow
23
43
  onRowClick?.(row);
24
44
  };
25
45
  const renderRow = (row) => (_jsx("tr", { className: cx(onRowClick !== undefined && 'is-link', rowClassName?.(row)), onClick: onRowClick === undefined ? undefined : handleRowClick(row), children: columns.map((column) => (_jsx("td", { className: cx(column.align === 'end' && 'end'), children: column.render(row) }, column.key))) }, rowKey(row)));
26
- return (_jsxs("div", { className: cx('tbl-box', className), children: [showPlaceholder ? placeholder : (_jsxs("div", { className: "tbl-scroll", children: [_jsxs("table", { className: "tbl", style: minWidth === undefined ? undefined : { minWidth }, "aria-label": label, "aria-busy": loading || undefined, children: [_jsx("thead", { children: _jsx("tr", { children: columns.map((column) => {
46
+ return (_jsxs("div", { className: cx('tbl-box', className), children: [showPlaceholder ? placeholder : (_jsxs("div", { className: "tbl-scroll", children: [_jsxs("table", { className: "tbl", style: { minWidth: tableMinWidth(columns, minWidth) }, "aria-label": label, "aria-busy": loading || undefined, children: [_jsx("thead", { children: _jsx("tr", { children: columns.map((column) => {
27
47
  const sorted = sort?.key === column.key ? sort.direction : undefined;
28
48
  return (_jsx("th", { scope: "col", className: cx(column.align === 'end' && 'end'), style: column.width === undefined ? undefined : { width: column.width }, "aria-sort": sorted === undefined ? undefined : sorted === 'asc' ? 'ascending' : 'descending', children: column.sortable && onSortChange !== undefined ? (_jsxs("button", { type: "button", className: "th-sort", onClick: () => toggleSort(column), children: [column.header, sorted === 'asc' && _jsx(ArrowUp, { className: "ic", "aria-hidden": true }), sorted === 'desc' && _jsx(ArrowDown, { className: "ic", "aria-hidden": true })] })) : column.header }, column.key));
29
49
  }) }) }), _jsx("tbody", { children: loading
package/dist/Toast.d.ts CHANGED
@@ -7,7 +7,7 @@ export type TToastAction = {
7
7
  icon?: LucideIcon;
8
8
  };
9
9
  export type TToast = {
10
- /** neutral — сохранено, удалено, скопировано; success — только «vN is live on Production». */
10
+ /** neutral — сохранено, удалено, скопировано; success — только «vN is live» (на Production или Test). */
11
11
  tone?: TToastTone;
12
12
  /** Иконка вместо стандартной для тона: корзина у удаления и т. п. */
13
13
  icon?: LucideIcon;
@@ -141,7 +141,7 @@
141
141
  .hint { font-size: var(--text-sm); line-height: var(--leading-normal); color: var(--text-muted); }
142
142
  .err { display: flex; align-items: center; gap: var(--space-1); font-size: var(--text-sm); color: var(--danger-text); }
143
143
  .err > .ic, .ok > .ic { align-self: flex-start; margin-top: 2px; }
144
- /* Positive check under a field: neutral, green is kept for “live on production”. */
144
+ /* Positive check under a field: neutral, green is kept for Live. */
145
145
  .ok { display: flex; align-items: center; gap: var(--space-1); font-size: var(--text-sm); color: var(--text-muted); }
146
146
  .control { width: 100%; min-height: var(--control-height-md); padding: 0 var(--space-3); border: 1px solid var(--border-strong);
147
147
  border-radius: var(--radius-md); background: var(--surface); color: var(--text); font: 400 var(--text-md) / 1.4 var(--font-ui);
@@ -371,7 +371,7 @@
371
371
  .app a.copy-act { color: var(--text-muted); text-decoration: none; }
372
372
  .copy-act:hover, .copy-act.is-hover, .app a.copy-act:hover { background: var(--bg-subtle); color: var(--text); text-decoration: none; }
373
373
  .copy-act:focus-visible, .copy-act.is-focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
374
- /* Copied: neutral with a check; green is kept for “live on production”. */
374
+ /* Copied: neutral with a check; green is kept for Live. */
375
375
  .copy-act.is-done, .app a.copy-act.is-done { color: var(--text); background: var(--bg-subtle); }
376
376
  .copy-act:disabled, .copy-act[aria-disabled='true'] { opacity: 0.55; cursor: not-allowed; background: transparent; }
377
377
 
@@ -431,9 +431,8 @@
431
431
  .tbl tbody tr.is-link:hover td, .tbl tr.is-hover td { background: var(--surface-hover); }
432
432
  .tbl tr.is-archived td { background: var(--bg-subtle); }
433
433
  .tbl tr.is-archived .cell-main { color: var(--text-muted); }
434
- /* Live version row: green tint on production only; on Test and Dev it is neutral. */
434
+ /* Live version row: green tint in every environment; the version cell or the environment chip says where. */
435
435
  .tbl tr.is-current td { background: color-mix(in srgb, var(--success-soft) 60%, var(--surface)); }
436
- .tbl tr.is-current.is-nonprod td { background: var(--bg); }
437
436
  /* Group heading inside a table: Upcoming, Past 30 days. */
438
437
  .tbl tr.grp td { height: 32px; padding-top: 0; padding-bottom: 0; background: var(--bg); font-size: var(--text-sm); font-weight: 600; color: var(--text-muted); }
439
438
  .tbl tbody tr.grp:hover td { background: var(--bg); }
@@ -495,7 +494,7 @@
495
494
  .report-row + .report-row { border-top: 1px solid var(--border); }
496
495
  .report-row > .ic { margin-top: 2px; }
497
496
  .report-row > .report-text { flex: 1; min-width: 0; }
498
- /* A passed check is neutral: green is kept for “live on production”. */
497
+ /* A passed check is neutral: green is kept for Live. */
499
498
  .c-ok { color: var(--text-muted); }
500
499
  .c-info { color: var(--accent); }
501
500
  .c-warn { color: var(--warning); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrktg-common/internal-ui",
3
- "version": "1.4.0",
3
+ "version": "1.5.1",
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.4.0",
5
+ "release": "1.5.1",
6
6
  "source": "lp-constructor src/styles/tokens.css + Landings Admin admin.css, merged 2026-10-12"
7
7
  },
8
8
  "color": {
@@ -143,7 +143,7 @@
143
143
  "light": "#1f9d55",
144
144
  "dark": "#34c073"
145
145
  },
146
- "usage": "Icon only: toast icon for “vN is live on Production”. Green means live on production and nothing else."
146
+ "usage": "Icon only: toast icon for “vN is live”. Green means Live, in any environment, and nothing else."
147
147
  },
148
148
  {
149
149
  "name": "success-soft",
@@ -151,7 +151,7 @@
151
151
  "light": "#e6f6ec",
152
152
  "dark": "rgba(52, 192, 115, 0.16)"
153
153
  },
154
- "usage": "Fill of the Live on production badge and the live version row."
154
+ "usage": "Fill of the Live badge and the live version row, in any environment."
155
155
  },
156
156
  {
157
157
  "name": "success-text",
@@ -159,7 +159,7 @@
159
159
  "light": "#187a43",
160
160
  "dark": "#7ad9a3"
161
161
  },
162
- "usage": "Live on production badge text on success-soft (4.8:1 light, 6.9:1 dark)."
162
+ "usage": "Live badge text on success-soft (4.8:1 light, 6.9:1 dark)."
163
163
  },
164
164
  {
165
165
  "name": "warning",