burne-ui 0.0.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 +117 -0
- package/dist/components/composite/Accordion/Accordion.d.ts +20 -0
- package/dist/components/composite/Accordion/index.d.ts +1 -0
- package/dist/components/composite/AlertDialog/AlertDialog.d.ts +83 -0
- package/dist/components/composite/AlertDialog/index.d.ts +1 -0
- package/dist/components/composite/ButtonGroup/ButtonGroup.d.ts +42 -0
- package/dist/components/composite/ButtonGroup/index.d.ts +2 -0
- package/dist/components/composite/CheckboxGroup/CheckboxGroup.d.ts +49 -0
- package/dist/components/composite/CheckboxGroup/index.d.ts +1 -0
- package/dist/components/composite/Form/Form.d.ts +4 -0
- package/dist/components/composite/Form/index.d.ts +1 -0
- package/dist/components/core/Alert/Alert.d.ts +34 -0
- package/dist/components/core/Alert/index.d.ts +1 -0
- package/dist/components/core/Avatar/Avatar.d.ts +40 -0
- package/dist/components/core/Avatar/index.d.ts +1 -0
- package/dist/components/core/Badge/Badge.d.ts +77 -0
- package/dist/components/core/Badge/index.d.ts +1 -0
- package/dist/components/core/Breadcrumbs/Breadcrumbs.d.ts +19 -0
- package/dist/components/core/Breadcrumbs/index.d.ts +2 -0
- package/dist/components/core/Button/Button.d.ts +86 -0
- package/dist/components/core/Button/index.d.ts +1 -0
- package/dist/components/core/Card/Card.d.ts +49 -0
- package/dist/components/core/Card/index.d.ts +1 -0
- package/dist/components/core/Checkbox/Checkbox.d.ts +32 -0
- package/dist/components/core/Checkbox/index.d.ts +1 -0
- package/dist/components/core/CloseButton/CloseButton.d.ts +10 -0
- package/dist/components/core/CloseButton/index.d.ts +1 -0
- package/dist/components/core/Dialog/Dialog.d.ts +39 -0
- package/dist/components/core/Dialog/index.d.ts +1 -0
- package/dist/components/core/Dropdown/Dropdown.d.ts +147 -0
- package/dist/components/core/Dropdown/index.d.ts +1 -0
- package/dist/components/core/Expandable/Expandable.d.ts +44 -0
- package/dist/components/core/Expandable/index.d.ts +1 -0
- package/dist/components/core/GlassSurface/GlassBackdrop.d.ts +7 -0
- package/dist/components/core/GlassSurface/GlassShaderLayer.d.ts +14 -0
- package/dist/components/core/GlassSurface/GlassSurface.d.ts +16 -0
- package/dist/components/core/GlassSurface/glassLensOgl.d.ts +11 -0
- package/dist/components/core/GlassSurface/index.d.ts +3 -0
- package/dist/components/core/Input/Input.d.ts +71 -0
- package/dist/components/core/Input/index.d.ts +1 -0
- package/dist/components/core/Ripple/Ripple.d.ts +40 -0
- package/dist/components/core/Ripple/index.d.ts +1 -0
- package/dist/components/core/SearchInput/SearchInput.d.ts +54 -0
- package/dist/components/core/SearchInput/index.d.ts +1 -0
- package/dist/components/core/Selector/Selector.d.ts +48 -0
- package/dist/components/core/Selector/index.d.ts +1 -0
- package/dist/components/core/Separator/Separator.d.ts +13 -0
- package/dist/components/core/Separator/index.d.ts +1 -0
- package/dist/components/core/Text/Text.d.ts +19 -0
- package/dist/components/core/Text/index.d.ts +1 -0
- package/dist/components/core/Tooltip/Tooltip.d.ts +38 -0
- package/dist/components/core/Tooltip/index.d.ts +1 -0
- package/dist/components/core/utils/buttonGroupSegment.d.ts +10 -0
- package/dist/components/core/utils/hoverInteractiveLift.d.ts +60 -0
- package/dist/components/core/utils/motionTokens.d.ts +24 -0
- package/dist/components/core/utils/pressRipple.d.ts +19 -0
- package/dist/components/core/utils/semanticStatusIcons.d.ts +5 -0
- package/dist/components/core/utils/useConvergeRipples.d.ts +13 -0
- package/dist/index.cjs +169 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +11863 -0
- package/dist/tokens/config.d.ts +70 -0
- package/dist/tokens/index.d.ts +12 -0
- package/dist/ui.css +3724 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/mockImages.d.ts +5 -0
- package/package.json +58 -0
package/README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Burne UI
|
|
2
|
+
|
|
3
|
+
React-компоненты с Tailwind CSS v4, анимациями на **anime.js** и тёмной/светлой темой. Иконки рассчитаны на **react-icons** (Io5).
|
|
4
|
+
|
|
5
|
+
## Установка
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install burne-ui
|
|
9
|
+
# или: pnpm / yarn / bun
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
### Peer-зависимости
|
|
13
|
+
|
|
14
|
+
Убедитесь, что в приложении установлены совместимые версии:
|
|
15
|
+
|
|
16
|
+
- `react`, `react-dom` (18 или 19)
|
|
17
|
+
- `react-icons` (^5)
|
|
18
|
+
|
|
19
|
+
## Стили
|
|
20
|
+
|
|
21
|
+
Подключите собранный CSS пакета **один раз** в точке входа (или в корневом layout):
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import "burne-ui/styles.css";
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
В нём:
|
|
28
|
+
|
|
29
|
+
- **Дизайн-токены** как CSS-переменные: `--color-*`, `--space-*`, `--font-family-*`, `--text-*-size` / `line-height` / `weight`, `--radius-value-*`, и др. Полный перечень имён — экспорт **`designTokenNames`** из `burne-ui`; исходные значения по умолчанию смотрите в репозитории в `src/tokens/styles.css`.
|
|
30
|
+
- **Мост Tailwind** (`@theme inline`): цвета в утилитах вида `bg-background`, `text-foreground`, `border-base`, `bg-accent`, отступы `gap-mid`, `p-plus`, радиусы `rounded-base` и т.д.
|
|
31
|
+
- **Кастомные утилиты** (`@utility`): например `text-header-1`, `text-mid`, `max-w-component-base`, `min-w-button-base`.
|
|
32
|
+
|
|
33
|
+
Имена переменных **не** с префиксом `brn-`; это обычные `--color-background`, `--space-mid` и т.п.
|
|
34
|
+
|
|
35
|
+
## Кастомизация темы
|
|
36
|
+
|
|
37
|
+
Чтобы поменять палитру, отступы, шрифты, шкалу типографики и прочее, переопределите те же переменные **после** импорта `burne-ui/styles.css`:
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import "burne-ui/styles.css";
|
|
41
|
+
import "./burne-theme-overrides.css";
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Пример `burne-theme-overrides.css`:
|
|
45
|
+
|
|
46
|
+
```css
|
|
47
|
+
:root {
|
|
48
|
+
--color-accent: #6366f1;
|
|
49
|
+
--space-mid: 1.125rem;
|
|
50
|
+
--font-family-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
|
|
51
|
+
--text-base-size: 0.9375rem;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* Светлая тема: те же ветки, что и в пакете */
|
|
55
|
+
[data-brn-theme="light"],
|
|
56
|
+
[data-theme="light"] {
|
|
57
|
+
--color-accent: #4f46e5;
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Переменные наследуются по дереву DOM — при необходимости задайте их на обёртке виджета вместо `html`.
|
|
62
|
+
|
|
63
|
+
Из JS удобно сверять имена с массивом **`designTokenNames`**, а для цветов в `style` есть хелпер **`colorToken`** (оба экспортируются из `burne-ui`):
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import { designTokenNames, colorToken } from "burne-ui";
|
|
67
|
+
|
|
68
|
+
const ripple = colorToken("converge-ripple-accent-soft"); // var(--color-converge-ripple-accent-soft)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Tailwind в приложении-потребителе
|
|
72
|
+
|
|
73
|
+
Компоненты используют классы Tailwind, сопоставленные с токенами пакета (`bg-surface`, `text-muted`, `gap-plus`, …). Чтобы **ваши** классы в `className` и классы из prebuilt-бандла библиотеки попали в итоговый CSS, Tailwind должен сканировать артефакты пакета. Добавьте путь к сборке (пример для Tailwind v4 / Vite):
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
// @source в глобальном CSS приложения или content — см. документацию Tailwind v4
|
|
77
|
+
// Нужно сканировать как минимум:
|
|
78
|
+
// - ваши **/*.{tsx,jsx},
|
|
79
|
+
// - node_modules/burne-ui/dist/**/*.{js,mjs,cjs}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Без этого часть утилит из переданных вами классов может не попасть в CSS.
|
|
83
|
+
|
|
84
|
+
## Светлая тема
|
|
85
|
+
|
|
86
|
+
На корне (например `<html>`) или на обёртке портала:
|
|
87
|
+
|
|
88
|
+
```html
|
|
89
|
+
<html data-brn-theme="light">
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Поддерживается также `data-theme="light"` (как в Storybook). В коде проверка: `document.documentElement.dataset.brnTheme === "light"`.
|
|
93
|
+
|
|
94
|
+
## Экспорт `cn`
|
|
95
|
+
|
|
96
|
+
Для предсказуемого слияния классов (в т.ч. переопределение дефолтов компонентов через `className`) используется **clsx** + **tailwind-merge**:
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
import { cn } from "burne-ui";
|
|
100
|
+
|
|
101
|
+
<div className={cn("flex gap-2", className)} />
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Функция реэкспортируется из корня пакета; зависимости уже входят в `burne-ui`, отдельно ставить их не обязательно.
|
|
105
|
+
|
|
106
|
+
## Сборка и разработка репозитория
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
bun install
|
|
110
|
+
bun run build # dist: JS/CJS + ui.css (как burne-ui/styles.css) + типы
|
|
111
|
+
bun run lint
|
|
112
|
+
bun run storybook
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Лицензия
|
|
116
|
+
|
|
117
|
+
Укажите лицензию в `package.json` при публикации в npm.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type AccordionItem = {
|
|
3
|
+
id: string;
|
|
4
|
+
title: ReactNode;
|
|
5
|
+
description?: ReactNode;
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
/** Узел перед иконкой/контентом триггера (например `<Ripple color="accentMuted" />`). */
|
|
8
|
+
triggerBefore?: ReactNode;
|
|
9
|
+
content: ReactNode;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type AccordionProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
13
|
+
items: readonly AccordionItem[];
|
|
14
|
+
/** Начально открытый item id (неконтролируемый режим). */
|
|
15
|
+
defaultOpenId?: string | null;
|
|
16
|
+
/** Управляемое открытое состояние. */
|
|
17
|
+
openId?: string | null;
|
|
18
|
+
onOpenIdChange?: (id: string | null) => void;
|
|
19
|
+
};
|
|
20
|
+
export declare function Accordion({ items, defaultOpenId, openId: openIdProp, onOpenIdChange, className, ...rest }: AccordionProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Accordion, type AccordionProps, type AccordionItem, } from './Accordion';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { AlertStatus, AlertVariant } from '../../core/Alert/Alert';
|
|
3
|
+
import { ButtonSize, ButtonVariant } from '../../core/Button';
|
|
4
|
+
import { CloseButtonProps } from '../../core/CloseButton';
|
|
5
|
+
import { TextVariant } from '../../core/Text';
|
|
6
|
+
/** Ширина и типографика панели. */
|
|
7
|
+
export type AlertDialogSize = "small" | "base" | "large";
|
|
8
|
+
/** Размер кнопок футера для заданного `size` модалки (если не используете `AlertDialog.Footer` с авто-подстановкой). */
|
|
9
|
+
export declare function footerButtonSizeForAlertDialog(dialogSize: AlertDialogSize): ButtonSize;
|
|
10
|
+
declare const ALERT_DIALOG_SIZE: Record<AlertDialogSize, {
|
|
11
|
+
panelMax: string;
|
|
12
|
+
maxHeight: string;
|
|
13
|
+
headerGap: string;
|
|
14
|
+
headerPad: string;
|
|
15
|
+
bodyPad: string;
|
|
16
|
+
footerPad: string;
|
|
17
|
+
headingBlockGap: string;
|
|
18
|
+
iconClass: string;
|
|
19
|
+
titleVariant: TextVariant;
|
|
20
|
+
titleClassName: string;
|
|
21
|
+
descVariant: TextVariant;
|
|
22
|
+
descClassName: string;
|
|
23
|
+
bodyVariant: TextVariant;
|
|
24
|
+
bodyClassName: string;
|
|
25
|
+
}>;
|
|
26
|
+
/** Основная кнопка действия в футере модалки в тон окна. */
|
|
27
|
+
export declare function primaryButtonVariantForAlertTone(tone: AlertStatus): ButtonVariant;
|
|
28
|
+
export type AlertDialogProps = {
|
|
29
|
+
open: boolean;
|
|
30
|
+
onOpenChange: (open: boolean) => void;
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
className?: string;
|
|
33
|
+
/** Как у `Alert`: default, outline, secondary, danger, success, info и `warning` через `status`. */
|
|
34
|
+
variant?: AlertVariant;
|
|
35
|
+
status?: AlertStatus;
|
|
36
|
+
/** По умолчанию `m`. */
|
|
37
|
+
size?: AlertDialogSize;
|
|
38
|
+
};
|
|
39
|
+
type AlertDialogContextValue = {
|
|
40
|
+
titleId: string;
|
|
41
|
+
descriptionId: string;
|
|
42
|
+
hasDescription: boolean;
|
|
43
|
+
setHasDescription: (v: boolean) => void;
|
|
44
|
+
onOpenChange: (open: boolean) => void;
|
|
45
|
+
tone: AlertStatus;
|
|
46
|
+
size: AlertDialogSize;
|
|
47
|
+
sizePreset: (typeof ALERT_DIALOG_SIZE)["base"];
|
|
48
|
+
/** Размер кнопок по умолчанию в `AlertDialog.Footer` (см. `footerButtonSizeForAlertDialog`). */
|
|
49
|
+
footerButtonSize: ButtonSize;
|
|
50
|
+
};
|
|
51
|
+
/** Контекст открытого `AlertDialog`: тон, размер, `footerButtonSize` для кнопок футера. */
|
|
52
|
+
export declare function useAlertDialog(): AlertDialogContextValue;
|
|
53
|
+
export type AlertDialogHeaderProps = HTMLAttributes<HTMLDivElement> & {
|
|
54
|
+
/**
|
|
55
|
+
* Для тона `default` иконки нет по умолчанию — передайте узел, если нужна.
|
|
56
|
+
* Для остальных тонов по умолчанию показывается иконка тона; `null` — скрыть.
|
|
57
|
+
*/
|
|
58
|
+
icon?: ReactNode | null;
|
|
59
|
+
/** Кнопка закрытия справа в шапке. По умолчанию `true`. */
|
|
60
|
+
showClose?: boolean;
|
|
61
|
+
};
|
|
62
|
+
export type AlertDialogTitleProps = HTMLAttributes<HTMLHeadingElement>;
|
|
63
|
+
export type AlertDialogDescriptionProps = HTMLAttributes<HTMLParagraphElement>;
|
|
64
|
+
export type AlertDialogBodyProps = HTMLAttributes<HTMLDivElement>;
|
|
65
|
+
export type AlertDialogFooterProps = HTMLAttributes<HTMLDivElement>;
|
|
66
|
+
export type AlertDialogCloseProps = CloseButtonProps;
|
|
67
|
+
declare function AlertDialogHeader({ icon, showClose, className, children, ...rest }: AlertDialogHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
68
|
+
declare function AlertDialogDescription({ className, id, ...rest }: AlertDialogDescriptionProps): import("react/jsx-runtime").JSX.Element;
|
|
69
|
+
declare function AlertDialogHeadingBlock({ className, ...rest }: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
70
|
+
declare function AlertDialogBody({ className, children, ...rest }: AlertDialogBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
71
|
+
declare function AlertDialogFooter({ className, children, ...rest }: AlertDialogFooterProps): import("react/jsx-runtime").JSX.Element;
|
|
72
|
+
export declare const AlertDialog: (({ open, onOpenChange, children, className, variant, status, size, }: AlertDialogProps) => import('react').ReactPortal | null) & {
|
|
73
|
+
Header: typeof AlertDialogHeader;
|
|
74
|
+
HeadingBlock: typeof AlertDialogHeadingBlock;
|
|
75
|
+
Title: import('react').ForwardRefExoticComponent<AlertDialogTitleProps & import('react').RefAttributes<HTMLHeadingElement>>;
|
|
76
|
+
Description: typeof AlertDialogDescription;
|
|
77
|
+
Body: typeof AlertDialogBody;
|
|
78
|
+
Footer: typeof AlertDialogFooter;
|
|
79
|
+
Close: import('react').ForwardRefExoticComponent<Omit<import('react').ButtonHTMLAttributes<HTMLButtonElement>, "children"> & {
|
|
80
|
+
variant?: import('../../core/CloseButton').CloseButtonVariant;
|
|
81
|
+
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
82
|
+
};
|
|
83
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AlertDialog, footerButtonSizeForAlertDialog, primaryButtonVariantForAlertTone, useAlertDialog, type AlertDialogProps, type AlertDialogSize, type AlertDialogBodyProps, type AlertDialogCloseProps, type AlertDialogDescriptionProps, type AlertDialogFooterProps, type AlertDialogHeaderProps, type AlertDialogTitleProps, } from './AlertDialog';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { ButtonSize } from '../../core/Button';
|
|
3
|
+
import { ButtonGroupSegment } from '../../core/utils/buttonGroupSegment';
|
|
4
|
+
export type ButtonGroupTextProps = ComponentPropsWithoutRef<"span"> & {
|
|
5
|
+
/**
|
|
6
|
+
* @internal Позиция в группе; выставляется из `<ButtonGroup>`.
|
|
7
|
+
*/
|
|
8
|
+
groupSegment?: ButtonGroupSegment;
|
|
9
|
+
/** Высота/отступы в духу `Button` того же размера. По умолчанию `base`. */
|
|
10
|
+
buttonSize?: ButtonSize;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Неактивная подпись внутри склеенной группы (`Button`, `SearchInput`-рядом и т.д.).
|
|
14
|
+
*/
|
|
15
|
+
export declare const ButtonGroupText: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
16
|
+
/**
|
|
17
|
+
* @internal Позиция в группе; выставляется из `<ButtonGroup>`.
|
|
18
|
+
*/
|
|
19
|
+
groupSegment?: ButtonGroupSegment;
|
|
20
|
+
/** Высота/отступы в духу `Button` того же размера. По умолчанию `base`. */
|
|
21
|
+
buttonSize?: ButtonSize;
|
|
22
|
+
} & import('react').RefAttributes<HTMLSpanElement>>;
|
|
23
|
+
export type ButtonGroupOrientation = "horizontal" | "vertical";
|
|
24
|
+
export type ButtonGroupProps = Omit<HTMLAttributes<HTMLDivElement>, "role" | "children"> & {
|
|
25
|
+
/** Ряд или колонка. По умолчанию `horizontal`. */
|
|
26
|
+
orientation?: ButtonGroupOrientation;
|
|
27
|
+
/** Совпадает с `size` вложенных `Button`; влияет на `ButtonGroupText`. По умолчанию `base`. */
|
|
28
|
+
buttonSize?: ButtonSize;
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Группа сегментов без зазоров: общий контур скругления только по внешним краям (`Button`, `Input`, `ButtonGroup.Text`).
|
|
33
|
+
*
|
|
34
|
+
* Скругления у `SearchInput` по-прежнему задаются инлайново — для тулбара используйте `Input` в группе или отдельный ряд.
|
|
35
|
+
*/
|
|
36
|
+
export declare const ButtonGroup: import('react').ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "children" | "role"> & {
|
|
37
|
+
/** Ряд или колонка. По умолчанию `horizontal`. */
|
|
38
|
+
orientation?: ButtonGroupOrientation;
|
|
39
|
+
/** Совпадает с `size` вложенных `Button`; влияет на `ButtonGroupText`. По умолчанию `base`. */
|
|
40
|
+
buttonSize?: ButtonSize;
|
|
41
|
+
children: ReactNode;
|
|
42
|
+
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { FieldsetHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
/** Режим выбора в группе: несколько галочек или только один вариант (остальные снимаются). */
|
|
3
|
+
export type CheckboxGroupSelection = "multiple" | "single";
|
|
4
|
+
export type CheckboxGroupProps = Omit<FieldsetHTMLAttributes<HTMLFieldSetElement>, "children" | "onChange"> & {
|
|
5
|
+
/** Заголовок над списком чекбоксов (`<legend>`). */
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
/** Подзаголовок под заголовком. */
|
|
8
|
+
description?: ReactNode;
|
|
9
|
+
/** Красная звездочка справа от заголовка. */
|
|
10
|
+
isRequired?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* `single` — только один отмеченный пункт; при выборе другого предыдущий снимается.
|
|
13
|
+
* У каждого дочернего `Checkbox` должен быть уникальный строковый `value` (или задаётся индекс).
|
|
14
|
+
*/
|
|
15
|
+
selection?: CheckboxGroupSelection;
|
|
16
|
+
/**
|
|
17
|
+
* Выбранное значение при `selection="single"` (контролируемый режим).
|
|
18
|
+
* `null` — ни один пункт не выбран. Если проп не передан, группа неконтролируемая (`defaultValue`).
|
|
19
|
+
*/
|
|
20
|
+
value?: string | null;
|
|
21
|
+
/** Начальное значение при `selection="single"` без `value`. */
|
|
22
|
+
defaultValue?: string;
|
|
23
|
+
/** Смена выбранного значения в режиме `single`. */
|
|
24
|
+
onValueChange?: (value: string | undefined) => void;
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
};
|
|
27
|
+
export declare const CheckboxGroup: import('react').ForwardRefExoticComponent<Omit<FieldsetHTMLAttributes<HTMLFieldSetElement>, "children" | "onChange"> & {
|
|
28
|
+
/** Заголовок над списком чекбоксов (`<legend>`). */
|
|
29
|
+
title: ReactNode;
|
|
30
|
+
/** Подзаголовок под заголовком. */
|
|
31
|
+
description?: ReactNode;
|
|
32
|
+
/** Красная звездочка справа от заголовка. */
|
|
33
|
+
isRequired?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* `single` — только один отмеченный пункт; при выборе другого предыдущий снимается.
|
|
36
|
+
* У каждого дочернего `Checkbox` должен быть уникальный строковый `value` (или задаётся индекс).
|
|
37
|
+
*/
|
|
38
|
+
selection?: CheckboxGroupSelection;
|
|
39
|
+
/**
|
|
40
|
+
* Выбранное значение при `selection="single"` (контролируемый режим).
|
|
41
|
+
* `null` — ни один пункт не выбран. Если проп не передан, группа неконтролируемая (`defaultValue`).
|
|
42
|
+
*/
|
|
43
|
+
value?: string | null;
|
|
44
|
+
/** Начальное значение при `selection="single"` без `value`. */
|
|
45
|
+
defaultValue?: string;
|
|
46
|
+
/** Смена выбранного значения в режиме `single`. */
|
|
47
|
+
onValueChange?: (value: string | undefined) => void;
|
|
48
|
+
children?: ReactNode;
|
|
49
|
+
} & import('react').RefAttributes<HTMLFieldSetElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CheckboxGroup, type CheckboxGroupProps, type CheckboxGroupSelection, } from './CheckboxGroup';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FormHTMLAttributes } from 'react';
|
|
2
|
+
export type FormProps = FormHTMLAttributes<HTMLFormElement>;
|
|
3
|
+
/** Вертикальная раскладка полей (герлей между дочерними `Input` и блоками). */
|
|
4
|
+
export declare const Form: import('react').ForwardRefExoticComponent<FormProps & import('react').RefAttributes<HTMLFormElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Form, type FormProps } from './Form';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
/** Визуальный вариант заливки (без отдельного статуса). */
|
|
3
|
+
export type AlertVariant = "default" | "outline" | "secondary" | "danger" | "success" | "info";
|
|
4
|
+
export type AlertStatus = AlertVariant | "warning";
|
|
5
|
+
export declare function resolveAlertStatus(status?: AlertStatus, variant?: AlertVariant): AlertStatus;
|
|
6
|
+
export type AlertProps = HTMLAttributes<HTMLDivElement> & {
|
|
7
|
+
variant?: AlertVariant;
|
|
8
|
+
status?: AlertStatus;
|
|
9
|
+
};
|
|
10
|
+
type AlertIndicatorProps = HTMLAttributes<HTMLSpanElement> & {
|
|
11
|
+
status?: AlertStatus;
|
|
12
|
+
};
|
|
13
|
+
type AlertContentProps = HTMLAttributes<HTMLDivElement>;
|
|
14
|
+
type AlertMessageProps = HTMLAttributes<HTMLDivElement>;
|
|
15
|
+
type AlertTitleProps = HTMLAttributes<HTMLDivElement>;
|
|
16
|
+
type AlertDescriptionProps = HTMLAttributes<HTMLDivElement>;
|
|
17
|
+
type AlertActionProps = HTMLAttributes<HTMLDivElement>;
|
|
18
|
+
declare function AlertIndicator({ status, className, children, ...rest }: AlertIndicatorProps): import("react/jsx-runtime").JSX.Element | null;
|
|
19
|
+
declare function AlertContent({ className, ...rest }: AlertContentProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
declare function AlertTitle({ className, ...rest }: AlertTitleProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
declare function AlertDescription({ className, ...rest }: AlertDescriptionProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
declare function AlertAction({ className, ...rest }: AlertActionProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare const Alert: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
24
|
+
variant?: AlertVariant;
|
|
25
|
+
status?: AlertStatus;
|
|
26
|
+
} & import('react').RefAttributes<HTMLDivElement>> & {
|
|
27
|
+
Indicator: typeof AlertIndicator;
|
|
28
|
+
Message: import('react').ForwardRefExoticComponent<AlertMessageProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
29
|
+
Content: typeof AlertContent;
|
|
30
|
+
Title: typeof AlertTitle;
|
|
31
|
+
Description: typeof AlertDescription;
|
|
32
|
+
Action: typeof AlertAction;
|
|
33
|
+
};
|
|
34
|
+
export type { AlertIndicatorProps, AlertContentProps, AlertMessageProps, AlertTitleProps, AlertDescriptionProps, AlertActionProps, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Alert, resolveAlertStatus, type AlertProps, type AlertVariant, type AlertStatus, type AlertIndicatorProps, type AlertContentProps, type AlertMessageProps, type AlertTitleProps, type AlertDescriptionProps, type AlertActionProps, } from './Alert';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ImgHTMLAttributes, HTMLAttributes } from 'react';
|
|
2
|
+
import { TooltipSide, TooltipSize, TooltipVariant } from '../Tooltip';
|
|
3
|
+
/** Размер круга аватара. */
|
|
4
|
+
export type AvatarSize = "small" | "base" | "large";
|
|
5
|
+
export type AvatarProps = Omit<HTMLAttributes<HTMLDivElement>, "aria-label"> & {
|
|
6
|
+
/** Круг диаметром small / base / large. По умолчанию `base`. */
|
|
7
|
+
size?: AvatarSize;
|
|
8
|
+
/** Подпись пользователя — первая буква во `Avatar.Fallback`, если там нет текста; также `aria-label` корня. */
|
|
9
|
+
label?: string;
|
|
10
|
+
/** Никнейм во всплывающем `Tooltip` при наведении. Без текста тултип не показывается. */
|
|
11
|
+
nickname?: string;
|
|
12
|
+
/** Размер тултипа при заданном `nickname`. По умолчанию `base`. */
|
|
13
|
+
tooltipSize?: TooltipSize;
|
|
14
|
+
/** Вариант тултипа (как у `Alert`). По умолчанию `default`. */
|
|
15
|
+
tooltipVariant?: TooltipVariant;
|
|
16
|
+
/** Сторона тултипа относительно аватара при `nickname`. По умолчанию `top`. */
|
|
17
|
+
tooltipSide?: TooltipSide;
|
|
18
|
+
};
|
|
19
|
+
export type AvatarImageProps = ImgHTMLAttributes<HTMLImageElement>;
|
|
20
|
+
export type AvatarFallbackProps = HTMLAttributes<HTMLSpanElement>;
|
|
21
|
+
export type AvatarGroupProps = HTMLAttributes<HTMLDivElement>;
|
|
22
|
+
/** Аватар: изображение + буква-фоллбек по полю `label` или тексту во `Fallback`. */
|
|
23
|
+
export declare const Avatar: import('react').ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "aria-label"> & {
|
|
24
|
+
/** Круг диаметром small / base / large. По умолчанию `base`. */
|
|
25
|
+
size?: AvatarSize;
|
|
26
|
+
/** Подпись пользователя — первая буква во `Avatar.Fallback`, если там нет текста; также `aria-label` корня. */
|
|
27
|
+
label?: string;
|
|
28
|
+
/** Никнейм во всплывающем `Tooltip` при наведении. Без текста тултип не показывается. */
|
|
29
|
+
nickname?: string;
|
|
30
|
+
/** Размер тултипа при заданном `nickname`. По умолчанию `base`. */
|
|
31
|
+
tooltipSize?: TooltipSize;
|
|
32
|
+
/** Вариант тултипа (как у `Alert`). По умолчанию `default`. */
|
|
33
|
+
tooltipVariant?: TooltipVariant;
|
|
34
|
+
/** Сторона тултипа относительно аватара при `nickname`. По умолчанию `top`. */
|
|
35
|
+
tooltipSide?: TooltipSide;
|
|
36
|
+
} & import('react').RefAttributes<HTMLDivElement>> & {
|
|
37
|
+
Image: import('react').ForwardRefExoticComponent<AvatarImageProps & import('react').RefAttributes<HTMLImageElement>>;
|
|
38
|
+
Fallback: import('react').ForwardRefExoticComponent<AvatarFallbackProps & import('react').RefAttributes<HTMLSpanElement>>;
|
|
39
|
+
};
|
|
40
|
+
export declare const AvatarGroup: import('react').ForwardRefExoticComponent<AvatarGroupProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Avatar, AvatarGroup, type AvatarProps, type AvatarSize, type AvatarImageProps, type AvatarFallbackProps, type AvatarGroupProps, } from './Avatar';
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { AlertStatus } from '../Alert';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
/** Семантика заливки — как у `Alert` / `AlertStatus` (включая `secondary`). */
|
|
4
|
+
export type BadgeTone = AlertStatus;
|
|
5
|
+
/** Публичный prop `color` (синоним тона бейджа). */
|
|
6
|
+
export type BadgeColor = BadgeTone;
|
|
7
|
+
/** @deprecated Используйте `BadgeColor`; оставлено для совместимости. */
|
|
8
|
+
export type BadgeVariant = BadgeTone;
|
|
9
|
+
export type BadgeSize = "small" | "base" | "large";
|
|
10
|
+
/** Угол привязки внутри `Badge.Anchor`. */
|
|
11
|
+
export type BadgePlacement = "top-right" | "top-left" | "bottom-right" | "bottom-left";
|
|
12
|
+
export type BadgeIconPosition = "start" | "end";
|
|
13
|
+
/** Устаревший литерал из API; сводим к `secondary`. */
|
|
14
|
+
type BadgeToneProp = BadgeTone | "accent";
|
|
15
|
+
export type BadgeAnchorProps = Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* При наведении на якорь слегка увеличивать (anime.js) прямой дочерний `Badge`, как hover у `Button`.
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
hoverLift?: boolean;
|
|
22
|
+
};
|
|
23
|
+
declare const BadgeAnchor: import('react').ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
24
|
+
children?: ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* При наведении на якорь слегка увеличивать (anime.js) прямой дочерний `Badge`, как hover у `Button`.
|
|
27
|
+
* @default true
|
|
28
|
+
*/
|
|
29
|
+
hoverLift?: boolean;
|
|
30
|
+
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
31
|
+
export type BadgeProps = Omit<HTMLAttributes<HTMLSpanElement>, "children"> & {
|
|
32
|
+
/** Семантика / цвет поверхности. Приоритет над `variant`. */
|
|
33
|
+
color?: BadgeToneProp;
|
|
34
|
+
/** Совместимость с прежним API; если задан только он — работает как `color`. */
|
|
35
|
+
variant?: BadgeToneProp;
|
|
36
|
+
/** `small` · `base` · `large`. По умолчанию `base`. */
|
|
37
|
+
size?: BadgeSize;
|
|
38
|
+
icon?: ReactNode;
|
|
39
|
+
iconPosition?: BadgeIconPosition;
|
|
40
|
+
iconOnly?: boolean;
|
|
41
|
+
dot?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Только для бейджа — **прямого** ребёнка `Badge.Anchor`: угол наложения.
|
|
44
|
+
* По умолчанию `top-right`. Внутри вложенных контейнеров не действует.
|
|
45
|
+
*/
|
|
46
|
+
placement?: BadgePlacement;
|
|
47
|
+
children?: ReactNode;
|
|
48
|
+
};
|
|
49
|
+
/** Компактный статус-бейдж; с `Badge.Anchor` — наложение и hover-scale как у `Button`. */
|
|
50
|
+
export declare const Badge: import('react').ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLSpanElement>, "children"> & {
|
|
51
|
+
/** Семантика / цвет поверхности. Приоритет над `variant`. */
|
|
52
|
+
color?: BadgeToneProp;
|
|
53
|
+
/** Совместимость с прежним API; если задан только он — работает как `color`. */
|
|
54
|
+
variant?: BadgeToneProp;
|
|
55
|
+
/** `small` · `base` · `large`. По умолчанию `base`. */
|
|
56
|
+
size?: BadgeSize;
|
|
57
|
+
icon?: ReactNode;
|
|
58
|
+
iconPosition?: BadgeIconPosition;
|
|
59
|
+
iconOnly?: boolean;
|
|
60
|
+
dot?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Только для бейджа — **прямого** ребёнка `Badge.Anchor`: угол наложения.
|
|
63
|
+
* По умолчанию `top-right`. Внутри вложенных контейнеров не действует.
|
|
64
|
+
*/
|
|
65
|
+
placement?: BadgePlacement;
|
|
66
|
+
children?: ReactNode;
|
|
67
|
+
} & import('react').RefAttributes<HTMLSpanElement>> & {
|
|
68
|
+
Anchor: import('react').ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
69
|
+
children?: ReactNode;
|
|
70
|
+
/**
|
|
71
|
+
* При наведении на якорь слегка увеличивать (anime.js) прямой дочерний `Badge`, как hover у `Button`.
|
|
72
|
+
* @default true
|
|
73
|
+
*/
|
|
74
|
+
hoverLift?: boolean;
|
|
75
|
+
} & import('react').RefAttributes<HTMLDivElement>>;
|
|
76
|
+
};
|
|
77
|
+
export { BadgeAnchor };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Badge, BadgeAnchor, type BadgeProps, type BadgeTone, type BadgeColor, type BadgeVariant, type BadgeSize, type BadgePlacement, type BadgeIconPosition, type BadgeAnchorProps, } from './Badge';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { HTMLAttributes, MouseEvent, ReactNode } from 'react';
|
|
2
|
+
export type BreadcrumbItem = {
|
|
3
|
+
/** Подпись сегмента. */
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
/** Внешняя ссылка (все сегменты кроме последнего с ховером должны иметь `href` и/или `onClick`). */
|
|
6
|
+
href?: string;
|
|
7
|
+
/** Клик без навигации (кнопка). */
|
|
8
|
+
onClick?: (event: MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void;
|
|
9
|
+
};
|
|
10
|
+
export type BreadcrumbsProps = Omit<HTMLAttributes<HTMLElement>, "children" | "role"> & {
|
|
11
|
+
items: readonly BreadcrumbItem[];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Навигационная цепочка: последний пункт — текст; остальные — `muted` с hover-scale и squeeze при нажатии (без тени и без рамки при клике мышью).
|
|
15
|
+
* Если сегментов больше трёх: первый, затем «…», затем два последних.
|
|
16
|
+
*/
|
|
17
|
+
export declare const Breadcrumbs: import('react').ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLElement>, "children" | "role"> & {
|
|
18
|
+
items: readonly BreadcrumbItem[];
|
|
19
|
+
} & import('react').RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes, MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import { ButtonGroupSegment } from '../utils/buttonGroupSegment';
|
|
3
|
+
/** Состояние асинхронного сценария после клика. */
|
|
4
|
+
export type ButtonAsyncState = "idle" | "loading" | "success" | "error";
|
|
5
|
+
/** Размер кнопки: высота, отступы, типографика, спиннер и иконки результата. */
|
|
6
|
+
export type ButtonSize = "small" | "base" | "large" | "xlarge";
|
|
7
|
+
/** Визуальный вариант заливки и обводки. */
|
|
8
|
+
export type ButtonVariant = "default" | "outline" | "secondary" | "ghost" | "danger" | "success" | "info" | "warning";
|
|
9
|
+
/** CSS-цвет converge-ripple под вариант кнопки — для собственного `<Ripple color={…} />` без `Button`. */
|
|
10
|
+
export declare function buttonRippleTone(variant: ButtonVariant): string;
|
|
11
|
+
export type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
12
|
+
/**
|
|
13
|
+
* Склейка с соседями в `ButtonGroup`: без зазора, общий контур скругления только по краям группы.
|
|
14
|
+
* Задаётся автоматически при использовании внутри `<ButtonGroup>`.
|
|
15
|
+
*/
|
|
16
|
+
groupSegment?: ButtonGroupSegment;
|
|
17
|
+
/** Стиль заливки и акцента. По умолчанию `default`. */
|
|
18
|
+
variant?: ButtonVariant;
|
|
19
|
+
/** Габариты и типографика. По умолчанию `base`. */
|
|
20
|
+
size?: ButtonSize;
|
|
21
|
+
/**
|
|
22
|
+
* Кнопка только с иконкой: вместо `min-w-button-*` используется `min-w-fit` (узкая обводка по контенту).
|
|
23
|
+
*/
|
|
24
|
+
iconOnly?: boolean;
|
|
25
|
+
/** Включить лёгкий scale-пульс при нажатии (anime.js), только в idle. */
|
|
26
|
+
animated?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Управляемое состояние: loading → success | error с рябью и иконками.
|
|
29
|
+
* Без `onAsyncClick` переходы задаёт родитель.
|
|
30
|
+
*/
|
|
31
|
+
asyncState?: ButtonAsyncState;
|
|
32
|
+
/** При контроле `asyncState` — уведомление о смене (опционально). */
|
|
33
|
+
onAsyncStateChange?: (state: ButtonAsyncState) => void;
|
|
34
|
+
/**
|
|
35
|
+
* Неконтролируемый режим: `true` из промиса → success + зелёная галочка,
|
|
36
|
+
* `false` → error + красный крест. Отклонение промиса трактуется как error.
|
|
37
|
+
*/
|
|
38
|
+
onAsyncClick?: (event: MouseEvent<HTMLButtonElement>) => Promise<boolean>;
|
|
39
|
+
/** Через сколько вернуться в idle после success/error (неконтролируемый режим). */
|
|
40
|
+
asyncFeedbackMs?: number;
|
|
41
|
+
/** Иконка слева от подписи (только в состоянии idle). */
|
|
42
|
+
leftIcon?: ReactNode;
|
|
43
|
+
/**
|
|
44
|
+
* Включить converge-ripple от точки нажатия (`<Ripple />` внутри кнопки, тон под `variant`).
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
ripple?: boolean;
|
|
48
|
+
};
|
|
49
|
+
export declare const Button: import('react').ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
50
|
+
/**
|
|
51
|
+
* Склейка с соседями в `ButtonGroup`: без зазора, общий контур скругления только по краям группы.
|
|
52
|
+
* Задаётся автоматически при использовании внутри `<ButtonGroup>`.
|
|
53
|
+
*/
|
|
54
|
+
groupSegment?: ButtonGroupSegment;
|
|
55
|
+
/** Стиль заливки и акцента. По умолчанию `default`. */
|
|
56
|
+
variant?: ButtonVariant;
|
|
57
|
+
/** Габариты и типографика. По умолчанию `base`. */
|
|
58
|
+
size?: ButtonSize;
|
|
59
|
+
/**
|
|
60
|
+
* Кнопка только с иконкой: вместо `min-w-button-*` используется `min-w-fit` (узкая обводка по контенту).
|
|
61
|
+
*/
|
|
62
|
+
iconOnly?: boolean;
|
|
63
|
+
/** Включить лёгкий scale-пульс при нажатии (anime.js), только в idle. */
|
|
64
|
+
animated?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Управляемое состояние: loading → success | error с рябью и иконками.
|
|
67
|
+
* Без `onAsyncClick` переходы задаёт родитель.
|
|
68
|
+
*/
|
|
69
|
+
asyncState?: ButtonAsyncState;
|
|
70
|
+
/** При контроле `asyncState` — уведомление о смене (опционально). */
|
|
71
|
+
onAsyncStateChange?: (state: ButtonAsyncState) => void;
|
|
72
|
+
/**
|
|
73
|
+
* Неконтролируемый режим: `true` из промиса → success + зелёная галочка,
|
|
74
|
+
* `false` → error + красный крест. Отклонение промиса трактуется как error.
|
|
75
|
+
*/
|
|
76
|
+
onAsyncClick?: (event: MouseEvent<HTMLButtonElement>) => Promise<boolean>;
|
|
77
|
+
/** Через сколько вернуться в idle после success/error (неконтролируемый режим). */
|
|
78
|
+
asyncFeedbackMs?: number;
|
|
79
|
+
/** Иконка слева от подписи (только в состоянии idle). */
|
|
80
|
+
leftIcon?: ReactNode;
|
|
81
|
+
/**
|
|
82
|
+
* Включить converge-ripple от точки нажатия (`<Ripple />` внутри кнопки, тон под `variant`).
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
ripple?: boolean;
|
|
86
|
+
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Button, buttonRippleTone, type ButtonProps, type ButtonAsyncState, type ButtonSize, type ButtonVariant, } from './Button';
|