phx-react 1.3.676 → 1.3.677
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/dist/cjs/components/SelectBox/SelectBox.js +4 -61
- package/dist/cjs/components/SelectBox/SelectBox.js.map +1 -1
- package/dist/cjs/utils/email-service.d.ts +2 -1
- package/dist/esm/components/SelectBox/SelectBox.js +5 -62
- package/dist/esm/components/SelectBox/SelectBox.js.map +1 -1
- package/dist/esm/utils/email-service.d.ts +2 -1
- package/package.json +1 -1
|
@@ -14,66 +14,12 @@ function classNames() {
|
|
|
14
14
|
}
|
|
15
15
|
return classes.filter(Boolean).join(' ');
|
|
16
16
|
}
|
|
17
|
-
var useDropdownPosition = function (actionButtonRef, open) {
|
|
18
|
-
var _a = (0, react_2.useState)({}), position = _a[0], setPosition = _a[1];
|
|
19
|
-
(0, react_2.useEffect)(function () {
|
|
20
|
-
if (!actionButtonRef.current || !open)
|
|
21
|
-
return;
|
|
22
|
-
var elementRef = actionButtonRef.current;
|
|
23
|
-
var positionAtrs = elementRef.getBoundingClientRect();
|
|
24
|
-
var bottom = positionAtrs.bottom, height = positionAtrs.height, left = positionAtrs.left, right = positionAtrs.right, top = positionAtrs.top;
|
|
25
|
-
var widthWindow = window.innerWidth;
|
|
26
|
-
var heightWindow = window.innerHeight;
|
|
27
|
-
var spaceAbove = top;
|
|
28
|
-
var spaceBelow = heightWindow - bottom;
|
|
29
|
-
var spaceLeft = left;
|
|
30
|
-
var spaceRight = widthWindow - right;
|
|
31
|
-
var style = {};
|
|
32
|
-
// Determine vertical positioning
|
|
33
|
-
if (spaceBelow >= 190) {
|
|
34
|
-
style.top = top + height + 8;
|
|
35
|
-
}
|
|
36
|
-
else if (spaceAbove >= 190) {
|
|
37
|
-
style.bottom = spaceBelow + height + 8;
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
// If not enough space above or below, use the maximum available space
|
|
41
|
-
if (spaceBelow > spaceAbove) {
|
|
42
|
-
style.top = top + height + 8;
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
style.bottom = spaceBelow + height + 8;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
// Determine horizontal positioning
|
|
49
|
-
if (spaceRight >= 224) {
|
|
50
|
-
style.left = left;
|
|
51
|
-
}
|
|
52
|
-
else if (spaceLeft >= 224) {
|
|
53
|
-
style.right = spaceRight;
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
// If not enough space on the right or left, use the maximum available space
|
|
57
|
-
if (spaceRight > spaceLeft) {
|
|
58
|
-
style.left = left;
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
style.right = spaceRight;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
setPosition(style);
|
|
65
|
-
}, [actionButtonRef, open]);
|
|
66
|
-
return position;
|
|
67
|
-
};
|
|
68
17
|
var PHXSelectBox = function (props) {
|
|
69
18
|
var data = props.data, defaultValue = props.defaultValue, error = props.error, errorMessageCustom = props.errorMessageCustom, errorType = props.errorType, label = props.label, onChange = props.onChange, placeholder = props.placeholder, register = props.register, _a = props.disabled, disabled = _a === void 0 ? false : _a;
|
|
70
19
|
var _b = (0, react_2.useState)(''), query = _b[0], setQuery = _b[1];
|
|
71
20
|
var comboBtn = (0, react_2.useRef)(null);
|
|
72
|
-
var
|
|
73
|
-
var _c = (0, react_2.useState)(false), open = _c[0], setOpen = _c[1];
|
|
74
|
-
var _d = (0, react_2.useState)(defaultValue ? defaultValue : null), selectedPerson = _d[0], setSelectedPerson = _d[1];
|
|
21
|
+
var _c = (0, react_2.useState)(defaultValue ? defaultValue : null), selectedPerson = _c[0], setSelectedPerson = _c[1];
|
|
75
22
|
var filteredPeople = query === '' ? data : data.filter(function (person) { return person.value.toLowerCase().includes(query.toLowerCase()); });
|
|
76
|
-
var position = useDropdownPosition(actionButtonRef, open);
|
|
77
23
|
var handlerClickInput = function () {
|
|
78
24
|
var _a;
|
|
79
25
|
(_a = comboBtn.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
@@ -114,17 +60,14 @@ var PHXSelectBox = function (props) {
|
|
|
114
60
|
var onChangeSelectBox = function (event) {
|
|
115
61
|
setQuery(event.target.value);
|
|
116
62
|
};
|
|
117
|
-
return (react_2["default"].createElement("
|
|
118
|
-
e.stopPropagation();
|
|
119
|
-
setOpen(function (prev) { return !prev; });
|
|
120
|
-
} },
|
|
63
|
+
return (react_2["default"].createElement(react_2["default"].Fragment, null,
|
|
121
64
|
react_2["default"].createElement(react_1.Combobox, { as: 'div', onChange: onChangeValue, value: selectedPerson },
|
|
122
65
|
react_2["default"].createElement(react_1.Combobox.Label, { className: 'mb-1 flex text-xs font-normal text-gray-700' }, label),
|
|
123
66
|
react_2["default"].createElement("div", null,
|
|
124
67
|
disabled ? (react_2["default"].createElement(Input_1.PHXInput, { disabled: disabled, value: (selectedPerson === null || selectedPerson === void 0 ? void 0 : selectedPerson.value) || '' })) : (react_2["default"].createElement(react_1.Combobox.Input, tslib_1.__assign({ autoComplete: 'off', className: classNames('block w-full rounded-lg border-[0.5px] border-gray-500 px-3 py-1.5 text-xs font-normal shadow-sm hover:bg-gray-50 focus:border-gray-500 focus:bg-gray-50 focus:outline-none focus:outline-offset-1 focus:outline-indigo-500 focus:ring-transparent', errorCheck ? 'border-red-800 bg-red-50 hover:bg-red-50 focus:border-red-800 focus:bg-red-50' : '') }, register, { displayValue: function (person) { return person === null || person === void 0 ? void 0 : person.value; }, onChange: function (event) { return onChangeSelectBox(event); }, onClick: function () { return handlerClickInput(); }, placeholder: placeholder }))),
|
|
125
68
|
react_2["default"].createElement(react_1.Combobox.Button, { ref: comboBtn, className: 'hidden' },
|
|
126
69
|
react_2["default"].createElement(solid_1.ChevronUpDownIcon, { "aria-hidden": 'true', className: 'h-5 w-5 text-gray-400' })),
|
|
127
|
-
filteredPeople.length > 0 ? (react_2["default"].createElement(react_1.Combobox.Options, { className: 'absolute z-10 mt-2 max-h-60 w-fit overflow-auto rounded-lg bg-white px-2 py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm'
|
|
70
|
+
filteredPeople.length > 0 ? (react_2["default"].createElement(react_1.Combobox.Options, { className: 'absolute z-10 mt-2 max-h-60 w-fit overflow-auto rounded-lg bg-white px-2 py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm' }, filteredPeople.map(function (person) { return (react_2["default"].createElement(react_1.Combobox.Option, { key: person.id, className: function (_a) {
|
|
128
71
|
var active = _a.active;
|
|
129
72
|
return classNames('relative mb-1 cursor-pointer select-none rounded-lg py-2 pl-3 pr-9', person.id === (selectedPerson === null || selectedPerson === void 0 ? void 0 : selectedPerson.id) ? 'bg-zinc-200' : 'text-gray-900 ', active ? 'bg-zinc-100' : 'text-gray-900 ');
|
|
130
73
|
}, value: person }, function (_a) {
|
|
@@ -133,7 +76,7 @@ var PHXSelectBox = function (props) {
|
|
|
133
76
|
react_2["default"].createElement("span", { className: classNames('block truncate text-xs', person.id === (selectedPerson === null || selectedPerson === void 0 ? void 0 : selectedPerson.id) && 'font-semibold') }, person.value),
|
|
134
77
|
person.id === (selectedPerson === null || selectedPerson === void 0 ? void 0 : selectedPerson.id) && (react_2["default"].createElement("span", { className: classNames('absolute inset-y-0 right-0 flex items-center pr-4', active ? 'text-gray-900' : 'text-indigo-600') },
|
|
135
78
|
react_2["default"].createElement(solid_1.CheckIcon, { "aria-hidden": 'true', className: 'h-4 w-4' })))));
|
|
136
|
-
})); }))) : (react_2["default"].createElement(react_1.Combobox.Options, { className: 'absolute z-10 max-h-60 w-fit overflow-auto rounded-lg bg-white px-2 py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm'
|
|
79
|
+
})); }))) : (react_2["default"].createElement(react_1.Combobox.Options, { className: 'absolute z-10 mt-2 max-h-60 w-fit overflow-auto rounded-lg bg-white px-2 py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm' },
|
|
137
80
|
react_2["default"].createElement(react_1.Combobox.Option, { className: 'mb-1 cursor-pointer select-none rounded-lg py-2 pl-3 pr-9', value: '' },
|
|
138
81
|
react_2["default"].createElement("div", { className: 'flex flex-col items-center justify-center' },
|
|
139
82
|
react_2["default"].createElement("svg", { className: 'mx-auto h-4 w-4 text-gray-700', fill: 'none', stroke: 'currentColor', viewBox: '0 0 24 24', xmlns: 'http://www.w3.org/2000/svg' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectBox.js","sourceRoot":"","sources":["../../../../src/components/SelectBox/SelectBox.tsx"],"names":[],"mappings":";;;;AAAA,2CAA4C;AAC5C,mDAAwE;AACxE,
|
|
1
|
+
{"version":3,"file":"SelectBox.js","sourceRoot":"","sources":["../../../../src/components/SelectBox/SelectBox.tsx"],"names":[],"mappings":";;;;AAAA,2CAA4C;AAC5C,mDAAwE;AACxE,qDAA+C;AAE/C,kCAAmC;AACnC,oFAAqD;AA2BrD,SAAS,UAAU;IAAC,iBAAe;SAAf,UAAe,EAAf,qBAAe,EAAf,IAAe;QAAf,4BAAe;;IACjC,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1C,CAAC;AAEM,IAAM,YAAY,GAAG,UAAC,KAAyB;IAElD,IAAA,IAAI,GAUF,KAAK,KAVH,EACJ,YAAY,GASV,KAAK,aATK,EACZ,KAAK,GAQH,KAAK,MARF,EACL,kBAAkB,GAOhB,KAAK,mBAPW,EAClB,SAAS,GAMP,KAAK,UANE,EACT,KAAK,GAKH,KAAK,MALF,EACL,QAAQ,GAIN,KAAK,SAJC,EACR,WAAW,GAGT,KAAK,YAHI,EACX,QAAQ,GAEN,KAAK,SAFC,EACR,KACE,KAAK,SADS,EAAhB,QAAQ,mBAAG,KAAK,KAAA,CACT;IACH,IAAA,KAAoB,IAAA,gBAAQ,EAAC,EAAE,CAAC,EAA/B,KAAK,QAAA,EAAE,Q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AkK;oBAC5L,iCAAC,gBAAQ,CAAC,MAAM,IAAC,SAAS,EAAC,2DAA2D,EAAC,KAAK,EAAC,EAAE;wBAC7F,0CAAK,SAAS,EAAC,2CAA2C;4BACxD,0CACE,SAAS,EAAC,+BAA+B,EACzC,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,OAAO,EAAC,WAAW,EACnB,KAAK,EAAC,4BAA4B;gCAElC,2CACE,CAAC,EAAC,6CAA6C,EAC/C,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,EACtB,WAAW,EAAC,GAAG,GACf,CACE;4BACN,yCAAI,SAAS,EAAC,gCAAgC,2CAAsB,CAChE,CACU,CACD,CACpB,CACG,CACG;QACV,UAAU,CAAC,CAAC,CAAC,iCAAC,yBAAY,IAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,GAAI,CAAC,CAAC,CAAC,IAAI,CACjE,CACJ,CAAA;AACH,CAAC,CAAA;AAvJY,QAAA,YAAY,gBAuJxB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
1
2
|
import { SendMailData } from './types/types';
|
|
2
3
|
declare class EmailService {
|
|
3
|
-
sendEmail: (data: SendMailData) => Promise<
|
|
4
|
+
sendEmail: (data: SendMailData) => Promise<axios.AxiosResponse<SendMailData, any>>;
|
|
4
5
|
}
|
|
5
6
|
declare const emailService: EmailService;
|
|
6
7
|
export default emailService;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __assign } from "tslib";
|
|
2
2
|
import { Combobox } from '@headlessui/react';
|
|
3
3
|
import { CheckIcon, ChevronUpDownIcon } from '@heroicons/react/24/solid';
|
|
4
|
-
import React, {
|
|
4
|
+
import React, { useRef, useState } from 'react';
|
|
5
5
|
import { PHXInput } from '../Input';
|
|
6
6
|
import ErrorMessage from '../../commons/ErrorMessage';
|
|
7
7
|
function classNames() {
|
|
@@ -11,66 +11,12 @@ function classNames() {
|
|
|
11
11
|
}
|
|
12
12
|
return classes.filter(Boolean).join(' ');
|
|
13
13
|
}
|
|
14
|
-
var useDropdownPosition = function (actionButtonRef, open) {
|
|
15
|
-
var _a = useState({}), position = _a[0], setPosition = _a[1];
|
|
16
|
-
useEffect(function () {
|
|
17
|
-
if (!actionButtonRef.current || !open)
|
|
18
|
-
return;
|
|
19
|
-
var elementRef = actionButtonRef.current;
|
|
20
|
-
var positionAtrs = elementRef.getBoundingClientRect();
|
|
21
|
-
var bottom = positionAtrs.bottom, height = positionAtrs.height, left = positionAtrs.left, right = positionAtrs.right, top = positionAtrs.top;
|
|
22
|
-
var widthWindow = window.innerWidth;
|
|
23
|
-
var heightWindow = window.innerHeight;
|
|
24
|
-
var spaceAbove = top;
|
|
25
|
-
var spaceBelow = heightWindow - bottom;
|
|
26
|
-
var spaceLeft = left;
|
|
27
|
-
var spaceRight = widthWindow - right;
|
|
28
|
-
var style = {};
|
|
29
|
-
// Determine vertical positioning
|
|
30
|
-
if (spaceBelow >= 190) {
|
|
31
|
-
style.top = top + height + 8;
|
|
32
|
-
}
|
|
33
|
-
else if (spaceAbove >= 190) {
|
|
34
|
-
style.bottom = spaceBelow + height + 8;
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
// If not enough space above or below, use the maximum available space
|
|
38
|
-
if (spaceBelow > spaceAbove) {
|
|
39
|
-
style.top = top + height + 8;
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
style.bottom = spaceBelow + height + 8;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
// Determine horizontal positioning
|
|
46
|
-
if (spaceRight >= 224) {
|
|
47
|
-
style.left = left;
|
|
48
|
-
}
|
|
49
|
-
else if (spaceLeft >= 224) {
|
|
50
|
-
style.right = spaceRight;
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
// If not enough space on the right or left, use the maximum available space
|
|
54
|
-
if (spaceRight > spaceLeft) {
|
|
55
|
-
style.left = left;
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
style.right = spaceRight;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
setPosition(style);
|
|
62
|
-
}, [actionButtonRef, open]);
|
|
63
|
-
return position;
|
|
64
|
-
};
|
|
65
14
|
export var PHXSelectBox = function (props) {
|
|
66
15
|
var data = props.data, defaultValue = props.defaultValue, error = props.error, errorMessageCustom = props.errorMessageCustom, errorType = props.errorType, label = props.label, onChange = props.onChange, placeholder = props.placeholder, register = props.register, _a = props.disabled, disabled = _a === void 0 ? false : _a;
|
|
67
16
|
var _b = useState(''), query = _b[0], setQuery = _b[1];
|
|
68
17
|
var comboBtn = useRef(null);
|
|
69
|
-
var
|
|
70
|
-
var _c = useState(false), open = _c[0], setOpen = _c[1];
|
|
71
|
-
var _d = useState(defaultValue ? defaultValue : null), selectedPerson = _d[0], setSelectedPerson = _d[1];
|
|
18
|
+
var _c = useState(defaultValue ? defaultValue : null), selectedPerson = _c[0], setSelectedPerson = _c[1];
|
|
72
19
|
var filteredPeople = query === '' ? data : data.filter(function (person) { return person.value.toLowerCase().includes(query.toLowerCase()); });
|
|
73
|
-
var position = useDropdownPosition(actionButtonRef, open);
|
|
74
20
|
var handlerClickInput = function () {
|
|
75
21
|
var _a;
|
|
76
22
|
(_a = comboBtn.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
@@ -111,17 +57,14 @@ export var PHXSelectBox = function (props) {
|
|
|
111
57
|
var onChangeSelectBox = function (event) {
|
|
112
58
|
setQuery(event.target.value);
|
|
113
59
|
};
|
|
114
|
-
return (React.createElement(
|
|
115
|
-
e.stopPropagation();
|
|
116
|
-
setOpen(function (prev) { return !prev; });
|
|
117
|
-
} },
|
|
60
|
+
return (React.createElement(React.Fragment, null,
|
|
118
61
|
React.createElement(Combobox, { as: 'div', onChange: onChangeValue, value: selectedPerson },
|
|
119
62
|
React.createElement(Combobox.Label, { className: 'mb-1 flex text-xs font-normal text-gray-700' }, label),
|
|
120
63
|
React.createElement("div", null,
|
|
121
64
|
disabled ? (React.createElement(PHXInput, { disabled: disabled, value: (selectedPerson === null || selectedPerson === void 0 ? void 0 : selectedPerson.value) || '' })) : (React.createElement(Combobox.Input, __assign({ autoComplete: 'off', className: classNames('block w-full rounded-lg border-[0.5px] border-gray-500 px-3 py-1.5 text-xs font-normal shadow-sm hover:bg-gray-50 focus:border-gray-500 focus:bg-gray-50 focus:outline-none focus:outline-offset-1 focus:outline-indigo-500 focus:ring-transparent', errorCheck ? 'border-red-800 bg-red-50 hover:bg-red-50 focus:border-red-800 focus:bg-red-50' : '') }, register, { displayValue: function (person) { return person === null || person === void 0 ? void 0 : person.value; }, onChange: function (event) { return onChangeSelectBox(event); }, onClick: function () { return handlerClickInput(); }, placeholder: placeholder }))),
|
|
122
65
|
React.createElement(Combobox.Button, { ref: comboBtn, className: 'hidden' },
|
|
123
66
|
React.createElement(ChevronUpDownIcon, { "aria-hidden": 'true', className: 'h-5 w-5 text-gray-400' })),
|
|
124
|
-
filteredPeople.length > 0 ? (React.createElement(Combobox.Options, { className: 'absolute z-10 mt-2 max-h-60 w-fit overflow-auto rounded-lg bg-white px-2 py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm'
|
|
67
|
+
filteredPeople.length > 0 ? (React.createElement(Combobox.Options, { className: 'absolute z-10 mt-2 max-h-60 w-fit overflow-auto rounded-lg bg-white px-2 py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm' }, filteredPeople.map(function (person) { return (React.createElement(Combobox.Option, { key: person.id, className: function (_a) {
|
|
125
68
|
var active = _a.active;
|
|
126
69
|
return classNames('relative mb-1 cursor-pointer select-none rounded-lg py-2 pl-3 pr-9', person.id === (selectedPerson === null || selectedPerson === void 0 ? void 0 : selectedPerson.id) ? 'bg-zinc-200' : 'text-gray-900 ', active ? 'bg-zinc-100' : 'text-gray-900 ');
|
|
127
70
|
}, value: person }, function (_a) {
|
|
@@ -130,7 +73,7 @@ export var PHXSelectBox = function (props) {
|
|
|
130
73
|
React.createElement("span", { className: classNames('block truncate text-xs', person.id === (selectedPerson === null || selectedPerson === void 0 ? void 0 : selectedPerson.id) && 'font-semibold') }, person.value),
|
|
131
74
|
person.id === (selectedPerson === null || selectedPerson === void 0 ? void 0 : selectedPerson.id) && (React.createElement("span", { className: classNames('absolute inset-y-0 right-0 flex items-center pr-4', active ? 'text-gray-900' : 'text-indigo-600') },
|
|
132
75
|
React.createElement(CheckIcon, { "aria-hidden": 'true', className: 'h-4 w-4' })))));
|
|
133
|
-
})); }))) : (React.createElement(Combobox.Options, { className: 'absolute z-10 max-h-60 w-fit overflow-auto rounded-lg bg-white px-2 py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm'
|
|
76
|
+
})); }))) : (React.createElement(Combobox.Options, { className: 'absolute z-10 mt-2 max-h-60 w-fit overflow-auto rounded-lg bg-white px-2 py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm' },
|
|
134
77
|
React.createElement(Combobox.Option, { className: 'mb-1 cursor-pointer select-none rounded-lg py-2 pl-3 pr-9', value: '' },
|
|
135
78
|
React.createElement("div", { className: 'flex flex-col items-center justify-center' },
|
|
136
79
|
React.createElement("svg", { className: 'mx-auto h-4 w-4 text-gray-700', fill: 'none', stroke: 'currentColor', viewBox: '0 0 24 24', xmlns: 'http://www.w3.org/2000/svg' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectBox.js","sourceRoot":"","sources":["../../../../src/components/SelectBox/SelectBox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AACxE,OAAO,KAAK,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"SelectBox.js","sourceRoot":"","sources":["../../../../src/components/SelectBox/SelectBox.tsx"],"names":[],"mappings":";AAAA,OAAO,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,GAAG,GACf,CACE;4BACN,4BAAI,SAAS,EAAC,gCAAgC,2CAAsB,CAChE,CACU,CACD,CACpB,CACG,CACG;QACV,UAAU,CAAC,CAAC,CAAC,oBAAC,YAAY,IAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,GAAI,CAAC,CAAC,CAAC,IAAI,CACjE,CACJ,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
1
2
|
import { SendMailData } from './types/types';
|
|
2
3
|
declare class EmailService {
|
|
3
|
-
sendEmail: (data: SendMailData) => Promise<
|
|
4
|
+
sendEmail: (data: SendMailData) => Promise<axios.AxiosResponse<SendMailData, any>>;
|
|
4
5
|
}
|
|
5
6
|
declare const emailService: EmailService;
|
|
6
7
|
export default emailService;
|