@ptcwebops/ptcw-design 2.6.6 → 2.6.8
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.cjs.entry.js +93 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/ptc-form-checkbox_3.cjs.entry.js +10664 -0
- package/dist/cjs/ptc-form.cjs.entry.js +89 -0
- package/dist/cjs/ptc-nav-link.cjs.entry.js +8 -4
- package/dist/cjs/ptc-nav-slider.cjs.entry.js +2 -2
- package/dist/cjs/ptc-nav-submenu.cjs.entry.js +1 -1
- package/dist/cjs/ptc-subnav.cjs.entry.js +7 -3
- package/dist/cjs/ptc-text-copy-with-background.cjs.entry.js +1 -1
- package/dist/cjs/ptcw-design.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +5 -0
- package/dist/collection/components/organism-bundles/form/embedded-form/embedded-form.css +29 -0
- package/dist/collection/components/organism-bundles/form/embedded-form/embedded-form.js +98 -0
- package/dist/collection/components/organism-bundles/form/ptc-form/ptc-form.css +14 -0
- package/dist/collection/components/organism-bundles/form/ptc-form/ptc-form.js +94 -0
- package/dist/collection/components/ptc-form-checkbox/ptc-form-checkbox.css +1083 -0
- package/dist/collection/components/ptc-form-checkbox/ptc-form-checkbox.js +209 -0
- package/dist/collection/components/ptc-select/ptc-select.css +6099 -0
- package/dist/collection/components/ptc-select/ptc-select.js +190 -0
- package/dist/collection/components/ptc-text-copy-with-background/ptc-text-copy-with-background.css +5 -2
- package/dist/collection/components/ptc-textfield/ptc-textfield.css +3590 -0
- package/dist/collection/components/ptc-textfield/ptc-textfield.js +351 -0
- package/dist/collection/components/subnav/ptc-nav-link/ptc-nav-link.css +2 -1
- package/dist/collection/components/subnav/ptc-nav-link/ptc-nav-link.js +24 -3
- package/dist/collection/components/subnav/ptc-nav-slider/ptc-nav-slider.js +2 -2
- package/dist/collection/components/subnav/ptc-nav-submenu/ptc-nav-submenu.css +8 -2
- package/dist/collection/components/subnav/ptc-subnav/ptc-subnav.css +8 -2
- package/dist/collection/components/subnav/ptc-subnav/ptc-subnav.js +12 -2
- package/dist/collection/stories/FormCheckbox.stories.js +58 -0
- package/dist/collection/stories/Select.stories.js +61 -0
- package/dist/collection/stories/Textfield.stories.js +82 -0
- package/dist/custom-elements/index.d.ts +31 -1
- package/dist/custom-elements/index.js +14325 -3479
- package/dist/esm/embedded-form.entry.js +89 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/ptc-form-checkbox_3.entry.js +10658 -0
- package/dist/esm/ptc-form.entry.js +85 -0
- package/dist/esm/ptc-nav-link.entry.js +9 -5
- package/dist/esm/ptc-nav-slider.entry.js +2 -2
- package/dist/esm/ptc-nav-submenu.entry.js +1 -1
- package/dist/esm/ptc-subnav.entry.js +7 -3
- package/dist/esm/ptc-text-copy-with-background.entry.js +1 -1
- package/dist/esm/ptcw-design.js +1 -1
- package/dist/ptcw-design/p-018470e2.entry.js +1 -0
- package/dist/ptcw-design/p-0b1d5c21.entry.js +1 -0
- package/dist/ptcw-design/p-11582f1e.entry.js +359 -0
- package/dist/ptcw-design/p-2fb1e3d3.entry.js +1 -0
- package/dist/ptcw-design/{p-bf47669c.entry.js → p-3fa6d101.entry.js} +1 -1
- package/dist/ptcw-design/p-84090398.entry.js +1 -0
- package/dist/ptcw-design/p-d46fc3a3.entry.js +1 -0
- package/dist/ptcw-design/p-f245f1bd.entry.js +1 -0
- package/dist/ptcw-design/ptcw-design.css +1 -1
- package/dist/ptcw-design/ptcw-design.esm.js +1 -1
- package/dist/types/components/organism-bundles/form/embedded-form/embedded-form.d.ts +29 -0
- package/dist/types/components/organism-bundles/form/ptc-form/ptc-form.d.ts +25 -0
- package/dist/types/components/ptc-form-checkbox/ptc-form-checkbox.d.ts +20 -0
- package/dist/types/components/ptc-select/ptc-select.d.ts +18 -0
- package/dist/types/components/ptc-textfield/ptc-textfield.d.ts +27 -0
- package/dist/types/components/subnav/ptc-nav-link/ptc-nav-link.d.ts +6 -1
- package/dist/types/components/subnav/ptc-subnav/ptc-subnav.d.ts +1 -0
- package/dist/types/components.d.ts +136 -0
- package/package.json +7 -1
- package/readme.md +1 -1
- package/dist/ptcw-design/p-110cd4a4.entry.js +0 -1
- package/dist/ptcw-design/p-909d5ec8.entry.js +0 -1
- package/dist/ptcw-design/p-c249785a.entry.js +0 -1
- package/dist/ptcw-design/p-fd6d40c3.entry.js +0 -1
- package/dist/types/global.d.ts +0 -1072
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import { h, Host } from '@stencil/core';
|
|
2
|
+
import { MDCTextField } from '@material/textfield';
|
|
3
|
+
import intlTelInput from 'intl-tel-input';
|
|
4
|
+
export class PtcTextfield {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.phoneValidity = 'validating';
|
|
7
|
+
this.fieldId = undefined;
|
|
8
|
+
this.type = 'text';
|
|
9
|
+
this.required = true;
|
|
10
|
+
this.ptcMaxLength = undefined;
|
|
11
|
+
this.labelText = 'Email';
|
|
12
|
+
this.helpertext = 'Please enter a value';
|
|
13
|
+
this.disabled = false;
|
|
14
|
+
this.name = 'email';
|
|
15
|
+
this.ptcDataEloquaName = undefined;
|
|
16
|
+
this.inputValue = '';
|
|
17
|
+
}
|
|
18
|
+
handleInput(event) {
|
|
19
|
+
this.inputValue = event.target.value;
|
|
20
|
+
this.setHelperText();
|
|
21
|
+
}
|
|
22
|
+
inputBlurHandler() {
|
|
23
|
+
// console.log(event.target)
|
|
24
|
+
// this.getPhoneValidation();
|
|
25
|
+
this.setErrorBackground();
|
|
26
|
+
setTimeout(() => {
|
|
27
|
+
this.getPhoneValidation();
|
|
28
|
+
}, 100);
|
|
29
|
+
}
|
|
30
|
+
componentDidLoad() {
|
|
31
|
+
this.mdcTextfieldComponent = MDCTextField.attachTo(this.mdcTextfield);
|
|
32
|
+
if (this.fieldId === 'contact-phone' && this.name === 'phone') {
|
|
33
|
+
this.iti = intlTelInput(this.customInput, {
|
|
34
|
+
separateDialCode: true,
|
|
35
|
+
initialCountry: 'us',
|
|
36
|
+
nationalMode: true,
|
|
37
|
+
utilsScript: 'https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/18.2.1/js/utils.min.js', // Required for formatting/validation
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
getPhoneValidation() {
|
|
42
|
+
if (this.fieldId === 'contact-phone' && this.name === 'phone') {
|
|
43
|
+
if (this.iti.isValidNumber()) {
|
|
44
|
+
if (this.mdcTextfield.classList.contains('mdc-text-field--invalid')) {
|
|
45
|
+
this.mdcTextfield.classList.remove('mdc-text-field--invalid');
|
|
46
|
+
}
|
|
47
|
+
if (this.el.classList.contains('invalid-field')) {
|
|
48
|
+
this.el.classList.remove('invalid-field');
|
|
49
|
+
}
|
|
50
|
+
// console.log("text field class list: " + this.mdcTextfield.className)
|
|
51
|
+
}
|
|
52
|
+
else if (!this.iti.isValidNumber()) {
|
|
53
|
+
if (!this.mdcTextfield.classList.contains('mdc-text-field--invalid')) {
|
|
54
|
+
this.mdcTextfield.classList.add('mdc-text-field--invalid');
|
|
55
|
+
}
|
|
56
|
+
if (!this.el.classList.contains('invalid-field')) {
|
|
57
|
+
this.el.classList.add('invalid-field');
|
|
58
|
+
}
|
|
59
|
+
// console.log("text field class list: " + this.mdcTextfield.className);
|
|
60
|
+
// console.log("this class list: " + this.el.className)
|
|
61
|
+
}
|
|
62
|
+
// console.log('hello!');
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
setErrorBackground() {
|
|
66
|
+
if (this.customInput.checkValidity()) {
|
|
67
|
+
if (this.el.classList.contains('invalid-field')) {
|
|
68
|
+
this.el.classList.remove('invalid-field');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else if (!this.customInput.checkValidity()) {
|
|
72
|
+
if (!this.el.classList.contains('invalid-field')) {
|
|
73
|
+
this.el.classList.add('invalid-field');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
getInputClassName() {
|
|
78
|
+
let className = 'mdc-text-field__input';
|
|
79
|
+
if (this.type === 'tel' && this.name === 'phone') {
|
|
80
|
+
className = `${className} intl-tel-input`;
|
|
81
|
+
}
|
|
82
|
+
else if (this.type === 'text' && this.ptcMaxLength) {
|
|
83
|
+
className = `${className} mdc-text-field--with-internal-counter`;
|
|
84
|
+
}
|
|
85
|
+
return className;
|
|
86
|
+
}
|
|
87
|
+
getValidationPattern() {
|
|
88
|
+
let validationPattern = '';
|
|
89
|
+
// if (this.type === 'email' && this.name === 'email') {
|
|
90
|
+
// validationPattern = '[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}';
|
|
91
|
+
// }
|
|
92
|
+
if (this.name === 'firstname' || this.name === 'lastname') {
|
|
93
|
+
validationPattern = '[A-Za-z ]+';
|
|
94
|
+
}
|
|
95
|
+
return validationPattern;
|
|
96
|
+
}
|
|
97
|
+
setHelperText() {
|
|
98
|
+
if (this.type === 'email' && this.name === 'email') {
|
|
99
|
+
if (this.customInput.validity.valueMissing) {
|
|
100
|
+
this.helpertext = 'Email is required.';
|
|
101
|
+
}
|
|
102
|
+
else if (this.customInput.validity.typeMismatch) {
|
|
103
|
+
this.helpertext = 'Please enter a valid email.';
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
else if (this.name === 'firstname') {
|
|
107
|
+
if (this.customInput.validity.valueMissing) {
|
|
108
|
+
this.helpertext = 'Please enter your first name.';
|
|
109
|
+
}
|
|
110
|
+
else if (this.customInput.validity.patternMismatch) {
|
|
111
|
+
this.helpertext = 'Please check your first name';
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
else if (this.name === 'lastname') {
|
|
115
|
+
if (this.customInput.validity.valueMissing) {
|
|
116
|
+
this.helpertext = 'Please enter your last name.';
|
|
117
|
+
}
|
|
118
|
+
else if (this.customInput.validity.patternMismatch) {
|
|
119
|
+
this.helpertext = 'Please check your last name';
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
else if (this.fieldId === 'contact-phone') {
|
|
123
|
+
if (this.iti) {
|
|
124
|
+
if (this.inputValue === '') {
|
|
125
|
+
this.helpertext = 'Phone number is required';
|
|
126
|
+
}
|
|
127
|
+
else if (!this.iti.isValidNumber()) {
|
|
128
|
+
this.helpertext = 'Phone number is invalid';
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
render() {
|
|
134
|
+
return (h(Host, { class: `ptc-text-field
|
|
135
|
+
${this.fieldId === 'contact-phone' ? 'phone-field-style' : ''}` }, h("label", { class: "ptc-label" }, this.labelText), h("div", { class: `mdc-text-field mdc-text-field--outlined mdc-text-field--no-label
|
|
136
|
+
${this.fieldId === 'contact-phone' ? 'intl-phone-adjustments' : ''}`, ref: mdcTextfield => {
|
|
137
|
+
this.mdcTextfield = mdcTextfield;
|
|
138
|
+
} }, 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 => {
|
|
139
|
+
this.customInput = customInput;
|
|
140
|
+
} }, (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)))), h("div", { class: `mdc-text-field-helper-line
|
|
141
|
+
${!!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)));
|
|
142
|
+
}
|
|
143
|
+
static get is() { return "ptc-textfield"; }
|
|
144
|
+
static get originalStyleUrls() {
|
|
145
|
+
return {
|
|
146
|
+
"$": ["ptc-textfield.scss"]
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
static get styleUrls() {
|
|
150
|
+
return {
|
|
151
|
+
"$": ["ptc-textfield.css"]
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
static get properties() {
|
|
155
|
+
return {
|
|
156
|
+
"fieldId": {
|
|
157
|
+
"type": "string",
|
|
158
|
+
"mutable": false,
|
|
159
|
+
"complexType": {
|
|
160
|
+
"original": "string",
|
|
161
|
+
"resolved": "string",
|
|
162
|
+
"references": {}
|
|
163
|
+
},
|
|
164
|
+
"required": false,
|
|
165
|
+
"optional": false,
|
|
166
|
+
"docs": {
|
|
167
|
+
"tags": [],
|
|
168
|
+
"text": ""
|
|
169
|
+
},
|
|
170
|
+
"attribute": "field-id",
|
|
171
|
+
"reflect": false
|
|
172
|
+
},
|
|
173
|
+
"type": {
|
|
174
|
+
"type": "string",
|
|
175
|
+
"mutable": false,
|
|
176
|
+
"complexType": {
|
|
177
|
+
"original": "string",
|
|
178
|
+
"resolved": "string",
|
|
179
|
+
"references": {}
|
|
180
|
+
},
|
|
181
|
+
"required": false,
|
|
182
|
+
"optional": false,
|
|
183
|
+
"docs": {
|
|
184
|
+
"tags": [],
|
|
185
|
+
"text": ""
|
|
186
|
+
},
|
|
187
|
+
"attribute": "type",
|
|
188
|
+
"reflect": false,
|
|
189
|
+
"defaultValue": "'text'"
|
|
190
|
+
},
|
|
191
|
+
"required": {
|
|
192
|
+
"type": "boolean",
|
|
193
|
+
"mutable": false,
|
|
194
|
+
"complexType": {
|
|
195
|
+
"original": "boolean",
|
|
196
|
+
"resolved": "boolean",
|
|
197
|
+
"references": {}
|
|
198
|
+
},
|
|
199
|
+
"required": false,
|
|
200
|
+
"optional": false,
|
|
201
|
+
"docs": {
|
|
202
|
+
"tags": [],
|
|
203
|
+
"text": ""
|
|
204
|
+
},
|
|
205
|
+
"attribute": "required",
|
|
206
|
+
"reflect": false,
|
|
207
|
+
"defaultValue": "true"
|
|
208
|
+
},
|
|
209
|
+
"ptcMaxLength": {
|
|
210
|
+
"type": "number",
|
|
211
|
+
"mutable": false,
|
|
212
|
+
"complexType": {
|
|
213
|
+
"original": "number",
|
|
214
|
+
"resolved": "number",
|
|
215
|
+
"references": {}
|
|
216
|
+
},
|
|
217
|
+
"required": false,
|
|
218
|
+
"optional": true,
|
|
219
|
+
"docs": {
|
|
220
|
+
"tags": [],
|
|
221
|
+
"text": ""
|
|
222
|
+
},
|
|
223
|
+
"attribute": "ptc-max-length",
|
|
224
|
+
"reflect": false
|
|
225
|
+
},
|
|
226
|
+
"labelText": {
|
|
227
|
+
"type": "string",
|
|
228
|
+
"mutable": true,
|
|
229
|
+
"complexType": {
|
|
230
|
+
"original": "string",
|
|
231
|
+
"resolved": "string",
|
|
232
|
+
"references": {}
|
|
233
|
+
},
|
|
234
|
+
"required": false,
|
|
235
|
+
"optional": false,
|
|
236
|
+
"docs": {
|
|
237
|
+
"tags": [],
|
|
238
|
+
"text": ""
|
|
239
|
+
},
|
|
240
|
+
"attribute": "label-text",
|
|
241
|
+
"reflect": false,
|
|
242
|
+
"defaultValue": "'Email'"
|
|
243
|
+
},
|
|
244
|
+
"helpertext": {
|
|
245
|
+
"type": "string",
|
|
246
|
+
"mutable": true,
|
|
247
|
+
"complexType": {
|
|
248
|
+
"original": "string",
|
|
249
|
+
"resolved": "string",
|
|
250
|
+
"references": {}
|
|
251
|
+
},
|
|
252
|
+
"required": false,
|
|
253
|
+
"optional": false,
|
|
254
|
+
"docs": {
|
|
255
|
+
"tags": [],
|
|
256
|
+
"text": ""
|
|
257
|
+
},
|
|
258
|
+
"attribute": "helpertext",
|
|
259
|
+
"reflect": false,
|
|
260
|
+
"defaultValue": "'Please enter a value'"
|
|
261
|
+
},
|
|
262
|
+
"disabled": {
|
|
263
|
+
"type": "boolean",
|
|
264
|
+
"mutable": false,
|
|
265
|
+
"complexType": {
|
|
266
|
+
"original": "boolean",
|
|
267
|
+
"resolved": "boolean",
|
|
268
|
+
"references": {}
|
|
269
|
+
},
|
|
270
|
+
"required": false,
|
|
271
|
+
"optional": false,
|
|
272
|
+
"docs": {
|
|
273
|
+
"tags": [],
|
|
274
|
+
"text": ""
|
|
275
|
+
},
|
|
276
|
+
"attribute": "disabled",
|
|
277
|
+
"reflect": false,
|
|
278
|
+
"defaultValue": "false"
|
|
279
|
+
},
|
|
280
|
+
"name": {
|
|
281
|
+
"type": "string",
|
|
282
|
+
"mutable": false,
|
|
283
|
+
"complexType": {
|
|
284
|
+
"original": "string",
|
|
285
|
+
"resolved": "string",
|
|
286
|
+
"references": {}
|
|
287
|
+
},
|
|
288
|
+
"required": false,
|
|
289
|
+
"optional": false,
|
|
290
|
+
"docs": {
|
|
291
|
+
"tags": [],
|
|
292
|
+
"text": ""
|
|
293
|
+
},
|
|
294
|
+
"attribute": "name",
|
|
295
|
+
"reflect": false,
|
|
296
|
+
"defaultValue": "'email'"
|
|
297
|
+
},
|
|
298
|
+
"ptcDataEloquaName": {
|
|
299
|
+
"type": "string",
|
|
300
|
+
"mutable": false,
|
|
301
|
+
"complexType": {
|
|
302
|
+
"original": "string",
|
|
303
|
+
"resolved": "string",
|
|
304
|
+
"references": {}
|
|
305
|
+
},
|
|
306
|
+
"required": false,
|
|
307
|
+
"optional": false,
|
|
308
|
+
"docs": {
|
|
309
|
+
"tags": [],
|
|
310
|
+
"text": ""
|
|
311
|
+
},
|
|
312
|
+
"attribute": "ptc-data-eloqua-name",
|
|
313
|
+
"reflect": false
|
|
314
|
+
},
|
|
315
|
+
"inputValue": {
|
|
316
|
+
"type": "string",
|
|
317
|
+
"mutable": true,
|
|
318
|
+
"complexType": {
|
|
319
|
+
"original": "string",
|
|
320
|
+
"resolved": "string",
|
|
321
|
+
"references": {}
|
|
322
|
+
},
|
|
323
|
+
"required": false,
|
|
324
|
+
"optional": false,
|
|
325
|
+
"docs": {
|
|
326
|
+
"tags": [],
|
|
327
|
+
"text": ""
|
|
328
|
+
},
|
|
329
|
+
"attribute": "input-value",
|
|
330
|
+
"reflect": false,
|
|
331
|
+
"defaultValue": "''"
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
static get elementRef() { return "el"; }
|
|
336
|
+
static get listeners() {
|
|
337
|
+
return [{
|
|
338
|
+
"name": "input",
|
|
339
|
+
"method": "handleInput",
|
|
340
|
+
"target": undefined,
|
|
341
|
+
"capture": false,
|
|
342
|
+
"passive": false
|
|
343
|
+
}, {
|
|
344
|
+
"name": "blur",
|
|
345
|
+
"method": "inputBlurHandler",
|
|
346
|
+
"target": undefined,
|
|
347
|
+
"capture": true,
|
|
348
|
+
"passive": false
|
|
349
|
+
}];
|
|
350
|
+
}
|
|
351
|
+
}
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
display: inline-block;
|
|
32
32
|
border-bottom: 2px solid transparent;
|
|
33
33
|
margin-left: 34%;
|
|
34
|
-
padding:
|
|
34
|
+
padding: var(--ptc-element-spacing-04) var(--ptc-element-spacing-03);
|
|
35
35
|
font-size: var(--ptc-font-size-xx-small);
|
|
36
36
|
line-height: var(--ptc-line-height-denser);
|
|
37
37
|
font-weight: var(--ptc-font-weight-bold);
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
}
|
|
49
49
|
@media only screen and (min-width: 1200px) {
|
|
50
50
|
:host a {
|
|
51
|
+
padding: 22px var(--ptc-element-spacing-03);
|
|
51
52
|
margin-left: 0;
|
|
52
53
|
display: flex;
|
|
53
54
|
align-items: center;
|
|
@@ -5,14 +5,17 @@ export class PtcNavLink {
|
|
|
5
5
|
this.isOutsideLink = false;
|
|
6
6
|
this.titleText = "";
|
|
7
7
|
}
|
|
8
|
-
handleClick() {
|
|
9
|
-
//
|
|
8
|
+
handleClick(event) {
|
|
9
|
+
// Prevent the event from propagating to the underlying <a> element
|
|
10
|
+
event.stopPropagation();
|
|
11
|
+
// Check if the href starts with #
|
|
10
12
|
if (this.href && this.href.startsWith('#')) {
|
|
11
13
|
// Find the corresponding section
|
|
12
14
|
const section = document.querySelector(this.href);
|
|
13
15
|
section.scrollIntoView({
|
|
14
16
|
behavior: 'smooth'
|
|
15
17
|
});
|
|
18
|
+
this.navLinkClicked.emit();
|
|
16
19
|
}
|
|
17
20
|
}
|
|
18
21
|
componentWillLoad() {
|
|
@@ -29,7 +32,7 @@ export class PtcNavLink {
|
|
|
29
32
|
}
|
|
30
33
|
}
|
|
31
34
|
render() {
|
|
32
|
-
return (h(Host, null, h("a", { href: this.href, target: this.isOutsideLink ? '_blank' : '_self', title: this.titleText, onClick: () => { this.handleClick(); } }, h("slot", null), !(this.href.startsWith('#')) &&
|
|
35
|
+
return (h(Host, null, h("a", { href: this.href, target: this.isOutsideLink ? '_blank' : '_self', title: this.titleText, onClick: (event) => { this.handleClick(event); } }, h("slot", null), !(this.href.startsWith('#')) &&
|
|
33
36
|
h("svg", { class: "icon-arrow-right", xmlns: "http://www.w3.org/2000/svg", width: "14", height: "10", viewBox: "0 0 14 10", fill: "none" }, h("path", { d: "M8.84921 0.77792L8.81313 3.41153L0.51545 3.55584L0.515449 6.5863L8.81313 6.44199L8.81313 9.40029L13.1424 5.07107L8.84921 0.77792Z", fill: "#AEB8BD" })))));
|
|
34
37
|
}
|
|
35
38
|
static get is() { return "ptc-nav-link"; }
|
|
@@ -101,6 +104,24 @@ export class PtcNavLink {
|
|
|
101
104
|
}
|
|
102
105
|
};
|
|
103
106
|
}
|
|
107
|
+
static get events() {
|
|
108
|
+
return [{
|
|
109
|
+
"method": "navLinkClicked",
|
|
110
|
+
"name": "navLinkClicked",
|
|
111
|
+
"bubbles": true,
|
|
112
|
+
"cancelable": true,
|
|
113
|
+
"composed": true,
|
|
114
|
+
"docs": {
|
|
115
|
+
"tags": [],
|
|
116
|
+
"text": "Creating navLinkClicked to check if the link is clicked and toggle the subnav on mobile"
|
|
117
|
+
},
|
|
118
|
+
"complexType": {
|
|
119
|
+
"original": "any",
|
|
120
|
+
"resolved": "any",
|
|
121
|
+
"references": {}
|
|
122
|
+
}
|
|
123
|
+
}];
|
|
124
|
+
}
|
|
104
125
|
static get elementRef() { return "el"; }
|
|
105
126
|
static get listeners() {
|
|
106
127
|
return [{
|
|
@@ -4,7 +4,7 @@ export class PtcNavSlider {
|
|
|
4
4
|
this.sliderId = `ptc-nav-slider-${Math.floor(Math.random() * 1000000)}`;
|
|
5
5
|
}
|
|
6
6
|
componentDidLoad() {
|
|
7
|
-
// use the ID to select elements within the component's shadow root
|
|
7
|
+
// use the ID to select elements within the component's shadow root
|
|
8
8
|
this.updateSlider(undefined);
|
|
9
9
|
const { shadowRoot } = document.querySelector(`#${this.sliderId}`);
|
|
10
10
|
const boxWrap = shadowRoot.querySelector('.box-wrap');
|
|
@@ -84,7 +84,7 @@ export class PtcNavSlider {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
render() {
|
|
87
|
-
return (h(Host, { class: `nav-slider`, id: this.sliderId }, h("div", { class: "btn-wrap-left" }, h("button", { id: "prevBtn", class: "navArrows", onClick: () => this.leftScroll(this) }, h("svg", { width: "
|
|
87
|
+
return (h(Host, { class: `nav-slider`, id: this.sliderId }, h("div", { class: "btn-wrap-left" }, h("button", { id: "prevBtn", class: "navArrows", onClick: () => this.leftScroll(this) }, h("svg", { width: "12", height: "12", viewBox: "0 0 12 15", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M10.166 13.2375L4.39723 7.5L10.166 1.7625L8.39004 0L0.832683 7.5L8.39004 15L10.166 13.2375Z", fill: "white" })))), h("div", { class: "box-wrap" }, h("slot", null)), h("div", { class: "btn-wrap-right" }, h("button", { id: "nextBtn", class: "navArrows ", onClick: () => this.rightScroll(this) }, h("svg", { width: "12", height: "12", viewBox: "0 0 12 15", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M0.833984 1.7625L6.60277 7.5L0.833984 13.2375L2.60996 15L10.1673 7.5L2.60996 0L0.833984 1.7625Z", fill: "white" }))))));
|
|
88
88
|
}
|
|
89
89
|
static get is() { return "ptc-nav-slider"; }
|
|
90
90
|
static get encapsulation() { return "shadow"; }
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
line-height: var(--ptc-line-height-denser);
|
|
51
51
|
font-weight: var(--ptc-font-weight-bold);
|
|
52
52
|
white-space: nowrap;
|
|
53
|
-
padding:
|
|
53
|
+
padding: var(--ptc-element-spacing-04) var(--ptc-element-spacing-03);
|
|
54
54
|
margin-left: 34%;
|
|
55
55
|
position: relative;
|
|
56
56
|
}
|
|
@@ -63,7 +63,12 @@
|
|
|
63
63
|
width: calc(100% - 20px);
|
|
64
64
|
left: 0;
|
|
65
65
|
right: 0;
|
|
66
|
-
bottom:
|
|
66
|
+
bottom: 14px;
|
|
67
|
+
}
|
|
68
|
+
@media only screen and (min-width: 1200px) {
|
|
69
|
+
:host .submenu-toggle::after {
|
|
70
|
+
bottom: 20px;
|
|
71
|
+
}
|
|
67
72
|
}
|
|
68
73
|
@media only screen and (min-width: 480px) {
|
|
69
74
|
:host .submenu-toggle {
|
|
@@ -77,6 +82,7 @@
|
|
|
77
82
|
}
|
|
78
83
|
@media only screen and (min-width: 1200px) {
|
|
79
84
|
:host .submenu-toggle {
|
|
85
|
+
padding: 22px var(--ptc-element-spacing-03);
|
|
80
86
|
margin-left: 0;
|
|
81
87
|
display: flex;
|
|
82
88
|
align-items: center;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
:host {
|
|
2
2
|
display: block;
|
|
3
3
|
width: 100%;
|
|
4
|
-
background-color: var(--color-gray-
|
|
4
|
+
background-color: var(--color-gray-12);
|
|
5
5
|
position: relative;
|
|
6
6
|
}
|
|
7
|
+
@media only screen and (min-width: 1200px) {
|
|
8
|
+
:host {
|
|
9
|
+
background-color: var(--color-gray-10);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
7
12
|
:host .stickyEl.sticky {
|
|
8
13
|
top: 0;
|
|
9
14
|
position: fixed;
|
|
@@ -37,16 +42,17 @@
|
|
|
37
42
|
width: auto;
|
|
38
43
|
margin: auto 0;
|
|
39
44
|
min-width: 163px;
|
|
45
|
+
max-height: calc(100vh - 53px);
|
|
40
46
|
}
|
|
41
47
|
@media only screen and (min-width: 1200px) {
|
|
42
48
|
:host .navbar .navbar-inner .nav-wrapper {
|
|
43
49
|
width: auto;
|
|
44
50
|
display: flex;
|
|
45
51
|
justify-content: space-between;
|
|
52
|
+
max-height: auto;
|
|
46
53
|
}
|
|
47
54
|
}
|
|
48
55
|
:host .navbar.navOpen .navbar-inner {
|
|
49
|
-
background-color: var(--color-gray-12);
|
|
50
56
|
display: block;
|
|
51
57
|
}
|
|
52
58
|
:host .navbar .navbar-toggle {
|
|
@@ -9,9 +9,13 @@ export class PtcSubnav {
|
|
|
9
9
|
this.navOpen = !this.navOpen;
|
|
10
10
|
}
|
|
11
11
|
handleScroll() {
|
|
12
|
-
this.el.shadowRoot.querySelector('nav.navbar').classList.remove('navOpen');
|
|
12
|
+
//this.el.shadowRoot.querySelector('nav.navbar').classList.remove('navOpen');
|
|
13
13
|
this.el.shadowRoot.querySelector('div.sticky-subnav').classList.remove('sticky');
|
|
14
14
|
}
|
|
15
|
+
handleNavLinkClickedEvent() {
|
|
16
|
+
console.log('link clicked');
|
|
17
|
+
this.toggleNav();
|
|
18
|
+
}
|
|
15
19
|
firstChildfuncID() {
|
|
16
20
|
const firstChildLi = document.querySelector('ptc-nav-link:first-child');
|
|
17
21
|
if (firstChildLi) {
|
|
@@ -40,7 +44,7 @@ export class PtcSubnav {
|
|
|
40
44
|
}
|
|
41
45
|
render() {
|
|
42
46
|
return (h(Host, null, h("div", { class: "sticky-subnav" }, h("nav", { class: `navbar ${this.navOpen ? 'navOpen' : ''}` }, h("button", { class: "navbar-toggle", onClick: () => {
|
|
43
|
-
this.scrollToSection(this.firstChildfuncID());
|
|
47
|
+
//this.scrollToSection(this.firstChildfuncID());
|
|
44
48
|
this.toggleNav();
|
|
45
49
|
} }, this.mobileTitle, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "15", height: "15", viewBox: "0 0 15 15", fill: "white", class: "" }, h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M13.2375 2.83325L7.5 8.60203L1.7625 2.83325L-7.76305e-08 4.60923L7.5 12.1666L15 4.60923L13.2375 2.83325Z", fill: "white" }))), h("div", { class: "navbar-inner" }, h("div", { class: "nav-wrapper" }, h("slot", { name: "subnav-menu-left" }), h("slot", { name: "subnav-menu-right" })))))));
|
|
46
50
|
}
|
|
@@ -91,6 +95,12 @@ export class PtcSubnav {
|
|
|
91
95
|
"target": "window",
|
|
92
96
|
"capture": false,
|
|
93
97
|
"passive": true
|
|
98
|
+
}, {
|
|
99
|
+
"name": "navLinkClicked",
|
|
100
|
+
"method": "handleNavLinkClickedEvent",
|
|
101
|
+
"target": undefined,
|
|
102
|
+
"capture": false,
|
|
103
|
+
"passive": false
|
|
94
104
|
}];
|
|
95
105
|
}
|
|
96
106
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Atoms/ptc-form-checkbox',
|
|
5
|
+
tags: [ 'autodocs' ],
|
|
6
|
+
argTypes: {
|
|
7
|
+
checkboxId: {
|
|
8
|
+
control: 'text',
|
|
9
|
+
description: '',
|
|
10
|
+
defaultValue: { summary: 'undefined' }
|
|
11
|
+
},
|
|
12
|
+
helpertext: {
|
|
13
|
+
control: 'text',
|
|
14
|
+
description: '',
|
|
15
|
+
defaultValue: { summary: 'This field is required' }
|
|
16
|
+
},
|
|
17
|
+
isChecked: {
|
|
18
|
+
control: 'boolean',
|
|
19
|
+
description: '',
|
|
20
|
+
defaultValue: { summary: 'false' }
|
|
21
|
+
},
|
|
22
|
+
label: {
|
|
23
|
+
control: 'text',
|
|
24
|
+
description: '',
|
|
25
|
+
defaultValue: { summary: 'undefined' }
|
|
26
|
+
},
|
|
27
|
+
name: {
|
|
28
|
+
control: 'text',
|
|
29
|
+
description: '',
|
|
30
|
+
defaultValue: { summary: 'undefined' }
|
|
31
|
+
},
|
|
32
|
+
required: {
|
|
33
|
+
control: 'boolean',
|
|
34
|
+
description: '',
|
|
35
|
+
defaultValue: { summary: 'true' }
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const Template = args => { return html `<ptc-form-checkbox
|
|
41
|
+
checkbox-id=${args.checkboxId}
|
|
42
|
+
helpertext=${args.helpertext}
|
|
43
|
+
is-checked=${args.isChecked}
|
|
44
|
+
label=${args.label}
|
|
45
|
+
name=${args.name}
|
|
46
|
+
required=${args.required}
|
|
47
|
+
></ptc-form-checkbox>`;}
|
|
48
|
+
|
|
49
|
+
export const Example = Template.bind({});
|
|
50
|
+
|
|
51
|
+
Example.args = {
|
|
52
|
+
checkboxId: 'undefined',
|
|
53
|
+
helpertext: 'This field is required',
|
|
54
|
+
isChecked: 'false',
|
|
55
|
+
label: 'undefined',
|
|
56
|
+
name: 'undefined',
|
|
57
|
+
required: 'true'
|
|
58
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Atoms/ptc-select',
|
|
5
|
+
tags: [ 'autodocs' ],
|
|
6
|
+
argTypes: {
|
|
7
|
+
disabled: {
|
|
8
|
+
control: 'boolean',
|
|
9
|
+
description: '',
|
|
10
|
+
defaultValue: { summary: 'false' }
|
|
11
|
+
},
|
|
12
|
+
helpertext: {
|
|
13
|
+
control: 'text',
|
|
14
|
+
description: '',
|
|
15
|
+
defaultValue: { summary: 'Please select a value!' }
|
|
16
|
+
},
|
|
17
|
+
isRequired: {
|
|
18
|
+
control: 'boolean',
|
|
19
|
+
description: '',
|
|
20
|
+
defaultValue: { summary: 'true' }
|
|
21
|
+
},
|
|
22
|
+
label: {
|
|
23
|
+
control: 'text',
|
|
24
|
+
description: '',
|
|
25
|
+
defaultValue: { summary: 'undefined' }
|
|
26
|
+
},
|
|
27
|
+
name: {
|
|
28
|
+
control: 'text',
|
|
29
|
+
description: '',
|
|
30
|
+
defaultValue: { summary: 'undefined' }
|
|
31
|
+
},
|
|
32
|
+
ptcDataEloquaName: {
|
|
33
|
+
control: 'text',
|
|
34
|
+
description: 'Eloqua Data',
|
|
35
|
+
defaultValue: { summary: 'undefined' }
|
|
36
|
+
},
|
|
37
|
+
selectedValue: { control: 'text', description: '', defaultValue: { summary: '' } }
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const Template = args => { return html `<ptc-select
|
|
42
|
+
disabled=${args.disabled}
|
|
43
|
+
helpertext=${args.helpertext}
|
|
44
|
+
is-required=${args.isRequired}
|
|
45
|
+
label=${args.label}
|
|
46
|
+
name=${args.name}
|
|
47
|
+
ptc-data-eloqua-name=${args.ptcDataEloquaName}
|
|
48
|
+
selected-value=${args.selectedValue}
|
|
49
|
+
></ptc-select>`;}
|
|
50
|
+
|
|
51
|
+
export const Example = Template.bind({});
|
|
52
|
+
|
|
53
|
+
Example.args = {
|
|
54
|
+
disabled: 'false',
|
|
55
|
+
helpertext: 'Please select a value!',
|
|
56
|
+
isRequired: 'true',
|
|
57
|
+
label: 'undefined',
|
|
58
|
+
name: 'undefined',
|
|
59
|
+
ptcDataEloquaName: 'undefined',
|
|
60
|
+
selectedValue: ''
|
|
61
|
+
}
|