@atls/tinkoff-payment-widget 0.1.5 → 0.1.6
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/CHANGELOG.md +11 -0
- package/dist/hooks/use-fields-render.hook.js +4 -2
- package/dist/interfaces/fields.interfaces.d.ts +2 -4
- package/dist/interfaces/form.interfaces.d.ts +1 -1
- package/dist/interfaces/index.d.ts +10 -9
- package/dist/interfaces/index.js +1 -9
- package/dist/interfaces/styles.enum.d.ts +4 -0
- package/dist/interfaces/styles.enum.js +5 -0
- package/dist/interfaces/styles.interfaces.d.ts +1 -4
- package/dist/interfaces/styles.interfaces.js +1 -5
- package/dist/locales/en.locale.d.ts +1 -1
- package/dist/locales/ru.locale.d.ts +1 -1
- package/dist/ui/form/form.component.d.ts +1 -0
- package/dist/ui/input/input.component.js +4 -4
- package/package.json +1 -1
- /package/dist/interfaces/{custom-fields.iterfaces.d.ts → custom-fields.interfaces.d.ts} +0 -0
- /package/dist/interfaces/{custom-fields.iterfaces.js → custom-fields.interfaces.js} +0 -0
- /package/dist/locales/{locale.interaces.d.ts → locale.interfaces.d.ts} +0 -0
- /package/dist/locales/{locale.interaces.js → locale.interfaces.js} +0 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
## [0.1.6](https://github.com/atls/reactjs/compare/@atls/tinkoff-payment-widget@0.1.5...@atls/tinkoff-payment-widget@0.1.6) (2025-01-22)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
* **react:** lint and typecheck errors ([a090051](https://github.com/atls/reactjs/commit/a090051d1007e171df8066e85f15fcf8fd44c4ed))
|
|
10
|
+
|
|
11
|
+
|
|
@@ -8,11 +8,13 @@ import { translate } from '../utils/translate.util.js';
|
|
|
8
8
|
export const useFieldsRenderer = (fields, errors, fieldsState, handleChange, handleBlur, inputGaps) => {
|
|
9
9
|
const intl = useIntl();
|
|
10
10
|
return (React.createElement(ThemeProvider, null, fields.map((field, index, currentFields) => {
|
|
11
|
-
const translatePlaceholder =
|
|
11
|
+
const translatePlaceholder = 'placeholder' in field && field.placeholder
|
|
12
|
+
? translate(intl, field.placeholder, field.placeholder)
|
|
13
|
+
: '';
|
|
12
14
|
const translateError = translate(intl, errors[field.name], errors[field.name]);
|
|
13
15
|
const isNotLastField = index !== currentFields.length - 1;
|
|
14
16
|
return (React.createElement(React.Fragment, { key: field.name },
|
|
15
|
-
React.createElement(MemoizedInput, { type: field.type
|
|
17
|
+
React.createElement(MemoizedInput, { type: 'type' in field ? field.type : 'text', name: field.name, placeholder: translatePlaceholder, required: 'required' in field ? field.required : false, value: fieldsState[field.name], errorText: translateError, onChangeNative: handleChange, onBlur: handleBlur }),
|
|
16
18
|
React.createElement(Condition, { match: isNotLastField },
|
|
17
19
|
React.createElement(Layout, { flexBasis: inputGaps, flexShrink: 0 }))));
|
|
18
20
|
})));
|
|
@@ -2,7 +2,7 @@ import type { FormEvent } from 'react';
|
|
|
2
2
|
import type { HTMLInputTypeAttribute } from 'react';
|
|
3
3
|
import type { AdditionalFieldsType } from '../enums/index.js';
|
|
4
4
|
import type { RequiredFieldsType } from '../enums/index.js';
|
|
5
|
-
import type { DirectionFields } from './styles.
|
|
5
|
+
import type { DirectionFields } from './styles.enum.js';
|
|
6
6
|
export type FieldsNames = AdditionalFieldsType | RequiredFieldsType;
|
|
7
7
|
export type FieldState = Record<FieldsNames, string>;
|
|
8
8
|
export type ValidateField = (name: FieldsNames, value: string, required?: boolean) => void;
|
|
@@ -20,9 +20,7 @@ export interface AdditionalField extends Field {
|
|
|
20
20
|
export interface RequiredField extends Field {
|
|
21
21
|
name: RequiredFieldsType;
|
|
22
22
|
}
|
|
23
|
-
export type FieldsErrors =
|
|
24
|
-
[key in FieldsNames]: string;
|
|
25
|
-
};
|
|
23
|
+
export type FieldsErrors = Record<FieldsNames, string>;
|
|
26
24
|
export interface FieldsProps {
|
|
27
25
|
amount?: number;
|
|
28
26
|
direction?: DirectionFields;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type { NameField } from './custom-fields.
|
|
2
|
+
import type { NameField } from './custom-fields.interfaces.js';
|
|
3
3
|
import type { Field } from './fields.interfaces.js';
|
|
4
4
|
import type { FieldsState } from './fields.interfaces.js';
|
|
5
5
|
import type { FieldsValidator } from './fields.interfaces.js';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export * from './widget.interfaces.js';
|
|
2
|
-
export * from './fields.interfaces.js';
|
|
3
|
-
export * from './settings.interfaces.js';
|
|
4
|
-
export * from './receipt.interfaces.js';
|
|
5
|
-
export * from './styles.interfaces.js';
|
|
6
|
-
export * from './theme.interfaces.js';
|
|
7
|
-
export * from './form.interfaces.js';
|
|
8
|
-
export * from './wrappers.interfaces.js';
|
|
9
|
-
export * from './custom-fields.
|
|
1
|
+
export type * from './widget.interfaces.js';
|
|
2
|
+
export type * from './fields.interfaces.js';
|
|
3
|
+
export type * from './settings.interfaces.js';
|
|
4
|
+
export type * from './receipt.interfaces.js';
|
|
5
|
+
export type * from './styles.interfaces.js';
|
|
6
|
+
export type * from './theme.interfaces.js';
|
|
7
|
+
export type * from './form.interfaces.js';
|
|
8
|
+
export type * from './wrappers.interfaces.js';
|
|
9
|
+
export type * from './custom-fields.interfaces.js';
|
|
10
|
+
export * from './styles.enum.js';
|
package/dist/interfaces/index.js
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./fields.interfaces.js";
|
|
3
|
-
export * from "./settings.interfaces.js";
|
|
4
|
-
export * from "./receipt.interfaces.js";
|
|
5
|
-
export * from "./styles.interfaces.js";
|
|
6
|
-
export * from "./theme.interfaces.js";
|
|
7
|
-
export * from "./form.interfaces.js";
|
|
8
|
-
export * from "./wrappers.interfaces.js";
|
|
9
|
-
export * from "./custom-fields.iterfaces.js";
|
|
1
|
+
export * from "./styles.enum.js";
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { ButtonProps } from '@atls-ui-parts/button';
|
|
2
|
-
|
|
3
|
-
Row = "row",
|
|
4
|
-
Column = "column"
|
|
5
|
-
}
|
|
2
|
+
import type { DirectionFields } from './styles.enum.js';
|
|
6
3
|
export interface Styles {
|
|
7
4
|
direction?: DirectionFields;
|
|
8
5
|
inputGaps?: number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Locale } from './locale.
|
|
1
|
+
import type { Locale } from './locale.interfaces.js';
|
|
2
2
|
export declare const EnLocale: Locale;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Locale } from './locale.
|
|
1
|
+
import type { Locale } from './locale.interfaces.js';
|
|
2
2
|
export declare const RuLocale: Locale;
|
|
@@ -16,7 +16,7 @@ import { baseStyles } from './input.styles.js';
|
|
|
16
16
|
import { shapeStyles } from './input.styles.js';
|
|
17
17
|
import { transitionStyles } from './input.styles.js';
|
|
18
18
|
export const InputElement = (styled.default ?? styled).div(baseStyles, shapeStyles, appearanceStyles, transitionStyles, layout);
|
|
19
|
-
const Container = (styled.default ?? styled).div(({ type }) => ({
|
|
19
|
+
const Container = (styled.default ?? styled).div(({ type, }) => ({
|
|
20
20
|
display: type === 'hidden' ? 'none' : 'flex',
|
|
21
21
|
width: '100%',
|
|
22
22
|
flexDirection: 'column',
|
|
@@ -30,14 +30,14 @@ export const InputWithoutRef = ({ value, type, required, disabled, errorText = '
|
|
|
30
30
|
}
|
|
31
31
|
return (React.createElement(Container, { type: type, onClick: () => {
|
|
32
32
|
;
|
|
33
|
-
ref.current
|
|
33
|
+
ref.current?.focus();
|
|
34
34
|
}, onBlur: () => {
|
|
35
35
|
;
|
|
36
|
-
ref.current
|
|
36
|
+
ref.current?.blur();
|
|
37
37
|
setFocus(false);
|
|
38
38
|
}, onFocus: () => {
|
|
39
39
|
;
|
|
40
|
-
ref.current
|
|
40
|
+
ref.current?.focus();
|
|
41
41
|
setFocus(true);
|
|
42
42
|
}, ...hoverProps },
|
|
43
43
|
React.createElement(InputElement, { ...props, error: errorText !== '' },
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|