@tap-payments/os-micro-frontend-shared 0.1.261-test.4 → 0.1.262
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/build/components/Chip/style.d.ts +1 -0
- package/build/components/CountBadge/style.d.ts +1 -0
- package/build/components/Customer/CustomerDropdown/CustomerDropdown.d.ts +8 -0
- package/build/components/Customer/CustomerDropdown/CustomerDropdown.js +39 -0
- package/build/components/Customer/CustomerDropdown/index.d.ts +1 -0
- package/build/components/Customer/CustomerDropdown/index.js +1 -0
- package/build/components/Customer/CustomerDropdown/style.d.ts +10 -0
- package/build/components/Customer/CustomerDropdown/style.js +30 -0
- package/build/components/Customer/CustomerForms/EmailForm.d.ts +12 -0
- package/build/components/Customer/CustomerForms/EmailForm.js +76 -0
- package/build/components/Customer/CustomerForms/FullInfo.d.ts +13 -0
- package/build/components/Customer/CustomerForms/FullInfo.js +72 -0
- package/build/components/Customer/CustomerForms/FullInfoForm.d.ts +12 -0
- package/build/components/Customer/CustomerForms/FullInfoForm.js +74 -0
- package/build/components/Customer/CustomerForms/PhoneNumberForm.d.ts +12 -0
- package/build/components/Customer/CustomerForms/PhoneNumberForm.js +71 -0
- package/build/components/Customer/CustomerForms/index.d.ts +9 -0
- package/build/components/Customer/CustomerForms/index.js +9 -0
- package/build/components/Customer/CustomerForms/style.d.ts +25 -0
- package/build/components/Customer/CustomerForms/style.js +71 -0
- package/build/components/Customer/CustomerForms/validation.d.ts +30 -0
- package/build/components/Customer/CustomerForms/validation.js +42 -0
- package/build/components/Customer/index.d.ts +1 -0
- package/build/components/Customer/index.js +1 -0
- package/build/components/Dialog/style.d.ts +1 -0
- package/build/components/Error/Error.d.ts +1 -1
- package/build/components/FlippingCard/style.d.ts +1 -0
- package/build/components/ImageWrapper/ImageWrapper.d.ts +1 -0
- package/build/components/Inputs/CountriesDropDown/CountriesDropdown.d.ts +5 -4
- package/build/components/Inputs/CountriesDropDown/CountriesDropdown.js +3 -3
- package/build/components/JSONViewer/style.d.ts +1 -0
- package/build/components/LeftPeekRightExpandingChip/style.d.ts +1 -0
- package/build/components/RightLeftExpandingCenterChip/style.d.ts +1 -0
- package/build/components/SearchButton/styles.d.ts +1 -0
- package/build/components/StatusIcons/AuthIcons/style.d.ts +1 -0
- package/build/components/StatusIcons/AuthorizationAutoIcons/style.d.ts +1 -0
- package/build/components/StatusIcons/ChargeStatusIcon/style.d.ts +1 -0
- package/build/components/StatusIcons/SourceIcons/style.d.ts +1 -0
- package/build/components/TableCells/CustomCells/ActionCell/style.d.ts +1 -0
- package/build/components/TableCells/CustomCells/ApplicationStatusCell/style.d.ts +1 -0
- package/build/components/TableCells/CustomCells/AuthenticationCell/style.d.ts +1 -0
- package/build/components/TableCells/CustomCells/AuthenticationStatusCell/style.d.ts +1 -0
- package/build/components/TableCells/CustomCells/AuthenticationTypeCell/style.d.ts +1 -0
- package/build/components/TableCells/CustomCells/BalanceCell/style.d.ts +1 -0
- package/build/components/TableCells/CustomCells/ChannelsCell/style.d.ts +1 -0
- package/build/components/TableCells/CustomCells/CheckoutStatusCell/style.d.ts +1 -0
- package/build/components/TableCells/CustomCells/DestinationStatusCell/style.d.ts +1 -0
- package/build/components/TableCells/CustomCells/DueDateCell/style.d.ts +1 -0
- package/build/components/TableCells/CustomCells/IDButton/style.d.ts +1 -0
- package/build/components/TableCells/CustomCells/IntentsStatusCell/style.d.ts +1 -0
- package/build/components/TableCells/CustomCells/InvoiceStatusCell/style.d.ts +1 -0
- package/build/components/TableCells/CustomCells/PayoutStatusCell/style.d.ts +1 -0
- package/build/components/TableCells/CustomCells/ProductsCell/style.d.ts +1 -0
- package/build/components/TableCells/CustomCells/ReferenceCell/style.d.ts +1 -0
- package/build/components/TableCells/CustomCells/RefundChargeCell/style.d.ts +1 -0
- package/build/components/TableCells/CustomCells/RefundStatusCell/style.d.ts +1 -0
- package/build/components/TableCells/CustomCells/SalesChannelCell/style.d.ts +1 -0
- package/build/components/TableCells/CustomCells/SegmentsCell/style.d.ts +1 -0
- package/build/components/TableCells/CustomCells/SourceCell/style.d.ts +1 -0
- package/build/components/TableCells/CustomCells/StatusCell/style.d.ts +1 -0
- package/build/components/TableCells/CustomCells/TokenStatusCell/style.d.ts +1 -0
- package/build/components/TableCells/CustomCells/style.d.ts +1 -0
- package/build/components/TableHeader/FiltersRow.d.ts +1 -1
- package/build/components/TableHeader/FiltersRow.js +4 -19
- package/build/components/TableHeader/TableHeader.d.ts +4 -5
- package/build/components/TableHeader/TableHeader.js +6 -21
- package/build/components/TableHeader/index.d.ts +2 -6
- package/build/components/TableHeader/index.js +2 -6
- package/build/components/TableHeader/style.d.ts +1 -1
- package/build/components/TableHeader/style.js +1 -1
- package/build/components/TableHeader/type.d.ts +10 -19
- package/build/components/TableHeader/type.js +7 -0
- package/build/components/VirtualTables/components/style.d.ts +1 -0
- package/build/components/index.d.ts +1 -1
- package/build/components/index.js +1 -1
- package/build/types/tsUtils.d.ts +0 -1
- package/package.json +20 -19
- package/build/components/TableHeader/FiltersRowWrapper.d.ts +0 -5
- package/build/components/TableHeader/FiltersRowWrapper.js +0 -18
- package/build/components/TableHeader/TableHeaderWrapper.d.ts +0 -5
- package/build/components/TableHeader/TableHeaderWrapper.js +0 -18
- package/build/components/TableHeader/TableView/ColumnItem.d.ts +0 -14
- package/build/components/TableHeader/TableView/ColumnItem.js +0 -29
- package/build/components/TableHeader/TableView/CustomViews.d.ts +0 -5
- package/build/components/TableHeader/TableView/CustomViews.js +0 -21
- package/build/components/TableHeader/TableView/DefaultViews.d.ts +0 -13
- package/build/components/TableHeader/TableView/DefaultViews.js +0 -22
- package/build/components/TableHeader/TableView/TableView.d.ts +0 -12
- package/build/components/TableHeader/TableView/TableView.js +0 -55
- package/build/components/TableHeader/TableView/hooks/index.d.ts +0 -3
- package/build/components/TableHeader/TableView/hooks/index.js +0 -3
- package/build/components/TableHeader/TableView/hooks/useColumnItem.d.ts +0 -21
- package/build/components/TableHeader/TableView/hooks/useColumnItem.js +0 -29
- package/build/components/TableHeader/TableView/hooks/useSubMenu.d.ts +0 -10
- package/build/components/TableHeader/TableView/hooks/useSubMenu.js +0 -31
- package/build/components/TableHeader/TableView/hooks/useViewColumns.d.ts +0 -13
- package/build/components/TableHeader/TableView/hooks/useViewColumns.js +0 -45
- package/build/components/TableHeader/TableView/index.d.ts +0 -3
- package/build/components/TableHeader/TableView/index.js +0 -3
- package/build/components/TableHeader/TableView/style.d.ts +0 -24
- package/build/components/TableHeader/TableView/style.js +0 -102
- package/build/components/TableHeader/TableView/type.d.ts +0 -10
- package/build/components/TableHeader/TableView/type.js +0 -1
- package/build/components/TableHeader/data.d.ts +0 -5
- package/build/components/TableHeader/data.js +0 -7
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
/// <reference types="react" />
|
|
2
3
|
import { GetSourceAnimationFunction } from './type';
|
|
3
4
|
export declare const ChipStyled: import("@emotion/styled").StyledComponent<import("react").RefAttributes<unknown> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
4
5
|
variant?: import("./type").ChipVariant | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FullInfoProps } from '../CustomerForms/FullInfo';
|
|
3
|
+
interface CustomerDropdownProps extends FullInfoProps {
|
|
4
|
+
isDisabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
declare function CustomerDropdown({ ...props }: Readonly<CustomerDropdownProps>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare const _default: import("react").MemoExoticComponent<typeof CustomerDropdown>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { memo, useMemo, useState } from 'react';
|
|
14
|
+
import Popper from '@mui/material/Popper';
|
|
15
|
+
import { useTranslation } from 'react-i18next';
|
|
16
|
+
import { getRandomGradientColor } from '../../../utils/index.js';
|
|
17
|
+
import { CustomBackdrop } from '../../index.js';
|
|
18
|
+
import { customerIcon2 } from '../../../constants/index.js';
|
|
19
|
+
import { Wrapper, AvatarStyled, Button } from './style';
|
|
20
|
+
import FullInfo from '../CustomerForms/FullInfo';
|
|
21
|
+
function CustomerDropdown(_a) {
|
|
22
|
+
var _b, _c;
|
|
23
|
+
var props = __rest(_a, []);
|
|
24
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
25
|
+
const { firstName, lastName } = props.customer;
|
|
26
|
+
const { t } = useTranslation();
|
|
27
|
+
const open = Boolean(anchorEl);
|
|
28
|
+
const openDropdown = (event) => {
|
|
29
|
+
if (!open)
|
|
30
|
+
setAnchorEl(event.currentTarget);
|
|
31
|
+
};
|
|
32
|
+
const closeDropdown = () => {
|
|
33
|
+
if (open)
|
|
34
|
+
setAnchorEl(null);
|
|
35
|
+
};
|
|
36
|
+
const AvatarColor = useMemo(() => getRandomGradientColor(), []);
|
|
37
|
+
return (_jsxs(Wrapper, Object.assign({ sx: Object.assign({}, (props.isDisabled && { pointerEvents: 'none', opacity: 0.7 })) }, { children: [_jsxs(Button, Object.assign({ onClick: openDropdown }, { children: [(!firstName || !lastName) && (_jsxs(_Fragment, { children: [_jsx("img", { src: customerIcon2, alt: "c" }), _jsx("span", { children: t('customer') })] })), firstName && lastName && (_jsxs(_Fragment, { children: [_jsx(AvatarStyled, Object.assign({ src: "#", alt: "a", sx: { background: AvatarColor } }, { children: `${(_b = firstName[0]) === null || _b === void 0 ? void 0 : _b.toUpperCase()}${((_c = lastName[0]) === null || _c === void 0 ? void 0 : _c.toUpperCase()) || ''}` })), `${firstName} ${lastName}`] }))] })), open && _jsx(CustomBackdrop, { onClick: closeDropdown }), _jsx(Popper, Object.assign({ open: open, anchorEl: anchorEl, placement: "bottom-start" }, { children: _jsx(FullInfo, Object.assign({}, props)) }))] })));
|
|
38
|
+
}
|
|
39
|
+
export default memo(CustomerDropdown);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './CustomerDropdown';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './CustomerDropdown';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Wrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
3
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
4
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
5
|
+
export declare const Button: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
6
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
7
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
8
|
+
export declare const AvatarStyled: import("@emotion/styled").StyledComponent<import("@mui/material/Avatar").AvatarOwnProps & import("@mui/material/Avatar").AvatarSlotsAndSlotProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
9
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
10
|
+
}, "classes" | "className" | "style" | "children" | "sx" | "variant" | "slotProps" | "slots" | "sizes" | "src" | "alt" | "srcSet" | "imgProps"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Avatar from '@mui/material/Avatar';
|
|
2
|
+
import Box from '@mui/material/Box';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
export const Wrapper = styled(Box)(() => ({
|
|
5
|
+
position: 'relative',
|
|
6
|
+
flexGrow: 0,
|
|
7
|
+
}));
|
|
8
|
+
export const Button = styled(Box)(({ theme }) => ({
|
|
9
|
+
fontSize: '11px',
|
|
10
|
+
color: theme.palette.text.primary,
|
|
11
|
+
display: 'flex',
|
|
12
|
+
padding: theme.spacing(1),
|
|
13
|
+
gap: theme.spacing(1),
|
|
14
|
+
border: `1px solid ${theme.palette.divider}`,
|
|
15
|
+
borderRadius: '4px',
|
|
16
|
+
backgroundColor: theme.palette.common.white,
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
height: 32,
|
|
19
|
+
textTransform: 'capitalize',
|
|
20
|
+
cursor: 'pointer',
|
|
21
|
+
}));
|
|
22
|
+
export const AvatarStyled = styled(Avatar)(({ theme }) => ({
|
|
23
|
+
width: 16,
|
|
24
|
+
height: 16,
|
|
25
|
+
cursor: 'pointer',
|
|
26
|
+
fontSize: '5.667px',
|
|
27
|
+
color: theme.palette.common.white,
|
|
28
|
+
fontWeight: 500,
|
|
29
|
+
border: `1px solid ${theme.palette.common.white}`,
|
|
30
|
+
}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Item } from '../../../types/index.js';
|
|
3
|
+
import { FullInfoProps } from './FullInfo';
|
|
4
|
+
export interface EmailFormProps extends Pick<FullInfoProps, 'onCustomerChange' | 'isCustomerNotValid' | 'customer'> {
|
|
5
|
+
items: Item[];
|
|
6
|
+
isItemsNotValid: boolean;
|
|
7
|
+
submitButtonText: string;
|
|
8
|
+
onSubmit: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare function EmailForm({ submitButtonText, onSubmit, customer, isItemsNotValid, items, onCustomerChange }: Readonly<EmailFormProps>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare const _default: import("react").MemoExoticComponent<typeof EmailForm>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { memo, useEffect, useRef } from 'react';
|
|
14
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
15
|
+
import Box from '@mui/material/Box';
|
|
16
|
+
import { Controller, useForm } from 'react-hook-form';
|
|
17
|
+
import { useTranslation } from 'react-i18next';
|
|
18
|
+
import { FormWrapper, InputStyled, SubmitButton, ErrorStyled } from './style';
|
|
19
|
+
import { validationEmailFromSchema } from './validation';
|
|
20
|
+
function EmailForm({ submitButtonText, onSubmit, customer, isItemsNotValid, items, onCustomerChange }) {
|
|
21
|
+
const firstNameRef = useRef();
|
|
22
|
+
const lastNameRef = useRef();
|
|
23
|
+
const emailRef = useRef();
|
|
24
|
+
const { t } = useTranslation();
|
|
25
|
+
const { control, formState: { isValid, errors }, watch, trigger, } = useForm({
|
|
26
|
+
mode: 'onChange',
|
|
27
|
+
resolver: yupResolver(validationEmailFromSchema),
|
|
28
|
+
defaultValues: {
|
|
29
|
+
firstName: customer.firstName,
|
|
30
|
+
email: customer.email,
|
|
31
|
+
lastName: customer.lastName,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
// revalidate default values
|
|
36
|
+
if (customer.firstName && customer.email && customer.lastName) {
|
|
37
|
+
trigger();
|
|
38
|
+
}
|
|
39
|
+
}, []);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
watch(({ firstName = '', lastName = '', email = '' }) => {
|
|
42
|
+
onCustomerChange(Object.assign(Object.assign({}, customer), { email,
|
|
43
|
+
firstName,
|
|
44
|
+
lastName }));
|
|
45
|
+
});
|
|
46
|
+
}, [watch, errors, customer]);
|
|
47
|
+
const onMouseLeave = (e) => {
|
|
48
|
+
e.stopPropagation();
|
|
49
|
+
};
|
|
50
|
+
return (_jsxs(FormWrapper, Object.assign({ onMouseLeave: onMouseLeave }, { children: [_jsx(Controller, { control: control, name: "email", render: (_a) => {
|
|
51
|
+
var _b = _a.field, { ref } = _b, field = __rest(_b, ["ref"]), { fieldState: { error } } = _a;
|
|
52
|
+
return (_jsxs(Box, Object.assign({ ref: emailRef }, { children: [_jsx(InputStyled, Object.assign({}, field, { "data-testid": "EmailForm_email", placeholder: t('email'), inputProps: {
|
|
53
|
+
autoComplete: 'off',
|
|
54
|
+
form: {
|
|
55
|
+
autoComplete: 'off',
|
|
56
|
+
},
|
|
57
|
+
}, error: Boolean(error === null || error === void 0 ? void 0 : error.message) })), (error === null || error === void 0 ? void 0 : error.message) && _jsx(ErrorStyled, { error: t(error.message) })] })));
|
|
58
|
+
} }), _jsx(Controller, { control: control, name: "firstName", render: (_a) => {
|
|
59
|
+
var _b = _a.field, { ref } = _b, field = __rest(_b, ["ref"]), { fieldState: { error } } = _a;
|
|
60
|
+
return (_jsxs(Box, Object.assign({ ref: firstNameRef }, { children: [_jsx(InputStyled, Object.assign({}, field, { "data-testid": "EmailForm_firstName", placeholder: t('firstName'), inputProps: {
|
|
61
|
+
autoComplete: 'off',
|
|
62
|
+
form: {
|
|
63
|
+
autoComplete: 'off',
|
|
64
|
+
},
|
|
65
|
+
}, error: Boolean(error === null || error === void 0 ? void 0 : error.message) })), (error === null || error === void 0 ? void 0 : error.message) && _jsx(ErrorStyled, { error: t(error.message) })] })));
|
|
66
|
+
} }), _jsx(Controller, { control: control, name: "lastName", render: (_a) => {
|
|
67
|
+
var _b = _a.field, { ref } = _b, field = __rest(_b, ["ref"]), { fieldState: { error } } = _a;
|
|
68
|
+
return (_jsxs(Box, Object.assign({ ref: lastNameRef }, { children: [_jsx(InputStyled, Object.assign({}, field, { "data-testid": "EmailForm_lastName", placeholder: t('lastName'), inputProps: {
|
|
69
|
+
autoComplete: 'off',
|
|
70
|
+
form: {
|
|
71
|
+
autoComplete: 'off',
|
|
72
|
+
},
|
|
73
|
+
}, error: Boolean(error === null || error === void 0 ? void 0 : error.message) })), (error === null || error === void 0 ? void 0 : error.message) && _jsx(ErrorStyled, { error: t(error.message) })] })));
|
|
74
|
+
} }), _jsx(SubmitButton, Object.assign({ type: "button", "data-testid": "EmailForm_submit", onClick: onSubmit, disabled: !isValid || isItemsNotValid || !items.length }, { children: submitButtonText }))] })));
|
|
75
|
+
}
|
|
76
|
+
export default memo(EmailForm);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Country, CustomerInfo, SegmentCountry } from '../../../types/index.js';
|
|
2
|
+
export interface FullInfoProps {
|
|
3
|
+
customer: CustomerInfo;
|
|
4
|
+
country: Country;
|
|
5
|
+
defaultCountry: SegmentCountry;
|
|
6
|
+
countries: Country[];
|
|
7
|
+
isCountriesLoading: boolean;
|
|
8
|
+
onCountryChange: (country: Country) => void;
|
|
9
|
+
onCustomerChange: (customer: CustomerInfo) => void;
|
|
10
|
+
isCustomerNotValid?: (value: boolean, err?: string) => void;
|
|
11
|
+
}
|
|
12
|
+
declare function FullInfo({ customer, country, defaultCountry, countries, isCountriesLoading, onCustomerChange, onCountryChange, isCustomerNotValid, }: Readonly<FullInfoProps>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default FullInfo;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { useEffect, useRef, useCallback } from 'react';
|
|
14
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
15
|
+
import Box from '@mui/material/Box';
|
|
16
|
+
import { Controller, useForm } from 'react-hook-form';
|
|
17
|
+
import { useTranslation } from 'react-i18next';
|
|
18
|
+
import { MobileWrapper, FormWrapper, InputStyled, InputNumberStyled, ErrorStyled } from './style';
|
|
19
|
+
import { validationFullInfoSchema } from './validation';
|
|
20
|
+
import CountriesDropdown from '../../Inputs/CountriesDropDown';
|
|
21
|
+
function FullInfo({ customer, country, defaultCountry, countries, isCountriesLoading, onCustomerChange, onCountryChange, isCustomerNotValid, }) {
|
|
22
|
+
const firstNameRef = useRef();
|
|
23
|
+
const lastNameRef = useRef();
|
|
24
|
+
const emailRef = useRef();
|
|
25
|
+
const phoneNumberRef = useRef();
|
|
26
|
+
const { t } = useTranslation();
|
|
27
|
+
const { control, watch, formState: { errors, isValid }, } = useForm({
|
|
28
|
+
mode: 'onChange',
|
|
29
|
+
resolver: yupResolver(validationFullInfoSchema(country.max_digits)),
|
|
30
|
+
defaultValues: {
|
|
31
|
+
firstName: customer.firstName,
|
|
32
|
+
email: customer.email,
|
|
33
|
+
lastName: customer.lastName,
|
|
34
|
+
phoneNumber: customer.phoneNumber,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
watch(({ firstName = '', lastName = '', email = '', phoneNumber = '' }) => {
|
|
39
|
+
onCustomerChange({
|
|
40
|
+
firstName,
|
|
41
|
+
lastName,
|
|
42
|
+
email,
|
|
43
|
+
phoneNumber,
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
}, [watch, errors, customer]);
|
|
47
|
+
const getFirstError = useCallback(() => { var _a, _b, _c, _d, _e, _f, _g; return (_f = (_d = (_b = (_a = errors.firstName) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : (_c = errors.lastName) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : (_e = errors.email) === null || _e === void 0 ? void 0 : _e.message) !== null && _f !== void 0 ? _f : (_g = errors.phoneNumber) === null || _g === void 0 ? void 0 : _g.message; }, [errors]);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
isCustomerNotValid === null || isCustomerNotValid === void 0 ? void 0 : isCustomerNotValid(!isValid, getFirstError());
|
|
50
|
+
}, [isValid, getFirstError]);
|
|
51
|
+
const onMouseLeave = (e) => {
|
|
52
|
+
e.stopPropagation();
|
|
53
|
+
};
|
|
54
|
+
return (_jsxs(FormWrapper, Object.assign({ onMouseLeave: onMouseLeave }, { children: [_jsx(Controller, { control: control, name: "firstName", render: (_a) => {
|
|
55
|
+
var _b = _a.field, { ref } = _b, field = __rest(_b, ["ref"]), { fieldState: { error } } = _a;
|
|
56
|
+
return (_jsxs(Box, Object.assign({ ref: firstNameRef }, { children: [_jsx(InputStyled, Object.assign({}, field, { placeholder: t('firstName'), inputProps: { autoComplete: 'off' }, error: Boolean(error === null || error === void 0 ? void 0 : error.message) })), (error === null || error === void 0 ? void 0 : error.message) && _jsx(ErrorStyled, { error: t(error.message) })] })));
|
|
57
|
+
} }, "fullInfoFirstName"), _jsx(Controller, { control: control, name: "lastName", render: (_a) => {
|
|
58
|
+
var _b = _a.field, { ref } = _b, field = __rest(_b, ["ref"]), { fieldState: { error } } = _a;
|
|
59
|
+
return (_jsxs(Box, Object.assign({ ref: lastNameRef }, { children: [_jsx(InputStyled, Object.assign({}, field, { placeholder: t('lastName'), inputProps: { autoComplete: 'off' }, error: Boolean(error === null || error === void 0 ? void 0 : error.message) })), (error === null || error === void 0 ? void 0 : error.message) && _jsx(ErrorStyled, { error: t(error.message) })] })));
|
|
60
|
+
} }, "fullInfoLastName"), _jsx(Controller, { control: control, name: "email", render: (_a) => {
|
|
61
|
+
var _b = _a.field, { ref } = _b, field = __rest(_b, ["ref"]), { fieldState: { error } } = _a;
|
|
62
|
+
return (_jsxs(Box, Object.assign({ ref: emailRef }, { children: [_jsx(InputStyled, Object.assign({}, field, { placeholder: t('email'), inputProps: { autoComplete: 'off' }, error: Boolean(error === null || error === void 0 ? void 0 : error.message) })), (error === null || error === void 0 ? void 0 : error.message) && _jsx(ErrorStyled, { error: t(error.message) })] })));
|
|
63
|
+
} }, "fullInfoEmail"), _jsx(Controller, { control: control, name: "phoneNumber", render: (_a) => {
|
|
64
|
+
var _b, _c;
|
|
65
|
+
var _d = _a.field, { ref } = _d, field = __rest(_d, ["ref"]), { fieldState: { error } } = _a;
|
|
66
|
+
return (_jsxs(Box, Object.assign({ ref: phoneNumberRef }, { children: [_jsxs(MobileWrapper, Object.assign({ sx: Object.assign({}, ((error === null || error === void 0 ? void 0 : error.message) && { borderBottom: 'none' })) }, { children: [_jsx(CountriesDropdown, { defaultCountry: (_c = (_b = country === null || country === void 0 ? void 0 : country.iso2) !== null && _b !== void 0 ? _b : defaultCountry === null || defaultCountry === void 0 ? void 0 : defaultCountry.code) !== null && _c !== void 0 ? _c : 'SA', value: country, onChangeCountry: onCountryChange, countries: countries, isLoading: isCountriesLoading }), _jsx(InputNumberStyled, Object.assign({}, field, { placeholder: t('mobile'), inputProps: { autoComplete: 'off' }, error: Boolean(error === null || error === void 0 ? void 0 : error.message), sx: {
|
|
67
|
+
border: 'none',
|
|
68
|
+
paddingInlineEnd: 0,
|
|
69
|
+
}, hideArrows: true }))] })), (error === null || error === void 0 ? void 0 : error.message) && _jsx(ErrorStyled, { error: t(error.message, { numberLen: country.max_digits }) })] })));
|
|
70
|
+
} }, "fullInfoPhoneNumber")] })));
|
|
71
|
+
}
|
|
72
|
+
export default FullInfo;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Item } from '../../../types/index.js';
|
|
3
|
+
import { FullInfoProps } from './FullInfo';
|
|
4
|
+
export interface FullInfoFormProps extends FullInfoProps {
|
|
5
|
+
items: Item[];
|
|
6
|
+
isItemsNotValid: boolean;
|
|
7
|
+
submitButtonText: string;
|
|
8
|
+
onSubmit: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare function FullInfoForm({ submitButtonText, onSubmit, customer, country, items, isItemsNotValid, defaultCountry, countries, isCountriesLoading, onCustomerChange, onCountryChange, }: Readonly<FullInfoFormProps>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare const _default: import("react").MemoExoticComponent<typeof FullInfoForm>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { memo, useEffect, useRef } from 'react';
|
|
14
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
15
|
+
import Box from '@mui/material/Box';
|
|
16
|
+
import { Controller, useForm } from 'react-hook-form';
|
|
17
|
+
import { useTranslation } from 'react-i18next';
|
|
18
|
+
import { InputNumberStyled, MobileWrapper } from '../../index.js';
|
|
19
|
+
import { FormWrapper, SubmitButton, InputStyled, ErrorStyled } from './style';
|
|
20
|
+
import { validationFullInfoSchema } from './validation';
|
|
21
|
+
import CountriesDropdown from '../../Inputs/CountriesDropDown';
|
|
22
|
+
function FullInfoForm({ submitButtonText, onSubmit, customer, country, items, isItemsNotValid, defaultCountry, countries, isCountriesLoading, onCustomerChange, onCountryChange, }) {
|
|
23
|
+
const firstNameRef = useRef();
|
|
24
|
+
const lastNameRef = useRef();
|
|
25
|
+
const emailRef = useRef();
|
|
26
|
+
const phoneNumberRef = useRef();
|
|
27
|
+
const { t } = useTranslation();
|
|
28
|
+
const { control, watch, trigger, formState: { isValid, errors }, } = useForm({
|
|
29
|
+
mode: 'onChange',
|
|
30
|
+
resolver: yupResolver(validationFullInfoSchema(country.max_digits)),
|
|
31
|
+
defaultValues: {
|
|
32
|
+
firstName: customer.firstName,
|
|
33
|
+
email: customer.email,
|
|
34
|
+
lastName: customer.lastName,
|
|
35
|
+
phoneNumber: customer.phoneNumber,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
watch(({ firstName = '', lastName = '', email = '', phoneNumber = '' }) => {
|
|
40
|
+
onCustomerChange({
|
|
41
|
+
email,
|
|
42
|
+
firstName,
|
|
43
|
+
lastName,
|
|
44
|
+
phoneNumber,
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
}, [watch, errors, customer]);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
// revalidate default values
|
|
50
|
+
if (customer.firstName && customer.lastName && (customer.email || customer.phoneNumber)) {
|
|
51
|
+
trigger();
|
|
52
|
+
}
|
|
53
|
+
}, []);
|
|
54
|
+
return (_jsxs(FormWrapper, Object.assign({ onMouseLeave: (e) => {
|
|
55
|
+
e.stopPropagation();
|
|
56
|
+
} }, { children: [_jsx(Controller, { control: control, name: "firstName", render: (_a) => {
|
|
57
|
+
var _b = _a.field, { ref } = _b, field = __rest(_b, ["ref"]), { fieldState: { error } } = _a;
|
|
58
|
+
return (_jsxs(Box, Object.assign({ ref: firstNameRef }, { children: [_jsx(InputStyled, Object.assign({}, field, { placeholder: t('firstName'), inputProps: { autoComplete: 'off' }, error: Boolean(error === null || error === void 0 ? void 0 : error.message) })), (error === null || error === void 0 ? void 0 : error.message) && _jsx(ErrorStyled, { error: t(error.message) })] })));
|
|
59
|
+
} }, "fullInfoFormFirstName"), _jsx(Controller, { control: control, name: "lastName", render: (_a) => {
|
|
60
|
+
var _b = _a.field, { ref } = _b, field = __rest(_b, ["ref"]), { fieldState: { error } } = _a;
|
|
61
|
+
return (_jsxs(Box, Object.assign({ ref: lastNameRef }, { children: [_jsx(InputStyled, Object.assign({}, field, { placeholder: t('lastName'), inputProps: { autoComplete: 'off' }, error: Boolean(error === null || error === void 0 ? void 0 : error.message) })), (error === null || error === void 0 ? void 0 : error.message) && _jsx(ErrorStyled, { error: t(error.message) })] })));
|
|
62
|
+
} }, "fullInfoFormLastName"), _jsx(Controller, { control: control, name: "email", render: (_a) => {
|
|
63
|
+
var _b = _a.field, { ref } = _b, field = __rest(_b, ["ref"]), { fieldState: { error } } = _a;
|
|
64
|
+
return (_jsxs(Box, Object.assign({ ref: emailRef }, { children: [_jsx(InputStyled, Object.assign({}, field, { placeholder: t('email'), inputProps: { autoComplete: 'off' }, error: Boolean(error === null || error === void 0 ? void 0 : error.message) })), (error === null || error === void 0 ? void 0 : error.message) && _jsx(ErrorStyled, { error: t(error.message) })] })));
|
|
65
|
+
} }, "fullInfoFormEmail"), _jsx(Controller, { control: control, name: "phoneNumber", render: (_a) => {
|
|
66
|
+
var _b, _c;
|
|
67
|
+
var _d = _a.field, { ref } = _d, field = __rest(_d, ["ref"]), { fieldState: { error } } = _a;
|
|
68
|
+
return (_jsxs(Box, Object.assign({ ref: phoneNumberRef }, { children: [_jsxs(MobileWrapper, Object.assign({ sx: Object.assign({}, ((error === null || error === void 0 ? void 0 : error.message) && { borderBottom: 'none' })) }, { children: [_jsx(CountriesDropdown, { defaultCountry: (_c = (_b = country === null || country === void 0 ? void 0 : country.iso2) !== null && _b !== void 0 ? _b : defaultCountry === null || defaultCountry === void 0 ? void 0 : defaultCountry.code) !== null && _c !== void 0 ? _c : 'SA', value: country, onChangeCountry: onCountryChange, countries: countries, isLoading: isCountriesLoading }), _jsx(InputNumberStyled, Object.assign({}, field, { placeholder: t('mobile'), inputProps: { autoComplete: 'off' }, error: Boolean(error === null || error === void 0 ? void 0 : error.message), sx: {
|
|
69
|
+
border: 'none',
|
|
70
|
+
paddingInlineEnd: 0,
|
|
71
|
+
}, hideArrows: true }))] })), (error === null || error === void 0 ? void 0 : error.message) && _jsx(ErrorStyled, { error: t(error.message, { numberLen: country.max_digits }) })] })));
|
|
72
|
+
} }), _jsx(SubmitButton, Object.assign({ onClick: onSubmit, disabled: !isValid || isItemsNotValid || !items.length }, { children: submitButtonText }))] })));
|
|
73
|
+
}
|
|
74
|
+
export default memo(FullInfoForm);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Item } from '../../../types/index.js';
|
|
3
|
+
import { FullInfoProps } from './FullInfo';
|
|
4
|
+
export interface PhoneNumberFormProps extends Pick<FullInfoProps, 'customer' | 'country' | 'onCountryChange' | 'onCustomerChange' | 'defaultCountry' | 'countries' | 'isCountriesLoading'> {
|
|
5
|
+
isItemsNotValid: boolean;
|
|
6
|
+
items: Item[];
|
|
7
|
+
submitButtonText: string;
|
|
8
|
+
onSubmit: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare function PhoneNumberForm({ submitButtonText, onSubmit, customer, country, isItemsNotValid, items, defaultCountry, countries, isCountriesLoading, onCustomerChange, onCountryChange, }: Readonly<PhoneNumberFormProps>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare const _default: import("react").MemoExoticComponent<typeof PhoneNumberForm>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { memo, useEffect, useRef } from 'react';
|
|
14
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
15
|
+
import Box from '@mui/material/Box';
|
|
16
|
+
import { Controller, useForm } from 'react-hook-form';
|
|
17
|
+
import { useTranslation } from 'react-i18next';
|
|
18
|
+
import { CountriesDropdown, InputNumberStyled, MobileWrapper } from '../../index.js';
|
|
19
|
+
import { FormWrapper, SubmitButton, InputStyled, ErrorStyled } from './style';
|
|
20
|
+
import { validationPhoneNumberSchema } from './validation';
|
|
21
|
+
function PhoneNumberForm({ submitButtonText, onSubmit, customer, country, isItemsNotValid, items, defaultCountry, countries, isCountriesLoading, onCustomerChange, onCountryChange, }) {
|
|
22
|
+
const firstNameRef = useRef();
|
|
23
|
+
const lastNameRef = useRef();
|
|
24
|
+
const phoneNumberRef = useRef();
|
|
25
|
+
const { t } = useTranslation();
|
|
26
|
+
const { control, formState: { isValid, errors }, watch, trigger, } = useForm({
|
|
27
|
+
mode: 'onChange',
|
|
28
|
+
resolver: yupResolver(validationPhoneNumberSchema(country.max_digits)),
|
|
29
|
+
defaultValues: {
|
|
30
|
+
firstName: customer.firstName,
|
|
31
|
+
phoneNumber: customer.phoneNumber,
|
|
32
|
+
lastName: customer.lastName,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
// revalidate default values
|
|
37
|
+
if (customer.firstName && customer.phoneNumber && customer.lastName) {
|
|
38
|
+
trigger();
|
|
39
|
+
}
|
|
40
|
+
}, []);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
watch(({ firstName = '', lastName = '', phoneNumber = '' }) => {
|
|
43
|
+
onCustomerChange(Object.assign(Object.assign({}, customer), { firstName,
|
|
44
|
+
lastName,
|
|
45
|
+
phoneNumber }));
|
|
46
|
+
});
|
|
47
|
+
}, [watch, errors, customer]);
|
|
48
|
+
const onMouseLeave = (e) => {
|
|
49
|
+
e.stopPropagation();
|
|
50
|
+
};
|
|
51
|
+
return (_jsxs(FormWrapper, Object.assign({ onMouseLeave: onMouseLeave }, { children: [_jsx(Controller, { control: control, name: "phoneNumber", render: (_a) => {
|
|
52
|
+
var _b, _c;
|
|
53
|
+
var _d = _a.field, { ref } = _d, field = __rest(_d, ["ref"]), { fieldState: { error } } = _a;
|
|
54
|
+
return (_jsxs(Box, Object.assign({ ref: phoneNumberRef }, { children: [_jsxs(MobileWrapper, Object.assign({ sx: Object.assign({}, ((error === null || error === void 0 ? void 0 : error.message) && { borderBottom: 'none' })) }, { children: [_jsx(CountriesDropdown, { defaultCountry: (_c = (_b = country === null || country === void 0 ? void 0 : country.iso2) !== null && _b !== void 0 ? _b : defaultCountry === null || defaultCountry === void 0 ? void 0 : defaultCountry.code) !== null && _c !== void 0 ? _c : 'SA', value: country, onChangeCountry: onCountryChange, countries: countries, isLoading: isCountriesLoading }), _jsx(InputNumberStyled, Object.assign({}, field, { placeholder: t('mobile'), error: Boolean(error === null || error === void 0 ? void 0 : error.message), sx: {
|
|
55
|
+
border: 'none',
|
|
56
|
+
paddingInlineEnd: 0,
|
|
57
|
+
}, inputProps: {
|
|
58
|
+
autoComplete: 'off',
|
|
59
|
+
form: {
|
|
60
|
+
autoComplete: 'off',
|
|
61
|
+
},
|
|
62
|
+
}, hideArrows: true }))] })), (error === null || error === void 0 ? void 0 : error.message) && _jsx(ErrorStyled, { error: t(error.message, { numberLen: country.max_digits }) })] })));
|
|
63
|
+
} }, "phoneNumberFormPhone"), _jsx(Controller, { control: control, name: "firstName", render: (_a) => {
|
|
64
|
+
var _b = _a.field, { ref } = _b, field = __rest(_b, ["ref"]), { fieldState: { error } } = _a;
|
|
65
|
+
return (_jsxs(Box, Object.assign({ ref: firstNameRef }, { children: [_jsx(InputStyled, Object.assign({}, field, { placeholder: t('firstName'), inputProps: { autoComplete: 'off' }, error: Boolean(error === null || error === void 0 ? void 0 : error.message) })), (error === null || error === void 0 ? void 0 : error.message) && _jsx(ErrorStyled, { error: t(error.message) })] })));
|
|
66
|
+
} }, "phoneNumberFormFirstName"), _jsx(Controller, { control: control, name: "lastName", render: (_a) => {
|
|
67
|
+
var _b = _a.field, { ref } = _b, field = __rest(_b, ["ref"]), { fieldState: { error } } = _a;
|
|
68
|
+
return (_jsxs(Box, Object.assign({ ref: lastNameRef }, { children: [_jsx(InputStyled, Object.assign({}, field, { placeholder: t('lastName'), inputProps: { autoComplete: 'off' }, error: Boolean(error === null || error === void 0 ? void 0 : error.message) })), (error === null || error === void 0 ? void 0 : error.message) && _jsx(ErrorStyled, { error: t(error.message) })] })));
|
|
69
|
+
} }, "phoneNumberFormLastName"), _jsx(SubmitButton, Object.assign({ onClick: onSubmit, disabled: !isValid || isItemsNotValid || !items.length }, { children: submitButtonText }))] })));
|
|
70
|
+
}
|
|
71
|
+
export default memo(PhoneNumberForm);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './validation';
|
|
2
|
+
export * from './EmailForm';
|
|
3
|
+
export { default as EmailForm } from './EmailForm';
|
|
4
|
+
export * from './FullInfo';
|
|
5
|
+
export { default as FullInfo } from './FullInfo';
|
|
6
|
+
export * from './FullInfoForm';
|
|
7
|
+
export { default as FullInfoForm } from './FullInfoForm';
|
|
8
|
+
export * from './PhoneNumberForm';
|
|
9
|
+
export { default as PhoneNumberForm } from './PhoneNumberForm';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './validation';
|
|
2
|
+
export * from './EmailForm';
|
|
3
|
+
export { default as EmailForm } from './EmailForm';
|
|
4
|
+
export * from './FullInfo';
|
|
5
|
+
export { default as FullInfo } from './FullInfo';
|
|
6
|
+
export * from './FullInfoForm';
|
|
7
|
+
export { default as FullInfoForm } from './FullInfoForm';
|
|
8
|
+
export * from './PhoneNumberForm';
|
|
9
|
+
export { default as PhoneNumberForm } from './PhoneNumberForm';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const MobileWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
3
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
4
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
5
|
+
export declare const SearchWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
6
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
7
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
8
|
+
export declare const FormWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
9
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
10
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material/styles").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
11
|
+
export declare const SubmitButton: import("@emotion/styled").StyledComponent<import("@mui/material/Button").ButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
12
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
13
|
+
}, "color" | "disabled" | "classes" | "className" | "style" | "tabIndex" | "children" | "sx" | "variant" | "size" | "fullWidth" | "href" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableElevation" | "disableFocusRipple" | "endIcon" | "startIcon"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
14
|
+
export declare const InputStyled: import("@emotion/styled").StyledComponent<Readonly<import("@mui/material").InputProps & {
|
|
15
|
+
isError?: boolean | undefined;
|
|
16
|
+
}> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
17
|
+
error?: boolean | undefined;
|
|
18
|
+
}, {}, {}>;
|
|
19
|
+
export declare const InputNumberStyled: import("@emotion/styled").StyledComponent<Omit<Readonly<import("@mui/material").InputProps & {
|
|
20
|
+
isError?: boolean | undefined;
|
|
21
|
+
hideArrows?: boolean | undefined;
|
|
22
|
+
}>, "ref"> & import("react").RefAttributes<HTMLInputElement> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
23
|
+
error?: boolean | undefined;
|
|
24
|
+
}, {}, {}>;
|
|
25
|
+
export declare const ErrorStyled: import("@emotion/styled").StyledComponent<import("../../Error/Error").ErrorI & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import Box from '@mui/material/Box';
|
|
2
|
+
import Button from '@mui/material/Button';
|
|
3
|
+
import { styled, alpha } from '@mui/material/styles';
|
|
4
|
+
import { Input, InputNumber, Error } from '../../index.js';
|
|
5
|
+
export const MobileWrapper = styled(Box)(({ theme }) => ({
|
|
6
|
+
border: `1px solid ${theme.palette.divider}`,
|
|
7
|
+
display: 'flex',
|
|
8
|
+
position: 'relative',
|
|
9
|
+
paddingInline: '8px',
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
borderRadius: '4px',
|
|
12
|
+
height: '40px',
|
|
13
|
+
}));
|
|
14
|
+
export const SearchWrapper = styled(Box)(() => ({
|
|
15
|
+
display: 'flex',
|
|
16
|
+
alignItems: 'center',
|
|
17
|
+
}));
|
|
18
|
+
export const FormWrapper = styled(Box)(({ theme }) => ({
|
|
19
|
+
padding: '8px',
|
|
20
|
+
display: 'flex',
|
|
21
|
+
flexDirection: 'column',
|
|
22
|
+
gap: '8px',
|
|
23
|
+
position: 'relative',
|
|
24
|
+
background: theme.palette.common.white,
|
|
25
|
+
borderRadius: '4px',
|
|
26
|
+
width: 'max-content',
|
|
27
|
+
maxWidth: 230,
|
|
28
|
+
boxShadow: theme.shadows[3],
|
|
29
|
+
}));
|
|
30
|
+
export const SubmitButton = styled(Button)(({ theme }) => ({
|
|
31
|
+
display: 'flex',
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
justifyContent: 'center',
|
|
34
|
+
textTransform: 'capitalize',
|
|
35
|
+
padding: '8px 13px',
|
|
36
|
+
minWidth: 89,
|
|
37
|
+
height: 32,
|
|
38
|
+
fontSize: '11px',
|
|
39
|
+
borderRadius: '4px',
|
|
40
|
+
fontWeight: 700,
|
|
41
|
+
background: theme.palette.info.dark,
|
|
42
|
+
color: theme.palette.common.white,
|
|
43
|
+
textAlign: 'center',
|
|
44
|
+
'&.Mui-disabled': {
|
|
45
|
+
backgroundColor: alpha(theme.palette.grey[700], 0.5),
|
|
46
|
+
color: theme.palette.common.white,
|
|
47
|
+
cursor: 'not-allowed',
|
|
48
|
+
},
|
|
49
|
+
'&:hover': {
|
|
50
|
+
background: theme.palette.info.dark,
|
|
51
|
+
},
|
|
52
|
+
}));
|
|
53
|
+
export const InputStyled = styled(Input, { shouldForwardProp: (props) => props !== 'error' })(({ error }) => (Object.assign({ img: {
|
|
54
|
+
cursor: 'pointer',
|
|
55
|
+
} }, (error && {
|
|
56
|
+
borderBottomLeftRadius: 0,
|
|
57
|
+
borderBottomRightRadius: 0,
|
|
58
|
+
borderBottom: 'none',
|
|
59
|
+
}))));
|
|
60
|
+
export const InputNumberStyled = styled(InputNumber, { shouldForwardProp: (props) => props !== 'error' })(({ error }) => (Object.assign({ img: {
|
|
61
|
+
cursor: 'pointer',
|
|
62
|
+
} }, (error && {
|
|
63
|
+
borderBottomLeftRadius: 0,
|
|
64
|
+
borderBottomRightRadius: 0,
|
|
65
|
+
borderBottom: 'none',
|
|
66
|
+
}))));
|
|
67
|
+
export const ErrorStyled = styled(Error)(() => ({
|
|
68
|
+
borderTopLeftRadius: 0,
|
|
69
|
+
borderTopRightRadius: 0,
|
|
70
|
+
height: 25,
|
|
71
|
+
}));
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as Yup from 'yup';
|
|
2
|
+
export declare const validationEmailFromSchema: Yup.ObjectSchema<{
|
|
3
|
+
email: string;
|
|
4
|
+
firstName: string;
|
|
5
|
+
lastName: string;
|
|
6
|
+
}, Yup.AnyObject, {
|
|
7
|
+
email: undefined;
|
|
8
|
+
firstName: undefined;
|
|
9
|
+
lastName: undefined;
|
|
10
|
+
}, "">;
|
|
11
|
+
export declare const validationFullInfoSchema: (numberLen: number) => Yup.ObjectSchema<{
|
|
12
|
+
email: string | undefined;
|
|
13
|
+
phoneNumber: string | undefined;
|
|
14
|
+
firstName: string;
|
|
15
|
+
lastName: string;
|
|
16
|
+
}, Yup.AnyObject, {
|
|
17
|
+
email: undefined;
|
|
18
|
+
phoneNumber: undefined;
|
|
19
|
+
firstName: undefined;
|
|
20
|
+
lastName: undefined;
|
|
21
|
+
}, "">;
|
|
22
|
+
export declare const validationPhoneNumberSchema: (numberLen: number) => Yup.ObjectSchema<{
|
|
23
|
+
firstName: string;
|
|
24
|
+
lastName: string;
|
|
25
|
+
phoneNumber: string;
|
|
26
|
+
}, Yup.AnyObject, {
|
|
27
|
+
firstName: undefined;
|
|
28
|
+
lastName: undefined;
|
|
29
|
+
phoneNumber: undefined;
|
|
30
|
+
}, "">;
|