tvuikit 0.7.1 → 0.8.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 +179 -25
- package/dist/components/dropdown/index.stories.d.ts +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/notification/index.d.ts +2 -0
- package/dist/components/notification/index.stories.d.ts +8 -0
- package/dist/components/notification/notification.component.d.ts +14 -0
- package/dist/components/notification/notifications.component.d.ts +1 -0
- package/dist/components/notification/use-notifications.hook.d.ts +31 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/tvuikit.es.js +1486 -1039
- package/dist/tvuikit.es.js.map +1 -1
- package/dist/tvuikit.umd.js +8 -3
- package/dist/tvuikit.umd.js.map +1 -1
- package/dist/utils/create-context.d.ts +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/package.json +12 -10
package/README.md
CHANGED
|
@@ -1,36 +1,190 @@
|
|
|
1
|
-
#
|
|
1
|
+
# TVUIKit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/tvuikit)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](https://react.dev/)
|
|
6
|
+
[](https://www.typescriptlang.org/)
|
|
7
|
+
[](https://storybook.js.org/)
|
|
8
|
+
[](https://tailwindcss.com/)
|
|
4
9
|
|
|
5
|
-
|
|
10
|
+
> Современный UI-кит на React для проектов The Void Community
|
|
6
11
|
|
|
7
|
-
|
|
8
|
-
- ([FOCKUSTY](https://github.com/FOCKUSTY))
|
|
12
|
+
TVUIKit — это библиотека React-компонентов, построенная с использованием Tailwind CSS. Она предоставляет набор переиспользуемых, доступных и настраиваемых компонентов для быстрой разработки современных пользовательских интерфейсов с темной темой по умолчанию.
|
|
9
13
|
|
|
10
|
-
##
|
|
14
|
+
## ✨ Возможности
|
|
11
15
|
|
|
12
|
-
-
|
|
16
|
+
- **🎨 Готовые компоненты**: Кнопки, поля ввода, выпадающие меню, модальные окна, переключатели, прогресс-бары и многое другое
|
|
17
|
+
- **🌙 Темная тема**: Все компоненты используют темную тему с кастомными CSS-переменными
|
|
18
|
+
- **🎯 Кастомизация**: Легкая настройка через пропсы и CSS-переменные
|
|
19
|
+
- **📱 Адаптивность**: Все компоненты responsive-ready
|
|
20
|
+
- **⚡ Производительность**: Оптимизированные компоненты с минимальным бандлом
|
|
21
|
+
- **🔧 TypeScript**: Полная поддержка TypeScript с типами
|
|
22
|
+
- **♿ Доступность**: Компоненты разработаны с учетом a11y
|
|
13
23
|
|
|
14
|
-
|
|
24
|
+
## 📦 Установка
|
|
15
25
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
```bash
|
|
27
|
+
npm install tvuikit
|
|
28
|
+
# или
|
|
29
|
+
yarn add tvuikit
|
|
30
|
+
# или
|
|
31
|
+
pnpm add tvuikit
|
|
32
|
+
```
|
|
23
33
|
|
|
24
|
-
|
|
34
|
+
## 🚀 Быстрый старт
|
|
25
35
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- [Storybook](https://storybook.js.org)
|
|
30
|
-
- [Eslint](https://eslint.org)
|
|
31
|
-
- [Prettier](https://prettier.io)
|
|
36
|
+
```tsx
|
|
37
|
+
import { Button, Input, Modal } from "tvuikit";
|
|
38
|
+
import "tvuikit/index.css";
|
|
32
39
|
|
|
33
|
-
|
|
40
|
+
function App() {
|
|
41
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
34
42
|
|
|
35
|
-
|
|
36
|
-
-
|
|
43
|
+
return (
|
|
44
|
+
<div className="p-8 bg-(--bg-default) text-(--fg-text)">
|
|
45
|
+
<Button variant="primary" onClick={() => setIsOpen(true)}>
|
|
46
|
+
Открыть модалку
|
|
47
|
+
</Button>
|
|
48
|
+
|
|
49
|
+
<Input placeholder="Введите текст" className="mt-4" />
|
|
50
|
+
|
|
51
|
+
<Modal isOpen={isOpen} onClose={() => setIsOpen(false)}>
|
|
52
|
+
<div className="p-6">
|
|
53
|
+
<h2 className="text-2xl mb-4">Пример модального окна</h2>
|
|
54
|
+
<p>Содержимое модального окна</p>
|
|
55
|
+
</div>
|
|
56
|
+
</Modal>
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Прогресс-индикаторы
|
|
63
|
+
|
|
64
|
+
| Компонент | Описание |
|
|
65
|
+
| ----------------------------- | ---------------------------- |
|
|
66
|
+
| `LinearProgress` | Линейный прогресс-бар |
|
|
67
|
+
| `CircleProgress` | Круговой индикатор загрузки |
|
|
68
|
+
| `EllipsisProgress` | Анимированные точки загрузки |
|
|
69
|
+
| `IndeterminateLinearProgress` | Неопределенный прогресс-бар |
|
|
70
|
+
|
|
71
|
+
### Вспомогательные компоненты
|
|
72
|
+
|
|
73
|
+
| Компонент | Описание |
|
|
74
|
+
| ----------- | ---------------------------------------------------- |
|
|
75
|
+
| `Wrapper` | Контейнер для контента |
|
|
76
|
+
| `Guildline` | Демонстрационные компоненты для типографики и кнопок |
|
|
77
|
+
|
|
78
|
+
### Переменные дизайн-системы
|
|
79
|
+
|
|
80
|
+
| Экспорт | Описание |
|
|
81
|
+
| -------------- | ----------------------------------------------- |
|
|
82
|
+
| `VARIABLES` | Цвета, шрифты и другие константы дизайн-системы |
|
|
83
|
+
| `borderRadius` | Стандартный радиус скругления |
|
|
84
|
+
|
|
85
|
+
## 🎨 Дизайн-система
|
|
86
|
+
|
|
87
|
+
### CSS-переменные
|
|
88
|
+
|
|
89
|
+
Библиотека использует CSS-переменные для управления темой:
|
|
90
|
+
|
|
91
|
+
```css
|
|
92
|
+
:root {
|
|
93
|
+
/* Фоны */
|
|
94
|
+
--bg-default: #0a0a0a;
|
|
95
|
+
--bg-component: #00000065;
|
|
96
|
+
--bg-smooth: #111111;
|
|
97
|
+
--bg-card: #27272780;
|
|
98
|
+
|
|
99
|
+
/* Текст */
|
|
100
|
+
--fg-default: #ededed;
|
|
101
|
+
--fg-text: #ededed;
|
|
102
|
+
--fg-mini-text: #ededed40;
|
|
103
|
+
--fg-component: #272727;
|
|
104
|
+
|
|
105
|
+
/* Цвета кнопок */
|
|
106
|
+
--color-default: #ededed;
|
|
107
|
+
--color-primary: #2aff6a;
|
|
108
|
+
--color-danger: #ff0000;
|
|
109
|
+
--color-secondary: #000000;
|
|
110
|
+
--color-tetriary: #000000;
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## 🛠 Разработка
|
|
115
|
+
|
|
116
|
+
### Предварительные требования
|
|
117
|
+
|
|
118
|
+
- Node.js 18+
|
|
119
|
+
- npm/yarn/pnpm
|
|
120
|
+
|
|
121
|
+
### Клонирование и установка
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
git clone https://github.com/The-Void-Community/tvuikit.git
|
|
125
|
+
cd tvuikit
|
|
126
|
+
npm install
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## 🏗 Архитектура
|
|
130
|
+
|
|
131
|
+
### Технологический стек
|
|
132
|
+
|
|
133
|
+
- **React 19** — UI библиотека
|
|
134
|
+
- **TypeScript** — Типизация
|
|
135
|
+
- **Tailwind CSS 4** — Стилизация через утилитарные классы
|
|
136
|
+
- **Vite** — Сборка и development server
|
|
137
|
+
- **Storybook** — Документация компонентов
|
|
138
|
+
- **ESLint + Prettier** — Линтинг и форматирование
|
|
139
|
+
|
|
140
|
+
### Структура проекта
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
tvuikit/
|
|
144
|
+
├── src/
|
|
145
|
+
│ ├── components/ # Компоненты библиотеки
|
|
146
|
+
│ ├── styles/ # Стили и CSS переменные
|
|
147
|
+
│ ├── utils/ # Вспомогательные функции
|
|
148
|
+
│ └── index.ts # Главный файл экспортов
|
|
149
|
+
├── .storybook/ # Конфигурация Storybook
|
|
150
|
+
├── dist/ # Собранные файлы (генерируется)
|
|
151
|
+
└── package.json
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## 📄 Лицензия
|
|
155
|
+
|
|
156
|
+
MIT © [The Void Community](https://github.com/The-Void-Community). Подробнее в файле [LICENSE](LICENSE).
|
|
157
|
+
|
|
158
|
+
## 👥 Участие в разработке
|
|
159
|
+
|
|
160
|
+
Мы приветствуем вклад! Пожалуйста, ознакомьтесь с нашим [Руководством по вкладу](CONTRIBUTING.md) для подробностей.
|
|
161
|
+
|
|
162
|
+
1. Форкните репозиторий
|
|
163
|
+
2. Создайте ветку для новой функции (`git checkout -b feature/amazing-feature`)
|
|
164
|
+
3. Зафиксируйте изменения (`git commit -m 'Add amazing feature'`)
|
|
165
|
+
4. Запушьте в ветку (`git push origin feature/amazing-feature`)
|
|
166
|
+
5. Откройте Pull Request
|
|
167
|
+
|
|
168
|
+
## 🤝 Сообщество
|
|
169
|
+
|
|
170
|
+
- **GitHub**: [The-Void-Community/tvuikit](https://github.com/The-Void-Community/tvuikit)
|
|
171
|
+
- **Issues**: [Сообщите об ошибках или предложите функции](https://github.com/The-Void-Community/tvuikit/issues)
|
|
172
|
+
- **Discussions**: [Присоединяйтесь к обсуждению](https://github.com/The-Void-Community/tvuikit/discussions)
|
|
173
|
+
|
|
174
|
+
## 🙏 Благодарности
|
|
175
|
+
|
|
176
|
+
- Вдохновлено [HeroUI](https://www.heroui.com) и [MaterialUI](https://mui.com)
|
|
177
|
+
- Собрано с помощью [Vite](https://vitejs.dev/)
|
|
178
|
+
- Стилизовано с помощью [Tailwind CSS](https://tailwindcss.com/)
|
|
179
|
+
- Документировано с помощью [Storybook](https://storybook.js.org/)
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
**Разработано [FOCKUSTY](https://fockusty.netlify.app) • Часть [The Void Community](https://github.com/The-Void-Community)**
|
|
184
|
+
|
|
185
|
+
## 📞 Поддержка
|
|
186
|
+
|
|
187
|
+
По вопросам использования библиотеки:
|
|
188
|
+
|
|
189
|
+
- Откройте [issue](https://github.com/The-Void-Community/tvuikit/issues) на GitHub
|
|
190
|
+
- Свяжитесь с разработчиком: [viserd.yt@gmail.com](mailto:viserd.yt@gmail.com)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
import { Dropdown } from '.';
|
|
3
3
|
declare const meta: Meta<typeof Dropdown>;
|
|
4
|
-
export default meta;
|
|
5
4
|
type Story = StoryObj<typeof Dropdown>;
|
|
6
5
|
export declare const Default: Story;
|
|
7
6
|
export declare const WithCustomTrigger: Story;
|
|
7
|
+
export default meta;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Notifications } from './notifications.component';
|
|
3
|
+
import { Notification } from './notification.component';
|
|
4
|
+
declare const meta: Meta<typeof Notification>;
|
|
5
|
+
type Story = StoryObj<typeof Notification>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const NotificationsTest: StoryObj<typeof Notifications>;
|
|
8
|
+
export default meta;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DetailedHTMLProps, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type NotificationProps = ({
|
|
3
|
+
text?: ReactNode | null | undefined;
|
|
4
|
+
closed?: true;
|
|
5
|
+
} | {
|
|
6
|
+
text: ReactNode;
|
|
7
|
+
closed?: false;
|
|
8
|
+
}) & {
|
|
9
|
+
close: (id: string) => void;
|
|
10
|
+
overwriteClassName?: boolean;
|
|
11
|
+
disablePositionAndInset?: boolean;
|
|
12
|
+
id?: string;
|
|
13
|
+
} & Omit<DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "children" | "id">;
|
|
14
|
+
export declare const Notification: ({ text, closed, className, disablePositionAndInset, id, close, ...props }: NotificationProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Notifications: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { NotificationProps } from './notification.component';
|
|
3
|
+
export type NotificationType = NotificationProps & {
|
|
4
|
+
id: string;
|
|
5
|
+
};
|
|
6
|
+
type FunctionOfNotificationParameter = (data: {
|
|
7
|
+
current: ExtendedNotificationType;
|
|
8
|
+
count: number;
|
|
9
|
+
queue: ExtendedNotificationType[];
|
|
10
|
+
}) => ReactNode;
|
|
11
|
+
type NotificateParameter = ReactNode | FunctionOfNotificationParameter;
|
|
12
|
+
type ExtendedNotificationType = Omit<NotificationType, "text"> & {
|
|
13
|
+
text: NotificateParameter;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* @param duration duration of notification in miliseconds
|
|
17
|
+
* @param delay delay between notifications in miliseconds
|
|
18
|
+
*/
|
|
19
|
+
export declare const useNotifications: (duration: number, delay?: number) => {
|
|
20
|
+
NotificationComponent: import('react').ReactPortal;
|
|
21
|
+
notifications: import('react').RefObject<{
|
|
22
|
+
[key: string]: NotificationType;
|
|
23
|
+
}>;
|
|
24
|
+
notificate: (data: NotificateParameter) => void;
|
|
25
|
+
count: import('react').RefObject<number>;
|
|
26
|
+
queue: ExtendedNotificationType[];
|
|
27
|
+
current: ExtendedNotificationType | null;
|
|
28
|
+
closeAll: () => void;
|
|
29
|
+
close: (id: string) => boolean | undefined;
|
|
30
|
+
};
|
|
31
|
+
export {};
|