@alfalab/core-components-pattern-lock 1.8.1 → 2.0.0
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/base-pattern-lock/Component.js +7 -11
- package/components/base-pattern-lock/index.css +14 -23
- package/consts.js +1 -1
- package/cssm/components/base-pattern-lock/Component.js +6 -10
- package/cssm/components/base-pattern-lock/index.module.css +11 -20
- package/cssm/consts.js +1 -1
- package/cssm/desktop/desktop.module.css +3 -4
- package/cssm/mobile/mobile.module.css +3 -26
- package/cssm/typings.d.ts +6 -14
- package/cssm/utils.d.ts +0 -2
- package/cssm/utils.js +5 -30
- package/desktop/Component.desktop.js +1 -1
- package/desktop/desktop.css +7 -8
- package/esm/components/base-pattern-lock/Component.js +7 -11
- package/esm/components/base-pattern-lock/index.css +14 -23
- package/esm/consts.js +1 -1
- package/esm/desktop/Component.desktop.js +1 -1
- package/esm/desktop/desktop.css +7 -8
- package/esm/mobile/Component.mobile.js +1 -1
- package/esm/mobile/mobile.css +6 -29
- package/esm/typings.d.ts +6 -14
- package/esm/utils.d.ts +0 -2
- package/esm/utils.js +5 -30
- package/mobile/Component.mobile.js +1 -1
- package/mobile/mobile.css +6 -29
- package/modern/components/base-pattern-lock/Component.js +6 -10
- package/modern/components/base-pattern-lock/index.css +14 -23
- package/modern/consts.js +1 -1
- package/modern/desktop/Component.desktop.js +1 -1
- package/modern/desktop/desktop.css +7 -8
- package/modern/mobile/Component.mobile.js +1 -1
- package/modern/mobile/mobile.css +6 -29
- package/modern/typings.d.ts +6 -14
- package/modern/utils.d.ts +0 -2
- package/modern/utils.js +5 -30
- package/package.json +1 -1
- package/src/components/base-pattern-lock/Component.tsx +3 -31
- package/src/components/base-pattern-lock/index.module.css +8 -18
- package/src/consts.ts +1 -1
- package/src/desktop/desktop.module.css +2 -2
- package/src/mobile/mobile.module.css +2 -23
- package/src/typings.ts +9 -16
- package/src/utils.ts +5 -27
- package/src/vars.css +3 -2
- package/typings.d.ts +6 -14
- package/utils.d.ts +0 -2
- package/utils.js +5 -30
package/src/typings.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MouseEvent
|
|
1
|
+
import { MouseEvent } from 'react';
|
|
2
2
|
import { ReactPatternLockProps } from 'react-canvas-pattern-lock';
|
|
3
3
|
|
|
4
4
|
type ConditionalProps =
|
|
@@ -28,20 +28,10 @@ type ConditionalProps =
|
|
|
28
28
|
|
|
29
29
|
export type CommonPatternLockProps = {
|
|
30
30
|
/**
|
|
31
|
-
* Дополнительный
|
|
31
|
+
* Дополнительный класс
|
|
32
32
|
*/
|
|
33
33
|
className?: string;
|
|
34
34
|
|
|
35
|
-
/**
|
|
36
|
-
* Сообщение об ошибке
|
|
37
|
-
*/
|
|
38
|
-
error?: ReactNode;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Сообщение над графическим ключом
|
|
42
|
-
*/
|
|
43
|
-
message?: ReactNode;
|
|
44
|
-
|
|
45
35
|
/**
|
|
46
36
|
* Идентификатор для систем автоматизированного тестирования.
|
|
47
37
|
* Для сообщения используется модификатор -message, ошибки -error,
|
|
@@ -50,13 +40,13 @@ export type CommonPatternLockProps = {
|
|
|
50
40
|
dataTestId?: string;
|
|
51
41
|
|
|
52
42
|
/**
|
|
53
|
-
* Следить ли за изменениями значений цветовых
|
|
43
|
+
* Следить ли за изменениями значений цветовых токенов
|
|
54
44
|
* @default false
|
|
55
45
|
*/
|
|
56
46
|
observeTokens?: boolean;
|
|
57
47
|
|
|
58
48
|
/**
|
|
59
|
-
* Параметры MutationObserver для наблюдения за изменениями режима(css custom properties)
|
|
49
|
+
* Параметры MutationObserver для наблюдения за изменениями режима(css custom properties)
|
|
60
50
|
*/
|
|
61
51
|
observerParams?: {
|
|
62
52
|
getTarget?: () => Node;
|
|
@@ -67,7 +57,10 @@ export type CommonPatternLockProps = {
|
|
|
67
57
|
* Дополнительный класс для message/errorMessage
|
|
68
58
|
*/
|
|
69
59
|
messageClassName?: string;
|
|
70
|
-
} & Omit<
|
|
60
|
+
} & Omit<
|
|
61
|
+
ReactPatternLockProps,
|
|
62
|
+
'theme' | 'width' | 'height' | 'rows' | 'cols' | 'hover' | 'justifyNodes'
|
|
63
|
+
> &
|
|
71
64
|
ConditionalProps;
|
|
72
65
|
|
|
73
66
|
export type PrivatePatternLockProps = {
|
|
@@ -76,7 +69,7 @@ export type PrivatePatternLockProps = {
|
|
|
76
69
|
*/
|
|
77
70
|
hover?: boolean;
|
|
78
71
|
/**
|
|
79
|
-
* Стили
|
|
72
|
+
* Стили компонента
|
|
80
73
|
*/
|
|
81
74
|
styles: { [key: string]: string };
|
|
82
75
|
};
|
package/src/utils.ts
CHANGED
|
@@ -26,31 +26,11 @@ export const getSizes = (() => {
|
|
|
26
26
|
return cachedSize;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
} else if (window.matchMedia('(min-width: 390px)').matches) {
|
|
36
|
-
cachedSize = {
|
|
37
|
-
elementSizes: { ...COMMON_SIZES, nodeRadius: 43 },
|
|
38
|
-
width: 322,
|
|
39
|
-
height: 322,
|
|
40
|
-
};
|
|
41
|
-
} else if (window.matchMedia('(min-width: 360px)').matches) {
|
|
42
|
-
cachedSize = {
|
|
43
|
-
elementSizes: { ...COMMON_SIZES, nodeRadius: 38 },
|
|
44
|
-
width: 292,
|
|
45
|
-
height: 292,
|
|
46
|
-
};
|
|
47
|
-
} else {
|
|
48
|
-
cachedSize = {
|
|
49
|
-
elementSizes: { ...COMMON_SIZES, nodeRadius: 32 },
|
|
50
|
-
width: 240,
|
|
51
|
-
height: 240,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
29
|
+
cachedSize = {
|
|
30
|
+
elementSizes: { ...COMMON_SIZES, nodeRadius: 32 },
|
|
31
|
+
width: 240,
|
|
32
|
+
height: 240,
|
|
33
|
+
};
|
|
54
34
|
|
|
55
35
|
return cachedSize;
|
|
56
36
|
};
|
|
@@ -99,7 +79,5 @@ export function getPatternLockTestIds(dataTestId: string) {
|
|
|
99
79
|
return {
|
|
100
80
|
patternLock: dataTestId,
|
|
101
81
|
forgotCodeBtn: getDataTestId(dataTestId, 'forgot-code-btn'),
|
|
102
|
-
error: getDataTestId(dataTestId, 'error'),
|
|
103
|
-
message: getDataTestId(dataTestId, 'message'),
|
|
104
82
|
};
|
|
105
83
|
}
|
package/src/vars.css
CHANGED
package/typings.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MouseEvent
|
|
1
|
+
import { MouseEvent } from 'react';
|
|
2
2
|
import { ReactPatternLockProps } from 'react-canvas-pattern-lock';
|
|
3
3
|
type ConditionalProps = {
|
|
4
4
|
/**
|
|
@@ -22,17 +22,9 @@ type ConditionalProps = {
|
|
|
22
22
|
};
|
|
23
23
|
type CommonPatternLockProps = {
|
|
24
24
|
/**
|
|
25
|
-
* Дополнительный
|
|
25
|
+
* Дополнительный класс
|
|
26
26
|
*/
|
|
27
27
|
className?: string;
|
|
28
|
-
/**
|
|
29
|
-
* Сообщение об ошибке
|
|
30
|
-
*/
|
|
31
|
-
error?: ReactNode;
|
|
32
|
-
/**
|
|
33
|
-
* Сообщение над графическим ключом
|
|
34
|
-
*/
|
|
35
|
-
message?: ReactNode;
|
|
36
28
|
/**
|
|
37
29
|
* Идентификатор для систем автоматизированного тестирования.
|
|
38
30
|
* Для сообщения используется модификатор -message, ошибки -error,
|
|
@@ -40,12 +32,12 @@ type CommonPatternLockProps = {
|
|
|
40
32
|
*/
|
|
41
33
|
dataTestId?: string;
|
|
42
34
|
/**
|
|
43
|
-
* Следить ли за изменениями значений цветовых
|
|
35
|
+
* Следить ли за изменениями значений цветовых токенов
|
|
44
36
|
* @default false
|
|
45
37
|
*/
|
|
46
38
|
observeTokens?: boolean;
|
|
47
39
|
/**
|
|
48
|
-
* Параметры MutationObserver для наблюдения за изменениями режима(css custom properties)
|
|
40
|
+
* Параметры MutationObserver для наблюдения за изменениями режима(css custom properties)
|
|
49
41
|
*/
|
|
50
42
|
observerParams?: {
|
|
51
43
|
getTarget?: () => Node;
|
|
@@ -55,14 +47,14 @@ type CommonPatternLockProps = {
|
|
|
55
47
|
* Дополнительный класс для message/errorMessage
|
|
56
48
|
*/
|
|
57
49
|
messageClassName?: string;
|
|
58
|
-
} & Omit<ReactPatternLockProps, 'theme' | 'width' | 'height' | 'rows' | 'cols' | 'hover'> & ConditionalProps;
|
|
50
|
+
} & Omit<ReactPatternLockProps, 'theme' | 'width' | 'height' | 'rows' | 'cols' | 'hover' | 'justifyNodes'> & ConditionalProps;
|
|
59
51
|
type PrivatePatternLockProps = {
|
|
60
52
|
/**
|
|
61
53
|
* Включает ховер-эффект
|
|
62
54
|
*/
|
|
63
55
|
hover?: boolean;
|
|
64
56
|
/**
|
|
65
|
-
* Стили
|
|
57
|
+
* Стили компонента
|
|
66
58
|
*/
|
|
67
59
|
styles: {
|
|
68
60
|
[key: string]: string;
|
package/utils.d.ts
CHANGED
|
@@ -10,7 +10,5 @@ declare function getTheme(dimens: ThemeParams['dimens']): Theme;
|
|
|
10
10
|
declare function getPatternLockTestIds(dataTestId: string): {
|
|
11
11
|
patternLock: string;
|
|
12
12
|
forgotCodeBtn: string;
|
|
13
|
-
error: string;
|
|
14
|
-
message: string;
|
|
15
13
|
};
|
|
16
14
|
export { getDefaultObserveTarget, getColorByToken, getSizes, getTheme, getPatternLockTestIds };
|
package/utils.js
CHANGED
|
@@ -23,34 +23,11 @@ var getSizes = (function () {
|
|
|
23
23
|
if (cachedSize) {
|
|
24
24
|
return cachedSize;
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
else if (window.matchMedia('(min-width: 390px)').matches) {
|
|
34
|
-
cachedSize = {
|
|
35
|
-
elementSizes: tslib.__assign(tslib.__assign({}, COMMON_SIZES), { nodeRadius: 43 }),
|
|
36
|
-
width: 322,
|
|
37
|
-
height: 322,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
else if (window.matchMedia('(min-width: 360px)').matches) {
|
|
41
|
-
cachedSize = {
|
|
42
|
-
elementSizes: tslib.__assign(tslib.__assign({}, COMMON_SIZES), { nodeRadius: 38 }),
|
|
43
|
-
width: 292,
|
|
44
|
-
height: 292,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
cachedSize = {
|
|
49
|
-
elementSizes: tslib.__assign(tslib.__assign({}, COMMON_SIZES), { nodeRadius: 32 }),
|
|
50
|
-
width: 240,
|
|
51
|
-
height: 240,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
26
|
+
cachedSize = {
|
|
27
|
+
elementSizes: tslib.__assign(tslib.__assign({}, COMMON_SIZES), { nodeRadius: 32 }),
|
|
28
|
+
width: 240,
|
|
29
|
+
height: 240,
|
|
30
|
+
};
|
|
54
31
|
return cachedSize;
|
|
55
32
|
};
|
|
56
33
|
})();
|
|
@@ -84,8 +61,6 @@ function getPatternLockTestIds(dataTestId) {
|
|
|
84
61
|
return {
|
|
85
62
|
patternLock: dataTestId,
|
|
86
63
|
forgotCodeBtn: coreComponentsShared.getDataTestId(dataTestId, 'forgot-code-btn'),
|
|
87
|
-
error: coreComponentsShared.getDataTestId(dataTestId, 'error'),
|
|
88
|
-
message: coreComponentsShared.getDataTestId(dataTestId, 'message'),
|
|
89
64
|
};
|
|
90
65
|
}
|
|
91
66
|
|