@mrktg-common/internal-ui 1.2.0 → 1.3.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/README.md +7 -0
- package/dist/Button.d.ts +2 -15
- package/dist/Button.js +1 -4
- package/dist/ChangeBlock.d.ts +2 -1
- package/dist/ChangeBlock.js +1 -1
- package/dist/MultiSelectMenu.js +1 -1
- package/dist/Search.d.ts +1 -1
- package/dist/Search.js +13 -2
- package/dist/SelectMenu.js +1 -1
- package/dist/buttonClass.d.ts +15 -0
- package/dist/buttonClass.js +6 -0
- package/dist/components.css +2 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +3 -1
- package/package.json +3 -2
- package/tokens/tokens.json +1 -1
package/README.md
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
и дизайн-система Internal ui: токены, классы компонентов, карточки с правилами и превью. Артефакт системы
|
|
5
5
|
в claude.ai собирается из этого репозитория, версия у пакета и системы одна.
|
|
6
6
|
|
|
7
|
+
Посмотреть систему: [страница в S3](https://int-components.s3.amazonaws.com/internal-ui/master/index.html)
|
|
8
|
+
(обновляется с каждым пушем в master), [артефакт в claude.ai](https://claude.ai/artifact/3fB9BQJv9cSkzYd4q3qhxB).
|
|
9
|
+
|
|
7
10
|
## Что внутри
|
|
8
11
|
|
|
9
12
|
- `tokens.css` — переменные обеих тем, генерируется из `tokens/tokens.json`.
|
|
@@ -24,6 +27,10 @@
|
|
|
24
27
|
`package.json` и ссылкой на коммит, `tokens.css` тем же генератором, что и пакет, классы, карточки, разделы
|
|
25
28
|
и `CHANGELOG.md` разделом. Тест проверяет, что пакет и артефакт получают одинаковые `tokens.css` и классы.
|
|
26
29
|
|
|
30
|
+
Там же собирается `design-dist/site/`: статическая страница системы для тех, у кого нет доступа к артефакту.
|
|
31
|
+
CI выкладывает её во внутренний S3-бакет int-components: [`internal-ui/master/`](https://int-components.s3.amazonaws.com/internal-ui/master/index.html) с master, `internal-ui/vX.Y.Z/` с тегов,
|
|
32
|
+
`internal-ui/<ветка>/` для MR. Переменные CI те же, что у int-components.
|
|
33
|
+
|
|
27
34
|
## Подключение
|
|
28
35
|
|
|
29
36
|
```bash
|
package/dist/Button.d.ts
CHANGED
|
@@ -1,19 +1,6 @@
|
|
|
1
1
|
import type { ComponentProps } from 'react';
|
|
2
|
-
|
|
3
|
-
export type TButtonSize
|
|
4
|
-
export interface IButtonStyle {
|
|
5
|
-
variant?: TButtonVariant;
|
|
6
|
-
size?: TButtonSize;
|
|
7
|
-
/** Квадратная кнопка с одной иконкой: подпись в aria-label и подсказке. */
|
|
8
|
-
iconOnly?: boolean;
|
|
9
|
-
/** Фильтр со значением (secondary) или включённый переключатель (ghost). */
|
|
10
|
-
active?: boolean;
|
|
11
|
-
block?: boolean;
|
|
12
|
-
/** Ghost-кнопка опасного действия краснеет при наведении. */
|
|
13
|
-
dangerHover?: boolean;
|
|
14
|
-
}
|
|
15
|
-
/** Классы кнопки для ссылок роутера, которые выглядят как кнопка. */
|
|
16
|
-
export declare function buttonClass({ variant, size, iconOnly, active, block, dangerHover }?: IButtonStyle, className?: string): string;
|
|
2
|
+
import { type IButtonStyle } from './buttonClass.ts';
|
|
3
|
+
export type { IButtonStyle, TButtonSize, TButtonVariant } from './buttonClass.ts';
|
|
17
4
|
export interface IButtonProps extends ComponentProps<'button'>, IButtonStyle {
|
|
18
5
|
/** Идёт действие: спиннер перед подписью, нажатия не проходят. */
|
|
19
6
|
busy?: boolean;
|
package/dist/Button.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { cx } from './cx.js';
|
|
4
|
-
|
|
5
|
-
export function buttonClass({ variant = 'secondary', size = 'md', iconOnly, active, block, dangerHover } = {}, className) {
|
|
6
|
-
return cx('btn', `btn-${variant}`, size === 'sm' && 'btn-sm', iconOnly && 'btn-icon', active && (variant === 'ghost' ? 'is-on' : 'is-active'), block && 'btn-block', dangerHover && 'danger-hover', className);
|
|
7
|
-
}
|
|
4
|
+
import { buttonClass } from './buttonClass.js';
|
|
8
5
|
function isAriaDisabled(value) {
|
|
9
6
|
return value === true || value === 'true';
|
|
10
7
|
}
|
package/dist/ChangeBlock.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ export type TChangeSide = {
|
|
|
3
3
|
label: ReactNode;
|
|
4
4
|
/** null — после действия на сайте ничего: «Not on the site» красным. */
|
|
5
5
|
value: ReactNode | null;
|
|
6
|
-
|
|
6
|
+
/** Строки под значением: дата, кто; массив — по строке на элемент. */
|
|
7
|
+
meta?: ReactNode | ReactNode[];
|
|
7
8
|
};
|
|
8
9
|
export interface IChangeBlockProps {
|
|
9
10
|
from: TChangeSide;
|
package/dist/ChangeBlock.js
CHANGED
|
@@ -3,6 +3,6 @@ import { ArrowRight } from 'lucide-react';
|
|
|
3
3
|
import { cx } from './cx.js';
|
|
4
4
|
/** «Было → станет» в окне подтверждения: что изменит действие, до нажатия. */
|
|
5
5
|
export function ChangeBlock({ from, to, small = false, offLabel = 'Not on the site' }) {
|
|
6
|
-
const side = (item, target) => (_jsxs("div", { className: "change-side", children: [_jsx("span", { className: "change-label", children: item.label }), item.value === null ? (_jsx("span", { className: "change-off", children: offLabel })) : (_jsx("span", { className: cx('change-v', small && 'change-v-sm', target && 'is-target'), children: item.value })), item.meta
|
|
6
|
+
const side = (item, target) => (_jsxs("div", { className: "change-side", children: [_jsx("span", { className: "change-label", children: item.label }), item.value === null ? (_jsx("span", { className: "change-off", children: offLabel })) : (_jsx("span", { className: cx('change-v', small && 'change-v-sm', target && 'is-target'), children: item.value })), (Array.isArray(item.meta) ? item.meta : item.meta === undefined ? [] : [item.meta]).map((line, index) => (_jsx("span", { className: "change-meta", children: line }, index)))] }));
|
|
7
7
|
return (_jsxs("div", { className: "change", "aria-label": "What changes", children: [side(from, false), _jsx(ArrowRight, { className: "ic", "aria-hidden": true }), side(to, true)] }));
|
|
8
8
|
}
|
package/dist/MultiSelectMenu.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Fragment, useState } from 'react';
|
|
4
4
|
import { ChevronDown } from 'lucide-react';
|
|
5
|
-
import { buttonClass } from './
|
|
5
|
+
import { buttonClass } from './buttonClass.js';
|
|
6
6
|
import { Popover } from './Popover.js';
|
|
7
7
|
/**
|
|
8
8
|
* Фильтр по нескольким значениям. Применяется сразу, как отмечаешь, без Apply; внизу Clear.
|
package/dist/Search.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ export interface ISearchProps extends Omit<ComponentProps<'input'>, 'size' | 'va
|
|
|
9
9
|
width?: number | string;
|
|
10
10
|
}
|
|
11
11
|
/** Поле поиска: иконка слева, кнопка очистки, пока есть запрос; Esc тоже очищает. */
|
|
12
|
-
export declare function Search({ value, onChange, label, size, width, className, onKeyDown, ...rest }: ISearchProps): import("react").JSX.Element;
|
|
12
|
+
export declare function Search({ value, onChange, label, size, width, className, onKeyDown, ref, ...rest }: ISearchProps): import("react").JSX.Element;
|
package/dist/Search.js
CHANGED
|
@@ -4,13 +4,18 @@ import { useRef } from 'react';
|
|
|
4
4
|
import { Search as SearchIcon, X } from 'lucide-react';
|
|
5
5
|
import { cx } from './cx.js';
|
|
6
6
|
/** Поле поиска: иконка слева, кнопка очистки, пока есть запрос; Esc тоже очищает. */
|
|
7
|
-
export function Search({ value, onChange, label, size = 'md', width, className, onKeyDown, ...rest }) {
|
|
7
|
+
export function Search({ value, onChange, label, size = 'md', width, className, onKeyDown, ref, ...rest }) {
|
|
8
8
|
const inputRef = useRef(null);
|
|
9
|
+
// Свой ref нужен кнопке очистки, внешний — продукту (фокус по горячей клавише)
|
|
10
|
+
const setRef = (node) => {
|
|
11
|
+
inputRef.current = node;
|
|
12
|
+
assignRef(ref, node);
|
|
13
|
+
};
|
|
9
14
|
const clear = () => {
|
|
10
15
|
onChange('');
|
|
11
16
|
inputRef.current?.focus();
|
|
12
17
|
};
|
|
13
|
-
return (_jsxs("label", { className: cx('with-icon', className), style: width === undefined ? undefined : { width }, children: [_jsx(SearchIcon, { className: "ic", "aria-hidden": true }), _jsx("span", { className: "sr-only", children: label }), _jsx("input", { ref:
|
|
18
|
+
return (_jsxs("label", { className: cx('with-icon', className), style: width === undefined ? undefined : { width }, children: [_jsx(SearchIcon, { className: "ic", "aria-hidden": true }), _jsx("span", { className: "sr-only", children: label }), _jsx("input", { ref: setRef, className: cx('control', size === 'sm' && 'control-sm'), type: "search", value: value, onChange: (event) => onChange(event.target.value), onKeyDown: (event) => {
|
|
14
19
|
if (event.key === 'Escape' && value !== '') {
|
|
15
20
|
event.preventDefault();
|
|
16
21
|
event.stopPropagation();
|
|
@@ -19,3 +24,9 @@ export function Search({ value, onChange, label, size = 'md', width, className,
|
|
|
19
24
|
onKeyDown?.(event);
|
|
20
25
|
}, ...rest }), value !== '' && (_jsx("button", { type: "button", className: "btn btn-ghost btn-sm btn-icon clear", "aria-label": "Clear search", style: size === 'sm' ? { width: 22, height: 22 } : undefined, onClick: clear, children: _jsx(X, { className: "ic ic-sm", "aria-hidden": true }) }))] }));
|
|
21
26
|
}
|
|
27
|
+
function assignRef(ref, node) {
|
|
28
|
+
if (typeof ref === 'function')
|
|
29
|
+
ref(node);
|
|
30
|
+
else if (ref)
|
|
31
|
+
ref.current = node;
|
|
32
|
+
}
|
package/dist/SelectMenu.js
CHANGED
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useEffect, useId, useLayoutEffect, useRef, useState } from 'react';
|
|
4
4
|
import { Check, ChevronDown, Search as SearchIcon, TriangleAlert } from 'lucide-react';
|
|
5
5
|
import { cx } from './cx.js';
|
|
6
|
-
import { buttonClass } from './
|
|
6
|
+
import { buttonClass } from './buttonClass.js';
|
|
7
7
|
import { controlClass } from './Field.js';
|
|
8
8
|
import { FixedPortal } from './portal.js';
|
|
9
9
|
const GAP = 4;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type TButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger';
|
|
2
|
+
export type TButtonSize = 'sm' | 'md';
|
|
3
|
+
export interface IButtonStyle {
|
|
4
|
+
variant?: TButtonVariant;
|
|
5
|
+
size?: TButtonSize;
|
|
6
|
+
/** Квадратная кнопка с одной иконкой: подпись в aria-label и подсказке. */
|
|
7
|
+
iconOnly?: boolean;
|
|
8
|
+
/** Фильтр со значением (secondary) или включённый переключатель (ghost). */
|
|
9
|
+
active?: boolean;
|
|
10
|
+
block?: boolean;
|
|
11
|
+
/** Ghost-кнопка опасного действия краснеет при наведении. */
|
|
12
|
+
dangerHover?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** Классы кнопки для ссылок роутера, которые выглядят как кнопка. */
|
|
15
|
+
export declare function buttonClass({ variant, size, iconOnly, active, block, dangerHover }?: IButtonStyle, className?: string): string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Без 'use client': классы кнопки нужны и серверным компонентам (ссылки в серверном layout Next).
|
|
2
|
+
import { cx } from './cx.js';
|
|
3
|
+
/** Классы кнопки для ссылок роутера, которые выглядят как кнопка. */
|
|
4
|
+
export function buttonClass({ variant = 'secondary', size = 'md', iconOnly, active, block, dangerHover } = {}, className) {
|
|
5
|
+
return cx('btn', `btn-${variant}`, size === 'sm' && 'btn-sm', iconOnly && 'btn-icon', active && (variant === 'ghost' ? 'is-on' : 'is-active'), block && 'btn-block', dangerHover && 'danger-hover', className);
|
|
6
|
+
}
|
package/dist/components.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Internal ui 1.
|
|
2
|
+
* Internal ui 1.3.0 — shared component classes of Landings Admin and LP Constructor.
|
|
3
3
|
* Loads after tokens.css. Every value is a token; no hex here.
|
|
4
4
|
* Classes are global on purpose: the same file styles the design canvases and the code package.
|
|
5
5
|
* .is-hover / .is-focus / .is-open are static stand-ins for :hover, :focus-visible and an open popup on canvases.
|
|
@@ -165,6 +165,7 @@
|
|
|
165
165
|
.with-icon > .control { padding-left: calc(var(--space-3) + 16px + var(--space-2)); }
|
|
166
166
|
.with-icon > .control:has(+ .clear) { padding-right: calc(var(--control-height-sm) + 6px); }
|
|
167
167
|
.with-icon > .clear { position: absolute; right: 3px; }
|
|
168
|
+
.with-icon > .control::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
|
|
168
169
|
.select-btn { display: inline-flex; align-items: center; gap: var(--space-2); justify-content: space-between; text-align: left; cursor: pointer; }
|
|
169
170
|
.select-btn > .chev { color: var(--text-muted); margin-left: auto; }
|
|
170
171
|
.counter { font-size: var(--text-sm); color: var(--text-muted); font-variant-numeric: tabular-nums; }
|
package/dist/index.d.ts
CHANGED
|
@@ -9,8 +9,10 @@ export { Breadcrumbs } from './Breadcrumbs.tsx';
|
|
|
9
9
|
export type { IBreadcrumbsProps, TCrumb } from './Breadcrumbs.tsx';
|
|
10
10
|
export { UserMenu, initials } from './UserMenu.tsx';
|
|
11
11
|
export type { IUserMenuProps, TUserRole } from './UserMenu.tsx';
|
|
12
|
-
export { Button
|
|
13
|
-
export type { IButtonProps
|
|
12
|
+
export { Button } from './Button.tsx';
|
|
13
|
+
export type { IButtonProps } from './Button.tsx';
|
|
14
|
+
export { buttonClass } from './buttonClass.ts';
|
|
15
|
+
export type { IButtonStyle, TButtonVariant, TButtonSize } from './buttonClass.ts';
|
|
14
16
|
export { Field, TextField, Input, Textarea, Checkbox, controlClass } from './Field.tsx';
|
|
15
17
|
export type { IFieldProps, ITextFieldProps, TInputProps, TTextareaProps, ICheckboxProps, IControlStyle, TControlSize } from './Field.tsx';
|
|
16
18
|
export { Search } from './Search.tsx';
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,9 @@ export { themeScript, isThemeChoice, THEME_STORAGE_KEY } from './themeScript.js'
|
|
|
5
5
|
export { Header, HeaderNav } from './Header.js';
|
|
6
6
|
export { Breadcrumbs } from './Breadcrumbs.js';
|
|
7
7
|
export { UserMenu, initials } from './UserMenu.js';
|
|
8
|
-
export { Button
|
|
8
|
+
export { Button } from './Button.js';
|
|
9
|
+
// Отдельно от Button: модуль без 'use client', его можно вызвать в серверном компоненте
|
|
10
|
+
export { buttonClass } from './buttonClass.js';
|
|
9
11
|
export { Field, TextField, Input, Textarea, Checkbox, controlClass } from './Field.js';
|
|
10
12
|
export { Search } from './Search.js';
|
|
11
13
|
export { Switch } from './Switch.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrktg-common/internal-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Общий интерфейс внутренних инструментов маркетинга (Landings Admin, LP Constructor): токены, классы компонентов и тонкие React-обёртки над ними.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"lint": "eslint .",
|
|
33
33
|
"test": "vitest --run",
|
|
34
34
|
"prepublishOnly": "npm run lint && npm run typecheck && npm test && npm run build",
|
|
35
|
-
"design": "node scripts/build-design.mjs"
|
|
35
|
+
"design": "node scripts/build-design.mjs && node scripts/build-site.mjs"
|
|
36
36
|
},
|
|
37
37
|
"engines": {
|
|
38
38
|
"node": ">=22.18"
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"globals": "^16.5.0",
|
|
60
60
|
"jsdom": "^28.1.0",
|
|
61
61
|
"lucide-react": "^1.44.0",
|
|
62
|
+
"marked": "^15.0.12",
|
|
62
63
|
"react": "^19.3.0",
|
|
63
64
|
"react-dom": "^19.3.0",
|
|
64
65
|
"typescript": "npm:@typescript/typescript6@^6.0.2",
|