sas-ui 0.8.281 → 0.8.283

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 (35) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/sas-avatar.cjs.entry.js +1 -1
  3. package/dist/cjs/{sas-button_19.cjs.entry.js → sas-button_13.cjs.entry.js} +373 -3837
  4. package/dist/cjs/sas-form-input-template_4.cjs.entry.js +2286 -0
  5. package/dist/cjs/sas-select.cjs.entry.js +606 -0
  6. package/dist/cjs/sas-ui.cjs.js +1 -1
  7. package/dist/collection/collection-manifest.json +0 -1
  8. package/dist/collection/components/sas-avatar/sas-avatar.css +4 -2
  9. package/dist/custom-elements/index.d.ts +0 -6
  10. package/dist/custom-elements/index.js +2 -591
  11. package/dist/esm/loader.js +1 -1
  12. package/dist/esm/sas-avatar.entry.js +1 -1
  13. package/dist/esm/{sas-button_19.entry.js → sas-button_13.entry.js} +374 -3832
  14. package/dist/esm/sas-form-input-template_4.entry.js +2279 -0
  15. package/dist/esm/sas-select.entry.js +602 -0
  16. package/dist/esm/sas-ui.js +1 -1
  17. package/dist/sas-ui/p-6adeec3b.entry.js +1 -0
  18. package/dist/sas-ui/p-8fd52963.entry.js +1 -0
  19. package/dist/sas-ui/p-d0a00973.entry.js +1 -0
  20. package/dist/sas-ui/p-fc9e5304.entry.js +1 -0
  21. package/dist/sas-ui/sas-ui.esm.js +1 -1
  22. package/dist/types/components.d.ts +0 -174
  23. package/package.json +1 -1
  24. package/dist/collection/components/sas-timezone-select/sas-timezone-select.css +0 -3
  25. package/dist/collection/components/sas-timezone-select/sas-timezone-select.js +0 -653
  26. package/dist/collection/components/sas-timezone-select/sas-timezone-select.stories.js +0 -115
  27. package/dist/collection/components/sas-timezone-select/timezones/timezone-data.js +0 -259
  28. package/dist/collection/components/sas-timezone-select/timezones/timezone-format.js +0 -104
  29. package/dist/collection/components/sas-timezone-select/type.js +0 -9
  30. package/dist/sas-ui/p-04b19ab3.entry.js +0 -1
  31. package/dist/sas-ui/p-45bf5b72.entry.js +0 -1
  32. package/dist/types/components/sas-timezone-select/sas-timezone-select.d.ts +0 -120
  33. package/dist/types/components/sas-timezone-select/timezones/timezone-data.d.ts +0 -60
  34. package/dist/types/components/sas-timezone-select/timezones/timezone-format.d.ts +0 -30
  35. package/dist/types/components/sas-timezone-select/type.d.ts +0 -85
@@ -0,0 +1,2286 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-cd75521b.js');
6
+ const global = require('./global-fcd219ac.js');
7
+ const _commonjsHelpers = require('./_commonjsHelpers-537d719a.js');
8
+
9
+ const sasFormInputTemplateCss = ":host{display:block;position:relative;height:100%}:host .hide{display:none}:host .container{overflow-y:auto;position:absolute;min-width:var(--form-input-template-container-min-width, 100%);max-width:var(--form-input-template-container-max-width, none);background-color:white;height:0;z-index:-15;pointer-events:none}:host .top{transform:translateY(-100%);top:0}:host .right{right:0}:host(:focus){outline:none}:host(:focus-within)>.container{padding:10px 0;height:auto;overflow:visible;z-index:15;pointer-events:initial;box-shadow:0px 5px 10px #0000001A;border:1px solid #D0D9DE;border-radius:5px}:host(:not([label=\"\"])) .top{transform:translateY(-100%);top:0}:host(:not([label=\"\"])[outside]:not([outside=false])) .top{transform:translateY(calc(-100% + 30px));top:0}:host:after{content:attr(data-message);position:absolute;top:calc(100% + 5px);right:10px;color:var(--li-2);font-size:12px;text-align:right}";
10
+
11
+ let SasFormInputTemplate = class {
12
+ constructor(hostRef) {
13
+ index.registerInstance(this, hostRef);
14
+ this.inputContainerClick = index.createEvent(this, "inputContainerClick", 7);
15
+ this.containerVerticalPosition = null;
16
+ this.containerHorizontalPosition = null;
17
+ /**
18
+ * Label
19
+ */
20
+ this.label = '';
21
+ /**
22
+ * Shows an icon next to the label - mainly for help icons
23
+ */
24
+ this.iconLabel = '';
25
+ /**
26
+ * Label position
27
+ */
28
+ this.outside = false;
29
+ /**
30
+ * Shows a star symbol behind label
31
+ */
32
+ this.required = false;
33
+ /**
34
+ * Placeholder
35
+ */
36
+ this.placeholder = '';
37
+ /**
38
+ * Placeholder
39
+ */
40
+ this.type = '';
41
+ /**
42
+ * Value
43
+ */
44
+ this.value = '';
45
+ /**
46
+ * Max value, only works with type number, range and date
47
+ */
48
+ this.max = null;
49
+ /**
50
+ * Min value, only works with type number, range and date
51
+ */
52
+ this.min = null;
53
+ /**
54
+ * Icon Right
55
+ */
56
+ this.iconRight = '';
57
+ /**
58
+ * Readonly
59
+ */
60
+ this.readonly = false;
61
+ /**
62
+ * Error
63
+ */
64
+ this.error = false;
65
+ /**
66
+ * Disabled
67
+ */
68
+ this.disabled = false;
69
+ /**
70
+ * Clear
71
+ */
72
+ this.clear = false;
73
+ /**
74
+ * Container vertical position
75
+ */
76
+ this.position = null;
77
+ /**
78
+ * Container horizontal position
79
+ */
80
+ this.positionH = null;
81
+ /**
82
+ * Show or hide content under input
83
+ */
84
+ this.show = false;
85
+ /**
86
+ * Close menu or not after click menu item
87
+ */
88
+ this.clickClose = false;
89
+ /**
90
+ * Minimum amount of space required above component, before rendering container above component
91
+ */
92
+ this.minimumPixelsAboveComponentRequired = 0;
93
+ /**
94
+ * Minimum amount of space required to the right of the component, before rendering container to the right of the component
95
+ */
96
+ this.minimumPixelsRightOfComponentRequired = 0;
97
+ this.handleInputClick = (event) => {
98
+ event.stopPropagation();
99
+ if (!this.disabled) {
100
+ const container = this.el.shadowRoot.querySelector('.container');
101
+ const height = container.getBoundingClientRect().height;
102
+ if (height > 0) {
103
+ this.show = false;
104
+ }
105
+ else {
106
+ this.show = true;
107
+ }
108
+ this.inputContainerClick.emit();
109
+ }
110
+ };
111
+ this.handleContainerClick = (event) => {
112
+ event.stopPropagation();
113
+ if (this.clickClose) {
114
+ setTimeout(() => {
115
+ this.show = false;
116
+ }, 100);
117
+ }
118
+ };
119
+ this.updateContainerPosition = () => {
120
+ this.updateVerticalContainerPosition();
121
+ this.updateContainerHorizontalPosition();
122
+ };
123
+ this.updateVerticalContainerPosition = () => {
124
+ if (Boolean(this.position)) {
125
+ this.containerVerticalPosition = this.position;
126
+ }
127
+ else {
128
+ const top = this.el.getBoundingClientRect().top;
129
+ const clientHeight = document.documentElement.clientHeight;
130
+ if (clientHeight < top * 2 && top > this.minimumPixelsAboveComponentRequired) {
131
+ this.containerVerticalPosition = 'top';
132
+ }
133
+ else {
134
+ this.containerVerticalPosition = 'bottom';
135
+ }
136
+ }
137
+ };
138
+ this.updateContainerHorizontalPosition = () => {
139
+ if (Boolean(this.positionH)) {
140
+ this.containerHorizontalPosition = this.positionH;
141
+ }
142
+ else {
143
+ const left = this.el.getBoundingClientRect().left;
144
+ const clientWidth = document.documentElement.clientWidth;
145
+ if (clientWidth - this.minimumPixelsRightOfComponentRequired > left) {
146
+ this.containerHorizontalPosition = 'left';
147
+ }
148
+ else {
149
+ this.containerHorizontalPosition = 'right';
150
+ }
151
+ }
152
+ };
153
+ }
154
+ showHandler(newValue) {
155
+ if (newValue) {
156
+ this.updateContainerPosition();
157
+ this.showContainer();
158
+ }
159
+ else {
160
+ this.hideContainer();
161
+ }
162
+ }
163
+ listItemClickEventUsedInternalHandler() {
164
+ // keep focus so dropdown list will not hide if there are dropdown components inside dropdown list
165
+ this.el.focus();
166
+ }
167
+ showContainer() {
168
+ const element = this.el.shadowRoot.querySelector('.container');
169
+ element.classList.remove('hide');
170
+ }
171
+ hideContainer() {
172
+ const element = this.el.shadowRoot.querySelector('.container');
173
+ element.classList.add('hide');
174
+ }
175
+ render() {
176
+ return (index.h(index.Host, { onFocus: this.updateContainerPosition, tabindex: 0, "data-message": "" }, index.h("sas-input", { label: this.label, outside: this.outside, required: this.required, type: this.type, placeholder: this.placeholder, "icon-right": this.iconRight, value: this.value, min: this.min, max: this.max, readonly: this.readonly, disabled: this.disabled, clear: this.clear, onKeyDown: global.keydownEvent, tabindex: 0, iconLabel: this.iconLabel,
177
+ // mouseDown event is faster than focus event, click event is slower than focus event
178
+ onMouseDown: this.handleInputClick }, index.h("slot", { name: "input" })), index.h("div", { class: `container hide ${this.containerVerticalPosition} ${this.containerHorizontalPosition}`, onMouseDown: this.handleContainerClick }, index.h("slot", { name: "container" }))));
179
+ }
180
+ get el() { return index.getElement(this); }
181
+ static get watchers() { return {
182
+ "show": ["showHandler"]
183
+ }; }
184
+ };
185
+ SasFormInputTemplate.style = sasFormInputTemplateCss;
186
+
187
+ const sasInputCss = ":host{display:flex}:host .input-container{position:relative;height:var(--input-height, 40px);width:100%;max-width:100%;background-color:var(--input-background-color, white);border:var(--input-border, 1px solid var(--s-300));border-radius:5px;box-sizing:border-box;display:flex;gap:5px;padding:var(--input-padding, 0)}:host .input-container:focus-within{border:var(--input-border, 1px solid var(--s-400));outline:none;box-shadow:var(--input-focus-box-shadow, 0px 0px 5px #0000001A)}:host .input-container:after{content:attr(data-message);position:absolute;top:calc(100% + 5px);right:10px;color:var(--li-2);font-size:12px;text-align:right}:host .outside-label{color:var(--secondary);font-size:14px;position:absolute;left:0;bottom:100%;transform:translateY(-10px)}:host .inside-label{color:var(--s-400);left:10px;position:absolute;z-index:1;font-size:12px;transform:translateY(-65%);background-color:white;padding:0 2px}:host .required-symbol{margin-left:5px;color:var(--primary)}:host .input{border:none;color:var(--input-color, var(--s-500));background-color:var(--input-background-color, white);height:100%;min-width:0;font-family:roboto, \"Font Awesome 6 Pro\";font-size:14px;text-overflow:ellipsis;flex-grow:1;flex-shrink:1;margin:0 10px;box-sizing:border-box}:host .input:focus{outline:none}:host .input:required{box-shadow:none}:host ::-webkit-input-placeholder{color:var(--s-400)}:host :-ms-input-placeholder{color:var(--s-400)}:host ::placeholder{color:var(--s-400)}:host input[type=date],:host input[type=time]{-webkit-appearance:none}:host input[type=date]::-webkit-calendar-picker-indicator{display:none}:host input[type=time]::-webkit-calendar-picker-indicator{display:none}:host .input-date-container{position:relative;flex-grow:1;display:flex}:host .input-date-cover{position:absolute;left:0;right:0;top:0;bottom:0;z-index:1}:host input[readonly]:not([readonly=false]){cursor:initial}:host .iconLabel{padding-left:5px;cursor:pointer}:host .right-icon-container{display:flex;align-items:center}:host .clear-icon{--icon-color:white;--icon-background-color:var(--s-300);--icon-background-width:14px;--icon-background-height:14px;--icon-size:9px;box-shadow:none;margin-right:10px}:host .input-right-icon{--icon-color:var(--input-right-icon-color, var(--s-500));--icon-size:var(--input-right-icon-size, 14px);--icon-background-height:38px;margin-right:10px;padding:var(--input-right-icon-padding, 0)}:host .input-error{border:1px solid var(--li-2)}:host(:focus){outline:none}:host([type=textarea]) .input-container{height:var(--input-height, auto)}:host([type=textarea]) .right-icon-container{align-items:flex-start}:host([type=textarea]) .clear-icon{margin-top:10px;margin-right:10px}:host(:not([label=\"\"])) .input-container{margin-top:var(--input-margin-top, 5px)}:host([outside]:not([outside=false]):not([label=\"\"])) .input-container{margin-top:var(--input-margin-top, 30px)}:host([disabled]:not([disabled=false])) .input-container{cursor:not-allowed}:host([disabled]:not([disabled=false])) label{cursor:default}:host([disabled]:not([disabled=false])) .input-container:before{content:\"\";background-color:var(--s-200);left:0;right:0;top:0;bottom:0;position:absolute;border-radius:5px;opacity:0.3;z-index:10}:host-context([error]:not([error=false])) .input-container,:host([error]:not([error=false])) .input-container{border-color:var(--li-2)}";
188
+
189
+ let SasInput = class {
190
+ constructor(hostRef) {
191
+ index.registerInstance(this, hostRef);
192
+ this.inputUpdate = index.createEvent(this, "inputUpdate", 7);
193
+ this.inputupdate = index.createEvent(this, "inputupdate", 7);
194
+ this.labeliconclicked = index.createEvent(this, "labeliconclicked", 7);
195
+ this.inputiconrightclicked = index.createEvent(this, "inputiconrightclicked", 7);
196
+ this.inputClear = index.createEvent(this, "inputClear", 7);
197
+ this.inputFocus = index.createEvent(this, "inputFocus", 7);
198
+ this.inputBlur = index.createEvent(this, "inputBlur", 7);
199
+ this.isUpdateFromSubcomponent = false;
200
+ /**
201
+ * Type
202
+ */
203
+ this.type = 'text';
204
+ /**
205
+ * Type
206
+ */
207
+ this.step = '1';
208
+ /**
209
+ * Placeholder
210
+ */
211
+ this.placeholder = '';
212
+ /**
213
+ * name
214
+ */
215
+ this.name = '';
216
+ /**
217
+ * Value
218
+ */
219
+ this.value = '';
220
+ /**
221
+ * Label
222
+ */
223
+ this.label = '';
224
+ /**
225
+ * Label position
226
+ */
227
+ this.outside = false;
228
+ /**
229
+ * Shows a star symbol behind label
230
+ */
231
+ this.required = false;
232
+ /**
233
+ * Maximum number of characters allowed
234
+ */
235
+ this.maxlength = 1000;
236
+ /**
237
+ * Minimum number of characters allowed
238
+ */
239
+ this.minlength = 0;
240
+ /**
241
+ * Max value, only works with type number, range and date
242
+ */
243
+ this.max = null;
244
+ /**
245
+ * Min value, only works with type number, range and date
246
+ */
247
+ this.min = null;
248
+ /**
249
+ * Shows an icon next to the label - mainly for help icons
250
+ */
251
+ this.iconLabel = '';
252
+ /**
253
+ * Shows an icon on left
254
+ */
255
+ this.iconLeft = '';
256
+ /**
257
+ * Shows an icon on right, will be overrided if type is password
258
+ */
259
+ this.iconRight = '';
260
+ /**
261
+ * Show a clear icon to clear input
262
+ */
263
+ this.clear = false;
264
+ /**
265
+ * Readonly
266
+ */
267
+ this.readonly = false;
268
+ /**
269
+ * Disabled
270
+ */
271
+ this.disabled = false;
272
+ /**
273
+ * Changes to false automatically when value updates
274
+ */
275
+ this.error = false;
276
+ /**
277
+ * Only shows when prop error is true, auto generated
278
+ */
279
+ this.message = '';
280
+ // type tel props
281
+ /**
282
+ * Country
283
+ */
284
+ this.country = 'au';
285
+ /**
286
+ * Placeholder Number Type
287
+ */
288
+ this.placeholderNumberType = 'MOBILE';
289
+ /**
290
+ * phone number validity
291
+ */
292
+ this.isValidNumber = true;
293
+ this.handleInput = (event) => {
294
+ this.value = event.target.value;
295
+ this.inputUpdate.emit(event.target.value);
296
+ this.inputupdate.emit(event.target.value);
297
+ };
298
+ this.focusEvent = () => {
299
+ this.inputFocus.emit();
300
+ };
301
+ this.blurEvent = () => {
302
+ this.inputBlur.emit();
303
+ };
304
+ this.clickEvent = (event) => {
305
+ if (this.type === 'date' || this.type === "time") {
306
+ event.preventDefault();
307
+ }
308
+ };
309
+ this.togglePassword = (event) => {
310
+ const icon = event.target.icon;
311
+ const input = this.el.shadowRoot.querySelector('input');
312
+ if (icon === 'fas fa-eye-slash') {
313
+ event.target.icon = 'fas fa-eye';
314
+ input.type = 'text';
315
+ }
316
+ else {
317
+ event.target.icon = 'fas fa-eye-slash';
318
+ input.type = 'password';
319
+ }
320
+ };
321
+ this.iconRightClickHandler = () => {
322
+ this.inputiconrightclicked.emit();
323
+ };
324
+ this.labelIconClickHandler = () => {
325
+ this.labeliconclicked.emit();
326
+ };
327
+ this.clearInput = (event) => {
328
+ event.stopPropagation();
329
+ // force date field and time field to clear incomplete input
330
+ // as when input not complete, value not update
331
+ // clear value will not trigger re-render
332
+ if (this.type === 'date' || this.type === 'time') {
333
+ const inputElement = this.el.shadowRoot.querySelector('input');
334
+ inputElement.value = '';
335
+ }
336
+ this.value = '';
337
+ this.update();
338
+ this.inputClear.emit();
339
+ };
340
+ }
341
+ watchCountryHandler() {
342
+ if (this.type === 'tel') {
343
+ const inputTel = this.el.shadowRoot.querySelector('sas-input-tel');
344
+ inputTel.setCountry(this.country);
345
+ }
346
+ }
347
+ async watchValueHandler() {
348
+ if (this.isUpdateFromSubcomponent) {
349
+ this.isUpdateFromSubcomponent = false;
350
+ }
351
+ else {
352
+ if (this.type === 'tel') {
353
+ const inputTel = this.el.shadowRoot.querySelector('sas-input-tel');
354
+ inputTel.update(this.value);
355
+ }
356
+ else {
357
+ this.value = global.HTMLDecodeString(this.value);
358
+ }
359
+ }
360
+ this.resetErrorStatus();
361
+ }
362
+ watchPlaceholderNumberTypeHandler() {
363
+ if (this.type === 'tel') {
364
+ const inputTel = this.el.shadowRoot.querySelector('sas-input-tel');
365
+ inputTel.setPlaceholder(this.placeholderNumberType);
366
+ }
367
+ }
368
+ async componentWillLoad() {
369
+ this.value = global.HTMLDecodeString(this.value);
370
+ this.resetErrorStatus();
371
+ }
372
+ inputTelUpdateHandler(event) {
373
+ if (this.country !== event.detail.country) {
374
+ this.country = event.detail.country;
375
+ }
376
+ if (this.isValidNumber !== event.detail.isValidNumber) {
377
+ this.isValidNumber = event.detail.isValidNumber;
378
+ }
379
+ if (this.value !== event.detail.value) {
380
+ this.isUpdateFromSubcomponent = true;
381
+ this.value = event.detail.value;
382
+ this.inputUpdate.emit(event.detail.value);
383
+ this.inputupdate.emit(event.detail.value);
384
+ }
385
+ }
386
+ inputTextareaUpdateHandler(event) {
387
+ this.value = event.detail;
388
+ this.inputUpdate.emit(event.detail);
389
+ this.inputupdate.emit(event.detail);
390
+ }
391
+ /**
392
+ * Trigger inputupdate event programmatically
393
+ */
394
+ async update() {
395
+ const value = this.value;
396
+ this.inputUpdate.emit(value);
397
+ this.inputupdate.emit(value);
398
+ }
399
+ /**
400
+ * Validate
401
+ */
402
+ async validate(customErrorMessage = '') {
403
+ const input = document.createElement('input');
404
+ if (this.type !== 'textarea') {
405
+ input.type = this.type;
406
+ }
407
+ input.required = this.required;
408
+ input.maxLength = this.maxlength;
409
+ input.minLength = this.minlength;
410
+ input.max = this.max;
411
+ input.min = this.min;
412
+ input.value = Boolean(this.value) ? this.value.trim() : '';
413
+ let isCustomError = false;
414
+ if (customErrorMessage !== '') {
415
+ isCustomError = true;
416
+ }
417
+ // check tooShort mannually
418
+ // as tooShort not trigger by using js to set value
419
+ let validity = {
420
+ badInput: input.validity.badInput,
421
+ customError: isCustomError,
422
+ patternMismatch: input.validity.patternMismatch,
423
+ rangeOverflow: input.validity.rangeOverflow,
424
+ rangeUnderflow: input.validity.rangeUnderflow,
425
+ stepMismatch: input.validity.stepMismatch,
426
+ tooLong: input.validity.tooLong,
427
+ tooShort: input.validity.tooShort,
428
+ typeMismatch: input.validity.typeMismatch,
429
+ valid: input.validity.valid && !isCustomError,
430
+ valueMissing: input.validity.valueMissing,
431
+ };
432
+ if (Boolean(this.value)) {
433
+ const length = this.value.length;
434
+ if (length < this.minlength) {
435
+ validity.tooShort = true;
436
+ validity.valid = false;
437
+ }
438
+ }
439
+ if (this.type === 'tel') {
440
+ if (!this.isValidNumber) {
441
+ validity.typeMismatch = true;
442
+ validity.valid = false;
443
+ }
444
+ }
445
+ this.validity = validity;
446
+ }
447
+ /**
448
+ * Show error status if value is not valid (only for components internal use)
449
+ */
450
+ async updateErrorStatus(errorMessage = '') {
451
+ await this.validate(errorMessage);
452
+ this.error = !this.validity.valid;
453
+ if (this.error) {
454
+ this.message = this.getErrorMessage();
455
+ }
456
+ }
457
+ /**
458
+ * Clear error status (only for components internal use)
459
+ */
460
+ async resetErrorStatus() {
461
+ this.error = false;
462
+ this.message = '';
463
+ }
464
+ /**
465
+ * Set custom error message and validate
466
+ */
467
+ async setCustomValidity(errorMessage = 'custom validation error message') {
468
+ this.message = errorMessage;
469
+ await this.updateErrorStatus(errorMessage);
470
+ }
471
+ getErrorMessage() {
472
+ const validity = this.validity;
473
+ if (validity.valueMissing) {
474
+ const prefix = Boolean(this.label) ? this.label : 'Field';
475
+ return `${prefix} is required`;
476
+ }
477
+ if (validity.typeMismatch || validity.badInput) {
478
+ return `Invalid ${this.type} format`;
479
+ }
480
+ if (validity.rangeOverflow) {
481
+ if (this.type === 'date' && this.value[0] !== '0') {
482
+ this.inputUpdate.emit('reset request');
483
+ this.inputupdate.emit('reset request');
484
+ }
485
+ return `${this.label} must be less or equal to ${this.max}`;
486
+ }
487
+ if (validity.rangeUnderflow) {
488
+ if (this.type === 'date' && this.value[0] !== '0') {
489
+ this.inputUpdate.emit('reset request');
490
+ this.inputupdate.emit('reset request');
491
+ }
492
+ return `${this.label} must be larger or equal to ${this.min}`;
493
+ }
494
+ if (validity.tooShort) {
495
+ return `${this.label}'s length must be larger or equal to ${this.minlength} characters`;
496
+ }
497
+ return this.message;
498
+ }
499
+ getLeftIcon() {
500
+ if (Boolean(this.iconLeft)) {
501
+ const icon = this.iconLeft.slice(7);
502
+ if (icon === 'search') {
503
+ return "\uf002" + ' ';
504
+ }
505
+ }
506
+ return '';
507
+ }
508
+ generateRightIcon() {
509
+ let rightIcon = null;
510
+ if (this.type === 'password') {
511
+ rightIcon = index.h("sas-icon", { class: "input-right-icon", icon: "fas fa-eye-slash", onClick: this.togglePassword });
512
+ }
513
+ else {
514
+ if (Boolean(this.iconRight)) {
515
+ rightIcon = index.h("sas-icon", { class: "input-right-icon", icon: this.iconRight, onClick: this.iconRightClickHandler });
516
+ }
517
+ }
518
+ return rightIcon;
519
+ }
520
+ render() {
521
+ return (index.h(index.Host
522
+ // onBlur = {() => this.updateErrorStatus()}
523
+ , null, index.h("div", { class: "input-container", "data-message": this.message }, Boolean(this.label)
524
+ ? index.h("label", { class: this.outside ? 'outside-label' : 'inside-label' }, this.label, this.required
525
+ ? index.h("span", { class: "required-symbol" }, "*")
526
+ : null, index.h("sas-icon", { class: "iconLabel", icon: this.iconLabel, onClick: this.labelIconClickHandler }))
527
+ : null, this.type === 'tel'
528
+ ? index.h("sas-input-tel", { "data-country": this.country, "data-value": this.value, "data-placeholder": this.placeholder, "data-placeholderNumberType": this.placeholderNumberType })
529
+ : null, this.type === 'textarea'
530
+ ? index.h("sas-input-textarea", { placeholder: this.getLeftIcon() + this.placeholder, maxlength: this.maxlength, minlength: this.minlength, value: this.value })
531
+ : null, this.type === 'date'
532
+ ? index.h("div", { class: "input-date-container" }, index.h("input", { class: "input", type: "date", placeholder: this.getLeftIcon() + this.placeholder, readonly: this.readonly, required: true, maxlength: this.maxlength, minlength: this.minlength, max: this.max, min: this.min, value: this.value, onFocus: this.focusEvent, onInput: this.handleInput, onBlur: this.blurEvent, onClick: this.clickEvent }), localStorage.getItem('platform') === 'ios' // prevent user interact with input field to trigger native date picker
533
+ ? index.h("div", { class: "input-date-cover" })
534
+ : null)
535
+ : null, this.type !== 'tel' && this.type !== 'textarea' && this.type !== 'date'
536
+ ? index.h("input", { class: "input", type: this.type, placeholder: this.getLeftIcon() + this.placeholder, readonly: this.readonly, required: this.required || this.type === 'date', maxlength: this.maxlength, minlength: this.minlength, max: this.max, min: this.min, step: this.step, value: this.value, onFocus: this.focusEvent, onInput: this.handleInput, onBlur: this.blurEvent, onClick: this.clickEvent })
537
+ : null, index.h("slot", null), index.h("div", { class: "right-icon-container" }, this.clear
538
+ ? index.h("sas-icon", { class: "clear-icon", type: "round", icon: "fas fa-times", onMouseDown: this.clearInput })
539
+ : null, this.generateRightIcon()))));
540
+ }
541
+ get el() { return index.getElement(this); }
542
+ static get watchers() { return {
543
+ "country": ["watchCountryHandler"],
544
+ "value": ["watchValueHandler"],
545
+ "placeholderNumberType": ["watchPlaceholderNumberTypeHandler"]
546
+ }; }
547
+ };
548
+ SasInput.style = sasInputCss;
549
+
550
+ var intlTelInput$1 = _commonjsHelpers.createCommonjsModule(function (module) {
551
+ /*
552
+ * International Telephone Input v18.2.1
553
+ * https://github.com/jackocnr/intl-tel-input.git
554
+ * Licensed under the MIT license
555
+ */
556
+
557
+ // wrap in UMD
558
+ (function(factory) {
559
+ if (module.exports) module.exports = factory(); else window.intlTelInput = factory();
560
+ })(function(undefined$1) {
561
+ return function() {
562
+ // Array of country objects for the flag dropdown.
563
+ // Here is the criteria for the plugin to support a given country/territory
564
+ // - It has an iso2 code: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
565
+ // - It has it's own country calling code (it is not a sub-region of another country): https://en.wikipedia.org/wiki/List_of_country_calling_codes
566
+ // - It has a flag in the region-flags project: https://github.com/behdad/region-flags/tree/gh-pages/png
567
+ // - It is supported by libphonenumber (it must be listed on this page): https://github.com/googlei18n/libphonenumber/blob/master/resources/ShortNumberMetadata.xml
568
+ // Each country array has the following information:
569
+ // [
570
+ // Country name,
571
+ // iso2 code,
572
+ // International dial code,
573
+ // Order (if >1 country with same dial code),
574
+ // Area codes
575
+ // ]
576
+ var allCountries = [ [ "Afghanistan (‫افغانستان‬‎)", "af", "93" ], [ "Albania (Shqipëri)", "al", "355" ], [ "Algeria (‫الجزائر‬‎)", "dz", "213" ], [ "American Samoa", "as", "1", 5, [ "684" ] ], [ "Andorra", "ad", "376" ], [ "Angola", "ao", "244" ], [ "Anguilla", "ai", "1", 6, [ "264" ] ], [ "Antigua and Barbuda", "ag", "1", 7, [ "268" ] ], [ "Argentina", "ar", "54" ], [ "Armenia (Հայաստան)", "am", "374" ], [ "Aruba", "aw", "297" ], [ "Ascension Island", "ac", "247" ], [ "Australia", "au", "61", 0 ], [ "Austria (Österreich)", "at", "43" ], [ "Azerbaijan (Azərbaycan)", "az", "994" ], [ "Bahamas", "bs", "1", 8, [ "242" ] ], [ "Bahrain (‫البحرين‬‎)", "bh", "973" ], [ "Bangladesh (বাংলাদেশ)", "bd", "880" ], [ "Barbados", "bb", "1", 9, [ "246" ] ], [ "Belarus (Беларусь)", "by", "375" ], [ "Belgium (België)", "be", "32" ], [ "Belize", "bz", "501" ], [ "Benin (Bénin)", "bj", "229" ], [ "Bermuda", "bm", "1", 10, [ "441" ] ], [ "Bhutan (འབྲུག)", "bt", "975" ], [ "Bolivia", "bo", "591" ], [ "Bosnia and Herzegovina (Босна и Херцеговина)", "ba", "387" ], [ "Botswana", "bw", "267" ], [ "Brazil (Brasil)", "br", "55" ], [ "British Indian Ocean Territory", "io", "246" ], [ "British Virgin Islands", "vg", "1", 11, [ "284" ] ], [ "Brunei", "bn", "673" ], [ "Bulgaria (България)", "bg", "359" ], [ "Burkina Faso", "bf", "226" ], [ "Burundi (Uburundi)", "bi", "257" ], [ "Cambodia (កម្ពុជា)", "kh", "855" ], [ "Cameroon (Cameroun)", "cm", "237" ], [ "Canada", "ca", "1", 1, [ "204", "226", "236", "249", "250", "263", "289", "306", "343", "354", "365", "367", "368", "382", "387", "403", "416", "418", "428", "431", "437", "438", "450", "584", "468", "474", "506", "514", "519", "548", "579", "581", "584", "587", "604", "613", "639", "647", "672", "683", "705", "709", "742", "753", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905" ] ], [ "Cape Verde (Kabu Verdi)", "cv", "238" ], [ "Caribbean Netherlands", "bq", "599", 1, [ "3", "4", "7" ] ], [ "Cayman Islands", "ky", "1", 12, [ "345" ] ], [ "Central African Republic (République centrafricaine)", "cf", "236" ], [ "Chad (Tchad)", "td", "235" ], [ "Chile", "cl", "56" ], [ "China (中国)", "cn", "86" ], [ "Christmas Island", "cx", "61", 2, [ "89164" ] ], [ "Cocos (Keeling) Islands", "cc", "61", 1, [ "89162" ] ], [ "Colombia", "co", "57" ], [ "Comoros (‫جزر القمر‬‎)", "km", "269" ], [ "Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)", "cd", "243" ], [ "Congo (Republic) (Congo-Brazzaville)", "cg", "242" ], [ "Cook Islands", "ck", "682" ], [ "Costa Rica", "cr", "506" ], [ "Côte d’Ivoire", "ci", "225" ], [ "Croatia (Hrvatska)", "hr", "385" ], [ "Cuba", "cu", "53" ], [ "Curaçao", "cw", "599", 0 ], [ "Cyprus (Κύπρος)", "cy", "357" ], [ "Czech Republic (Česká republika)", "cz", "420" ], [ "Denmark (Danmark)", "dk", "45" ], [ "Djibouti", "dj", "253" ], [ "Dominica", "dm", "1", 13, [ "767" ] ], [ "Dominican Republic (República Dominicana)", "do", "1", 2, [ "809", "829", "849" ] ], [ "Ecuador", "ec", "593" ], [ "Egypt (‫مصر‬‎)", "eg", "20" ], [ "El Salvador", "sv", "503" ], [ "Equatorial Guinea (Guinea Ecuatorial)", "gq", "240" ], [ "Eritrea", "er", "291" ], [ "Estonia (Eesti)", "ee", "372" ], [ "Eswatini", "sz", "268" ], [ "Ethiopia", "et", "251" ], [ "Falkland Islands (Islas Malvinas)", "fk", "500" ], [ "Faroe Islands (Føroyar)", "fo", "298" ], [ "Fiji", "fj", "679" ], [ "Finland (Suomi)", "fi", "358", 0 ], [ "France", "fr", "33" ], [ "French Guiana (Guyane française)", "gf", "594" ], [ "French Polynesia (Polynésie française)", "pf", "689" ], [ "Gabon", "ga", "241" ], [ "Gambia", "gm", "220" ], [ "Georgia (საქართველო)", "ge", "995" ], [ "Germany (Deutschland)", "de", "49" ], [ "Ghana (Gaana)", "gh", "233" ], [ "Gibraltar", "gi", "350" ], [ "Greece (Ελλάδα)", "gr", "30" ], [ "Greenland (Kalaallit Nunaat)", "gl", "299" ], [ "Grenada", "gd", "1", 14, [ "473" ] ], [ "Guadeloupe", "gp", "590", 0 ], [ "Guam", "gu", "1", 15, [ "671" ] ], [ "Guatemala", "gt", "502" ], [ "Guernsey", "gg", "44", 1, [ "1481", "7781", "7839", "7911" ] ], [ "Guinea (Guinée)", "gn", "224" ], [ "Guinea-Bissau (Guiné Bissau)", "gw", "245" ], [ "Guyana", "gy", "592" ], [ "Haiti", "ht", "509" ], [ "Honduras", "hn", "504" ], [ "Hong Kong (香港)", "hk", "852" ], [ "Hungary (Magyarország)", "hu", "36" ], [ "Iceland (Ísland)", "is", "354" ], [ "India (भारत)", "in", "91" ], [ "Indonesia", "id", "62" ], [ "Iran (‫ایران‬‎)", "ir", "98" ], [ "Iraq (‫العراق‬‎)", "iq", "964" ], [ "Ireland", "ie", "353" ], [ "Isle of Man", "im", "44", 2, [ "1624", "74576", "7524", "7924", "7624" ] ], [ "Israel (‫ישראל‬‎)", "il", "972" ], [ "Italy (Italia)", "it", "39", 0 ], [ "Jamaica", "jm", "1", 4, [ "876", "658" ] ], [ "Japan (日本)", "jp", "81" ], [ "Jersey", "je", "44", 3, [ "1534", "7509", "7700", "7797", "7829", "7937" ] ], [ "Jordan (‫الأردن‬‎)", "jo", "962" ], [ "Kazakhstan (Казахстан)", "kz", "7", 1, [ "33", "7" ] ], [ "Kenya", "ke", "254" ], [ "Kiribati", "ki", "686" ], [ "Kosovo", "xk", "383" ], [ "Kuwait (‫الكويت‬‎)", "kw", "965" ], [ "Kyrgyzstan (Кыргызстан)", "kg", "996" ], [ "Laos (ລາວ)", "la", "856" ], [ "Latvia (Latvija)", "lv", "371" ], [ "Lebanon (‫لبنان‬‎)", "lb", "961" ], [ "Lesotho", "ls", "266" ], [ "Liberia", "lr", "231" ], [ "Libya (‫ليبيا‬‎)", "ly", "218" ], [ "Liechtenstein", "li", "423" ], [ "Lithuania (Lietuva)", "lt", "370" ], [ "Luxembourg", "lu", "352" ], [ "Macau (澳門)", "mo", "853" ], [ "Madagascar (Madagasikara)", "mg", "261" ], [ "Malawi", "mw", "265" ], [ "Malaysia", "my", "60" ], [ "Maldives", "mv", "960" ], [ "Mali", "ml", "223" ], [ "Malta", "mt", "356" ], [ "Marshall Islands", "mh", "692" ], [ "Martinique", "mq", "596" ], [ "Mauritania (‫موريتانيا‬‎)", "mr", "222" ], [ "Mauritius (Moris)", "mu", "230" ], [ "Mayotte", "yt", "262", 1, [ "269", "639" ] ], [ "Mexico (México)", "mx", "52" ], [ "Micronesia", "fm", "691" ], [ "Moldova (Republica Moldova)", "md", "373" ], [ "Monaco", "mc", "377" ], [ "Mongolia (Монгол)", "mn", "976" ], [ "Montenegro (Crna Gora)", "me", "382" ], [ "Montserrat", "ms", "1", 16, [ "664" ] ], [ "Morocco (‫المغرب‬‎)", "ma", "212", 0 ], [ "Mozambique (Moçambique)", "mz", "258" ], [ "Myanmar (Burma) (မြန်မာ)", "mm", "95" ], [ "Namibia (Namibië)", "na", "264" ], [ "Nauru", "nr", "674" ], [ "Nepal (नेपाल)", "np", "977" ], [ "Netherlands (Nederland)", "nl", "31" ], [ "New Caledonia (Nouvelle-Calédonie)", "nc", "687" ], [ "New Zealand", "nz", "64" ], [ "Nicaragua", "ni", "505" ], [ "Niger (Nijar)", "ne", "227" ], [ "Nigeria", "ng", "234" ], [ "Niue", "nu", "683" ], [ "Norfolk Island", "nf", "672" ], [ "North Korea (조선 민주주의 인민 공화국)", "kp", "850" ], [ "North Macedonia (Северна Македонија)", "mk", "389" ], [ "Northern Mariana Islands", "mp", "1", 17, [ "670" ] ], [ "Norway (Norge)", "no", "47", 0 ], [ "Oman (‫عُمان‬‎)", "om", "968" ], [ "Pakistan (‫پاکستان‬‎)", "pk", "92" ], [ "Palau", "pw", "680" ], [ "Palestine (‫فلسطين‬‎)", "ps", "970" ], [ "Panama (Panamá)", "pa", "507" ], [ "Papua New Guinea", "pg", "675" ], [ "Paraguay", "py", "595" ], [ "Peru (Perú)", "pe", "51" ], [ "Philippines", "ph", "63" ], [ "Poland (Polska)", "pl", "48" ], [ "Portugal", "pt", "351" ], [ "Puerto Rico", "pr", "1", 3, [ "787", "939" ] ], [ "Qatar (‫قطر‬‎)", "qa", "974" ], [ "Réunion (La Réunion)", "re", "262", 0 ], [ "Romania (România)", "ro", "40" ], [ "Russia (Россия)", "ru", "7", 0 ], [ "Rwanda", "rw", "250" ], [ "Saint Barthélemy", "bl", "590", 1 ], [ "Saint Helena", "sh", "290" ], [ "Saint Kitts and Nevis", "kn", "1", 18, [ "869" ] ], [ "Saint Lucia", "lc", "1", 19, [ "758" ] ], [ "Saint Martin (Saint-Martin (partie française))", "mf", "590", 2 ], [ "Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)", "pm", "508" ], [ "Saint Vincent and the Grenadines", "vc", "1", 20, [ "784" ] ], [ "Samoa", "ws", "685" ], [ "San Marino", "sm", "378" ], [ "São Tomé and Príncipe (São Tomé e Príncipe)", "st", "239" ], [ "Saudi Arabia (‫المملكة العربية السعودية‬‎)", "sa", "966" ], [ "Senegal (Sénégal)", "sn", "221" ], [ "Serbia (Србија)", "rs", "381" ], [ "Seychelles", "sc", "248" ], [ "Sierra Leone", "sl", "232" ], [ "Singapore", "sg", "65" ], [ "Sint Maarten", "sx", "1", 21, [ "721" ] ], [ "Slovakia (Slovensko)", "sk", "421" ], [ "Slovenia (Slovenija)", "si", "386" ], [ "Solomon Islands", "sb", "677" ], [ "Somalia (Soomaaliya)", "so", "252" ], [ "South Africa", "za", "27" ], [ "South Korea (대한민국)", "kr", "82" ], [ "South Sudan (‫جنوب السودان‬‎)", "ss", "211" ], [ "Spain (España)", "es", "34" ], [ "Sri Lanka (ශ්‍රී ලංකාව)", "lk", "94" ], [ "Sudan (‫السودان‬‎)", "sd", "249" ], [ "Suriname", "sr", "597" ], [ "Svalbard and Jan Mayen", "sj", "47", 1, [ "79" ] ], [ "Sweden (Sverige)", "se", "46" ], [ "Switzerland (Schweiz)", "ch", "41" ], [ "Syria (‫سوريا‬‎)", "sy", "963" ], [ "Taiwan (台灣)", "tw", "886" ], [ "Tajikistan", "tj", "992" ], [ "Tanzania", "tz", "255" ], [ "Thailand (ไทย)", "th", "66" ], [ "Timor-Leste", "tl", "670" ], [ "Togo", "tg", "228" ], [ "Tokelau", "tk", "690" ], [ "Tonga", "to", "676" ], [ "Trinidad and Tobago", "tt", "1", 22, [ "868" ] ], [ "Tunisia (‫تونس‬‎)", "tn", "216" ], [ "Turkey (Türkiye)", "tr", "90" ], [ "Turkmenistan", "tm", "993" ], [ "Turks and Caicos Islands", "tc", "1", 23, [ "649" ] ], [ "Tuvalu", "tv", "688" ], [ "U.S. Virgin Islands", "vi", "1", 24, [ "340" ] ], [ "Uganda", "ug", "256" ], [ "Ukraine (Україна)", "ua", "380" ], [ "United Arab Emirates (‫الإمارات العربية المتحدة‬‎)", "ae", "971" ], [ "United Kingdom", "gb", "44", 0 ], [ "United States", "us", "1", 0 ], [ "Uruguay", "uy", "598" ], [ "Uzbekistan (Oʻzbekiston)", "uz", "998" ], [ "Vanuatu", "vu", "678" ], [ "Vatican City (Città del Vaticano)", "va", "39", 1, [ "06698" ] ], [ "Venezuela", "ve", "58" ], [ "Vietnam (Việt Nam)", "vn", "84" ], [ "Wallis and Futuna (Wallis-et-Futuna)", "wf", "681" ], [ "Western Sahara (‫الصحراء الغربية‬‎)", "eh", "212", 1, [ "5288", "5289" ] ], [ "Yemen (‫اليمن‬‎)", "ye", "967" ], [ "Zambia", "zm", "260" ], [ "Zimbabwe", "zw", "263" ], [ "Åland Islands", "ax", "358", 1, [ "18" ] ] ];
577
+ // loop over all of the countries above, restructuring the data to be objects with named keys
578
+ for (var i = 0; i < allCountries.length; i++) {
579
+ var c = allCountries[i];
580
+ allCountries[i] = {
581
+ name: c[0],
582
+ iso2: c[1],
583
+ dialCode: c[2],
584
+ priority: c[3] || 0,
585
+ areaCodes: c[4] || null
586
+ };
587
+ }
588
+ function _objectSpread(target) {
589
+ for (var i = 1; i < arguments.length; i++) {
590
+ var source = arguments[i] != null ? Object(arguments[i]) : {};
591
+ var ownKeys = Object.keys(source);
592
+ if (typeof Object.getOwnPropertySymbols === "function") {
593
+ ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function(sym) {
594
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
595
+ }));
596
+ }
597
+ ownKeys.forEach(function(key) {
598
+ _defineProperty(target, key, source[key]);
599
+ });
600
+ }
601
+ return target;
602
+ }
603
+ function _defineProperty(obj, key, value) {
604
+ key = _toPropertyKey(key);
605
+ if (key in obj) {
606
+ Object.defineProperty(obj, key, {
607
+ value: value,
608
+ enumerable: true,
609
+ configurable: true,
610
+ writable: true
611
+ });
612
+ } else {
613
+ obj[key] = value;
614
+ }
615
+ return obj;
616
+ }
617
+ function _classCallCheck(instance, Constructor) {
618
+ if (!(instance instanceof Constructor)) {
619
+ throw new TypeError("Cannot call a class as a function");
620
+ }
621
+ }
622
+ function _defineProperties(target, props) {
623
+ for (var i = 0; i < props.length; i++) {
624
+ var descriptor = props[i];
625
+ descriptor.enumerable = descriptor.enumerable || false;
626
+ descriptor.configurable = true;
627
+ if ("value" in descriptor) descriptor.writable = true;
628
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
629
+ }
630
+ }
631
+ function _createClass(Constructor, protoProps, staticProps) {
632
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
633
+ if (staticProps) _defineProperties(Constructor, staticProps);
634
+ Object.defineProperty(Constructor, "prototype", {
635
+ writable: false
636
+ });
637
+ return Constructor;
638
+ }
639
+ function _toPropertyKey(arg) {
640
+ var key = _toPrimitive(arg, "string");
641
+ return typeof key === "symbol" ? key : String(key);
642
+ }
643
+ function _toPrimitive(input, hint) {
644
+ if (typeof input !== "object" || input === null) return input;
645
+ var prim = input[Symbol.toPrimitive];
646
+ if (prim !== undefined$1) {
647
+ var res = prim.call(input, hint || "default");
648
+ if (typeof res !== "object") return res;
649
+ throw new TypeError("@@toPrimitive must return a primitive value.");
650
+ }
651
+ return (hint === "string" ? String : Number)(input);
652
+ }
653
+ var intlTelInputGlobals = {
654
+ getInstance: function getInstance(input) {
655
+ var id = input.getAttribute("data-intl-tel-input-id");
656
+ return window.intlTelInputGlobals.instances[id];
657
+ },
658
+ instances: {},
659
+ // using a global like this allows us to mock it in the tests
660
+ documentReady: function documentReady() {
661
+ return document.readyState === "complete";
662
+ }
663
+ };
664
+ if (typeof window === "object") {
665
+ window.intlTelInputGlobals = intlTelInputGlobals;
666
+ }
667
+ // these vars persist through all instances of the plugin
668
+ var id = 0;
669
+ var defaults = {
670
+ // whether or not to allow the dropdown
671
+ allowDropdown: true,
672
+ // auto insert dial code (A) on init, (B) on user selecting a country, (C) on calling setCountry
673
+ // also listen for blur/submit and auto remove dial code if that's all there is
674
+ autoInsertDialCode: false,
675
+ // add a placeholder in the input with an example number for the selected country
676
+ autoPlaceholder: "polite",
677
+ // modify the parentClass
678
+ customContainer: "",
679
+ // modify the auto placeholder
680
+ customPlaceholder: null,
681
+ // append menu to specified element
682
+ dropdownContainer: null,
683
+ // don't display these countries
684
+ excludeCountries: [],
685
+ // format the input value during initialisation and on setNumber
686
+ formatOnDisplay: true,
687
+ // geoIp lookup function
688
+ geoIpLookup: null,
689
+ // inject a hidden input with this name, and on submit, populate it with the result of getNumber
690
+ hiddenInput: "",
691
+ // initial country
692
+ initialCountry: "",
693
+ // localized country names e.g. { 'de': 'Deutschland' }
694
+ localizedCountries: null,
695
+ // national vs international formatting for numbers e.g. placeholders and displaying existing numbers
696
+ nationalMode: true,
697
+ // display only these countries
698
+ onlyCountries: [],
699
+ // number type to use for placeholders
700
+ placeholderNumberType: "MOBILE",
701
+ // the countries at the top of the list. defaults to united states and united kingdom
702
+ preferredCountries: [ "us", "gb" ],
703
+ // display the country dial code next to the selected flag
704
+ separateDialCode: false,
705
+ // option to hide the flags - must be used with separateDialCode, or allowDropdown=false
706
+ showFlags: true,
707
+ // specify the path to the libphonenumber script to enable validation/formatting
708
+ utilsScript: ""
709
+ };
710
+ // https://en.wikipedia.org/wiki/List_of_North_American_Numbering_Plan_area_codes#Non-geographic_area_codes
711
+ var regionlessNanpNumbers = [ "800", "822", "833", "844", "855", "866", "877", "880", "881", "882", "883", "884", "885", "886", "887", "888", "889" ];
712
+ // utility function to iterate over an object. can't use Object.entries or native forEach because
713
+ // of IE11
714
+ var forEachProp = function forEachProp(obj, callback) {
715
+ var keys = Object.keys(obj);
716
+ for (var i = 0; i < keys.length; i++) {
717
+ callback(keys[i], obj[keys[i]]);
718
+ }
719
+ };
720
+ // run a method on each instance of the plugin
721
+ var forEachInstance = function forEachInstance(method) {
722
+ forEachProp(window.intlTelInputGlobals.instances, function(key) {
723
+ window.intlTelInputGlobals.instances[key][method]();
724
+ });
725
+ };
726
+ // this is our plugin class that we will create an instance of
727
+ // eslint-disable-next-line no-unused-vars
728
+ var Iti = /*#__PURE__*/ function() {
729
+ function Iti(input, options) {
730
+ var _this = this;
731
+ _classCallCheck(this, Iti);
732
+ this.id = id++;
733
+ this.telInput = input;
734
+ this.activeItem = null;
735
+ this.highlightedItem = null;
736
+ // process specified options / defaults
737
+ // alternative to Object.assign, which isn't supported by IE11
738
+ var customOptions = options || {};
739
+ this.options = {};
740
+ forEachProp(defaults, function(key, value) {
741
+ _this.options[key] = customOptions.hasOwnProperty(key) ? customOptions[key] : value;
742
+ });
743
+ this.hadInitialPlaceholder = Boolean(input.getAttribute("placeholder"));
744
+ }
745
+ _createClass(Iti, [ {
746
+ key: "_init",
747
+ value: function _init() {
748
+ var _this2 = this;
749
+ // if in nationalMode, do not insert dial codes
750
+ if (this.options.nationalMode) {
751
+ this.options.autoInsertDialCode = false;
752
+ }
753
+ // if separateDialCode enabled, do not insert dial codes
754
+ if (this.options.separateDialCode) {
755
+ this.options.autoInsertDialCode = false;
756
+ }
757
+ // force showFlags=true if there's a dropdown and we're not displaying the dial code,
758
+ // as otherwise you just have a down arrow on it's own which doesn't make sense
759
+ var forceShowFlags = this.options.allowDropdown && !this.options.separateDialCode;
760
+ if (!this.options.showFlags && forceShowFlags) {
761
+ this.options.showFlags = true;
762
+ }
763
+ // we cannot just test screen size as some smartphones/website meta tags will report desktop
764
+ // resolutions
765
+ // Note: for some reason jasmine breaks if you put this in the main Plugin function with the
766
+ // rest of these declarations
767
+ // Note: to target Android Mobiles (and not Tablets), we must find 'Android' and 'Mobile'
768
+ this.isMobile = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
769
+ if (this.isMobile) {
770
+ // trigger the mobile dropdown css
771
+ document.body.classList.add("iti-mobile");
772
+ // on mobile, we want a full screen dropdown, so we must append it to the body
773
+ if (!this.options.dropdownContainer) {
774
+ this.options.dropdownContainer = document.body;
775
+ }
776
+ }
777
+ // check if input has one parent with RTL
778
+ this.isRTL = !!this.telInput.closest("[dir=rtl]");
779
+ // these promises get resolved when their individual requests complete
780
+ // this way the dev can do something like iti.promise.then(...) to know when all requests are
781
+ // complete
782
+ if (typeof Promise !== "undefined") {
783
+ var autoCountryPromise = new Promise(function(resolve, reject) {
784
+ _this2.resolveAutoCountryPromise = resolve;
785
+ _this2.rejectAutoCountryPromise = reject;
786
+ });
787
+ var utilsScriptPromise = new Promise(function(resolve, reject) {
788
+ _this2.resolveUtilsScriptPromise = resolve;
789
+ _this2.rejectUtilsScriptPromise = reject;
790
+ });
791
+ this.promise = Promise.all([ autoCountryPromise, utilsScriptPromise ]);
792
+ } else {
793
+ // prevent errors when Promise doesn't exist
794
+ this.resolveAutoCountryPromise = this.rejectAutoCountryPromise = function() {};
795
+ this.resolveUtilsScriptPromise = this.rejectUtilsScriptPromise = function() {};
796
+ }
797
+ // in various situations there could be no country selected initially, but we need to be able
798
+ // to assume this variable exists
799
+ this.selectedCountryData = {};
800
+ // process all the data: onlyCountries, excludeCountries, preferredCountries etc
801
+ this._processCountryData();
802
+ // generate the markup
803
+ this._generateMarkup();
804
+ // set the initial state of the input value and the selected flag
805
+ this._setInitialState();
806
+ // start all of the event listeners: autoInsertDialCode, input keydown, selectedFlag click
807
+ this._initListeners();
808
+ // utils script, and auto country
809
+ this._initRequests();
810
+ }
811
+ }, {
812
+ key: "_processCountryData",
813
+ value: function _processCountryData() {
814
+ // process onlyCountries or excludeCountries array if present
815
+ this._processAllCountries();
816
+ // process the countryCodes map
817
+ this._processCountryCodes();
818
+ // process the preferredCountries
819
+ this._processPreferredCountries();
820
+ // translate countries according to localizedCountries option
821
+ if (this.options.localizedCountries) {
822
+ this._translateCountriesByLocale();
823
+ }
824
+ // sort countries by name
825
+ if (this.options.onlyCountries.length || this.options.localizedCountries) {
826
+ this.countries.sort(this._countryNameSort);
827
+ }
828
+ }
829
+ }, {
830
+ key: "_addCountryCode",
831
+ value: function _addCountryCode(iso2, countryCode, priority) {
832
+ if (countryCode.length > this.countryCodeMaxLen) {
833
+ this.countryCodeMaxLen = countryCode.length;
834
+ }
835
+ if (!this.countryCodes.hasOwnProperty(countryCode)) {
836
+ this.countryCodes[countryCode] = [];
837
+ }
838
+ // bail if we already have this country for this countryCode
839
+ for (var i = 0; i < this.countryCodes[countryCode].length; i++) {
840
+ if (this.countryCodes[countryCode][i] === iso2) {
841
+ return;
842
+ }
843
+ }
844
+ // check for undefined as 0 is falsy
845
+ var index = priority !== undefined$1 ? priority : this.countryCodes[countryCode].length;
846
+ this.countryCodes[countryCode][index] = iso2;
847
+ }
848
+ }, {
849
+ key: "_processAllCountries",
850
+ value: function _processAllCountries() {
851
+ if (this.options.onlyCountries.length) {
852
+ var lowerCaseOnlyCountries = this.options.onlyCountries.map(function(country) {
853
+ return country.toLowerCase();
854
+ });
855
+ this.countries = allCountries.filter(function(country) {
856
+ return lowerCaseOnlyCountries.indexOf(country.iso2) > -1;
857
+ });
858
+ } else if (this.options.excludeCountries.length) {
859
+ var lowerCaseExcludeCountries = this.options.excludeCountries.map(function(country) {
860
+ return country.toLowerCase();
861
+ });
862
+ this.countries = allCountries.filter(function(country) {
863
+ return lowerCaseExcludeCountries.indexOf(country.iso2) === -1;
864
+ });
865
+ } else {
866
+ this.countries = allCountries;
867
+ }
868
+ }
869
+ }, {
870
+ key: "_translateCountriesByLocale",
871
+ value: function _translateCountriesByLocale() {
872
+ for (var i = 0; i < this.countries.length; i++) {
873
+ var iso = this.countries[i].iso2.toLowerCase();
874
+ if (this.options.localizedCountries.hasOwnProperty(iso)) {
875
+ this.countries[i].name = this.options.localizedCountries[iso];
876
+ }
877
+ }
878
+ }
879
+ }, {
880
+ key: "_countryNameSort",
881
+ value: function _countryNameSort(a, b) {
882
+ if (a.name < b.name) {
883
+ return -1;
884
+ }
885
+ if (a.name > b.name) {
886
+ return 1;
887
+ }
888
+ return 0;
889
+ }
890
+ }, {
891
+ key: "_processCountryCodes",
892
+ value: function _processCountryCodes() {
893
+ this.countryCodeMaxLen = 0;
894
+ // here we store just dial codes
895
+ this.dialCodes = {};
896
+ // here we store "country codes" (both dial codes and their area codes)
897
+ this.countryCodes = {};
898
+ // first: add dial codes
899
+ for (var i = 0; i < this.countries.length; i++) {
900
+ var c = this.countries[i];
901
+ if (!this.dialCodes[c.dialCode]) {
902
+ this.dialCodes[c.dialCode] = true;
903
+ }
904
+ this._addCountryCode(c.iso2, c.dialCode, c.priority);
905
+ }
906
+ // next: add area codes
907
+ // this is a second loop over countries, to make sure we have all of the "root" countries
908
+ // already in the map, so that we can access them, as each time we add an area code substring
909
+ // to the map, we also need to include the "root" country's code, as that also matches
910
+ for (var _i = 0; _i < this.countries.length; _i++) {
911
+ var _c = this.countries[_i];
912
+ // area codes
913
+ if (_c.areaCodes) {
914
+ var rootCountryCode = this.countryCodes[_c.dialCode][0];
915
+ // for each area code
916
+ for (var j = 0; j < _c.areaCodes.length; j++) {
917
+ var areaCode = _c.areaCodes[j];
918
+ // for each digit in the area code to add all partial matches as well
919
+ for (var k = 1; k < areaCode.length; k++) {
920
+ var partialDialCode = _c.dialCode + areaCode.substr(0, k);
921
+ // start with the root country, as that also matches this dial code
922
+ this._addCountryCode(rootCountryCode, partialDialCode);
923
+ this._addCountryCode(_c.iso2, partialDialCode);
924
+ }
925
+ // add the full area code
926
+ this._addCountryCode(_c.iso2, _c.dialCode + areaCode);
927
+ }
928
+ }
929
+ }
930
+ }
931
+ }, {
932
+ key: "_processPreferredCountries",
933
+ value: function _processPreferredCountries() {
934
+ this.preferredCountries = [];
935
+ for (var i = 0; i < this.options.preferredCountries.length; i++) {
936
+ var countryCode = this.options.preferredCountries[i].toLowerCase();
937
+ var countryData = this._getCountryData(countryCode, false, true);
938
+ if (countryData) {
939
+ this.preferredCountries.push(countryData);
940
+ }
941
+ }
942
+ }
943
+ }, {
944
+ key: "_createEl",
945
+ value: function _createEl(name, attrs, container) {
946
+ var el = document.createElement(name);
947
+ if (attrs) {
948
+ forEachProp(attrs, function(key, value) {
949
+ return el.setAttribute(key, value);
950
+ });
951
+ }
952
+ if (container) {
953
+ container.appendChild(el);
954
+ }
955
+ return el;
956
+ }
957
+ }, {
958
+ key: "_generateMarkup",
959
+ value: function _generateMarkup() {
960
+ // if autocomplete does not exist on the element and its form, then
961
+ // prevent autocomplete as there's no safe, cross-browser event we can react to, so it can
962
+ // easily put the plugin in an inconsistent state e.g. the wrong flag selected for the
963
+ // autocompleted number, which on submit could mean wrong number is saved
964
+ if (!this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete"))) {
965
+ this.telInput.setAttribute("autocomplete", "off");
966
+ }
967
+ var _this$options = this.options, allowDropdown = _this$options.allowDropdown, separateDialCode = _this$options.separateDialCode, showFlags = _this$options.showFlags, customContainer = _this$options.customContainer, hiddenInput = _this$options.hiddenInput, dropdownContainer = _this$options.dropdownContainer;
968
+ // containers (mostly for positioning)
969
+ var parentClass = "iti";
970
+ if (allowDropdown) {
971
+ parentClass += " iti--allow-dropdown";
972
+ }
973
+ if (separateDialCode) {
974
+ parentClass += " iti--separate-dial-code";
975
+ }
976
+ if (showFlags) {
977
+ parentClass += " iti--show-flags";
978
+ }
979
+ if (customContainer) {
980
+ parentClass += " ".concat(customContainer);
981
+ }
982
+ var wrapper = this._createEl("div", {
983
+ "class": parentClass
984
+ });
985
+ this.telInput.parentNode.insertBefore(wrapper, this.telInput);
986
+ // only hide the flagsContainer if allowDropdown, showFlags and separateDialCode are all false
987
+ var showFlagsContainer = allowDropdown || showFlags || separateDialCode;
988
+ if (showFlagsContainer) {
989
+ this.flagsContainer = this._createEl("div", {
990
+ "class": "iti__flag-container"
991
+ }, wrapper);
992
+ }
993
+ wrapper.appendChild(this.telInput);
994
+ // selected flag (displayed to left of input)
995
+ // using Aria tags for "Select-Only Combobox Example"
996
+ // https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/
997
+ if (showFlagsContainer) {
998
+ this.selectedFlag = this._createEl("div", _objectSpread({
999
+ "class": "iti__selected-flag"
1000
+ }, allowDropdown && {
1001
+ role: "combobox",
1002
+ "aria-haspopup": "listbox",
1003
+ "aria-controls": "iti-".concat(this.id, "__country-listbox"),
1004
+ "aria-expanded": "false",
1005
+ "aria-label": "Telephone country code"
1006
+ }), this.flagsContainer);
1007
+ }
1008
+ if (showFlags) {
1009
+ this.selectedFlagInner = this._createEl("div", {
1010
+ "class": "iti__flag"
1011
+ }, this.selectedFlag);
1012
+ }
1013
+ if (this.selectedFlag && this.telInput.disabled) {
1014
+ this.selectedFlag.setAttribute("aria-disabled", "true");
1015
+ }
1016
+ if (separateDialCode) {
1017
+ this.selectedDialCode = this._createEl("div", {
1018
+ "class": "iti__selected-dial-code"
1019
+ }, this.selectedFlag);
1020
+ }
1021
+ if (allowDropdown) {
1022
+ if (!this.telInput.disabled) {
1023
+ // make element focusable and tab navigable
1024
+ this.selectedFlag.setAttribute("tabindex", "0");
1025
+ }
1026
+ this.dropdownArrow = this._createEl("div", {
1027
+ "class": "iti__arrow"
1028
+ }, this.selectedFlag);
1029
+ // country dropdown: preferred countries, then divider, then all countries
1030
+ this.countryList = this._createEl("ul", {
1031
+ "class": "iti__country-list iti__hide",
1032
+ id: "iti-".concat(this.id, "__country-listbox"),
1033
+ role: "listbox",
1034
+ "aria-label": "List of countries"
1035
+ });
1036
+ if (this.preferredCountries.length) {
1037
+ this._appendListItems(this.preferredCountries, "iti__preferred", true);
1038
+ this._createEl("li", {
1039
+ "class": "iti__divider",
1040
+ role: "separator",
1041
+ "aria-disabled": "true"
1042
+ }, this.countryList);
1043
+ }
1044
+ this._appendListItems(this.countries, "iti__standard");
1045
+ // create dropdownContainer markup
1046
+ if (dropdownContainer) {
1047
+ this.dropdown = this._createEl("div", {
1048
+ "class": "iti iti--container"
1049
+ });
1050
+ this.dropdown.appendChild(this.countryList);
1051
+ } else {
1052
+ this.flagsContainer.appendChild(this.countryList);
1053
+ }
1054
+ }
1055
+ if (hiddenInput) {
1056
+ var hiddenInputName = hiddenInput;
1057
+ var name = this.telInput.getAttribute("name");
1058
+ if (name) {
1059
+ var i = name.lastIndexOf("[");
1060
+ // if input name contains square brackets, then give the hidden input the same name,
1061
+ // replacing the contents of the last set of brackets with the given hiddenInput name
1062
+ if (i !== -1) {
1063
+ hiddenInputName = "".concat(name.substr(0, i), "[").concat(hiddenInputName, "]");
1064
+ }
1065
+ }
1066
+ this.hiddenInput = this._createEl("input", {
1067
+ type: "hidden",
1068
+ name: hiddenInputName
1069
+ });
1070
+ wrapper.appendChild(this.hiddenInput);
1071
+ }
1072
+ }
1073
+ }, {
1074
+ key: "_appendListItems",
1075
+ value: function _appendListItems(countries, className, preferred) {
1076
+ // we create so many DOM elements, it is faster to build a temp string
1077
+ // and then add everything to the DOM in one go at the end
1078
+ var tmp = "";
1079
+ // for each country
1080
+ for (var i = 0; i < countries.length; i++) {
1081
+ var c = countries[i];
1082
+ var idSuffix = preferred ? "-preferred" : "";
1083
+ // open the list item
1084
+ tmp += "<li class='iti__country ".concat(className, "' tabIndex='-1' id='iti-").concat(this.id, "__item-").concat(c.iso2).concat(idSuffix, "' role='option' data-dial-code='").concat(c.dialCode, "' data-country-code='").concat(c.iso2, "' aria-selected='false'>");
1085
+ // add the flag
1086
+ if (this.options.showFlags) {
1087
+ tmp += "<div class='iti__flag-box'><div class='iti__flag iti__".concat(c.iso2, "'></div></div>");
1088
+ }
1089
+ // and the country name and dial code
1090
+ tmp += "<span class='iti__country-name'>".concat(c.name, "</span>");
1091
+ tmp += "<span class='iti__dial-code'>+".concat(c.dialCode, "</span>");
1092
+ // close the list item
1093
+ tmp += "</li>";
1094
+ }
1095
+ this.countryList.insertAdjacentHTML("beforeend", tmp);
1096
+ }
1097
+ }, {
1098
+ key: "_setInitialState",
1099
+ value: function _setInitialState() {
1100
+ // fix firefox bug: when first load page (with input with value set to number with intl dial
1101
+ // code) and initialising plugin removes the dial code from the input, then refresh page,
1102
+ // and we try to init plugin again but this time on number without dial code so get grey flag
1103
+ var attributeValue = this.telInput.getAttribute("value");
1104
+ var inputValue = this.telInput.value;
1105
+ var useAttribute = attributeValue && attributeValue.charAt(0) === "+" && (!inputValue || inputValue.charAt(0) !== "+");
1106
+ var val = useAttribute ? attributeValue : inputValue;
1107
+ var dialCode = this._getDialCode(val);
1108
+ var isRegionlessNanp = this._isRegionlessNanp(val);
1109
+ var _this$options2 = this.options, initialCountry = _this$options2.initialCountry, autoInsertDialCode = _this$options2.autoInsertDialCode;
1110
+ // if we already have a dial code, and it's not a regionlessNanp, we can go ahead and set the
1111
+ // flag, else fall back to the default country
1112
+ if (dialCode && !isRegionlessNanp) {
1113
+ this._updateFlagFromNumber(val);
1114
+ } else if (initialCountry !== "auto") {
1115
+ // see if we should select a flag
1116
+ if (initialCountry) {
1117
+ this._setFlag(initialCountry.toLowerCase());
1118
+ } else {
1119
+ if (dialCode && isRegionlessNanp) {
1120
+ // has intl dial code, is regionless nanp, and no initialCountry, so default to US
1121
+ this._setFlag("us");
1122
+ } else {
1123
+ // no dial code and no initialCountry, so default to first in list
1124
+ this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2;
1125
+ if (!val) {
1126
+ this._setFlag(this.defaultCountry);
1127
+ }
1128
+ }
1129
+ }
1130
+ // if empty and autoInsertDialCode then insert the dial code
1131
+ if (!val && autoInsertDialCode) {
1132
+ this.telInput.value = "+".concat(this.selectedCountryData.dialCode);
1133
+ }
1134
+ }
1135
+ // NOTE: if initialCountry is set to auto, that will be handled separately
1136
+ // format - note this wont be run after _updateDialCode as that's only called if no val
1137
+ if (val) {
1138
+ this._updateValFromNumber(val);
1139
+ }
1140
+ }
1141
+ }, {
1142
+ key: "_initListeners",
1143
+ value: function _initListeners() {
1144
+ this._initKeyListeners();
1145
+ if (this.options.autoInsertDialCode) {
1146
+ this._initBlurListeners();
1147
+ }
1148
+ if (this.options.allowDropdown) {
1149
+ this._initDropdownListeners();
1150
+ }
1151
+ if (this.hiddenInput) {
1152
+ this._initHiddenInputListener();
1153
+ }
1154
+ }
1155
+ }, {
1156
+ key: "_initHiddenInputListener",
1157
+ value: function _initHiddenInputListener() {
1158
+ var _this3 = this;
1159
+ this._handleHiddenInputSubmit = function() {
1160
+ _this3.hiddenInput.value = _this3.getNumber();
1161
+ };
1162
+ if (this.telInput.form) {
1163
+ this.telInput.form.addEventListener("submit", this._handleHiddenInputSubmit);
1164
+ }
1165
+ }
1166
+ }, {
1167
+ key: "_getClosestLabel",
1168
+ value: function _getClosestLabel() {
1169
+ var el = this.telInput;
1170
+ while (el && el.tagName !== "LABEL") {
1171
+ el = el.parentNode;
1172
+ }
1173
+ return el;
1174
+ }
1175
+ }, {
1176
+ key: "_initDropdownListeners",
1177
+ value: function _initDropdownListeners() {
1178
+ var _this4 = this;
1179
+ // hack for input nested inside label (which is valid markup): clicking the selected-flag to
1180
+ // open the dropdown would then automatically trigger a 2nd click on the input which would
1181
+ // close it again
1182
+ this._handleLabelClick = function(e) {
1183
+ // if the dropdown is closed, then focus the input, else ignore the click
1184
+ if (_this4.countryList.classList.contains("iti__hide")) {
1185
+ _this4.telInput.focus();
1186
+ } else {
1187
+ e.preventDefault();
1188
+ }
1189
+ };
1190
+ var label = this._getClosestLabel();
1191
+ if (label) {
1192
+ label.addEventListener("click", this._handleLabelClick);
1193
+ }
1194
+ // toggle country dropdown on click
1195
+ this._handleClickSelectedFlag = function() {
1196
+ // only intercept this event if we're opening the dropdown
1197
+ // else let it bubble up to the top ("click-off-to-close" listener)
1198
+ // we cannot just stopPropagation as it may be needed to close another instance
1199
+ if (_this4.countryList.classList.contains("iti__hide") && !_this4.telInput.disabled && !_this4.telInput.readOnly) {
1200
+ _this4._showDropdown();
1201
+ }
1202
+ };
1203
+ this.selectedFlag.addEventListener("click", this._handleClickSelectedFlag);
1204
+ // open dropdown list if currently focused
1205
+ this._handleFlagsContainerKeydown = function(e) {
1206
+ var isDropdownHidden = _this4.countryList.classList.contains("iti__hide");
1207
+ if (isDropdownHidden && [ "ArrowUp", "Up", "ArrowDown", "Down", " ", "Enter" ].indexOf(e.key) !== -1) {
1208
+ // prevent form from being submitted if "ENTER" was pressed
1209
+ e.preventDefault();
1210
+ // prevent event from being handled again by document
1211
+ e.stopPropagation();
1212
+ _this4._showDropdown();
1213
+ }
1214
+ // allow navigation from dropdown to input on TAB
1215
+ if (e.key === "Tab") {
1216
+ _this4._closeDropdown();
1217
+ }
1218
+ };
1219
+ this.flagsContainer.addEventListener("keydown", this._handleFlagsContainerKeydown);
1220
+ }
1221
+ }, {
1222
+ key: "_initRequests",
1223
+ value: function _initRequests() {
1224
+ var _this5 = this;
1225
+ // if the user has specified the path to the utils script, fetch it on window.load, else resolve
1226
+ if (this.options.utilsScript && !window.intlTelInputUtils) {
1227
+ // if the plugin is being initialised after the window.load event has already been fired
1228
+ if (window.intlTelInputGlobals.documentReady()) {
1229
+ window.intlTelInputGlobals.loadUtils(this.options.utilsScript);
1230
+ } else {
1231
+ // wait until the load event so we don't block any other requests e.g. the flags image
1232
+ window.addEventListener("load", function() {
1233
+ window.intlTelInputGlobals.loadUtils(_this5.options.utilsScript);
1234
+ });
1235
+ }
1236
+ } else {
1237
+ this.resolveUtilsScriptPromise();
1238
+ }
1239
+ if (this.options.initialCountry === "auto") {
1240
+ this._loadAutoCountry();
1241
+ } else {
1242
+ this.resolveAutoCountryPromise();
1243
+ }
1244
+ }
1245
+ }, {
1246
+ key: "_loadAutoCountry",
1247
+ value: function _loadAutoCountry() {
1248
+ // 3 options:
1249
+ // 1) already loaded (we're done)
1250
+ // 2) not already started loading (start)
1251
+ // 3) already started loading (do nothing - just wait for loading callback to fire)
1252
+ if (window.intlTelInputGlobals.autoCountry) {
1253
+ this.handleAutoCountry();
1254
+ } else if (!window.intlTelInputGlobals.startedLoadingAutoCountry) {
1255
+ // don't do this twice!
1256
+ window.intlTelInputGlobals.startedLoadingAutoCountry = true;
1257
+ if (typeof this.options.geoIpLookup === "function") {
1258
+ this.options.geoIpLookup(function(countryCode) {
1259
+ window.intlTelInputGlobals.autoCountry = countryCode.toLowerCase();
1260
+ // tell all instances the auto country is ready
1261
+ // TODO: this should just be the current instances
1262
+ // UPDATE: use setTimeout in case their geoIpLookup function calls this callback straight
1263
+ // away (e.g. if they have already done the geo ip lookup somewhere else). Using
1264
+ // setTimeout means that the current thread of execution will finish before executing
1265
+ // this, which allows the plugin to finish initialising.
1266
+ setTimeout(function() {
1267
+ return forEachInstance("handleAutoCountry");
1268
+ });
1269
+ }, function() {
1270
+ return forEachInstance("rejectAutoCountryPromise");
1271
+ });
1272
+ }
1273
+ }
1274
+ }
1275
+ }, {
1276
+ key: "_initKeyListeners",
1277
+ value: function _initKeyListeners() {
1278
+ var _this6 = this;
1279
+ // update flag on keyup
1280
+ this._handleKeyupEvent = function() {
1281
+ if (_this6._updateFlagFromNumber(_this6.telInput.value)) {
1282
+ _this6._triggerCountryChange();
1283
+ }
1284
+ };
1285
+ this.telInput.addEventListener("keyup", this._handleKeyupEvent);
1286
+ // update flag on cut/paste events (now supported in all major browsers)
1287
+ this._handleClipboardEvent = function() {
1288
+ // hack because "paste" event is fired before input is updated
1289
+ setTimeout(_this6._handleKeyupEvent);
1290
+ };
1291
+ this.telInput.addEventListener("cut", this._handleClipboardEvent);
1292
+ this.telInput.addEventListener("paste", this._handleClipboardEvent);
1293
+ }
1294
+ }, {
1295
+ key: "_cap",
1296
+ value: function _cap(number) {
1297
+ var max = this.telInput.getAttribute("maxlength");
1298
+ return max && number.length > max ? number.substr(0, max) : number;
1299
+ }
1300
+ }, {
1301
+ key: "_initBlurListeners",
1302
+ value: function _initBlurListeners() {
1303
+ var _this7 = this;
1304
+ // on blur or form submit: if just a dial code then remove it
1305
+ this._handleSubmitOrBlurEvent = function() {
1306
+ _this7._removeEmptyDialCode();
1307
+ };
1308
+ if (this.telInput.form) {
1309
+ this.telInput.form.addEventListener("submit", this._handleSubmitOrBlurEvent);
1310
+ }
1311
+ this.telInput.addEventListener("blur", this._handleSubmitOrBlurEvent);
1312
+ }
1313
+ }, {
1314
+ key: "_removeEmptyDialCode",
1315
+ value: function _removeEmptyDialCode() {
1316
+ if (this.telInput.value.charAt(0) === "+") {
1317
+ var numeric = this._getNumeric(this.telInput.value);
1318
+ // if just a plus, or if just a dial code
1319
+ if (!numeric || this.selectedCountryData.dialCode === numeric) {
1320
+ this.telInput.value = "";
1321
+ }
1322
+ }
1323
+ }
1324
+ }, {
1325
+ key: "_getNumeric",
1326
+ value: function _getNumeric(s) {
1327
+ return s.replace(/\D/g, "");
1328
+ }
1329
+ }, {
1330
+ key: "_trigger",
1331
+ value: function _trigger(name) {
1332
+ // have to use old school document.createEvent as IE11 doesn't support `new Event()` syntax
1333
+ var e = document.createEvent("Event");
1334
+ e.initEvent(name, true, true);
1335
+ // can bubble, and is cancellable
1336
+ this.telInput.dispatchEvent(e);
1337
+ }
1338
+ }, {
1339
+ key: "_showDropdown",
1340
+ value: function _showDropdown() {
1341
+ this.countryList.classList.remove("iti__hide");
1342
+ this.selectedFlag.setAttribute("aria-expanded", "true");
1343
+ this._setDropdownPosition();
1344
+ // update highlighting and scroll to active list item
1345
+ if (this.activeItem) {
1346
+ this._highlightListItem(this.activeItem, false);
1347
+ this._scrollTo(this.activeItem, true);
1348
+ }
1349
+ // bind all the dropdown-related listeners: mouseover, click, click-off, keydown
1350
+ this._bindDropdownListeners();
1351
+ // update the arrow
1352
+ this.dropdownArrow.classList.add("iti__arrow--up");
1353
+ this._trigger("open:countrydropdown");
1354
+ }
1355
+ }, {
1356
+ key: "_toggleClass",
1357
+ value: function _toggleClass(el, className, shouldHaveClass) {
1358
+ if (shouldHaveClass && !el.classList.contains(className)) {
1359
+ el.classList.add(className);
1360
+ } else if (!shouldHaveClass && el.classList.contains(className)) {
1361
+ el.classList.remove(className);
1362
+ }
1363
+ }
1364
+ }, {
1365
+ key: "_setDropdownPosition",
1366
+ value: function _setDropdownPosition() {
1367
+ var _this8 = this;
1368
+ if (this.options.dropdownContainer) {
1369
+ this.options.dropdownContainer.appendChild(this.dropdown);
1370
+ }
1371
+ if (!this.isMobile) {
1372
+ var pos = this.telInput.getBoundingClientRect();
1373
+ // windowTop from https://stackoverflow.com/a/14384091/217866
1374
+ var windowTop = window.pageYOffset || document.documentElement.scrollTop;
1375
+ var inputTop = pos.top + windowTop;
1376
+ var dropdownHeight = this.countryList.offsetHeight;
1377
+ // dropdownFitsBelow = (dropdownBottom < windowBottom)
1378
+ var dropdownFitsBelow = inputTop + this.telInput.offsetHeight + dropdownHeight < windowTop + window.innerHeight;
1379
+ var dropdownFitsAbove = inputTop - dropdownHeight > windowTop;
1380
+ // by default, the dropdown will be below the input. If we want to position it above the
1381
+ // input, we add the dropup class.
1382
+ this._toggleClass(this.countryList, "iti__country-list--dropup", !dropdownFitsBelow && dropdownFitsAbove);
1383
+ // if dropdownContainer is enabled, calculate postion
1384
+ if (this.options.dropdownContainer) {
1385
+ // by default the dropdown will be directly over the input because it's not in the flow.
1386
+ // If we want to position it below, we need to add some extra top value.
1387
+ var extraTop = !dropdownFitsBelow && dropdownFitsAbove ? 0 : this.telInput.offsetHeight;
1388
+ // calculate placement
1389
+ this.dropdown.style.top = "".concat(inputTop + extraTop, "px");
1390
+ this.dropdown.style.left = "".concat(pos.left + document.body.scrollLeft, "px");
1391
+ // close menu on window scroll
1392
+ this._handleWindowScroll = function() {
1393
+ return _this8._closeDropdown();
1394
+ };
1395
+ window.addEventListener("scroll", this._handleWindowScroll);
1396
+ }
1397
+ }
1398
+ }
1399
+ }, {
1400
+ key: "_getClosestListItem",
1401
+ value: function _getClosestListItem(target) {
1402
+ var el = target;
1403
+ while (el && el !== this.countryList && !el.classList.contains("iti__country")) {
1404
+ el = el.parentNode;
1405
+ }
1406
+ // if we reached the countryList element, then return null
1407
+ return el === this.countryList ? null : el;
1408
+ }
1409
+ }, {
1410
+ key: "_bindDropdownListeners",
1411
+ value: function _bindDropdownListeners() {
1412
+ var _this9 = this;
1413
+ // when mouse over a list item, just highlight that one
1414
+ // we add the class "highlight", so if they hit "enter" we know which one to select
1415
+ this._handleMouseoverCountryList = function(e) {
1416
+ // handle event delegation, as we're listening for this event on the countryList
1417
+ var listItem = _this9._getClosestListItem(e.target);
1418
+ if (listItem) {
1419
+ _this9._highlightListItem(listItem, false);
1420
+ }
1421
+ };
1422
+ this.countryList.addEventListener("mouseover", this._handleMouseoverCountryList);
1423
+ // listen for country selection
1424
+ this._handleClickCountryList = function(e) {
1425
+ var listItem = _this9._getClosestListItem(e.target);
1426
+ if (listItem) {
1427
+ _this9._selectListItem(listItem);
1428
+ }
1429
+ };
1430
+ this.countryList.addEventListener("click", this._handleClickCountryList);
1431
+ // click off to close
1432
+ // (except when this initial opening click is bubbling up)
1433
+ // we cannot just stopPropagation as it may be needed to close another instance
1434
+ var isOpening = true;
1435
+ this._handleClickOffToClose = function() {
1436
+ if (!isOpening) {
1437
+ _this9._closeDropdown();
1438
+ }
1439
+ isOpening = false;
1440
+ };
1441
+ document.documentElement.addEventListener("click", this._handleClickOffToClose);
1442
+ // listen for up/down scrolling, enter to select, or letters to jump to country name.
1443
+ // use keydown as keypress doesn't fire for non-char keys and we want to catch if they
1444
+ // just hit down and hold it to scroll down (no keyup event).
1445
+ // listen on the document because that's where key events are triggered if no input has focus
1446
+ var query = "";
1447
+ var queryTimer = null;
1448
+ this._handleKeydownOnDropdown = function(e) {
1449
+ // prevent down key from scrolling the whole page,
1450
+ // and enter key from submitting a form etc
1451
+ e.preventDefault();
1452
+ // up and down to navigate
1453
+ if (e.key === "ArrowUp" || e.key === "Up" || e.key === "ArrowDown" || e.key === "Down") {
1454
+ _this9._handleUpDownKey(e.key);
1455
+ } else if (e.key === "Enter") {
1456
+ _this9._handleEnterKey();
1457
+ } else if (e.key === "Escape") {
1458
+ _this9._closeDropdown();
1459
+ } else if (/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(e.key)) {
1460
+ // jump to countries that start with the query string
1461
+ if (queryTimer) {
1462
+ clearTimeout(queryTimer);
1463
+ }
1464
+ query += e.key.toLowerCase();
1465
+ _this9._searchForCountry(query);
1466
+ // if the timer hits 1 second, reset the query
1467
+ queryTimer = setTimeout(function() {
1468
+ query = "";
1469
+ }, 1e3);
1470
+ }
1471
+ };
1472
+ document.addEventListener("keydown", this._handleKeydownOnDropdown);
1473
+ }
1474
+ }, {
1475
+ key: "_handleUpDownKey",
1476
+ value: function _handleUpDownKey(key) {
1477
+ var next = key === "ArrowUp" || key === "Up" ? this.highlightedItem.previousElementSibling : this.highlightedItem.nextElementSibling;
1478
+ if (next) {
1479
+ // skip the divider
1480
+ if (next.classList.contains("iti__divider")) {
1481
+ next = key === "ArrowUp" || key === "Up" ? next.previousElementSibling : next.nextElementSibling;
1482
+ }
1483
+ this._highlightListItem(next, true);
1484
+ }
1485
+ }
1486
+ }, {
1487
+ key: "_handleEnterKey",
1488
+ value: function _handleEnterKey() {
1489
+ if (this.highlightedItem) {
1490
+ this._selectListItem(this.highlightedItem);
1491
+ }
1492
+ }
1493
+ }, {
1494
+ key: "_searchForCountry",
1495
+ value: function _searchForCountry(query) {
1496
+ for (var i = 0; i < this.countries.length; i++) {
1497
+ if (this._startsWith(this.countries[i].name, query)) {
1498
+ var listItem = this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(this.countries[i].iso2));
1499
+ // update highlighting and scroll
1500
+ this._highlightListItem(listItem, false);
1501
+ this._scrollTo(listItem, true);
1502
+ break;
1503
+ }
1504
+ }
1505
+ }
1506
+ }, {
1507
+ key: "_startsWith",
1508
+ value: function _startsWith(a, b) {
1509
+ return a.substr(0, b.length).toLowerCase() === b;
1510
+ }
1511
+ }, {
1512
+ key: "_updateValFromNumber",
1513
+ value: function _updateValFromNumber(originalNumber) {
1514
+ var number = originalNumber;
1515
+ if (this.options.formatOnDisplay && window.intlTelInputUtils && this.selectedCountryData) {
1516
+ var useNational = this.options.nationalMode || number.charAt(0) !== "+" && !this.options.separateDialCode;
1517
+ var _intlTelInputUtils$nu = intlTelInputUtils.numberFormat, NATIONAL = _intlTelInputUtils$nu.NATIONAL, INTERNATIONAL = _intlTelInputUtils$nu.INTERNATIONAL;
1518
+ var format = useNational ? NATIONAL : INTERNATIONAL;
1519
+ number = intlTelInputUtils.formatNumber(number, this.selectedCountryData.iso2, format);
1520
+ }
1521
+ number = this._beforeSetNumber(number);
1522
+ this.telInput.value = number;
1523
+ }
1524
+ }, {
1525
+ key: "_updateFlagFromNumber",
1526
+ value: function _updateFlagFromNumber(originalNumber) {
1527
+ // if we already have US/Canada selected, make sure the number starts
1528
+ // with a +1 so _getDialCode will be able to extract the area code
1529
+ // update: if we dont yet have selectedCountryData, but we're here (trying to update the flag
1530
+ // from the number), that means we're initialising the plugin with a number that already has a
1531
+ // dial code, so fine to ignore this bit
1532
+ var number = originalNumber;
1533
+ var selectedDialCode = this.selectedCountryData.dialCode;
1534
+ var isNanp = selectedDialCode === "1";
1535
+ if (number && isNanp && number.charAt(0) !== "+") {
1536
+ if (number.charAt(0) !== "1") {
1537
+ number = "1".concat(number);
1538
+ }
1539
+ number = "+".concat(number);
1540
+ }
1541
+ // if separateDialCode enabled, then consider the selected dial code to be part of the number
1542
+ if (this.options.separateDialCode && selectedDialCode && number.charAt(0) !== "+") {
1543
+ number = "+".concat(selectedDialCode).concat(number);
1544
+ }
1545
+ // try and extract valid dial code from input
1546
+ var dialCode = this._getDialCode(number, true);
1547
+ var numeric = this._getNumeric(number);
1548
+ var countryCode = null;
1549
+ if (dialCode) {
1550
+ var countryCodes = this.countryCodes[this._getNumeric(dialCode)];
1551
+ // check if the right country is already selected. this should be false if the number is
1552
+ // longer than the matched dial code because in this case we need to make sure that if
1553
+ // there are multiple country matches, that the first one is selected (note: we could
1554
+ // just check that here, but it requires the same loop that we already have later)
1555
+ var alreadySelected = countryCodes.indexOf(this.selectedCountryData.iso2) !== -1 && numeric.length <= dialCode.length - 1;
1556
+ var isRegionlessNanpNumber = selectedDialCode === "1" && this._isRegionlessNanp(numeric);
1557
+ // only update the flag if:
1558
+ // A) NOT (we currently have a NANP flag selected, and the number is a regionlessNanp)
1559
+ // AND
1560
+ // B) the right country is not already selected
1561
+ if (!isRegionlessNanpNumber && !alreadySelected) {
1562
+ // if using onlyCountries option, countryCodes[0] may be empty, so we must find the first
1563
+ // non-empty index
1564
+ for (var j = 0; j < countryCodes.length; j++) {
1565
+ if (countryCodes[j]) {
1566
+ countryCode = countryCodes[j];
1567
+ break;
1568
+ }
1569
+ }
1570
+ }
1571
+ } else if (number.charAt(0) === "+" && numeric.length) {
1572
+ // invalid dial code, so empty
1573
+ // Note: use getNumeric here because the number has not been formatted yet, so could contain
1574
+ // bad chars
1575
+ countryCode = "";
1576
+ } else if (!number || number === "+") {
1577
+ // empty, or just a plus, so default
1578
+ countryCode = this.defaultCountry;
1579
+ }
1580
+ if (countryCode !== null) {
1581
+ return this._setFlag(countryCode);
1582
+ }
1583
+ return false;
1584
+ }
1585
+ }, {
1586
+ key: "_isRegionlessNanp",
1587
+ value: function _isRegionlessNanp(number) {
1588
+ var numeric = this._getNumeric(number);
1589
+ if (numeric.charAt(0) === "1") {
1590
+ var areaCode = numeric.substr(1, 3);
1591
+ return regionlessNanpNumbers.indexOf(areaCode) !== -1;
1592
+ }
1593
+ return false;
1594
+ }
1595
+ }, {
1596
+ key: "_highlightListItem",
1597
+ value: function _highlightListItem(listItem, shouldFocus) {
1598
+ var prevItem = this.highlightedItem;
1599
+ if (prevItem) {
1600
+ prevItem.classList.remove("iti__highlight");
1601
+ }
1602
+ this.highlightedItem = listItem;
1603
+ this.highlightedItem.classList.add("iti__highlight");
1604
+ this.selectedFlag.setAttribute("aria-activedescendant", listItem.getAttribute("id"));
1605
+ if (shouldFocus) {
1606
+ this.highlightedItem.focus();
1607
+ }
1608
+ }
1609
+ }, {
1610
+ key: "_getCountryData",
1611
+ value: function _getCountryData(countryCode, ignoreOnlyCountriesOption, allowFail) {
1612
+ var countryList = ignoreOnlyCountriesOption ? allCountries : this.countries;
1613
+ for (var i = 0; i < countryList.length; i++) {
1614
+ if (countryList[i].iso2 === countryCode) {
1615
+ return countryList[i];
1616
+ }
1617
+ }
1618
+ if (allowFail) {
1619
+ return null;
1620
+ }
1621
+ throw new Error("No country data for '".concat(countryCode, "'"));
1622
+ }
1623
+ }, {
1624
+ key: "_setFlag",
1625
+ value: function _setFlag(countryCode) {
1626
+ var _this$options3 = this.options, allowDropdown = _this$options3.allowDropdown, separateDialCode = _this$options3.separateDialCode, showFlags = _this$options3.showFlags;
1627
+ var prevCountry = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
1628
+ // do this first as it will throw an error and stop if countryCode is invalid
1629
+ this.selectedCountryData = countryCode ? this._getCountryData(countryCode, false, false) : {};
1630
+ // update the defaultCountry - we only need the iso2 from now on, so just store that
1631
+ if (this.selectedCountryData.iso2) {
1632
+ this.defaultCountry = this.selectedCountryData.iso2;
1633
+ }
1634
+ if (showFlags) {
1635
+ this.selectedFlagInner.setAttribute("class", "iti__flag iti__".concat(countryCode));
1636
+ }
1637
+ this._setSelectedCountryFlagTitleAttribute(countryCode, separateDialCode);
1638
+ if (separateDialCode) {
1639
+ var dialCode = this.selectedCountryData.dialCode ? "+".concat(this.selectedCountryData.dialCode) : "";
1640
+ this.selectedDialCode.innerHTML = dialCode;
1641
+ // offsetWidth is zero if input is in a hidden container during initialisation
1642
+ var selectedFlagWidth = this.selectedFlag.offsetWidth || this._getHiddenSelectedFlagWidth();
1643
+ // add 6px of padding after the grey selected-dial-code box, as this is what we use in the css
1644
+ if (this.isRTL) {
1645
+ this.telInput.style.paddingRight = "".concat(selectedFlagWidth + 6, "px");
1646
+ } else {
1647
+ this.telInput.style.paddingLeft = "".concat(selectedFlagWidth + 6, "px");
1648
+ }
1649
+ }
1650
+ // and the input's placeholder
1651
+ this._updatePlaceholder();
1652
+ // update the active list item
1653
+ if (allowDropdown) {
1654
+ var prevItem = this.activeItem;
1655
+ if (prevItem) {
1656
+ prevItem.classList.remove("iti__active");
1657
+ prevItem.setAttribute("aria-selected", "false");
1658
+ }
1659
+ if (countryCode) {
1660
+ // check if there is a preferred item first, else fall back to standard
1661
+ var nextItem = this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(countryCode, "-preferred")) || this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(countryCode));
1662
+ nextItem.setAttribute("aria-selected", "true");
1663
+ nextItem.classList.add("iti__active");
1664
+ this.activeItem = nextItem;
1665
+ }
1666
+ }
1667
+ // return if the flag has changed or not
1668
+ return prevCountry.iso2 !== countryCode;
1669
+ }
1670
+ }, {
1671
+ key: "_setSelectedCountryFlagTitleAttribute",
1672
+ value: function _setSelectedCountryFlagTitleAttribute(countryCode, separateDialCode) {
1673
+ if (!this.selectedFlag) {
1674
+ return;
1675
+ }
1676
+ var title;
1677
+ if (countryCode && !separateDialCode) {
1678
+ title = "".concat(this.selectedCountryData.name, ": +").concat(this.selectedCountryData.dialCode);
1679
+ } else if (countryCode) {
1680
+ // For screen reader output, we don't want to include the dial code in the reader output twice
1681
+ // so just use the selected country name here:
1682
+ title = this.selectedCountryData.name;
1683
+ } else {
1684
+ title = "Unknown";
1685
+ }
1686
+ this.selectedFlag.setAttribute("title", title);
1687
+ }
1688
+ }, {
1689
+ key: "_getHiddenSelectedFlagWidth",
1690
+ value: function _getHiddenSelectedFlagWidth() {
1691
+ // to get the right styling to apply, all we need is a shallow clone of the container,
1692
+ // and then to inject a deep clone of the selectedFlag element
1693
+ var containerClone = this.telInput.parentNode.cloneNode();
1694
+ containerClone.style.visibility = "hidden";
1695
+ document.body.appendChild(containerClone);
1696
+ var flagsContainerClone = this.flagsContainer.cloneNode();
1697
+ containerClone.appendChild(flagsContainerClone);
1698
+ var selectedFlagClone = this.selectedFlag.cloneNode(true);
1699
+ flagsContainerClone.appendChild(selectedFlagClone);
1700
+ var width = selectedFlagClone.offsetWidth;
1701
+ containerClone.parentNode.removeChild(containerClone);
1702
+ return width;
1703
+ }
1704
+ }, {
1705
+ key: "_updatePlaceholder",
1706
+ value: function _updatePlaceholder() {
1707
+ var shouldSetPlaceholder = this.options.autoPlaceholder === "aggressive" || !this.hadInitialPlaceholder && this.options.autoPlaceholder === "polite";
1708
+ if (window.intlTelInputUtils && shouldSetPlaceholder) {
1709
+ var numberType = intlTelInputUtils.numberType[this.options.placeholderNumberType];
1710
+ var placeholder = this.selectedCountryData.iso2 ? intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2, this.options.nationalMode, numberType) : "";
1711
+ placeholder = this._beforeSetNumber(placeholder);
1712
+ if (typeof this.options.customPlaceholder === "function") {
1713
+ placeholder = this.options.customPlaceholder(placeholder, this.selectedCountryData);
1714
+ }
1715
+ this.telInput.setAttribute("placeholder", placeholder);
1716
+ }
1717
+ }
1718
+ }, {
1719
+ key: "_selectListItem",
1720
+ value: function _selectListItem(listItem) {
1721
+ // update selected flag and active list item
1722
+ var flagChanged = this._setFlag(listItem.getAttribute("data-country-code"));
1723
+ this._closeDropdown();
1724
+ this._updateDialCode(listItem.getAttribute("data-dial-code"));
1725
+ // focus the input
1726
+ this.telInput.focus();
1727
+ // put cursor at end - this fix is required for FF and IE11 (with auto inserting dial code),
1728
+ // who try to put the cursor at the beginning the first time
1729
+ var len = this.telInput.value.length;
1730
+ this.telInput.setSelectionRange(len, len);
1731
+ if (flagChanged) {
1732
+ this._triggerCountryChange();
1733
+ }
1734
+ }
1735
+ }, {
1736
+ key: "_closeDropdown",
1737
+ value: function _closeDropdown() {
1738
+ this.countryList.classList.add("iti__hide");
1739
+ this.selectedFlag.setAttribute("aria-expanded", "false");
1740
+ this.selectedFlag.removeAttribute("aria-activedescendant");
1741
+ // update the arrow
1742
+ this.dropdownArrow.classList.remove("iti__arrow--up");
1743
+ // unbind key events
1744
+ document.removeEventListener("keydown", this._handleKeydownOnDropdown);
1745
+ document.documentElement.removeEventListener("click", this._handleClickOffToClose);
1746
+ this.countryList.removeEventListener("mouseover", this._handleMouseoverCountryList);
1747
+ this.countryList.removeEventListener("click", this._handleClickCountryList);
1748
+ // remove menu from container
1749
+ if (this.options.dropdownContainer) {
1750
+ if (!this.isMobile) {
1751
+ window.removeEventListener("scroll", this._handleWindowScroll);
1752
+ }
1753
+ if (this.dropdown.parentNode) {
1754
+ this.dropdown.parentNode.removeChild(this.dropdown);
1755
+ }
1756
+ }
1757
+ this._trigger("close:countrydropdown");
1758
+ }
1759
+ }, {
1760
+ key: "_scrollTo",
1761
+ value: function _scrollTo(element, middle) {
1762
+ var container = this.countryList;
1763
+ // windowTop from https://stackoverflow.com/a/14384091/217866
1764
+ var windowTop = window.pageYOffset || document.documentElement.scrollTop;
1765
+ var containerHeight = container.offsetHeight;
1766
+ var containerTop = container.getBoundingClientRect().top + windowTop;
1767
+ var containerBottom = containerTop + containerHeight;
1768
+ var elementHeight = element.offsetHeight;
1769
+ var elementTop = element.getBoundingClientRect().top + windowTop;
1770
+ var elementBottom = elementTop + elementHeight;
1771
+ var newScrollTop = elementTop - containerTop + container.scrollTop;
1772
+ var middleOffset = containerHeight / 2 - elementHeight / 2;
1773
+ if (elementTop < containerTop) {
1774
+ // scroll up
1775
+ if (middle) {
1776
+ newScrollTop -= middleOffset;
1777
+ }
1778
+ container.scrollTop = newScrollTop;
1779
+ } else if (elementBottom > containerBottom) {
1780
+ // scroll down
1781
+ if (middle) {
1782
+ newScrollTop += middleOffset;
1783
+ }
1784
+ var heightDifference = containerHeight - elementHeight;
1785
+ container.scrollTop = newScrollTop - heightDifference;
1786
+ }
1787
+ }
1788
+ }, {
1789
+ key: "_updateDialCode",
1790
+ value: function _updateDialCode(newDialCodeBare) {
1791
+ var inputVal = this.telInput.value;
1792
+ // save having to pass this every time
1793
+ var newDialCode = "+".concat(newDialCodeBare);
1794
+ var newNumber;
1795
+ if (inputVal.charAt(0) === "+") {
1796
+ // there's a plus so we're dealing with a replacement
1797
+ var prevDialCode = this._getDialCode(inputVal);
1798
+ if (prevDialCode) {
1799
+ // current number contains a valid dial code, so replace it
1800
+ newNumber = inputVal.replace(prevDialCode, newDialCode);
1801
+ } else {
1802
+ // current number contains an invalid dial code, so ditch it
1803
+ // (no way to determine where the invalid dial code ends and the rest of the number begins)
1804
+ newNumber = newDialCode;
1805
+ }
1806
+ this.telInput.value = newNumber;
1807
+ } else if (this.options.autoInsertDialCode) {
1808
+ if (inputVal) {
1809
+ // there is an existing value with no dial code: prefix the new dial code
1810
+ newNumber = newDialCode + inputVal;
1811
+ } else {
1812
+ newNumber = newDialCode;
1813
+ }
1814
+ this.telInput.value = newNumber;
1815
+ }
1816
+ }
1817
+ }, {
1818
+ key: "_getDialCode",
1819
+ value: function _getDialCode(number, includeAreaCode) {
1820
+ var dialCode = "";
1821
+ // only interested in international numbers (starting with a plus)
1822
+ if (number.charAt(0) === "+") {
1823
+ var numericChars = "";
1824
+ // iterate over chars
1825
+ for (var i = 0; i < number.length; i++) {
1826
+ var c = number.charAt(i);
1827
+ // if char is number (https://stackoverflow.com/a/8935649/217866)
1828
+ if (!isNaN(parseInt(c, 10))) {
1829
+ numericChars += c;
1830
+ // if current numericChars make a valid dial code
1831
+ if (includeAreaCode) {
1832
+ if (this.countryCodes[numericChars]) {
1833
+ // store the actual raw string (useful for matching later)
1834
+ dialCode = number.substr(0, i + 1);
1835
+ }
1836
+ } else {
1837
+ if (this.dialCodes[numericChars]) {
1838
+ dialCode = number.substr(0, i + 1);
1839
+ // if we're just looking for a dial code, we can break as soon as we find one
1840
+ break;
1841
+ }
1842
+ }
1843
+ // stop searching as soon as we can - in this case when we hit max len
1844
+ if (numericChars.length === this.countryCodeMaxLen) {
1845
+ break;
1846
+ }
1847
+ }
1848
+ }
1849
+ }
1850
+ return dialCode;
1851
+ }
1852
+ }, {
1853
+ key: "_getFullNumber",
1854
+ value: function _getFullNumber() {
1855
+ var val = this.telInput.value.trim();
1856
+ var dialCode = this.selectedCountryData.dialCode;
1857
+ var prefix;
1858
+ var numericVal = this._getNumeric(val);
1859
+ if (this.options.separateDialCode && val.charAt(0) !== "+" && dialCode && numericVal) {
1860
+ // when using separateDialCode, it is visible so is effectively part of the typed number
1861
+ prefix = "+".concat(dialCode);
1862
+ } else {
1863
+ prefix = "";
1864
+ }
1865
+ return prefix + val;
1866
+ }
1867
+ }, {
1868
+ key: "_beforeSetNumber",
1869
+ value: function _beforeSetNumber(originalNumber) {
1870
+ var number = originalNumber;
1871
+ if (this.options.separateDialCode) {
1872
+ var dialCode = this._getDialCode(number);
1873
+ // if there is a valid dial code
1874
+ if (dialCode) {
1875
+ // in case _getDialCode returned an area code as well
1876
+ dialCode = "+".concat(this.selectedCountryData.dialCode);
1877
+ // a lot of numbers will have a space separating the dial code and the main number, and
1878
+ // some NANP numbers will have a hyphen e.g. +1 684-733-1234 - in both cases we want to get
1879
+ // rid of it
1880
+ // NOTE: don't just trim all non-numerics as may want to preserve an open parenthesis etc
1881
+ var start = number[dialCode.length] === " " || number[dialCode.length] === "-" ? dialCode.length + 1 : dialCode.length;
1882
+ number = number.substr(start);
1883
+ }
1884
+ }
1885
+ return this._cap(number);
1886
+ }
1887
+ }, {
1888
+ key: "_triggerCountryChange",
1889
+ value: function _triggerCountryChange() {
1890
+ this._trigger("countrychange");
1891
+ }
1892
+ }, {
1893
+ key: "handleAutoCountry",
1894
+ value: function handleAutoCountry() {
1895
+ if (this.options.initialCountry === "auto") {
1896
+ // we must set this even if there is an initial val in the input: in case the initial val is
1897
+ // invalid and they delete it - they should see their auto country
1898
+ this.defaultCountry = window.intlTelInputGlobals.autoCountry;
1899
+ // if there's no initial value in the input, then update the flag
1900
+ if (!this.telInput.value) {
1901
+ this.setCountry(this.defaultCountry);
1902
+ }
1903
+ this.resolveAutoCountryPromise();
1904
+ }
1905
+ }
1906
+ }, {
1907
+ key: "handleUtils",
1908
+ value: function handleUtils() {
1909
+ // if the request was successful
1910
+ if (window.intlTelInputUtils) {
1911
+ // if there's an initial value in the input, then format it
1912
+ if (this.telInput.value) {
1913
+ this._updateValFromNumber(this.telInput.value);
1914
+ }
1915
+ this._updatePlaceholder();
1916
+ }
1917
+ this.resolveUtilsScriptPromise();
1918
+ }
1919
+ }, {
1920
+ key: "destroy",
1921
+ value: function destroy() {
1922
+ var form = this.telInput.form;
1923
+ if (this.options.allowDropdown) {
1924
+ // make sure the dropdown is closed (and unbind listeners)
1925
+ this._closeDropdown();
1926
+ this.selectedFlag.removeEventListener("click", this._handleClickSelectedFlag);
1927
+ this.flagsContainer.removeEventListener("keydown", this._handleFlagsContainerKeydown);
1928
+ // label click hack
1929
+ var label = this._getClosestLabel();
1930
+ if (label) {
1931
+ label.removeEventListener("click", this._handleLabelClick);
1932
+ }
1933
+ }
1934
+ // unbind hiddenInput listeners
1935
+ if (this.hiddenInput && form) {
1936
+ form.removeEventListener("submit", this._handleHiddenInputSubmit);
1937
+ }
1938
+ // unbind autoInsertDialCode listeners
1939
+ if (this.options.autoInsertDialCode) {
1940
+ if (form) {
1941
+ form.removeEventListener("submit", this._handleSubmitOrBlurEvent);
1942
+ }
1943
+ this.telInput.removeEventListener("blur", this._handleSubmitOrBlurEvent);
1944
+ }
1945
+ // unbind key events, and cut/paste events
1946
+ this.telInput.removeEventListener("keyup", this._handleKeyupEvent);
1947
+ this.telInput.removeEventListener("cut", this._handleClipboardEvent);
1948
+ this.telInput.removeEventListener("paste", this._handleClipboardEvent);
1949
+ // remove attribute of id instance: data-intl-tel-input-id
1950
+ this.telInput.removeAttribute("data-intl-tel-input-id");
1951
+ // remove markup (but leave the original input)
1952
+ var wrapper = this.telInput.parentNode;
1953
+ wrapper.parentNode.insertBefore(this.telInput, wrapper);
1954
+ wrapper.parentNode.removeChild(wrapper);
1955
+ delete window.intlTelInputGlobals.instances[this.id];
1956
+ }
1957
+ }, {
1958
+ key: "getExtension",
1959
+ value: function getExtension() {
1960
+ if (window.intlTelInputUtils) {
1961
+ return intlTelInputUtils.getExtension(this._getFullNumber(), this.selectedCountryData.iso2);
1962
+ }
1963
+ return "";
1964
+ }
1965
+ }, {
1966
+ key: "getNumber",
1967
+ value: function getNumber(format) {
1968
+ if (window.intlTelInputUtils) {
1969
+ var iso2 = this.selectedCountryData.iso2;
1970
+ return intlTelInputUtils.formatNumber(this._getFullNumber(), iso2, format);
1971
+ }
1972
+ return "";
1973
+ }
1974
+ }, {
1975
+ key: "getNumberType",
1976
+ value: function getNumberType() {
1977
+ if (window.intlTelInputUtils) {
1978
+ return intlTelInputUtils.getNumberType(this._getFullNumber(), this.selectedCountryData.iso2);
1979
+ }
1980
+ return -99;
1981
+ }
1982
+ }, {
1983
+ key: "getSelectedCountryData",
1984
+ value: function getSelectedCountryData() {
1985
+ return this.selectedCountryData;
1986
+ }
1987
+ }, {
1988
+ key: "getValidationError",
1989
+ value: function getValidationError() {
1990
+ if (window.intlTelInputUtils) {
1991
+ var iso2 = this.selectedCountryData.iso2;
1992
+ return intlTelInputUtils.getValidationError(this._getFullNumber(), iso2);
1993
+ }
1994
+ return -99;
1995
+ }
1996
+ }, {
1997
+ key: "isValidNumber",
1998
+ value: function isValidNumber() {
1999
+ var val = this._getFullNumber().trim();
2000
+ return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(val, this.selectedCountryData.iso2) : null;
2001
+ }
2002
+ }, {
2003
+ key: "isPossibleNumber",
2004
+ value: function isPossibleNumber() {
2005
+ var val = this._getFullNumber().trim();
2006
+ return window.intlTelInputUtils ? intlTelInputUtils.isPossibleNumber(val, this.selectedCountryData.iso2) : null;
2007
+ }
2008
+ }, {
2009
+ key: "setCountry",
2010
+ value: function setCountry(originalCountryCode) {
2011
+ var countryCode = originalCountryCode.toLowerCase();
2012
+ // check if already selected
2013
+ if (this.selectedCountryData.iso2 !== countryCode) {
2014
+ this._setFlag(countryCode);
2015
+ this._updateDialCode(this.selectedCountryData.dialCode);
2016
+ this._triggerCountryChange();
2017
+ }
2018
+ }
2019
+ }, {
2020
+ key: "setNumber",
2021
+ value: function setNumber(number) {
2022
+ // we must update the flag first, which updates this.selectedCountryData, which is used for
2023
+ // formatting the number before displaying it
2024
+ var flagChanged = this._updateFlagFromNumber(number);
2025
+ this._updateValFromNumber(number);
2026
+ if (flagChanged) {
2027
+ this._triggerCountryChange();
2028
+ }
2029
+ }
2030
+ }, {
2031
+ key: "setPlaceholderNumberType",
2032
+ value: function setPlaceholderNumberType(type) {
2033
+ this.options.placeholderNumberType = type;
2034
+ this._updatePlaceholder();
2035
+ }
2036
+ } ]);
2037
+ return Iti;
2038
+ }();
2039
+ /********************
2040
+ * STATIC METHODS
2041
+ ********************/
2042
+ // get the country data object
2043
+ intlTelInputGlobals.getCountryData = function() {
2044
+ return allCountries;
2045
+ };
2046
+ // inject a <script> element to load utils.js
2047
+ var injectScript = function injectScript(path, handleSuccess, handleFailure) {
2048
+ // inject a new script element into the page
2049
+ var script = document.createElement("script");
2050
+ script.onload = function() {
2051
+ forEachInstance("handleUtils");
2052
+ if (handleSuccess) {
2053
+ handleSuccess();
2054
+ }
2055
+ };
2056
+ script.onerror = function() {
2057
+ forEachInstance("rejectUtilsScriptPromise");
2058
+ if (handleFailure) {
2059
+ handleFailure();
2060
+ }
2061
+ };
2062
+ script.className = "iti-load-utils";
2063
+ script.async = true;
2064
+ script.src = path;
2065
+ document.body.appendChild(script);
2066
+ };
2067
+ // load the utils script
2068
+ intlTelInputGlobals.loadUtils = function(path) {
2069
+ // 2 options:
2070
+ // 1) not already started loading (start)
2071
+ // 2) already started loading (do nothing - just wait for the onload callback to fire, which will
2072
+ // trigger handleUtils on all instances, invoking their resolveUtilsScriptPromise functions)
2073
+ if (!window.intlTelInputUtils && !window.intlTelInputGlobals.startedLoadingUtilsScript) {
2074
+ // only do this once
2075
+ window.intlTelInputGlobals.startedLoadingUtilsScript = true;
2076
+ // if we have promises, then return a promise
2077
+ if (typeof Promise !== "undefined") {
2078
+ return new Promise(function(resolve, reject) {
2079
+ return injectScript(path, resolve, reject);
2080
+ });
2081
+ }
2082
+ injectScript(path);
2083
+ }
2084
+ return null;
2085
+ };
2086
+ // default options
2087
+ intlTelInputGlobals.defaults = defaults;
2088
+ // version
2089
+ intlTelInputGlobals.version = "18.2.1";
2090
+ // convenience wrapper
2091
+ return function(input, options) {
2092
+ var iti = new Iti(input, options);
2093
+ iti._init();
2094
+ input.setAttribute("data-intl-tel-input-id", iti.id);
2095
+ window.intlTelInputGlobals.instances[iti.id] = iti;
2096
+ return iti;
2097
+ };
2098
+ }();
2099
+ });
2100
+ });
2101
+
2102
+ /**
2103
+ * Exposing intl-tel-input as a component
2104
+ */
2105
+ var intlTelInput = intlTelInput$1;
2106
+
2107
+ const sasInputTelCss = ".iti{position:relative;display:inline-block}.iti *{box-sizing:border-box}.iti__hide{display:none}.iti__v-hide{visibility:hidden}.iti input,.iti input[type=text],.iti input[type=tel]{position:relative;z-index:0;margin-top:0 !important;margin-bottom:0 !important;padding-right:36px;margin-right:0}.iti__flag-container{position:absolute;top:0;bottom:0;right:0;padding:1px}.iti__selected-flag{z-index:1;position:relative;display:flex;align-items:center;height:100%;padding:0 6px 0 8px}.iti__arrow{margin-left:6px;width:0;height:0;border-left:3px solid transparent;border-right:3px solid transparent;border-top:4px solid #555}[dir=rtl] .iti__arrow{margin-right:6px;margin-left:0}.iti__arrow--up{border-top:none;border-bottom:4px solid #555}.iti__country-list{position:absolute;z-index:2;list-style:none;padding:0;margin:0 0 0 -1px;box-shadow:1px 1px 4px rgba(0, 0, 0, 0.2);background-color:white;border:1px solid #ccc;white-space:nowrap;max-height:200px;overflow-y:scroll;-webkit-overflow-scrolling:touch}.iti__country-list--dropup{bottom:100%;margin-bottom:-1px}@media (max-width: 500px){.iti__country-list{white-space:normal}}.iti__flag-box{display:inline-block;width:20px}.iti__divider{padding-bottom:5px;margin-bottom:5px;border-bottom:1px solid #ccc}.iti__country{display:flex;align-items:center;padding:5px 10px;outline:none}.iti__dial-code{color:#999}.iti__country.iti__highlight{background-color:rgba(0, 0, 0, 0.05)}.iti__flag-box,.iti__country-name{margin-right:6px}[dir=rtl] .iti__flag-box,[dir=rtl] .iti__country-name{margin-right:0;margin-left:6px}.iti--allow-dropdown input,.iti--allow-dropdown input[type=text],.iti--allow-dropdown input[type=tel],.iti--separate-dial-code input,.iti--separate-dial-code input[type=text],.iti--separate-dial-code input[type=tel]{padding-right:6px;padding-left:52px;margin-left:0}[dir=rtl] .iti--allow-dropdown input,[dir=rtl] .iti--allow-dropdown input[type=text],[dir=rtl] .iti--allow-dropdown input[type=tel],[dir=rtl] .iti--separate-dial-code input,[dir=rtl] .iti--separate-dial-code input[type=text],[dir=rtl] .iti--separate-dial-code input[type=tel]{padding-right:52px;padding-left:6px;margin-right:0}.iti--allow-dropdown .iti__flag-container,.iti--separate-dial-code .iti__flag-container{right:auto;left:0}[dir=rtl] .iti--allow-dropdown .iti__flag-container,[dir=rtl] .iti--separate-dial-code .iti__flag-container{right:0;left:auto}.iti--allow-dropdown .iti__flag-container:hover{cursor:pointer}.iti--allow-dropdown .iti__flag-container:hover .iti__selected-flag{background-color:rgba(0, 0, 0, 0.05)}.iti--allow-dropdown input[disabled]+.iti__flag-container:hover,.iti--allow-dropdown input[readonly]+.iti__flag-container:hover{cursor:default}.iti--allow-dropdown input[disabled]+.iti__flag-container:hover .iti__selected-flag,.iti--allow-dropdown input[readonly]+.iti__flag-container:hover .iti__selected-flag{background-color:transparent}.iti--separate-dial-code .iti__selected-flag{background-color:rgba(0, 0, 0, 0.05)}.iti--separate-dial-code.iti--show-flags .iti__selected-dial-code{margin-left:6px}[dir=rtl] .iti--separate-dial-code.iti--show-flags .iti__selected-dial-code{margin-left:0;margin-right:6px}.iti--container{position:absolute;top:-1000px;left:-1000px;z-index:1060;padding:1px}.iti--container:hover{cursor:pointer}.iti-mobile .iti--container{top:30px;bottom:30px;left:30px;right:30px;position:fixed}.iti-mobile .iti__country-list{max-height:100%;width:100%}.iti-mobile .iti__country{padding:10px 10px;line-height:1.5em}.iti__flag{width:20px}.iti__flag.iti__be{width:18px}.iti__flag.iti__ch{width:15px}.iti__flag.iti__mc{width:19px}.iti__flag.iti__ne{width:18px}.iti__flag.iti__np{width:13px}.iti__flag.iti__va{width:15px}@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi){.iti__flag{background-size:5762px 15px}}.iti__flag.iti__ac{height:10px;background-position:0px 0px}.iti__flag.iti__ad{height:14px;background-position:-22px 0px}.iti__flag.iti__ae{height:10px;background-position:-44px 0px}.iti__flag.iti__af{height:14px;background-position:-66px 0px}.iti__flag.iti__ag{height:14px;background-position:-88px 0px}.iti__flag.iti__ai{height:10px;background-position:-110px 0px}.iti__flag.iti__al{height:15px;background-position:-132px 0px}.iti__flag.iti__am{height:10px;background-position:-154px 0px}.iti__flag.iti__ao{height:14px;background-position:-176px 0px}.iti__flag.iti__aq{height:14px;background-position:-198px 0px}.iti__flag.iti__ar{height:13px;background-position:-220px 0px}.iti__flag.iti__as{height:10px;background-position:-242px 0px}.iti__flag.iti__at{height:14px;background-position:-264px 0px}.iti__flag.iti__au{height:10px;background-position:-286px 0px}.iti__flag.iti__aw{height:14px;background-position:-308px 0px}.iti__flag.iti__ax{height:13px;background-position:-330px 0px}.iti__flag.iti__az{height:10px;background-position:-352px 0px}.iti__flag.iti__ba{height:10px;background-position:-374px 0px}.iti__flag.iti__bb{height:14px;background-position:-396px 0px}.iti__flag.iti__bd{height:12px;background-position:-418px 0px}.iti__flag.iti__be{height:15px;background-position:-440px 0px}.iti__flag.iti__bf{height:14px;background-position:-460px 0px}.iti__flag.iti__bg{height:12px;background-position:-482px 0px}.iti__flag.iti__bh{height:12px;background-position:-504px 0px}.iti__flag.iti__bi{height:12px;background-position:-526px 0px}.iti__flag.iti__bj{height:14px;background-position:-548px 0px}.iti__flag.iti__bl{height:14px;background-position:-570px 0px}.iti__flag.iti__bm{height:10px;background-position:-592px 0px}.iti__flag.iti__bn{height:10px;background-position:-614px 0px}.iti__flag.iti__bo{height:14px;background-position:-636px 0px}.iti__flag.iti__bq{height:14px;background-position:-658px 0px}.iti__flag.iti__br{height:14px;background-position:-680px 0px}.iti__flag.iti__bs{height:10px;background-position:-702px 0px}.iti__flag.iti__bt{height:14px;background-position:-724px 0px}.iti__flag.iti__bv{height:15px;background-position:-746px 0px}.iti__flag.iti__bw{height:14px;background-position:-768px 0px}.iti__flag.iti__by{height:10px;background-position:-790px 0px}.iti__flag.iti__bz{height:12px;background-position:-812px 0px}.iti__flag.iti__ca{height:10px;background-position:-834px 0px}.iti__flag.iti__cc{height:10px;background-position:-856px 0px}.iti__flag.iti__cd{height:15px;background-position:-878px 0px}.iti__flag.iti__cf{height:14px;background-position:-900px 0px}.iti__flag.iti__cg{height:14px;background-position:-922px 0px}.iti__flag.iti__ch{height:15px;background-position:-944px 0px}.iti__flag.iti__ci{height:14px;background-position:-961px 0px}.iti__flag.iti__ck{height:10px;background-position:-983px 0px}.iti__flag.iti__cl{height:14px;background-position:-1005px 0px}.iti__flag.iti__cm{height:14px;background-position:-1027px 0px}.iti__flag.iti__cn{height:14px;background-position:-1049px 0px}.iti__flag.iti__co{height:14px;background-position:-1071px 0px}.iti__flag.iti__cp{height:14px;background-position:-1093px 0px}.iti__flag.iti__cq{height:12px;background-position:-1115px 0px}.iti__flag.iti__cr{height:12px;background-position:-1137px 0px}.iti__flag.iti__cu{height:10px;background-position:-1159px 0px}.iti__flag.iti__cv{height:12px;background-position:-1181px 0px}.iti__flag.iti__cw{height:14px;background-position:-1203px 0px}.iti__flag.iti__cx{height:10px;background-position:-1225px 0px}.iti__flag.iti__cy{height:14px;background-position:-1247px 0px}.iti__flag.iti__cz{height:14px;background-position:-1269px 0px}.iti__flag.iti__de{height:12px;background-position:-1291px 0px}.iti__flag.iti__dg{height:10px;background-position:-1313px 0px}.iti__flag.iti__dj{height:14px;background-position:-1335px 0px}.iti__flag.iti__dk{height:15px;background-position:-1357px 0px}.iti__flag.iti__dm{height:10px;background-position:-1379px 0px}.iti__flag.iti__do{height:14px;background-position:-1401px 0px}.iti__flag.iti__dz{height:14px;background-position:-1423px 0px}.iti__flag.iti__ea{height:14px;background-position:-1445px 0px}.iti__flag.iti__ec{height:14px;background-position:-1467px 0px}.iti__flag.iti__ee{height:13px;background-position:-1489px 0px}.iti__flag.iti__eg{height:14px;background-position:-1511px 0px}.iti__flag.iti__eh{height:10px;background-position:-1533px 0px}.iti__flag.iti__er{height:10px;background-position:-1555px 0px}.iti__flag.iti__es{height:14px;background-position:-1577px 0px}.iti__flag.iti__et{height:10px;background-position:-1599px 0px}.iti__flag.iti__eu{height:14px;background-position:-1621px 0px}.iti__flag.iti__ez{height:14px;background-position:-1643px 0px}.iti__flag.iti__fi{height:12px;background-position:-1665px 0px}.iti__flag.iti__fj{height:10px;background-position:-1687px 0px}.iti__flag.iti__fk{height:10px;background-position:-1709px 0px}.iti__flag.iti__fm{height:11px;background-position:-1731px 0px}.iti__flag.iti__fo{height:15px;background-position:-1753px 0px}.iti__flag.iti__fr{height:14px;background-position:-1775px 0px}.iti__flag.iti__fx{height:14px;background-position:-1797px 0px}.iti__flag.iti__ga{height:15px;background-position:-1819px 0px}.iti__flag.iti__gb{height:10px;background-position:-1841px 0px}.iti__flag.iti__gd{height:12px;background-position:-1863px 0px}.iti__flag.iti__ge{height:14px;background-position:-1885px 0px}.iti__flag.iti__gf{height:14px;background-position:-1907px 0px}.iti__flag.iti__gg{height:14px;background-position:-1929px 0px}.iti__flag.iti__gh{height:14px;background-position:-1951px 0px}.iti__flag.iti__gi{height:10px;background-position:-1973px 0px}.iti__flag.iti__gl{height:14px;background-position:-1995px 0px}.iti__flag.iti__gm{height:14px;background-position:-2017px 0px}.iti__flag.iti__gn{height:14px;background-position:-2039px 0px}.iti__flag.iti__gp{height:14px;background-position:-2061px 0px}.iti__flag.iti__gq{height:14px;background-position:-2083px 0px}.iti__flag.iti__gr{height:14px;background-position:-2105px 0px}.iti__flag.iti__gs{height:10px;background-position:-2127px 0px}.iti__flag.iti__gt{height:13px;background-position:-2149px 0px}.iti__flag.iti__gu{height:11px;background-position:-2171px 0px}.iti__flag.iti__gw{height:10px;background-position:-2193px 0px}.iti__flag.iti__gy{height:12px;background-position:-2215px 0px}.iti__flag.iti__hk{height:14px;background-position:-2237px 0px}.iti__flag.iti__hm{height:10px;background-position:-2259px 0px}.iti__flag.iti__hn{height:10px;background-position:-2281px 0px}.iti__flag.iti__hr{height:10px;background-position:-2303px 0px}.iti__flag.iti__ht{height:12px;background-position:-2325px 0px}.iti__flag.iti__hu{height:10px;background-position:-2347px 0px}.iti__flag.iti__ic{height:14px;background-position:-2369px 0px}.iti__flag.iti__id{height:14px;background-position:-2391px 0px}.iti__flag.iti__ie{height:10px;background-position:-2413px 0px}.iti__flag.iti__il{height:15px;background-position:-2435px 0px}.iti__flag.iti__im{height:10px;background-position:-2457px 0px}.iti__flag.iti__in{height:14px;background-position:-2479px 0px}.iti__flag.iti__io{height:10px;background-position:-2501px 0px}.iti__flag.iti__iq{height:14px;background-position:-2523px 0px}.iti__flag.iti__ir{height:12px;background-position:-2545px 0px}.iti__flag.iti__is{height:15px;background-position:-2567px 0px}.iti__flag.iti__it{height:14px;background-position:-2589px 0px}.iti__flag.iti__je{height:12px;background-position:-2611px 0px}.iti__flag.iti__jm{height:10px;background-position:-2633px 0px}.iti__flag.iti__jo{height:10px;background-position:-2655px 0px}.iti__flag.iti__jp{height:14px;background-position:-2677px 0px}.iti__flag.iti__ke{height:14px;background-position:-2699px 0px}.iti__flag.iti__kg{height:12px;background-position:-2721px 0px}.iti__flag.iti__kh{height:13px;background-position:-2743px 0px}.iti__flag.iti__ki{height:10px;background-position:-2765px 0px}.iti__flag.iti__km{height:12px;background-position:-2787px 0px}.iti__flag.iti__kn{height:14px;background-position:-2809px 0px}.iti__flag.iti__kp{height:10px;background-position:-2831px 0px}.iti__flag.iti__kr{height:14px;background-position:-2853px 0px}.iti__flag.iti__kw{height:10px;background-position:-2875px 0px}.iti__flag.iti__ky{height:10px;background-position:-2897px 0px}.iti__flag.iti__kz{height:10px;background-position:-2919px 0px}.iti__flag.iti__la{height:14px;background-position:-2941px 0px}.iti__flag.iti__lb{height:14px;background-position:-2963px 0px}.iti__flag.iti__lc{height:10px;background-position:-2985px 0px}.iti__flag.iti__li{height:12px;background-position:-3007px 0px}.iti__flag.iti__lk{height:10px;background-position:-3029px 0px}.iti__flag.iti__lr{height:11px;background-position:-3051px 0px}.iti__flag.iti__ls{height:14px;background-position:-3073px 0px}.iti__flag.iti__lt{height:12px;background-position:-3095px 0px}.iti__flag.iti__lu{height:12px;background-position:-3117px 0px}.iti__flag.iti__lv{height:10px;background-position:-3139px 0px}.iti__flag.iti__ly{height:10px;background-position:-3161px 0px}.iti__flag.iti__ma{height:14px;background-position:-3183px 0px}.iti__flag.iti__mc{height:15px;background-position:-3205px 0px}.iti__flag.iti__md{height:10px;background-position:-3226px 0px}.iti__flag.iti__me{height:10px;background-position:-3248px 0px}.iti__flag.iti__mf{height:14px;background-position:-3270px 0px}.iti__flag.iti__mg{height:14px;background-position:-3292px 0px}.iti__flag.iti__mh{height:11px;background-position:-3314px 0px}.iti__flag.iti__mk{height:10px;background-position:-3336px 0px}.iti__flag.iti__ml{height:14px;background-position:-3358px 0px}.iti__flag.iti__mm{height:14px;background-position:-3380px 0px}.iti__flag.iti__mn{height:10px;background-position:-3402px 0px}.iti__flag.iti__mo{height:14px;background-position:-3424px 0px}.iti__flag.iti__mp{height:10px;background-position:-3446px 0px}.iti__flag.iti__mq{height:14px;background-position:-3468px 0px}.iti__flag.iti__mr{height:14px;background-position:-3490px 0px}.iti__flag.iti__ms{height:10px;background-position:-3512px 0px}.iti__flag.iti__mt{height:14px;background-position:-3534px 0px}.iti__flag.iti__mu{height:14px;background-position:-3556px 0px}.iti__flag.iti__mv{height:14px;background-position:-3578px 0px}.iti__flag.iti__mw{height:14px;background-position:-3600px 0px}.iti__flag.iti__mx{height:12px;background-position:-3622px 0px}.iti__flag.iti__my{height:10px;background-position:-3644px 0px}.iti__flag.iti__mz{height:14px;background-position:-3666px 0px}.iti__flag.iti__na{height:14px;background-position:-3688px 0px}.iti__flag.iti__nc{height:10px;background-position:-3710px 0px}.iti__flag.iti__ne{height:15px;background-position:-3732px 0px}.iti__flag.iti__nf{height:10px;background-position:-3752px 0px}.iti__flag.iti__ng{height:10px;background-position:-3774px 0px}.iti__flag.iti__ni{height:12px;background-position:-3796px 0px}.iti__flag.iti__nl{height:14px;background-position:-3818px 0px}.iti__flag.iti__no{height:15px;background-position:-3840px 0px}.iti__flag.iti__np{height:15px;background-position:-3862px 0px}.iti__flag.iti__nr{height:10px;background-position:-3877px 0px}.iti__flag.iti__nu{height:10px;background-position:-3899px 0px}.iti__flag.iti__nz{height:10px;background-position:-3921px 0px}.iti__flag.iti__om{height:10px;background-position:-3943px 0px}.iti__flag.iti__pa{height:14px;background-position:-3965px 0px}.iti__flag.iti__pe{height:14px;background-position:-3987px 0px}.iti__flag.iti__pf{height:14px;background-position:-4009px 0px}.iti__flag.iti__pg{height:15px;background-position:-4031px 0px}.iti__flag.iti__ph{height:10px;background-position:-4053px 0px}.iti__flag.iti__pk{height:14px;background-position:-4075px 0px}.iti__flag.iti__pl{height:13px;background-position:-4097px 0px}.iti__flag.iti__pm{height:14px;background-position:-4119px 0px}.iti__flag.iti__pn{height:10px;background-position:-4141px 0px}.iti__flag.iti__pr{height:14px;background-position:-4163px 0px}.iti__flag.iti__ps{height:10px;background-position:-4185px 0px}.iti__flag.iti__pt{height:14px;background-position:-4207px 0px}.iti__flag.iti__pw{height:13px;background-position:-4229px 0px}.iti__flag.iti__py{height:11px;background-position:-4251px 0px}.iti__flag.iti__qa{height:8px;background-position:-4273px 0px}.iti__flag.iti__re{height:14px;background-position:-4295px 0px}.iti__flag.iti__ro{height:14px;background-position:-4317px 0px}.iti__flag.iti__rs{height:14px;background-position:-4339px 0px}.iti__flag.iti__ru{height:14px;background-position:-4361px 0px}.iti__flag.iti__rw{height:14px;background-position:-4383px 0px}.iti__flag.iti__sa{height:14px;background-position:-4405px 0px}.iti__flag.iti__sb{height:10px;background-position:-4427px 0px}.iti__flag.iti__sc{height:10px;background-position:-4449px 0px}.iti__flag.iti__sd{height:10px;background-position:-4471px 0px}.iti__flag.iti__se{height:13px;background-position:-4493px 0px}.iti__flag.iti__sg{height:14px;background-position:-4515px 0px}.iti__flag.iti__sh{height:10px;background-position:-4537px 0px}.iti__flag.iti__si{height:10px;background-position:-4559px 0px}.iti__flag.iti__sj{height:15px;background-position:-4581px 0px}.iti__flag.iti__sk{height:14px;background-position:-4603px 0px}.iti__flag.iti__sl{height:14px;background-position:-4625px 0px}.iti__flag.iti__sm{height:15px;background-position:-4647px 0px}.iti__flag.iti__sn{height:14px;background-position:-4669px 0px}.iti__flag.iti__so{height:14px;background-position:-4691px 0px}.iti__flag.iti__sr{height:14px;background-position:-4713px 0px}.iti__flag.iti__ss{height:10px;background-position:-4735px 0px}.iti__flag.iti__st{height:10px;background-position:-4757px 0px}.iti__flag.iti__su{height:10px;background-position:-4779px 0px}.iti__flag.iti__sv{height:12px;background-position:-4801px 0px}.iti__flag.iti__sx{height:14px;background-position:-4823px 0px}.iti__flag.iti__sy{height:14px;background-position:-4845px 0px}.iti__flag.iti__sz{height:14px;background-position:-4867px 0px}.iti__flag.iti__ta{height:10px;background-position:-4889px 0px}.iti__flag.iti__tc{height:10px;background-position:-4911px 0px}.iti__flag.iti__td{height:14px;background-position:-4933px 0px}.iti__flag.iti__tf{height:14px;background-position:-4955px 0px}.iti__flag.iti__tg{height:13px;background-position:-4977px 0px}.iti__flag.iti__th{height:14px;background-position:-4999px 0px}.iti__flag.iti__tj{height:10px;background-position:-5021px 0px}.iti__flag.iti__tk{height:10px;background-position:-5043px 0px}.iti__flag.iti__tl{height:10px;background-position:-5065px 0px}.iti__flag.iti__tm{height:14px;background-position:-5087px 0px}.iti__flag.iti__tn{height:14px;background-position:-5109px 0px}.iti__flag.iti__to{height:10px;background-position:-5131px 0px}.iti__flag.iti__tr{height:14px;background-position:-5153px 0px}.iti__flag.iti__tt{height:12px;background-position:-5175px 0px}.iti__flag.iti__tv{height:10px;background-position:-5197px 0px}.iti__flag.iti__tw{height:14px;background-position:-5219px 0px}.iti__flag.iti__tz{height:14px;background-position:-5241px 0px}.iti__flag.iti__ua{height:14px;background-position:-5263px 0px}.iti__flag.iti__ug{height:14px;background-position:-5285px 0px}.iti__flag.iti__uk{height:10px;background-position:-5307px 0px}.iti__flag.iti__um{height:11px;background-position:-5329px 0px}.iti__flag.iti__un{height:14px;background-position:-5351px 0px}.iti__flag.iti__us{height:11px;background-position:-5373px 0px}.iti__flag.iti__uy{height:14px;background-position:-5395px 0px}.iti__flag.iti__uz{height:10px;background-position:-5417px 0px}.iti__flag.iti__va{height:15px;background-position:-5439px 0px}.iti__flag.iti__vc{height:14px;background-position:-5456px 0px}.iti__flag.iti__ve{height:14px;background-position:-5478px 0px}.iti__flag.iti__vg{height:10px;background-position:-5500px 0px}.iti__flag.iti__vi{height:14px;background-position:-5522px 0px}.iti__flag.iti__vn{height:14px;background-position:-5544px 0px}.iti__flag.iti__vu{height:12px;background-position:-5566px 0px}.iti__flag.iti__wf{height:14px;background-position:-5588px 0px}.iti__flag.iti__ws{height:10px;background-position:-5610px 0px}.iti__flag.iti__xk{height:15px;background-position:-5632px 0px}.iti__flag.iti__ye{height:14px;background-position:-5654px 0px}.iti__flag.iti__yt{height:14px;background-position:-5676px 0px}.iti__flag.iti__za{height:14px;background-position:-5698px 0px}.iti__flag.iti__zm{height:14px;background-position:-5720px 0px}.iti__flag.iti__zw{height:10px;background-position:-5742px 0px}.iti__flag{height:15px;box-shadow:0px 0px 1px 0px #888;background-image:url(\"../img/flags.png?1\");background-repeat:no-repeat;background-color:#dbdbdb;background-position:20px 0}@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi){.iti__flag{background-image:url(\"../img/flags@2x.png?1\")}}.iti__flag.iti__np{background-color:transparent}:host{display:flex;flex-grow:1;padding-left:3px;padding-right:3px}:host .iti{flex-grow:1}:host .iti__flag{background-image:url(\"https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/18.2.1/img/flags.png\")}@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi){:host .iti__flag{background-image:url(\"https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/18.2.1/img/flags@2x.png\")}}:host .iti--allow-dropdown{display:inline-flex}:host .iti__flag-container{padding:0}:host .iti__flag-container .iti__selected-flag:focus{outline:none}:host #phone{border:none;flex-grow:1;box-sizing:border-box;color:var(--s-500);font-family:roboto, \"Font Awesome 5 Pro\";font-size:14px;text-overflow:ellipsis;width:100%}:host #phone2Container{display:none}:host #phone:focus-within{outline:none}:host ::-webkit-input-placeholder{color:var(--s-400)}:host :-ms-input-placeholder{color:var(--s-400)}:host ::placeholder{color:var(--s-400)}";
2108
+
2109
+ let SasInputTel = class {
2110
+ constructor(hostRef) {
2111
+ index.registerInstance(this, hostRef);
2112
+ this.inputTelUpdate = index.createEvent(this, "inputTelUpdate", 7);
2113
+ }
2114
+ componentDidLoad() {
2115
+ var _a, _b, _c, _d;
2116
+ const input = this.el.shadowRoot.querySelector("#phone");
2117
+ const placeholder = this.el.getAttribute('data-placeholder');
2118
+ if (Boolean(placeholder)) {
2119
+ input.placeholder = placeholder;
2120
+ }
2121
+ this.iti = intlTelInput(input, {
2122
+ initialCountry: (_a = this.el.getAttribute('data-country')) !== null && _a !== void 0 ? _a : 'au',
2123
+ placeholderNumberType: (_b = this.el.getAttribute('data-placeholderNumberType')) !== null && _b !== void 0 ? _b : 'MOBILE',
2124
+ preferredCountries: ['au', 'ca', 'gb', 'nz', 'us'],
2125
+ utilsScript: 'https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/18.2.1/js/utils.min.js',
2126
+ });
2127
+ const thisClone = this;
2128
+ this.iti.promise.then(() => {
2129
+ if (Boolean(thisClone.el.getAttribute('data-value'))) {
2130
+ thisClone.update(thisClone.el.getAttribute('data-value'));
2131
+ }
2132
+ });
2133
+ input.addEventListener('countrychange', function () {
2134
+ thisClone.update();
2135
+ });
2136
+ input.addEventListener('input', function () {
2137
+ thisClone.update();
2138
+ });
2139
+ const input2 = this.el.shadowRoot.querySelector("#phone2");
2140
+ this.iti2 = intlTelInput(input2, {
2141
+ initialCountry: (_c = this.el.getAttribute('data-country')) !== null && _c !== void 0 ? _c : 'au',
2142
+ nationalMode: false,
2143
+ placeholderNumberType: (_d = this.el.getAttribute('data-placeholderNumberType')) !== null && _d !== void 0 ? _d : 'MOBILE',
2144
+ preferredCountries: ['au', 'ca', 'gb', 'nz', 'us'],
2145
+ utilsScript: 'https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/18.2.1/js/utils.min.js',
2146
+ });
2147
+ }
2148
+ /**
2149
+ * Check the componnet validity (only for components internal use)
2150
+ */
2151
+ async getValidity() {
2152
+ return this.iti.isPossibleNumber();
2153
+ }
2154
+ /**
2155
+ * Set country (only for components internal use)
2156
+ */
2157
+ async setCountry(country) {
2158
+ this.iti.setCountry(country);
2159
+ }
2160
+ /**
2161
+ * Set placeholder (only for components internal use)
2162
+ */
2163
+ async setPlaceholder(type) {
2164
+ this.iti.setPlaceholderNumberType(type);
2165
+ }
2166
+ /**
2167
+ * Set value and trigger inputTelUpdate event programmatically (only for components internal use)
2168
+ */
2169
+ async update(value = 'default value used internal') {
2170
+ const input = this.el.shadowRoot.querySelector("#phone");
2171
+ if (value != 'default value used internal') {
2172
+ input.value = this.getFilteredValue(value);
2173
+ }
2174
+ else {
2175
+ input.value = this.getFilteredValue(input.value);
2176
+ }
2177
+ let isValidNumber = false;
2178
+ // only check format
2179
+ // parent input component will check value missing or not
2180
+ if (this.iti.isPossibleNumber() || input.value === '') {
2181
+ this.iti.setNumber(input.value);
2182
+ isValidNumber = true;
2183
+ }
2184
+ if (input.value.length === 3) {
2185
+ isValidNumber = true;
2186
+ }
2187
+ const object = {
2188
+ country: this.iti.getSelectedCountryData().iso2,
2189
+ value: this.getFormatNumber(isValidNumber),
2190
+ isValidNumber: isValidNumber,
2191
+ };
2192
+ this.inputTelUpdate.emit(object);
2193
+ }
2194
+ getFilteredValue(value) {
2195
+ return value.replace(/[^0-9\+]/g, '');
2196
+ }
2197
+ getFormatNumber(isValidNumber) {
2198
+ const input = this.el.shadowRoot.querySelector("#phone");
2199
+ const input2 = this.el.shadowRoot.querySelector("#phone2");
2200
+ if (isValidNumber) {
2201
+ const internationalNumber = this.iti.getNumber();
2202
+ this.iti2.setNumber(internationalNumber);
2203
+ return input2.value;
2204
+ }
2205
+ return input.value;
2206
+ }
2207
+ render() {
2208
+ return (index.h(index.Host, null, index.h("input", { id: "phone", type: "tel" }), index.h("div", { id: "phone2Container" }, index.h("input", { id: "phone2", type: "tel" }))));
2209
+ }
2210
+ get el() { return index.getElement(this); }
2211
+ };
2212
+ SasInputTel.style = sasInputTelCss;
2213
+
2214
+ const sasInputTextareaCss = ":host{display:flex;flex-grow:1}:host .container{display:flex;flex-grow:1;position:relative}:host .container:after{content:attr(data-count);position:absolute;right:0;bottom:7px;color:var(--s-400);font-size:12px;line-height:24px}:host textarea{border:none;color:var(--s-500);font-family:roboto, \"Font Awesome 6 Pro\";font-size:14px;text-overflow:ellipsis;flex-grow:1;margin:5px 25px 5px 10px;resize:none;line-height:24px;position:relative}:host textarea:focus{outline:none}:host .hidden-textarea{position:absolute;opacity:0;box-sizing:border-box;left:0;bottom:0;width:calc(100% - 35px)}";
2215
+
2216
+ let SasInputTextarea = class {
2217
+ constructor(hostRef) {
2218
+ index.registerInstance(this, hostRef);
2219
+ this.inputTextareaUpdate = index.createEvent(this, "inputTextareaUpdate", 7);
2220
+ this.lineHeight = 24;
2221
+ this.baseScrollHeight = -1;
2222
+ /**
2223
+ * Placeholder
2224
+ */
2225
+ this.placeholder = '';
2226
+ /**
2227
+ * Maximum number of characters allowed
2228
+ */
2229
+ this.maxlength = 1000;
2230
+ /**
2231
+ * Minimum number of characters allowed
2232
+ */
2233
+ this.minlength = 0;
2234
+ /**
2235
+ * Value
2236
+ */
2237
+ this.value = '';
2238
+ this.handleInput = (event) => {
2239
+ this.resize();
2240
+ this.inputTextareaUpdate.emit(event.target.value);
2241
+ };
2242
+ }
2243
+ watchHandler() {
2244
+ const element = this.el.shadowRoot.querySelector('.textarea');
2245
+ element.value = this.value;
2246
+ this.resize();
2247
+ }
2248
+ componentDidLoad() {
2249
+ this.resize();
2250
+ }
2251
+ resize() {
2252
+ if (this.baseScrollHeight === -1) {
2253
+ this.baseScrollHeight = this.getBaseScrollHeight();
2254
+ }
2255
+ const currentScrollHeight = this.getCurrentScrollHeight();
2256
+ const rows = Math.ceil((currentScrollHeight - this.baseScrollHeight) / this.lineHeight) + 1;
2257
+ const element = this.el.shadowRoot.querySelector('.textarea');
2258
+ element.rows = rows;
2259
+ }
2260
+ getBaseScrollHeight() {
2261
+ const element = this.el.shadowRoot.querySelector('.hidden-textarea');
2262
+ element.rows = 1;
2263
+ element.value = '';
2264
+ return element.scrollHeight;
2265
+ }
2266
+ getCurrentScrollHeight() {
2267
+ const element = this.el.shadowRoot.querySelector('.hidden-textarea');
2268
+ element.value = this.value;
2269
+ const currentScrollHeight = element.scrollHeight;
2270
+ element.value = '';
2271
+ return currentScrollHeight;
2272
+ }
2273
+ render() {
2274
+ return (index.h(index.Host, null, index.h("div", { class: "container", "data-count": Boolean(this.maxlength) && Boolean(this.value) ? this.maxlength - this.value.length : '' }, index.h("textarea", { class: "hidden-textarea", rows: 1 }), index.h("textarea", { class: "textarea", rows: 1, placeholder: this.placeholder, maxlength: this.maxlength, minlength: this.minlength, value: this.value, onInput: this.handleInput }))));
2275
+ }
2276
+ get el() { return index.getElement(this); }
2277
+ static get watchers() { return {
2278
+ "value": ["watchHandler"]
2279
+ }; }
2280
+ };
2281
+ SasInputTextarea.style = sasInputTextareaCss;
2282
+
2283
+ exports.sas_form_input_template = SasFormInputTemplate;
2284
+ exports.sas_input = SasInput;
2285
+ exports.sas_input_tel = SasInputTel;
2286
+ exports.sas_input_textarea = SasInputTextarea;