@mrktg-common/internal-ui 1.2.1 → 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/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/SelectMenu.js +1 -1
- package/dist/buttonClass.d.ts +15 -0
- package/dist/buttonClass.js +6 -0
- package/dist/components.css +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +3 -1
- package/package.json +1 -1
- package/tokens/tokens.json +1 -1
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/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.
|
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",
|