denwa-react-shared 1.0.1 → 1.0.3

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.
Files changed (63) hide show
  1. package/dist/denwa-react-shared.cjs.js +441 -0
  2. package/dist/denwa-react-shared.css +1 -0
  3. package/dist/denwa-react-shared.es.js +63671 -0
  4. package/dist/denwa-react-shared.umd.js +441 -0
  5. package/dist/entities/index.d.ts +1 -0
  6. package/dist/entities/session/index.d.ts +1 -0
  7. package/dist/entities/session/model/index.d.ts +2 -0
  8. package/dist/entities/session/model/session.store.d.ts +2 -0
  9. package/dist/entities/session/model/types.d.ts +27 -0
  10. package/dist/index.d.ts +6 -0
  11. package/dist/shared/constants/index.d.ts +3 -0
  12. package/dist/shared/constants/storage.d.ts +7 -0
  13. package/dist/shared/constants/theme.d.ts +24 -0
  14. package/dist/shared/constants/variables.d.ts +16 -0
  15. package/dist/shared/lib/form.d.ts +81 -0
  16. package/dist/shared/lib/hooks/index.d.ts +1 -0
  17. package/dist/shared/lib/hooks/use-view-port.d.ts +24 -0
  18. package/dist/shared/lib/images.d.ts +45 -0
  19. package/dist/shared/lib/index.d.ts +5 -0
  20. package/dist/shared/lib/messages/context.d.ts +2 -0
  21. package/dist/shared/lib/messages/index.d.ts +2 -0
  22. package/dist/shared/lib/messages/provider.d.ts +3 -0
  23. package/dist/shared/lib/messages/types.d.ts +8 -0
  24. package/dist/shared/lib/messages/use-message.d.ts +1 -0
  25. package/dist/shared/lib/storage.d.ts +10 -0
  26. package/dist/shared/schemas/index.d.ts +137 -0
  27. package/dist/shared/types/index.d.ts +148 -0
  28. package/dist/shared/ui/container/index.d.ts +3 -0
  29. package/dist/shared/ui/container/types.d.ts +4 -0
  30. package/dist/shared/ui/date-picker/index.d.ts +3 -0
  31. package/dist/shared/ui/date-picker/types.d.ts +6 -0
  32. package/dist/shared/ui/drawer-form/index.d.ts +3 -0
  33. package/dist/shared/ui/drawer-form/types.d.ts +18 -0
  34. package/dist/shared/ui/image/index.d.ts +3 -0
  35. package/dist/shared/ui/image-upload/data.d.ts +4 -0
  36. package/dist/shared/ui/image-upload/index.d.ts +3 -0
  37. package/dist/shared/ui/image-upload/item.d.ts +3 -0
  38. package/dist/shared/ui/image-upload/schema.d.ts +14 -0
  39. package/dist/shared/ui/image-upload/types.d.ts +50 -0
  40. package/dist/shared/ui/image-upload/upload-button.d.ts +1 -0
  41. package/dist/shared/ui/index.d.ts +11 -0
  42. package/dist/shared/ui/input/index.d.ts +6 -0
  43. package/dist/shared/ui/input-number/index.d.ts +3 -0
  44. package/dist/shared/ui/layout-card/index.d.ts +2 -0
  45. package/dist/shared/ui/material-map/index.d.ts +3 -0
  46. package/dist/shared/ui/material-map/types.d.ts +7 -0
  47. package/dist/shared/ui/readonly-input/index.d.ts +3 -0
  48. package/dist/shared/ui/readonly-input/types.d.ts +3 -0
  49. package/dist/shared/ui/search-input/index.d.ts +3 -0
  50. package/dist/shared/ui/search-input/types.d.ts +15 -0
  51. package/dist/shared/ui/spin/index.d.ts +3 -0
  52. package/dist/shared/ui/spin/types.d.ts +4 -0
  53. package/dist/shared/ui/text-editor/data.d.ts +16 -0
  54. package/dist/shared/ui/text-editor/element.d.ts +4 -0
  55. package/dist/shared/ui/text-editor/index.d.ts +1 -0
  56. package/dist/shared/ui/text-editor/lib.d.ts +67 -0
  57. package/dist/shared/ui/text-editor/link-button.d.ts +1 -0
  58. package/dist/shared/ui/text-editor/link-component.d.ts +3 -0
  59. package/dist/shared/ui/text-editor/remove-link-button.d.ts +1 -0
  60. package/dist/shared/ui/text-editor/text-editor.d.ts +12 -0
  61. package/dist/shared/ui/text-editor/toolbar.d.ts +1 -0
  62. package/dist/shared/ui/text-editor/types.d.ts +30 -0
  63. package/package.json +86 -86
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ export declare const useUploadItemSchema: () => z.ZodObject<{
3
+ altRU: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
4
+ altEN: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
5
+ altAR: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ altRU?: string | undefined;
8
+ altEN?: string | undefined;
9
+ altAR?: string | undefined;
10
+ }, {
11
+ altRU?: string | undefined;
12
+ altEN?: string | undefined;
13
+ altAR?: string | undefined;
14
+ }>;
@@ -0,0 +1,50 @@
1
+ import { UploadProps } from 'antd';
2
+ import { UploadFile } from 'antd/lib/upload/interface';
3
+ import { IServerImageForm, IUploadImage } from '../../types';
4
+ export interface BaseImageUploadProps extends UploadProps {
5
+ serverImages: IServerImageForm[];
6
+ updatedImages?: IUploadImage[];
7
+ language: string;
8
+ onUpdateData: (data: IUploadImage) => void;
9
+ onDeleteImage: (uid: string) => void;
10
+ onImagesOrder?: (data: string[]) => void;
11
+ onSuccessUpload: (newFile: {
12
+ tempName: string;
13
+ uid: string;
14
+ }) => void;
15
+ onUpdateTempImage: (data: FormData) => {
16
+ status: number;
17
+ data: {
18
+ data: {
19
+ tempFiles: string[];
20
+ };
21
+ };
22
+ error?: unknown;
23
+ };
24
+ }
25
+ export interface ItemProps {
26
+ file: IUploadFile;
27
+ language: string;
28
+ maxCount: number | undefined;
29
+ errorsUid: string[];
30
+ disabled: boolean;
31
+ isLoading: boolean;
32
+ updatedImages?: IUploadImage[];
33
+ actions: {
34
+ download: () => void;
35
+ preview: () => void;
36
+ remove: () => void;
37
+ };
38
+ onUpdateData: (data: IUploadImage) => void;
39
+ onDeleteImage: (uid: string) => void;
40
+ onDeleteError: (uid: string) => void;
41
+ }
42
+ export interface IUploadFile extends UploadFile {
43
+ altRU?: string;
44
+ altEN?: string;
45
+ altAR?: string;
46
+ }
47
+ export interface IFormImage {
48
+ tempName: string;
49
+ uid: string;
50
+ }
@@ -0,0 +1 @@
1
+ export declare const UploadButton: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ export * from './container';
2
+ export * from './date-picker';
3
+ export * from './drawer-form';
4
+ export * from './image';
5
+ export * from './image-upload';
6
+ export * from './input';
7
+ export * from './input-number';
8
+ export * from './layout-card';
9
+ export * from './readonly-input';
10
+ export * from './spin';
11
+ export * from './text-editor';
@@ -0,0 +1,6 @@
1
+ import { InputProps } from 'antd';
2
+ import { FC } from 'react';
3
+ import { TextAreaProps } from 'antd/es/input';
4
+ export declare const BaseInput: FC<InputProps>;
5
+ export declare const BasePasswordInput: FC<InputProps>;
6
+ export declare const BaseTextAreaInput: FC<TextAreaProps>;
@@ -0,0 +1,3 @@
1
+ import { InputNumberProps } from 'antd';
2
+ import { FC } from 'react';
3
+ export declare const BaseInputNumber: FC<InputNumberProps>;
@@ -0,0 +1,2 @@
1
+ import { DetailedHTMLProps, FC } from 'react';
2
+ export declare const LayoutCard: FC<DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { BaseMaterialMapProps } from './types';
3
+ export declare const BaseMaterialMap: FC<BaseMaterialMapProps>;
@@ -0,0 +1,7 @@
1
+ export interface BaseMaterialMapProps {
2
+ apikey: string | undefined;
3
+ suggestApikey: string | undefined;
4
+ defaultCoords?: number[] | null;
5
+ disabled?: boolean;
6
+ onPlacemarkMove?: (coords: number[]) => void;
7
+ }
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { BaseReadonlyInputProps } from './types';
3
+ export declare const BaseReadonlyInput: FC<BaseReadonlyInputProps>;
@@ -0,0 +1,3 @@
1
+ export interface BaseReadonlyInputProps {
2
+ value: string | number | undefined;
3
+ }
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { BaseSearchInputProps } from './types';
3
+ export declare const BaseSearchInput: FC<BaseSearchInputProps>;
@@ -0,0 +1,15 @@
1
+ import { CSSProperties } from 'react';
2
+ import { OptionType } from '../../types';
3
+ export interface BaseSearchInputProps {
4
+ dataName: string | undefined;
5
+ value: string | undefined;
6
+ searchTypeDefaultValue: string;
7
+ searchTypeOptions: OptionType[];
8
+ placeholder?: string;
9
+ style?: CSSProperties;
10
+ searchTypeStyle?: CSSProperties;
11
+ loading?: boolean;
12
+ disabled?: boolean;
13
+ onSearch: (value: string, searchTypeValue: string, callback: (data: OptionType[]) => void) => void;
14
+ onChange: (value: string) => void;
15
+ }
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { BaseSpinProps } from './types';
3
+ export declare const BaseSpin: FC<BaseSpinProps>;
@@ -0,0 +1,4 @@
1
+ import { SpinProps } from 'antd';
2
+ export interface BaseSpinProps extends SpinProps {
3
+ spinFontSize?: number;
4
+ }
@@ -0,0 +1,16 @@
1
+ export declare const HOTKEYS: {
2
+ 'mod+b': string;
3
+ 'mod+i': string;
4
+ 'mod+u': string;
5
+ 'mod+`': string;
6
+ };
7
+ export declare const LIST_TYPES: string[];
8
+ export declare const TEXT_ALIGN_TYPES: string[];
9
+ export declare const allowedUrls: string[];
10
+ export declare const useIconButtons: () => {
11
+ id: string;
12
+ title: any;
13
+ format: string;
14
+ icon: import("react/jsx-runtime").JSX.Element;
15
+ type: string;
16
+ }[];
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import { ElementProps, LeafProps } from './types';
3
+ export declare const Element: FC<ElementProps>;
4
+ export declare const Leaf: FC<LeafProps>;
@@ -0,0 +1 @@
1
+ export * from './text-editor';
@@ -0,0 +1,67 @@
1
+ import { BaseEditor, Descendant } from 'slate';
2
+ import { ReactEditor } from 'slate-react';
3
+ /**
4
+ * @description Активна ли кнопка блока
5
+ * @param editor - slate editor
6
+ * @param format - тип параметра
7
+ * @param blockType - тип блока
8
+ * @returns тип кнопки primary или default
9
+ */
10
+ export declare const isBlockActive: (editor: BaseEditor & ReactEditor, format: string, blockType?: "type" | "align") => "primary" | "default";
11
+ /**
12
+ * @description Активна ли кнопка маркировки
13
+ * @param editor - slate editor
14
+ * @param format - тип параметра
15
+ * @returns тип кнопки primary или default
16
+ */
17
+ export declare const isMarkActive: (editor: BaseEditor & ReactEditor, format: string) => "primary" | "default";
18
+ /**
19
+ * @description Смена маркировки
20
+ * @param editor - slate editor
21
+ * @param format - тип параметра
22
+ */
23
+ export declare const toggleMark: (editor: BaseEditor & ReactEditor, format: string) => void;
24
+ /**
25
+ * @description Смена блока
26
+ * @param editor - slate editor
27
+ * @param format - тип параметра
28
+ */
29
+ export declare const toggleBlock: (editor: BaseEditor & ReactEditor, format: string) => void;
30
+ /**
31
+ * @description Активна ли ссылка
32
+ * @param editor - slate editor
33
+ */
34
+ export declare const isLinkActive: (editor: BaseEditor & ReactEditor) => boolean;
35
+ /**
36
+ * @description Убрать ссылку
37
+ * @param editor - slate editor
38
+ */
39
+ export declare const unwrapLink: (editor: BaseEditor & ReactEditor) => void;
40
+ /**
41
+ * @description Вставить ссылку
42
+ * @param editor - slate editor
43
+ * @param url - ссылка
44
+ */
45
+ export declare const insertLink: (editor: BaseEditor & ReactEditor, url: string) => void;
46
+ /**
47
+ * @description Добавить ссылку
48
+ * @param editor - slate editor
49
+ */
50
+ export declare const wrapLink: (editor: BaseEditor & ReactEditor, url: string) => void;
51
+ /**
52
+ * @description Поддержка ссылок в редакторе
53
+ * @param editor - slate editor
54
+ */
55
+ export declare const withInlines: (editor: BaseEditor & ReactEditor) => BaseEditor & ReactEditor;
56
+ /**
57
+ * @description Экранирование специальных символов в заданной строке текста
58
+ * @param {string} string - Исходная строка
59
+ * @return {string}
60
+ */
61
+ export declare const escapeHtml: (string: string) => string;
62
+ /**
63
+ * @description Конвертация содержимого редактора в html
64
+ * @param {Descendant} node - node узел
65
+ * @return {string} Возвращает html строку
66
+ */
67
+ export declare const serializeToHtml: (node: Descendant) => string;
@@ -0,0 +1 @@
1
+ export declare const LinkButton: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { ElementProps } from './types';
3
+ export declare const LinkComponent: FC<ElementProps>;
@@ -0,0 +1 @@
1
+ export declare const RemoveLinkButton: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { FC } from 'react';
2
+ import { BaseEditor } from 'slate';
3
+ import { ReactEditor } from 'slate-react';
4
+ import { BaseTextEditorProps, CustomElement, CustomText } from './types';
5
+ declare module 'slate' {
6
+ interface CustomTypes {
7
+ Editor: BaseEditor & ReactEditor;
8
+ Element: CustomElement;
9
+ Text: CustomText;
10
+ }
11
+ }
12
+ export declare const BaseTextEditor: FC<BaseTextEditorProps>;
@@ -0,0 +1 @@
1
+ export declare const Toolbar: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,30 @@
1
+ import { RenderElementProps, RenderLeafProps } from 'slate-react';
2
+ export interface BaseTextEditorProps {
3
+ language: string;
4
+ readOnly?: boolean;
5
+ isResetContent?: boolean;
6
+ content?: string;
7
+ onSetContent: (contentJSON: string, lang: string) => void;
8
+ onSetHtml: (html: string, lang: string) => void;
9
+ onResetContent?: () => void;
10
+ }
11
+ export interface ElementProps extends RenderElementProps {
12
+ element: any;
13
+ }
14
+ export interface LeafProps extends RenderLeafProps {
15
+ leaf: any;
16
+ }
17
+ export type ElementTypes = 'paragraph' | 'list-item' | 'numbered-list' | 'bulleted-list' | 'link';
18
+ export type CustomElement = {
19
+ type: ElementTypes;
20
+ url?: string | ArrayBuffer | null;
21
+ href?: string;
22
+ align?: 'left' | 'center' | 'right' | 'justify';
23
+ children: CustomText[];
24
+ };
25
+ export type CustomText = {
26
+ text: string;
27
+ bold?: boolean;
28
+ italic?: boolean;
29
+ underline?: boolean;
30
+ };
package/package.json CHANGED
@@ -1,86 +1,86 @@
1
- {
2
- "name": "denwa-react-shared",
3
- "private": false,
4
- "version": "1.0.1",
5
- "type": "module",
6
- "author": "Denwa",
7
- "main": "dist/denwa-react-shared.umd.js",
8
- "module": "dist/denwa-react-shared.es.js",
9
- "files": [
10
- "dist"
11
- ],
12
- "types": "dist/index.d.ts",
13
- "exports": {
14
- ".": {
15
- "types": {
16
- "import": "./dist/index.d.ts",
17
- "require": "./dist/index.d.ts"
18
- },
19
- "import": "./dist/denwa-react-shared.es.js",
20
- "require": "./dist/denwa-react-shared.cjs.js"
21
- }
22
- },
23
- "scripts": {
24
- "dev": "vite",
25
- "build": "tsc -b && vite build",
26
- "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0 --fix",
27
- "preview": "vite preview",
28
- "prepare-push": "npm run lint && npm run build",
29
- "release:minor": "npm run build && standard-version minor",
30
- "release:patch": "npm run build && standard-version patch"
31
- },
32
- "dependencies": {
33
- "@ant-design/icons": "^6.0.0",
34
- "@dnd-kit/core": "^6.3.1",
35
- "@dnd-kit/sortable": "^10.0.0",
36
- "@dnd-kit/utilities": "^3.2.2",
37
- "@hookform/resolvers": "^5.0.1",
38
- "@pbe/react-yandex-maps": "^1.2.5",
39
- "@tanstack/react-router": "^1.120.16",
40
- "antd": "^5.25.4",
41
- "axios": "^1.9.0",
42
- "classnames": "^2.5.1",
43
- "dayjs": "^1.11.13",
44
- "is-hotkey": "^0.2.0",
45
- "libphonenumber-js": "^1.12.9",
46
- "react": "^19.1.0",
47
- "react-dom": "^19.1.0",
48
- "react-hook-form": "^7.57.0",
49
- "react-i18next": "^15.5.2",
50
- "react-use": "^17.6.0",
51
- "slate": "^0.115.1",
52
- "slate-dom": "^0.114.0",
53
- "slate-history": "^0.113.1",
54
- "slate-react": "^0.114.2",
55
- "validator": "^13.15.15",
56
- "zod": "^3.25.55",
57
- "zustand": "^5.0.5"
58
- },
59
- "devDependencies": {
60
- "@eslint/eslintrc": "^3.3.1",
61
- "@eslint/js": "^9.28.0",
62
- "@types/is-hotkey": "^0.1.10",
63
- "@types/react": "^19.1.6",
64
- "@types/react-dom": "^19.1.6",
65
- "@types/validator": "^13.15.1",
66
- "@vitejs/plugin-react-swc": "^3.10.1",
67
- "autoprefixer": "^10.4.21",
68
- "eslint": "^9.28.0",
69
- "eslint-config-prettier": "^10.1.5",
70
- "eslint-plugin-prettier": "^5.4.1",
71
- "eslint-plugin-react-hooks": "^5.2.0",
72
- "eslint-plugin-react-refresh": "^0.4.20",
73
- "globals": "^16.2.0",
74
- "postcss": "^8.5.4",
75
- "postcss-cli": "^11.0.1",
76
- "postcss-custom-media": "^11.0.6",
77
- "postcss-import": "^16.1.0",
78
- "postcss-nesting": "^13.0.1",
79
- "prettier": "^3.5.3",
80
- "standard-version": "^9.5.0",
81
- "typescript": "~5.8.3",
82
- "typescript-eslint": "^8.33.1",
83
- "vite": "^6.3.5",
84
- "vite-plugin-dts": "^4.5.4"
85
- }
86
- }
1
+ {
2
+ "name": "denwa-react-shared",
3
+ "private": false,
4
+ "version": "1.0.3",
5
+ "type": "module",
6
+ "author": "Denwa",
7
+ "main": "dist/denwa-react-shared.umd.js",
8
+ "module": "dist/denwa-react-shared.es.js",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "types": "dist/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "types": {
16
+ "import": "./dist/index.d.ts",
17
+ "require": "./dist/index.d.ts"
18
+ },
19
+ "import": "./dist/denwa-react-shared.es.js",
20
+ "require": "./dist/denwa-react-shared.cjs.js"
21
+ }
22
+ },
23
+ "scripts": {
24
+ "dev": "vite",
25
+ "build": "tsc -b && vite build",
26
+ "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0 --fix",
27
+ "preview": "vite preview",
28
+ "prepare-push": "npm run lint && npm run build",
29
+ "release:minor": "npm run build && standard-version minor",
30
+ "release:patch": "npm run build && standard-version patch"
31
+ },
32
+ "dependencies": {
33
+ "@ant-design/icons": "^6.0.0",
34
+ "@dnd-kit/core": "^6.3.1",
35
+ "@dnd-kit/sortable": "^10.0.0",
36
+ "@dnd-kit/utilities": "^3.2.2",
37
+ "@hookform/resolvers": "^5.0.1",
38
+ "@pbe/react-yandex-maps": "^1.2.5",
39
+ "@tanstack/react-router": "^1.120.16",
40
+ "antd": "^5.25.4",
41
+ "axios": "^1.9.0",
42
+ "classnames": "^2.5.1",
43
+ "dayjs": "^1.11.13",
44
+ "is-hotkey": "^0.2.0",
45
+ "libphonenumber-js": "^1.12.9",
46
+ "react": "^19.1.0",
47
+ "react-dom": "^19.1.0",
48
+ "react-hook-form": "^7.57.0",
49
+ "react-i18next": "^15.5.2",
50
+ "react-use": "^17.6.0",
51
+ "slate": "^0.115.1",
52
+ "slate-dom": "^0.114.0",
53
+ "slate-history": "^0.113.1",
54
+ "slate-react": "^0.114.2",
55
+ "validator": "^13.15.15",
56
+ "zod": "^3.25.55",
57
+ "zustand": "^5.0.5"
58
+ },
59
+ "devDependencies": {
60
+ "@eslint/eslintrc": "^3.3.1",
61
+ "@eslint/js": "^9.28.0",
62
+ "@types/is-hotkey": "^0.1.10",
63
+ "@types/react": "^19.1.6",
64
+ "@types/react-dom": "^19.1.6",
65
+ "@types/validator": "^13.15.1",
66
+ "@vitejs/plugin-react-swc": "^3.10.1",
67
+ "autoprefixer": "^10.4.21",
68
+ "eslint": "^9.28.0",
69
+ "eslint-config-prettier": "^10.1.5",
70
+ "eslint-plugin-prettier": "^5.4.1",
71
+ "eslint-plugin-react-hooks": "^5.2.0",
72
+ "eslint-plugin-react-refresh": "^0.4.20",
73
+ "globals": "^16.2.0",
74
+ "postcss": "^8.5.4",
75
+ "postcss-cli": "^11.0.1",
76
+ "postcss-custom-media": "^11.0.6",
77
+ "postcss-import": "^16.1.0",
78
+ "postcss-nesting": "^13.0.1",
79
+ "prettier": "^3.5.3",
80
+ "standard-version": "^9.5.0",
81
+ "typescript": "~5.8.3",
82
+ "typescript-eslint": "^8.33.1",
83
+ "vite": "^6.3.5",
84
+ "vite-plugin-dts": "^4.5.4"
85
+ }
86
+ }