@nice2dev/ui-money 1.0.12 → 1.0.15
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/index.mjs +16 -7
- package/dist/style.css +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -492,14 +492,18 @@ class ot extends ge {
|
|
|
492
492
|
}
|
|
493
493
|
async getRate(n, c) {
|
|
494
494
|
const r = n.toUpperCase(), a = c.toUpperCase();
|
|
495
|
-
if (r === a)
|
|
495
|
+
if (r === a)
|
|
496
|
+
return { base: r, quote: a, rate: 1, asOf: (/* @__PURE__ */ new Date()).toISOString() };
|
|
496
497
|
const o = this.getCached(r, a);
|
|
497
|
-
if (o)
|
|
498
|
+
if (o)
|
|
499
|
+
return o;
|
|
498
500
|
const i = async (b) => {
|
|
499
501
|
var y;
|
|
500
|
-
if (b === "PLN")
|
|
502
|
+
if (b === "PLN")
|
|
503
|
+
return { rate: 1, date: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10) };
|
|
501
504
|
const p = `https://api.nbp.pl/api/exchangerates/rates/${this.table}/${b}/?format=json`, d = await this.fetchImpl(p);
|
|
502
|
-
if (!d.ok)
|
|
505
|
+
if (!d.ok)
|
|
506
|
+
return null;
|
|
503
507
|
const h = (y = (await d.json()).rates) == null ? void 0 : y[0];
|
|
504
508
|
return h ? { rate: h.mid ?? h.ask ?? 0, date: h.effectiveDate } : null;
|
|
505
509
|
}, l = await i(r), u = await i(a);
|
|
@@ -1057,9 +1061,14 @@ const Fe = de(function({
|
|
|
1057
1061
|
return { group: ",", decimal: "." };
|
|
1058
1062
|
}
|
|
1059
1063
|
}, [m]), Me = M ?? !!_e.group, ze = k(() => {
|
|
1060
|
-
if (!Me || be === !1)
|
|
1061
|
-
|
|
1062
|
-
|
|
1064
|
+
if (!Me || be === !1)
|
|
1065
|
+
return we;
|
|
1066
|
+
const $ = _e.decimal, L = _e.group, Q = we.replace(
|
|
1067
|
+
new RegExp(`[${L.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")}]`, "g"),
|
|
1068
|
+
""
|
|
1069
|
+
), [ae, ie] = Q.split($);
|
|
1070
|
+
if (!ae)
|
|
1071
|
+
return Q;
|
|
1063
1072
|
const ue = ae.replace(/\B(?=(\d{3})+(?!\d))/g, L);
|
|
1064
1073
|
return ie != null ? `${ue}${$}${ie}` : ue;
|
|
1065
1074
|
}, [we, be, Me, _e]), Pe = k(() => e ? te(e, { locale: m }) : "", [e, m]), pe = typeof f == "string" ? f : void 0, Ge = `nice-money-input nice-money-input--${h} nice-money-input--label-${O} nice-money-input--error-${Y}` + (pe ? " nice-money-input--error" : "") + (ee ? " nice-money-input--disabled" : "") + (g ? " nice-money-input--loading" : "") + (z ? ` ${z}` : ""), Ye = ($) => {
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.nice-money{font-variant-numeric:tabular-nums}.nice-money--negative .nice-money__value{color:var(--nice-
|
|
1
|
+
.nice-money{font-variant-numeric:tabular-nums}.nice-money--negative .nice-money__value{color:var(--nice-danger, #dc2626)}.nice-money__converted{margin-left:.25em;opacity:.7;font-size:.875em}.nice-currency-selector{display:inline-flex;align-items:center;gap:.25rem}.nice-currency-selector__select{font:inherit;padding:.375rem .5rem;border:1px solid var(--nice-border, #d1d5db);border-radius:var(--nice-radius-sm, 4px);background:var(--nice-bg, #fff);color:inherit}.nice-currency-selector__search{font:inherit;padding:.25rem .5rem;border:1px solid var(--nice-border, #d1d5db);border-radius:var(--nice-radius-sm, 4px);width:8rem}.nice-currency-selector--compact .nice-currency-selector__search{display:none}.nice-money-input{display:flex;flex-direction:column;gap:.25rem}.nice-money-input__label{font-size:.875rem;font-weight:500}.nice-money-input__required{color:var(--nice-danger, #dc2626);margin-left:.125rem}.nice-money-input__row{display:flex;align-items:stretch;gap:.25rem;border:1px solid var(--nice-border, #d1d5db);border-radius:var(--nice-radius-md, 6px);background:var(--nice-bg, #fff);padding:.125rem}.nice-money-input--error .nice-money-input__row{border-color:var(--nice-danger, #dc2626)}.nice-money-input--disabled{opacity:.6;pointer-events:none}.nice-money-input__currency .nice-currency-selector__select{border:none;background:transparent;padding:.5rem}.nice-money-input__symbol{display:inline-flex;align-items:center;padding:0 .5rem;color:var(--nice-text-muted, #6b7280);font-weight:600}.nice-money-input__amount{flex:1;border:none;background:transparent;font:inherit;padding:.5rem;outline:none;font-variant-numeric:tabular-nums;text-align:right;min-width:0}.nice-money-input__step{border:none;background:var(--nice-bg-secondary, #f3f4f6);border-radius:var(--nice-radius-sm, 4px);width:2rem;font-size:1.125rem;cursor:pointer}.nice-money-input__step:disabled{opacity:.4;cursor:not-allowed}.nice-money-input--sm .nice-money-input__amount{padding:.25rem;font-size:.875rem}.nice-money-input--lg .nice-money-input__amount{padding:.75rem;font-size:1.125rem}.nice-money-input__preview{font-size:.8125rem;color:var(--nice-text-muted, #6b7280)}.nice-money-input__error{font-size:.8125rem;color:var(--nice-danger, #dc2626)}.nice-money-input__helper{font-size:.8125rem;color:var(--nice-text-muted, #6b7280)}.nice-credit-card{display:flex;flex-direction:column;gap:.5rem}.nice-credit-card__row{display:flex;flex-direction:column;gap:.25rem}.nice-credit-card__row--split{flex-direction:row;gap:.5rem}.nice-credit-card__row--split .nice-credit-card__field{flex:1}.nice-credit-card__field{display:flex;flex-direction:column;gap:.125rem}.nice-credit-card__label{font-size:.8125rem;font-weight:500;color:var(--nice-text-muted, #4b5563)}.nice-credit-card__input-wrapper{position:relative;display:flex;align-items:center}.nice-credit-card__input{font:inherit;font-variant-numeric:tabular-nums;padding:.5rem .75rem;border:1px solid var(--nice-border, #d1d5db);border-radius:var(--nice-radius-md, 6px);background:var(--nice-bg, #fff);width:100%;outline:none}.nice-credit-card__input:focus{border-color:var(--nice-primary, #2563eb);box-shadow:0 0 0 2px var(--nice-primary-bg, #bfdbfe)}.nice-credit-card__input[aria-invalid=true]{border-color:var(--nice-danger, #dc2626)}.nice-credit-card__brand{position:absolute;right:.5rem;top:50%;transform:translateY(-50%);font-size:.75rem;font-weight:700;letter-spacing:.05em;padding:.125rem .375rem;border-radius:var(--nice-radius-sm, 4px);background:var(--nice-bg-secondary, #f3f4f6);color:var(--nice-text-muted, #4b5563);pointer-events:none}.nice-credit-card__brand--visa{background:#1a1f71;color:var(--nice-bg, #FFF)}.nice-credit-card__brand--mastercard{background:#eb001b;color:var(--nice-bg, #FFF)}.nice-credit-card__brand--amex{background:#2e77bb;color:var(--nice-bg, #FFF)}.nice-credit-card__brand--discover{background:#ff6000;color:var(--nice-bg, #FFF)}.nice-credit-card__error{font-size:.75rem;color:var(--nice-danger, #dc2626)}.nice-payment-form{display:flex;flex-direction:column;gap:.75rem;max-width:28rem}.nice-payment-form__total{display:flex;justify-content:space-between;align-items:baseline;padding:.75rem 1rem;background:var(--nice-bg-secondary, #f9fafb);border-radius:var(--nice-radius-md, 6px);font-size:1.125rem;font-weight:600}.nice-payment-form__total-label{color:var(--nice-text-muted, #6b7280);font-size:.875rem;font-weight:500}.nice-payment-form__description{font-size:.875rem;color:var(--nice-text-muted, #4b5563);margin:0}.nice-payment-form__warning,.nice-payment-form__error{padding:.5rem .75rem;border-radius:var(--nice-radius-md, 6px);font-size:.875rem}.nice-payment-form__warning{background:var(--nice-warning-bg, #fef3c7);color:var(--nice-warning-text, #92400e)}.nice-payment-form__error{background:var(--nice-danger-bg, #fee2e2);color:var(--nice-danger-text, #991b1b)}.nice-payment-form__submit{font:inherit;font-weight:600;padding:.75rem 1rem;border:none;border-radius:var(--nice-radius-md, 6px);background:var(--nice-primary, #2563eb);color:var(--nice-text-inverse, #fff);cursor:pointer}.nice-payment-form__submit:disabled{opacity:.5;cursor:not-allowed}.nice-payment-form__processor{text-align:center;font-size:.75rem;color:var(--nice-text-muted, #6b7280);margin:0}.nice-price-tag{display:inline-flex;align-items:baseline;gap:.5rem;font-variant-numeric:tabular-nums}.nice-price-tag__amount{font-weight:700}.nice-price-tag--sm{font-size:.875rem}.nice-price-tag--md{font-size:1rem}.nice-price-tag--lg{font-size:1.25rem}.nice-price-tag--xl{font-size:1.75rem}.nice-price-tag__period{font-size:.75em;color:var(--nice-text-muted, #6b7280);margin-left:.125em}.nice-price-tag__original{color:var(--nice-text-muted, #9ca3af);font-size:.875em}.nice-price-tag__discount{background:var(--nice-success, #16a34a);color:var(--nice-text-inverse, #fff);border-radius:var(--nice-radius-sm, 4px);padding:.125em .375em;font-size:.75em;font-weight:700}.nice-currency-converter{display:flex;flex-direction:column;gap:.5rem}.nice-currency-converter__output{display:flex;align-items:center;gap:.5rem;padding:.5rem;border:1px solid var(--nice-border, #d1d5db);border-radius:var(--nice-radius-md, 6px)}.nice-currency-converter__amount{font-weight:600;font-variant-numeric:tabular-nums;margin-left:auto}.nice-currency-converter__rate{font-size:.8125rem;color:var(--nice-text-muted, #6b7280);margin:0}.nice-currency-converter__inverse{opacity:.7}.nice-currency-converter__error{color:var(--nice-danger, #dc2626);font-size:.8125rem}.nice-tax-breakdown{width:100%;border-collapse:collapse;font-variant-numeric:tabular-nums}.nice-tax-breakdown th,.nice-tax-breakdown td{padding:var(--nice-space-2, 8px) var(--nice-space-2-5, 10px);border-bottom:1px solid var(--nice-border, #e5e7eb);text-align:left}.nice-tax-breakdown--compact th,.nice-tax-breakdown--compact td{padding:var(--nice-space-1, 4px) var(--nice-space-2, 8px);font-size:.875rem}.nice-tax-breakdown__num{text-align:right;font-variant-numeric:tabular-nums}.nice-tax-breakdown__rate{text-align:right}.nice-tax-breakdown__totals{font-weight:600;background:var(--nice-surface-alt, #f9fafb)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nice2dev/ui-money",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "Nice2Dev Money & Payments — Money / MoneyInput / CurrencySelector / CreditCardInput / PaymentForm + ISO 4217 catalog, Luhn validation, exchange-rate & payment-processor adapters",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"prepublishOnly": "npm run build"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@nice2dev/ui-core": "^1.0.
|
|
36
|
+
"@nice2dev/ui-core": "^1.0.15",
|
|
37
37
|
"react": ">=17.0.0",
|
|
38
38
|
"react-dom": ">=17.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@nice2dev/ui-core": "^1.0.
|
|
41
|
+
"@nice2dev/ui-core": "^1.0.15",
|
|
42
42
|
"@testing-library/jest-dom": "^6.9.1",
|
|
43
43
|
"@testing-library/react": "^14.0.0",
|
|
44
44
|
"@types/react": "^18.2.0",
|