@ptcwebops/ptcw-design 0.4.6 → 0.4.7
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/LICENSE +21 -21
- package/dist/cjs/{icon-asset_4.cjs.entry.js → icon-asset_8.cjs.entry.js} +298 -219
- package/dist/cjs/{interfaces-0ecd8027.js → interfaces-574e6df7.js} +9 -9
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/lottie-player.cjs.entry.js +354 -354
- package/dist/cjs/my-component.cjs.entry.js +13 -13
- package/dist/cjs/ptc-breadcrumb.cjs.entry.js +12 -12
- package/dist/cjs/ptc-button.cjs.entry.js +65 -65
- package/dist/cjs/ptc-card-bottom.cjs.entry.js +31 -31
- package/dist/cjs/ptc-card-content.cjs.entry.js +31 -31
- package/dist/cjs/ptc-card-plm.cjs.entry.js +16 -16
- package/dist/cjs/ptc-card.cjs.entry.js +68 -68
- package/dist/cjs/ptc-countdown.cjs.entry.js +8 -8
- package/dist/cjs/ptc-date.cjs.entry.js +48 -48
- package/dist/cjs/ptc-footer.cjs.entry.js +8 -8
- package/dist/cjs/ptc-form.cjs.entry.js +104 -104
- package/dist/cjs/ptc-hero.cjs.entry.js +18 -18
- package/dist/cjs/ptc-img_2.cjs.entry.js +169 -169
- package/dist/cjs/ptc-input.cjs.entry.js +20 -20
- package/dist/cjs/ptc-link.cjs.entry.js +42 -42
- package/dist/cjs/ptc-list.cjs.entry.js +20 -20
- package/dist/cjs/ptc-lottie.cjs.entry.js +12 -12
- package/dist/cjs/ptc-modal.cjs.entry.js +103 -103
- package/dist/cjs/ptc-nav-item.cjs.entry.js +83 -83
- package/dist/cjs/ptc-nav.cjs.entry.js +8 -8
- package/dist/cjs/ptc-para.cjs.entry.js +39 -39
- package/dist/cjs/ptc-picture.cjs.entry.js +158 -158
- package/dist/cjs/ptc-responsive-wrapper.cjs.entry.js +54 -54
- package/dist/cjs/ptc-select.cjs.entry.js +24 -24
- package/dist/cjs/ptc-social-share.cjs.entry.js +64 -64
- package/dist/cjs/ptc-spacer.cjs.entry.js +35 -35
- package/dist/cjs/ptc-span.cjs.entry.js +23 -23
- package/dist/cjs/ptc-title.cjs.entry.js +44 -44
- package/dist/cjs/ptcw-design.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +3 -0
- package/dist/collection/components/icon-asset/icon-asset.css +4 -4
- package/dist/collection/components/icon-asset/icon-asset.js +178 -178
- package/dist/collection/components/icon-asset/media/brands.svg +1381 -1381
- package/dist/collection/components/icon-asset/media/designer.svg +316 -316
- package/dist/collection/components/icon-asset/media/regular.svg +463 -463
- package/dist/collection/components/icon-asset/media/solid.svg +3013 -3013
- package/dist/collection/components/icon-asset/media/svg-with-js.min.css +4 -4
- package/dist/collection/components/list-item/list-item.css +31 -0
- package/dist/collection/components/list-item/list-item.js +103 -84
- package/dist/collection/components/my-component/my-component.css +3 -3
- package/dist/collection/components/my-component/my-component.js +73 -73
- package/dist/collection/components/ptc-announcement/ptc-announcement.js +170 -170
- package/dist/collection/components/ptc-breadcrumb/ptc-breadcrumb.js +21 -21
- package/dist/collection/components/ptc-button/ptc-button.js +293 -293
- package/dist/collection/components/ptc-card/ptc-card.js +282 -282
- package/dist/collection/components/ptc-card-bottom/ptc-card-bottom.js +105 -105
- package/dist/collection/components/ptc-card-content/ptc-card-content.js +105 -105
- package/dist/collection/components/ptc-card-plm/ptc-card-plm.js +97 -97
- package/dist/collection/components/ptc-countdown/ptc-countdown.js +15 -15
- package/dist/collection/components/ptc-date/ptc-date.js +201 -201
- package/dist/collection/components/ptc-footer/ptc-footer.js +25 -25
- package/dist/collection/components/ptc-form/ptc-form.js +118 -118
- package/dist/collection/components/ptc-form/validation/FormValidation.js +4234 -4234
- package/dist/collection/components/ptc-hero/ptc-hero.js +67 -67
- package/dist/collection/components/ptc-img/ptc-img.js +314 -314
- package/dist/collection/components/ptc-input/ptc-input.js +133 -133
- package/dist/collection/components/ptc-link/ptc-link.js +198 -198
- package/dist/collection/components/ptc-list/ptc-list.js +63 -63
- package/dist/collection/components/ptc-lottie/ptc-lottie.css +5 -5
- package/dist/collection/components/ptc-lottie/ptc-lottie.js +58 -58
- package/dist/collection/components/ptc-minimized-footer/ptc-minimized-footer.css +44 -0
- package/dist/collection/components/ptc-minimized-footer/ptc-minimized-footer.js +17 -0
- package/dist/collection/components/ptc-minimized-header/ptc-minimized-header.css +77 -0
- package/dist/collection/components/ptc-minimized-header/ptc-minimized-header.js +80 -0
- package/dist/collection/components/ptc-mobile-select/ptc-mobile-select.js +220 -220
- package/dist/collection/components/ptc-modal/ptc-modal.js +252 -252
- package/dist/collection/components/ptc-nav/ptc-nav.js +21 -21
- package/dist/collection/components/ptc-nav-item/ptc-nav-item.js +252 -252
- package/dist/collection/components/ptc-overlay/ptc-overlay.js +99 -99
- package/dist/collection/components/ptc-para/ptc-para.js +157 -157
- package/dist/collection/components/ptc-picture/ptc-picture.js +428 -428
- package/dist/collection/components/ptc-previous-url/ptc-previous-url.css +24 -0
- package/dist/collection/components/ptc-previous-url/ptc-previous-url.js +54 -0
- package/dist/collection/components/ptc-responsive-wrapper/ptc-responsive-wrapper.css +3 -3
- package/dist/collection/components/ptc-responsive-wrapper/ptc-responsive-wrapper.js +62 -62
- package/dist/collection/components/ptc-select/ptc-select.js +105 -105
- package/dist/collection/components/ptc-social-share/ptc-social-share.js +206 -206
- package/dist/collection/components/ptc-spacer/ptc-spacer.css +322 -322
- package/dist/collection/components/ptc-spacer/ptc-spacer.js +99 -99
- package/dist/collection/components/ptc-span/ptc-span.js +89 -89
- package/dist/collection/components/ptc-svg-btn/ptc-svg-btn.css +16 -0
- package/dist/collection/components/ptc-svg-btn/ptc-svg-btn.js +71 -69
- package/dist/collection/components/ptc-title/ptc-title.js +231 -231
- package/dist/collection/index.js +1 -1
- package/dist/collection/media/svg-imgs/Back-arrow.svg +11 -0
- package/dist/collection/media/svg-imgs/close.svg +10 -10
- package/dist/collection/media/svg-imgs/slider-arrow-left.svg +18 -18
- package/dist/collection/media/svg-imgs/slider-arrow-right.svg +18 -18
- package/dist/collection/utils/interfaces.js +11 -11
- package/dist/collection/utils/utils.js +3 -3
- package/dist/custom-elements/index.d.ts +18 -0
- package/dist/custom-elements/index.js +2056 -1991
- package/dist/esm/{icon-asset_4.entry.js → icon-asset_8.entry.js} +295 -220
- package/dist/esm/{interfaces-c1c73092.js → interfaces-7c0243be.js} +9 -9
- package/dist/esm/loader.js +1 -1
- package/dist/esm/lottie-player.entry.js +354 -354
- package/dist/esm/my-component.entry.js +13 -13
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/esm/ptc-breadcrumb.entry.js +12 -12
- package/dist/esm/ptc-button.entry.js +65 -65
- package/dist/esm/ptc-card-bottom.entry.js +31 -31
- package/dist/esm/ptc-card-content.entry.js +31 -31
- package/dist/esm/ptc-card-plm.entry.js +16 -16
- package/dist/esm/ptc-card.entry.js +68 -68
- package/dist/esm/ptc-countdown.entry.js +8 -8
- package/dist/esm/ptc-date.entry.js +48 -48
- package/dist/esm/ptc-footer.entry.js +8 -8
- package/dist/esm/ptc-form.entry.js +104 -104
- package/dist/esm/ptc-hero.entry.js +18 -18
- package/dist/esm/ptc-img_2.entry.js +169 -169
- package/dist/esm/ptc-input.entry.js +20 -20
- package/dist/esm/ptc-link.entry.js +42 -42
- package/dist/esm/ptc-list.entry.js +20 -20
- package/dist/esm/ptc-lottie.entry.js +12 -12
- package/dist/esm/ptc-modal.entry.js +103 -103
- package/dist/esm/ptc-nav-item.entry.js +83 -83
- package/dist/esm/ptc-nav.entry.js +8 -8
- package/dist/esm/ptc-para.entry.js +39 -39
- package/dist/esm/ptc-picture.entry.js +158 -158
- package/dist/esm/ptc-responsive-wrapper.entry.js +54 -54
- package/dist/esm/ptc-select.entry.js +24 -24
- package/dist/esm/ptc-social-share.entry.js +64 -64
- package/dist/esm/ptc-spacer.entry.js +35 -35
- package/dist/esm/ptc-span.entry.js +23 -23
- package/dist/esm/ptc-title.entry.js +44 -44
- package/dist/esm/ptcw-design.js +1 -1
- package/dist/ptcw-design/media/brands.svg +1381 -1381
- package/dist/ptcw-design/media/designer.svg +316 -316
- package/dist/ptcw-design/media/regular.svg +463 -463
- package/dist/ptcw-design/media/solid.svg +3013 -3013
- package/dist/ptcw-design/media/svg-with-js.min.css +4 -4
- package/dist/ptcw-design/{p-1e39bc14.entry.js → p-894e8c85.entry.js} +1 -1
- package/dist/ptcw-design/{p-439c9e49.entry.js → p-e87c04ae.entry.js} +2 -2
- package/dist/ptcw-design/{p-27538cac.entry.js → p-f2f1c015.entry.js} +1 -1
- package/dist/ptcw-design/ptcw-design.css +1 -1
- package/dist/ptcw-design/ptcw-design.esm.js +1 -1
- package/dist/ptcw-design/validation/FormValidation.js +4234 -4234
- package/dist/types/components/icon-asset/icon-asset.d.ts +32 -32
- package/dist/types/components/list-item/list-item.d.ts +8 -7
- package/dist/types/components/my-component/my-component.d.ts +16 -16
- package/dist/types/components/ptc-announcement/ptc-announcement.d.ts +35 -35
- package/dist/types/components/ptc-breadcrumb/ptc-breadcrumb.d.ts +4 -4
- package/dist/types/components/ptc-button/ptc-button.d.ts +56 -56
- package/dist/types/components/ptc-card/ptc-card.d.ts +50 -50
- package/dist/types/components/ptc-card-bottom/ptc-card-bottom.d.ts +15 -15
- package/dist/types/components/ptc-card-content/ptc-card-content.d.ts +15 -15
- package/dist/types/components/ptc-card-plm/ptc-card-plm.d.ts +8 -8
- package/dist/types/components/ptc-countdown/ptc-countdown.d.ts +3 -3
- package/dist/types/components/ptc-date/ptc-date.d.ts +41 -41
- package/dist/types/components/ptc-footer/ptc-footer.d.ts +3 -3
- package/dist/types/components/ptc-form/ptc-form.d.ts +11 -11
- package/dist/types/components/ptc-hero/ptc-hero.d.ts +12 -12
- package/dist/types/components/ptc-img/ptc-img.d.ts +51 -51
- package/dist/types/components/ptc-input/ptc-input.d.ts +19 -19
- package/dist/types/components/ptc-link/ptc-link.d.ts +36 -36
- package/dist/types/components/ptc-list/ptc-list.d.ts +6 -6
- package/dist/types/components/ptc-lottie/ptc-lottie.d.ts +12 -12
- package/dist/types/components/ptc-minimized-footer/ptc-minimized-footer.d.ts +3 -0
- package/dist/types/components/ptc-minimized-header/ptc-minimized-header.d.ts +6 -0
- package/dist/types/components/ptc-mobile-select/ptc-mobile-select.d.ts +40 -40
- package/dist/types/components/ptc-modal/ptc-modal.d.ts +46 -46
- package/dist/types/components/ptc-nav/ptc-nav.d.ts +3 -3
- package/dist/types/components/ptc-nav-item/ptc-nav-item.d.ts +53 -53
- package/dist/types/components/ptc-overlay/ptc-overlay.d.ts +20 -20
- package/dist/types/components/ptc-para/ptc-para.d.ts +28 -28
- package/dist/types/components/ptc-picture/ptc-picture.d.ts +82 -82
- package/dist/types/components/ptc-previous-url/ptc-previous-url.d.ts +5 -0
- package/dist/types/components/ptc-responsive-wrapper/ptc-responsive-wrapper.d.ts +8 -8
- package/dist/types/components/ptc-select/ptc-select.d.ts +9 -9
- package/dist/types/components/ptc-social-share/ptc-social-share.d.ts +25 -25
- package/dist/types/components/ptc-spacer/ptc-spacer.d.ts +16 -16
- package/dist/types/components/ptc-span/ptc-span.d.ts +16 -16
- package/dist/types/components/ptc-svg-btn/ptc-svg-btn.d.ts +12 -12
- package/dist/types/components/ptc-title/ptc-title.d.ts +41 -41
- package/dist/types/components.d.ts +77 -26
- package/dist/types/global.d.ts +1072 -1072
- package/dist/types/index.d.ts +1 -1
- package/dist/types/utils/interfaces.d.ts +14 -14
- package/dist/types/utils/utils.d.ts +1 -1
- package/package.json +58 -58
- package/readme.md +11 -11
- package/dist/cjs/list-item.cjs.entry.js +0 -29
- package/dist/esm/list-item.entry.js +0 -25
- package/dist/ptcw-design/p-80c03571.entry.js +0 -1
- /package/dist/ptcw-design/{p-50e52c88.js → p-ee1183b2.js} +0 -0
|
@@ -1,165 +1,165 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host, a as getElement } from './index-357497dc.js';
|
|
2
|
-
import { R as ResponsivePictureVariables } from './interfaces-
|
|
2
|
+
import { R as ResponsivePictureVariables } from './interfaces-7c0243be.js';
|
|
3
3
|
|
|
4
4
|
const ptcPictureCss = ":host{display:block;overflow:hidden}:host(.relative){position:relative}:host(.static){position:static}:host(.absoltue){position:absolute}img{max-width:100%}.cover{object-fit:cover}.fill{object-fit:fill}.contain{object-fit:contain}.scale-down{object-fit:scale-down}.none{object-fit:none}.initial{object-fit:initial}.inherit{object-fit:inherit}.radius-sm{border-radius:var(--ptc-border-radius-small)}.radius-md{border-radius:var(--ptc-border-radius-medium)}.radius-lg{border-radius:var(--ptc-border-radius-large)}.radius-x-lg{border-radius:var(--ptc-border-radius-x-large)}.is-full-height{height:100%}.is-full-width{width:100%}";
|
|
5
5
|
|
|
6
|
-
let PtcPicture = class {
|
|
7
|
-
constructor(hostRef) {
|
|
8
|
-
registerInstance(this, hostRef);
|
|
9
|
-
/**
|
|
10
|
-
* Image alt
|
|
11
|
-
*/
|
|
12
|
-
this.alt = "image";
|
|
13
|
-
/**
|
|
14
|
-
* Image size for smallest screen
|
|
15
|
-
* <=767px
|
|
16
|
-
*/
|
|
17
|
-
this.sizeXs = '510x340';
|
|
18
|
-
/**
|
|
19
|
-
* Image size for small screen
|
|
20
|
-
* >=768px and <=991px
|
|
21
|
-
*/
|
|
22
|
-
this.sizeSm = '1240x496';
|
|
23
|
-
/**
|
|
24
|
-
* Image size for medium screen
|
|
25
|
-
* >=992px and <=1199px
|
|
26
|
-
*/
|
|
27
|
-
this.sizeMd = '1366x500';
|
|
28
|
-
/**
|
|
29
|
-
* Image solution for large screen
|
|
30
|
-
* >=1200px
|
|
31
|
-
*/
|
|
32
|
-
this.sizeLg = '1920x1080';
|
|
33
|
-
/**
|
|
34
|
-
* Image Position
|
|
35
|
-
*/
|
|
36
|
-
this.imagePosition = 'static';
|
|
37
|
-
/**
|
|
38
|
-
* Object Fit
|
|
39
|
-
* Default: cover
|
|
40
|
-
*/
|
|
41
|
-
this.objectFit = 'cover';
|
|
42
|
-
/**
|
|
43
|
-
* Stretch height to 100%?
|
|
44
|
-
*/
|
|
45
|
-
this.isFullHeight = false;
|
|
46
|
-
/**
|
|
47
|
-
* Stretch width to 100%?
|
|
48
|
-
*/
|
|
49
|
-
this.isFullWidth = false;
|
|
50
|
-
}
|
|
51
|
-
WindowResize() {
|
|
52
|
-
this.addIntersectionObserver();
|
|
53
|
-
}
|
|
54
|
-
componentDidLoad() {
|
|
55
|
-
this.addIntersectionObserver();
|
|
56
|
-
}
|
|
57
|
-
componentWillUpdate() {
|
|
58
|
-
if (this.src !== this.oldSrc) {
|
|
59
|
-
this.addIntersectionObserver();
|
|
60
|
-
}
|
|
61
|
-
this.oldSrc = this.src;
|
|
62
|
-
}
|
|
63
|
-
//lazy-loading
|
|
64
|
-
addIntersectionObserver() {
|
|
65
|
-
if (!this.src) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
if ('IntersectionObserver' in window) {
|
|
69
|
-
let lazyLoadImages = new IntersectionObserver(entries => {
|
|
70
|
-
entries.forEach(entry => {
|
|
71
|
-
if (entry.isIntersecting) {
|
|
72
|
-
const image = this.el.shadowRoot.querySelector('img');
|
|
73
|
-
image.src = this.setResponsiveBg();
|
|
74
|
-
console.log('loaded');
|
|
75
|
-
lazyLoadImages.unobserve(image);
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
lazyLoadImages.observe(this.el.shadowRoot.querySelector('img'));
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
// fall back to setTimeout for Safari and IE
|
|
83
|
-
setTimeout(() => {
|
|
84
|
-
const image = this.el.shadowRoot.querySelector('img');
|
|
85
|
-
image.src = this.setResponsiveBg();
|
|
86
|
-
image.onload = () => {
|
|
87
|
-
image.removeAttribute('data-src');
|
|
88
|
-
console.log('loaded fallback');
|
|
89
|
-
};
|
|
90
|
-
}, 5000);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
//responsive image
|
|
94
|
-
setResponsiveBg() {
|
|
95
|
-
// Define local variables
|
|
96
|
-
let backgrounds = (this.el.shadowRoot || document).querySelectorAll('img'), el, elData, currentBreakpoint = this.getCurrentBreakPoints();
|
|
97
|
-
for (var i = 0, len = backgrounds.length; i < len; i++) {
|
|
98
|
-
// Set current variables
|
|
99
|
-
el = backgrounds[i];
|
|
100
|
-
elData = el.getAttribute('data-' + currentBreakpoint);
|
|
101
|
-
if (elData !== null) {
|
|
102
|
-
// console.log('img src= ' + elData);
|
|
103
|
-
return elData;
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
if (typeof console == 'object') {
|
|
107
|
-
console.warn('Data attribute: data-' + currentBreakpoint + ' not found on element:\n\n' + el.outerHTML + '\n\n\n');
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
render() {
|
|
113
|
-
const classMap = this.getCssClassMap();
|
|
114
|
-
return (h(Host, { class: this.imagePosition }, this.styles && h("style", null, this.styles), h("img", Object.assign({ class: classMap, "data-xs": !!this.sizeXs ? `${this.src}:${this.sizeXs}` : `${this.src}`, "data-sm": !!this.sizeSm ? `${this.src}:${this.sizeSm}` : `${this.src}`, "data-md": !!this.sizeMd ? `${this.src}:${this.sizeMd}` : `${this.src}`, "data-lg": !!this.sizeLg ? `${this.src}:${this.sizeLg}` : `${this.src}` }, (!!this.width ? { width: this.width } : {}), (!!this.height ? { height: this.height } : {}), { alt: this.alt })), h("slot", null)));
|
|
115
|
-
}
|
|
116
|
-
getCurrentBreakPoints() {
|
|
117
|
-
// Define local variables
|
|
118
|
-
let doc = window.document, temp = doc.createElement('div'), env;
|
|
119
|
-
// Append test node
|
|
120
|
-
doc.body.appendChild(temp);
|
|
121
|
-
// Loop through breakpoints
|
|
122
|
-
for (let i = ResponsivePictureVariables.envs.length - 1; i >= 0; i--) {
|
|
123
|
-
env = ResponsivePictureVariables.envs[i];
|
|
124
|
-
// Add classes
|
|
125
|
-
temp.className = 'hidden-' + env;
|
|
126
|
-
// Found breakpoint
|
|
127
|
-
if (temp.offsetParent === null) {
|
|
128
|
-
// Remove our test node
|
|
129
|
-
doc.body.removeChild(temp);
|
|
130
|
-
console.log('remove test node');
|
|
131
|
-
// Return current breakpoint
|
|
132
|
-
return env;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
// Breakpoint not found, try fallback
|
|
136
|
-
doc.body.removeChild(temp);
|
|
137
|
-
return this.getFallbackBreakpoint();
|
|
138
|
-
}
|
|
139
|
-
getFallbackBreakpoint() {
|
|
140
|
-
if (window.matchMedia('(min-width: 992px)').matches) {
|
|
141
|
-
return 'lg';
|
|
142
|
-
}
|
|
143
|
-
else if (window.matchMedia('(min-width: 768px)').matches) {
|
|
144
|
-
return 'md';
|
|
145
|
-
}
|
|
146
|
-
else if (window.matchMedia('(min-width: 576px)').matches) {
|
|
147
|
-
return 'sm';
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
return 'xs';
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
getCssClassMap() {
|
|
154
|
-
return {
|
|
155
|
-
[this.borderRadius]: this.borderRadius ? true : false,
|
|
156
|
-
[this.objectFit]: true,
|
|
157
|
-
[this.isFullHeight ? 'is-full-height' : 'is-normal-height']: true,
|
|
158
|
-
[this.isFullWidth ? 'is-full-width' : 'is-normal-width']: true
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
get el() { return getElement(this); }
|
|
162
|
-
};
|
|
6
|
+
let PtcPicture = class {
|
|
7
|
+
constructor(hostRef) {
|
|
8
|
+
registerInstance(this, hostRef);
|
|
9
|
+
/**
|
|
10
|
+
* Image alt
|
|
11
|
+
*/
|
|
12
|
+
this.alt = "image";
|
|
13
|
+
/**
|
|
14
|
+
* Image size for smallest screen
|
|
15
|
+
* <=767px
|
|
16
|
+
*/
|
|
17
|
+
this.sizeXs = '510x340';
|
|
18
|
+
/**
|
|
19
|
+
* Image size for small screen
|
|
20
|
+
* >=768px and <=991px
|
|
21
|
+
*/
|
|
22
|
+
this.sizeSm = '1240x496';
|
|
23
|
+
/**
|
|
24
|
+
* Image size for medium screen
|
|
25
|
+
* >=992px and <=1199px
|
|
26
|
+
*/
|
|
27
|
+
this.sizeMd = '1366x500';
|
|
28
|
+
/**
|
|
29
|
+
* Image solution for large screen
|
|
30
|
+
* >=1200px
|
|
31
|
+
*/
|
|
32
|
+
this.sizeLg = '1920x1080';
|
|
33
|
+
/**
|
|
34
|
+
* Image Position
|
|
35
|
+
*/
|
|
36
|
+
this.imagePosition = 'static';
|
|
37
|
+
/**
|
|
38
|
+
* Object Fit
|
|
39
|
+
* Default: cover
|
|
40
|
+
*/
|
|
41
|
+
this.objectFit = 'cover';
|
|
42
|
+
/**
|
|
43
|
+
* Stretch height to 100%?
|
|
44
|
+
*/
|
|
45
|
+
this.isFullHeight = false;
|
|
46
|
+
/**
|
|
47
|
+
* Stretch width to 100%?
|
|
48
|
+
*/
|
|
49
|
+
this.isFullWidth = false;
|
|
50
|
+
}
|
|
51
|
+
WindowResize() {
|
|
52
|
+
this.addIntersectionObserver();
|
|
53
|
+
}
|
|
54
|
+
componentDidLoad() {
|
|
55
|
+
this.addIntersectionObserver();
|
|
56
|
+
}
|
|
57
|
+
componentWillUpdate() {
|
|
58
|
+
if (this.src !== this.oldSrc) {
|
|
59
|
+
this.addIntersectionObserver();
|
|
60
|
+
}
|
|
61
|
+
this.oldSrc = this.src;
|
|
62
|
+
}
|
|
63
|
+
//lazy-loading
|
|
64
|
+
addIntersectionObserver() {
|
|
65
|
+
if (!this.src) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if ('IntersectionObserver' in window) {
|
|
69
|
+
let lazyLoadImages = new IntersectionObserver(entries => {
|
|
70
|
+
entries.forEach(entry => {
|
|
71
|
+
if (entry.isIntersecting) {
|
|
72
|
+
const image = this.el.shadowRoot.querySelector('img');
|
|
73
|
+
image.src = this.setResponsiveBg();
|
|
74
|
+
console.log('loaded');
|
|
75
|
+
lazyLoadImages.unobserve(image);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
lazyLoadImages.observe(this.el.shadowRoot.querySelector('img'));
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
// fall back to setTimeout for Safari and IE
|
|
83
|
+
setTimeout(() => {
|
|
84
|
+
const image = this.el.shadowRoot.querySelector('img');
|
|
85
|
+
image.src = this.setResponsiveBg();
|
|
86
|
+
image.onload = () => {
|
|
87
|
+
image.removeAttribute('data-src');
|
|
88
|
+
console.log('loaded fallback');
|
|
89
|
+
};
|
|
90
|
+
}, 5000);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
//responsive image
|
|
94
|
+
setResponsiveBg() {
|
|
95
|
+
// Define local variables
|
|
96
|
+
let backgrounds = (this.el.shadowRoot || document).querySelectorAll('img'), el, elData, currentBreakpoint = this.getCurrentBreakPoints();
|
|
97
|
+
for (var i = 0, len = backgrounds.length; i < len; i++) {
|
|
98
|
+
// Set current variables
|
|
99
|
+
el = backgrounds[i];
|
|
100
|
+
elData = el.getAttribute('data-' + currentBreakpoint);
|
|
101
|
+
if (elData !== null) {
|
|
102
|
+
// console.log('img src= ' + elData);
|
|
103
|
+
return elData;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
if (typeof console == 'object') {
|
|
107
|
+
console.warn('Data attribute: data-' + currentBreakpoint + ' not found on element:\n\n' + el.outerHTML + '\n\n\n');
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
render() {
|
|
113
|
+
const classMap = this.getCssClassMap();
|
|
114
|
+
return (h(Host, { class: this.imagePosition }, this.styles && h("style", null, this.styles), h("img", Object.assign({ class: classMap, "data-xs": !!this.sizeXs ? `${this.src}:${this.sizeXs}` : `${this.src}`, "data-sm": !!this.sizeSm ? `${this.src}:${this.sizeSm}` : `${this.src}`, "data-md": !!this.sizeMd ? `${this.src}:${this.sizeMd}` : `${this.src}`, "data-lg": !!this.sizeLg ? `${this.src}:${this.sizeLg}` : `${this.src}` }, (!!this.width ? { width: this.width } : {}), (!!this.height ? { height: this.height } : {}), { alt: this.alt })), h("slot", null)));
|
|
115
|
+
}
|
|
116
|
+
getCurrentBreakPoints() {
|
|
117
|
+
// Define local variables
|
|
118
|
+
let doc = window.document, temp = doc.createElement('div'), env;
|
|
119
|
+
// Append test node
|
|
120
|
+
doc.body.appendChild(temp);
|
|
121
|
+
// Loop through breakpoints
|
|
122
|
+
for (let i = ResponsivePictureVariables.envs.length - 1; i >= 0; i--) {
|
|
123
|
+
env = ResponsivePictureVariables.envs[i];
|
|
124
|
+
// Add classes
|
|
125
|
+
temp.className = 'hidden-' + env;
|
|
126
|
+
// Found breakpoint
|
|
127
|
+
if (temp.offsetParent === null) {
|
|
128
|
+
// Remove our test node
|
|
129
|
+
doc.body.removeChild(temp);
|
|
130
|
+
console.log('remove test node');
|
|
131
|
+
// Return current breakpoint
|
|
132
|
+
return env;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// Breakpoint not found, try fallback
|
|
136
|
+
doc.body.removeChild(temp);
|
|
137
|
+
return this.getFallbackBreakpoint();
|
|
138
|
+
}
|
|
139
|
+
getFallbackBreakpoint() {
|
|
140
|
+
if (window.matchMedia('(min-width: 992px)').matches) {
|
|
141
|
+
return 'lg';
|
|
142
|
+
}
|
|
143
|
+
else if (window.matchMedia('(min-width: 768px)').matches) {
|
|
144
|
+
return 'md';
|
|
145
|
+
}
|
|
146
|
+
else if (window.matchMedia('(min-width: 576px)').matches) {
|
|
147
|
+
return 'sm';
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
return 'xs';
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
getCssClassMap() {
|
|
154
|
+
return {
|
|
155
|
+
[this.borderRadius]: this.borderRadius ? true : false,
|
|
156
|
+
[this.objectFit]: true,
|
|
157
|
+
[this.isFullHeight ? 'is-full-height' : 'is-normal-height']: true,
|
|
158
|
+
[this.isFullWidth ? 'is-full-width' : 'is-normal-width']: true
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
get el() { return getElement(this); }
|
|
162
|
+
};
|
|
163
163
|
PtcPicture.style = ptcPictureCss;
|
|
164
164
|
|
|
165
165
|
export { PtcPicture as ptc_picture };
|
|
@@ -2,60 +2,60 @@ import { r as registerInstance, h, a as getElement } from './index-357497dc.js';
|
|
|
2
2
|
|
|
3
3
|
const ptcResponsiveWrapperCss = ":host{display:block}";
|
|
4
4
|
|
|
5
|
-
let PtcResponsiveWrapper = class {
|
|
6
|
-
constructor(hostRef) {
|
|
7
|
-
registerInstance(this, hostRef);
|
|
8
|
-
}
|
|
9
|
-
componentDidLoad() {
|
|
10
|
-
this.ro = new ResizeObserver(entries => {
|
|
11
|
-
for (const entry of entries) {
|
|
12
|
-
this.applySizeClasses(entry.contentRect.width);
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
this.ro.observe(this.element);
|
|
16
|
-
}
|
|
17
|
-
disconnectedCallback() {
|
|
18
|
-
this.ro.disconnect();
|
|
19
|
-
}
|
|
20
|
-
applySizeClasses(size) {
|
|
21
|
-
let xsmall = false;
|
|
22
|
-
let small = false;
|
|
23
|
-
let medium = false;
|
|
24
|
-
let large = false;
|
|
25
|
-
let xlarge = false;
|
|
26
|
-
let xxlarge = false;
|
|
27
|
-
let large2k = false;
|
|
28
|
-
let large4k = false;
|
|
29
|
-
if (size >= 2600)
|
|
30
|
-
large4k = true;
|
|
31
|
-
else if (size >= 1980)
|
|
32
|
-
large2k = true;
|
|
33
|
-
else if (size >= 1600)
|
|
34
|
-
xxlarge = true;
|
|
35
|
-
else if (size >= 1440)
|
|
36
|
-
xlarge = true;
|
|
37
|
-
else if (size >= 1200)
|
|
38
|
-
large = true;
|
|
39
|
-
else if (size >= 992)
|
|
40
|
-
medium = true;
|
|
41
|
-
else if (size >= 768)
|
|
42
|
-
small = true;
|
|
43
|
-
else
|
|
44
|
-
xsmall = true;
|
|
45
|
-
this.element.classList.toggle("xsmall", xsmall);
|
|
46
|
-
this.element.classList.toggle("small", small);
|
|
47
|
-
this.element.classList.toggle("medium", medium);
|
|
48
|
-
this.element.classList.toggle("large", large);
|
|
49
|
-
this.element.classList.toggle("xlarge", xlarge);
|
|
50
|
-
this.element.classList.toggle("xxlarge", xxlarge);
|
|
51
|
-
this.element.classList.toggle("large2k", large2k);
|
|
52
|
-
this.element.classList.toggle("large4k", large4k);
|
|
53
|
-
}
|
|
54
|
-
render() {
|
|
55
|
-
return (h("div", null, h("slot", null)));
|
|
56
|
-
}
|
|
57
|
-
get element() { return getElement(this); }
|
|
58
|
-
};
|
|
5
|
+
let PtcResponsiveWrapper = class {
|
|
6
|
+
constructor(hostRef) {
|
|
7
|
+
registerInstance(this, hostRef);
|
|
8
|
+
}
|
|
9
|
+
componentDidLoad() {
|
|
10
|
+
this.ro = new ResizeObserver(entries => {
|
|
11
|
+
for (const entry of entries) {
|
|
12
|
+
this.applySizeClasses(entry.contentRect.width);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
this.ro.observe(this.element);
|
|
16
|
+
}
|
|
17
|
+
disconnectedCallback() {
|
|
18
|
+
this.ro.disconnect();
|
|
19
|
+
}
|
|
20
|
+
applySizeClasses(size) {
|
|
21
|
+
let xsmall = false;
|
|
22
|
+
let small = false;
|
|
23
|
+
let medium = false;
|
|
24
|
+
let large = false;
|
|
25
|
+
let xlarge = false;
|
|
26
|
+
let xxlarge = false;
|
|
27
|
+
let large2k = false;
|
|
28
|
+
let large4k = false;
|
|
29
|
+
if (size >= 2600)
|
|
30
|
+
large4k = true;
|
|
31
|
+
else if (size >= 1980)
|
|
32
|
+
large2k = true;
|
|
33
|
+
else if (size >= 1600)
|
|
34
|
+
xxlarge = true;
|
|
35
|
+
else if (size >= 1440)
|
|
36
|
+
xlarge = true;
|
|
37
|
+
else if (size >= 1200)
|
|
38
|
+
large = true;
|
|
39
|
+
else if (size >= 992)
|
|
40
|
+
medium = true;
|
|
41
|
+
else if (size >= 768)
|
|
42
|
+
small = true;
|
|
43
|
+
else
|
|
44
|
+
xsmall = true;
|
|
45
|
+
this.element.classList.toggle("xsmall", xsmall);
|
|
46
|
+
this.element.classList.toggle("small", small);
|
|
47
|
+
this.element.classList.toggle("medium", medium);
|
|
48
|
+
this.element.classList.toggle("large", large);
|
|
49
|
+
this.element.classList.toggle("xlarge", xlarge);
|
|
50
|
+
this.element.classList.toggle("xxlarge", xxlarge);
|
|
51
|
+
this.element.classList.toggle("large2k", large2k);
|
|
52
|
+
this.element.classList.toggle("large4k", large4k);
|
|
53
|
+
}
|
|
54
|
+
render() {
|
|
55
|
+
return (h("div", null, h("slot", null)));
|
|
56
|
+
}
|
|
57
|
+
get element() { return getElement(this); }
|
|
58
|
+
};
|
|
59
59
|
PtcResponsiveWrapper.style = ptcResponsiveWrapperCss;
|
|
60
60
|
|
|
61
61
|
export { PtcResponsiveWrapper as ptc_responsive_wrapper };
|
|
@@ -2,30 +2,30 @@ import { r as registerInstance, h, a as getElement } from './index-357497dc.js';
|
|
|
2
2
|
|
|
3
3
|
const ptcSelectCss = ".sc-ptc-select-h{display:block}.ptc-select.sc-ptc-select{display:block;width:100%;padding:6px 12px;border:none;border-bottom:1px solid #3b4550;padding-left:20px;-webkit-box-shadow:1px 1px 25px 0 rgba(0, 0, 0, 0.16);box-shadow:1px 1px 25px 0 rgba(0, 0, 0, 0.16);border-top-left-radius:5px;border-top-right-radius:5px;border-bottom-left-radius:0;border-bottom-right-radius:0;font-size:16px;color:#707070;padding-top:14px;background:#fff}";
|
|
4
4
|
|
|
5
|
-
let PtcSelect = class {
|
|
6
|
-
constructor(hostRef) {
|
|
7
|
-
registerInstance(this, hostRef);
|
|
8
|
-
this.valueOptions = [];
|
|
9
|
-
}
|
|
10
|
-
componentWillLoad() {
|
|
11
|
-
const BASE_URL = 'https://countriesnow.space/api/v0.1/countries/iso';
|
|
12
|
-
return fetch(`${BASE_URL}`)
|
|
13
|
-
.then(response => response.json())
|
|
14
|
-
.then(data => {
|
|
15
|
-
this.valueOptions = data.data;
|
|
16
|
-
console.log(this.valueOptions);
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
render() {
|
|
20
|
-
if (this.selectId == 'contact-country') {
|
|
21
|
-
console.log('country field exist');
|
|
22
|
-
}
|
|
23
|
-
return (h("div", null, h("select", { id: this.selectId, class: "ptc-select", "data-eloqua-name": this.dataEloquaName, name: this.name }, this.selectId === 'contact-country'
|
|
24
|
-
? this.valueOptions.map(recipient => h("option", { value: recipient.Iso2 }, recipient.name))
|
|
25
|
-
: this.valueOptions.map(recipient => h("option", { value: recipient.Iso3 }, recipient.name))), h("label", { htmlFor: this.selectId, class: "floating-label" }, h("slot", null))));
|
|
26
|
-
}
|
|
27
|
-
get el() { return getElement(this); }
|
|
28
|
-
};
|
|
5
|
+
let PtcSelect = class {
|
|
6
|
+
constructor(hostRef) {
|
|
7
|
+
registerInstance(this, hostRef);
|
|
8
|
+
this.valueOptions = [];
|
|
9
|
+
}
|
|
10
|
+
componentWillLoad() {
|
|
11
|
+
const BASE_URL = 'https://countriesnow.space/api/v0.1/countries/iso';
|
|
12
|
+
return fetch(`${BASE_URL}`)
|
|
13
|
+
.then(response => response.json())
|
|
14
|
+
.then(data => {
|
|
15
|
+
this.valueOptions = data.data;
|
|
16
|
+
console.log(this.valueOptions);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
render() {
|
|
20
|
+
if (this.selectId == 'contact-country') {
|
|
21
|
+
console.log('country field exist');
|
|
22
|
+
}
|
|
23
|
+
return (h("div", null, h("select", { id: this.selectId, class: "ptc-select", "data-eloqua-name": this.dataEloquaName, name: this.name }, this.selectId === 'contact-country'
|
|
24
|
+
? this.valueOptions.map(recipient => h("option", { value: recipient.Iso2 }, recipient.name))
|
|
25
|
+
: this.valueOptions.map(recipient => h("option", { value: recipient.Iso3 }, recipient.name))), h("label", { htmlFor: this.selectId, class: "floating-label" }, h("slot", null))));
|
|
26
|
+
}
|
|
27
|
+
get el() { return getElement(this); }
|
|
28
|
+
};
|
|
29
29
|
PtcSelect.style = ptcSelectCss;
|
|
30
30
|
|
|
31
31
|
export { PtcSelect as ptc_select };
|
|
@@ -2,70 +2,70 @@ import { r as registerInstance, h, H as Host, a as getElement } from './index-35
|
|
|
2
2
|
|
|
3
3
|
const ptcSocialShareCss = ":host(.inline-block){display:inline-block}:host(.block){display:block}:host(.inline){display:inline}:host(.flex){display:flex}:host(.ptc-social-share){cursor:pointer}@media screen and (min-width: 1200px){:host(.ptc-social-m-left){margin-left:19px}}";
|
|
4
4
|
|
|
5
|
-
let PtcSocialShare = class {
|
|
6
|
-
constructor(hostRef) {
|
|
7
|
-
registerInstance(this, hostRef);
|
|
8
|
-
this.display = 'inline-block';
|
|
9
|
-
this.shareType = 'twitter';
|
|
10
|
-
/**
|
|
11
|
-
* Optional - source for linkedin
|
|
12
|
-
*/
|
|
13
|
-
this.source = '';
|
|
14
|
-
/**
|
|
15
|
-
* Email recipient.
|
|
16
|
-
* If you want to use mail share, you need to use this property
|
|
17
|
-
*/
|
|
18
|
-
this.recipient = '';
|
|
19
|
-
/**
|
|
20
|
-
* is hover or not
|
|
21
|
-
*/
|
|
22
|
-
this.isHover = false;
|
|
23
|
-
}
|
|
24
|
-
render() {
|
|
25
|
-
const classMap = this.getCssClassMap();
|
|
26
|
-
return (h(Host, { class: classMap }, h("div", { onClick: () => this.share(), onMouseEnter: () => this.hoverToggle(), onMouseLeave: () => this.hoverToggle() }, this.shareType == 'mail' ? h("icon-asset", Object.assign({ type: "ptc", size: "x-large", name: "plm-mail" }, (this.isHover ? { color: 'gray' } : { color: 'white' }))) : null, this.shareType == 'linkedin' ? h("icon-asset", Object.assign({ type: "ptc", size: "x-large", name: "plm-linkedin" }, (this.isHover ? { color: 'gray' } : { color: 'white' }))) : null, this.shareType == 'twitter' ? h("icon-asset", Object.assign({ type: "ptc", size: "x-large", name: "plm-twitter" }, (this.isHover ? { color: 'gray' } : { color: 'white' }))) : null, this.shareType == 'facebook' ? h("icon-asset", Object.assign({ type: "ptc", size: "x-large", name: "plm-fb" }, (this.isHover ? { color: 'gray' } : { color: 'white' }))) : null, this.shareType == 'share-api' ? h("icon-asset", Object.assign({ type: "solid", size: "x-large", name: "share-square" }, (this.isHover ? { color: 'gray' } : { color: 'white' }))) : null)));
|
|
27
|
-
}
|
|
28
|
-
getCssClassMap() {
|
|
29
|
-
return {
|
|
30
|
-
['ptc-social-share']: true,
|
|
31
|
-
[this.display]: true,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
hoverToggle() {
|
|
35
|
-
this.isHover = !this.isHover;
|
|
36
|
-
}
|
|
37
|
-
share() {
|
|
38
|
-
if (this.shareType == 'twitter') {
|
|
39
|
-
window.open(`https://twitter.com/share?text=${this.text}&url=${this.url}`);
|
|
40
|
-
}
|
|
41
|
-
if (this.shareType == 'facebook') {
|
|
42
|
-
window.open(`https://www.facebook.com/sharer/sharer.php?u=${this.url}`);
|
|
43
|
-
}
|
|
44
|
-
if (this.shareType == 'linkedin') {
|
|
45
|
-
window.open(`https://www.linkedin.com/shareArticle?mini=true&url=${this.url}&title=${this.shareTitle}&summary=${this.text}&source=${this.source}`);
|
|
46
|
-
}
|
|
47
|
-
if (this.shareType == 'mail') {
|
|
48
|
-
window.open(`mailto:${this.recipient}?subject=${this.text}&body=${this.url}`);
|
|
49
|
-
}
|
|
50
|
-
if (this.shareType == 'share-api') {
|
|
51
|
-
if (navigator.share) {
|
|
52
|
-
navigator
|
|
53
|
-
.share({
|
|
54
|
-
title: this.shareTitle,
|
|
55
|
-
text: this.text,
|
|
56
|
-
url: this.url,
|
|
57
|
-
})
|
|
58
|
-
.then(() => console.log('Successful share'))
|
|
59
|
-
.catch(error => console.log('Error sharing', error));
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
// fallback to sharing to twitter
|
|
63
|
-
window.open(`http://twitter.com/share?text=${this.text}&url=${this.url}`);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
get el() { return getElement(this); }
|
|
68
|
-
};
|
|
5
|
+
let PtcSocialShare = class {
|
|
6
|
+
constructor(hostRef) {
|
|
7
|
+
registerInstance(this, hostRef);
|
|
8
|
+
this.display = 'inline-block';
|
|
9
|
+
this.shareType = 'twitter';
|
|
10
|
+
/**
|
|
11
|
+
* Optional - source for linkedin
|
|
12
|
+
*/
|
|
13
|
+
this.source = '';
|
|
14
|
+
/**
|
|
15
|
+
* Email recipient.
|
|
16
|
+
* If you want to use mail share, you need to use this property
|
|
17
|
+
*/
|
|
18
|
+
this.recipient = '';
|
|
19
|
+
/**
|
|
20
|
+
* is hover or not
|
|
21
|
+
*/
|
|
22
|
+
this.isHover = false;
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
const classMap = this.getCssClassMap();
|
|
26
|
+
return (h(Host, { class: classMap }, h("div", { onClick: () => this.share(), onMouseEnter: () => this.hoverToggle(), onMouseLeave: () => this.hoverToggle() }, this.shareType == 'mail' ? h("icon-asset", Object.assign({ type: "ptc", size: "x-large", name: "plm-mail" }, (this.isHover ? { color: 'gray' } : { color: 'white' }))) : null, this.shareType == 'linkedin' ? h("icon-asset", Object.assign({ type: "ptc", size: "x-large", name: "plm-linkedin" }, (this.isHover ? { color: 'gray' } : { color: 'white' }))) : null, this.shareType == 'twitter' ? h("icon-asset", Object.assign({ type: "ptc", size: "x-large", name: "plm-twitter" }, (this.isHover ? { color: 'gray' } : { color: 'white' }))) : null, this.shareType == 'facebook' ? h("icon-asset", Object.assign({ type: "ptc", size: "x-large", name: "plm-fb" }, (this.isHover ? { color: 'gray' } : { color: 'white' }))) : null, this.shareType == 'share-api' ? h("icon-asset", Object.assign({ type: "solid", size: "x-large", name: "share-square" }, (this.isHover ? { color: 'gray' } : { color: 'white' }))) : null)));
|
|
27
|
+
}
|
|
28
|
+
getCssClassMap() {
|
|
29
|
+
return {
|
|
30
|
+
['ptc-social-share']: true,
|
|
31
|
+
[this.display]: true,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
hoverToggle() {
|
|
35
|
+
this.isHover = !this.isHover;
|
|
36
|
+
}
|
|
37
|
+
share() {
|
|
38
|
+
if (this.shareType == 'twitter') {
|
|
39
|
+
window.open(`https://twitter.com/share?text=${this.text}&url=${this.url}`);
|
|
40
|
+
}
|
|
41
|
+
if (this.shareType == 'facebook') {
|
|
42
|
+
window.open(`https://www.facebook.com/sharer/sharer.php?u=${this.url}`);
|
|
43
|
+
}
|
|
44
|
+
if (this.shareType == 'linkedin') {
|
|
45
|
+
window.open(`https://www.linkedin.com/shareArticle?mini=true&url=${this.url}&title=${this.shareTitle}&summary=${this.text}&source=${this.source}`);
|
|
46
|
+
}
|
|
47
|
+
if (this.shareType == 'mail') {
|
|
48
|
+
window.open(`mailto:${this.recipient}?subject=${this.text}&body=${this.url}`);
|
|
49
|
+
}
|
|
50
|
+
if (this.shareType == 'share-api') {
|
|
51
|
+
if (navigator.share) {
|
|
52
|
+
navigator
|
|
53
|
+
.share({
|
|
54
|
+
title: this.shareTitle,
|
|
55
|
+
text: this.text,
|
|
56
|
+
url: this.url,
|
|
57
|
+
})
|
|
58
|
+
.then(() => console.log('Successful share'))
|
|
59
|
+
.catch(error => console.log('Error sharing', error));
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
// fallback to sharing to twitter
|
|
63
|
+
window.open(`http://twitter.com/share?text=${this.text}&url=${this.url}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
get el() { return getElement(this); }
|
|
68
|
+
};
|
|
69
69
|
PtcSocialShare.style = ptcSocialShareCss;
|
|
70
70
|
|
|
71
71
|
export { PtcSocialShare as ptc_social_share };
|