@ptcwebops/ptcw-design 3.0.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/embedded-form_9.cjs.entry.js +287 -12
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/ptcw-design.cjs.js +1 -1
- package/dist/collection/components/ptc-form-checkbox/ptc-form-checkbox.css +2 -3
- package/dist/collection/components/ptc-select/ptc-select.js +274 -3
- package/dist/collection/components/ptc-textfield/ptc-textfield.js +84 -6
- package/dist/collection/utils/elq-lib.js +4 -2
- package/dist/custom-elements/index.js +289 -14
- package/dist/esm/embedded-form_9.entry.js +287 -12
- package/dist/esm/loader.js +1 -1
- package/dist/esm/ptcw-design.js +1 -1
- package/dist/ptcw-design/p-b0b4ebd6.entry.js +359 -0
- package/dist/ptcw-design/ptcw-design.css +1 -1
- package/dist/ptcw-design/ptcw-design.esm.js +1 -1
- package/dist/types/components/ptc-select/ptc-select.d.ts +2 -0
- package/dist/types/components/ptc-textfield/ptc-textfield.d.ts +3 -0
- package/dist/types/components.d.ts +7 -0
- package/package.json +1 -1
- package/readme.md +1 -1
- package/dist/ptcw-design/p-61086af2.entry.js +0 -359
|
@@ -3,6 +3,253 @@ import { MDCSelect } from '@material/select';
|
|
|
3
3
|
// import { MDCSelectHelperText } from '@material/select/helper-text';
|
|
4
4
|
export class PtcSelect {
|
|
5
5
|
constructor() {
|
|
6
|
+
// helperTextComponent: any;
|
|
7
|
+
this.map = {
|
|
8
|
+
'Afghanistan': 'AF',
|
|
9
|
+
'Albania': 'AL',
|
|
10
|
+
'Algeria': 'DZ',
|
|
11
|
+
'American Samoa': 'AS',
|
|
12
|
+
'Andorra': 'AD',
|
|
13
|
+
'Angola': 'AO',
|
|
14
|
+
'Anguilla': 'AI',
|
|
15
|
+
'Antarctica': 'AQ',
|
|
16
|
+
'Antigua and Barbuda': 'AG',
|
|
17
|
+
'Argentina': 'AR',
|
|
18
|
+
'Armenia': 'AM',
|
|
19
|
+
'Aruba': 'AW',
|
|
20
|
+
'Australia': 'AU',
|
|
21
|
+
'Austria': 'AT',
|
|
22
|
+
'Azerbaijan': 'AZ',
|
|
23
|
+
'Bahamas': 'BS',
|
|
24
|
+
'Bahrain': 'BH',
|
|
25
|
+
'Bangladesh': 'BD',
|
|
26
|
+
'Barbados': 'BB',
|
|
27
|
+
'Belarus': 'BY',
|
|
28
|
+
'Belgium': 'BE',
|
|
29
|
+
'Belize': 'BZ',
|
|
30
|
+
'Benin': 'BJ',
|
|
31
|
+
'Bermuda': 'BM',
|
|
32
|
+
'Bhutan': 'BT',
|
|
33
|
+
'Bolivia': 'BO',
|
|
34
|
+
'Bosnia and Herzegovina': 'BA',
|
|
35
|
+
'Botswana': 'BW',
|
|
36
|
+
'Bouvet Island': 'BV',
|
|
37
|
+
'Brazil': 'BR',
|
|
38
|
+
'British Indian Ocean Territory': 'IO',
|
|
39
|
+
'Brunei Darussalam': 'BN',
|
|
40
|
+
'Bulgaria': 'BG',
|
|
41
|
+
'Burkina Faso': 'BF',
|
|
42
|
+
'Burundi': 'BI',
|
|
43
|
+
'Cambodia': 'KH',
|
|
44
|
+
'Cameroon': 'CM',
|
|
45
|
+
'Canada': 'CA',
|
|
46
|
+
'Cape Verde': 'CV',
|
|
47
|
+
'Cayman Islands': 'KY',
|
|
48
|
+
'Central African Republic': 'CF',
|
|
49
|
+
'Chad': 'TD',
|
|
50
|
+
'Chile': 'CL',
|
|
51
|
+
'China': 'CN',
|
|
52
|
+
'Christmas Island': 'CX',
|
|
53
|
+
'Cocos (Keeling) Islands': 'CC',
|
|
54
|
+
'Colombia': 'CO',
|
|
55
|
+
'Comoros': 'KM',
|
|
56
|
+
'Congo': 'CG',
|
|
57
|
+
'Congo, Democratic Republic': 'CD',
|
|
58
|
+
'Cook Islands': 'CK',
|
|
59
|
+
'Costa Rica': 'CR',
|
|
60
|
+
'Cote d ivoire': 'CI',
|
|
61
|
+
'Croatia': 'HR',
|
|
62
|
+
'Cuba': 'CU',
|
|
63
|
+
'Cyprus': 'CY',
|
|
64
|
+
'Czech Republic': 'CZ',
|
|
65
|
+
'Denmark': 'DK',
|
|
66
|
+
'Djibouti': 'DJ',
|
|
67
|
+
'Dominica': 'DM',
|
|
68
|
+
'Dominican Republic': 'DO',
|
|
69
|
+
'Ecuador': 'EC',
|
|
70
|
+
'Egypt': 'EG',
|
|
71
|
+
'El Salvador': 'SV',
|
|
72
|
+
'Equatorial Guinea': 'GQ',
|
|
73
|
+
'Eritrea': 'ER',
|
|
74
|
+
'Estonia': 'EE',
|
|
75
|
+
'Ethiopia': 'ET',
|
|
76
|
+
'Falkland Islands': 'FK',
|
|
77
|
+
'Faroe Islands': 'FO',
|
|
78
|
+
'Fiji': 'FJ',
|
|
79
|
+
'Finland': 'FI',
|
|
80
|
+
'France': 'FR',
|
|
81
|
+
'French Guiana': 'GF',
|
|
82
|
+
'French Polynesia': 'PF',
|
|
83
|
+
'French Southern Territories': 'TF',
|
|
84
|
+
'Gabon': 'GA',
|
|
85
|
+
'Gambia': 'GM',
|
|
86
|
+
'Georgia': 'GE',
|
|
87
|
+
'Germany': 'DE',
|
|
88
|
+
'Ghana': 'GH',
|
|
89
|
+
'Gibraltar': 'GI',
|
|
90
|
+
'Greece': 'GR',
|
|
91
|
+
'Greenland': 'GL',
|
|
92
|
+
'Grenada': 'GD',
|
|
93
|
+
'Guadeloupe': 'GP',
|
|
94
|
+
'Guam': 'GU',
|
|
95
|
+
'Guatemala': 'GT',
|
|
96
|
+
'Guernsey': 'GG',
|
|
97
|
+
'Guinea': 'GN',
|
|
98
|
+
'Guinea-Bissau': 'GW',
|
|
99
|
+
'Guyana': 'GY',
|
|
100
|
+
'Haiti': 'HT',
|
|
101
|
+
'Heard and McDonald Isl': 'HM',
|
|
102
|
+
'Holy See (Vatican City State)': 'VA',
|
|
103
|
+
'Honduras': 'HN',
|
|
104
|
+
'Hong Kong': 'HK',
|
|
105
|
+
'Hungary': 'HU',
|
|
106
|
+
'Iceland': 'IS',
|
|
107
|
+
'India': 'IN',
|
|
108
|
+
'Indonesia': 'ID',
|
|
109
|
+
'Iran, Islamic Republic Of': 'IR',
|
|
110
|
+
'Iraq': 'IQ',
|
|
111
|
+
'Ireland': 'IE',
|
|
112
|
+
'Isle Of Man': 'IM',
|
|
113
|
+
'Israel': 'IL',
|
|
114
|
+
'Italy': 'IT',
|
|
115
|
+
'Jamaica': 'JM',
|
|
116
|
+
'Japan': 'JP',
|
|
117
|
+
'Jersey': 'JE',
|
|
118
|
+
'Jordan': 'JO',
|
|
119
|
+
'Kazakhstan': 'KZ',
|
|
120
|
+
'Kenya': 'KE',
|
|
121
|
+
'Kiribati': 'KI',
|
|
122
|
+
'Korea': 'KR',
|
|
123
|
+
'Kuwait': 'KW',
|
|
124
|
+
'Kyrgyzstan': 'KG',
|
|
125
|
+
"Lao People's Democratic Republic": 'LA',
|
|
126
|
+
'Latvia': 'LV',
|
|
127
|
+
'Lebanon': 'LB',
|
|
128
|
+
'Lesotho': 'LS',
|
|
129
|
+
'Liberia': 'LR',
|
|
130
|
+
'Libyan Arab Jamahiriya': 'LY',
|
|
131
|
+
'Liechtenstein': 'LI',
|
|
132
|
+
'Lithuania': 'LT',
|
|
133
|
+
'Luxembourg': 'LU',
|
|
134
|
+
'Macao': 'MO',
|
|
135
|
+
'Macedonia': 'MK',
|
|
136
|
+
'Madagascar': 'MG',
|
|
137
|
+
'Malawi': 'MW',
|
|
138
|
+
'Malaysia': 'MY',
|
|
139
|
+
'Maldives': 'MV',
|
|
140
|
+
'Mali': 'ML',
|
|
141
|
+
'Malta': 'MT',
|
|
142
|
+
'Marshall Islands': 'MH',
|
|
143
|
+
'Martinique': 'MQ',
|
|
144
|
+
'Mauritania': 'MR',
|
|
145
|
+
'Mauritius': 'MU',
|
|
146
|
+
'Mayotte': 'YT',
|
|
147
|
+
'Mexico': 'MX',
|
|
148
|
+
'Micronesia, Federated States Of': 'FM',
|
|
149
|
+
'Moldova': 'MD',
|
|
150
|
+
'Monaco': 'MC',
|
|
151
|
+
'Mongolia': 'MN',
|
|
152
|
+
'Montenegro': 'ME',
|
|
153
|
+
'Montserrat': 'MS',
|
|
154
|
+
'Morocco': 'MA',
|
|
155
|
+
'Mozambique': 'MZ',
|
|
156
|
+
'Myanmar': 'MM',
|
|
157
|
+
'Namibia': 'NA',
|
|
158
|
+
'Nauru': 'NR',
|
|
159
|
+
'Nepal': 'NP',
|
|
160
|
+
'Netherlands': 'NL',
|
|
161
|
+
'Netherlands Antilles': 'AN',
|
|
162
|
+
'New Caledonia': 'NC',
|
|
163
|
+
'New Zealand': 'NZ',
|
|
164
|
+
'Nicaragua': 'NI',
|
|
165
|
+
'Niger': 'NE',
|
|
166
|
+
'Nigeria': 'NG',
|
|
167
|
+
'Niue': 'NU',
|
|
168
|
+
'Norfolk Island': 'NF',
|
|
169
|
+
'Northern Mariana Islands': 'MP',
|
|
170
|
+
'Norway': 'NO',
|
|
171
|
+
'Oman': 'OM',
|
|
172
|
+
'Pakistan': 'PK',
|
|
173
|
+
'Palau': 'PW',
|
|
174
|
+
'Palestinian Territory, Occupied': 'PS',
|
|
175
|
+
'Panama': 'PA',
|
|
176
|
+
'Papua New Guinea': 'PG',
|
|
177
|
+
'Paraguay': 'PY',
|
|
178
|
+
'Peru': 'PE',
|
|
179
|
+
'Philippines': 'PH',
|
|
180
|
+
'Pitcairn': 'PN',
|
|
181
|
+
'Poland': 'PL',
|
|
182
|
+
'Portugal': 'PT',
|
|
183
|
+
'Puerto Rico': 'PR',
|
|
184
|
+
'Qatar': 'QA',
|
|
185
|
+
'Reunion': 'RE',
|
|
186
|
+
'Romania': 'RO',
|
|
187
|
+
'Russian Federation': 'RU',
|
|
188
|
+
'Rwanda': 'RW',
|
|
189
|
+
'Saint Barthelemy': 'BL',
|
|
190
|
+
'Saint Helena': 'SH',
|
|
191
|
+
'Saint Kitts and Nevis': 'KN',
|
|
192
|
+
'Saint Lucia': 'LC',
|
|
193
|
+
'Saint Martin': 'MF',
|
|
194
|
+
'Saint Pierre and Miquelon': 'PM',
|
|
195
|
+
'Saint Vincent and Grenadines': 'VC',
|
|
196
|
+
'Samoa': 'WS',
|
|
197
|
+
'San Marino': 'SM',
|
|
198
|
+
'Sao Tome and Principe': 'ST',
|
|
199
|
+
'Saudi Arabia': 'SA',
|
|
200
|
+
'Senegal': 'SN',
|
|
201
|
+
'Serbia': 'RS',
|
|
202
|
+
'Seychelles': 'SC',
|
|
203
|
+
'Sierra Leone': 'SL',
|
|
204
|
+
'Singapore': 'SG',
|
|
205
|
+
'Slovakia': 'SK',
|
|
206
|
+
'Slovenia': 'SI',
|
|
207
|
+
'Solomon Islands': 'SB',
|
|
208
|
+
'Somalia': 'SO',
|
|
209
|
+
'South Africa': 'ZA',
|
|
210
|
+
'South Georgia and Sandwich Isl.': 'GS',
|
|
211
|
+
'Spain': 'ES',
|
|
212
|
+
'Sri Lanka': 'LK',
|
|
213
|
+
'Sudan': 'SD',
|
|
214
|
+
'Suriname': 'SR',
|
|
215
|
+
'Svalbard and Jan Mayen': 'SJ',
|
|
216
|
+
'Swaziland': 'SZ',
|
|
217
|
+
'Sweden': 'SE',
|
|
218
|
+
'Switzerland': 'CH',
|
|
219
|
+
'Syrian Arab Republic': 'SY',
|
|
220
|
+
'Taiwan': 'TW',
|
|
221
|
+
'Tajikistan': 'TJ',
|
|
222
|
+
'Tanzania': 'TZ',
|
|
223
|
+
'Thailand': 'TH',
|
|
224
|
+
'Timor-Leste': 'TL',
|
|
225
|
+
'Togo': 'TG',
|
|
226
|
+
'Tokelau': 'TK',
|
|
227
|
+
'Tonga': 'TO',
|
|
228
|
+
'Trinidad and Tobago': 'TT',
|
|
229
|
+
'Tunisia': 'TN',
|
|
230
|
+
'Turkey': 'TR',
|
|
231
|
+
'Turkmenistan': 'TM',
|
|
232
|
+
'Turks and Caicos Islands': 'TC',
|
|
233
|
+
'Tuvalu': 'TV',
|
|
234
|
+
'Uganda': 'UG',
|
|
235
|
+
'Ukraine': 'UA',
|
|
236
|
+
'United Arab Emirates': 'AE',
|
|
237
|
+
'United Kingdom': 'GB',
|
|
238
|
+
'USA': 'US',
|
|
239
|
+
'US Minor Outlying Islands': 'UM',
|
|
240
|
+
'Uruguay': 'UY',
|
|
241
|
+
'Uzbekistan': 'UZ',
|
|
242
|
+
'Vanuatu': 'VU',
|
|
243
|
+
'Venezuela': 'VE',
|
|
244
|
+
'Vietnam': 'VN',
|
|
245
|
+
'Virgin Islands (British)': 'VG',
|
|
246
|
+
'Virgin Islands (U.S.)': 'VI',
|
|
247
|
+
'Wallis And Futuna': 'WF',
|
|
248
|
+
'Western Sahara': 'EH',
|
|
249
|
+
'Yemen': 'YE',
|
|
250
|
+
'Zambia': 'ZM',
|
|
251
|
+
'Zimbabwe': 'ZW',
|
|
252
|
+
};
|
|
6
253
|
this.fieldId = undefined;
|
|
7
254
|
this.label = undefined;
|
|
8
255
|
this.isRequired = true;
|
|
@@ -11,15 +258,22 @@ export class PtcSelect {
|
|
|
11
258
|
this.disabled = false;
|
|
12
259
|
this.selectedValue = '';
|
|
13
260
|
this.ptcDataEloquaName = undefined;
|
|
261
|
+
this.ptcDataTargetEloquaName = undefined;
|
|
14
262
|
}
|
|
15
|
-
// helperTextComponent: any;
|
|
16
263
|
componentDidLoad() {
|
|
17
264
|
const select = new MDCSelect(this.el.querySelector('.mdc-select'));
|
|
18
265
|
select.listen('MDCSelect:change', () => {
|
|
19
266
|
this.valueChange.emit(select.value);
|
|
20
267
|
this.selectedValue = select.value;
|
|
268
|
+
if (this.fieldId === 'contact-country') {
|
|
269
|
+
console.log('changing country field value');
|
|
270
|
+
const countryCode = this.selectedValue ? this.map[this.selectedValue] : '';
|
|
271
|
+
const telField = document.querySelector('ptc-textfield[field-id="contact-phone"]');
|
|
272
|
+
if (telField && countryCode) {
|
|
273
|
+
telField.syncCountry(countryCode);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
21
276
|
});
|
|
22
|
-
// this.helperTextComponent = new MDCSelectHelperText(this.el.querySelector('.mdc-select-helper-text'));
|
|
23
277
|
}
|
|
24
278
|
getSelectClassName() {
|
|
25
279
|
let className = 'mdc-select mdc-select--outlined mdc-select--no-label';
|
|
@@ -29,7 +283,7 @@ export class PtcSelect {
|
|
|
29
283
|
return className;
|
|
30
284
|
}
|
|
31
285
|
render() {
|
|
32
|
-
return (h(Host, { class: "ptc-select" }, h("label", { class: "ptc-label-select" }, this.label), h("div", { class: this.getSelectClassName() }, h("div", Object.assign({ class: "mdc-select__anchor", "aria-labelledby": "outlined-select-label" }, (this.isRequired ? { ariaRequired: true } : null)), h("span", { class: "mdc-notched-outline" }, h("span", { class: "mdc-notched-outline__leading" }), h("span", { class: "mdc-notched-outline__trailing" })), h("span", { class: "mdc-select__selected-text-container" }, h("span", { id: this.fieldId, class: "mdc-select__selected-text", "aria-controls": this.name, "aria-describedby": this.name, "data-eloqua-name": this.ptcDataEloquaName })), h("span", { class: "mdc-select__dropdown-icon" }, h("svg", { class: "", width: "20", height: "12", viewBox: "0 0 10 10", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M1.375 1.875L5 5.5L8.625 1.875L9.9375 3.1875L5 8.125L0.0625 3.1875L1.375 1.875Z" })))), h("div", { class: "mdc-select__menu mdc-menu mdc-menu-surface mdc-menu-surface--fullwidth" }, h("slot", null))), h("p", { id: this.name, class: "mdc-select-helper-text mdc-select-helper-text--validation-msg" }, h("svg", { class: "select-error-svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("g", { "clip-path": "url(#clip0_12_1424)" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M11.3156 0L16 4.68444V11.3156L11.3156 16H4.68444L0 11.3156V4.68444L4.68444 0H11.3156ZM8 10.4C7.36 10.4 6.84444 10.9156 6.84444 11.5556C6.84444 12.1956 7.36 12.7111 8 12.7111C8.64 12.7111 9.15556 12.1956 9.15556 11.5556C9.15556 10.9156 8.64 10.4 8 10.4ZM8.88889 3.55556H7.11111V8.88889H8.88889V3.55556Z", fill: "#AF3231" })), h("defs", null, h("clipPath", { id: "clip0_12_1424" }, h("rect", { width: "16", height: "16", fill: "white" })))), this.helpertext)));
|
|
286
|
+
return (h(Host, { class: "ptc-select" }, h("label", { class: "ptc-label-select" }, this.label), h("div", { class: this.getSelectClassName() }, h("div", Object.assign({ class: "mdc-select__anchor", "aria-labelledby": "outlined-select-label" }, (this.isRequired ? { ariaRequired: true } : null)), h("span", { class: "mdc-notched-outline" }, h("span", { class: "mdc-notched-outline__leading" }), h("span", { class: "mdc-notched-outline__trailing" })), h("span", { class: "mdc-select__selected-text-container" }, h("span", { id: this.fieldId, class: "mdc-select__selected-text", "aria-controls": this.name, "aria-describedby": this.name, "data-eloqua-name": this.ptcDataEloquaName, "data-target-eloqua-name": this.ptcDataTargetEloquaName })), h("span", { class: "mdc-select__dropdown-icon" }, h("svg", { class: "", width: "20", height: "12", viewBox: "0 0 10 10", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M1.375 1.875L5 5.5L8.625 1.875L9.9375 3.1875L5 8.125L0.0625 3.1875L1.375 1.875Z" })))), h("div", { class: "mdc-select__menu mdc-menu mdc-menu-surface mdc-menu-surface--fullwidth" }, h("slot", null))), h("p", { id: this.name, class: "mdc-select-helper-text mdc-select-helper-text--validation-msg" }, h("svg", { class: "select-error-svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("g", { "clip-path": "url(#clip0_12_1424)" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M11.3156 0L16 4.68444V11.3156L11.3156 16H4.68444L0 11.3156V4.68444L4.68444 0H11.3156ZM8 10.4C7.36 10.4 6.84444 10.9156 6.84444 11.5556C6.84444 12.1956 7.36 12.7111 8 12.7111C8.64 12.7111 9.15556 12.1956 9.15556 11.5556C9.15556 10.9156 8.64 10.4 8 10.4ZM8.88889 3.55556H7.11111V8.88889H8.88889V3.55556Z", fill: "#AF3231" })), h("defs", null, h("clipPath", { id: "clip0_12_1424" }, h("rect", { width: "16", height: "16", fill: "white" })))), this.helpertext)));
|
|
33
287
|
}
|
|
34
288
|
static get is() { return "ptc-select"; }
|
|
35
289
|
static get originalStyleUrls() {
|
|
@@ -183,6 +437,23 @@ export class PtcSelect {
|
|
|
183
437
|
},
|
|
184
438
|
"attribute": "ptc-data-eloqua-name",
|
|
185
439
|
"reflect": false
|
|
440
|
+
},
|
|
441
|
+
"ptcDataTargetEloquaName": {
|
|
442
|
+
"type": "string",
|
|
443
|
+
"mutable": false,
|
|
444
|
+
"complexType": {
|
|
445
|
+
"original": "string",
|
|
446
|
+
"resolved": "string",
|
|
447
|
+
"references": {}
|
|
448
|
+
},
|
|
449
|
+
"required": false,
|
|
450
|
+
"optional": false,
|
|
451
|
+
"docs": {
|
|
452
|
+
"tags": [],
|
|
453
|
+
"text": ""
|
|
454
|
+
},
|
|
455
|
+
"attribute": "ptc-data-target-eloqua-name",
|
|
456
|
+
"reflect": false
|
|
186
457
|
}
|
|
187
458
|
};
|
|
188
459
|
}
|
|
@@ -13,7 +13,9 @@ export class PtcTextfield {
|
|
|
13
13
|
this.disabled = false;
|
|
14
14
|
this.name = 'email';
|
|
15
15
|
this.ptcDataEloquaName = undefined;
|
|
16
|
+
this.ptcDataTargetEloquaName = undefined;
|
|
16
17
|
this.inputValue = '';
|
|
18
|
+
this.customValidation = undefined;
|
|
17
19
|
}
|
|
18
20
|
handleInput(event) {
|
|
19
21
|
this.inputValue = event.target.value;
|
|
@@ -22,10 +24,21 @@ export class PtcTextfield {
|
|
|
22
24
|
inputBlurHandler() {
|
|
23
25
|
// console.log(event.target)
|
|
24
26
|
// this.getPhoneValidation();
|
|
25
|
-
this.
|
|
26
|
-
|
|
27
|
-
this.
|
|
28
|
-
|
|
27
|
+
if (this.customValidation) {
|
|
28
|
+
let message = this.customValidation(this.customInput);
|
|
29
|
+
this.customInput.setCustomValidity(message);
|
|
30
|
+
this.customInput.reportValidity();
|
|
31
|
+
this.setErrorBackground();
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this.setErrorBackground();
|
|
35
|
+
setTimeout(() => {
|
|
36
|
+
this.getPhoneValidation();
|
|
37
|
+
}, 100);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async syncCountry(countryCode) {
|
|
41
|
+
this.iti.setCountry(countryCode);
|
|
29
42
|
}
|
|
30
43
|
componentDidLoad() {
|
|
31
44
|
if (this.type !== 'hidden') {
|
|
@@ -41,8 +54,14 @@ export class PtcTextfield {
|
|
|
41
54
|
if (this.fieldId === 'contact-phone' && this.name === 'phone') {
|
|
42
55
|
this.iti = intlTelInput(this.customInput, {
|
|
43
56
|
separateDialCode: true,
|
|
44
|
-
initialCountry: '
|
|
57
|
+
initialCountry: 'auto',
|
|
45
58
|
nationalMode: true,
|
|
59
|
+
geoIpLookup: callback => {
|
|
60
|
+
fetch("https://ipapi.co/json")
|
|
61
|
+
.then(res => res.json())
|
|
62
|
+
.then(data => callback(data.country_code))
|
|
63
|
+
.catch(() => callback("us"));
|
|
64
|
+
},
|
|
46
65
|
utilsScript: 'https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/18.2.1/js/utils.min.js', // Required for formatting/validation
|
|
47
66
|
});
|
|
48
67
|
}
|
|
@@ -148,7 +167,7 @@ export class PtcTextfield {
|
|
|
148
167
|
this.mdcTextfield = mdcTextfield;
|
|
149
168
|
} }, h("span", { class: "mdc-notched-outline ptc-textfield-outline" }, h("span", { class: "mdc-notched-outline__leading" }), h("span", { class: "mdc-notched-outline__trailing" })), h("input", Object.assign({ ref: customInput => {
|
|
150
169
|
this.customInput = customInput;
|
|
151
|
-
}, id: this.fieldId }, (this.getInputClassName() ? { class: this.getInputClassName() } : null), { type: this.type }, (this.required ? { required: true } : null), (this.ptcMaxLength ? { maxlength: this.ptcMaxLength } : null), { "aria-controls": this.name, "aria-describedby": this.name, "data-eloqua-name": this.ptcDataEloquaName, value: this.inputValue }, (this.getValidationPattern() ? { pattern: this.getValidationPattern() } : null)))),
|
|
170
|
+
}, id: this.fieldId }, (this.getInputClassName() ? { class: this.getInputClassName() } : null), { type: this.type }, (this.required ? { required: true } : null), (this.ptcMaxLength ? { maxlength: this.ptcMaxLength } : null), { "aria-controls": this.name, "aria-describedby": this.name, "data-eloqua-name": this.ptcDataEloquaName, "data-target-eloqua-name": this.ptcDataTargetEloquaName, value: this.inputValue }, (this.getValidationPattern() ? { pattern: this.getValidationPattern() } : null)))),
|
|
152
171
|
h("div", { class: `mdc-text-field-helper-line
|
|
153
172
|
${!!this.ptcMaxLength ? 'field-with-counter' : ''}` }, h("div", { class: "mdc-text-field-helper-text mdc-text-field-helper-text--validation-msg", id: this.name }, h("svg", { class: "input-error-svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("g", { "clip-path": "url(#clip0_12_1424)" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M11.3156 0L16 4.68444V11.3156L11.3156 16H4.68444L0 11.3156V4.68444L4.68444 0H11.3156ZM8 10.4C7.36 10.4 6.84444 10.9156 6.84444 11.5556C6.84444 12.1956 7.36 12.7111 8 12.7111C8.64 12.7111 9.15556 12.1956 9.15556 11.5556C9.15556 10.9156 8.64 10.4 8 10.4ZM8.88889 3.55556H7.11111V8.88889H8.88889V3.55556Z", fill: "#AF3231" })), h("defs", null, h("clipPath", { id: "clip0_12_1424" }, h("rect", { width: "16", height: "16", fill: "white" })))), this.helpertext), this.ptcMaxLength ? (h("div", { class: "mdc-text-field-character-counter" }, this.inputValue.length, " / ", this.ptcMaxLength)) : null),
|
|
154
173
|
]) : (h("input", { type: "hidden", "data-eloqua-name": this.ptcDataEloquaName, value: this.inputValue }))));
|
|
@@ -325,6 +344,23 @@ export class PtcTextfield {
|
|
|
325
344
|
"attribute": "ptc-data-eloqua-name",
|
|
326
345
|
"reflect": false
|
|
327
346
|
},
|
|
347
|
+
"ptcDataTargetEloquaName": {
|
|
348
|
+
"type": "string",
|
|
349
|
+
"mutable": false,
|
|
350
|
+
"complexType": {
|
|
351
|
+
"original": "string",
|
|
352
|
+
"resolved": "string",
|
|
353
|
+
"references": {}
|
|
354
|
+
},
|
|
355
|
+
"required": false,
|
|
356
|
+
"optional": false,
|
|
357
|
+
"docs": {
|
|
358
|
+
"tags": [],
|
|
359
|
+
"text": ""
|
|
360
|
+
},
|
|
361
|
+
"attribute": "ptc-data-target-eloqua-name",
|
|
362
|
+
"reflect": false
|
|
363
|
+
},
|
|
328
364
|
"inputValue": {
|
|
329
365
|
"type": "string",
|
|
330
366
|
"mutable": true,
|
|
@@ -342,6 +378,48 @@ export class PtcTextfield {
|
|
|
342
378
|
"attribute": "input-value",
|
|
343
379
|
"reflect": false,
|
|
344
380
|
"defaultValue": "''"
|
|
381
|
+
},
|
|
382
|
+
"customValidation": {
|
|
383
|
+
"type": "unknown",
|
|
384
|
+
"mutable": false,
|
|
385
|
+
"complexType": {
|
|
386
|
+
"original": "(input: HTMLInputElement) => string",
|
|
387
|
+
"resolved": "(input: HTMLInputElement) => string",
|
|
388
|
+
"references": {
|
|
389
|
+
"HTMLInputElement": {
|
|
390
|
+
"location": "global"
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
"required": false,
|
|
395
|
+
"optional": false,
|
|
396
|
+
"docs": {
|
|
397
|
+
"tags": [],
|
|
398
|
+
"text": ""
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
static get methods() {
|
|
404
|
+
return {
|
|
405
|
+
"syncCountry": {
|
|
406
|
+
"complexType": {
|
|
407
|
+
"signature": "(countryCode: string) => Promise<void>",
|
|
408
|
+
"parameters": [{
|
|
409
|
+
"tags": [],
|
|
410
|
+
"text": ""
|
|
411
|
+
}],
|
|
412
|
+
"references": {
|
|
413
|
+
"Promise": {
|
|
414
|
+
"location": "global"
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
"return": "Promise<void>"
|
|
418
|
+
},
|
|
419
|
+
"docs": {
|
|
420
|
+
"text": "",
|
|
421
|
+
"tags": []
|
|
422
|
+
}
|
|
345
423
|
}
|
|
346
424
|
};
|
|
347
425
|
}
|
|
@@ -323,8 +323,10 @@ export class ElqLib {
|
|
|
323
323
|
init_notme() {
|
|
324
324
|
const topAdditional = document.getElementById('not-me-additional-top');
|
|
325
325
|
const bottomAdditional = document.getElementById('not-me-additional-bottom');
|
|
326
|
-
topAdditional
|
|
327
|
-
|
|
326
|
+
if (topAdditional)
|
|
327
|
+
topAdditional.style.display = 'none';
|
|
328
|
+
if (bottomAdditional)
|
|
329
|
+
bottomAdditional.style.display = 'none';
|
|
328
330
|
}
|
|
329
331
|
remove_user_details(e) {
|
|
330
332
|
e.preventDefault();
|