@alphakits/ui 2.6.1 → 2.6.2

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.
@@ -19,7 +19,7 @@ export type AmountInputProps = Omit<InputProps, 'value' | 'onChange' | 'type'> &
19
19
  export declare const AmountInput: React.ForwardRefExoticComponent<Omit<InputProps, "onChange" | "value" | "type"> & {
20
20
  value?: number | undefined | null;
21
21
  type?: AmountValueType | undefined;
22
- suffix?: "CHF" | "EUR" | "RUR" | "RUB" | "USD" | "GBP" | "SEK" | "DKK" | "NOK" | "CZK" | "PLN" | "HUF" | "RSD" | "BGN" | "HRK" | "RON" | "MKD" | "BAM" | "ALL" | "ISK" | "UAH" | "BYN" | "MDL" | "GEL" | "TRY" | "CAD" | "AUD" | "ILS" | undefined;
22
+ suffix?: "CHF" | "EUR" | "RUR" | "RUB" | "USD" | "GBP" | "SEK" | "DKK" | "NOK" | "CZK" | "PLN" | "HUF" | "RSD" | "BGN" | "HRK" | "RON" | "MKD" | "BAM" | "ALL" | "ISK" | "UAH" | "BYN" | "MDL" | "GEL" | "TRY" | "CAD" | "AUD" | "ILS" | "NZD" | "ARS" | "BRL" | "TWD" | "MXN" | "JPY" | "SGD" | undefined;
23
23
  required?: boolean | undefined;
24
24
  integerLength?: number | undefined;
25
25
  minority?: number | undefined;
@@ -27,6 +27,13 @@ declare const CURRENCY_SYMBOLS: {
27
27
  CAD: string;
28
28
  AUD: string;
29
29
  ILS: string;
30
+ NZD: string;
31
+ ARS: string;
32
+ BRL: string;
33
+ TWD: string;
34
+ MXN: string;
35
+ JPY: string;
36
+ SGD: string;
30
37
  };
31
38
  export type CurrencyCodes = keyof typeof CURRENCY_SYMBOLS;
32
39
  export declare const currency: {
@@ -1,4 +1,4 @@
1
- const K = {
1
+ const R = {
2
2
  EUR: "€",
3
3
  RUR: "руб.",
4
4
  RUB: "руб.",
@@ -47,122 +47,18 @@ const K = {
47
47
  // Турецкая лира
48
48
  CAD: "C$",
49
49
  AUD: "$",
50
- ILS: "₪"
51
- // ALL: '\u004c\u0065\u006b',
52
- // AFN: '\u060b',
53
- // ARS: '\u0024',
54
- // AWG: '\u0192',
55
- // AZN: '\u20bc',
56
- // BSD: '\u0024',
57
- // BBD: '\u0024',
58
- // BYN: '\u0042\u0072',
59
- // BZD: '\u0042\u005a\u0024',
60
- // BMD: '\u0024',
61
- // BOB: '\u0024\u0062',
62
- // BAM: '\u004b\u004d',
63
- // BWP: '\u0050',
64
- // BGN: '\u043b\u0432',
65
- // BRL: '\u0052\u0024',
66
- // BND: '\u0024',
67
- // KHR: '\u17db',
68
- // KYD: '\u0024',
69
- // CLP: '\u0024',
70
- // CNY: '\u00a5',
71
- // COP: '\u0024',
72
- // CRC: '\u20a1',
73
- // HRK: '\u006b\u006e',
74
- // CUP: '\u20b1',
75
- // CZK: '\u004b\u010d',
76
- // DKK: '\u006b\u0072',
77
- // DOP: '\u0052\u0044\u0024',
78
- // XCD: '\u0024',
79
- // EGP: '\u00a3',
80
- // SVC: '\u0024',
81
- // EEK: '\u006b\u0072',
82
- // EUR: '\u20ac',
83
- // FKP: '\u00a3',
84
- // FJD: '\u0024',
85
- // FRF: '\u20a3',
86
- // GHC: '\u00a2',
87
- // GIP: '\u00a3',
88
- // GTQ: '\u0051',
89
- // GGP: '\u00a3',
90
- // GYD: '\u0024',
91
- // HNL: '\u004c',
92
- // HKD: '\u0024',
93
- // HUF: '\u0046\u0074',
94
- // ISK: '\u006b\u0072',
95
- // INR: '\u20a8',
96
- // IDR: '\u0052\u0070',
97
- // IRR: '\ufdfc',
98
- // IMP: '\u00a3',
99
- // ILS: '\u20aa',
100
- // JMD: '\u004a\u0024',
101
- // JPY: '\u00a5',
102
- // JEP: '\u00a3',
103
- // KZT: '\u20B8',
104
- // KGS: '\u004B\u0047\u0053',
105
- // LAK: '\u20ad',
106
- // LVL: '\u004c\u0073',
107
- // LBP: '\u00a3',
108
- // LRD: '\u0024',
109
- // LTL: '\u004c\u0074',
110
- // MKD: '\u0434\u0435\u043d',
111
- // MYR: '\u0052\u004d',
112
- // MUR: '\u20a8',
113
- // MXN: '\u0024',
114
- // MNT: '\u20ae',
115
- // MZN: '\u004d\u0054',
116
- // NAD: '\u0024',
117
- // NPR: '\u20a8',
118
- // ANG: '\u0192',
119
- // NZD: '\u0024',
120
- // NIO: '\u0043\u0024',
121
- // NGN: '\u20a6',
122
- // KPW: '\u20a9',
123
- // NOK: '\u006b\u0072',
124
- // OMR: '\ufdfc',
125
- // PKR: '\u20a8',
126
- // PAB: '\u0042\u002f\u002e',
127
- // PYG: '\u0047\u0073',
128
- // PEN: '\u0053\u002f\u002e',
129
- // PHP: '\u20b1',
130
- // PLN: '\u007a\u0142',
131
- // QAR: '\ufdfc',
132
- // RON: '\u006c\u0065\u0069',
133
- // RUR: '\u20bd',
134
- // SHP: '\u00a3',
135
- // SAR: '\ufdfc',
136
- // RSD: '\u0414\u0438\u043d\u002e',
137
- // SCR: '\u20a8',
138
- // SGD: '\u0024',
139
- // SBD: '\u0024',
140
- // SOS: '\u0053',
141
- // ZAR: '\u0052',
142
- // KRW: '\u20a9',
143
- // LKR: '\u20a8',
144
- // SEK: '\u006b\u0072',
145
- // CHF: '\u20a3',
146
- // SRD: '\u0024',
147
- // SYP: '\u00a3',
148
- // TWD: '\u004e\u0054\u0024',
149
- // THB: '\u0e3f',
150
- // TTD: '\u0054\u0054\u0024',
151
- // TRY: '\u20ba',
152
- // TRL: '\u20ba',
153
- // TVD: '\u0024',
154
- // UAH: '\u20b4',
155
- // GBP: '\u00a3',
156
- // USD: '\u0024',
157
- // UYU: '\u0024\u0055',
158
- // UZS: '\u043b\u0432',
159
- // VEF: '\u0042\u0073',
160
- // VND: '\u20ab',
161
- // YER: '\ufdfc',
162
- // ZWD: '\u005a\u0024',
163
- }, R = {
164
- CURRENCY_SYMBOLS: K
50
+ ILS: "₪",
51
+ // Markets we may enable later (countries currently bill in EUR)
52
+ NZD: "$",
53
+ ARS: "$",
54
+ BRL: "R$",
55
+ TWD: "NT$",
56
+ MXN: "$",
57
+ JPY: "¥",
58
+ SGD: "$"
59
+ }, D = {
60
+ CURRENCY_SYMBOLS: R
165
61
  };
166
62
  export {
167
- R as currency
63
+ D as currency
168
64
  };
@@ -11,7 +11,7 @@ function L(t) {
11
11
  const e = new Date(t);
12
12
  return new Date(e.getFullYear(), 11, 31, 23, 59, 59, 999);
13
13
  }
14
- function O(t) {
14
+ function T(t) {
15
15
  const e = new Date(t);
16
16
  return new Date(e.getFullYear(), e.getMonth() + 1, 0, 0, 0, 0, 0);
17
17
  }
@@ -23,12 +23,12 @@ function M(t) {
23
23
  const e = new Date(t);
24
24
  return new Date(e.getFullYear(), e.getMonth(), e.getDate(), 23, 59, 59, 999);
25
25
  }
26
- function p(t) {
26
+ function O(t) {
27
27
  const e = new Date(t.getFullYear(), t.getMonth(), t.getDate()), n = e.getDay(), r = n === 0 ? -6 : 1 - n;
28
28
  return e.setDate(e.getDate() + r), new Date(e.getFullYear(), e.getMonth(), e.getDate(), 0, 0, 0, 0);
29
29
  }
30
30
  function W(t) {
31
- return M(i(p(t), 6));
31
+ return M(i(O(t), 6));
32
32
  }
33
33
  function N(t, e) {
34
34
  const n = e?.weekStartsOn ?? 0, r = new Date(t.getFullYear(), t.getMonth(), t.getDate()), o = (r.getDay() - n + 7) % 7;
@@ -75,7 +75,7 @@ function _(t, e) {
75
75
  function q(t, e) {
76
76
  return i(t, -7 * e);
77
77
  }
78
- function G(t) {
78
+ function C(t) {
79
79
  let e = D(t.start);
80
80
  const n = D(t.end);
81
81
  if (e > n) return [];
@@ -84,7 +84,7 @@ function G(t) {
84
84
  r.push(new Date(e)), e = i(e, 1);
85
85
  return r;
86
86
  }
87
- function R(t) {
87
+ function G(t) {
88
88
  let e = m(t.start);
89
89
  const n = m(t.end);
90
90
  if (e > n) return [];
@@ -93,7 +93,7 @@ function R(t) {
93
93
  r.push(new Date(e)), e = f(e, 1);
94
94
  return r;
95
95
  }
96
- function $(t) {
96
+ function R(t) {
97
97
  const e = l(t.start).getFullYear(), n = l(t.end).getFullYear(), r = Math.min(e, n), a = Math.max(e, n), o = [];
98
98
  for (let s = r; s <= a; s += 1)
99
99
  o.push(new Date(s, 0, 1));
@@ -108,13 +108,13 @@ function S(t, e) {
108
108
  function k(t, e) {
109
109
  return t.getFullYear() === e.getFullYear();
110
110
  }
111
- function j(t, e) {
111
+ function $(t, e) {
112
112
  return t.getTime() < e.getTime();
113
113
  }
114
- function z(t, e) {
114
+ function j(t, e) {
115
115
  return t.getTime() > e.getTime();
116
116
  }
117
- function C(t) {
117
+ function z(t) {
118
118
  return new Date(Math.max(...t.map((e) => new Date(e).getTime())));
119
119
  }
120
120
  function J(t) {
@@ -124,7 +124,7 @@ function K(t, e) {
124
124
  return new Date(t).getTime() === new Date(e).getTime();
125
125
  }
126
126
  function Q(t) {
127
- return t.getDate() === O(t).getDate();
127
+ return t.getDate() === T(t).getDate();
128
128
  }
129
129
  function U(t, e) {
130
130
  const n = t.getTime();
@@ -143,11 +143,13 @@ function v(t) {
143
143
  return new Date(t);
144
144
  }
145
145
  function tt(t) {
146
- const e = new Date(2021, 5, 7, 12, 0, 0, 0);
147
- return Array.from(
148
- { length: 7 },
149
- (n, r) => new Intl.DateTimeFormat(t, { weekday: "short" }).format(i(e, r))
150
- );
146
+ const e = new Date(2021, 5, 7, 12, 0, 0, 0), n = t.toLowerCase().startsWith("pt");
147
+ return Array.from({ length: 7 }, (r, a) => {
148
+ const o = new Intl.DateTimeFormat(t, { weekday: "short" }).format(
149
+ i(e, a)
150
+ );
151
+ return n ? o.replace(/[^\p{L}]/gu, "").slice(0, 3) : o;
152
+ });
151
153
  }
152
154
  function y(t, e, n) {
153
155
  return new Intl.DateTimeFormat(e, { day: "numeric", month: n }).formatToParts(
@@ -171,8 +173,8 @@ function et(t, e, n) {
171
173
  [/yy/g, () => c(a % 100)]
172
174
  ];
173
175
  let g = e;
174
- return d.forEach(([F, T]) => {
175
- g = g.replace(F, T);
176
+ return d.forEach(([F, p]) => {
177
+ g = g.replace(F, p);
176
178
  }), g;
177
179
  }
178
180
  function I(t, e) {
@@ -206,16 +208,16 @@ export {
206
208
  i as addDays,
207
209
  f as addMonths,
208
210
  w as addYears,
209
- G as eachDayOfInterval,
210
- R as eachMonthOfInterval,
211
- $ as eachYearOfInterval,
211
+ C as eachDayOfInterval,
212
+ G as eachMonthOfInterval,
213
+ R as eachYearOfInterval,
212
214
  M as endOfDay,
213
215
  W as endOfISOWeek,
214
216
  P as endOfWeek,
215
217
  L as endOfYear,
216
218
  et as format,
217
- z as isAfter,
218
- j as isBefore,
219
+ j as isAfter,
220
+ $ as isBefore,
219
221
  K as isEqual,
220
222
  Q as isLastDayOfMonth,
221
223
  x as isSameDay,
@@ -225,13 +227,13 @@ export {
225
227
  Z as isThisYear,
226
228
  V as isToday,
227
229
  U as isWithinInterval,
228
- O as lastDayOfMonth,
229
- C as max,
230
+ T as lastDayOfMonth,
231
+ z as max,
230
232
  J as min,
231
233
  H as parse,
232
234
  v as parseISO,
233
235
  D as startOfDay,
234
- p as startOfISOWeek,
236
+ O as startOfISOWeek,
235
237
  m as startOfMonth,
236
238
  N as startOfWeek,
237
239
  l as startOfYear,
@@ -1,45 +1,45 @@
1
- import { currency as M } from "../data/currency-codes.js";
1
+ import { currency as R } from "../data/currency-codes.js";
2
2
  import { getCurrencySymbol as _ } from "../get-currency-symbol/util.js";
3
3
  import { splitAmount as C } from "../split-amount/util.js";
4
- const O = 3, R = 4, T = "−", a = " ", l = ",", S = (t) => t === "USD" || t === "CHF" || t === "GBP" || t === "CAD" || t === "AUD" || t === "TRY" || t === "GEL" || t === "ILS" || t === "UAH", N = (t, r, n) => r ? t ? S(n) ? `${r}${a}${t}` : `${t}${a}${r}` : "" : t, U = (t) => t ? t.length > 2 ? t.slice(0, 2) : t.length < 2 ? `${t}0` : t : "00", h = (t, r, n) => {
5
- const o = U(t);
6
- return !n && o === "00" ? null : !n && o[1] === "0" ? o.slice(0, 1) : o === "00" && !r ? null : o;
7
- }, d = ({
4
+ const O = 3, S = 4, T = "−", a = " ", e = ",", l = (t) => t === "USD" || t === "CHF" || t === "GBP" || t === "CAD" || t === "AUD" || t === "NZD" || t === "ARS" || t === "BRL" || t === "TWD" || t === "MXN" || t === "JPY" || t === "SGD" || t === "TRY" || t === "GEL" || t === "ILS" || t === "UAH", N = (t, o, i) => o ? t ? l(i) ? `${o}${a}${t}` : `${t}${a}${o}` : "" : t, U = (t) => t ? t.length > 2 ? t.slice(0, 2) : t.length < 2 ? `${t}0` : t : "00", h = (t, o, i) => {
5
+ const r = U(t);
6
+ return !i && r === "00" ? null : !i && r[1] === "0" ? r.slice(0, 1) : r === "00" && !o ? null : r;
7
+ }, $ = ({
8
8
  value: t,
9
- currency: r,
10
- showMinorPart: n,
11
- type: o
9
+ currency: o,
10
+ showMinorPart: i,
11
+ type: r
12
12
  }) => {
13
- const e = !!r && !!M.CURRENCY_SYMBOLS[r], i = e ? _(r) : r;
13
+ const m = !!o && !!R.CURRENCY_SYMBOLS[o], n = m ? _(o) : o;
14
14
  if (t === null)
15
15
  return {
16
16
  majorPart: "",
17
17
  minorPart: "",
18
18
  formatted: "",
19
- currencySymbol: i,
19
+ currencySymbol: n,
20
20
  formattedWithCurrency: ""
21
21
  };
22
- const [P, s] = o === "default" ? `${t}`.split(".") : [`${t}`.slice(0, -2), `${t}`.slice(-2)], m = C(
23
- `${Math.abs(+P || 0)}`,
22
+ const [M, s] = r === "default" ? `${t}`.split(".") : [`${t}`.slice(0, -2), `${t}`.slice(-2)], A = C(
23
+ `${Math.abs(+M || 0)}`,
24
24
  O,
25
25
  a,
26
- R
27
- ), f = t < 0 ? T + m : m, A = s ? f + l + s : f;
26
+ S
27
+ ), f = t < 0 ? T + A : A, P = s ? f + e + s : f;
28
28
  return {
29
29
  majorPart: f,
30
- minorPart: h(s, n, e),
31
- currencySymbol: i,
32
- formatted: A,
30
+ minorPart: h(s, i, m),
31
+ currencySymbol: n,
32
+ formatted: P,
33
33
  formattedWithCurrency: N(
34
- A,
35
- i || "",
36
- r
34
+ P,
35
+ n || "",
36
+ o
37
37
  )
38
38
  };
39
39
  };
40
40
  export {
41
- l as AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR,
41
+ e as AMOUNT_MAJOR_MINOR_PARTS_SEPARATOR,
42
42
  a as THINSP,
43
- d as formatAmount,
44
- S as isCurrencyFirst
43
+ $ as formatAmount,
44
+ l as isCurrencyFirst
45
45
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alphakits/ui",
3
- "version": "2.6.1",
3
+ "version": "2.6.2",
4
4
  "files": [
5
5
  "dist"
6
6
  ],