@mrktg-common/internal-ui 1.2.0 → 1.2.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/README.md +7 -0
- package/dist/Search.d.ts +1 -1
- package/dist/Search.js +13 -2
- package/dist/components.css +2 -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/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/components.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Internal ui 1.2.
|
|
2
|
+
* Internal ui 1.2.1 — 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrktg-common/internal-ui",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
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",
|