@grupalia/rn-ui-kit 0.96.0 → 0.98.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/BaseConfirmationModal.js +15 -18
- package/lib/commonjs/components/BaseConfirmationModal.js.map +1 -1
- package/lib/commonjs/utils/filters.js +39 -21
- package/lib/commonjs/utils/filters.js.map +1 -1
- package/lib/module/components/BaseConfirmationModal.js +15 -18
- package/lib/module/components/BaseConfirmationModal.js.map +1 -1
- package/lib/module/utils/filters.js +39 -21
- package/lib/module/utils/filters.js.map +1 -1
- package/lib/typescript/commonjs/components/BaseConfirmationModal.d.ts +8 -4
- package/lib/typescript/commonjs/components/BaseConfirmationModal.d.ts.map +1 -1
- package/lib/typescript/commonjs/utils/filters.d.ts +10 -1
- package/lib/typescript/commonjs/utils/filters.d.ts.map +1 -1
- package/lib/typescript/module/components/BaseConfirmationModal.d.ts +8 -4
- package/lib/typescript/module/components/BaseConfirmationModal.d.ts.map +1 -1
- package/lib/typescript/module/utils/filters.d.ts +10 -1
- package/lib/typescript/module/utils/filters.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -5,13 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _nativewind = require("nativewind");
|
|
8
|
-
var _hocComponents = require("../hoc-components");
|
|
9
8
|
var _BaseButton = _interopRequireDefault(require("./BaseButton"));
|
|
9
|
+
var _BaseModal = _interopRequireDefault(require("./BaseModal"));
|
|
10
10
|
var _BaseText = _interopRequireDefault(require("./BaseText"));
|
|
11
|
+
var _hocComponents = require("../hoc-components");
|
|
11
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
14
|
function BaseConfirmationModal({
|
|
14
|
-
visible,
|
|
15
15
|
title,
|
|
16
16
|
body,
|
|
17
17
|
confirmText = 'Aceptar',
|
|
@@ -22,23 +22,20 @@ function BaseConfirmationModal({
|
|
|
22
22
|
loading = false,
|
|
23
23
|
...props
|
|
24
24
|
}) {
|
|
25
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
26
|
-
animationType: "fade",
|
|
27
|
-
transparent: true,
|
|
28
|
-
visible: visible,
|
|
25
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BaseModal.default, {
|
|
29
26
|
onRequestClose: () => onCancel(),
|
|
30
27
|
...props,
|
|
31
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
32
|
-
className: "
|
|
33
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
34
|
-
className: "
|
|
35
|
-
children:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
28
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_hocComponents.View, {
|
|
29
|
+
className: "space-y-4",
|
|
30
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_BaseText.default, {
|
|
31
|
+
className: "mb-4 text-lg font-semibold",
|
|
32
|
+
children: title
|
|
33
|
+
}), typeof body === 'string' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_BaseText.default, {
|
|
34
|
+
className: "text-base",
|
|
35
|
+
children: body
|
|
36
|
+
}) : body, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_hocComponents.View, {
|
|
37
|
+
className: "space-y-2",
|
|
38
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_BaseButton.default, {
|
|
42
39
|
text: confirmText,
|
|
43
40
|
onPress: onConfirm,
|
|
44
41
|
loading: loading,
|
|
@@ -48,7 +45,7 @@ function BaseConfirmationModal({
|
|
|
48
45
|
text: cancelText,
|
|
49
46
|
onPress: onCancel
|
|
50
47
|
})]
|
|
51
|
-
})
|
|
48
|
+
})]
|
|
52
49
|
})
|
|
53
50
|
});
|
|
54
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_nativewind","require","
|
|
1
|
+
{"version":3,"names":["_nativewind","require","_BaseButton","_interopRequireDefault","_BaseModal","_BaseText","_hocComponents","_jsxRuntime","e","__esModule","default","BaseConfirmationModal","title","body","confirmText","cancelText","onConfirm","onCancel","countdownSecs","loading","props","jsx","onRequestClose","children","jsxs","View","className","text","onPress","variant","_default","exports","styled"],"sourceRoot":"../../../src","sources":["components/BaseConfirmationModal.tsx"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,UAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,SAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AAAyC,IAAAM,WAAA,GAAAN,OAAA;AAAA,SAAAE,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAazC,SAASG,qBAAqBA,CAAC;EAC7BC,KAAK;EACLC,IAAI;EACJC,WAAW,GAAG,SAAS;EACvBC,UAAU,GAAG,UAAU;EACvBC,SAAS;EACTC,QAAQ;EACRC,aAAa,GAAG,CAAC;EACjBC,OAAO,GAAG,KAAK;EACf,GAAGC;AACE,CAAC,EAAE;EACR,oBACE,IAAAb,WAAA,CAAAc,GAAA,EAACjB,UAAA,CAAAM,OAAS;IACRY,cAAc,EAAEA,CAAA,KAAML,QAAQ,CAAC,CAAE;IAAA,GAC7BG,KAAK;IAAAG,QAAA,eAET,IAAAhB,WAAA,CAAAiB,IAAA,EAAClB,cAAA,CAAAmB,IAAI;MAACC,SAAS,EAAC,WAAW;MAAAH,QAAA,gBACzB,IAAAhB,WAAA,CAAAc,GAAA,EAAChB,SAAA,CAAAK,OAAQ;QAACgB,SAAS,EAAC,4BAA4B;QAAAH,QAAA,EAC7CX;MAAK,CACE,CAAC,EACV,OAAOC,IAAI,KAAK,QAAQ,gBACvB,IAAAN,WAAA,CAAAc,GAAA,EAAChB,SAAA,CAAAK,OAAQ;QAACgB,SAAS,EAAC,WAAW;QAAAH,QAAA,EAC5BV;MAAI,CACG,CAAC,GACTA,IAAI,eACR,IAAAN,WAAA,CAAAiB,IAAA,EAAClB,cAAA,CAAAmB,IAAI;QAACC,SAAS,EAAC,WAAW;QAAAH,QAAA,gBAEzB,IAAAhB,WAAA,CAAAc,GAAA,EAACnB,WAAA,CAAAQ,OAAU;UACTiB,IAAI,EAAEb,WAAY;UAClBc,OAAO,EAAEZ,SAAU;UACnBG,OAAO,EAAEA,OAAQ;UACjBD,aAAa,EAAEA;QAAc,CAC9B,CAAC,eACF,IAAAX,WAAA,CAAAc,GAAA,EAACnB,WAAA,CAAAQ,OAAU;UACTmB,OAAO,EAAC,WAAW;UACnBF,IAAI,EAAEZ,UAAW;UACjBa,OAAO,EAAEX;QAAS,CACnB,CAAC;MAAA,CACE,CAAC;IAAA,CACH;EAAC,CACE,CAAC;AAEhB;AAAC,IAAAa,QAAA,GAAAC,OAAA,CAAArB,OAAA,GAEc,IAAAsB,kBAAM,EAACrB,qBAAqB,CAAC","ignoreList":[]}
|
|
@@ -6,34 +6,52 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.toCurrency = toCurrency;
|
|
7
7
|
exports.toLocalPhoneNumber = toLocalPhoneNumber;
|
|
8
8
|
exports.toSpanishOrdinal = toSpanishOrdinal;
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
function toCompactCurrency(value, {
|
|
10
|
+
symbol
|
|
11
|
+
}) {
|
|
12
|
+
const abs = Math.abs(value);
|
|
13
|
+
const sign = value < 0 ? '-' : '';
|
|
14
|
+
if (abs >= 1_000_000) {
|
|
15
|
+
const formatted = (abs / 1_000_000).toFixed(1).replace(/\.0$/, '');
|
|
16
|
+
return `${sign}${symbol}${formatted}M`;
|
|
12
17
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
if (abs >= 1_000) {
|
|
19
|
+
const rounded = parseFloat((abs / 1_000).toFixed(1));
|
|
20
|
+
if (rounded >= 1_000) {
|
|
21
|
+
return `${sign}${symbol}1M`;
|
|
22
|
+
}
|
|
23
|
+
const formatted = rounded.toFixed(1).replace(/\.0$/, '');
|
|
24
|
+
return `${sign}${symbol}${formatted}k`;
|
|
25
|
+
}
|
|
26
|
+
return `${sign}${symbol}${abs}`;
|
|
27
|
+
}
|
|
28
|
+
function toNormalCurrency(value, {
|
|
29
|
+
symbol,
|
|
30
|
+
decimalSeparator,
|
|
31
|
+
thousandSeparator,
|
|
32
|
+
precision
|
|
33
|
+
}) {
|
|
29
34
|
const numericValue = Number(value).toFixed(precision);
|
|
30
|
-
|
|
31
|
-
// eslint-disable-next-line prefer-const
|
|
32
35
|
let [integerPart, decimalPart] = numericValue.split('.');
|
|
33
36
|
integerPart = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, thousandSeparator);
|
|
34
37
|
const formattedValue = decimalPart ? `${integerPart}${decimalSeparator}${decimalPart}` : integerPart;
|
|
35
38
|
return `${symbol}${formattedValue}`;
|
|
36
39
|
}
|
|
40
|
+
const DEFAULT_CURRENCY_OPTIONS = {
|
|
41
|
+
symbol: '$',
|
|
42
|
+
decimalSeparator: '.',
|
|
43
|
+
thousandSeparator: ',',
|
|
44
|
+
precision: 0
|
|
45
|
+
};
|
|
46
|
+
function toCurrency(value, options = {}) {
|
|
47
|
+
const settings = {
|
|
48
|
+
...DEFAULT_CURRENCY_OPTIONS,
|
|
49
|
+
...options
|
|
50
|
+
};
|
|
51
|
+
if (!value && value !== 0) return `${settings.symbol}-`;
|
|
52
|
+
if (options.compact) return toCompactCurrency(value, settings);
|
|
53
|
+
return toNormalCurrency(value, settings);
|
|
54
|
+
}
|
|
37
55
|
function toLocalPhoneNumber(phoneNumber) {
|
|
38
56
|
return phoneNumber.replace(/^\+521(\d{3})(\d{3})(\d{4})$/, '$1 $2 $3');
|
|
39
57
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["toCompactCurrency","value","symbol","abs","Math","sign","formatted","toFixed","replace","rounded","parseFloat","toNormalCurrency","decimalSeparator","thousandSeparator","precision","numericValue","Number","integerPart","decimalPart","split","formattedValue","DEFAULT_CURRENCY_OPTIONS","toCurrency","options","settings","compact","toLocalPhoneNumber","phoneNumber","toSpanishOrdinal","ordinals","ordinal","charAt","toUpperCase","slice"],"sourceRoot":"../../../src","sources":["utils/filters.ts"],"mappings":";;;;;;;;AAOA,SAASA,iBAAiBA,CAACC,KAAa,EAAE;EAAEC;AAAwB,CAAC,EAAU;EAC7E,MAAMC,GAAG,GAAGC,IAAI,CAACD,GAAG,CAACF,KAAK,CAAC;EAC3B,MAAMI,IAAI,GAAGJ,KAAK,GAAG,CAAC,GAAG,GAAG,GAAG,EAAE;EAEjC,IAAIE,GAAG,IAAI,SAAS,EAAE;IACpB,MAAMG,SAAS,GAAG,CAACH,GAAG,GAAG,SAAS,EAAEI,OAAO,CAAC,CAAC,CAAC,CAACC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;IAClE,OAAO,GAAGH,IAAI,GAAGH,MAAM,GAAGI,SAAS,GAAG;EACxC;EAEA,IAAIH,GAAG,IAAI,KAAK,EAAE;IAChB,MAAMM,OAAO,GAAGC,UAAU,CAAC,CAACP,GAAG,GAAG,KAAK,EAAEI,OAAO,CAAC,CAAC,CAAC,CAAC;IACpD,IAAIE,OAAO,IAAI,KAAK,EAAE;MACpB,OAAO,GAAGJ,IAAI,GAAGH,MAAM,IAAI;IAC7B;IACA,MAAMI,SAAS,GAAGG,OAAO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,CAAC;AAC1C;AAEA,SAASE,kBAAkBA,CAACC,WAAmB,EAAU;EACvD,OAAOA,WAAW,CAACnB,OAAO,CAAC,8BAA8B,EAAE,UAAU,CAAC;AACxE;AAEA,SAASoB,gBAAgBA,CAAC3B,KAAa,EAAU;EAC/C,MAAM4B,QAAgC,GAAG;IACvC,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,QAAQ;IACX,EAAE,EAAE;EACN,CAAC;EAED,MAAMC,OAAO,GAAGD,QAAQ,CAAC5B,KAAK,CAAC,IAAI,GAAGA,KAAK,GAAG;EAC9C,OAAO6B,OAAO,CAACC,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,GAAGF,OAAO,CAACG,KAAK,CAAC,CAAC,CAAC;AAC3D","ignoreList":[]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { styled } from 'nativewind';
|
|
4
|
-
import { View, Modal } from "../hoc-components.js";
|
|
5
4
|
import BaseButton from "./BaseButton.js";
|
|
5
|
+
import BaseModal from "./BaseModal.js";
|
|
6
6
|
import BaseText from "./BaseText.js";
|
|
7
|
+
import { View } from "../hoc-components.js";
|
|
7
8
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
9
|
function BaseConfirmationModal({
|
|
9
|
-
visible,
|
|
10
10
|
title,
|
|
11
11
|
body,
|
|
12
12
|
confirmText = 'Aceptar',
|
|
@@ -17,23 +17,20 @@ function BaseConfirmationModal({
|
|
|
17
17
|
loading = false,
|
|
18
18
|
...props
|
|
19
19
|
}) {
|
|
20
|
-
return /*#__PURE__*/_jsx(
|
|
21
|
-
animationType: "fade",
|
|
22
|
-
transparent: true,
|
|
23
|
-
visible: visible,
|
|
20
|
+
return /*#__PURE__*/_jsx(BaseModal, {
|
|
24
21
|
onRequestClose: () => onCancel(),
|
|
25
22
|
...props,
|
|
26
|
-
children: /*#__PURE__*/
|
|
27
|
-
className: "
|
|
28
|
-
children: /*#__PURE__*/
|
|
29
|
-
className: "
|
|
30
|
-
children:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
23
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
24
|
+
className: "space-y-4",
|
|
25
|
+
children: [/*#__PURE__*/_jsx(BaseText, {
|
|
26
|
+
className: "mb-4 text-lg font-semibold",
|
|
27
|
+
children: title
|
|
28
|
+
}), typeof body === 'string' ? /*#__PURE__*/_jsx(BaseText, {
|
|
29
|
+
className: "text-base",
|
|
30
|
+
children: body
|
|
31
|
+
}) : body, /*#__PURE__*/_jsxs(View, {
|
|
32
|
+
className: "space-y-2",
|
|
33
|
+
children: [/*#__PURE__*/_jsx(BaseButton, {
|
|
37
34
|
text: confirmText,
|
|
38
35
|
onPress: onConfirm,
|
|
39
36
|
loading: loading,
|
|
@@ -43,7 +40,7 @@ function BaseConfirmationModal({
|
|
|
43
40
|
text: cancelText,
|
|
44
41
|
onPress: onCancel
|
|
45
42
|
})]
|
|
46
|
-
})
|
|
43
|
+
})]
|
|
47
44
|
})
|
|
48
45
|
});
|
|
49
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["styled","
|
|
1
|
+
{"version":3,"names":["styled","BaseButton","BaseModal","BaseText","View","jsx","_jsx","jsxs","_jsxs","BaseConfirmationModal","title","body","confirmText","cancelText","onConfirm","onCancel","countdownSecs","loading","props","onRequestClose","children","className","text","onPress","variant"],"sourceRoot":"../../../src","sources":["components/BaseConfirmationModal.tsx"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,YAAY;AAEnC,OAAOC,UAAU,MAAM,iBAAc;AACrC,OAA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|
"use strict";
|
|
2
2
|
|
|
3
|
-
function
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
function toCompactCurrency(value, {
|
|
4
|
+
symbol
|
|
5
|
+
}) {
|
|
6
|
+
const abs = Math.abs(value);
|
|
7
|
+
const sign = value < 0 ? '-' : '';
|
|
8
|
+
if (abs >= 1_000_000) {
|
|
9
|
+
const formatted = (abs / 1_000_000).toFixed(1).replace(/\.0$/, '');
|
|
10
|
+
return `${sign}${symbol}${formatted}M`;
|
|
6
11
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
if (abs >= 1_000) {
|
|
13
|
+
const rounded = parseFloat((abs / 1_000).toFixed(1));
|
|
14
|
+
if (rounded >= 1_000) {
|
|
15
|
+
return `${sign}${symbol}1M`;
|
|
16
|
+
}
|
|
17
|
+
const formatted = rounded.toFixed(1).replace(/\.0$/, '');
|
|
18
|
+
return `${sign}${symbol}${formatted}k`;
|
|
19
|
+
}
|
|
20
|
+
return `${sign}${symbol}${abs}`;
|
|
21
|
+
}
|
|
22
|
+
function toNormalCurrency(value, {
|
|
23
|
+
symbol,
|
|
24
|
+
decimalSeparator,
|
|
25
|
+
thousandSeparator,
|
|
26
|
+
precision
|
|
27
|
+
}) {
|
|
23
28
|
const numericValue = Number(value).toFixed(precision);
|
|
24
|
-
|
|
25
|
-
// eslint-disable-next-line prefer-const
|
|
26
29
|
let [integerPart, decimalPart] = numericValue.split('.');
|
|
27
30
|
integerPart = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, thousandSeparator);
|
|
28
31
|
const formattedValue = decimalPart ? `${integerPart}${decimalSeparator}${decimalPart}` : integerPart;
|
|
29
32
|
return `${symbol}${formattedValue}`;
|
|
30
33
|
}
|
|
34
|
+
const DEFAULT_CURRENCY_OPTIONS = {
|
|
35
|
+
symbol: '$',
|
|
36
|
+
decimalSeparator: '.',
|
|
37
|
+
thousandSeparator: ',',
|
|
38
|
+
precision: 0
|
|
39
|
+
};
|
|
40
|
+
function toCurrency(value, options = {}) {
|
|
41
|
+
const settings = {
|
|
42
|
+
...DEFAULT_CURRENCY_OPTIONS,
|
|
43
|
+
...options
|
|
44
|
+
};
|
|
45
|
+
if (!value && value !== 0) return `${settings.symbol}-`;
|
|
46
|
+
if (options.compact) return toCompactCurrency(value, settings);
|
|
47
|
+
return toNormalCurrency(value, settings);
|
|
48
|
+
}
|
|
31
49
|
function toLocalPhoneNumber(phoneNumber) {
|
|
32
50
|
return phoneNumber.replace(/^\+521(\d{3})(\d{3})(\d{4})$/, '$1 $2 $3');
|
|
33
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["toCompactCurrency","value","symbol","abs","Math","sign","formatted","toFixed","replace","rounded","parseFloat","toNormalCurrency","decimalSeparator","thousandSeparator","precision","numericValue","Number","integerPart","decimalPart","split","formattedValue","DEFAULT_CURRENCY_OPTIONS","toCurrency","options","settings","compact","toLocalPhoneNumber","phoneNumber","toSpanishOrdinal","ordinals","ordinal","charAt","toUpperCase","slice"],"sourceRoot":"../../../src","sources":["utils/filters.ts"],"mappings":";;AAOA,SAASA,iBAAiBA,CAACC,KAAa,EAAE;EAAEC;AAAwB,CAAC,EAAU;EAC7E,MAAMC,GAAG,GAAGC,IAAI,CAACD,GAAG,CAACF,KAAK,CAAC;EAC3B,MAAMI,IAAI,GAAGJ,KAAK,GAAG,CAAC,GAAG,GAAG,GAAG,EAAE;EAEjC,IAAIE,GAAG,IAAI,SAAS,EAAE;IACpB,MAAMG,SAAS,GAAG,CAACH,GAAG,GAAG,SAAS,EAAEI,OAAO,CAAC,CAAC,CAAC,CAACC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;IAClE,OAA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EACtF,MAAMC,QAAQ,GAAG;IAAE,GAAGH,wBAAwB;IAAE,GAAGE;EAAQ,CAAC;EAE5D,IAAI,CAACtB,KAAK,IAAIA,KAAK,KAAK,CAAC,EAAE,OAAO,GAAGuB,QAAQ,CAACtB,MAAM,GAAG;EAEvD,IAAIqB,OAAO,CAACE,OAAO,EAAE,OAAOzB,iBAAiB,CAACC,KAAK,EAAEuB,QAAQ,CAAC;EAC9D,OAAOb,gBAAgB,CAACV,KAAK,EAAEuB,QAAQ,CAAC;AAC1C;AAEA,SAASE,kBAAkBA,CAACC,WAAmB,EAAU;EACvD,OAAOA,WAAW,CAACnB,OAAO,CAAC,8BAA8B,EAAE,UAAU,CAAC;AACxE;AAEA,SAASoB,gBAAgBA,CAAC3B,KAAa,EAAU;EAC/C,MAAM4B,QAAgC,GAAG;IACvC,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,QAAQ;IACX,EAAE,EAAE;EACN,CAAC;EAED,MAAMC,OAAO,GAAGD,QAAQ,CAAC5B,KAAK,CAAC,IAAI,GAAGA,KAAK,GAAG;EAC9C,OAAO6B,OAAO,CAACC,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,GAAGF,OAAO,CAACG,KAAK,CAAC,CAAC,CAAC;AAC3D;AAEA,SAASX,UAAU,EAAEI,kBAAkB,EAAEE,gBAAgB","ignoreList":[]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
interface Props extends
|
|
4
|
-
visible: boolean;
|
|
2
|
+
import { BaseModalProps } from './BaseModal';
|
|
3
|
+
interface Props extends Omit<BaseModalProps, 'children'> {
|
|
5
4
|
title: string;
|
|
6
5
|
body: string | React.ReactNode;
|
|
7
6
|
confirmText?: string;
|
|
@@ -11,6 +10,11 @@ interface Props extends React.ComponentProps<typeof Modal> {
|
|
|
11
10
|
countdownSecs?: number;
|
|
12
11
|
loading?: boolean;
|
|
13
12
|
}
|
|
14
|
-
declare const _default: import("react").ForwardRefExoticComponent<
|
|
13
|
+
declare const _default: import("react").ForwardRefExoticComponent<Props & {
|
|
14
|
+
className?: string | undefined;
|
|
15
|
+
tw?: string | undefined;
|
|
16
|
+
baseClassName?: string | undefined;
|
|
17
|
+
baseTw?: string | undefined;
|
|
18
|
+
} & import("react").RefAttributes<unknown>>;
|
|
15
19
|
export default _default;
|
|
16
20
|
//# sourceMappingURL=BaseConfirmationModal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseConfirmationModal.d.ts","sourceRoot":"","sources":["../../../../src/components/BaseConfirmationModal.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"BaseConfirmationModal.d.ts","sourceRoot":"","sources":["../../../../src/components/BaseConfirmationModal.tsx"],"names":[],"mappings":";AAGA,OAAkB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAIxD,UAAU,KAAM,SAAQ,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;;;;;;;AA8CD,wBAA6C"}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
interface CurrencyOptions {
|
|
2
|
+
symbol: string;
|
|
3
|
+
decimalSeparator: string;
|
|
4
|
+
thousandSeparator: string;
|
|
5
|
+
precision: number;
|
|
6
|
+
}
|
|
7
|
+
interface ToCurrencyOptions extends Partial<CurrencyOptions> {
|
|
8
|
+
compact?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare function toCurrency(value: number | undefined, options?: ToCurrencyOptions): string;
|
|
2
11
|
declare function toLocalPhoneNumber(phoneNumber: string): string;
|
|
3
12
|
declare function toSpanishOrdinal(value: number): string;
|
|
4
13
|
export { toCurrency, toLocalPhoneNumber, toSpanishOrdinal };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../../../src/utils/filters.ts"],"names":[],"mappings":"AAAA,iBAAS,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../../../src/utils/filters.ts"],"names":[],"mappings":"AAAA,UAAU,eAAe;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB;AAwCD,UAAU,iBAAkB,SAAQ,OAAO,CAAC,eAAe,CAAC;IAC1D,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AASD,iBAAS,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,GAAE,iBAAsB,GAAG,MAAM,CAOtF;AAED,iBAAS,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,iBAAS,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAgB/C;AAED,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
interface Props extends
|
|
4
|
-
visible: boolean;
|
|
2
|
+
import { BaseModalProps } from './BaseModal';
|
|
3
|
+
interface Props extends Omit<BaseModalProps, 'children'> {
|
|
5
4
|
title: string;
|
|
6
5
|
body: string | React.ReactNode;
|
|
7
6
|
confirmText?: string;
|
|
@@ -11,6 +10,11 @@ interface Props extends React.ComponentProps<typeof Modal> {
|
|
|
11
10
|
countdownSecs?: number;
|
|
12
11
|
loading?: boolean;
|
|
13
12
|
}
|
|
14
|
-
declare const _default: import("react").ForwardRefExoticComponent<
|
|
13
|
+
declare const _default: import("react").ForwardRefExoticComponent<Props & {
|
|
14
|
+
className?: string | undefined;
|
|
15
|
+
tw?: string | undefined;
|
|
16
|
+
baseClassName?: string | undefined;
|
|
17
|
+
baseTw?: string | undefined;
|
|
18
|
+
} & import("react").RefAttributes<unknown>>;
|
|
15
19
|
export default _default;
|
|
16
20
|
//# sourceMappingURL=BaseConfirmationModal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseConfirmationModal.d.ts","sourceRoot":"","sources":["../../../../src/components/BaseConfirmationModal.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"BaseConfirmationModal.d.ts","sourceRoot":"","sources":["../../../../src/components/BaseConfirmationModal.tsx"],"names":[],"mappings":";AAGA,OAAkB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAIxD,UAAU,KAAM,SAAQ,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;;;;;;;AA8CD,wBAA6C"}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
interface CurrencyOptions {
|
|
2
|
+
symbol: string;
|
|
3
|
+
decimalSeparator: string;
|
|
4
|
+
thousandSeparator: string;
|
|
5
|
+
precision: number;
|
|
6
|
+
}
|
|
7
|
+
interface ToCurrencyOptions extends Partial<CurrencyOptions> {
|
|
8
|
+
compact?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare function toCurrency(value: number | undefined, options?: ToCurrencyOptions): string;
|
|
2
11
|
declare function toLocalPhoneNumber(phoneNumber: string): string;
|
|
3
12
|
declare function toSpanishOrdinal(value: number): string;
|
|
4
13
|
export { toCurrency, toLocalPhoneNumber, toSpanishOrdinal };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../../../src/utils/filters.ts"],"names":[],"mappings":"AAAA,iBAAS,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../../../src/utils/filters.ts"],"names":[],"mappings":"AAAA,UAAU,eAAe;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB;AAwCD,UAAU,iBAAkB,SAAQ,OAAO,CAAC,eAAe,CAAC;IAC1D,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AASD,iBAAS,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,GAAE,iBAAsB,GAAG,MAAM,CAOtF;AAED,iBAAS,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED,iBAAS,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAgB/C;AAED,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,CAAC"}
|