q2-tecton-elements 1.28.3 → 1.29.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.
Files changed (101) hide show
  1. package/dist/cjs/click-elsewhere_2.cjs.entry.js +4 -3
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/q2-action-sheet.cjs.entry.js +10 -5
  4. package/dist/cjs/q2-badge.cjs.entry.js +43 -0
  5. package/dist/cjs/q2-btn_2.cjs.entry.js +1 -1
  6. package/dist/cjs/q2-checkbox.cjs.entry.js +16 -7
  7. package/dist/cjs/q2-data-table.cjs.entry.js +287 -0
  8. package/dist/cjs/{q2-badge_2.cjs.entry.js → q2-input.cjs.entry.js} +1 -38
  9. package/dist/cjs/q2-tecton-elements.cjs.js +1 -1
  10. package/dist/collection/collection-manifest.json +1 -0
  11. package/dist/collection/components/q2-action-sheet/index.js +26 -4
  12. package/dist/collection/components/q2-action-sheet/styles.css +2 -2
  13. package/dist/collection/components/q2-btn/styles.css +4 -0
  14. package/dist/collection/components/q2-checkbox/index.js +15 -6
  15. package/dist/collection/components/q2-checkbox/styles.css +4 -0
  16. package/dist/collection/components/q2-data-table/index.js +539 -0
  17. package/dist/collection/components/q2-data-table/styles.css +192 -0
  18. package/dist/collection/components/q2-input/styles.css +1 -1
  19. package/dist/collection/components/q2-popover/index.js +4 -3
  20. package/dist/components/index.d.ts +1 -0
  21. package/dist/components/index.js +1 -0
  22. package/dist/components/index10.js +72 -55
  23. package/dist/components/index11.js +56 -44
  24. package/dist/components/index12.js +42 -42
  25. package/dist/components/index13.js +40 -538
  26. package/dist/components/index14.js +518 -136
  27. package/dist/components/index15.js +174 -574
  28. package/dist/components/index16.js +589 -0
  29. package/dist/components/index3.js +1 -1
  30. package/dist/components/index5.js +3 -3
  31. package/dist/components/index6.js +93 -94
  32. package/dist/components/index7.js +112 -2927
  33. package/dist/components/index8.js +2919 -3347
  34. package/dist/components/index9.js +3343 -56
  35. package/dist/components/q2-action-sheet.js +18 -12
  36. package/dist/components/q2-calendar.js +6 -6
  37. package/dist/components/q2-card.js +2 -2
  38. package/dist/components/q2-carousel-pane.js +1 -1
  39. package/dist/components/q2-carousel.js +3 -3
  40. package/dist/components/q2-chart-area.js +1 -1
  41. package/dist/components/q2-chart-bar.js +1 -1
  42. package/dist/components/q2-chart-donut.js +2 -2
  43. package/dist/components/q2-checkbox-group.js +2 -2
  44. package/dist/components/q2-checkbox.js +1 -133
  45. package/dist/components/q2-data-table.d.ts +11 -0
  46. package/dist/components/q2-data-table.js +349 -0
  47. package/dist/components/q2-dropdown-item.js +1 -1
  48. package/dist/components/q2-dropdown.js +5 -5
  49. package/dist/components/q2-editable-field.js +4 -4
  50. package/dist/components/q2-icon.js +1 -1
  51. package/dist/components/q2-input.js +1 -1
  52. package/dist/components/q2-loading.js +1 -1
  53. package/dist/components/q2-loc.js +1 -1
  54. package/dist/components/q2-message.js +1 -1
  55. package/dist/components/q2-month-picker.js +3 -3
  56. package/dist/components/q2-optgroup.js +1 -1
  57. package/dist/components/q2-option-list.js +1 -1
  58. package/dist/components/q2-option.js +1 -1
  59. package/dist/components/q2-pagination.js +4 -4
  60. package/dist/components/q2-pill.js +4 -4
  61. package/dist/components/q2-popover.js +1 -1
  62. package/dist/components/q2-radio-group.js +2 -2
  63. package/dist/components/q2-radio.js +1 -1
  64. package/dist/components/q2-section.js +3 -3
  65. package/dist/components/q2-select.js +6 -6
  66. package/dist/components/q2-stepper-pane.js +1 -1
  67. package/dist/components/q2-stepper-vertical.js +2 -2
  68. package/dist/components/q2-stepper.js +3 -3
  69. package/dist/components/q2-tab-container.js +3 -3
  70. package/dist/components/q2-tag.js +4 -4
  71. package/dist/components/q2-textarea.js +2 -2
  72. package/dist/components/q2-tooltip.js +1 -1
  73. package/dist/docs.json +280 -3
  74. package/dist/esm/click-elsewhere_2.entry.js +4 -3
  75. package/dist/esm/loader.js +1 -1
  76. package/dist/esm/q2-action-sheet.entry.js +10 -5
  77. package/dist/esm/q2-badge.entry.js +39 -0
  78. package/dist/esm/q2-btn_2.entry.js +1 -1
  79. package/dist/esm/q2-checkbox.entry.js +16 -7
  80. package/dist/esm/q2-data-table.entry.js +283 -0
  81. package/dist/esm/{q2-badge_2.entry.js → q2-input.entry.js} +3 -39
  82. package/dist/esm/q2-tecton-elements.js +1 -1
  83. package/dist/q2-tecton-elements/p-00b2c345.entry.js +1 -0
  84. package/dist/q2-tecton-elements/p-0112df78.entry.js +1 -0
  85. package/dist/q2-tecton-elements/p-08286237.entry.js +1 -0
  86. package/dist/q2-tecton-elements/p-42d03011.entry.js +1 -0
  87. package/dist/q2-tecton-elements/p-47aefcc2.entry.js +1 -0
  88. package/dist/q2-tecton-elements/p-9a327827.entry.js +1 -0
  89. package/dist/q2-tecton-elements/p-c9abc814.entry.js +1 -0
  90. package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
  91. package/dist/types/components/q2-action-sheet/index.d.ts +1 -0
  92. package/dist/types/components/q2-checkbox/index.d.ts +4 -0
  93. package/dist/types/components/q2-data-table/index.d.ts +94 -0
  94. package/dist/types/components.d.ts +47 -0
  95. package/package.json +3 -3
  96. package/dist/q2-tecton-elements/p-0b7003c4.entry.js +0 -1
  97. package/dist/q2-tecton-elements/p-1b9e07b4.entry.js +0 -1
  98. package/dist/q2-tecton-elements/p-3bf06809.entry.js +0 -1
  99. package/dist/q2-tecton-elements/p-92e746c8.entry.js +0 -1
  100. package/dist/q2-tecton-elements/p-d6824ce5.entry.js +0 -1
  101. /package/dist/types/workspace/workspace/{tecton-production_release_1.28.x → Tecton_tecton-production_master}/packages/q2-tecton-elements/.stencil/test/helpers.d.ts +0 -0
@@ -1,101 +1,3388 @@
1
- import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
- import { l as loc, h as handleAriaLabel } from './index15.js';
3
- import { s as shapes } from './shapes.js';
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Fragment } from '@stencil/core/internal/client';
2
+ import { i as isMobile, d as createGuid, s as setMessageHeight, h as handleAriaLabel, o as overrideFocus, l as loc, a as isEventFromElement, j as labelDOM, m as messagesDOM } from './index16.js';
3
+ import { d as defineCustomElement$4 } from './index4.js';
4
+ import { d as defineCustomElement$3 } from './index5.js';
5
+ import { d as defineCustomElement$2 } from './index8.js';
6
+ import { d as defineCustomElement$1 } from './index10.js';
4
7
 
5
- const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #33b4ff #06C)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}.flex{display:flex}.flex-center{justify-content:center}.flex-left{justify-content:flex-start}.flex-right{justify-content:flex-end}.flex-v-center{align-items:center}.no-margin{margin:0}:host{display:block}:host([inline]),:host([modifiers*=inline]){display:inline-block}:host([hidden]){display:none}:host(:not([inline]):not([modifiers*=inline])){font-size:var(--tct-loading-spinner-size, var(--t-loading-spinner-size, var(--app-scale-12x, 60px)))}.q2-loading-animation{height:1em;width:1em}.half-circle-spinner,.half-circle-spinner *{box-sizing:border-box}.half-circle-spinner{border-radius:100%;position:relative}.half-circle-spinner .circle{position:absolute;width:100%;height:100%;border-radius:100%;border:0.0833333333em solid transparent}.half-circle-spinner .circle.circle-1{border-top-color:var(--tct-loading-primary-color, var(--t-loading-primary-color, var(--t-primary, #0079c1)));animation:half-circle-spinner-animation 1s infinite}.half-circle-spinner .circle.circle-2{border-bottom-color:var(--tct-loading-secondary-color, var(--t-loading-secondary-color, #9ddd4f));animation:half-circle-spinner-animation 1s infinite alternate}@keyframes half-circle-spinner-animation{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.q2-loading-skeleton{position:relative;width:100%;height:100%;overflow:hidden;--comp-loading-skeleton-shimmer-color:var(--tct-loading-skeleton-shimmer-color, var(--t-base, rgba(255, 255, 255, 0.5)));--comp-loading-skeleton-vertical-gap:var(--tct-loading-skeleton-vertical-gap, var(--tct-scale-2, 10px));--comp-loading-skeleton-horizontal-gap:var(--tct-loading-skeleton-horizontal-gap, var(--tct-scale-2, 10px))}.q2-loading-skeleton-shimmer{position:absolute;width:1rem;height:100%;top:0;left:-100px;animation:skeletonShimmer 3s ease-in-out infinite;background-color:var(--comp-loading-skeleton-shimmer-color);box-shadow:0 0 25px 20px var(--comp-loading-skeleton-shimmer-color);transform:rotate(10deg)}.skeleton-shape.rectangle:not(.no-margin){margin:var(--tct-loading-skeleton-vertical-gap, var(--tct-scale-2, 10px)) var(--tct-loading-skeleton-horizontal-gap, var(--tct-scale-2, 10px))}.skeleton-shape.circle,.skeleton-shape.rectangle{background-color:var(--tct-loading-skeleton-element-bg, var(--tct-gray-l3, var(--t-gray-14, #f2f2f2)))}.skeleton-shape.rectangle{min-height:var(--tct-loading-skeleton-rectangle-min-height, 20px)}.skeleton-shape.circle{border-radius:50%;padding-top:100%}.flex .rectangle{flex-grow:1}.skeleton-table-row .rectangle{margin:var(--comp-loading-skeleton-vertical-gap) var(--comp-loading-skeleton-horizontal-gap)}.skeleton-table-row .rectangle:not(:first-child):not(:last-child){flex-grow:2}.skeleton-table-row-border .skeleton-shape{margin:0 var(--comp-loading-skeleton-horizontal-gap)}.form{flex-wrap:wrap}.form .field{margin:var(--comp-loading-skeleton-vertical-gap) 0}.form.columns-1 .field{flex-basis:100%}.form.columns-2 .field{flex-basis:50%}.form.columns-3 .field{flex-basis:33.3333%}.form.columns-4 .field{flex-basis:25%}.form.columns-5 .field{flex-basis:20%}.text .rectangle{margin-bottom:0}.text .header.center{margin:0 auto}.text .header.right{margin-left:auto}.text .header{height:1.5rem}.text .header.smaller{height:1rem}.detailed-item{flex-wrap:wrap}.detailed-item.right{flex-flow:row-reverse}.detailed-item-image{flex:0 0 auto;display:inline-flex}.center .detailed-item-image{flex-basis:100%;display:flex}.detailed-item-image .rectangle{flex-grow:0}.detailed-item-text>div{width:100%}.detailed-item-text{flex:1 1 auto}.detailed-item-text .text{margin-top:0;margin-bottom:0}.label-value{flex-wrap:wrap}.label-value .rectangle{flex-basis:calc(50% - 2 * var(--comp-loading-skeleton-horizontal-gap))}@keyframes skeletonShimmer{0%{left:-100px;opacity:1}70%{opacity:1}100%{left:800px;opacity:0}}";
8
+ function formatNumber(val = '', options = {
9
+ prefix: '',
10
+ suffix: '',
11
+ decimals: 0,
12
+ decimalSeparator: '.',
13
+ thousandsSeparator: '',
14
+ allowDecimal: false,
15
+ allowNegative: true,
16
+ }, explicit = false) {
17
+ const isNegative = val[0] === '-';
18
+ let value = val;
19
+ const allowDecimal = !!options.allowDecimal && !!options.decimals;
20
+ if (explicit) {
21
+ const parsedValue = value.replace(/[^\d.]/g, '');
22
+ value = (parsedValue && Number(parsedValue).toFixed(allowDecimal ? options.decimals : 0)) || '';
23
+ }
24
+ value = value.replace(/[^\d]/g, '');
25
+ let { integerString, decimalString } = splitValue(value, allowDecimal, options.decimals);
26
+ // define decimalString
27
+ let decimalSeparator = options.decimalSeparator;
28
+ if (!allowDecimal) {
29
+ decimalSeparator = '';
30
+ decimalString = '';
31
+ }
32
+ // define negative
33
+ const negativeSymbol = options.allowNegative && isNegative ? '-' : '';
34
+ value = `${negativeSymbol}${integerString}${decimalSeparator}${decimalString}`;
35
+ // format integerString
36
+ integerString = integerString.replace(/\B(?=(\d{3})+(?!\d))/g, options.thousandsSeparator);
37
+ const formattedValue = negativeSymbol || integerString ? `${negativeSymbol}${integerString}${decimalSeparator}${decimalString}` : '';
38
+ const fullyFormattedValue = negativeSymbol || integerString
39
+ ? `${negativeSymbol}${options.prefix}${integerString}${decimalSeparator}${decimalString}${options.suffix}`
40
+ : '';
41
+ let formattingCharacterCount = formattedValue.length - value.length;
42
+ if (decimalSeparator) {
43
+ formattingCharacterCount = formattingCharacterCount + options.decimalSeparator.length;
44
+ }
45
+ const prefix = options.prefix || options.suffix;
46
+ const maxlength = Number.MAX_SAFE_INTEGER.toString().length + formattingCharacterCount + decimalString.length;
47
+ const unformattedValue = `${integerString.replace(/[^0-9]/g, '')}${decimalString}`.replace(/^0+/, '');
48
+ return {
49
+ value,
50
+ formattedValue,
51
+ fullyFormattedValue,
52
+ prefix,
53
+ suffix: '',
54
+ formattingCharacterCount,
55
+ maxlength,
56
+ unformattedValue,
57
+ };
58
+ }
59
+ function splitValue(value, allowDecimal = false, decimals) {
60
+ if (!allowDecimal) {
61
+ return {
62
+ integerString: value,
63
+ decimalString: '',
64
+ };
65
+ }
66
+ const splitIndex = value.length - decimals;
67
+ let integerString = value.substring(0, splitIndex).padStart(1, '0');
68
+ if (integerString.length > 1 && integerString[0] === '0') {
69
+ integerString = integerString.substring(1);
70
+ }
71
+ const decimalString = value.substring(splitIndex).padStart(decimals, '0');
72
+ return {
73
+ integerString,
74
+ decimalString,
75
+ };
76
+ }
77
+
78
+ function formatValue(value = '', mask = '', options) {
79
+ const prefix = (options && options.prefix) || '';
80
+ const suffix = (options && options.suffix) || '';
81
+ if (!value || !mask) {
82
+ const fullyFormattedValue = `${prefix}${value}${suffix}`;
83
+ return {
84
+ value,
85
+ formattedValue: value,
86
+ fullyFormattedValue,
87
+ prefix: prefix.trim() || suffix.trim(),
88
+ formattingCharacterCount: 0,
89
+ unformattedValue: value,
90
+ };
91
+ }
92
+ const { unformattedValue, formattedValue, formattingCharacterCount } = generateMask(value, mask);
93
+ const fullyFormattedValue = `${prefix}${formattedValue}${suffix}`;
94
+ const maxlength = mask.length;
95
+ const minFormattedLength = getMinimumFormattedLength(mask, prefix, suffix);
96
+ return {
97
+ value: unformattedValue,
98
+ formattedValue,
99
+ fullyFormattedValue,
100
+ prefix: prefix.trim() || suffix.trim(),
101
+ formattingCharacterCount,
102
+ maxlength,
103
+ minFormattedLength,
104
+ unformattedValue,
105
+ };
106
+ }
107
+ const optionalValidatingChars = ['?'];
108
+ function isOptionalValidatingChar(character) {
109
+ return optionalValidatingChars.includes(character);
110
+ }
111
+ const knownValidatingChars = ['#', '@', '*', ...optionalValidatingChars];
112
+ function isKnownValidatingChar(character) {
113
+ return knownValidatingChars.includes(character);
114
+ }
115
+ function getStaticFormattingChars(mask) {
116
+ const knownChars = knownValidatingChars.join('|');
117
+ const formattingChars = mask.replace(new RegExp(`[${knownChars}]`, 'g'), '').split('');
118
+ return new Set(formattingChars);
119
+ }
120
+ function isStaticFormattingChar(character, formattingChars) {
121
+ return formattingChars.has(character);
122
+ }
123
+ function getValidatedChar(char, matcher) {
124
+ switch (matcher) {
125
+ case '#':
126
+ char = char.replace(/[^\d]/g, '');
127
+ break;
128
+ case '@':
129
+ char = char.toUpperCase().replace(/[^A-Z]+/g, ''); // allows only upper case
130
+ break;
131
+ case '*':
132
+ char = char.toUpperCase().replace(/[^\dA-Z]+/g, '');
133
+ break;
134
+ case '?':
135
+ char = char.replace(/[^\d]/g, '');
136
+ break;
137
+ default:
138
+ return char;
139
+ }
140
+ return char;
141
+ }
142
+ function generateMask(value, mask) {
143
+ const maskArray = mask.split('');
144
+ const formattingChars = getStaticFormattingChars(mask);
145
+ let currentValueIndex = 0;
146
+ let formattingCharacterCount = 0;
147
+ let unformattedValue = '';
148
+ const formattedValue = maskArray.reduce((acc, character) => {
149
+ if (currentValueIndex >= value.length) {
150
+ return acc;
151
+ }
152
+ if (isOptionalValidatingChar(character) && isStaticFormattingChar(value[currentValueIndex], formattingChars)) {
153
+ return acc;
154
+ }
155
+ if (isKnownValidatingChar(character)) {
156
+ // Step value index if formatting character pushed out of place by user input
157
+ currentValueIndex = getNextNonFormattingCharIndex(value, currentValueIndex, formattingChars);
158
+ if (currentValueIndex >= value.length) {
159
+ return acc;
160
+ }
161
+ const validChar = getValidatedChar(value[currentValueIndex], character);
162
+ acc += validChar;
163
+ unformattedValue += validChar;
164
+ currentValueIndex++;
165
+ }
166
+ else {
167
+ // Static formatting characters added directly to formatted string
168
+ acc += character;
169
+ formattingCharacterCount++;
170
+ if (character === value[currentValueIndex]) {
171
+ // Continue to walk value if next value at this index matches formatting character
172
+ currentValueIndex++;
173
+ }
174
+ }
175
+ return acc;
176
+ }, '');
177
+ return {
178
+ unformattedValue,
179
+ formattedValue,
180
+ formattingCharacterCount,
181
+ };
182
+ }
183
+ function getNextNonFormattingCharIndex(value, currentValueIndex, formattingChars) {
184
+ if (isStaticFormattingChar(value[currentValueIndex], formattingChars)) {
185
+ currentValueIndex++;
186
+ return getNextNonFormattingCharIndex(value, currentValueIndex, formattingChars);
187
+ }
188
+ return currentValueIndex;
189
+ }
190
+ function getMinimumFormattedLength(mask, prefix, suffix) {
191
+ return (mask.replace(new RegExp(`[${optionalValidatingChars.join('|')}]`, 'g'), '').length +
192
+ prefix.length +
193
+ suffix.length);
194
+ }
195
+
196
+ // decimal data source: http://www.iso.org/iso/home/standards/currency_codes.htm 09/Nov/2016
197
+ const currencyFormats = {
198
+ AED: {
199
+ prefix: '',
200
+ suffix: 'د.إ',
201
+ decimals: 2,
202
+ decimalSeparator: '.',
203
+ thousandsSeparator: ',',
204
+ },
205
+ AFN: {
206
+ prefix: '¤',
207
+ suffix: '',
208
+ decimals: 2,
209
+ decimalSeparator: '.',
210
+ thousandsSeparator: ',',
211
+ },
212
+ ALL: {
213
+ prefix: 'L',
214
+ suffix: '',
215
+ decimals: 2,
216
+ decimalSeparator: '.',
217
+ thousandsSeparator: ',',
218
+ },
219
+ AMD: {
220
+ prefix: 'դր.',
221
+ suffix: '',
222
+ decimals: 2,
223
+ decimalSeparator: '.',
224
+ thousandsSeparator: ',',
225
+ },
226
+ ANG: {
227
+ prefix: 'ƒ',
228
+ suffix: '',
229
+ decimals: 2,
230
+ decimalSeparator: '.',
231
+ thousandsSeparator: ',',
232
+ },
233
+ AOA: {
234
+ prefix: 'Kz',
235
+ suffix: '',
236
+ decimals: 2,
237
+ decimalSeparator: '.',
238
+ thousandsSeparator: ',',
239
+ },
240
+ ARS: {
241
+ prefix: '$',
242
+ suffix: '',
243
+ decimals: 2,
244
+ decimalSeparator: '.',
245
+ thousandsSeparator: ',',
246
+ },
247
+ AUD: {
248
+ prefix: '$',
249
+ suffix: '',
250
+ decimals: 2,
251
+ decimalSeparator: '.',
252
+ thousandsSeparator: ',',
253
+ },
254
+ AWG: {
255
+ prefix: 'ƒ',
256
+ suffix: '',
257
+ decimals: 2,
258
+ decimalSeparator: '.',
259
+ thousandsSeparator: ',',
260
+ },
261
+ AZN: {
262
+ prefix: '¤',
263
+ suffix: '',
264
+ decimals: 2,
265
+ decimalSeparator: '.',
266
+ thousandsSeparator: ',',
267
+ },
268
+ BAM: {
269
+ prefix: 'КМ',
270
+ suffix: '',
271
+ decimals: 2,
272
+ decimalSeparator: '.',
273
+ thousandsSeparator: ',',
274
+ },
275
+ BBD: {
276
+ prefix: '$',
277
+ suffix: '',
278
+ decimals: 2,
279
+ decimalSeparator: '.',
280
+ thousandsSeparator: ',',
281
+ },
282
+ BDT: {
283
+ prefix: '৳',
284
+ suffix: '',
285
+ decimals: 2,
286
+ decimalSeparator: '.',
287
+ thousandsSeparator: ',',
288
+ },
289
+ BGN: {
290
+ prefix: '৳',
291
+ suffix: '',
292
+ decimals: 2,
293
+ decimalSeparator: '.',
294
+ thousandsSeparator: ',',
295
+ },
296
+ BHD: {
297
+ prefix: '',
298
+ suffix: 'ب.د',
299
+ decimals: 3,
300
+ decimalSeparator: '.',
301
+ thousandsSeparator: ',',
302
+ },
303
+ BIF: {
304
+ prefix: 'Fr',
305
+ suffix: '',
306
+ decimals: 0,
307
+ decimalSeparator: '.',
308
+ thousandsSeparator: ',',
309
+ },
310
+ BMD: {
311
+ prefix: '$',
312
+ suffix: '',
313
+ decimals: 2,
314
+ decimalSeparator: '.',
315
+ thousandsSeparator: ',',
316
+ },
317
+ BND: {
318
+ prefix: '$',
319
+ suffix: '',
320
+ decimals: 2,
321
+ decimalSeparator: '.',
322
+ thousandsSeparator: ',',
323
+ },
324
+ BOB: {
325
+ prefix: 'Bs.',
326
+ suffix: '',
327
+ decimals: 2,
328
+ decimalSeparator: '.',
329
+ thousandsSeparator: ',',
330
+ },
331
+ BRL: {
332
+ prefix: 'R$',
333
+ suffix: '',
334
+ decimals: 2,
335
+ decimalSeparator: '.',
336
+ thousandsSeparator: ',',
337
+ },
338
+ BSD: {
339
+ prefix: '$',
340
+ suffix: '',
341
+ decimals: 2,
342
+ decimalSeparator: '.',
343
+ thousandsSeparator: ',',
344
+ },
345
+ BTN: {
346
+ prefix: '¤',
347
+ suffix: '',
348
+ decimals: 2,
349
+ decimalSeparator: '.',
350
+ thousandsSeparator: ',',
351
+ },
352
+ BWP: {
353
+ prefix: 'P',
354
+ suffix: '',
355
+ decimals: 2,
356
+ decimalSeparator: '.',
357
+ thousandsSeparator: ',',
358
+ },
359
+ BYN: {
360
+ prefix: 'Br',
361
+ suffix: '',
362
+ decimals: 0,
363
+ decimalSeparator: '.',
364
+ thousandsSeparator: ',',
365
+ },
366
+ BZD: {
367
+ prefix: '$',
368
+ suffix: '',
369
+ decimals: 2,
370
+ decimalSeparator: '.',
371
+ thousandsSeparator: ',',
372
+ },
373
+ CAD: {
374
+ prefix: '$',
375
+ suffix: '',
376
+ decimals: 2,
377
+ decimalSeparator: '.',
378
+ thousandsSeparator: ',',
379
+ },
380
+ CDF: {
381
+ prefix: 'Fr',
382
+ suffix: '',
383
+ decimals: 2,
384
+ decimalSeparator: '.',
385
+ thousandsSeparator: ',',
386
+ },
387
+ CHF: {
388
+ prefix: 'Fr',
389
+ suffix: '',
390
+ decimals: 2,
391
+ decimalSeparator: '.',
392
+ thousandsSeparator: ',',
393
+ },
394
+ CLF: {
395
+ prefix: 'Fr',
396
+ suffix: '',
397
+ decimals: 4,
398
+ decimalSeparator: '.',
399
+ thousandsSeparator: ',',
400
+ },
401
+ CLP: {
402
+ prefix: '$',
403
+ suffix: '',
404
+ decimals: 0,
405
+ decimalSeparator: '.',
406
+ thousandsSeparator: ',',
407
+ },
408
+ CNY: {
409
+ prefix: '¥',
410
+ suffix: '',
411
+ decimals: 2,
412
+ decimalSeparator: '.',
413
+ thousandsSeparator: ',',
414
+ },
415
+ COP: {
416
+ prefix: '$',
417
+ suffix: '',
418
+ decimals: 2,
419
+ decimalSeparator: '.',
420
+ thousandsSeparator: ',',
421
+ },
422
+ CRC: {
423
+ prefix: '₡',
424
+ suffix: '',
425
+ decimals: 2,
426
+ decimalSeparator: '.',
427
+ thousandsSeparator: ',',
428
+ },
429
+ CUC: {
430
+ prefix: '$',
431
+ suffix: '',
432
+ decimals: 2,
433
+ decimalSeparator: '.',
434
+ thousandsSeparator: ',',
435
+ },
436
+ CUP: {
437
+ prefix: '$',
438
+ suffix: '',
439
+ decimals: 2,
440
+ decimalSeparator: '.',
441
+ thousandsSeparator: ',',
442
+ },
443
+ CVE: {
444
+ prefix: '$',
445
+ suffix: '',
446
+ decimals: 0,
447
+ decimalSeparator: '.',
448
+ thousandsSeparator: ',',
449
+ },
450
+ CZK: {
451
+ prefix: 'Kč',
452
+ suffix: '',
453
+ decimals: 2,
454
+ decimalSeparator: '.',
455
+ thousandsSeparator: ',',
456
+ },
457
+ DJF: {
458
+ prefix: 'Fr',
459
+ suffix: '',
460
+ decimals: 0,
461
+ decimalSeparator: '.',
462
+ thousandsSeparator: ',',
463
+ },
464
+ DKK: {
465
+ prefix: 'kr',
466
+ suffix: '',
467
+ decimals: 2,
468
+ decimalSeparator: '.',
469
+ thousandsSeparator: ',',
470
+ },
471
+ DOP: {
472
+ prefix: '$',
473
+ suffix: '',
474
+ decimals: 2,
475
+ decimalSeparator: '.',
476
+ thousandsSeparator: ',',
477
+ },
478
+ DZD: {
479
+ prefix: '',
480
+ suffix: 'د.ج',
481
+ decimals: 2,
482
+ decimalSeparator: '.',
483
+ thousandsSeparator: ',',
484
+ },
485
+ EEK: {
486
+ prefix: 'KR',
487
+ suffix: '',
488
+ decimals: 2,
489
+ decimalSeparator: '.',
490
+ thousandsSeparator: ',',
491
+ },
492
+ EGP: {
493
+ prefix: '£',
494
+ suffix: '',
495
+ decimals: 2,
496
+ decimalSeparator: '.',
497
+ thousandsSeparator: ',',
498
+ },
499
+ ERN: {
500
+ prefix: 'Nfk',
501
+ suffix: '',
502
+ decimals: 2,
503
+ decimalSeparator: '.',
504
+ thousandsSeparator: ',',
505
+ },
506
+ ETB: {
507
+ prefix: '¤',
508
+ suffix: '',
509
+ decimals: 2,
510
+ decimalSeparator: '.',
511
+ thousandsSeparator: ',',
512
+ },
513
+ EUR: {
514
+ prefix: '€',
515
+ suffix: '',
516
+ decimals: 2,
517
+ decimalSeparator: '.',
518
+ thousandsSeparator: ',',
519
+ },
520
+ FJD: {
521
+ prefix: '$',
522
+ suffix: '',
523
+ decimals: 2,
524
+ decimalSeparator: '.',
525
+ thousandsSeparator: ',',
526
+ },
527
+ FKP: {
528
+ prefix: '£',
529
+ suffix: '',
530
+ decimals: 2,
531
+ decimalSeparator: '.',
532
+ thousandsSeparator: ',',
533
+ },
534
+ GBP: {
535
+ prefix: '£',
536
+ suffix: '',
537
+ decimals: 2,
538
+ decimalSeparator: '.',
539
+ thousandsSeparator: ',',
540
+ },
541
+ GEL: {
542
+ prefix: 'ლ',
543
+ suffix: '',
544
+ decimals: 2,
545
+ decimalSeparator: '.',
546
+ thousandsSeparator: ',',
547
+ },
548
+ GHS: {
549
+ prefix: '¤',
550
+ suffix: '',
551
+ decimals: 2,
552
+ decimalSeparator: '.',
553
+ thousandsSeparator: ',',
554
+ },
555
+ GIP: {
556
+ prefix: '£',
557
+ suffix: '',
558
+ decimals: 2,
559
+ decimalSeparator: '.',
560
+ thousandsSeparator: ',',
561
+ },
562
+ GMD: {
563
+ prefix: 'D',
564
+ suffix: '',
565
+ decimals: 2,
566
+ decimalSeparator: '.',
567
+ thousandsSeparator: ',',
568
+ },
569
+ GNF: {
570
+ prefix: 'Fr',
571
+ suffix: '',
572
+ decimals: 0,
573
+ decimalSeparator: '.',
574
+ thousandsSeparator: ',',
575
+ },
576
+ GTQ: {
577
+ prefix: 'Q',
578
+ suffix: '',
579
+ decimals: 2,
580
+ decimalSeparator: '.',
581
+ thousandsSeparator: ',',
582
+ },
583
+ GYD: {
584
+ prefix: '$',
585
+ suffix: '',
586
+ decimals: 2,
587
+ decimalSeparator: '.',
588
+ thousandsSeparator: ',',
589
+ },
590
+ HKD: {
591
+ prefix: '$',
592
+ suffix: '',
593
+ decimals: 2,
594
+ decimalSeparator: '.',
595
+ thousandsSeparator: ',',
596
+ },
597
+ HNL: {
598
+ prefix: 'L',
599
+ suffix: '',
600
+ decimals: 2,
601
+ decimalSeparator: '.',
602
+ thousandsSeparator: ',',
603
+ },
604
+ HRK: {
605
+ prefix: 'kn',
606
+ suffix: '',
607
+ decimals: 2,
608
+ decimalSeparator: '.',
609
+ thousandsSeparator: ',',
610
+ },
611
+ HTG: {
612
+ prefix: 'G',
613
+ suffix: '',
614
+ decimals: 2,
615
+ decimalSeparator: '.',
616
+ thousandsSeparator: ',',
617
+ },
618
+ HUF: {
619
+ prefix: 'Ft',
620
+ suffix: '',
621
+ decimals: 2,
622
+ decimalSeparator: '.',
623
+ thousandsSeparator: ',',
624
+ },
625
+ IDR: {
626
+ prefix: 'Rs',
627
+ suffix: '',
628
+ decimals: 2,
629
+ decimalSeparator: '.',
630
+ thousandsSeparator: ',',
631
+ },
632
+ ILS: {
633
+ prefix: '₪',
634
+ suffix: '',
635
+ decimals: 2,
636
+ decimalSeparator: '.',
637
+ thousandsSeparator: ',',
638
+ },
639
+ INR: {
640
+ prefix: '₨',
641
+ suffix: '',
642
+ decimals: 2,
643
+ decimalSeparator: '.',
644
+ thousandsSeparator: ',',
645
+ },
646
+ IQD: {
647
+ prefix: '',
648
+ suffix: 'ع.د',
649
+ decimals: 3,
650
+ decimalSeparator: '.',
651
+ thousandsSeparator: ',',
652
+ },
653
+ IRR: {
654
+ prefix: '¤',
655
+ suffix: '',
656
+ decimals: 2,
657
+ decimalSeparator: '.',
658
+ thousandsSeparator: ',',
659
+ },
660
+ ISK: {
661
+ prefix: 'kr',
662
+ suffix: '',
663
+ decimals: 0,
664
+ decimalSeparator: '.',
665
+ thousandsSeparator: ',',
666
+ },
667
+ JMD: {
668
+ prefix: '$',
669
+ suffix: '',
670
+ decimals: 2,
671
+ decimalSeparator: '.',
672
+ thousandsSeparator: ',',
673
+ },
674
+ JOD: {
675
+ prefix: '',
676
+ suffix: 'د.ا',
677
+ decimals: 3,
678
+ decimalSeparator: '.',
679
+ thousandsSeparator: ',',
680
+ },
681
+ JPY: {
682
+ prefix: '¥',
683
+ suffix: '',
684
+ decimals: 0,
685
+ decimalSeparator: '.',
686
+ thousandsSeparator: ',',
687
+ },
688
+ KES: {
689
+ prefix: 'Sh',
690
+ suffix: '',
691
+ decimals: 2,
692
+ decimalSeparator: '.',
693
+ thousandsSeparator: ',',
694
+ },
695
+ KGS: {
696
+ prefix: '¤',
697
+ suffix: '',
698
+ decimals: 2,
699
+ decimalSeparator: '.',
700
+ thousandsSeparator: ',',
701
+ },
702
+ KHR: {
703
+ prefix: '¤',
704
+ suffix: '',
705
+ decimals: 2,
706
+ decimalSeparator: '.',
707
+ thousandsSeparator: ',',
708
+ },
709
+ KMF: {
710
+ prefix: 'Fr',
711
+ suffix: '',
712
+ decimals: 0,
713
+ decimalSeparator: '.',
714
+ thousandsSeparator: ',',
715
+ },
716
+ KPW: {
717
+ prefix: '₩',
718
+ suffix: '',
719
+ decimals: 2,
720
+ decimalSeparator: '.',
721
+ thousandsSeparator: ',',
722
+ },
723
+ KRW: {
724
+ prefix: '₩',
725
+ suffix: '',
726
+ decimals: 0,
727
+ decimalSeparator: '.',
728
+ thousandsSeparator: ',',
729
+ },
730
+ KWD: {
731
+ prefix: 'د.ك',
732
+ suffix: '',
733
+ decimals: 3,
734
+ decimalSeparator: '.',
735
+ thousandsSeparator: ',',
736
+ },
737
+ KYD: {
738
+ prefix: '$',
739
+ suffix: '',
740
+ decimals: 2,
741
+ decimalSeparator: '.',
742
+ thousandsSeparator: ',',
743
+ },
744
+ KZT: {
745
+ prefix: '〒',
746
+ suffix: '',
747
+ decimals: 2,
748
+ decimalSeparator: '.',
749
+ thousandsSeparator: ',',
750
+ },
751
+ LAK: {
752
+ prefix: '₭',
753
+ suffix: '',
754
+ decimals: 2,
755
+ decimalSeparator: '.',
756
+ thousandsSeparator: ',',
757
+ },
758
+ LBP: {
759
+ prefix: '',
760
+ suffix: 'ل.ل',
761
+ decimals: 2,
762
+ decimalSeparator: '.',
763
+ thousandsSeparator: ',',
764
+ },
765
+ LKR: {
766
+ prefix: 'Rs',
767
+ suffix: '',
768
+ decimals: 2,
769
+ decimalSeparator: '.',
770
+ thousandsSeparator: ',',
771
+ },
772
+ LRD: {
773
+ prefix: '$',
774
+ suffix: '',
775
+ decimals: 2,
776
+ decimalSeparator: '.',
777
+ thousandsSeparator: ',',
778
+ },
779
+ LSL: {
780
+ prefix: 'L',
781
+ suffix: '',
782
+ decimals: 2,
783
+ decimalSeparator: '.',
784
+ thousandsSeparator: ',',
785
+ },
786
+ LTL: {
787
+ prefix: 'Lt',
788
+ suffix: '',
789
+ decimals: 2,
790
+ decimalSeparator: '.',
791
+ thousandsSeparator: ',',
792
+ },
793
+ LVL: {
794
+ prefix: 'Ls',
795
+ suffix: '',
796
+ decimals: 2,
797
+ decimalSeparator: '.',
798
+ thousandsSeparator: ',',
799
+ },
800
+ LYD: {
801
+ prefix: '',
802
+ suffix: 'ل.د',
803
+ decimals: 3,
804
+ decimalSeparator: '.',
805
+ thousandsSeparator: ',',
806
+ },
807
+ MAD: {
808
+ prefix: '',
809
+ suffix: 'د.م.',
810
+ decimals: 2,
811
+ decimalSeparator: '.',
812
+ thousandsSeparator: ',',
813
+ },
814
+ MDL: {
815
+ prefix: 'L',
816
+ suffix: '',
817
+ decimals: 2,
818
+ decimalSeparator: '.',
819
+ thousandsSeparator: ',',
820
+ },
821
+ MGA: {
822
+ prefix: '¤',
823
+ suffix: '',
824
+ decimals: 1,
825
+ decimalSeparator: '.',
826
+ thousandsSeparator: ',',
827
+ },
828
+ MKD: {
829
+ prefix: 'ден',
830
+ suffix: '',
831
+ decimals: 2,
832
+ decimalSeparator: '.',
833
+ thousandsSeparator: ',',
834
+ },
835
+ MMK: {
836
+ prefix: 'K',
837
+ suffix: '',
838
+ decimals: 2,
839
+ decimalSeparator: '.',
840
+ thousandsSeparator: ',',
841
+ },
842
+ MNT: {
843
+ prefix: '₮',
844
+ suffix: '',
845
+ decimals: 2,
846
+ decimalSeparator: '.',
847
+ thousandsSeparator: ',',
848
+ },
849
+ MOP: {
850
+ prefix: 'P',
851
+ suffix: '',
852
+ decimals: 2,
853
+ decimalSeparator: '.',
854
+ thousandsSeparator: ',',
855
+ },
856
+ MRU: {
857
+ prefix: 'UM',
858
+ suffix: '',
859
+ decimals: 1,
860
+ decimalSeparator: '.',
861
+ thousandsSeparator: ',',
862
+ },
863
+ MUR: {
864
+ prefix: '₨',
865
+ suffix: '',
866
+ decimals: 2,
867
+ decimalSeparator: '.',
868
+ thousandsSeparator: ',',
869
+ },
870
+ MVR: {
871
+ prefix: '¤',
872
+ suffix: '',
873
+ decimals: 2,
874
+ decimalSeparator: '.',
875
+ thousandsSeparator: ',',
876
+ },
877
+ MWK: {
878
+ prefix: 'MK',
879
+ suffix: '',
880
+ decimals: 2,
881
+ decimalSeparator: '.',
882
+ thousandsSeparator: ',',
883
+ },
884
+ MXN: {
885
+ prefix: '$',
886
+ suffix: '',
887
+ decimals: 2,
888
+ decimalSeparator: '.',
889
+ thousandsSeparator: ',',
890
+ },
891
+ MYR: {
892
+ prefix: 'RM',
893
+ suffix: '',
894
+ decimals: 2,
895
+ decimalSeparator: '.',
896
+ thousandsSeparator: ',',
897
+ },
898
+ MZN: {
899
+ prefix: 'MTn',
900
+ suffix: '',
901
+ decimals: 2,
902
+ decimalSeparator: '.',
903
+ thousandsSeparator: ',',
904
+ },
905
+ NAD: {
906
+ prefix: '$',
907
+ suffix: '',
908
+ decimals: 2,
909
+ decimalSeparator: '.',
910
+ thousandsSeparator: ',',
911
+ },
912
+ NGN: {
913
+ prefix: '₦',
914
+ suffix: '',
915
+ decimals: 2,
916
+ decimalSeparator: '.',
917
+ thousandsSeparator: ',',
918
+ },
919
+ NIO: {
920
+ prefix: 'C$',
921
+ suffix: '',
922
+ decimals: 2,
923
+ decimalSeparator: '.',
924
+ thousandsSeparator: ',',
925
+ },
926
+ NOK: {
927
+ prefix: 'kr',
928
+ suffix: '',
929
+ decimals: 2,
930
+ decimalSeparator: '.',
931
+ thousandsSeparator: ',',
932
+ },
933
+ NPR: {
934
+ prefix: '₨',
935
+ suffix: '',
936
+ decimals: 2,
937
+ decimalSeparator: '.',
938
+ thousandsSeparator: ',',
939
+ },
940
+ NZD: {
941
+ prefix: '$',
942
+ suffix: '',
943
+ decimals: 2,
944
+ decimalSeparator: '.',
945
+ thousandsSeparator: ',',
946
+ },
947
+ OMR: {
948
+ prefix: '',
949
+ suffix: 'ر.ع.',
950
+ decimals: 3,
951
+ decimalSeparator: '.',
952
+ thousandsSeparator: ',',
953
+ },
954
+ PAB: {
955
+ prefix: 'B/.',
956
+ suffix: '',
957
+ decimals: 2,
958
+ decimalSeparator: '.',
959
+ thousandsSeparator: ',',
960
+ },
961
+ PEN: {
962
+ prefix: 'S/.',
963
+ suffix: '',
964
+ decimals: 2,
965
+ decimalSeparator: '.',
966
+ thousandsSeparator: ',',
967
+ },
968
+ PGK: {
969
+ prefix: 'K',
970
+ suffix: '',
971
+ decimals: 2,
972
+ decimalSeparator: '.',
973
+ thousandsSeparator: ',',
974
+ },
975
+ PHP: {
976
+ prefix: 'p',
977
+ suffix: '',
978
+ decimals: 2,
979
+ decimalSeparator: '.',
980
+ thousandsSeparator: ',',
981
+ },
982
+ PKR: {
983
+ prefix: '₨',
984
+ suffix: '',
985
+ decimals: 2,
986
+ decimalSeparator: '.',
987
+ thousandsSeparator: ',',
988
+ },
989
+ PLN: {
990
+ prefix: 'zł',
991
+ suffix: '',
992
+ decimals: 2,
993
+ decimalSeparator: '.',
994
+ thousandsSeparator: ',',
995
+ },
996
+ PYG: {
997
+ prefix: '¤',
998
+ suffix: '',
999
+ decimals: 0,
1000
+ decimalSeparator: '.',
1001
+ thousandsSeparator: ',',
1002
+ },
1003
+ QAR: {
1004
+ prefix: '',
1005
+ suffix: 'ر.ق',
1006
+ decimals: 2,
1007
+ decimalSeparator: '.',
1008
+ thousandsSeparator: ',',
1009
+ },
1010
+ RON: {
1011
+ prefix: 'L',
1012
+ suffix: '',
1013
+ decimals: 2,
1014
+ decimalSeparator: '.',
1015
+ thousandsSeparator: ',',
1016
+ },
1017
+ RSD: {
1018
+ prefix: 'дин.',
1019
+ suffix: '',
1020
+ decimals: 2,
1021
+ decimalSeparator: '.',
1022
+ thousandsSeparator: ',',
1023
+ },
1024
+ RUB: {
1025
+ prefix: 'руб.',
1026
+ suffix: '',
1027
+ decimals: 2,
1028
+ decimalSeparator: '.',
1029
+ thousandsSeparator: ',',
1030
+ },
1031
+ RWF: {
1032
+ prefix: 'Fr',
1033
+ suffix: '',
1034
+ decimals: 0,
1035
+ decimalSeparator: '.',
1036
+ thousandsSeparator: ',',
1037
+ },
1038
+ SAR: {
1039
+ prefix: '',
1040
+ suffix: 'ر.س',
1041
+ decimals: 2,
1042
+ decimalSeparator: '.',
1043
+ thousandsSeparator: ',',
1044
+ },
1045
+ SBD: {
1046
+ prefix: '$',
1047
+ suffix: '',
1048
+ decimals: 2,
1049
+ decimalSeparator: '.',
1050
+ thousandsSeparator: ',',
1051
+ },
1052
+ SCR: {
1053
+ prefix: '₨',
1054
+ suffix: '',
1055
+ decimals: 2,
1056
+ decimalSeparator: '.',
1057
+ thousandsSeparator: ',',
1058
+ },
1059
+ SDG: {
1060
+ prefix: '£',
1061
+ suffix: '',
1062
+ decimals: 2,
1063
+ decimalSeparator: '.',
1064
+ thousandsSeparator: ',',
1065
+ },
1066
+ SEK: {
1067
+ prefix: 'kr',
1068
+ suffix: '',
1069
+ decimals: 2,
1070
+ decimalSeparator: '.',
1071
+ thousandsSeparator: ',',
1072
+ },
1073
+ SGD: {
1074
+ prefix: '$',
1075
+ suffix: '',
1076
+ decimals: 2,
1077
+ decimalSeparator: '.',
1078
+ thousandsSeparator: ',',
1079
+ },
1080
+ SHP: {
1081
+ prefix: '£',
1082
+ suffix: '',
1083
+ decimals: 2,
1084
+ decimalSeparator: '.',
1085
+ thousandsSeparator: ',',
1086
+ },
1087
+ SKK: {
1088
+ prefix: 'Sk',
1089
+ suffix: '',
1090
+ decimals: 2,
1091
+ decimalSeparator: '.',
1092
+ thousandsSeparator: ',',
1093
+ },
1094
+ SLL: {
1095
+ prefix: 'Le',
1096
+ suffix: '',
1097
+ decimals: 2,
1098
+ decimalSeparator: '.',
1099
+ thousandsSeparator: ',',
1100
+ },
1101
+ SOS: {
1102
+ prefix: 'Sh',
1103
+ suffix: '',
1104
+ decimals: 2,
1105
+ decimalSeparator: '.',
1106
+ thousandsSeparator: ',',
1107
+ },
1108
+ SRD: {
1109
+ prefix: '$',
1110
+ suffix: '',
1111
+ decimals: 2,
1112
+ decimalSeparator: '.',
1113
+ thousandsSeparator: ',',
1114
+ },
1115
+ STN: {
1116
+ prefix: 'Db',
1117
+ suffix: '',
1118
+ decimals: 2,
1119
+ decimalSeparator: '.',
1120
+ thousandsSeparator: ',',
1121
+ },
1122
+ SVC: {
1123
+ prefix: '₡',
1124
+ suffix: '',
1125
+ decimals: 2,
1126
+ decimalSeparator: '.',
1127
+ thousandsSeparator: ',',
1128
+ },
1129
+ SYP: {
1130
+ prefix: '£',
1131
+ suffix: '',
1132
+ decimals: 2,
1133
+ decimalSeparator: '.',
1134
+ thousandsSeparator: ',',
1135
+ },
1136
+ SZL: {
1137
+ prefix: 'L',
1138
+ suffix: '',
1139
+ decimals: 2,
1140
+ decimalSeparator: '.',
1141
+ thousandsSeparator: ',',
1142
+ },
1143
+ THB: {
1144
+ prefix: '฿',
1145
+ suffix: '',
1146
+ decimals: 2,
1147
+ decimalSeparator: '.',
1148
+ thousandsSeparator: ',',
1149
+ },
1150
+ TJS: {
1151
+ prefix: 'ЅМ',
1152
+ suffix: '',
1153
+ decimals: 2,
1154
+ decimalSeparator: '.',
1155
+ thousandsSeparator: ',',
1156
+ },
1157
+ TMM: {
1158
+ prefix: 'm',
1159
+ suffix: '',
1160
+ decimals: 2,
1161
+ decimalSeparator: '.',
1162
+ thousandsSeparator: ',',
1163
+ },
1164
+ TND: {
1165
+ prefix: '',
1166
+ suffix: 'د.ت',
1167
+ decimals: 3,
1168
+ decimalSeparator: '.',
1169
+ thousandsSeparator: ',',
1170
+ },
1171
+ TOP: {
1172
+ prefix: 'T$',
1173
+ suffix: '',
1174
+ decimals: 2,
1175
+ decimalSeparator: '.',
1176
+ thousandsSeparator: ',',
1177
+ },
1178
+ TRY: {
1179
+ prefix: 'YTL',
1180
+ suffix: '',
1181
+ decimals: 2,
1182
+ decimalSeparator: '.',
1183
+ thousandsSeparator: ',',
1184
+ },
1185
+ TTD: {
1186
+ prefix: '$',
1187
+ suffix: '',
1188
+ decimals: 2,
1189
+ decimalSeparator: '.',
1190
+ thousandsSeparator: ',',
1191
+ },
1192
+ TWD: {
1193
+ prefix: '$',
1194
+ suffix: '',
1195
+ decimals: 2,
1196
+ decimalSeparator: '.',
1197
+ thousandsSeparator: ',',
1198
+ },
1199
+ TZS: {
1200
+ prefix: 'Sh',
1201
+ suffix: '',
1202
+ decimals: 2,
1203
+ decimalSeparator: '.',
1204
+ thousandsSeparator: ',',
1205
+ },
1206
+ UAH: {
1207
+ prefix: '¤',
1208
+ suffix: '',
1209
+ decimals: 2,
1210
+ decimalSeparator: '.',
1211
+ thousandsSeparator: ',',
1212
+ },
1213
+ UGX: {
1214
+ prefix: 'Sh',
1215
+ suffix: '',
1216
+ decimals: 0,
1217
+ decimalSeparator: '.',
1218
+ thousandsSeparator: ',',
1219
+ },
1220
+ USD: {
1221
+ prefix: '$',
1222
+ suffix: '',
1223
+ decimals: 2,
1224
+ decimalSeparator: '.',
1225
+ thousandsSeparator: ',',
1226
+ },
1227
+ UYU: {
1228
+ prefix: '$',
1229
+ suffix: '',
1230
+ decimals: 0,
1231
+ decimalSeparator: '.',
1232
+ thousandsSeparator: ',',
1233
+ },
1234
+ UZS: {
1235
+ prefix: '¤',
1236
+ suffix: '',
1237
+ decimals: 2,
1238
+ decimalSeparator: '.',
1239
+ thousandsSeparator: ',',
1240
+ },
1241
+ VEF: {
1242
+ prefix: 'Bs F',
1243
+ suffix: '',
1244
+ decimals: 2,
1245
+ decimalSeparator: '.',
1246
+ thousandsSeparator: ',',
1247
+ },
1248
+ VND: {
1249
+ prefix: '₫',
1250
+ suffix: '',
1251
+ decimals: 0,
1252
+ decimalSeparator: '.',
1253
+ thousandsSeparator: ',',
1254
+ },
1255
+ VUV: {
1256
+ prefix: 'Vt',
1257
+ suffix: '',
1258
+ decimals: 0,
1259
+ decimalSeparator: '.',
1260
+ thousandsSeparator: ',',
1261
+ },
1262
+ WST: {
1263
+ prefix: 'T',
1264
+ suffix: '',
1265
+ decimals: 2,
1266
+ decimalSeparator: '.',
1267
+ thousandsSeparator: ',',
1268
+ },
1269
+ XAF: {
1270
+ prefix: 'Fr',
1271
+ suffix: '',
1272
+ decimals: 0,
1273
+ decimalSeparator: '.',
1274
+ thousandsSeparator: ',',
1275
+ },
1276
+ XCD: {
1277
+ prefix: '$',
1278
+ suffix: '',
1279
+ decimals: 2,
1280
+ decimalSeparator: '.',
1281
+ thousandsSeparator: ',',
1282
+ },
1283
+ XOF: {
1284
+ prefix: 'Fr',
1285
+ suffix: '',
1286
+ decimals: 0,
1287
+ decimalSeparator: '.',
1288
+ thousandsSeparator: ',',
1289
+ },
1290
+ XPF: {
1291
+ prefix: 'Fr',
1292
+ suffix: '',
1293
+ decimals: 0,
1294
+ decimalSeparator: '.',
1295
+ thousandsSeparator: ',',
1296
+ },
1297
+ YER: {
1298
+ prefix: '¤',
1299
+ suffix: '',
1300
+ decimals: 2,
1301
+ decimalSeparator: '.',
1302
+ thousandsSeparator: ',',
1303
+ },
1304
+ ZAR: {
1305
+ prefix: 'R',
1306
+ suffix: '',
1307
+ decimals: 2,
1308
+ decimalSeparator: '.',
1309
+ thousandsSeparator: ',',
1310
+ },
1311
+ ZMW: {
1312
+ prefix: 'ZK',
1313
+ suffix: '',
1314
+ decimals: 2,
1315
+ decimalSeparator: '.',
1316
+ thousandsSeparator: ',',
1317
+ },
1318
+ ZWD: {
1319
+ prefix: '$',
1320
+ suffix: '',
1321
+ decimals: 2,
1322
+ decimalSeparator: '.',
1323
+ thousandsSeparator: ',',
1324
+ }, // '$9,999.99'
1325
+ };
1326
+ function formatCurrency(value, currencyCode = 'USD', explicit = false) {
1327
+ let processedCurrencyCode = currencyCode || '';
1328
+ let allowDecimal = true;
1329
+ if (processedCurrencyCode.includes('-integer')) {
1330
+ processedCurrencyCode = processedCurrencyCode.split('-integer')[0];
1331
+ allowDecimal = false;
1332
+ }
1333
+ const currencyFormat = currencyFormats[processedCurrencyCode];
1334
+ if (!currencyFormat) {
1335
+ return formatValue(value);
1336
+ }
1337
+ const options = Object.assign(Object.assign({}, currencyFormat), { allowDecimal: allowDecimal && currencyFormat.decimals > 0, allowNegative: false });
1338
+ return formatNumber(value, options, explicit);
1339
+ }
1340
+
1341
+ const phoneNumberFormats = {
1342
+ AF: {
1343
+ mask: '(##) #######',
1344
+ prefix: '+93 ',
1345
+ },
1346
+ AL: {
1347
+ mask: '#######',
1348
+ prefix: '+355 ',
1349
+ },
1350
+ DZ: {
1351
+ mask: '(##) ###-###',
1352
+ prefix: '+213 ',
1353
+ },
1354
+ // AS
1355
+ AD: {
1356
+ mask: '(#) #####',
1357
+ prefix: '+376 ',
1358
+ },
1359
+ AO: {
1360
+ mask: '#########',
1361
+ prefix: '+244 ',
1362
+ },
1363
+ AI: {
1364
+ mask: '(###) ###-####',
1365
+ prefix: '+1 ',
1366
+ },
1367
+ AG: {
1368
+ mask: '(###) ###-####',
1369
+ prefix: '+1 ',
1370
+ },
1371
+ AR: {
1372
+ mask: '##########',
1373
+ prefix: '+54 ',
1374
+ },
1375
+ AM: {
1376
+ mask: '########',
1377
+ prefix: '+375 ',
1378
+ },
1379
+ AQ: {
1380
+ mask: '##-####',
1381
+ prefix: '+672 ',
1382
+ },
1383
+ AW: {
1384
+ mask: '###-####',
1385
+ prefix: '+297 ',
1386
+ },
1387
+ AU: {
1388
+ mask: '(##) ####-####',
1389
+ prefix: '+61 ',
1390
+ },
1391
+ /* AT: {
1392
+ mask:'####?????????',
1393
+ prefix: ''
1394
+ }, */
1395
+ AT: {
1396
+ mask: '#############',
1397
+ prefix: '+43 ',
1398
+ },
1399
+ /* AZ: {
1400
+ mask:'########?',
1401
+ prefix: ''
1402
+ }, */
1403
+ AZ: {
1404
+ mask: '#########',
1405
+ prefix: '+994 ',
1406
+ },
1407
+ BS: {
1408
+ mask: '(###) ###-####',
1409
+ prefix: '+1 ',
1410
+ },
1411
+ BH: {
1412
+ mask: '####-####',
1413
+ prefix: '+973 ',
1414
+ },
1415
+ /* BD: {
1416
+ mask:'#######??',
1417
+ prefix: ''
1418
+ }, */
1419
+ BD: {
1420
+ mask: '#########',
1421
+ prefix: '+880 ',
1422
+ },
1423
+ BB: {
1424
+ mask: '(###) ###-####',
1425
+ prefix: '+1 ',
1426
+ },
1427
+ BY: {
1428
+ mask: '#########',
1429
+ prefix: '+375 ',
1430
+ },
1431
+ BE: {
1432
+ mask: '########??',
1433
+ prefix: '+32 ',
1434
+ },
1435
+ BZ: {
1436
+ mask: '#######',
1437
+ prefix: '+501 ',
1438
+ },
1439
+ BJ: {
1440
+ mask: '(##) ###-###',
1441
+ prefix: '+229 ',
1442
+ },
1443
+ BM: {
1444
+ mask: '(###) ###-####',
1445
+ prefix: '+1 ',
1446
+ },
1447
+ BT: {
1448
+ mask: '(#) ###-###',
1449
+ prefix: '+975 ',
1450
+ },
1451
+ BO: {
1452
+ mask: '(#) ###-####',
1453
+ prefix: '+591 ',
1454
+ },
1455
+ BA: {
1456
+ mask: '(##) ##-##-##',
1457
+ prefix: '+387 ',
1458
+ },
1459
+ /* BW: {
1460
+ mask:'#######?',
1461
+ prefix: ''
1462
+ }, */
1463
+ BW: {
1464
+ mask: '########',
1465
+ prefix: '+267 ',
1466
+ },
1467
+ BR: {
1468
+ mask: '(##) ####-####',
1469
+ prefix: '+55 ',
1470
+ },
1471
+ BN: {
1472
+ mask: '###-####',
1473
+ prefix: '+673 ',
1474
+ },
1475
+ BG: {
1476
+ mask: '#######?',
1477
+ prefix: '+359 ',
1478
+ },
1479
+ BF: {
1480
+ mask: '##-##-##-##',
1481
+ prefix: '+226 ',
1482
+ },
1483
+ BI: {
1484
+ mask: '####-####',
1485
+ prefix: '+257 ',
1486
+ },
1487
+ KH: {
1488
+ mask: '(##) ######',
1489
+ prefix: '+855 ',
1490
+ },
1491
+ CM: {
1492
+ mask: '####-####',
1493
+ prefix: '+237 ',
1494
+ },
1495
+ CA: {
1496
+ mask: '(###) ###-####',
1497
+ prefix: '+1 ',
1498
+ },
1499
+ CV: {
1500
+ mask: '###-####',
1501
+ prefix: '+238 ',
1502
+ },
1503
+ KY: {
1504
+ mask: '(###) ###-####',
1505
+ prefix: '+1 ',
1506
+ },
1507
+ CF: {
1508
+ mask: '###-###',
1509
+ prefix: '+236 ',
1510
+ },
1511
+ TD: {
1512
+ mask: '###-##-##',
1513
+ prefix: '+235 ',
1514
+ },
1515
+ /* CL: {
1516
+ mask:'########?',
1517
+ prefix: ''
1518
+ }, */
1519
+ CL: {
1520
+ mask: '#########',
1521
+ prefix: '+56 ',
1522
+ },
1523
+ /* CN: {
1524
+ mask:'########???',
1525
+ prefix: ''
1526
+ }, */
1527
+ CN: {
1528
+ mask: '###########',
1529
+ prefix: '+86 ',
1530
+ },
1531
+ /* CO: {
1532
+ mask:'########??',
1533
+ prefix: ''
1534
+ }, */
1535
+ CO: {
1536
+ mask: '##########',
1537
+ prefix: '57 ',
1538
+ },
1539
+ KM: {
1540
+ mask: '###-####',
1541
+ prefix: '+269 ',
1542
+ },
1543
+ CD: {
1544
+ mask: '###-####',
1545
+ prefix: '+243 ',
1546
+ },
1547
+ CG: {
1548
+ mask: '###-####',
1549
+ prefix: '+242 ',
1550
+ },
1551
+ // CK
1552
+ CR: {
1553
+ mask: '####-####',
1554
+ prefix: '+506 ',
1555
+ },
1556
+ CI: {
1557
+ mask: '####-####',
1558
+ prefix: '+225 ',
1559
+ },
1560
+ HR: {
1561
+ mask: '########?',
1562
+ prefix: '+385 ',
1563
+ },
1564
+ /* CU: {
1565
+ mask:'#####?ID:?????',
1566
+ prefix: ''
1567
+ }, */
1568
+ CU: {
1569
+ mask: '###########',
1570
+ prefix: '+53 ',
1571
+ },
1572
+ CY: {
1573
+ mask: '####-####',
1574
+ prefix: '+357 ',
1575
+ },
1576
+ CZ: {
1577
+ mask: '#########',
1578
+ prefix: '+420 ',
1579
+ },
1580
+ DK: {
1581
+ mask: '####-####',
1582
+ prefix: '+45 ',
1583
+ },
1584
+ DJ: {
1585
+ mask: '##-##-##-##',
1586
+ prefix: '+253 ',
1587
+ },
1588
+ DM: {
1589
+ mask: '(###) ###-####',
1590
+ prefix: '+1 ',
1591
+ },
1592
+ DO: {
1593
+ mask: '(###) ###-####',
1594
+ prefix: '+1 ',
1595
+ },
1596
+ TL: {
1597
+ mask: '###-####',
1598
+ prefix: '+670 ',
1599
+ },
1600
+ EC: {
1601
+ mask: '(##) ###-####',
1602
+ prefix: '+593 ',
1603
+ },
1604
+ /* EG: {
1605
+ mask:'########??',
1606
+ prefix: ''
1607
+ }, */
1608
+ EG: {
1609
+ mask: '##########',
1610
+ prefix: '+20 ',
1611
+ },
1612
+ SV: {
1613
+ mask: '####-####',
1614
+ prefix: '+503 ',
1615
+ },
1616
+ GQ: {
1617
+ mask: '##-####',
1618
+ prefix: '+240 ',
1619
+ },
1620
+ // ER:
1621
+ EE: {
1622
+ mask: '#######?',
1623
+ prefix: '+372 ',
1624
+ },
1625
+ ET: {
1626
+ mask: '(##) ###-####',
1627
+ prefix: '+251 ',
1628
+ },
1629
+ FK: {
1630
+ mask: '#####',
1631
+ prefix: '+500 ',
1632
+ },
1633
+ FO: {
1634
+ mask: '######',
1635
+ prefix: '+298 ',
1636
+ },
1637
+ FJ: {
1638
+ mask: '###-####',
1639
+ prefix: '+679 ',
1640
+ },
1641
+ /* FI: {
1642
+ mask:'#####???????',
1643
+ prefix: ''
1644
+ }, */
1645
+ FI: {
1646
+ mask: '############',
1647
+ prefix: '+358 ',
1648
+ },
1649
+ FR: {
1650
+ mask: '#########',
1651
+ prefix: '+33 ',
1652
+ },
1653
+ /* GF: {
1654
+ mask:'#########?',
1655
+ prefix: ''
1656
+ }, */
1657
+ GF: {
1658
+ mask: '##########',
1659
+ prefix: '+594 ',
1660
+ },
1661
+ PF: {
1662
+ mask: '######',
1663
+ prefix: '+689 ',
1664
+ },
1665
+ GA: {
1666
+ mask: '######?',
1667
+ prefix: '+241 ',
1668
+ },
1669
+ GM: {
1670
+ mask: '###-####',
1671
+ prefix: '+220 ',
1672
+ },
1673
+ GE: {
1674
+ mask: '########',
1675
+ prefix: '+995 ',
1676
+ },
1677
+ /* DE: {
1678
+ mask:'######?????',
1679
+ prefix: ''
1680
+ }, */
1681
+ DE: {
1682
+ mask: '###########',
1683
+ prefix: '+49 ',
1684
+ },
1685
+ /* GH: {
1686
+ mask:'########?',
1687
+ prefix: ''
1688
+ }, */
1689
+ GH: {
1690
+ mask: '#########',
1691
+ prefix: '+233 ',
1692
+ },
1693
+ GI: {
1694
+ mask: '####-####',
1695
+ prefix: '+350 ',
1696
+ },
1697
+ GR: {
1698
+ mask: '##########',
1699
+ prefix: '+30 ',
1700
+ },
1701
+ GL: {
1702
+ mask: '###-###',
1703
+ prefix: '+299 ',
1704
+ },
1705
+ GD: {
1706
+ mask: '(###) ###-####',
1707
+ prefix: '+1 ',
1708
+ },
1709
+ GP: {
1710
+ mask: '##########',
1711
+ prefix: '+590 ',
1712
+ },
1713
+ GU: {
1714
+ mask: '(###) ###-####',
1715
+ prefix: '+1 ',
1716
+ },
1717
+ GT: {
1718
+ mask: '####-####',
1719
+ prefix: '+502 ',
1720
+ },
1721
+ GN: {
1722
+ mask: '####-####',
1723
+ prefix: '+224 ',
1724
+ },
1725
+ GW: {
1726
+ mask: '###-####',
1727
+ prefix: '+245 ',
1728
+ },
1729
+ GY: {
1730
+ mask: '(###) ####',
1731
+ prefix: '+592 ',
1732
+ },
1733
+ HK: {
1734
+ mask: '####-####',
1735
+ prefix: '+852 ',
1736
+ },
1737
+ HN: {
1738
+ mask: '########',
1739
+ prefix: '+504 ',
1740
+ },
1741
+ HT: {
1742
+ mask: '####-####',
1743
+ prefix: '+509 ',
1744
+ },
1745
+ HU: {
1746
+ mask: '########??',
1747
+ prefix: '+36 ',
1748
+ },
1749
+ /* IS: {
1750
+ mask:'#######??',
1751
+ prefix: ''
1752
+ }, */
1753
+ IS: {
1754
+ mask: '#########',
1755
+ prefix: '+354 ',
1756
+ },
1757
+ IN: {
1758
+ mask: '##########',
1759
+ prefix: '+91 ',
1760
+ },
1761
+ /* ID: {
1762
+ mask:'#######???',
1763
+ prefix: ''
1764
+ }, */
1765
+ ID: {
1766
+ mask: '#######??????',
1767
+ prefix: '+62 ',
1768
+ },
1769
+ IR: {
1770
+ mask: '##########',
1771
+ prefix: '+98 ',
1772
+ },
1773
+ /* IQ: {
1774
+ mask:'########??',
1775
+ prefix: ''
1776
+ }, */
1777
+ IQ: {
1778
+ mask: '##########',
1779
+ prefix: '+964 ',
1780
+ },
1781
+ /* IE: {
1782
+ mask:'#######??',
1783
+ prefix: ''
1784
+ }, */
1785
+ IE: {
1786
+ mask: '#########',
1787
+ prefix: '+353 ',
1788
+ },
1789
+ /* IL: {
1790
+ mask:'########?',
1791
+ prefix: ''
1792
+ }, */
1793
+ IL: {
1794
+ mask: '#########',
1795
+ prefix: '+972 ',
1796
+ },
1797
+ /* IT: {
1798
+ mask:'######????',
1799
+ prefix: ''
1800
+ }, */
1801
+ IT: {
1802
+ mask: '##########',
1803
+ prefix: '+39 ',
1804
+ },
1805
+ JM: {
1806
+ mask: '(###) ###-####',
1807
+ prefix: '+1 ',
1808
+ },
1809
+ JP: {
1810
+ mask: '#########',
1811
+ prefix: '+81 ',
1812
+ },
1813
+ /* JO: {
1814
+ mask:'#######??',
1815
+ prefix: ''
1816
+ }, */
1817
+ JO: {
1818
+ mask: '#########',
1819
+ prefix: '+962 ',
1820
+ },
1821
+ KZ: {
1822
+ mask: '(###) ####-###',
1823
+ prefix: '+7 ',
1824
+ },
1825
+ /* KE: {
1826
+ mask:'######????',
1827
+ prefix: ''
1828
+ }, */
1829
+ KE: {
1830
+ mask: '##########',
1831
+ prefix: '+254 ',
1832
+ },
1833
+ KI: {
1834
+ mask: '##-###',
1835
+ prefix: '+686 ',
1836
+ },
1837
+ // kp
1838
+ /* KR: {
1839
+ mask:'####??????',
1840
+ prefix: ''
1841
+ }, */
1842
+ KR: {
1843
+ mask: '##########',
1844
+ prefix: '+82 ',
1845
+ },
1846
+ KW: {
1847
+ mask: '####-####',
1848
+ prefix: '+965 ',
1849
+ },
1850
+ KG: {
1851
+ mask: '#########',
1852
+ prefix: '+996 ',
1853
+ },
1854
+ LA: {
1855
+ mask: '########?',
1856
+ prefix: '+856 ',
1857
+ },
1858
+ LV: {
1859
+ mask: '####-####',
1860
+ prefix: '+371 ',
1861
+ },
1862
+ LB: {
1863
+ mask: '#######?',
1864
+ prefix: '+961 ',
1865
+ },
1866
+ LS: {
1867
+ mask: '##-###-###',
1868
+ prefix: '+266 ',
1869
+ },
1870
+ // LR
1871
+ /* LY: {
1872
+ mask:'########?',
1873
+ prefix: ''
1874
+ }, */
1875
+ LY: {
1876
+ mask: '########?',
1877
+ prefix: '+218 ',
1878
+ },
1879
+ LI: {
1880
+ mask: '###-####',
1881
+ prefix: '+423 ',
1882
+ },
1883
+ LT: {
1884
+ mask: '########',
1885
+ prefix: '+370 ',
1886
+ },
1887
+ /* LU: {
1888
+ mask:'#####??????',
1889
+ prefix: '+352 '
1890
+ }, */
1891
+ LU: {
1892
+ mask: '###########',
1893
+ prefix: '+352 ',
1894
+ },
1895
+ MO: {
1896
+ mask: '####-####',
1897
+ prefix: '+853 ',
1898
+ },
1899
+ MK: {
1900
+ mask: '########',
1901
+ prefix: '+389 ',
1902
+ },
1903
+ MG: {
1904
+ mask: '##-##-###-##',
1905
+ prefix: '+261 ',
1906
+ },
1907
+ /* MW: {
1908
+ mask:'#######??',
1909
+ prefix: '+265 '
1910
+ }, */
1911
+ MW: {
1912
+ mask: '#########',
1913
+ prefix: '+265 ',
1914
+ },
1915
+ /* MY: {
1916
+ mask:'#######???',
1917
+ prefix: '+60 '
1918
+ }, */
1919
+ MY: {
1920
+ mask: '##########',
1921
+ prefix: '+60 ',
1922
+ },
1923
+ MV: {
1924
+ mask: '###-####',
1925
+ prefix: '+960 ',
1926
+ },
1927
+ ML: {
1928
+ mask: '####-####',
1929
+ prefix: '+223 ',
1930
+ },
1931
+ MT: {
1932
+ mask: '##-##-##-##',
1933
+ prefix: '+356 ',
1934
+ },
1935
+ MH: {
1936
+ mask: '###-####',
1937
+ prefix: '+692 ',
1938
+ },
1939
+ MQ: {
1940
+ mask: '###-######',
1941
+ prefix: '+596 ',
1942
+ },
1943
+ // MR
1944
+ MU: {
1945
+ mask: '###-####',
1946
+ prefix: '+230 ',
1947
+ },
1948
+ // YT
1949
+ MX: {
1950
+ mask: '(###) ###-####',
1951
+ prefix: '+52 ',
1952
+ },
1953
+ // FM
1954
+ MD: {
1955
+ mask: '########',
1956
+ prefix: '+373 ',
1957
+ },
1958
+ MC: {
1959
+ mask: '####-####',
1960
+ prefix: '+377 ',
1961
+ },
1962
+ /* MN: {
1963
+ mask:'######?????',
1964
+ prefix: '+976 '
1965
+ }, */
1966
+ MN: {
1967
+ mask: '###########',
1968
+ prefix: '+976 ',
1969
+ },
1970
+ MS: {
1971
+ mask: '(###) ###-####',
1972
+ prefix: '+1 ',
1973
+ },
1974
+ MA: {
1975
+ mask: '#########?',
1976
+ prefix: '+212 ',
1977
+ },
1978
+ /* MZ: {
1979
+ mask:'########?',
1980
+ prefix: '+258 '
1981
+ }, */
1982
+ MZ: {
1983
+ mask: '#########',
1984
+ prefix: '+258 ',
1985
+ },
1986
+ /* MM: {
1987
+ mask:'#######?',
1988
+ prefix: '+95 '
1989
+ }, */
1990
+ MM: {
1991
+ mask: '########',
1992
+ prefix: '+95 ',
1993
+ },
1994
+ /* NA: {
1995
+ mask:'######????',
1996
+ prefix: '+264 '
1997
+ }, */
1998
+ NA: {
1999
+ mask: '##########',
2000
+ prefix: '+264 ',
2001
+ },
2002
+ // NR
2003
+ /* NP: {
2004
+ mask:'########??',
2005
+ prefix: '+977 '
2006
+ }, */
2007
+ NP: {
2008
+ mask: '##########',
2009
+ prefix: '+977 ',
2010
+ },
2011
+ NL: {
2012
+ mask: '#########',
2013
+ prefix: '+31 ',
2014
+ },
2015
+ /* AN: {
2016
+ mask:'#######?',
2017
+ prefix: '+599 '
2018
+ }, */
2019
+ AN: {
2020
+ mask: '########',
2021
+ prefix: '+599 ',
2022
+ },
2023
+ NC: {
2024
+ mask: '###-###',
2025
+ prefix: '+687 ',
2026
+ },
2027
+ /* NZ: {
2028
+ mask:'########??',
2029
+ prefix: '+64 '
2030
+ }, */
2031
+ NZ: {
2032
+ mask: '##########',
2033
+ prefix: '+64 ',
2034
+ },
2035
+ NI: {
2036
+ mask: '####-####',
2037
+ prefix: '+505 ',
2038
+ },
2039
+ NE: {
2040
+ mask: '##-###-###',
2041
+ prefix: '+227 ',
2042
+ },
2043
+ /* NG: {
2044
+ mask:'########??',
2045
+ prefix: '+234 '
2046
+ }, */
2047
+ NG: {
2048
+ mask: '##########',
2049
+ prefix: '+234 ',
2050
+ },
2051
+ // NU
2052
+ MP: {
2053
+ mask: '(###) ###-####',
2054
+ prefix: '+1 ',
2055
+ },
2056
+ NO: {
2057
+ mask: '####-####',
2058
+ prefix: '+47 ',
2059
+ },
2060
+ OM: {
2061
+ mask: '####-####',
2062
+ prefix: '+968 ',
2063
+ },
2064
+ /* PK: {
2065
+ mask:'#########?',
2066
+ prefix: '+92 '
2067
+ }, */
2068
+ PK: {
2069
+ mask: '##########',
2070
+ prefix: '+92 ',
2071
+ },
2072
+ PW: {
2073
+ mask: '###-####',
2074
+ prefix: '+680 ',
2075
+ },
2076
+ /* PA: {
2077
+ mask:'#######?',
2078
+ prefix: '+507 '
2079
+ }, */
2080
+ PA: {
2081
+ mask: '########',
2082
+ prefix: '+507 ',
2083
+ },
2084
+ /* PG: {
2085
+ mask:'#######?',
2086
+ prefix: '+675 '
2087
+ }, */
2088
+ PG: {
2089
+ mask: '########',
2090
+ prefix: '+675 ',
2091
+ },
2092
+ // PY
2093
+ /* PE: {
2094
+ mask:'#######????',
2095
+ prefix: '+51 '
2096
+ }, */
2097
+ PE: {
2098
+ mask: '###########',
2099
+ prefix: '+51 ',
2100
+ },
2101
+ /* PH: {
2102
+ mask:'########??',
2103
+ prefix: '+63 '
2104
+ }, */
2105
+ PH: {
2106
+ mask: '##########',
2107
+ prefix: '+63 ',
2108
+ },
2109
+ PL: {
2110
+ mask: '#########',
2111
+ prefix: '+48 ',
2112
+ },
2113
+ PT: {
2114
+ mask: '#-####-####',
2115
+ prefix: '+351 ',
2116
+ },
2117
+ PR: {
2118
+ mask: '(###) ###-####',
2119
+ prefix: '+1 ',
2120
+ },
2121
+ QA: {
2122
+ mask: '###-####',
2123
+ prefix: '+974 ',
2124
+ },
2125
+ RE: {
2126
+ mask: '###-###-###',
2127
+ prefix: '+262 ',
2128
+ },
2129
+ RO: {
2130
+ mask: '#########',
2131
+ prefix: '+40 ',
2132
+ },
2133
+ RU: {
2134
+ mask: '##########',
2135
+ prefix: '+7 ',
2136
+ },
2137
+ RW: {
2138
+ mask: '###-###-###',
2139
+ prefix: '+250 ',
2140
+ },
2141
+ SH: {
2142
+ mask: '#-###',
2143
+ prefix: '+290 ',
2144
+ },
2145
+ // PM
2146
+ KN: {
2147
+ mask: '(###) ###-####',
2148
+ prefix: '+1 ',
2149
+ },
2150
+ LC: {
2151
+ mask: '(###) ###-####',
2152
+ prefix: '+1 ',
2153
+ },
2154
+ VC: {
2155
+ mask: '(###) ###-####',
2156
+ prefix: '+1 ',
2157
+ },
2158
+ // WS
2159
+ // SM
2160
+ ST: {
2161
+ mask: '##-####',
2162
+ prefix: '+239 ',
2163
+ },
2164
+ /* SA: {
2165
+ mask:'########?',
2166
+ prefix: '+966 '
2167
+ }, */
2168
+ SA: {
2169
+ mask: '#########',
2170
+ prefix: '+966 ',
2171
+ },
2172
+ SN: {
2173
+ mask: '##-###-####',
2174
+ prefix: '+221 ',
2175
+ },
2176
+ SC: {
2177
+ mask: '###-###',
2178
+ prefix: '+248 ',
2179
+ },
2180
+ SL: {
2181
+ mask: '(##) ###-###',
2182
+ prefix: '+232 ',
2183
+ },
2184
+ SG: {
2185
+ mask: '####-####',
2186
+ prefix: '+65 ',
2187
+ },
2188
+ SK: {
2189
+ mask: '#########',
2190
+ prefix: '+421 ',
2191
+ },
2192
+ SI: {
2193
+ mask: '########',
2194
+ prefix: '+386 ',
2195
+ },
2196
+ SB: {
2197
+ mask: '##-###',
2198
+ prefix: '+677 ',
2199
+ },
2200
+ // SO
2201
+ ZA: {
2202
+ mask: '(##) ###-####',
2203
+ prefix: '+27 ',
2204
+ },
2205
+ ES: {
2206
+ mask: '###-###-###',
2207
+ prefix: '+34 ',
2208
+ },
2209
+ LK: {
2210
+ mask: '(##) ###-####',
2211
+ prefix: '+94 ',
2212
+ },
2213
+ SD: {
2214
+ mask: '##-###-####',
2215
+ prefix: '+249 ',
2216
+ },
2217
+ SR: {
2218
+ mask: '######?',
2219
+ prefix: '+597 ',
2220
+ },
2221
+ SZ: {
2222
+ mask: '###-####',
2223
+ prefix: '+268 ',
2224
+ },
2225
+ /* SE: {
2226
+ mask:'######?????',
2227
+ prefix: '+46 '
2228
+ }, */
2229
+ SE: {
2230
+ mask: '###########',
2231
+ prefix: '+46 ',
2232
+ },
2233
+ CH: {
2234
+ mask: '(##) ###-####',
2235
+ prefix: '+41 ',
2236
+ },
2237
+ /* SY: {
2238
+ mask:'########?',
2239
+ prefix: '+963 '
2240
+ }, */
2241
+ SY: {
2242
+ mask: '#########',
2243
+ prefix: '+963 ',
2244
+ },
2245
+ TJ: {
2246
+ mask: '#########',
2247
+ prefix: '+992 ',
2248
+ },
2249
+ TZ: {
2250
+ mask: '#########',
2251
+ prefix: '+255 ',
2252
+ },
2253
+ /* TH: {
2254
+ mask:'########?',
2255
+ prefix: '+66 '
2256
+ }, */
2257
+ TH: {
2258
+ mask: '#########',
2259
+ prefix: '+66 ',
2260
+ },
2261
+ TG: {
2262
+ mask: '###-####',
2263
+ prefix: '+228 ',
2264
+ },
2265
+ // TK
2266
+ // TO
2267
+ TT: {
2268
+ mask: '(###) ###-####',
2269
+ prefix: '+1 ',
2270
+ },
2271
+ TN: {
2272
+ mask: '##-###-###',
2273
+ prefix: '+216 ',
2274
+ },
2275
+ TR: {
2276
+ mask: '(###) ###-####',
2277
+ prefix: '+90 ',
2278
+ },
2279
+ TM: {
2280
+ mask: '########',
2281
+ prefix: '+993 ',
2282
+ },
2283
+ TC: {
2284
+ mask: '(###) ###-####',
2285
+ prefix: '+1 ',
2286
+ },
2287
+ // TV
2288
+ UG: {
2289
+ mask: '#########',
2290
+ prefix: '+256 ',
2291
+ },
2292
+ UA: {
2293
+ mask: '(##) ###-####',
2294
+ prefix: '+380 ',
2295
+ },
2296
+ /* AE: {
2297
+ mask:'########?',
2298
+ prefix: '+971 '
2299
+ }, */
2300
+ AE: {
2301
+ mask: '#########',
2302
+ prefix: '+971 ',
2303
+ },
2304
+ /* GB: {
2305
+ mask:'##########???',
2306
+ prefix: '+44 '
2307
+ }, */
2308
+ GB: {
2309
+ mask: '#########????',
2310
+ prefix: '+44 ',
2311
+ },
2312
+ UY: {
2313
+ mask: '########?',
2314
+ prefix: '+598 ',
2315
+ },
2316
+ UZ: {
2317
+ mask: '(##) ###-####',
2318
+ prefix: '+998 ',
2319
+ },
2320
+ // VU
2321
+ // VA
2322
+ VE: {
2323
+ mask: '(###) ###-####',
2324
+ prefix: '+58 ',
2325
+ },
2326
+ VN: {
2327
+ mask: '#######????',
2328
+ prefix: '+84 ',
2329
+ },
2330
+ VG: {
2331
+ mask: '(###) ###-####',
2332
+ prefix: '+1 ',
2333
+ },
2334
+ VI: {
2335
+ mask: '(###) ###-####',
2336
+ prefix: '+1 ',
2337
+ },
2338
+ // WF
2339
+ /* YE: {
2340
+ mask:'#######??',
2341
+ prefix: '+967 '
2342
+ }, */
2343
+ YE: {
2344
+ mask: '#########',
2345
+ prefix: '+967 ',
2346
+ },
2347
+ // YU
2348
+ ZM: {
2349
+ mask: '#########',
2350
+ prefix: '+260 ',
2351
+ },
2352
+ /* ZW: {
2353
+ mask:'####?????',
2354
+ prefix: '+263 '
2355
+ }, */
2356
+ ZW: {
2357
+ mask: '#########',
2358
+ prefix: '+263 ',
2359
+ },
2360
+ AC: {
2361
+ mask: '####',
2362
+ prefix: '+247 ',
2363
+ },
2364
+ ME: {
2365
+ mask: '(##) ###-####',
2366
+ prefix: '+382 ',
2367
+ },
2368
+ /* PS: {
2369
+ mask:'########?',
2370
+ prefix: '+970 '
2371
+ }, */
2372
+ PS: {
2373
+ mask: '#########',
2374
+ prefix: '+970 ',
2375
+ },
2376
+ /* RS: {
2377
+ mask:'#######??',
2378
+ prefix: '+381 '
2379
+ }, */
2380
+ RS: {
2381
+ mask: '#########',
2382
+ prefix: '+381 ',
2383
+ },
2384
+ /* TW: {
2385
+ mask:'########?',
2386
+ prefix: '+886 '
2387
+ }, */
2388
+ TW: {
2389
+ mask: '#########',
2390
+ prefix: '+886 ',
2391
+ },
2392
+ CW: {
2393
+ mask: '#-###-####',
2394
+ prefix: '+599 ',
2395
+ },
2396
+ US: {
2397
+ mask: '(###) ###-####',
2398
+ prefix: '',
2399
+ },
2400
+ };
2401
+ function formatPhoneNumber(value, isoCode = 'US') {
2402
+ const { mask, prefix } = phoneNumberFormats[isoCode] || phoneNumberFormats.US;
2403
+ const options = {
2404
+ prefix,
2405
+ };
2406
+ const val = value || '';
2407
+ // Brazil need edge case handle, mobile: (xx) xxxxx-xxxx, land phone: (xx) xxxx-xxxx
2408
+ if (isoCode === 'BR' && val.replace(/[^0-9]/g, '').length === 11) {
2409
+ return formatValue(val, '(##) #####-####', options);
2410
+ }
2411
+ else {
2412
+ return formatValue(val, mask, options);
2413
+ }
2414
+ }
2415
+
2416
+ function formatSSN(value) {
2417
+ return formatValue(value, '###-##-####');
2418
+ }
2419
+
2420
+ function formatAlphanumeric(value) {
2421
+ const val = (value || '').replace(/[^\da-zA-Z]/g, '');
2422
+ return formatValue(val);
2423
+ }
2424
+
2425
+ function formatAlpha(value, modifier) {
2426
+ let val = value || '';
2427
+ if (modifier === 'spaced') {
2428
+ val = val.replace(/[^a-zA-Z ]/g, '');
2429
+ }
2430
+ else {
2431
+ val = val.replace(/[^a-zA-Z]/g, '');
2432
+ }
2433
+ return formatValue(val);
2434
+ }
2435
+
2436
+ const numberFormats = {
2437
+ delimited: {
2438
+ prefix: '',
2439
+ suffix: '',
2440
+ decimals: 0,
2441
+ decimalSeparator: '.',
2442
+ thousandsSeparator: ',',
2443
+ allowDecimal: false,
2444
+ allowNegative: true,
2445
+ },
2446
+ integer: {
2447
+ prefix: '',
2448
+ suffix: '',
2449
+ decimals: 0,
2450
+ decimalSeparator: '.',
2451
+ thousandsSeparator: '',
2452
+ allowDecimal: true,
2453
+ allowNegative: true,
2454
+ },
2455
+ dec: {
2456
+ prefix: '',
2457
+ suffix: '',
2458
+ decimals: 2,
2459
+ decimalSeparator: '.',
2460
+ thousandsSeparator: ',',
2461
+ allowDecimal: true,
2462
+ allowNegative: true,
2463
+ },
2464
+ };
2465
+ function getNumberFormat(key) {
2466
+ let decimals;
2467
+ if (key.includes('dec')) {
2468
+ decimals = Number(key.replace('dec', ''));
2469
+ key = 'dec';
2470
+ }
2471
+ let numberFormat = numberFormats[key];
2472
+ if (!numberFormat) {
2473
+ return;
2474
+ }
2475
+ numberFormat = Object.assign({}, numberFormat);
2476
+ if (decimals) {
2477
+ numberFormat.decimals = decimals;
2478
+ }
2479
+ return numberFormat;
2480
+ }
2481
+ function formatNumeric(value = '', modifier = '', explicit = false) {
2482
+ const numberFormat = getNumberFormat(modifier);
2483
+ if (!numberFormat) {
2484
+ const val = (value || '').replace(/[^\d.,-]/g, '');
2485
+ return formatValue(val);
2486
+ }
2487
+ return formatNumber(value, numberFormat, explicit);
2488
+ }
2489
+ function formatPercentage(value = '', modifier = '', explicit = false) {
2490
+ const numberFormat = getNumberFormat(modifier);
2491
+ if (!numberFormat) {
2492
+ const val = (value || '').replace(/[^\d.,-]/g, '');
2493
+ return formatValue(val, undefined, { suffix: '%' });
2494
+ }
2495
+ numberFormat.suffix = '%';
2496
+ return formatNumber(value, numberFormat, explicit);
2497
+ }
2498
+
2499
+ const postalCodeFormats = {
2500
+ AF: '####',
2501
+ AL: '####',
2502
+ DZ: '#####',
2503
+ AC: 'ASCN 1ZZ',
2504
+ AD: 'AD###',
2505
+ AR: '####',
2506
+ 'AR+': '@####@@@',
2507
+ AI: 'AI-2640',
2508
+ AM: '####',
2509
+ AS: '#####',
2510
+ 'AS+4': '#####-####',
2511
+ AU: '####',
2512
+ AT: '####',
2513
+ AZ: 'AZ ####',
2514
+ BH: '###?',
2515
+ BD: '####',
2516
+ BB: 'BB#####',
2517
+ BY: '######',
2518
+ BE: '####',
2519
+ BM: '@@ **',
2520
+ BT: '#####',
2521
+ BA: '######',
2522
+ BR: '#####',
2523
+ 'BR+3': '#####-###',
2524
+ VG: 'VG####',
2525
+ BN: '@@####',
2526
+ BG: '####',
2527
+ KH: '#####',
2528
+ KY: 'KY#-####',
2529
+ CA: '@#@ #@#',
2530
+ CL: '###-####',
2531
+ CN: '######',
2532
+ CX: '####',
2533
+ CC: '####',
2534
+ CO: '######',
2535
+ CR: '#####',
2536
+ 'CR+4': '#####-####',
2537
+ CV: '####',
2538
+ HR: '#####',
2539
+ CU: '#####',
2540
+ CY: '####',
2541
+ CZ: '### ##',
2542
+ DK: '####',
2543
+ DO: '#####',
2544
+ EC: '######',
2545
+ SV: '####',
2546
+ EG: '#####',
2547
+ EE: '#####',
2548
+ ET: '####',
2549
+ FK: 'FIQQ 1ZZ',
2550
+ FO: '###',
2551
+ FI: '#####',
2552
+ FR: '#####',
2553
+ GF: '973##',
2554
+ PF: '987##',
2555
+ GI: 'GX11 1AA',
2556
+ GE: '####',
2557
+ DE: '#####',
2558
+ GR: '### ##',
2559
+ GL: '####',
2560
+ GP: '971##',
2561
+ GU: '#####',
2562
+ 'GU+4': '#####-####',
2563
+ GT: '#####',
2564
+ GG: 'GY#? #@@',
2565
+ GN: '###',
2566
+ GS: 'SIQQ 1ZZ',
2567
+ GW: '####',
2568
+ HT: '####',
2569
+ HN: '@@####',
2570
+ 'HN-': '#####',
2571
+ HU: '####',
2572
+ IS: '###',
2573
+ IN: '### ###',
2574
+ ID: '#####',
2575
+ IE: '*** ****',
2576
+ IR: '##########',
2577
+ IQ: '#####',
2578
+ IM: 'IM#? #@@',
2579
+ IL: '#######',
2580
+ IT: '#####',
2581
+ JM: '##',
2582
+ JP: '###-####',
2583
+ JE: 'JE#? #@@',
2584
+ JO: '#####',
2585
+ KZ: '######',
2586
+ KE: '#####',
2587
+ KR: '#####',
2588
+ KN: 'KN####',
2589
+ XK: '#####',
2590
+ KW: '#####',
2591
+ KG: '######',
2592
+ LA: '#####',
2593
+ LV: 'LV-####',
2594
+ LB: '####? ????',
2595
+ LS: '###',
2596
+ LR: '####',
2597
+ LI: '####',
2598
+ LT: '#####',
2599
+ LU: '####',
2600
+ MK: '####',
2601
+ MG: '###',
2602
+ MY: '#####',
2603
+ MV: '#####',
2604
+ MT: '@@@ ####',
2605
+ MH: '#####',
2606
+ 'MH+4': '#####-####',
2607
+ MU: '#####',
2608
+ MQ: '972##',
2609
+ MW: '######',
2610
+ YT: '976##',
2611
+ MX: '#####',
2612
+ FM: '#####',
2613
+ 'FM+4': '#####-####',
2614
+ MD: '####',
2615
+ MC: '980##',
2616
+ MN: '#####',
2617
+ ME: '#####',
2618
+ MA: '#####',
2619
+ MZ: '####',
2620
+ MM: '#####',
2621
+ NA: '#####',
2622
+ NP: '#####',
2623
+ NC: '988##',
2624
+ NZ: '####',
2625
+ NI: '#####',
2626
+ NE: '####',
2627
+ NG: '######',
2628
+ NF: '####',
2629
+ MP: '#####',
2630
+ NO: '####',
2631
+ OM: '###',
2632
+ PK: '#####',
2633
+ PW: '#####',
2634
+ 'PW+4': '#####-####',
2635
+ PS: '###',
2636
+ PA: '####',
2637
+ PG: '###',
2638
+ PY: '####',
2639
+ PE: '#####',
2640
+ 'PE+': '####',
2641
+ PH: '####',
2642
+ PL: '##-###',
2643
+ PT: '####',
2644
+ 'PT+3': '####-###',
2645
+ PR: '#####',
2646
+ 'PR+4': '#####-####',
2647
+ RE: '974##',
2648
+ PM: '975##',
2649
+ PN: 'PCRN 1ZZ',
2650
+ RO: '######',
2651
+ RU: '######',
2652
+ LC: 'LC## ###',
2653
+ VC: '####',
2654
+ WS: '####',
2655
+ SM: '4879#',
2656
+ SA: '#####',
2657
+ 'SA+4': '#####-####',
2658
+ SN: '#####',
2659
+ RS: '#####',
2660
+ SG: '######',
2661
+ SH: '@@@@ 1ZZ',
2662
+ SK: '### ##',
2663
+ SI: '####',
2664
+ SO: '@@ #####',
2665
+ ZA: '####',
2666
+ ES: '#####',
2667
+ LK: '#####',
2668
+ SD: '#####',
2669
+ SZ: '@###',
2670
+ SE: '### ##',
2671
+ CH: '####',
2672
+ SJ: '####',
2673
+ TW: '###',
2674
+ 'TW+2': '###-##?',
2675
+ TJ: '######',
2676
+ TZ: '#####',
2677
+ TH: '#####',
2678
+ TT: '######',
2679
+ TN: '####',
2680
+ TR: '#####',
2681
+ TM: '######',
2682
+ UA: '#####',
2683
+ UY: '#####',
2684
+ VI: '#####',
2685
+ 'VI+4': '#####-####',
2686
+ UZ: '######',
2687
+ VE: '####',
2688
+ 'VE-': '####-@',
2689
+ VN: '#####?',
2690
+ YU: '#####',
2691
+ WF: '986##',
2692
+ ZM: '#####',
2693
+ US: '#####',
2694
+ 'US+4': '#####-####',
2695
+ };
2696
+ function formatPostalCode(value, modifier = 'US') {
2697
+ const mask = postalCodeFormats[modifier];
2698
+ if (!mask) {
2699
+ return formatAlphanumeric(value);
2700
+ }
2701
+ return formatValue(value, mask);
2702
+ }
2703
+
2704
+ const dateFormats = {
2705
+ 'MM/DD/YYYY': '##/##/####',
2706
+ 'M/D/YYYY': '#?/#?/####',
2707
+ 'MM/DD/YY': '##/##/##',
2708
+ 'M/D/YY': '#?/#?/##',
2709
+ 'MM/YY': '##/##',
2710
+ 'M/YY': '#?/##',
2711
+ 'DD/MM/YYYY': '##/##/####',
2712
+ 'D/M/YYYY': '#?/#?/####',
2713
+ 'DD/MM/YY': '##/##/##',
2714
+ 'D/M/YY': '#?/#?/##',
2715
+ 'MM-DD-YYYY': '##-##-####',
2716
+ 'M-D-YYYY': '#?-#?-####',
2717
+ 'MM-DD-YY': '##-##-##',
2718
+ 'M-D-YY': '#?-#?-##',
2719
+ 'MM-YY': '##-##',
2720
+ 'M-YY': '#?-##',
2721
+ 'DD-MM-YYYY': '##-##-####',
2722
+ 'D-M-YYYY': '#?-#?-####',
2723
+ 'DD-MM-YY': '##-##-##',
2724
+ 'D-M-YY': '#?-#?-##',
2725
+ };
2726
+ function formatDate(value, format = 'MM/DD/YYYY') {
2727
+ const mask = dateFormats[format] || dateFormats['MM/DD/YYYY'];
2728
+ const formattedValueObject = formatValue(value, mask);
2729
+ return Object.assign(Object.assign({}, formattedValueObject), { value: formattedValueObject.formattedValue });
2730
+ }
2731
+
2732
+ function format(value) {
2733
+ // have a initial generic mask which then converts to specific mask
2734
+ const detectedType = formatCreditCard.detectCreditCardTypeFromValue(value);
2735
+ const formattedValueObject = creditCardFormatters[detectedType](value);
2736
+ if (value.length < 2 && detectedType === 'unknown') {
2737
+ formattedValueObject.leftIcon = 'card';
2738
+ }
2739
+ return formattedValueObject;
2740
+ }
2741
+ const unknownFormatter = function unknownFn(value) {
2742
+ const valueObject = formatValue(value, '#### #### #### ####');
2743
+ return Object.assign(Object.assign({}, valueObject), { type: 'unknown', leftIcon: 'card-unknown', leftIconMuted: value.length < 16 });
2744
+ };
2745
+ const amexFormatter = function amexFn(value) {
2746
+ const valueObject = formatValue(value, '#### ###### #####');
2747
+ return Object.assign(Object.assign({}, valueObject), { type: 'amex', leftIcon: 'card-amex-color', leftIconMuted: value.length < 15 });
2748
+ };
2749
+ const discoverFormatter = function discoverFn(value) {
2750
+ const valueObject = formatValue(value, '#### #### #### ####');
2751
+ return Object.assign(Object.assign({}, valueObject), { type: 'discover', leftIcon: 'card-discover-color', leftIconMuted: value.length < 16 });
2752
+ };
2753
+ const masterCardFormatter = function masterCardFn(value) {
2754
+ const valueObject = formatValue(value, '#### #### #### ####');
2755
+ return Object.assign(Object.assign({}, valueObject), { type: 'masterCard', leftIcon: 'card-mastercard-color', leftIconMuted: value.length < 16 });
2756
+ };
2757
+ const visaFormatter = function visaFn(value) {
2758
+ const valueObject = formatValue(value, '#### #### #### ####');
2759
+ return Object.assign(Object.assign({}, valueObject), { type: 'visa', leftIcon: 'card-visa-color', leftIconMuted: value.length < 16 });
2760
+ };
2761
+ const dinersClubInternationalFormatter = function dinersClub(value) {
2762
+ const valueObject = formatValue(value, '#### ###### ####');
2763
+ return Object.assign(Object.assign({}, valueObject), { type: 'dinersClub', leftIcon: 'card-dinersclub-color', leftIconMuted: value.length < 14 });
2764
+ };
2765
+ const creditCardFormatters = {
2766
+ discover: discoverFormatter,
2767
+ amex: amexFormatter,
2768
+ masterCard: masterCardFormatter,
2769
+ visa: visaFormatter,
2770
+ dinersClub: dinersClubInternationalFormatter,
2771
+ unknown: unknownFormatter,
2772
+ };
2773
+ /* tslint:disable:cyclomatic-complexity */
2774
+ function detectCreditCardTypeFromValue(value) {
2775
+ // use value and some algorithm from the internet to detect and return card type based on string
2776
+ // return string 'unknown' if algorithm cannot detect or returns a type that is not one of our 5 supported types
2777
+ const firstInt = parseInt(value.charAt(0));
2778
+ const secondInt = parseInt(value.charAt(1));
2779
+ switch (firstInt) {
2780
+ case 2:
2781
+ if (secondInt > 1 && secondInt < 8) {
2782
+ if (value.length >= 4) {
2783
+ const firstfour = parseInt(value.substr(0, 4));
2784
+ if (firstfour >= 2221 && firstfour < 2721) {
2785
+ return 'masterCard';
2786
+ }
2787
+ }
2788
+ else {
2789
+ return 'masterCard';
2790
+ }
2791
+ }
2792
+ break;
2793
+ case 3:
2794
+ if (secondInt === 4 || secondInt === 7) {
2795
+ return 'amex';
2796
+ }
2797
+ if (secondInt === 0) {
2798
+ if (value.length > 2) {
2799
+ const thirdInt = parseInt(value.charAt(2));
2800
+ if (thirdInt < 6 || thirdInt === 9) {
2801
+ return 'dinersClub';
2802
+ }
2803
+ }
2804
+ else {
2805
+ return 'dinersClub';
2806
+ }
2807
+ }
2808
+ if (secondInt === 6 || secondInt === 8 || secondInt === 9) {
2809
+ return 'dinersClub';
2810
+ }
2811
+ break;
2812
+ case 4:
2813
+ return 'visa';
2814
+ case 5:
2815
+ if (secondInt > 0 && secondInt < 6) {
2816
+ return 'masterCard';
2817
+ }
2818
+ break;
2819
+ case 6:
2820
+ if (secondInt === 0) {
2821
+ if (value.length > 3) {
2822
+ const firstfour = value.substr(0, 4);
2823
+ if (firstfour === '6011') {
2824
+ return 'discover';
2825
+ }
2826
+ }
2827
+ else {
2828
+ return 'discover';
2829
+ }
2830
+ }
2831
+ if (secondInt === 4) {
2832
+ if (value.length > 2) {
2833
+ const firstthree = parseInt(value.substr(0, 3));
2834
+ if (firstthree > 643) {
2835
+ return 'discover';
2836
+ }
2837
+ }
2838
+ else {
2839
+ return 'discover';
2840
+ }
2841
+ }
2842
+ if (secondInt === 5) {
2843
+ return 'discover';
2844
+ }
2845
+ if (secondInt === 2) {
2846
+ if (value.length > 5) {
2847
+ const firstsix = parseInt(value.substr(0, 6));
2848
+ if (firstsix >= 622126 && firstsix <= 622925) {
2849
+ return 'discover';
2850
+ }
2851
+ }
2852
+ else {
2853
+ return 'discover';
2854
+ }
2855
+ }
2856
+ break;
2857
+ default:
2858
+ return 'unknown';
2859
+ }
2860
+ return 'unknown';
2861
+ }
2862
+ /* tslint:enable:cyclomatic-complexity */
2863
+ const formatCreditCard = {
2864
+ detectCreditCardTypeFromValue,
2865
+ format,
2866
+ amexFormatter,
2867
+ dinersClubInternationalFormatter,
2868
+ discoverFormatter,
2869
+ masterCardFormatter,
2870
+ visaFormatter,
2871
+ unknownFormatter,
2872
+ };
2873
+
2874
+ const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #33b4ff #06C)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}:host{display:block;margin-top:var(--tct-input-margin-top, var(--t-input-margin-top, var(--app-scale-6x, 30px)));margin-bottom:var(--tct-input-margin-bottom, var(--t-input-margin-bottom, var(--app-scale-6x, 30px)));font-size:var(--tct-input-font-size, var(--t-input-font-size, var(--app-font-size, inherit)))}:host([hidden]){display:none}.field-container,.input-container{position:relative}.field-container{--comp-input-tween:var(--tct-input-tween, var(--t-input-tween, var(--tct-tween-2, var(--app-tween-2, 0.4s ease))))}label{display:block;padding-left:var(--tct-input-label-padding-left, var(--t-input-label-padding-left, 0));padding-right:var(--tct-input-label-padding-right, var(--t-input-label-padding-right, 0));margin-top:var(--tct-input-label-margin-top, var(--t-input-label-margin-top, 0));margin-bottom:var(--tct-input-label-margin-bottom, var(--t-input-label-margin-bottom, var(--tct-scale-1, var(--app-scale-1x, 5px))));color:var(--tct-input-label-font-color, var(--t-input-label-font-color, inherit));font-size:var(--tct-input-label-font-size, var(--t-input-label-font-size, inherit));font-weight:var(--tct-input-label-font-weight, var(--t-input-label-font-weight, 600));text-transform:var(--tct-input-label-text-transform, var(--t-input-label-text-transform, none));letter-spacing:var(--tct-input-label-letter-spacing, var(--t-input-label-letter-spacing, normal));transition:color var(--comp-input-tween)}.optional-tag{margin-left:var(--tct-input-label-optional-margin-left, var(--t-input-label-optional-margin-left, var(--tct-scale-1, var(--app-scale-1x, 5px))));color:var(--tct-input-label-optional-font-color, var(--t-input-label-optional-font-color, var(--t-textA, var(--t-a11y-gray-color, rgba(77, 77, 77, 0.77)))));font-size:var(--tct-input-label-optional-font-size, var(--t-input-label-optional-font-size, 12px));font-weight:var(--tct-input-label-optional-font-weight, var(--t-input-label-optional-font-weight, 400))}.input-container{background:var(--tct-input-background, var(--t-input-background, var(--tct-input-bg, var(--t-input-bg, var(--t-gray-14, #fcfcfd)))));display:flex;align-items:center;--comp-input-horizontal-gap:var(--tct-input-horizontal-gap, var(--t-input-horizontal-gap, 8px));--comp-input-border-top-left-radius:var(--tct-input-border-top-left-radius, var(--t-input-border-top-left-radius, var(--tct-border-radius-1, var(--app-border-radius-1, 3px))));--comp-input-border-top-right-radius:var(--tct-input-border-top-right-radius, var(--t-input-border-top-right-radius, var(--tct-border-radius-1, var(--app-border-radius-1, 3px))));--comp-input-border-bottom-right-radius:var(--tct-input-border-bottom-right-radius, var(--t-input-border-bottom-right-radius, var(--tct-border-radius-1, var(--app-border-radius-1, 3px))));--comp-input-border-bottom-left-radius:var(--tct-input-border-bottom-left-radius, var(--t-input-border-bottom-left-radius, var(--tct-border-radius-1, var(--app-border-radius-1, 3px))));--comp-input-border-radius:var(--comp-input-border-top-left-radius) var(--comp-input-border-top-right-radius)\n var(--comp-input-border-bottom-right-radius) var(--comp-input-border-bottom-left-radius);--comp-input-border-width:var(--tct-input-border-top-width, 1px) var(--tct-input-border-right-width, 1px)\n var(--tct-input-border-bottom-width, 1px) var(--tct-input-border-left-width, 1px);--comp-input-focus-border-width:var(--tct-input-focus-border-top-width, 1px)\n var(--tct-input-focus-border-right-width, 1px) var(--tct-input-focus-border-bottom-width, 1px)\n var(--tct-input-focus-border-left-width, 1px);--comp-input-prefix-clearance:calc(3 * var(--tct-input-prefix-font-size, 14px) + var(--tct-scale-1, 5px));--comp-input-icon-clearance:34px;--comp-input-min-height:var(--tct-input-min-height, var(--t-input-min-height, 44px));--comp-input-max-height:var(--tct-input-max-height, var(--t-input-max-height));border-width:var(--comp-input-border-width);border-style:solid;border-color:var(--tct-input-border-color, var(--t-input-border-color, var(--t-a11y-gray-color-AA, #949494)));border-radius:var(--comp-input-border-radius);box-shadow:var(--tct-input-box-shadow, var(--t-input-box-shadow, none));transition:border-width var(--comp-input-tween), border-color var(--comp-input-tween), box-shadow var(--comp-input-tween)}:host([disabled]:not([disabled=false])) .input-container{cursor:not-allowed;opacity:var(--tct-input-disabled-opacity, var(--t-input-disabled-opacity, var(--tct-disabled-opacity, var(--app-disabled-opacity, 0.4))))}.input-field{flex:1;border:0;-webkit-appearance:none;appearance:none;box-sizing:border-box;min-height:var(--comp-input-min-height);max-height:var(--comp-input-max-height);overflow-y:hidden;height:var(--tct-input-height, var(--t-input-height, 44px));width:100%;padding:0 var(--tct-input-horizontal-padding, var(--t-input-horizontal-padding, var(--tct-scale-2, var(--app-scale-2x, 10px))));background-color:transparent;color:var(--tct-input-font-color, var(--t-input-font-color, var(--t-text, inherit)));display:inline-block;text-align:var(--tct-input-align, \"start\");font-weight:var(--tct-input-font-weight, var(--t-input-font-weight, 400));}.input-field:focus{outline:none;box-shadow:none}.input-field::-webkit-outer-spin-button,.input-field::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.input-field[type=number]{-moz-appearance:textfield}.input-field::-ms-clear{display:none}.input-field[type=search]::-webkit-search-decoration,.input-field[type=search]::-webkit-search-cancel-button,.input-field[type=search]::-webkit-search-results-button,.input-field[type=search]::-webkit-search-results-decoration{display:none}.input-field[disabled]:not([disabled=false]){cursor:not-allowed}.right-aligned .input-field{text-align:right}.input-field:is(input){flex:1}.input-field:is(button){display:inline-flex;align-items:center}.has-custom-display .input-field:is(button){height:auto;padding:0}.input-field:is(button) span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block}.custom-display-container{max-width:100%}.has-custom-display .custom-display-container{--comp-default-padding:var(--app-scale-2x, 10px) var(--app-scale-2x, 10px) var(--app-scale-3x, 15px);padding:var(--tct-input-padding, var(--t-input-padding, var(--comp-default-padding)));width:100%}.input-container:focus-within{border-width:var(--comp-input-focus-border-width, 1px);border-color:var(--tct-input-focus-border-color, var(--t-input-focus-border-color, var(--t-a11y-active-gray-color-AA, #404040)));box-shadow:var(--const-double-focus-ring), var(--tct-input-focus-box-shadow, var(--t-input-focus-box-shadow, 0 0 transparent))}.input-field::placeholder,.placeholder-text{color:var(--tct-input-placeholder-font-color, var(--t-input-placeholder-font-color, var(--t-textA, var(--app-gray-d1, rgba(77, 77, 77, 0.77)))))}.pseudo-input-container{min-width:0;flex:1}.input-icons-container-left,.input-icons-container-right{display:flex;flex-direction:row;align-items:center;gap:var(--comp-input-horizontal-gap)}.input-icons-container-left:empty,.input-icons-container-right:empty{display:none}.input-icons-container-left{padding-left:var(--comp-input-horizontal-gap)}.input-icons-container-right{padding-right:var(--comp-input-horizontal-gap)}.input-icons-container-right .btn-visibility-toggle{color:var(--tct-primary, var(--t-primary, #006eb2));font-size:12px}q2-icon{margin-top:calc(var(--tct-input-border-top-width, var(--t-input-border-top-width, 1px)) / 2);margin-bottom:calc(var(--tct-input-border-bottom-width, var(--t-input-border-bottom-width, 1px)) / 2);pointer-events:none;color:var(--tct-input-icon-stroke-primary, var(--t-input-icon-stroke-primary, var(--t-textA, var(--app-gray, rgba(77, 77, 77, 0.77)))));--tct-icon-stroke-primary:var(--tct-input-icon-stroke-primary, var(--t-input-icon-stroke-primary, var(--t-textA, var(--app-gray, rgba(77, 77, 77, 0.77)))))}.icon-left-muted{opacity:0.5}.input-prefix,.input-suffix{margin-left:calc(var(--comp-input-horizontal-gap) * -1);margin-right:calc(var(--comp-input-horizontal-gap) * -1);width:3em;display:inline-flex;align-items:center;justify-content:center;min-height:calc(\n var(--comp-input-min-height) - var(--tct-input-focus-border-top-width, var(--t-input-focus-border-top-width, 1px)) - var(--tct-input-focus-border-bottom-width, var(--t-input-focus-border-bottom-width, 1px))\n );height:calc(\n var(--tct-input-height, var(--t-input-height, 44px)) - var(--tct-input-focus-border-top-width, var(--t-input-focus-border-top-width, 1px)) - var(--tct-input-focus-border-bottom-width, var(--t-input-focus-border-bottom-width, 1px))\n );font-size:var(--tct-input-prefix-font-size, var(--t-input-prefix-font-size, inherit));color:var(--tct-input-prefix-font-color, var(--t-input-prefix-font-color, inherit));background-color:var(--tct-input-prefix-bg, var(--t-input-prefix-bg, var(--tct-input-bg, var(--t-input-bg, var(--tct-gray-14, var(--t-gray-14, #f2f2f2))))));transition:color var(--comp-input-tween), background-color var(--comp-input-tween)}.input-prefix{border-top-left-radius:calc(\n var(--comp-input-border-top-left-radius) - var(--tct-input-border-top-width, var(--t-input-border-top-width, 1px)) - var(--tct-input-border-left-width, var(--t-input-border-left-width, 1px))\n );border-bottom-left-radius:calc(\n var(--comp-input-border-bottom-left-radius) - var(--tct-input-border-bottom-width, var(--t-input-border-bottom-width, 1px)) - var(--tct-input-border-left-width, var(--t-input-border-left-width, 1px))\n );pointer-events:none;}.input-suffix{border-top-right-radius:calc(\n var(--comp-input-border-top-right-radius) - var(--tct-input-border-top-width, var(--t-input-border-top-width, 1px)) - var(--tct-input-border-right-width, var(--t-input-border-right-width, 1px))\n );border-bottom-right-radius:calc(\n var(--comp-input-border-bottom-right-radius) - var(--tct-input-border-bottom-width, var(--t-input-border-bottom-width, 1px)) - var(--tct-input-border-right-width, var(--t-input-border-right-width, 1px))\n )}.icon-error{color:var(--tct-stoplight-error, var(--const-stoplight-alert, #c30000));--tct-icon-stroke-primary:var(--tct-stoplight-error, var(--const-stoplight-alert, #c30000))}.pw-show{position:absolute;margin-right:var(--tct-scale-2, var(--app-scale-2x, 10px))}.btn-clear{margin-top:calc(var(--tct-input-border-top-width, var(--t-input-border-top-width, 1px)) / 2);margin-bottom:calc(var(--tct-input-border-bottom-width, var(--t-input-border-bottom-width, 1px)) / 2);height:22px;--tct-btn-icon-width:17px;--tct-btn-icon-height:22px;--tct-icon-size:17px}.messages-container{height:0px;overflow:hidden;background-color:var(--tct-message-bg, var(--t-message-bg, var(--tct-gray-14, var(--t-gray-14, var(--tct-gray-l3, var(--app-gray-l3, #f2f2f2))))));box-shadow:var(--tct-input-message-box-shadow, var(--t-input-message-box-shadow, var(--tct-box-shadow-1, var(--app-shadow-1, 0 2px 4px rgba(0, 0, 0, 0.3)))));transition:height var(--tct-input-messages-tween, var(--t-input-messages-tween, var(--tct-tween-1, var(--app-tween-1, 0.2s ease))));margin-top:2px;z-index:1;position:absolute;width:100%;color:var(--tct-input-messages-font-color, var(--t-input-messages-font-color, inherit))}.has-error label{color:var(--tct-input-error-label-font-color, var(--t-input-error-label-font-color, var(--tct-input-label-font-color, var(--t-input-label-font-color, inherit))))}.has-error:not(.has-focus) .input-prefix,.has-error:not(.has-focus) .input-suffix{color:var(--tct-input-error-prefix-font-color, var(--t-input-error-prefix-font-color, inherit));background-color:var(--tct-input-error-prefix-bg, var(--t-input-error-prefix-bg, var(--tct-input-bg, var(--t-input-bg, var(--tct-gray-14, var(--t-gray-14, var(--tct-gray-l3, var(--app-gray-l3, #f2f2f2))))))))}.has-error .input-container:not(:focus-within){border-color:var(--tct-input-error-border-color, var(--t-input-error-border-color, var(--const-stoplight-alert, #c30000)))}.icon-left{width:26px;height:26px}.vertical-separator{height:calc(var(--comp-input-min-height) - 2px);border-right:1px solid var(--tct-input-prefix-border-color, var(--t-input-prefix-border-color, var(--tct-input-border-color, var(--t-input-border-color, var(--t-a11y-gray-color-AA, #949494)))))}";
6
2875
 
7
- const Q2Loading = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
2876
+ const inputTypeMap = {
2877
+ text: 'text',
2878
+ tel: 'tel',
2879
+ number: 'number',
2880
+ password: 'text',
2881
+ search: 'search',
2882
+ url: 'url',
2883
+ email: 'email',
2884
+ currency: 'text',
2885
+ phone: 'tel',
2886
+ ssn: 'text',
2887
+ alphanumeric: 'text',
2888
+ alpha: 'text',
2889
+ numeric: 'text',
2890
+ percentage: 'text',
2891
+ postal: 'text',
2892
+ date: 'text',
2893
+ 'credit-card': 'text',
2894
+ };
2895
+ const Q2Input = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
8
2896
  constructor() {
9
2897
  super();
10
2898
  this.__registerHost();
11
2899
  this.__attachShadow();
12
- this.halfCircleSpinner = () => {
13
- return (h("div", { class: "q2-loading-animation half-circle-spinner", "aria-label": this.localizedLabel }, h("div", { class: "circle circle-1" }), h("div", { class: "circle circle-2" })));
2900
+ this.input = createEvent(this, "input", 7);
2901
+ this.change = createEvent(this, "change", 7);
2902
+ this.clear = createEvent(this, "clear", 7);
2903
+ this.scheduledAfterRender = [];
2904
+ this.isMobile = isMobile();
2905
+ this.guid = createGuid();
2906
+ ///// ACTIONS ////////
2907
+ this.onToggleVisibility = () => {
2908
+ this.textHidden = !this.textHidden;
14
2909
  };
15
- this.spinner = () => {
16
- return this.halfCircleSpinner();
2910
+ this.onInputClick = () => {
2911
+ if (this.shouldCursorStayAtEnd)
2912
+ this.placeCursorAtEnd();
17
2913
  };
18
- this.skeletonLoader = () => {
19
- return (h("div", { class: "q2-loading-skeleton", "aria-label": this.localizedLabel }, this.shape === 'custom' ? h("slot", null) : this.skeletonShape, h("div", { class: "q2-loading-skeleton-shimmer" })));
2914
+ this.onInputFocus = () => {
2915
+ this.scheduledAfterRender.push(() => this.shouldCursorStayAtEnd
2916
+ ? this.placeCursorAtEnd()
2917
+ : this.setCursorPosition(this.calculateCursorPositionOnFocus()));
2918
+ this.hasFocus = true;
2919
+ setMessageHeight(this);
2920
+ this.valueOnFocus = this.value;
20
2921
  };
21
- this.type = undefined;
22
- this.shape = undefined;
23
- this.modifiers = undefined;
24
- this.counts = undefined;
2922
+ this.onInputBlur = () => {
2923
+ this.hasFocus = false;
2924
+ setMessageHeight(this);
2925
+ if (this.valueOnFocus !== this.formattedValueObject.value) {
2926
+ this.valueOnFocus = this.formattedValueObject.value;
2927
+ this.change.emit(Object.assign({ value: this.formattedValueObject.value, formattedValue: this.formattedValueObject.fullyFormattedValue, minFormattedLength: this.formattedValueObject.minFormattedLength }, (this.formattedValueObject.type && { type: this.formattedValueObject.type })));
2928
+ }
2929
+ };
2930
+ this.onInputInput = (event) => {
2931
+ event.stopPropagation();
2932
+ const newFormattedValue = this.getFormattedValue(event.target.value, false);
2933
+ this.handleDataInput(newFormattedValue);
2934
+ };
2935
+ this.onInputPaste = (event) => {
2936
+ if (this.type === 'currency') {
2937
+ const clipboardData = event.clipboardData.getData('text');
2938
+ const newFormattedValue = this.getFormattedValue(clipboardData, true);
2939
+ event.preventDefault();
2940
+ this.handleDataInput(newFormattedValue);
2941
+ }
2942
+ };
2943
+ this.onInputKeydown = (event) => {
2944
+ const keysThatMoveCursor = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Home', 'End'];
2945
+ const { key } = event;
2946
+ if (this.shouldCursorStayAtEnd && keysThatMoveCursor.includes(key))
2947
+ event.preventDefault();
2948
+ if (key === 'Enter' && this.valueOnFocus !== this.formattedValueObject.value) {
2949
+ this.valueOnFocus = this.formattedValueObject.value;
2950
+ this.change.emit(Object.assign({ value: this.formattedValueObject.value, formattedValue: this.formattedValueObject.fullyFormattedValue, minFormattedLength: this.formattedValueObject.minFormattedLength }, (this.formattedValueObject.type && { type: this.formattedValueObject.type })));
2951
+ }
2952
+ };
2953
+ this.onClearInput = () => {
2954
+ const eventDetail = {
2955
+ value: '',
2956
+ formattedValue: '',
2957
+ minFormattedLength: this.formattedValueObject.minFormattedLength,
2958
+ };
2959
+ this.input.emit(eventDetail);
2960
+ this.change.emit(eventDetail);
2961
+ this.clear.emit();
2962
+ this.inputField.focus();
2963
+ };
2964
+ this.value = undefined;
25
2965
  this.label = undefined;
26
- this.inline = undefined;
2966
+ this.hideLabel = undefined;
2967
+ this.type = 'text';
2968
+ this.placeholder = undefined;
2969
+ this.disabled = false;
2970
+ this.autocomplete = undefined;
2971
+ this.autocorrect = undefined;
2972
+ this.autocapitalize = undefined;
2973
+ this.hideMessages = undefined;
2974
+ this.iconLeft = undefined;
2975
+ this.iconRight = undefined;
2976
+ this.readonly = undefined;
2977
+ this.clearable = undefined;
2978
+ this.optional = undefined;
2979
+ this.min = undefined;
2980
+ this.max = undefined;
2981
+ this.step = undefined;
2982
+ this.formatModifier = undefined;
2983
+ this.maxlength = undefined;
2984
+ this.pseudo = undefined;
2985
+ this.showVisibilityToggle = false;
2986
+ this.textHidden = undefined;
2987
+ this.badgeValue = undefined;
2988
+ this.badgeTheme = undefined;
2989
+ this.role = undefined;
2990
+ this.ariaControls = undefined;
2991
+ this.ariaOwns = undefined;
2992
+ this.ariaHaspopup = undefined;
2993
+ this.ariaExpanded = undefined;
2994
+ this.ariaActivedescendant = undefined;
2995
+ this.current = undefined;
27
2996
  this.ariaLabel = undefined;
2997
+ this.errors = undefined;
2998
+ this.hints = undefined;
2999
+ this.formattedValueObject = undefined;
3000
+ this.hasFocus = undefined;
28
3001
  }
29
- get loader() {
30
- const loaderMap = {
31
- default: this.spinner,
32
- spinner: this.spinner,
33
- skeleton: this.skeletonLoader,
3002
+ /////// LIFECYCLE HOOKS ////////
3003
+ componentWillLoad() {
3004
+ if (isNaN(this.maxlength)) {
3005
+ this.maxlength = undefined;
3006
+ }
3007
+ this.formattedValueObject = this.getFormattedValue(this.stringValue, true);
3008
+ handleAriaLabel(this);
3009
+ if (this.textHidden === undefined) {
3010
+ this.textHidden = this.type === 'password';
3011
+ }
3012
+ }
3013
+ componentDidLoad() {
3014
+ if (!this.pseudo) {
3015
+ this.inputField.value = this.formattedValueObject.formattedValue;
3016
+ }
3017
+ overrideFocus(this.hostElement);
3018
+ }
3019
+ componentDidRender() {
3020
+ this.scheduledAfterRender.forEach(fn => fn());
3021
+ this.scheduledAfterRender = [];
3022
+ }
3023
+ getFormattedValue(value, valueChangedFromProperty) {
3024
+ const formattingFunctions = {
3025
+ currency: formatCurrency,
3026
+ phone: formatPhoneNumber,
3027
+ ssn: formatSSN,
3028
+ alphanumeric: formatAlphanumeric,
3029
+ alpha: formatAlpha,
3030
+ numeric: formatNumeric,
3031
+ percentage: formatPercentage,
3032
+ postal: formatPostalCode,
3033
+ date: formatDate,
3034
+ 'credit-card': formatCreditCard.format,
34
3035
  };
35
- return loaderMap[this.type] || loaderMap.default;
3036
+ if (formattingFunctions[this.type]) {
3037
+ return formattingFunctions[this.type](value, this.formatModifier, valueChangedFromProperty);
3038
+ }
3039
+ return {
3040
+ value,
3041
+ formattedValue: value,
3042
+ fullyFormattedValue: value,
3043
+ formattingCharacterCount: 0,
3044
+ unformattedValue: value,
3045
+ };
3046
+ }
3047
+ get canClear() {
3048
+ return this.clearable && !!this.value;
3049
+ }
3050
+ get shouldCursorStayAtEnd() {
3051
+ return this.isMobile && this.type === 'currency';
3052
+ }
3053
+ get hasError() {
3054
+ return Array.isArray(this.errors) && this.errors.length > 0;
36
3055
  }
37
- get modifiersSet() {
38
- if (this.type !== 'skeleton' || !this.modifiers) {
39
- return undefined;
3056
+ get messages() {
3057
+ return ((this.errors && this.errors.length > 0 && this.errors) ||
3058
+ (this.hints && this.hints.length > 0 && this.hints) ||
3059
+ []);
3060
+ }
3061
+ get inputField() {
3062
+ return this.hostElement.shadowRoot.querySelector('.input-field');
3063
+ }
3064
+ get showMessages() {
3065
+ return this.messages.length > 0 && !this.hideMessages;
3066
+ }
3067
+ get inputId() {
3068
+ return `input-guid-${this.guid}`;
3069
+ }
3070
+ get inputDescribedBy() {
3071
+ return this.showMessages ? `${this.inputId}-description` : undefined;
3072
+ }
3073
+ get isMaskedType() {
3074
+ const maskedTypes = [
3075
+ 'currency',
3076
+ 'phone',
3077
+ 'ssn',
3078
+ 'alphanumeric',
3079
+ 'alpha',
3080
+ 'numeric',
3081
+ 'percentage',
3082
+ 'postal',
3083
+ 'date',
3084
+ 'credit-card',
3085
+ ];
3086
+ return maskedTypes.includes(this.type);
3087
+ }
3088
+ get wrapperClasses() {
3089
+ const classNames = ['field-container'];
3090
+ if (this.hasError)
3091
+ classNames.push('has-error');
3092
+ if (!!this.value)
3093
+ classNames.push('has-value');
3094
+ if (this.clearable && !!this.value)
3095
+ classNames.push('has-clear');
3096
+ if (this.hasFocus)
3097
+ classNames.push('has-focus');
3098
+ if (this.formattedValueObject.prefix)
3099
+ classNames.push('has-prefix');
3100
+ if (this.computedIconLeft)
3101
+ classNames.push('has-icon-left');
3102
+ if (this.showIconSeparator)
3103
+ classNames.push('has-icon-separator');
3104
+ if (this.formattedValueObject.suffix)
3105
+ classNames.push('has-suffix');
3106
+ if (!this.formattedValueObject.suffix && this.iconRight)
3107
+ classNames.push('has-icon-right');
3108
+ if (this.type === 'currency')
3109
+ classNames.push('right-aligned');
3110
+ else
3111
+ classNames.push('left-aligned');
3112
+ if (this.hasCustomDisplaySlot)
3113
+ classNames.push('has-custom-display');
3114
+ return classNames.join(' ');
3115
+ }
3116
+ get computedType() {
3117
+ if (['password', 'text', 'ssn'].includes(this.type) && this.textHidden) {
3118
+ return 'password';
3119
+ }
3120
+ else {
3121
+ return (this.type && inputTypeMap[this.type]) || 'text';
3122
+ }
3123
+ }
3124
+ get computedAutocomplete() {
3125
+ // force off for currency type
3126
+ if (this.type === 'currency')
3127
+ return 'transaction-amount';
3128
+ return this.autocomplete || 'off';
3129
+ }
3130
+ get computedIconLeft() {
3131
+ if (this.formattedValueObject.prefix) {
3132
+ return;
3133
+ }
3134
+ if (this.type === 'search') {
3135
+ return 'search';
3136
+ }
3137
+ if (this.formattedValueObject.leftIcon) {
3138
+ return this.formattedValueObject.leftIcon;
40
3139
  }
41
- return new Set(this.modifiers.split('-'));
3140
+ return this.iconLeft;
42
3141
  }
43
- get countsArray() {
44
- if (this.type !== 'skeleton' || !this.counts) {
45
- return undefined;
3142
+ get showIconSeparator() {
3143
+ return this.type === 'credit-card' || !!this.formattedValueObject.prefix;
3144
+ }
3145
+ get computedClassForIconLeft() {
3146
+ let className = 'icon-left';
3147
+ if (this.formattedValueObject.leftIconMuted) {
3148
+ className += ' icon-left-muted';
46
3149
  }
47
- return this.counts.split('x').map(Number);
3150
+ return className;
48
3151
  }
49
- get skeletonShape() {
50
- var _a, _b;
51
- return (_b = (_a = shapes[this.shape]) === null || _a === void 0 ? void 0 : _a.call(shapes, this.countsArray, this.modifiersSet)) !== null && _b !== void 0 ? _b : '';
3152
+ get stringValue() {
3153
+ return (this.value && String(this.value)) || '';
52
3154
  }
53
- get spinnerShape() {
54
- const spinnerMap = {
55
- default: this.halfCircleSpinner,
56
- 'half-circle': this.halfCircleSpinner,
57
- };
58
- return spinnerMap[this.type] || spinnerMap.default;
3155
+ get canSetSelection() {
3156
+ // email and number type don't support setSelectionRange
3157
+ return !['email', 'number'].includes(this.computedType);
59
3158
  }
60
- get localizedLabel() {
61
- return loc(this.label || 'tecton.element.loading.ariaLabel');
3159
+ get visibilityToggleText() {
3160
+ return loc(`tecton.element.input.toggle.${this.textHidden ? 'show' : 'hide'}`);
62
3161
  }
63
- componentWillLoad() {
64
- handleAriaLabel(this);
3162
+ formatAndUpdateValueFromProp() {
3163
+ this.formattedValueObject = this.getFormattedValue(this.stringValue, true);
3164
+ if (!this.pseudo) {
3165
+ const setValue = () => {
3166
+ this.inputField.value = this.formattedValueObject.formattedValue;
3167
+ };
3168
+ this.inputField ? setValue() : this.scheduledAfterRender.push(() => setValue());
3169
+ }
3170
+ }
3171
+ get inputMode() {
3172
+ const inputModeMap = {
3173
+ currency: 'numeric',
3174
+ ssn: 'numeric',
3175
+ numeric: 'decimal',
3176
+ percentage: 'decimal',
3177
+ postal: 'numeric',
3178
+ date: 'numeric',
3179
+ 'credit-card': 'numeric',
3180
+ };
3181
+ return (this.type && inputModeMap[this.type]) || undefined;
65
3182
  }
3183
+ //////// OBSERVERS //////////
66
3184
  ariaLabelObserver() {
67
3185
  handleAriaLabel(this);
68
3186
  }
3187
+ valueObserver() {
3188
+ this.formatAndUpdateValueFromProp();
3189
+ }
3190
+ typeObserver() {
3191
+ this.formatAndUpdateValueFromProp();
3192
+ }
3193
+ formatModifierObserver() {
3194
+ this.formatAndUpdateValueFromProp();
3195
+ }
3196
+ hintsObserver() {
3197
+ this.hasFocus && this.scheduledAfterRender.push(() => setMessageHeight(this));
3198
+ }
3199
+ errorsObserver() {
3200
+ this.hasFocus && this.scheduledAfterRender.push(() => setMessageHeight(this));
3201
+ }
3202
+ ///////// HOST ELEMENT EVENTS //////
3203
+ onHostElementFocus(event) {
3204
+ if (!isEventFromElement(event, this.hostElement))
3205
+ return;
3206
+ this.inputField.focus();
3207
+ }
3208
+ onHostElementChange(event) {
3209
+ if (event.target === this.hostElement && !this.hostElement.onchange) {
3210
+ this.value = event.detail.value;
3211
+ }
3212
+ }
3213
+ handleDataInput(newFormattedValue) {
3214
+ if (this.maxlength === undefined ||
3215
+ newFormattedValue.unformattedValue.length <= this.maxlength ||
3216
+ newFormattedValue.unformattedValue.length <= this.formattedValueObject.unformattedValue.length) {
3217
+ this.formattedValueObject = newFormattedValue;
3218
+ }
3219
+ else if (this.maxlength) {
3220
+ newFormattedValue = this.getFormattedValue(newFormattedValue.unformattedValue.substring(0, this.maxlength), false);
3221
+ this.formattedValueObject = newFormattedValue;
3222
+ }
3223
+ // ORDER IMPORTANT: calculate cursor position -> set value -> set cursor position
3224
+ const cursorPosition = this.calculateCursorPositionOnInput();
3225
+ this.inputField.value = this.formattedValueObject.formattedValue;
3226
+ this.input.emit(Object.assign({ value: this.formattedValueObject.value, formattedValue: this.formattedValueObject.fullyFormattedValue, minFormattedLength: this.formattedValueObject.minFormattedLength }, (this.formattedValueObject.type && { type: this.formattedValueObject.type })));
3227
+ this.setCursorPosition(cursorPosition);
3228
+ }
3229
+ /////// VIEW METHODS ///////
69
3230
  render() {
70
- return this.loader();
3231
+ return (h("div", { class: this.wrapperClasses }, labelDOM(this), this.inputContainerDOM(), messagesDOM(this)));
3232
+ }
3233
+ get hasCustomDisplaySlot() {
3234
+ return !!this.hostElement.querySelector('[slot=custom-display]');
3235
+ }
3236
+ /* tslint:disable:cyclomatic-complexity */
3237
+ inputContainerDOM() {
3238
+ return (h("div", { class: "input-container", tabindex: -1, "test-id": "inputContainer" }, h("div", { class: "input-icons-container-left" }, this.formattedValueObject.prefix && (h("span", { class: "input-prefix" }, this.formattedValueObject.prefix)), this.computedIconLeft && (h("q2-icon", { type: this.computedIconLeft, class: this.computedClassForIconLeft })), this.showIconSeparator && h("div", { class: "vertical-separator" }), this.hasError && this.type === 'currency' && (h("q2-icon", { type: "error", class: "icon-error", "test-id": "iconError" }))), this.pseudo ? this.pseudoInputDOM() : this.standardInputDOM(), h("div", { class: "input-icons-container-right" }, this.canClear && (h("q2-btn", { class: "btn-clear", ariaLabel: loc('tecton.element.input.clear', [this.label]), "test-id": "clearButton", onClick: this.onClearInput }, h("q2-icon", { type: "close", class: "icon-clear" }))), ['password', 'text', 'ssn'].includes(this.type) && this.showVisibilityToggle && (h("q2-btn", { class: "btn-visibility-toggle", "test-id": "toggleVisibilityButton", onClick: this.onToggleVisibility }, this.visibilityToggleText)), this.formattedValueObject.suffix && (h("span", { class: "input-suffix" }, this.formattedValueObject.suffix)), this.badgeValue && (h("q2-badge", { size: "large", theme: this.badgeTheme }, this.badgeValue)), this.iconRight && !this.formattedValueObject.suffix && (h("q2-icon", { type: this.iconRight, class: "icon-right" })), this.hasError && this.type !== 'currency' && (h("q2-icon", { type: "error", class: "icon-error" })))));
3239
+ }
3240
+ /* tslint:enable:cyclomatic-complexity */
3241
+ /* tslint:disable:cyclomatic-complexity */
3242
+ standardInputDOM() {
3243
+ const { hasCustomDisplaySlot } = this;
3244
+ const inputClasses = ['input-field'];
3245
+ if (hasCustomDisplaySlot)
3246
+ inputClasses.push('sr');
3247
+ return (h(Fragment, null, hasCustomDisplaySlot && (h("div", { class: "custom-display-container" }, h("slot", { name: "custom-display" }))), h("input", { class: inputClasses.join(' '), id: this.inputId, type: this.computedType, size: this.formattedValueObject.prefix ? 10 : undefined, max: this.max, min: this.min, step: this.step, "aria-current": this.current || undefined, "aria-describedby": this.inputDescribedBy, "aria-required": `${!this.optional}`, "aria-invalid": `${this.hasError}`, "aria-controls": (this.ariaControls && `${this.ariaControls}`) || undefined, "aria-owns": (this.ariaOwns && `${this.ariaOwns}`) || undefined, "aria-haspopup": (this.ariaHaspopup && `${this.ariaHaspopup}`) || undefined, "aria-expanded": (!!this.ariaExpanded && `${!!this.ariaExpanded}`) || undefined, "aria-activedescendant": this.ariaActivedescendant && `${this.ariaActivedescendant}`, "aria-label": this.hideLabel && this.label ? loc(this.label) : undefined, autocomplete: this.computedAutocomplete, autocapitalize: this.autocapitalize, autocorrect: this.autocorrect === 'on' ? 'on' : 'off', placeholder: (this.placeholder && loc(this.placeholder)) || undefined, role: (this.role && `${this.role}`) || undefined, "test-id": "inputField", readonly: !!this.readonly, disabled: !!this.disabled, onFocus: this.onInputFocus, onBlur: this.onInputBlur, onClick: this.onInputClick, onKeyDown: this.onInputKeydown, onInput: this.onInputInput, onPaste: this.onInputPaste, inputmode: this.inputMode })));
3248
+ }
3249
+ /* tslint:enable:cyclomatic-complexity */
3250
+ pseudoInputDOM() {
3251
+ const showPlaceholder = !this.value && !!this.placeholder;
3252
+ let ariaLabelSuffix = '';
3253
+ if (this.optional) {
3254
+ ariaLabelSuffix = loc('tecton.element.input.optional');
3255
+ }
3256
+ if (this.readonly) {
3257
+ ariaLabelSuffix = loc('tecton.element.input.readonly');
3258
+ }
3259
+ return (h("div", { class: "pseudo-input-container" }, h("button", { class: "input-field", type: "button", id: this.inputId, "aria-describedby": this.inputDescribedBy, "aria-invalid": `${this.hasError}`, "aria-controls": (this.ariaControls && `${this.ariaControls}`) || undefined, "aria-owns": (this.ariaOwns && `${this.ariaOwns}`) || undefined, "aria-haspopup": (this.ariaHaspopup && `${this.ariaHaspopup}`) || undefined, "aria-expanded": this.ariaExpanded === 'true' ? 'true' : undefined, "aria-activedescendant": this.ariaActivedescendant && `${this.ariaActivedescendant}`, "aria-label": `${this.value}, ${(this.label && loc(this.label)) || ''}${ariaLabelSuffix}`, role: (this.role && `${this.role}`) || undefined, disabled: !!this.disabled, "test-id": "q2InputInnerClearButton" }, h("div", { class: "custom-display-container" }, h("slot", { name: "custom-display" }, h("span", { class: showPlaceholder ? 'placeholder-text' : '' }, showPlaceholder ? this.placeholder : this.value))))));
3260
+ }
3261
+ placeCursorAtEnd() {
3262
+ const { inputField } = this;
3263
+ inputField.selectionStart = inputField.selectionEnd = inputField.value.length;
3264
+ }
3265
+ calculateCursorPositionOnInput() {
3266
+ const input = this.inputField;
3267
+ const formattedLength = this.formattedValueObject.formattedValue.length;
3268
+ const currentValueLength = input.value.length;
3269
+ const defaultPosition = this.type === 'currency' ? formattedLength : 0;
3270
+ return {
3271
+ startingPosition: (input && input.selectionStart) || defaultPosition,
3272
+ valueLength: formattedLength,
3273
+ previousValueLength: input && currentValueLength,
3274
+ hasSelection: false,
3275
+ };
3276
+ }
3277
+ calculateCursorPositionOnFocus() {
3278
+ var _a, _b, _c;
3279
+ const { inputField } = this;
3280
+ const valueLength = (_b = (_a = inputField === null || inputField === void 0 ? void 0 : inputField.value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
3281
+ const startingPosition = (_c = inputField === null || inputField === void 0 ? void 0 : inputField.selectionStart) !== null && _c !== void 0 ? _c : valueLength;
3282
+ return {
3283
+ startingPosition,
3284
+ valueLength,
3285
+ previousValueLength: valueLength,
3286
+ hasSelection: getSelection().toString().length > 0,
3287
+ };
3288
+ }
3289
+ setCursorPosition(cursorData) {
3290
+ if (this.canSetSelection && !cursorData.hasSelection) {
3291
+ const input = this.inputField;
3292
+ const { valueLength, previousValueLength, startingPosition } = cursorData;
3293
+ if (startingPosition === valueLength && valueLength >= previousValueLength && this.type === 'currency') {
3294
+ input.setSelectionRange(valueLength, valueLength);
3295
+ }
3296
+ else {
3297
+ const difference = valueLength - previousValueLength;
3298
+ // Never allow the cursor to move in reverse
3299
+ const newPosition = startingPosition + (difference > 0 ? difference : 0);
3300
+ input.setSelectionRange(newPosition, newPosition);
3301
+ }
3302
+ }
71
3303
  }
72
3304
  get hostElement() { return this; }
73
3305
  static get watchers() { return {
74
- "ariaLabel": ["ariaLabelObserver"]
3306
+ "ariaLabel": ["ariaLabelObserver"],
3307
+ "value": ["valueObserver"],
3308
+ "type": ["typeObserver"],
3309
+ "formatModifier": ["formatModifierObserver"],
3310
+ "hints": ["hintsObserver"],
3311
+ "errors": ["errorsObserver"]
75
3312
  }; }
76
3313
  static get style() { return stylesCss; }
77
- }, [1, "q2-loading", {
78
- "type": [513],
79
- "shape": [513],
80
- "modifiers": [513],
81
- "counts": [513],
3314
+ }, [1, "q2-input", {
3315
+ "value": [1025],
82
3316
  "label": [1537],
83
- "inline": [516],
84
- "ariaLabel": [1537, "aria-label"]
85
- }]);
3317
+ "hideLabel": [1540, "hide-label"],
3318
+ "type": [513],
3319
+ "placeholder": [513],
3320
+ "disabled": [516],
3321
+ "autocomplete": [513],
3322
+ "autocorrect": [513],
3323
+ "autocapitalize": [513],
3324
+ "hideMessages": [516, "hide-messages"],
3325
+ "iconLeft": [513, "icon-left"],
3326
+ "iconRight": [513, "icon-right"],
3327
+ "readonly": [516],
3328
+ "clearable": [516],
3329
+ "optional": [516],
3330
+ "min": [514],
3331
+ "max": [514],
3332
+ "step": [514],
3333
+ "formatModifier": [513, "format-modifier"],
3334
+ "maxlength": [1538],
3335
+ "pseudo": [516],
3336
+ "showVisibilityToggle": [516, "show-visibility-toggle"],
3337
+ "textHidden": [1540, "text-hidden"],
3338
+ "badgeValue": [513, "badge-value"],
3339
+ "badgeTheme": [513, "badge-theme"],
3340
+ "role": [1],
3341
+ "ariaControls": [1, "aria-controls"],
3342
+ "ariaOwns": [1, "aria-owns"],
3343
+ "ariaHaspopup": [1, "aria-haspopup"],
3344
+ "ariaExpanded": [1, "aria-expanded"],
3345
+ "ariaActivedescendant": [8, "aria-activedescendant"],
3346
+ "current": [1],
3347
+ "ariaLabel": [1537, "aria-label"],
3348
+ "errors": [16],
3349
+ "hints": [16],
3350
+ "formattedValueObject": [32],
3351
+ "hasFocus": [32]
3352
+ }, [[0, "focus", "onHostElementFocus"], [0, "change", "onHostElementChange"]]]);
86
3353
  function defineCustomElement() {
87
3354
  if (typeof customElements === "undefined") {
88
3355
  return;
89
3356
  }
90
- const components = ["q2-loading"];
3357
+ const components = ["q2-input", "q2-badge", "q2-btn", "q2-icon", "q2-loading"];
91
3358
  components.forEach(tagName => { switch (tagName) {
3359
+ case "q2-input":
3360
+ if (!customElements.get(tagName)) {
3361
+ customElements.define(tagName, Q2Input);
3362
+ }
3363
+ break;
3364
+ case "q2-badge":
3365
+ if (!customElements.get(tagName)) {
3366
+ defineCustomElement$4();
3367
+ }
3368
+ break;
3369
+ case "q2-btn":
3370
+ if (!customElements.get(tagName)) {
3371
+ defineCustomElement$3();
3372
+ }
3373
+ break;
3374
+ case "q2-icon":
3375
+ if (!customElements.get(tagName)) {
3376
+ defineCustomElement$2();
3377
+ }
3378
+ break;
92
3379
  case "q2-loading":
93
3380
  if (!customElements.get(tagName)) {
94
- customElements.define(tagName, Q2Loading);
3381
+ defineCustomElement$1();
95
3382
  }
96
3383
  break;
97
3384
  } });
98
3385
  }
99
3386
  defineCustomElement();
100
3387
 
101
- export { Q2Loading as Q, defineCustomElement as d };
3388
+ export { Q2Input as Q, defineCustomElement as d };