mosuk-ui 1.0.19 → 1.0.20
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/components/input-otp/.partials/components/component.interface.d.ts +2 -2
- package/components/input-otp/.partials/components/component.js +1 -1
- package/components/input-otp/.partials/components/input/component.js +1 -1
- package/package.json +16 -26
- package/providers/tbank/.partials/provider.js +50 -24
- package/types/css.d.ts +4 -0
- package/types/react-file-icon.d.ts +25 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Input } from '../../../../components/input/index.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { OTPField } from '@base-ui/react/otp-field';
|
|
3
3
|
type InputOtpOwnProps = {
|
|
4
4
|
size?: Input.Props['size'];
|
|
5
5
|
variant?: Input.Props['variant'];
|
|
@@ -7,5 +7,5 @@ type InputOtpOwnProps = {
|
|
|
7
7
|
isReadOnly?: boolean;
|
|
8
8
|
isRequired?: boolean;
|
|
9
9
|
};
|
|
10
|
-
export type InputOtpProps = InputOtpOwnProps & Omit<
|
|
10
|
+
export type InputOtpProps = InputOtpOwnProps & Omit<OTPField.Root.Props, 'disabled' | 'readOnly' | 'required' | 'size'>;
|
|
11
11
|
export {};
|
|
@@ -23,7 +23,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
import { InputOtpInput } from '../../../../components/input-otp/.partials/components/input/component.js';
|
|
24
24
|
import { INPUT_OTP_DEFAULT_SIZE, INPUT_OTP_DEFAULT_VARIANT, } from '../../../../components/input-otp/.partials/constants/component.constants.js';
|
|
25
25
|
import styles from '../../../../components/input-otp/.partials/styles/component.module.css';
|
|
26
|
-
import {
|
|
26
|
+
import { OTPField } from '@base-ui/react/otp-field';
|
|
27
27
|
import classNames from 'classnames';
|
|
28
28
|
import React, { Children, cloneElement, isValidElement, useId, } from 'react';
|
|
29
29
|
export function InputOtp(_a) {
|
|
@@ -22,7 +22,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import { Input } from '../../../../../components/input/index.js';
|
|
24
24
|
import styles from '../../../../../components/input-otp/.partials/styles/component.module.css';
|
|
25
|
-
import {
|
|
25
|
+
import { OTPField } from '@base-ui/react/otp-field';
|
|
26
26
|
import classNames from 'classnames';
|
|
27
27
|
import React from 'react';
|
|
28
28
|
export function InputOtpInput(_a) {
|
package/package.json
CHANGED
|
@@ -1,38 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mosuk-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
4
4
|
"author": "mosuk",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"private": false,
|
|
7
6
|
"type": "module",
|
|
8
|
-
"style": "./index.css",
|
|
9
7
|
"dependencies": {
|
|
10
|
-
"@base-ui/react": "^1.
|
|
11
|
-
"@
|
|
12
|
-
"@dnd-kit/modifiers": "^9.0.0",
|
|
13
|
-
"@dnd-kit/sortable": "^10.0.0",
|
|
14
|
-
"@dnd-kit/utilities": "^3.2.2",
|
|
8
|
+
"@base-ui/react": "^1.6.0",
|
|
9
|
+
"@internationalized/date": "^3.12.4",
|
|
15
10
|
"classnames": "^2.5.1",
|
|
16
|
-
"date-fns": "^4.1.0",
|
|
17
11
|
"lucide-react": "latest",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
12
|
+
"react-aria": "^3.53.1",
|
|
13
|
+
"react-aria-components": "^1.22.1",
|
|
20
14
|
"react-file-icon": "^1.6.0",
|
|
21
|
-
"react-
|
|
22
|
-
"react-imask": "^7.6.1",
|
|
15
|
+
"react-syntax-highlighter": "^16.1.2",
|
|
23
16
|
"react-textarea-autosize": "^8.5.9",
|
|
24
|
-
"
|
|
17
|
+
"swiper": "^11.2.10"
|
|
25
18
|
},
|
|
26
19
|
"peerDependencies": {
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"recharts": "^2.15.0"
|
|
20
|
+
"react": "19.1.0",
|
|
21
|
+
"react-dom": "19.1.0",
|
|
22
|
+
"recharts": "^2.15.0",
|
|
23
|
+
"tailwindcss": "^4.3.3"
|
|
32
24
|
},
|
|
33
|
-
"
|
|
34
|
-
"
|
|
25
|
+
"peerDependenciesMeta": {
|
|
26
|
+
"recharts": {
|
|
27
|
+
"optional": true
|
|
28
|
+
}
|
|
35
29
|
},
|
|
30
|
+
"style": "./index.css",
|
|
36
31
|
"exports": {
|
|
37
32
|
".": {
|
|
38
33
|
"style": "./index.css",
|
|
@@ -474,10 +469,5 @@
|
|
|
474
469
|
"default": "./services/toasts/index.js"
|
|
475
470
|
}
|
|
476
471
|
}
|
|
477
|
-
},
|
|
478
|
-
"peerDependenciesMeta": {
|
|
479
|
-
"recharts": {
|
|
480
|
-
"optional": true
|
|
481
|
-
}
|
|
482
472
|
}
|
|
483
473
|
}
|
|
@@ -35,19 +35,19 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
import { TBankContext } from '../../../providers/tbank/.partials/context/context.js';
|
|
38
|
-
import Script from 'next/script';
|
|
39
38
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
39
|
+
var TBANK_SCRIPT_SRC = 'https://integrationjs.tbank.ru/integration.js';
|
|
40
40
|
export var TBankProvider = function (_a) {
|
|
41
41
|
var children = _a.children;
|
|
42
42
|
var _b = useState(true), isLoading = _b[0], setIsLoading = _b[1];
|
|
43
43
|
var _c = useState(null), error = _c[0], setError = _c[1];
|
|
44
44
|
var _d = useState(null), integration = _d[0], setIntegration = _d[1];
|
|
45
45
|
var _e = useState(false), scriptLoaded = _e[0], setScriptLoaded = _e[1];
|
|
46
|
-
|
|
46
|
+
var scriptInjectedRef = useRef(false);
|
|
47
47
|
var retryCountRef = useRef(0);
|
|
48
48
|
var retryTimeoutRef = useRef(null);
|
|
49
49
|
var maxRetries = 3;
|
|
50
|
-
var retryDelay = 5000;
|
|
50
|
+
var retryDelay = 5000;
|
|
51
51
|
var initializeIntegration = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
52
52
|
return __generator(this, function (_a) {
|
|
53
53
|
try {
|
|
@@ -56,14 +56,12 @@ export var TBankProvider = function (_a) {
|
|
|
56
56
|
if (typeof window === 'undefined' || !window.PaymentIntegration) {
|
|
57
57
|
throw new Error('T-Bank Payment Integration не загружен');
|
|
58
58
|
}
|
|
59
|
-
// Сохраняем экземпляр интеграции для использования в контексте
|
|
60
59
|
setIntegration(window.PaymentIntegration);
|
|
61
60
|
setIsLoading(false);
|
|
62
61
|
setError(null);
|
|
63
|
-
retryCountRef.current = 0;
|
|
62
|
+
retryCountRef.current = 0;
|
|
64
63
|
}
|
|
65
|
-
catch (
|
|
66
|
-
// Автоматический retry
|
|
64
|
+
catch (_b) {
|
|
67
65
|
if (retryCountRef.current < maxRetries) {
|
|
68
66
|
retryCountRef.current += 1;
|
|
69
67
|
retryTimeoutRef.current = setTimeout(function () {
|
|
@@ -79,28 +77,59 @@ export var TBankProvider = function (_a) {
|
|
|
79
77
|
return [2 /*return*/];
|
|
80
78
|
});
|
|
81
79
|
}); }, []);
|
|
82
|
-
var handleScriptLoad = useCallback(function () {
|
|
83
|
-
setScriptLoaded(true);
|
|
84
|
-
}, []);
|
|
85
|
-
var handleScriptError = useCallback(function () {
|
|
86
|
-
setError('Не удалось загрузить скрипт T-Bank');
|
|
87
|
-
setIsLoading(false);
|
|
88
|
-
}, []);
|
|
89
|
-
// Проверяем, не загружен ли уже скрипт
|
|
90
80
|
useEffect(function () {
|
|
91
|
-
|
|
92
|
-
|
|
81
|
+
if (typeof window === 'undefined') {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (window.PaymentIntegration) {
|
|
93
85
|
setScriptLoaded(true);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (scriptInjectedRef.current) {
|
|
89
|
+
return;
|
|
94
90
|
}
|
|
95
|
-
|
|
96
|
-
|
|
91
|
+
var existing = document.querySelector("script[src=\"".concat(TBANK_SCRIPT_SRC, "\"]"));
|
|
92
|
+
if (existing) {
|
|
93
|
+
scriptInjectedRef.current = true;
|
|
94
|
+
if (window.PaymentIntegration) {
|
|
95
|
+
setScriptLoaded(true);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
existing.addEventListener('load', function () { return setScriptLoaded(true); });
|
|
99
|
+
existing.addEventListener('error', function () {
|
|
100
|
+
setError('Не удалось загрузить скрипт T-Bank');
|
|
101
|
+
setIsLoading(false);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
var loadScript = function () {
|
|
107
|
+
var script = document.createElement('script');
|
|
108
|
+
script.src = TBANK_SCRIPT_SRC;
|
|
109
|
+
script.async = true;
|
|
110
|
+
script.onload = function () {
|
|
111
|
+
setScriptLoaded(true);
|
|
112
|
+
};
|
|
113
|
+
script.onerror = function () {
|
|
114
|
+
setError('Не удалось загрузить скрипт T-Bank');
|
|
115
|
+
setIsLoading(false);
|
|
116
|
+
};
|
|
117
|
+
document.head.appendChild(script);
|
|
118
|
+
scriptInjectedRef.current = true;
|
|
119
|
+
};
|
|
120
|
+
if ('requestIdleCallback' in window) {
|
|
121
|
+
window.requestIdleCallback(loadScript, { timeout: 5000 });
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
setTimeout(loadScript, 0);
|
|
125
|
+
}
|
|
126
|
+
}, []);
|
|
97
127
|
useEffect(function () {
|
|
98
128
|
if (scriptLoaded ||
|
|
99
129
|
(typeof window !== 'undefined' && window.PaymentIntegration)) {
|
|
100
130
|
initializeIntegration();
|
|
101
131
|
}
|
|
102
132
|
}, [scriptLoaded, initializeIntegration]);
|
|
103
|
-
// Очистка таймера при размонтировании
|
|
104
133
|
useEffect(function () {
|
|
105
134
|
return function () {
|
|
106
135
|
if (retryTimeoutRef.current) {
|
|
@@ -113,8 +142,5 @@ export var TBankProvider = function (_a) {
|
|
|
113
142
|
isLoading: isLoading,
|
|
114
143
|
error: error,
|
|
115
144
|
};
|
|
116
|
-
|
|
117
|
-
return (React.createElement(TBankContext.Provider, { value: contextValue },
|
|
118
|
-
!isScriptAlreadyLoaded && (React.createElement(Script, { src: 'https://integrationjs.tbank.ru/integration.js', strategy: 'afterInteractive', onLoad: handleScriptLoad, onError: handleScriptError })),
|
|
119
|
-
children));
|
|
145
|
+
return (React.createElement(TBankContext.Provider, { value: contextValue }, children));
|
|
120
146
|
};
|
package/types/css.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare module 'react-file-icon' {
|
|
2
|
+
import type { ComponentType, CSSProperties } from 'react';
|
|
3
|
+
|
|
4
|
+
export type FileIconProps = {
|
|
5
|
+
extension?: string;
|
|
6
|
+
type?: string;
|
|
7
|
+
color?: string;
|
|
8
|
+
fold?: boolean;
|
|
9
|
+
foldColor?: string;
|
|
10
|
+
glyphColor?: string;
|
|
11
|
+
gradientColor?: string;
|
|
12
|
+
gradientOpacity?: number;
|
|
13
|
+
labelColor?: string;
|
|
14
|
+
labelTextColor?: string;
|
|
15
|
+
labelUppercase?: boolean;
|
|
16
|
+
radius?: number;
|
|
17
|
+
width?: number | string;
|
|
18
|
+
height?: number | string;
|
|
19
|
+
style?: CSSProperties;
|
|
20
|
+
className?: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const FileIcon: ComponentType<FileIconProps>;
|
|
24
|
+
export const defaultStyles: Record<string, Partial<FileIconProps>>;
|
|
25
|
+
}
|