@arquimedes.co/eureka-forms 2.0.26 → 2.0.28
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/App/AppFunctions.js +1 -1
- package/dist/Form/FormTypes/ColumnForm/ColumnForm.js +2 -9
- package/dist/Form/FormTypes/ColumnForm/ColumnForm.module.css +0 -28
- package/dist/Form/FormTypes/StepperForm/StepperForm.js +4 -14
- package/dist/Form/FormTypes/StepperForm/StepperForm.module.css +0 -27
- package/dist/FormSteps/StepFunctions.d.ts +3 -3
- package/dist/FormSteps/StepFunctions.js +19 -7
- package/dist/Shared/CustomBtn/CustomBtn.d.ts +13 -0
- package/dist/Shared/CustomBtn/CustomBtn.js +102 -0
- package/dist/Shared/CustomBtn/CustomBtn.module.css +57 -0
- package/package.json +1 -1
package/dist/App/AppFunctions.js
CHANGED
|
@@ -106,7 +106,7 @@ export function calcRecursiveData(element, newSteps, customSteps) {
|
|
|
106
106
|
if (custom === null || custom === void 0 ? void 0 : custom.calcRecursiveData) {
|
|
107
107
|
custom.calcRecursiveData(step, element.ids);
|
|
108
108
|
}
|
|
109
|
-
calcSubSteps(step, function (idStep) { var _a; return (_a = element.ids[idStep]) !== null && _a !== void 0 ? _a : idStep; });
|
|
109
|
+
calcSubSteps(step.id, newSteps, function (idStep) { var _a; return (_a = element.ids[idStep]) !== null && _a !== void 0 ? _a : idStep; });
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
export var mapOriginalValue = function (step, value, values, form) {
|
|
@@ -48,13 +48,13 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
48
48
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
49
49
|
import { useCallback, useContext, useState } from 'react';
|
|
50
50
|
import styles from './ColumnForm.module.css';
|
|
51
|
-
import Loader from '../../../Shared/Loader/Loader';
|
|
52
51
|
import React from 'react';
|
|
53
52
|
import Terms from '../../Terms/Terms';
|
|
54
53
|
import { useFormContext } from 'react-hook-form';
|
|
55
54
|
import { useAppSelector } from '../../../hooks';
|
|
56
55
|
import Section from '../../Section/Section';
|
|
57
56
|
import CustomContext from '../../../Contexts/CustomContext';
|
|
57
|
+
import CustomBtn from '../../../Shared/CustomBtn/CustomBtn';
|
|
58
58
|
function ColumnForm(_a) {
|
|
59
59
|
var _this = this;
|
|
60
60
|
var onSubmit = _a.onSubmit, customSubmitBtns = _a.customSubmitBtns;
|
|
@@ -90,13 +90,6 @@ function ColumnForm(_a) {
|
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
92
|
}); }, []);
|
|
93
|
-
return (_jsxs("div", __assign({ className: styles.container, style: { color: formStyle.textColor } }, { children: [loading && _jsx("div", { className: styles.curtain }), previous.map(function (idSection) { return (_jsx(Section, { idSection: idSection }, idSection)); }), next.map(function (idSection) { return (_jsx(Section, { idSection: idSection }, idSection)); }), _jsx(Terms, {}), !postview && editable && (_jsxs(React.Fragment, { children: [!customSubmitBtns && (_jsx("div", __assign({ className: styles.submitBtnContainer }, { children:
|
|
94
|
-
background: formStyle.primaryColor,
|
|
95
|
-
color: formStyle.primaryContrastColor,
|
|
96
|
-
}, disabled: loading }, { children: [_jsx("div", __assign({ style: {
|
|
97
|
-
visibility: loading
|
|
98
|
-
? 'hidden'
|
|
99
|
-
: 'visible',
|
|
100
|
-
} }, { children: sendLabel !== null && sendLabel !== void 0 ? sendLabel : 'Enviar' })), loading && (_jsx("div", __assign({ className: styles.loaderContainer }, { children: _jsx(Loader, { color: formStyle.primaryContrastColor, position: "unset" }) })))] })) }))), customSubmitBtns === null || customSubmitBtns === void 0 ? void 0 : customSubmitBtns(submit, loading)] }))] })));
|
|
93
|
+
return (_jsxs("div", __assign({ className: styles.container, style: { color: formStyle.textColor } }, { children: [loading && _jsx("div", { className: styles.curtain }), previous.map(function (idSection) { return (_jsx(Section, { idSection: idSection }, idSection)); }), next.map(function (idSection) { return (_jsx(Section, { idSection: idSection }, idSection)); }), _jsx(Terms, {}), !postview && editable && (_jsxs(React.Fragment, { children: [!customSubmitBtns && (_jsx("div", __assign({ className: styles.submitBtnContainer }, { children: _jsx(CustomBtn, { onClick: submit, width: "calc(100% - 70px)", label: sendLabel !== null && sendLabel !== void 0 ? sendLabel : 'Enviar', backgroundColor: formStyle.primaryColor, color: formStyle.primaryContrastColor, loading: loading, "data-testid": "form__submit" }) }))), customSubmitBtns === null || customSubmitBtns === void 0 ? void 0 : customSubmitBtns(submit, loading)] }))] })));
|
|
101
94
|
}
|
|
102
95
|
export default ColumnForm;
|
|
@@ -17,31 +17,3 @@
|
|
|
17
17
|
width: 200px;
|
|
18
18
|
max-width: calc(100% - 40px);
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
.submitBtn {
|
|
22
|
-
border-radius: 20px;
|
|
23
|
-
padding: 15px 10px;
|
|
24
|
-
width: calc(100% - 30px);
|
|
25
|
-
margin: 0 auto 0 auto;
|
|
26
|
-
font-size: 1.4rem;
|
|
27
|
-
cursor: pointer;
|
|
28
|
-
-moz-user-select: none;
|
|
29
|
-
-khtml-user-select: none;
|
|
30
|
-
-webkit-user-select: none;
|
|
31
|
-
-ms-user-select: none;
|
|
32
|
-
user-select: none;
|
|
33
|
-
border: none;
|
|
34
|
-
position: relative;
|
|
35
|
-
}
|
|
36
|
-
.submitBtn[disabled] {
|
|
37
|
-
pointer-events: none;
|
|
38
|
-
opacity: 0.5;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.loaderContainer {
|
|
42
|
-
top: 0px;
|
|
43
|
-
bottom: 0px;
|
|
44
|
-
right: 0px;
|
|
45
|
-
left: 0px;
|
|
46
|
-
position: absolute;
|
|
47
|
-
}
|
|
@@ -48,7 +48,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
48
48
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
49
49
|
import { useCallback, useContext, useState } from 'react';
|
|
50
50
|
import styles from './StepperForm.module.css';
|
|
51
|
-
import Loader from '../../../Shared/Loader/Loader';
|
|
52
51
|
import Terms from '../../Terms/Terms';
|
|
53
52
|
import { useFormContext } from 'react-hook-form';
|
|
54
53
|
import { useAppDispatch, useAppSelector } from '../../../hooks';
|
|
@@ -57,6 +56,7 @@ import CustomContext from '../../../Contexts/CustomContext';
|
|
|
57
56
|
import * as SiteReducer from '../../../States/SiteSlice';
|
|
58
57
|
import { getAppState } from '../../../Utils/store';
|
|
59
58
|
import { IdFormContext } from '../../../App/App';
|
|
59
|
+
import CustomBtn from '../../../Shared/CustomBtn/CustomBtn';
|
|
60
60
|
function StepperForm(_a) {
|
|
61
61
|
var _this = this;
|
|
62
62
|
var onSubmit = _a.onSubmit, scrollToTop = _a.scrollToTop;
|
|
@@ -112,18 +112,8 @@ function StepperForm(_a) {
|
|
|
112
112
|
}); }, [next]);
|
|
113
113
|
if (!idCurrent)
|
|
114
114
|
return _jsx(_Fragment, {});
|
|
115
|
-
return (_jsxs("div", __assign({ className: styles.container, style: { color: formStyle.textColor } }, { children: [loading && _jsx("div", { className: styles.curtain }), _jsx(Section, { idSection: idCurrent }, idCurrent), next.length === 0 && _jsx(Terms, {}), _jsxs("div", __assign({ className: styles.btnsContainer }, { children: [previous.length > 0 && (
|
|
116
|
-
|
|
117
|
-
color: formStyle.primaryContrastColor,
|
|
118
|
-
}, disabled: !!loading }, { children: [_jsx("div", __assign({ style: {
|
|
119
|
-
visibility: loading === 'BACK' ? 'hidden' : 'visible',
|
|
120
|
-
} }, { children: "Volver" })), loading === 'BACK' && (_jsx("div", __assign({ className: styles.loaderContainer }, { children: _jsx(Loader, { color: formStyle.primaryContrastColor, position: "unset" }) })))] }))), (next.length > 0 || (!postview && editable)) && (_jsxs("button", __assign({ "data-testid": "form__submit", className: styles.formBtn, onClick: handleNext, style: {
|
|
121
|
-
background: formStyle.primaryColor,
|
|
122
|
-
color: formStyle.primaryContrastColor,
|
|
123
|
-
}, disabled: !!loading }, { children: [_jsx("div", __assign({ style: {
|
|
124
|
-
visibility: loading === 'NEXT' ? 'hidden' : 'visible',
|
|
125
|
-
} }, { children: next.length > 0
|
|
126
|
-
? 'Siguiente'
|
|
127
|
-
: sendLabel !== null && sendLabel !== void 0 ? sendLabel : 'Enviar' })), loading === 'NEXT' && (_jsx("div", __assign({ className: styles.loaderContainer }, { children: _jsx(Loader, { color: formStyle.primaryContrastColor, position: "unset" }) })))] })))] }))] })));
|
|
115
|
+
return (_jsxs("div", __assign({ className: styles.container, style: { color: formStyle.textColor } }, { children: [loading && _jsx("div", { className: styles.curtain }), _jsx(Section, { idSection: idCurrent }, idCurrent), next.length === 0 && _jsx(Terms, {}), _jsxs("div", __assign({ className: styles.btnsContainer }, { children: [previous.length > 0 && (_jsx(CustomBtn, { label: "Volver", "data-testid": "form__back", onClick: handlePrevious, backgroundColor: formStyle.primaryColor, color: formStyle.primaryContrastColor, disabled: !!loading, loading: loading === 'BACK' })), (next.length > 0 || (!postview && editable)) && (_jsx(CustomBtn, { label: next.length > 0
|
|
116
|
+
? 'Siguiente'
|
|
117
|
+
: sendLabel !== null && sendLabel !== void 0 ? sendLabel : 'Enviar', "data-testid": "form__submit", onClick: handleNext, backgroundColor: formStyle.primaryColor, color: formStyle.primaryContrastColor, disabled: !!loading, loading: loading === 'NEXT' }))] }))] })));
|
|
128
118
|
}
|
|
129
119
|
export default StepperForm;
|
|
@@ -24,30 +24,3 @@
|
|
|
24
24
|
justify-content: center;
|
|
25
25
|
gap: 10px 20px;
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
.formBtn {
|
|
29
|
-
max-width: 100%;
|
|
30
|
-
border-radius: 20px;
|
|
31
|
-
padding: 15px 20px;
|
|
32
|
-
font-size: 1.4rem;
|
|
33
|
-
cursor: pointer;
|
|
34
|
-
-moz-user-select: none;
|
|
35
|
-
-khtml-user-select: none;
|
|
36
|
-
-webkit-user-select: none;
|
|
37
|
-
-ms-user-select: none;
|
|
38
|
-
user-select: none;
|
|
39
|
-
border: none;
|
|
40
|
-
position: relative;
|
|
41
|
-
}
|
|
42
|
-
.formBtn[disabled] {
|
|
43
|
-
pointer-events: none;
|
|
44
|
-
opacity: 0.5;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.loaderContainer {
|
|
48
|
-
top: 0px;
|
|
49
|
-
bottom: 0px;
|
|
50
|
-
right: 0px;
|
|
51
|
-
left: 0px;
|
|
52
|
-
position: absolute;
|
|
53
|
-
}
|
|
@@ -8,9 +8,9 @@ export declare const calcStepWidth: (stepSize: 1 | 2 | 3 | 4, size: FormSize) =>
|
|
|
8
8
|
export declare const calcDefaultValue: (step: FormStep | CBRFormStep) => any;
|
|
9
9
|
export declare const iterateNestedSteps: (idStep: string, steps: Record<string, FormStep>, iteration: (step: FormStep) => void) => void;
|
|
10
10
|
/**
|
|
11
|
-
* Utility function to
|
|
11
|
+
* Utility function to calc the substeps of a step
|
|
12
12
|
* @param step step to calc the substeps
|
|
13
13
|
* @param idModifier optional modifier for the ids of the substeps and all other properties
|
|
14
|
-
* @returns list of the ids of the
|
|
14
|
+
* @returns list of the ids of the substeps of the step, if modifier returns modified steps
|
|
15
15
|
*/
|
|
16
|
-
export declare const calcSubSteps: (
|
|
16
|
+
export declare const calcSubSteps: (idStep: string, allSteps: Record<string, FormStep | CBRFormStep | AYFFormStep>, idModifier?: ((idSubStep: string) => string) | undefined) => string[];
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
2
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3
|
+
if (ar || !(i in from)) {
|
|
4
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
+
ar[i] = from[i];
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
+
};
|
|
1
10
|
import { ApiSelectorOptionTypes, ClassifierOptionTypes, EntityValueDataTypes, EntityValueOptionTypes, OptionTypes, StepTypes, } from '../constants/FormStepTypes';
|
|
2
11
|
import CBRFormStepTypes from '../constants/CBRFormStepTypes';
|
|
3
12
|
import AYFFormStepTypes from '../constants/AYFFormStepTypes';
|
|
@@ -146,27 +155,30 @@ export var iterateNestedSteps = function (idStep, steps, iteration) {
|
|
|
146
155
|
}
|
|
147
156
|
}
|
|
148
157
|
else {
|
|
149
|
-
for (var _b = 0, _c = calcSubSteps(step); _b < _c.length; _b++) {
|
|
158
|
+
for (var _b = 0, _c = calcSubSteps(step.id, steps); _b < _c.length; _b++) {
|
|
150
159
|
var idSubStep = _c[_b];
|
|
151
160
|
iterateNestedSteps(idSubStep, steps, iteration);
|
|
152
161
|
}
|
|
153
162
|
}
|
|
154
163
|
};
|
|
155
164
|
/**
|
|
156
|
-
* Utility function to
|
|
165
|
+
* Utility function to calc the substeps of a step
|
|
157
166
|
* @param step step to calc the substeps
|
|
158
167
|
* @param idModifier optional modifier for the ids of the substeps and all other properties
|
|
159
|
-
* @returns list of the ids of the
|
|
168
|
+
* @returns list of the ids of the substeps of the step, if modifier returns modified steps
|
|
160
169
|
*/
|
|
161
|
-
export var calcSubSteps = function (
|
|
170
|
+
export var calcSubSteps = function (idStep, allSteps, idModifier) {
|
|
162
171
|
var _a;
|
|
172
|
+
var step = allSteps[idStep];
|
|
163
173
|
var subSteps = [];
|
|
174
|
+
if (!step)
|
|
175
|
+
return [];
|
|
164
176
|
var handleSteps = function (steps) {
|
|
165
177
|
for (var i = 0; i < steps.length; i++) {
|
|
166
|
-
var
|
|
178
|
+
var idSubStep = steps[i];
|
|
167
179
|
if (idModifier)
|
|
168
|
-
steps[i] = idModifier(
|
|
169
|
-
subSteps.push(
|
|
180
|
+
steps[i] = idModifier(steps[i]);
|
|
181
|
+
subSteps.push.apply(subSteps, __spreadArray([idSubStep], calcSubSteps(idSubStep, allSteps, idModifier), false));
|
|
170
182
|
}
|
|
171
183
|
};
|
|
172
184
|
switch (step.type) {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface CustomBtnProps {
|
|
3
|
+
label: string;
|
|
4
|
+
'data-testid'?: string;
|
|
5
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
6
|
+
backgroundColor?: string;
|
|
7
|
+
color?: string;
|
|
8
|
+
width?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
loading?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare function CustomBtn({ label, onClick, backgroundColor, color, loading, disabled, width, ...others }: CustomBtnProps): JSX.Element;
|
|
13
|
+
export default CustomBtn;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
49
|
+
var t = {};
|
|
50
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
51
|
+
t[p] = s[p];
|
|
52
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
53
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
54
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
55
|
+
t[p[i]] = s[p[i]];
|
|
56
|
+
}
|
|
57
|
+
return t;
|
|
58
|
+
};
|
|
59
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
60
|
+
import { useEffect, useState } from 'react';
|
|
61
|
+
import styles from './CustomBtn.module.css';
|
|
62
|
+
import Loader from '../Loader/Loader';
|
|
63
|
+
function CustomBtn(_a) {
|
|
64
|
+
var _this = this;
|
|
65
|
+
var label = _a.label, onClick = _a.onClick, backgroundColor = _a.backgroundColor, color = _a.color, _b = _a.loading, loading = _b === void 0 ? false : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, _d = _a.width, width = _d === void 0 ? 'fit-content' : _d, others = __rest(_a, ["label", "onClick", "backgroundColor", "color", "loading", "disabled", "width"]);
|
|
66
|
+
var _e = useState(undefined), coords = _e[0], setCoords = _e[1];
|
|
67
|
+
useEffect(function () {
|
|
68
|
+
if (coords)
|
|
69
|
+
setCoords(undefined);
|
|
70
|
+
}, [label]);
|
|
71
|
+
return (_jsxs("button", __assign({ className: styles.customBtn, style: {
|
|
72
|
+
width: width,
|
|
73
|
+
background: backgroundColor,
|
|
74
|
+
color: color,
|
|
75
|
+
}, "data-testid": others['data-testid'], disabled: disabled || loading, onClick: function (e) { return __awaiter(_this, void 0, void 0, function () {
|
|
76
|
+
var rect;
|
|
77
|
+
return __generator(this, function (_a) {
|
|
78
|
+
switch (_a.label) {
|
|
79
|
+
case 0:
|
|
80
|
+
rect = e.target.getBoundingClientRect();
|
|
81
|
+
setCoords({
|
|
82
|
+
x: e.clientX - rect.left,
|
|
83
|
+
y: e.clientY - rect.top,
|
|
84
|
+
});
|
|
85
|
+
setTimeout(function () { return setCoords(undefined); }, 600);
|
|
86
|
+
return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 200); })];
|
|
87
|
+
case 1:
|
|
88
|
+
_a.sent();
|
|
89
|
+
onClick && onClick(e);
|
|
90
|
+
return [2 /*return*/];
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}); } }, { children: [coords ? (_jsx("span", { className: styles.ripple, style: {
|
|
94
|
+
backgroundColor: color,
|
|
95
|
+
left: coords.x,
|
|
96
|
+
top: coords.y,
|
|
97
|
+
} })) : (_jsx(_Fragment, {})), _jsx("div", __assign({ style: {
|
|
98
|
+
visibility: loading ? 'hidden' : 'visible',
|
|
99
|
+
margin: '0px 10px',
|
|
100
|
+
} }, { children: label })), loading && (_jsx("div", __assign({ className: styles.loaderContainer }, { children: _jsx(Loader, { color: color, position: "unset" }) })))] })));
|
|
101
|
+
}
|
|
102
|
+
export default CustomBtn;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
.customBtn {
|
|
2
|
+
max-width: 100%;
|
|
3
|
+
border-radius: 20px;
|
|
4
|
+
padding: 15px 30px;
|
|
5
|
+
font-size: 1.4rem;
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
-moz-user-select: none;
|
|
8
|
+
-khtml-user-select: none;
|
|
9
|
+
-webkit-user-select: none;
|
|
10
|
+
-ms-user-select: none;
|
|
11
|
+
user-select: none;
|
|
12
|
+
border: none;
|
|
13
|
+
position: relative;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.customBtn[disabled] {
|
|
21
|
+
pointer-events: none;
|
|
22
|
+
opacity: 0.5;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.ripple {
|
|
26
|
+
width: 50px;
|
|
27
|
+
height: 50px;
|
|
28
|
+
position: absolute;
|
|
29
|
+
display: block;
|
|
30
|
+
content: '';
|
|
31
|
+
border-radius: 9999px;
|
|
32
|
+
opacity: 1;
|
|
33
|
+
animation: 1s ease 1 forwards ripple-effect;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@keyframes ripple-effect {
|
|
37
|
+
0% {
|
|
38
|
+
transform: scale(1);
|
|
39
|
+
opacity: 1;
|
|
40
|
+
}
|
|
41
|
+
50% {
|
|
42
|
+
transform: scale(10);
|
|
43
|
+
opacity: 0.375;
|
|
44
|
+
}
|
|
45
|
+
100% {
|
|
46
|
+
transform: scale(35);
|
|
47
|
+
opacity: 0;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.loaderContainer {
|
|
52
|
+
top: 0px;
|
|
53
|
+
bottom: 0px;
|
|
54
|
+
right: 0px;
|
|
55
|
+
left: 0px;
|
|
56
|
+
position: absolute;
|
|
57
|
+
}
|