Skip to content

Commit cd5da4c

Browse files
rc v0.5.0
1 parent a4e58aa commit cd5da4c

File tree

223 files changed

+12461
-28023
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

223 files changed

+12461
-28023
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ npm-debug.log
1010
npm-debug.log.*
1111

1212
# storybook
13-
/storybook-static
13+
storybook-static
1414
.storybook
1515

1616
# *Storm
@@ -43,3 +43,5 @@ coverage
4343
/.idea/
4444

4545
/storybook-static
46+
47+
*storybook.log

.storybook/main.ts

Lines changed: 84 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,96 @@ import type { StorybookConfig } from '@storybook/react-webpack5';
33
const config: StorybookConfig = {
44
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
55
addons: [
6-
'@storybook/addon-links',
7-
'@storybook/addon-essentials',
8-
'@storybook/preset-create-react-app',
6+
'@storybook/addon-webpack5-compiler-swc',
97
'@storybook/addon-onboarding',
8+
'@storybook/addon-essentials',
9+
'@chromatic-com/storybook',
1010
'@storybook/addon-interactions',
11-
'@storybook/addon-viewport'
1211
],
1312
framework: {
1413
name: '@storybook/react-webpack5',
15-
options: {
16-
builder: {
17-
useSWC: true,
18-
},
19-
},
14+
options: {},
2015
},
21-
docs: {
22-
autodocs: 'tag',
16+
webpackFinal: async (config) => {
17+
// ✅ Гарантируем, что module и module.rules существуют
18+
if (!config.module) {
19+
config.module = { rules: [] };
20+
}
21+
if (!config.module.rules) {
22+
config.module.rules = [];
23+
}
24+
25+
// ✅ Удаляем встроенные Storybook'ом правила для SVG и других медиафайлов
26+
config.module.rules = config.module.rules.filter(
27+
(rule) =>
28+
rule &&
29+
typeof rule === 'object' &&
30+
'test' in rule &&
31+
rule.test instanceof RegExp &&
32+
!rule.test.toString().includes(
33+
'(svg|ico|jpg|jpeg|png|apng|gif|eot|otf|webp|ttf|woff|woff2|cur|ani|pdf)'
34+
)
35+
);
36+
37+
// ✅ Поддержка SVG как React-компонентов (если импортируется с `?react`)
38+
config.module.rules.unshift({
39+
test: /\.svg$/i,
40+
oneOf: [
41+
{
42+
resourceQuery: /react/, // 🔥 `?react` → импорт как React-компонент
43+
use: [
44+
{
45+
loader: '@svgr/webpack',
46+
options: {
47+
icon: true,
48+
esModule: true,
49+
},
50+
},
51+
],
52+
},
53+
{
54+
// 🔥 Обычные импорты SVG без `?react` → обрабатываются как файлы
55+
type: 'asset/resource',
56+
},
57+
],
58+
});
59+
60+
// ✅ Восстанавливаем обработку PNG, JPG, шрифтов и других медиафайлов
61+
config.module.rules.push({
62+
test: /\.(png|jpg|jpeg|gif|woff|woff2|eot|ttf)$/i,
63+
type: 'asset/resource',
64+
});
65+
66+
// ✅ Поддержка SCSS/SASS
67+
config.module.rules.push({
68+
test: /\.scss$/,
69+
use: ['style-loader', 'css-loader', 'sass-loader'],
70+
});
71+
72+
// ✅ Поддержка Babel для JS/TS файлов
73+
config.module.rules.push({
74+
test: /\.(ts|tsx|js|jsx)$/,
75+
exclude: /node_modules/,
76+
use: {
77+
loader: 'babel-loader',
78+
},
79+
});
80+
81+
// ✅ Поддержка alias
82+
if (!config.resolve) {
83+
config.resolve = {};
84+
}
85+
config.resolve = {
86+
...config.resolve,
87+
extensions: ['.tsx', '.ts', '.js', '.jsx', '.scss', '.css', '.svg'],
88+
alias: {
89+
...config.resolve?.alias,
90+
path: require.resolve('path-browserify'),
91+
},
92+
};
93+
94+
return config;
2395
},
24-
staticDirs: ['../public'],
2596
};
97+
2698
export default config;

.storybook/preview.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
import type { Preview } from '@storybook/react';
2+
import { fn } from '@storybook/test';
23
import '../src/index.scss';
34

45
const preview: Preview = {
56
parameters: {
6-
actions: { argTypesRegex: '^on[A-Z].*' },
7+
actions: {
8+
onClick: fn(),
9+
onChange: fn(),
10+
},
711
controls: {
812
matchers: {
913
color: /(background|color)$/i,
1014
date: /Date$/i,
1115
},
1216
},
17+
viewMode: 'docs',
1318
},
1419
};
1520

babel.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
presets: [
3+
'@babel/preset-env', // Поддержка современных возможностей JavaScript
4+
'@babel/preset-react', // Добавляем поддержку JSX
5+
'@babel/preset-typescript' // Поддержка TypeScript
6+
],
7+
};

global.d.ts

Lines changed: 15 additions & 202 deletions
Original file line numberDiff line numberDiff line change
@@ -1,204 +1,17 @@
1-
// interface Tone {
2-
// name: string;
3-
// description: string;
4-
// iconEmoji: string;
5-
// }
6-
//
7-
// type Primitive = string | number | boolean | undefined | null | Date | File;
8-
9-
// type SetTails<T, R extends Primitive> = T extends Array<unknown>
10-
// ? Array<T[number] extends Primitive ? R : SetTails<T[number], R>>
11-
// : {
12-
// [K in keyof T]: T[K] extends Primitive ? R : SetTails<T[K], R>;
13-
// };
14-
15-
// type ProxyConfig = {
16-
// api: string;
17-
// servername: string;
18-
// port: string;
19-
// };
20-
// interface WidgetConfig {
21-
// apiKey: string;
22-
// useDefault: boolean;
23-
// maxTokens: number;
24-
// proxyConfig: ProxyConfig;
25-
// }
26-
//
27-
// interface AITranslateWidgetConfig extends WidgetConfig {
28-
// defaultLanguage: string;
29-
// languages: string[];
30-
// }
31-
//
32-
// interface AIRephraseWidgetConfig extends WidgetConfig {
33-
// defaultTone: string;
34-
// Tones: Tone[];
35-
// }
36-
37-
// interface QBConfig {
38-
// credentials: {
39-
// appId: number;
40-
// accountKey: string;
41-
// authKey: string;
42-
// authSecret: string;
43-
// sessionToken: string; // ??? ui-kit
44-
// };
45-
// configAIApi: {
46-
// // ui-kit
47-
// AIAnswerAssistWidgetConfig: WidgetConfig;
48-
// AITranslateWidgetConfig: AITranslateWidgetConfig;
49-
// AIRephraseWidgetConfig: AIRephraseWidgetConfig;
50-
// };
51-
// appConfig: {
52-
// maxFileSize: number; // ui-kit
53-
// sessionTimeOut: number; // ?? webRTc -> ui-kit
54-
// chatProtocol: {
55-
// active: number;
56-
// };
57-
// debug: boolean;
58-
// enableForwarding: boolean; // ui-kit
59-
// enableReplying: boolean; // ui-kit
60-
// regexUserName?: string; // ui-kit
61-
// endpoints: {
62-
// api: string;
63-
// chat: string;
64-
// };
65-
// // on: {
66-
// // sessionExpired: (handleResponse: any, retry: any) => Promise<void>;
67-
// // };
68-
// streamManagement: {
69-
// enable: boolean;
70-
// };
71-
// };
72-
// }
73-
74-
/*
75-
* QuickBlox Types - start
76-
77-
*/
78-
791
type Dictionary<T> = Record<string, T>;
80-
//
81-
// type RequiredProps<T, K extends keyof T> = T & Required<Pick<T, K>>;
82-
83-
// declare enum QBChatProtocol {
84-
// BOSH = 1,
85-
// WebSockets = 2,
86-
// }
87-
//
88-
// interface ICEServer {
89-
// urls: string;
90-
// username: string;
91-
// credential: string;
92-
// }
93-
94-
// declare enum QBChatDialogType {
95-
// PUBLIC_GROUP = 1,
96-
// GROUP = 2,
97-
// PRIVATE = 3,
98-
// }
99-
100-
// declare interface QBChatDialog {
101-
// /** ID of the dialog. Generated automatically by the server after dialog creation. */
102-
// _id: string;
103-
// /** ID of dialog's owner. */
104-
// user_id: QBUser['id'];
105-
// /** Date & time when a record was created, filled automatically. */
106-
// created_at: string;
107-
// /** Date & time when a record was created, filled automatically. */
108-
// updated_at: string;
109-
// /**
110-
// * Type of dialog. Possible values are:
111-
// * - type=1 (`PUBLIC_GROUP`)
112-
// * - type=2 (`GROUP`)
113-
// * - type=3 (`PRIVATE`)
114-
// */
115-
// type: QBChatDialogType;
116-
// /**
117-
// * Name of a group chat. Makes sense if type=1 (`PUBLIC_GROUP`) or type=2 (`GROUP`).
118-
// * The maximum length for the dialog name is 200 symbols.
119-
// */
120-
// name: string;
121-
// /**
122-
// * Photo of a group chat. Makes sense if type=1 (`PUBLIC_GROUP`) or type=2 (`GROUP`).
123-
// * Can contain a link to a file in Content module, Custom Objects module or just a web link.
124-
// */
125-
// photo: null | string;
126-
// /**
127-
// * JID of XMPP room for group chat to connect. Nil if type=3 (PRIVATE).
128-
// * Generated automatically by the server after dialog creation.
129-
// */
130-
// xmpp_room_jid: string | null;
131-
// /** Array of users' IDs - dialog occupants. Does not make sense if type=1 (PUBLIC_GROUP). */
132-
// occupants_ids: number[];
133-
// /** Last sent message in this dialog. */
134-
// last_message: string | null;
135-
// /** Timestamp of last sent message in this dialog. */
136-
// last_message_date_sent: number | null | string; // todo: switch type to number
137-
// /** ID of the user who sent last message in this dialog. */
138-
// last_message_user_id: QBUser['id'] | null;
139-
// /** ID of last message in this dialog. */
140-
// last_message_id: string | null;
141-
// /** Number of unread messages in this dialog for a current user. */
142-
// unread_messages_count: number | null;
143-
// /**
144-
// * - Information about class and fields in Custom Objects.
145-
// * - Any dialog can be extended using Custom Objects to store additional parameters.
146-
// */
147-
// data?: {
148-
// /** Class name in Custom Objects. */
149-
// class_name: string;
150-
// /** Field name of class in Custom Objects. Can be many: 1..N. */
151-
// [field_name_N: string]: QBCustomField;
152-
// };
153-
// new_occupants_ids?: number[]; // TODO: EXTENDS TYPE AND SWITCH TO THIS NEW TYPE
154-
// joined?: boolean; // TODO: EXTENDS TYPE AND SWITCH TO THIS NEW TYPE
155-
// }
156-
157-
// declare interface QBChatNewMessage {
158-
// type: 'chat' | 'groupchat';
159-
// body: string;
160-
// notification_type?: string; // TODO: NED ADD TO TYPE
161-
// dialog_id: QBChatDialog['_id']; // TODO: NED ADD TO TYPE
162-
// extension: {
163-
// attachments?: ChatMessageAttachment[];
164-
// save_to_history: 0 | 1;
165-
// dialog_id: QBChatDialog['_id'];
166-
// notification_type?: string; // TODO: NED ADD TO TYPE
167-
// sender_id?: QBUser['id']; // TODO: NED ADD TO TYPE
168-
// qb_message_action?: 'forward' | 'reply'; // TODO: NED ADD TO TYPE
169-
// origin_sender_name?: string; // TODO: NED ADD TO TYPE
170-
// qb_original_messages?: string; // TODO: NED ADD TO TYPE
171-
// };
172-
// markable: 0 | 1;
173-
// }
1742

175-
// TODO: add export to SDK
176-
// type ChatConnectParams =
177-
// | {
178-
// /** Connect to the chat by user id */
179-
// userId: QBUser['id'];
180-
// /** The user's password or session token */
181-
// password: string;
182-
// }
183-
// | {
184-
// /** Connect to the chat by user jid */
185-
// jid: string;
186-
// /** The user's password or session token */
187-
// password: string;
188-
// }
189-
// | {
190-
// /** Connect to the chat by user's email */
191-
// email: string;
192-
// /** The user's password or session token */
193-
// password: string;
194-
// };
195-
//
196-
// type QBCustomField =
197-
// | string
198-
// | string[]
199-
// | number
200-
// | number[]
201-
// | boolean
202-
// | boolean[]
203-
// | null
204-
// | undefined;
3+
declare module "*.svg" {
4+
import React from "react";
5+
const content: (props: React.SVGProps<SVGSVGElement>) => JSX.Element;
6+
export default content;
7+
}
8+
9+
declare module "*.svg?react" {
10+
import React from "react";
11+
const content: (props: React.SVGProps<SVGSVGElement>) => JSX.Element;
12+
export default content;
13+
}
14+
15+
interface Window {
16+
webkitAudioContext: typeof AudioContext;
17+
}

0 commit comments

Comments
 (0)