@ptcwebops/ptcw-design 1.7.1 → 1.7.3
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/icon-asset_5.cjs.entry.js +218 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/ptc-back-to-top.cjs.entry.js +46 -0
- package/dist/cjs/ptc-jumbotron.cjs.entry.js +1 -1
- package/dist/cjs/ptc-para_2.cjs.entry.js +94 -0
- package/dist/cjs/ptc-picture.cjs.entry.js +154 -0
- package/dist/cjs/ptc-product-card.cjs.entry.js +33 -0
- package/dist/cjs/ptc-product-category.cjs.entry.js +21 -0
- package/dist/cjs/ptc-product-dropdown.cjs.entry.js +80 -0
- package/dist/cjs/ptc-product-highlight-card.cjs.entry.js +23 -0
- package/dist/cjs/ptc-product-list.cjs.entry.js +151 -0
- package/dist/cjs/ptc-product-sidebar.cjs.entry.js +141 -0
- package/dist/cjs/ptc-sticky-section.cjs.entry.js +1 -1
- package/dist/cjs/ptc-sticky-title.cjs.entry.js +1 -1
- package/dist/cjs/ptc-tooltip.cjs.entry.js +106 -0
- package/dist/cjs/ptcw-design.cjs.js +1 -1
- package/dist/collection/components/ptc-jumbotron/ptc-jumbotron.css +1 -1
- package/dist/collection/components/ptc-product-sidebar/ptc-product-sidebar.js +3 -2
- package/dist/collection/components/ptc-sticky-section/ptc-sticky-section.css +1 -1
- package/dist/collection/components/ptc-sticky-title/ptc-sticky-title.css +5 -1
- package/dist/collection/components/ptc-title/ptc-title.css +5 -0
- package/dist/custom-elements/index.js +7 -6
- package/dist/esm/icon-asset_5.entry.js +210 -0
- package/dist/esm/{interfaces-7c0243be.js → interfaces-4caedd26.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/max-width-container_3.entry.js +1 -1
- package/dist/esm/ptc-back-to-top.entry.js +42 -0
- package/dist/esm/ptc-jumbotron.entry.js +1 -1
- package/dist/esm/ptc-para_2.entry.js +89 -0
- package/dist/esm/ptc-picture.entry.js +150 -0
- package/dist/esm/ptc-product-card.entry.js +29 -0
- package/dist/esm/ptc-product-category.entry.js +17 -0
- package/dist/esm/ptc-product-dropdown.entry.js +76 -0
- package/dist/esm/ptc-product-highlight-card.entry.js +19 -0
- package/dist/esm/ptc-product-list.entry.js +147 -0
- package/dist/esm/ptc-product-sidebar.entry.js +137 -0
- package/dist/esm/ptc-sticky-section.entry.js +1 -1
- package/dist/esm/ptc-sticky-title.entry.js +1 -1
- package/dist/esm/ptc-tooltip.entry.js +102 -0
- package/dist/esm/ptcw-design.js +1 -1
- package/dist/ptcw-design/{p-f1f1b19d.entry.js → p-116679f9.entry.js} +1 -1
- package/dist/ptcw-design/p-2bcb85cb.entry.js +1 -0
- package/dist/ptcw-design/p-341a4c39.entry.js +1 -0
- package/dist/ptcw-design/p-49dc9b68.entry.js +1 -0
- package/dist/ptcw-design/p-564f58cf.entry.js +1 -0
- package/dist/ptcw-design/{p-f4923de6.entry.js → p-577a1370.entry.js} +1 -1
- package/dist/ptcw-design/p-65513c45.entry.js +1 -0
- package/dist/ptcw-design/p-6e9eccfc.entry.js +1 -0
- package/dist/ptcw-design/{p-ee1183b2.js → p-711bcdad.js} +1 -1
- package/dist/ptcw-design/p-9a5ee2d5.entry.js +1 -0
- package/dist/ptcw-design/p-ba213813.entry.js +1 -0
- package/dist/ptcw-design/{p-e8c46d2e.entry.js → p-baabdb8a.entry.js} +1 -1
- package/dist/ptcw-design/p-d8ade68d.entry.js +1 -0
- package/dist/ptcw-design/p-e5a6f9df.entry.js +1 -0
- package/dist/ptcw-design/p-f86b2262.entry.js +1 -0
- package/dist/ptcw-design/p-fe0815f2.entry.js +1 -0
- package/dist/ptcw-design/ptcw-design.css +2 -2
- package/dist/ptcw-design/ptcw-design.esm.js +1 -1
- package/package.json +1 -1
- package/readme.md +1 -1
- package/dist/cjs/icon-asset_16.cjs.entry.js +0 -1006
- package/dist/esm/icon-asset_16.entry.js +0 -987
- package/dist/ptcw-design/p-cd44eedb.entry.js +0 -1
- package/dist/ptcw-design/p-fe438f03.entry.js +0 -1
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-8e63c32d.js';
|
|
2
|
+
|
|
3
|
+
const ptcProductDropdownCss = ":host{display:block;margin-top:4px;background-color:var(--color-white)}:host .hidden{display:none}:host .dropdown{position:relative;display:inline-block;width:100%;font-size:16px}:host .dropdown .dropdown-toggle{padding:0.5rem;border:1px solid var(--color-gray-03);background-color:var(--color-white);cursor:pointer;display:flex;align-items:center;justify-content:space-between;min-height:34px;box-sizing:border-box}:host .dropdown .dropdown-toggle .dropdown-placeholder{font-size:14px;color:var(--color-gray-07)}:host .caret{display:inline-block;vertical-align:middle}:host .dropdown-menu{position:absolute;top:100%;left:0;min-width:10rem;border:1px solid var(--color-gray-03);background-color:var(--color-white);box-shadow:0px 2px 4px rgba(35, 43, 45, 0.3);z-index:105;max-height:400px;overflow-y:auto}:host .dropdown-menu::-webkit-scrollbar{width:5px}:host .dropdown-menu::-webkit-scrollbar-track{-webkit-box-shadow:inset 0 0 6px rgba(0, 0, 0, 0.3)}:host .dropdown-menu::-webkit-scrollbar-thumb{background-color:var(--color-gray-05);outline:1px solid var(--color-gray-05)}:host .checkbox-label{display:flex;align-items:flex-start;padding:6px 16px;cursor:pointer;font-size:14px}:host .checkbox-label:first-child{padding-top:20px}:host .checkbox-label:last-child{padding-bottom:20px}:host .checkbox-label input[type=checkbox]{min-width:20px;margin-right:8px;width:20px;height:20px;margin-top:0}";
|
|
4
|
+
|
|
5
|
+
const PtcProductDropdown = class {
|
|
6
|
+
constructor(hostRef) {
|
|
7
|
+
registerInstance(this, hostRef);
|
|
8
|
+
this.selectedValues = createEvent(this, "selectedValues", 7);
|
|
9
|
+
this.dropdownTouched = createEvent(this, "dropdownTouched", 7);
|
|
10
|
+
this.internalOptions = undefined;
|
|
11
|
+
this.newOptions = undefined;
|
|
12
|
+
this.selectedOptions = [];
|
|
13
|
+
this.placeholder = undefined;
|
|
14
|
+
this.isOpen = false;
|
|
15
|
+
}
|
|
16
|
+
parseOptions() {
|
|
17
|
+
let options = Array.from(this.hostElement.querySelectorAll('span'));
|
|
18
|
+
if (options) {
|
|
19
|
+
this.internalOptions = options.map((option) => {
|
|
20
|
+
return option.textContent;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
toggleDropdown() {
|
|
25
|
+
this.isOpen = !this.isOpen;
|
|
26
|
+
this.dropdownTouched.emit({
|
|
27
|
+
'sender': this,
|
|
28
|
+
'isOpen': this.isOpen
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
handleSearchResult(event) {
|
|
32
|
+
const { sender, searchTerm } = event.detail;
|
|
33
|
+
if (sender) {
|
|
34
|
+
if (searchTerm === "") {
|
|
35
|
+
this.selectedOptions = [];
|
|
36
|
+
this.isOpen = false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
handleinputChanged(event) {
|
|
41
|
+
const { sender } = event.detail;
|
|
42
|
+
if (sender) {
|
|
43
|
+
this.selectedOptions = [];
|
|
44
|
+
this.isOpen = false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
handleCheckboxChange(option) {
|
|
48
|
+
const index = this.selectedOptions.indexOf(option);
|
|
49
|
+
if (index > -1) {
|
|
50
|
+
this.selectedOptions.splice(index, 1);
|
|
51
|
+
//console.log(this.selectedOptions);
|
|
52
|
+
this.selectedValues.emit({
|
|
53
|
+
'sender': this,
|
|
54
|
+
'selectedOptions': this.selectedOptions
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
this.selectedOptions.push(option);
|
|
59
|
+
//console.log(this.selectedOptions);
|
|
60
|
+
this.selectedValues.emit({
|
|
61
|
+
'sender': this,
|
|
62
|
+
'selectedOptions': this.selectedOptions
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
componentWillLoad() {
|
|
67
|
+
this.parseOptions();
|
|
68
|
+
}
|
|
69
|
+
render() {
|
|
70
|
+
return (h(Host, null, h("div", { class: "dropdown" }, h("div", { class: "dropdown-toggle", onClick: () => this.toggleDropdown() }, h("span", { class: "dropdown-placeholder" }, this.placeholder), h("span", { class: "caret" }, h("svg", { width: "12", height: "8", viewBox: "0 0 12 8", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M1.86537 0.917969L6.14614 4.56922L10.4269 0.917969L11.9769 2.23997L6.14614 7.21323L0.31543 2.23997L1.86537 0.917969Z", fill: "#323B42" })))), this.isOpen && (h("div", { class: "dropdown-menu" }, this.internalOptions.map((option) => (h("label", { class: "checkbox-label" }, h("input", { type: "checkbox", checked: this.selectedOptions.includes(option), onChange: () => this.handleCheckboxChange(option) }), option)))))), h("div", { class: "hidden" }, h("slot", null))));
|
|
71
|
+
}
|
|
72
|
+
get hostElement() { return getElement(this); }
|
|
73
|
+
};
|
|
74
|
+
PtcProductDropdown.style = ptcProductDropdownCss;
|
|
75
|
+
|
|
76
|
+
export { PtcProductDropdown as ptc_product_dropdown };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { r as registerInstance, h, H as Host } from './index-8e63c32d.js';
|
|
2
|
+
|
|
3
|
+
const ptcProductHighlightCardCss = ":host{max-width:300px;display:block;padding:18px 10px 12px 10px;border:1px solid var(--color-gray-04);border-radius:var(--ptc-border-radius-standard);margin:auto;height:100%}:host ptc-picture{min-height:100px}";
|
|
4
|
+
|
|
5
|
+
const PtcProductHighlightCard = class {
|
|
6
|
+
constructor(hostRef) {
|
|
7
|
+
registerInstance(this, hostRef);
|
|
8
|
+
this.cardTitle = undefined;
|
|
9
|
+
this.cardImage = undefined;
|
|
10
|
+
this.cardImageAltText = undefined;
|
|
11
|
+
this.cardDescription = undefined;
|
|
12
|
+
}
|
|
13
|
+
render() {
|
|
14
|
+
return (h(Host, null, h("ptc-title", { type: 'h4', upperline: "no-upperline", "title-margin": "margin-flush", "title-size": "small", "text-align": 'center' }, h("ptc-tooltip", { "text-display": "block", "text-lines": "2", "z-index": "z-999", description: this.cardTitle, position: "bottom", width: 'full-width' })), h("ptc-picture", { alt: "image-test", src: this.cardImage, "image-alignment": "center", width: "69", "display-image": "inline-block", styles: "img{margin: 12px auto 18px auto}" }), h("ptc-para", { "font-size": "x-small", "para-margin": "margin-flush", "para-line-h": "line-height-densest", "para-align": 'left', "para-z-index": "z-auto" }, h("ptc-tooltip", { "text-display": "block", "text-lines": "3", "z-index": "z-999", description: this.cardDescription, position: "bottom", width: 'full-width' }))));
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
PtcProductHighlightCard.style = ptcProductHighlightCardCss;
|
|
18
|
+
|
|
19
|
+
export { PtcProductHighlightCard as ptc_product_highlight_card };
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-8e63c32d.js';
|
|
2
|
+
|
|
3
|
+
const ptcProductListCss = ":host{display:block;padding-bottom:52px}@media only screen and (min-width: 992px){:host{padding-bottom:102px}}:host .no-result-wrap{display:none}:host .no-result-wrap.show{display:block}:host .no-result-wrap .no-result{display:flex;justify-content:center;align-items:center;min-height:160px;padding:20px;text-align:center}";
|
|
4
|
+
|
|
5
|
+
const PtcProductList = class {
|
|
6
|
+
constructor(hostRef) {
|
|
7
|
+
registerInstance(this, hostRef);
|
|
8
|
+
this.clearCtaClicked = createEvent(this, "clearCtaClicked", 7);
|
|
9
|
+
}
|
|
10
|
+
handleSearchResult(event) {
|
|
11
|
+
const { sender, searchTerm } = event.detail;
|
|
12
|
+
if (sender) {
|
|
13
|
+
this.sortCards(searchTerm);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
handleMultipleSearchResult(event) {
|
|
17
|
+
const { sender, selectedOptions } = event.detail;
|
|
18
|
+
if (sender) {
|
|
19
|
+
this.sortMultipleCards(selectedOptions);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
handleEmptyResult(event) {
|
|
23
|
+
const { sender, searchTerm } = event.detail;
|
|
24
|
+
if (sender) {
|
|
25
|
+
this.noresultSection.classList.add('show');
|
|
26
|
+
this.sortCards(searchTerm);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
sortMultipleCards(searchItems) {
|
|
30
|
+
const categoryList = Array.from(this.hostElement.querySelectorAll('ptc-product-category'));
|
|
31
|
+
categoryList.forEach((category) => {
|
|
32
|
+
const categoryTitle = category.getAttribute('category-title');
|
|
33
|
+
const productList = Array.from(category.querySelectorAll('ptc-product-card'));
|
|
34
|
+
if (searchItems.length > 0) {
|
|
35
|
+
const shouldDisplayCategory = searchItems.some(searchItem => categoryTitle && categoryTitle.includes(searchItem));
|
|
36
|
+
category.style.display = shouldDisplayCategory ? 'block' : 'none';
|
|
37
|
+
if (shouldDisplayCategory) {
|
|
38
|
+
productList.forEach(product => {
|
|
39
|
+
product.style.display = 'block';
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
productList.forEach(product => {
|
|
44
|
+
const productTitle = product.getAttribute('card-title');
|
|
45
|
+
const shouldDisplayProduct = searchItems.some(searchItem => productTitle && productTitle.includes(searchItem));
|
|
46
|
+
product.style.display = shouldDisplayProduct ? 'block' : 'none';
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
category.style.display = 'block';
|
|
52
|
+
productList.forEach(product => {
|
|
53
|
+
product.style.display = 'block';
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
// Sorting the
|
|
59
|
+
sortCards(searchItem) {
|
|
60
|
+
const categoryList = this.hostElement.querySelectorAll('ptc-product-category');
|
|
61
|
+
categoryList.forEach((category) => {
|
|
62
|
+
const categoryTitle = category.getAttribute('category-title');
|
|
63
|
+
const productList = category.querySelectorAll('ptc-product-card');
|
|
64
|
+
category.style.display = 'none';
|
|
65
|
+
if (searchItem === '') {
|
|
66
|
+
category.style.display = 'block';
|
|
67
|
+
productList.forEach(product => {
|
|
68
|
+
product.style.display = 'block';
|
|
69
|
+
});
|
|
70
|
+
this.noresultSection.classList.remove('show');
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
const searchItemLowerCase = searchItem; //
|
|
74
|
+
if (searchItemLowerCase === categoryTitle) {
|
|
75
|
+
category.style.display = 'block';
|
|
76
|
+
productList.forEach(product => {
|
|
77
|
+
product.style.display = 'block';
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
productList.forEach(product => {
|
|
82
|
+
const productTitle = product.getAttribute('card-title');
|
|
83
|
+
product.style.display = 'none';
|
|
84
|
+
if (searchItemLowerCase === productTitle) {
|
|
85
|
+
product.style.display = 'block';
|
|
86
|
+
category.style.display = 'block';
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
componentDidLoad() {
|
|
94
|
+
this.addIds();
|
|
95
|
+
this.noresultSection = this.hostElement.shadowRoot.querySelector('.no-result-wrap');
|
|
96
|
+
this.productList = this.hostElement.shadowRoot.querySelector('.product-list');
|
|
97
|
+
const productCards = this.hostElement.querySelectorAll('ptc-product-category ptc-product-card');
|
|
98
|
+
productCards.forEach(card => {
|
|
99
|
+
const toggleBtn = (card.shadowRoot).querySelector('.toggle-btn');
|
|
100
|
+
if (toggleBtn) {
|
|
101
|
+
toggleBtn.addEventListener('click', () => {
|
|
102
|
+
if (card.classList.contains('has-opened')) {
|
|
103
|
+
card.classList.remove('has-opened');
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
card.classList.add('has-opened');
|
|
107
|
+
}
|
|
108
|
+
this.hideAllCards(card);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
hideAllCards(selectedCard) {
|
|
114
|
+
const productCards = this.hostElement.querySelectorAll('ptc-product-category ptc-product-card');
|
|
115
|
+
productCards.forEach(card => {
|
|
116
|
+
if (selectedCard != card) {
|
|
117
|
+
card.classList.remove('has-opened');
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
handleClick(event) {
|
|
122
|
+
this.clearCtaClicked.emit({
|
|
123
|
+
'sender': this,
|
|
124
|
+
'event': event,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
// Adding id to the category and product cards
|
|
128
|
+
addIds() {
|
|
129
|
+
const categoryList = this.hostElement.querySelectorAll('ptc-product-category');
|
|
130
|
+
categoryList.forEach((category) => {
|
|
131
|
+
const categoryTitle = category.getAttribute('category-title');
|
|
132
|
+
category.setAttribute('id', categoryTitle);
|
|
133
|
+
const productList = category.querySelectorAll('ptc-product-card');
|
|
134
|
+
productList.forEach(product => {
|
|
135
|
+
const productTitle = product.getAttribute('card-title');
|
|
136
|
+
product.setAttribute('id', productTitle);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
render() {
|
|
141
|
+
return (h(Host, null, h("div", { class: "product-list" }, h("slot", null)), h("div", { class: "no-result-wrap" }, h("div", { class: "no-result" }, h("div", null, h("ptc-title", { type: 'h3', "title-margin": "margin-flush", upperline: 'no-upperline', "title-size": "large" }, "No Results Found"), h("ptc-para", { "font-size": "x-small" }, "Try changing or removing some of your filters"), h("ptc-button", { type: "link", color: "ptc-quaternary", target: "_blank", onClick: (e) => { this.handleClick(e); } }, "Clear Filters"))))));
|
|
142
|
+
}
|
|
143
|
+
get hostElement() { return getElement(this); }
|
|
144
|
+
};
|
|
145
|
+
PtcProductList.style = ptcProductListCss;
|
|
146
|
+
|
|
147
|
+
export { PtcProductList as ptc_product_list };
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-8e63c32d.js';
|
|
2
|
+
|
|
3
|
+
const ptcProductSidebarCss = ":host{display:block;position:relative}:host .hide{display:none !important}:host .white-box{padding:12px;background-color:var(--color-white);border-radius:var(--ptc-border-radius-standard)}:host .sort-wrap{display:block}@media only screen and (min-width: 768px){:host .sort-wrap{display:flex;justify-content:space-between}}@media only screen and (min-width: 992px){:host .sort-wrap{display:block}}:host .filter-result-wrap label{font-size:var(--ptc-font-size-xx-small);font-weight:600}@media only screen and (min-width: 992px){:host .filter-result-wrap label{font-size:var(--ptc-font-size-x-small)}}:host .filter-result-wrap .result-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}@media only screen and (min-width: 992px){:host .filter-result-wrap .result-header{margin-bottom:26px}}:host .filter-result-wrap .result-header .clear-cta{cursor:pointer;display:none;color:var(--color-gray-07);font-size:var(--ptc-font-size-x-small);text-decoration:underline}:host .filter-result-wrap .result-header .clear-cta.show{display:block}:host .filter-result-wrap .typeahead-input{box-sizing:border-box;margin-bottom:14px;width:100%;margin-right:0}@media only screen and (min-width: 768px){:host .filter-result-wrap .typeahead-input{margin-right:40px}}@media only screen and (min-width: 992px){:host .filter-result-wrap .typeahead-input{margin-right:0}}:host .filter-result-wrap .typeahead-input .input-wrap{position:relative}:host .filter-result-wrap .typeahead-input .input-wrap svg{position:absolute;left:8px;top:8px}:host .filter-result-wrap .typeahead-input .input-wrap input{margin-top:4px;padding:8px 8px 8px 34px;display:block;width:100%;box-sizing:border-box;border:1px solid var(--color-gray-03);font-size:14px}:host .filter-result-wrap .typeahead-input .suggestion-wrap{position:relative;width:100%}:host .filter-result-wrap .typeahead-input .suggestion-wrap .suggestions{border:1px solid var(--color-gray-03);box-shadow:0px 2px 4px rgba(35, 43, 45, 0.3);background-color:var(--color-white);position:absolute;z-index:105;top:0;margin:0;width:100%;box-sizing:border-box;padding:0;max-height:400px;overflow-y:auto}:host .filter-result-wrap .typeahead-input .suggestion-wrap .suggestions::-webkit-scrollbar{width:5px}:host .filter-result-wrap .typeahead-input .suggestion-wrap .suggestions::-webkit-scrollbar-track{-webkit-box-shadow:inset 0 0 6px rgba(0, 0, 0, 0.3)}:host .filter-result-wrap .typeahead-input .suggestion-wrap .suggestions::-webkit-scrollbar-thumb{background-color:var(--color-gray-05);outline:1px solid var(--color-gray-05)}:host .filter-result-wrap .typeahead-input .suggestion-wrap .suggestions li{list-style:none;padding:10px 16px;cursor:pointer;display:block;font-size:14px}:host .filter-result-wrap .typeahead-input .suggestion-wrap .suggestions li:first-child{padding-top:20px}:host .filter-result-wrap .typeahead-input .suggestion-wrap .suggestions li:last-child{padding-bottom:20px}:host .filter-result-wrap .dropdwon-filter{margin-bottom:10px;width:100%}:host .product-list-wrap{display:none}@media only screen and (min-width: 992px){:host .product-list-wrap{display:block}}:host .product-list-wrap .category-list{display:block;padding:12px 4px;font-size:var(--ptc-font-size-x-small)}:host .product-list-wrap .category-list ptc-para{padding-bottom:4px;display:block}:host .product-list-wrap .category-list ul{padding-left:20px;margin:0}";
|
|
4
|
+
|
|
5
|
+
const PtcProductSidebar = class {
|
|
6
|
+
constructor(hostRef) {
|
|
7
|
+
registerInstance(this, hostRef);
|
|
8
|
+
this.selectedResult = createEvent(this, "selectedResult", 7);
|
|
9
|
+
this.clearsearch = createEvent(this, "clearsearch", 7);
|
|
10
|
+
this.inputChanged = createEvent(this, "inputChanged", 7);
|
|
11
|
+
this.emptyResult = createEvent(this, "emptyResult", 7);
|
|
12
|
+
this.searchTerm = '';
|
|
13
|
+
this.suggestions = [];
|
|
14
|
+
this.suggestionList = [];
|
|
15
|
+
}
|
|
16
|
+
componentWillLoad() {
|
|
17
|
+
this.getDomData();
|
|
18
|
+
}
|
|
19
|
+
componentDidLoad() {
|
|
20
|
+
this.productListWrap = this.hostElement.shadowRoot.querySelector('.product-list-wrap');
|
|
21
|
+
this.clearBtn = this.hostElement.shadowRoot.querySelector('.clear-cta');
|
|
22
|
+
}
|
|
23
|
+
// Getting category title and products list
|
|
24
|
+
getDomData() {
|
|
25
|
+
const categoryList = document.querySelectorAll('ptc-product-category');
|
|
26
|
+
categoryList.forEach(category => {
|
|
27
|
+
let categoryTitle = category.getAttribute('category-title');
|
|
28
|
+
let categoryObject = { categoryName: categoryTitle, products: [] };
|
|
29
|
+
this.suggestionList.push(categoryObject);
|
|
30
|
+
let productList = category.querySelectorAll('ptc-product-card');
|
|
31
|
+
productList.forEach(product => {
|
|
32
|
+
let productTitle = product.getAttribute('card-title');
|
|
33
|
+
categoryObject.products.push(productTitle);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
handleInputChange(event) {
|
|
38
|
+
const inputElement = event.target;
|
|
39
|
+
this.searchTerm = inputElement.value.toLocaleLowerCase();
|
|
40
|
+
this.productListWrap.classList.add('hide');
|
|
41
|
+
this.clearBtn.classList.add('show');
|
|
42
|
+
this.getSuggestions();
|
|
43
|
+
this.inputChanged.emit({
|
|
44
|
+
'sender': this,
|
|
45
|
+
'event': event,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
getSuggestions() {
|
|
49
|
+
const searchTerm = this.searchTerm.toLowerCase();
|
|
50
|
+
const suggestions = this.suggestionList.reduce((acc, item) => {
|
|
51
|
+
if (item.categoryName.toLowerCase().includes(searchTerm)) {
|
|
52
|
+
acc.push(item.categoryName); // Include the category if it matches the search term
|
|
53
|
+
}
|
|
54
|
+
const matchedProducts = item.products.filter((product) => product.toLowerCase().includes(searchTerm));
|
|
55
|
+
if (matchedProducts.length > 0) {
|
|
56
|
+
acc.push(...matchedProducts); // Include the matching products
|
|
57
|
+
}
|
|
58
|
+
return acc;
|
|
59
|
+
}, []);
|
|
60
|
+
this.suggestions = suggestions;
|
|
61
|
+
}
|
|
62
|
+
handleSelectSuggestion(suggestion, event) {
|
|
63
|
+
this.searchTerm = suggestion;
|
|
64
|
+
//this.serachInput.setAttribute('value', this.searchTerm);
|
|
65
|
+
this.selectedResult.emit({
|
|
66
|
+
'sender': this,
|
|
67
|
+
'event': event,
|
|
68
|
+
'searchTerm': this.searchTerm
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
handleKeyUp(e) {
|
|
72
|
+
const inputElement = e.target;
|
|
73
|
+
this.searchTerm = inputElement.value.toLocaleLowerCase();
|
|
74
|
+
if (e.keyCode === 13 && this.suggestions.length == 0) {
|
|
75
|
+
console.log('Enter key pressed');
|
|
76
|
+
this.emptyResult.emit({
|
|
77
|
+
'sender': this,
|
|
78
|
+
'event': e,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
clearSearch(event) {
|
|
83
|
+
let input = this.hostElement.shadowRoot.querySelector('input');
|
|
84
|
+
this.productListWrap.classList.remove('hide');
|
|
85
|
+
this.clearBtn.classList.remove('show');
|
|
86
|
+
if (input) {
|
|
87
|
+
input.value = "";
|
|
88
|
+
}
|
|
89
|
+
this.suggestions = [];
|
|
90
|
+
this.clearsearch.emit({
|
|
91
|
+
'sender': this,
|
|
92
|
+
'event': event,
|
|
93
|
+
'searchTerm': input.value
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
handleDropdownTouched(event) {
|
|
97
|
+
const { sender, isOpen } = event.detail;
|
|
98
|
+
if (sender) {
|
|
99
|
+
if (isOpen) {
|
|
100
|
+
let input = this.hostElement.shadowRoot.querySelector('input');
|
|
101
|
+
if (input) {
|
|
102
|
+
input.value = "";
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
handleClick() {
|
|
108
|
+
this.suggestions = [];
|
|
109
|
+
}
|
|
110
|
+
handleclearCtaClicked(event) {
|
|
111
|
+
const { sender, event: mouseEvent, } = event.detail;
|
|
112
|
+
if (sender) {
|
|
113
|
+
this.clearSearch(mouseEvent);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
handleSelectedValues(event) {
|
|
117
|
+
const { sender, selectedOptions } = event.detail;
|
|
118
|
+
if (sender) {
|
|
119
|
+
if (selectedOptions.length > 0) {
|
|
120
|
+
this.clearBtn.classList.add('show');
|
|
121
|
+
this.productListWrap.classList.add('hide');
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
this.clearBtn.classList.remove('show');
|
|
125
|
+
this.productListWrap.classList.remove('hide');
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
render() {
|
|
130
|
+
return (h(Host, { class: 'search-box' }, h("div", { class: "filter-result-wrap white-box" }, h("div", { class: "result-header" }, h("ptc-title", { type: "h3", "title-margin": "margin-flush", upperline: "no-upperline", "title-size": "medium" }, "Filter Result"), h("span", { class: "clear-cta", onClick: (e) => this.clearSearch(e) }, "Clear")), h("div", { class: "sort-wrap" }, h("div", { class: "typeahead-input" }, h("label", { htmlFor: "searchBox" }, "Filter"), h("div", { class: "input-wrap" }, h("svg", { width: "19", height: "18", viewBox: "0 0 19 18", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M0.208984 0V1.2375L6.95898 7.65V14.2875L11.5715 17.8875V7.65L18.209 1.35V0H0.208984Z", fill: "#323B42" })), h("input", { type: "text", value: this.searchTerm, onInput: (event) => this.handleInputChange(event), onKeyUp: (e) => this.handleKeyUp(e), id: 'searchBox' })), this.suggestions.length > 0 &&
|
|
131
|
+
h("div", { class: "suggestion-wrap" }, h("ul", { class: "suggestions" }, this.suggestions.map((suggestion) => (h("li", { onClick: (e) => this.handleSelectSuggestion(suggestion, e) }, suggestion)))))), h("div", { class: "dropdwon-filter" }, h("label", { htmlFor: "tech-dropdown" }, "Technology"), h("ptc-product-dropdown", { placeholder: "Select a technology", id: "tech-dropdown" }, this.suggestionList.sort((a, b) => a.categoryName.localeCompare(b.categoryName)).map((item) => (h("span", null, item.categoryName))))))), h("ptc-spacer", { size: "large" }), h("div", { class: "product-list-wrap white-box" }, h("ptc-title", { type: "h3", "title-margin": "margin-flush", upperline: "no-upperline", "title-size": "medium" }, "Jump to Product"), this.suggestionList.sort((a, b) => a.categoryName.localeCompare(b.categoryName)).map((item) => (h("div", { class: "category-list" }, h("ptc-para", { "font-size": 'x-small', "font-weight": 'w-7', "para-line-h": "line-height-densest", "para-margin": 'margin-flush' }, h("list-item", { "list-type": "list-underline", "link-href": '#' + item.categoryName }, h("ptc-tooltip", { "text-display": "inline", "text-lines": "4", "z-index": "z-2", description: item.categoryName, position: "bottom" }))), h("div", { class: "product-list" }, h("ul", null, item.products.sort((a, b) => a.localeCompare(b)).map((product) => (h("list-item", { "list-type": "list-underline", "link-href": '#' + product }, product)))))))))));
|
|
132
|
+
}
|
|
133
|
+
get hostElement() { return getElement(this); }
|
|
134
|
+
};
|
|
135
|
+
PtcProductSidebar.style = ptcProductSidebarCss;
|
|
136
|
+
|
|
137
|
+
export { PtcProductSidebar as ptc_product_sidebar };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host, a as getElement } from './index-8e63c32d.js';
|
|
2
2
|
|
|
3
|
-
const ptcStickySectionCss = ":host{display:block}:host .stickyEl.sticky{top:0;position:fixed;width:100%;z-index:
|
|
3
|
+
const ptcStickySectionCss = ":host{display:block}:host .stickyEl.sticky{top:0;position:fixed;width:100%;z-index:2000;transition:top 0.5s}";
|
|
4
4
|
|
|
5
5
|
const PtcStickySection = class {
|
|
6
6
|
constructor(hostRef) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, g as getAssetPath, h, H as Host } from './index-8e63c32d.js';
|
|
2
2
|
|
|
3
|
-
const ptcStickyTitleCss = ":host{display:block;position:relative;z-index:3}.sticky-header-container{position:absolute;top:0;left:0;width:100%;height:0;padding:0 24px;background-color:transparent;transition:height 0.3s ease-in-out;display:flex;align-items:flex-end;box-sizing:border-box}@media only screen and (min-width: 768px){.sticky-header-container{align-items:center}}.sticky-header-container.sticky{position:fixed;height:74px;background-image:linear-gradient(272deg, #3b4550, #1a1a1a);z-index:1}.sticky-header-title{width:100%;display:flex;justify-content:flex-start;align-items:center;position:relative}@media only screen and (min-width: 768px){.sticky-header-title{justify-content:center}}.sticky-header-title .logo-image{position:absolute;left:0px;visibility:hidden;transform:translateY(-25px)}@media only screen and (min-width: 768px){.sticky-header-title .logo-image{transform:translateY(0px)}}.sticky-header-title .logo-image.is-visible{visibility:visible}.sticky-header-title .logo-image img{max-height:24px;width:auto}@media only screen and (min-width: 768px){.sticky-header-title .logo-image img{max-height:100%;width:60px}}@media only screen and (min-width: 992px){.sticky-header-title .logo-image img{width:90px}}.sticky-header-title .share-icons{position:absolute;right:0px;visibility:visible;transform:translateY(-25px);transition:visibility 0.3s ease-in-out}@media only screen and (min-width: 768px){.sticky-header-title .share-icons{visibility:hidden}}.sticky-header-title .share-icons ptc-social-share{margin-left:var(--ptc-element-spacing-03)}.sticky-header-title h1{color:#ffffff;font-size:var(--ptc-font-size-small);font-weight:var(--ptc-font-weight-bold);margin-top:var(--ptc-element-spacing-05);margin-bottom:var(--ptc-element-spacing-05)}@media only screen and (min-width: 768px){.sticky-header-title h1{margin-top:0.67em;margin-bottom:0.67em;font-size:var(--ptc-font-size-large)}}ptc-progress-bar{display:none;width:100%}.sticky ptc-progress-bar{position:absolute;bottom:0;left:0;width:100%;display:block}";
|
|
3
|
+
const ptcStickyTitleCss = ":host{display:block;position:relative;z-index:3}.sticky-header-container{position:absolute;top:0;left:0;width:100%;height:0;padding:0 24px;background-color:transparent;transition:visibility 0.3s ease-in-out, opacity 0.3s ease-in-out, height 0.3s ease-in-out;display:flex;opacity:0;visibility:hidden;align-items:flex-end;box-sizing:border-box}@media only screen and (min-width: 768px){.sticky-header-container{align-items:center}}.sticky-header-container.sticky{position:fixed;height:74px;background-image:linear-gradient(272deg, #3b4550, #1a1a1a);z-index:1;visibility:visible;opacity:1}.sticky-header-title{width:100%;display:flex;justify-content:flex-start;align-items:center;position:relative}@media only screen and (min-width: 768px){.sticky-header-title{justify-content:center}}.sticky-header-title .logo-image{position:absolute;left:0px;visibility:hidden;transform:translateY(-25px)}@media only screen and (min-width: 768px){.sticky-header-title .logo-image{transform:translateY(0px)}}.sticky-header-title .logo-image.is-visible{visibility:visible}.sticky-header-title .logo-image img{max-height:24px;width:auto}@media only screen and (min-width: 768px){.sticky-header-title .logo-image img{max-height:100%;width:60px}}@media only screen and (min-width: 992px){.sticky-header-title .logo-image img{width:90px}}.sticky-header-title .share-icons{position:absolute;right:0px;visibility:visible;transform:translateY(-25px);transition:visibility 0.3s ease-in-out}@media only screen and (min-width: 768px){.sticky-header-title .share-icons{visibility:hidden}}.sticky-header-title .share-icons ptc-social-share{margin-left:var(--ptc-element-spacing-03)}.sticky-header-title h1{color:#ffffff;font-size:var(--ptc-font-size-small);font-weight:var(--ptc-font-weight-bold);margin-top:var(--ptc-element-spacing-05);margin-bottom:var(--ptc-element-spacing-05)}@media only screen and (min-width: 768px){.sticky-header-title h1{margin-top:0.67em;margin-bottom:0.67em;font-size:var(--ptc-font-size-large)}}ptc-progress-bar{display:none;width:100%}.sticky ptc-progress-bar{position:absolute;bottom:0;left:0;width:100%;display:block}";
|
|
4
4
|
|
|
5
5
|
const PtcStickyTitle = class {
|
|
6
6
|
constructor(hostRef) {
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { r as registerInstance, h, H as Host, a as getElement } from './index-8e63c32d.js';
|
|
2
|
+
|
|
3
|
+
const ptcTooltipCss = ".sc-ptc-tooltip-h{position:relative}.inline.sc-ptc-tooltip-h{display:inline}.block.sc-ptc-tooltip-h{display:block}.text-ellipsis.sc-ptc-tooltip{position:relative;display:inline}.text-ellipsis.sc-ptc-tooltip:not(.truncated){z-index:auto !important}.z-auto.sc-ptc-tooltip{z-index:auto}.z-1.sc-ptc-tooltip{z-index:1}.z-2.sc-ptc-tooltip{z-index:2}.z-3.sc-ptc-tooltip{z-index:3}.z-999.sc-ptc-tooltip{z-index:999}.tooltip.sc-ptc-tooltip{position:absolute;padding:8px;color:var(--color-white);font-size:var(--ptc-font-size-xxx-small);font-weight:var(--ptc-font-weight-semibold);background:var(--color-gray-09);box-shadow:0px 2px 4px rgba(0, 0, 0, 0.3);border:none;border-radius:2px;width:auto;height:auto;visibility:hidden;text-align:left;text-shadow:none;white-space:normal}@media only screen and (min-width: 480px){.tooltip.sc-ptc-tooltip{width:273px}}.tooltip.danger.sc-ptc-tooltip{color:var(--color-red-07);font-family:var(--ptc-font-latin);font-weight:var(--ptc-font-weight-semibold);font-size:var(--ptc-font-size-xx-small);line-height:var(--ptc-line-height-p);border:2px solid var(--color-red-07);border-radius:var(--ptc-border-radius-standard);background-color:var(--color-white);padding:var(--ptc-element-spacing-06)}.tooltip.danger.sc-ptc-tooltip a.sc-ptc-tooltip{color:var(--color-blue-07)}.tooltip.bottom.sc-ptc-tooltip{bottom:-12px;transform:translateY(100%)}.tooltip.bottom.sc-ptc-tooltip::after{top:1px;left:50%;transform:translate(-50%, -100%);border:8px solid transparent;border-bottom:8px solid var(--color-gray-09)}.tooltip.left.sc-ptc-tooltip{bottom:-12px;transform:translate(-80%, 100%)}.tooltip.left.sc-ptc-tooltip::after{top:1px;right:8px;transform:translateY(-100%);border:8px solid transparent;border-bottom:8px solid var(--color-gray-09)}.tooltip.right.sc-ptc-tooltip{bottom:-12px;transform:translateY(100%);right:0px}@-moz-document url-prefix(){.tooltip.right{right:unset !important;bottom:unset !important;transform:translate(60%, 8px) !important}@media screen and (min-width: 992px){.tooltip.right{transform:translate(100%, 8px) !important}}}.tooltip.right.sc-ptc-tooltip::after{top:1px;left:8px;transform:translateY(-100%);border:8px solid transparent;border-bottom:8px solid var(--color-gray-09)}.tooltip.top.sc-ptc-tooltip{top:-8px;transform:translateY(-100%)}.tooltip.top.sc-ptc-tooltip::after{left:50%;bottom:1px;transform:translate(-50%, 100%);border:8px solid transparent;border-top:8px solid var(--color-gray-09)}.tooltip.bottom-right.sc-ptc-tooltip{bottom:-12px;transform:translate(-60%, 100%)}.tooltip.bottom-right.sc-ptc-tooltip::after{top:1px;left:75%;transform:translate(-50%, -100%);border:8px solid transparent;border-bottom:8px solid var(--color-gray-09)}.tooltip.danger.sc-ptc-tooltip::after{top:0;border-bottom:8px solid var(--color-red-07)}.truncated.sc-ptc-tooltip{cursor:help}.truncated.sc-ptc-tooltip:hover+.tooltip.sc-ptc-tooltip{visibility:visible;z-index:9999}.wrapper-content.sc-ptc-tooltip{display:inline-block;position:relative}.wrapper-content.sc-ptc-tooltip .tooltip.sc-ptc-tooltip{width:auto;min-width:72px;max-width:273px}.wrapper-content.sc-ptc-tooltip .slot-content.sc-ptc-tooltip:hover+.tooltip.sc-ptc-tooltip{visibility:visible;z-index:9999}.tooltip.sc-ptc-tooltip::after{content:\"\";position:absolute}.ellipsis-by-line-boxing.sc-ptc-tooltip{display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;overflow-wrap:break-word;padding-bottom:0}.full-width.sc-ptc-tooltip-h .tooltip.sc-ptc-tooltip{width:100%}@media only screen and (min-width: 480px){.full-width.sc-ptc-tooltip-h .tooltip.sc-ptc-tooltip{width:100%}}";
|
|
4
|
+
|
|
5
|
+
const PtcTooltip = class {
|
|
6
|
+
constructor(hostRef) {
|
|
7
|
+
registerInstance(this, hostRef);
|
|
8
|
+
this.textDisplay = 'inline';
|
|
9
|
+
this.maxLength = 45;
|
|
10
|
+
this.textLines = undefined;
|
|
11
|
+
this.description = 'This is a tooltip text placeholder';
|
|
12
|
+
this.zIndex = 'z-auto';
|
|
13
|
+
this.position = 'bottom';
|
|
14
|
+
this.styles = undefined;
|
|
15
|
+
this.mode = 'text-only';
|
|
16
|
+
this.theme = 'standard';
|
|
17
|
+
this.width = 'default';
|
|
18
|
+
this.hideOnMobile = false;
|
|
19
|
+
this.isSmallScreen = undefined;
|
|
20
|
+
}
|
|
21
|
+
addTruncatedClass() {
|
|
22
|
+
const appRoot = this.el;
|
|
23
|
+
const text = appRoot.querySelectorAll('.ellipsis-by-line-boxing');
|
|
24
|
+
text.forEach(t => {
|
|
25
|
+
t.classList[t.scrollHeight > t.clientHeight ? 'add' : 'remove']('truncated');
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
windowResize() {
|
|
29
|
+
this.verifiyScreenSize();
|
|
30
|
+
}
|
|
31
|
+
verifiyScreenSize() {
|
|
32
|
+
this.isSmallScreen = window.innerWidth < 768;
|
|
33
|
+
}
|
|
34
|
+
// Created this function to initialize the truncate function on specific elements like tabs
|
|
35
|
+
enableAddTruncatedClass(element) {
|
|
36
|
+
const allTabHeaders = document.querySelectorAll(element);
|
|
37
|
+
for (const element of Array.from(allTabHeaders)) {
|
|
38
|
+
let tabHeader = element;
|
|
39
|
+
if (tabHeader) {
|
|
40
|
+
tabHeader.addEventListener('click', () => {
|
|
41
|
+
setTimeout(() => {
|
|
42
|
+
this.addTruncatedClass();
|
|
43
|
+
}, 100);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
componentWillLoad() {
|
|
49
|
+
this.verifiyScreenSize();
|
|
50
|
+
}
|
|
51
|
+
componentDidLoad() {
|
|
52
|
+
//this.addTruncatedClass();
|
|
53
|
+
setTimeout(() => {
|
|
54
|
+
this.addTruncatedClass();
|
|
55
|
+
}, 1000);
|
|
56
|
+
this.enableAddTruncatedClass('tab-header');
|
|
57
|
+
this.enableAddTruncatedClass('ptc-ellipsis-dropdown');
|
|
58
|
+
this.enableAddTruncatedClass('ptc-product-card');
|
|
59
|
+
document.addEventListener('readystatechange', () => {
|
|
60
|
+
if (document.readyState === 'complete') {
|
|
61
|
+
this.addTruncatedClass();
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
render() {
|
|
66
|
+
if (this.mode == 'wrapper') {
|
|
67
|
+
return (h(Host, { class: this.textDisplay }, this.styles && h("style", null, this.styles), h("div", { class: "wrapper-content" }, h("div", { class: "slot-content" }, h("slot", null)), h("div", { class: `tooltip ${this.position} ${this.theme}` }, h("slot", { name: "description" }), this.description))));
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
const classMap = this.getCssClassMap();
|
|
71
|
+
const cutOff = this.getLineCuttoff();
|
|
72
|
+
let truncatedText = this.description.substring(0, this.maxLength);
|
|
73
|
+
if (this.description.length > this.maxLength) {
|
|
74
|
+
const lastSpace = truncatedText.lastIndexOf(' ');
|
|
75
|
+
truncatedText = truncatedText.substring(0, lastSpace);
|
|
76
|
+
truncatedText += '... ';
|
|
77
|
+
}
|
|
78
|
+
return (h(Host, { class: this.textDisplay + " " + this.width }, this.styles && h("style", null, this.styles), (this.hideOnMobile && this.isSmallScreen) ? (h("div", null, this.description)) : (h("div", null, this.textLines > 0 && !!this.textLines ? (h("div", { class: "ellipsis-by-line-boxing", style: cutOff }, this.description)) : (h("div", { class: classMap }, truncatedText)), h("div", { class: `tooltip ${this.position} ${this.theme}` }, this.description)))));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
getCssClassMap() {
|
|
82
|
+
return {
|
|
83
|
+
// ['ellipsis-by-line-boxing']: this.textLines && this.textLines > 0,
|
|
84
|
+
['text-ellipsis']: true,
|
|
85
|
+
[this.zIndex]: this.description.length > this.maxLength ? true : false,
|
|
86
|
+
['truncated']: this.description.length > this.maxLength && !this.textLines ? true : false,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
getLineCuttoff() {
|
|
90
|
+
let result;
|
|
91
|
+
if (this.textLines && this.textLines > 0) {
|
|
92
|
+
result = {
|
|
93
|
+
['-webkit-line-clamp']: `${this.textLines}`,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
get el() { return getElement(this); }
|
|
99
|
+
};
|
|
100
|
+
PtcTooltip.style = ptcTooltipCss;
|
|
101
|
+
|
|
102
|
+
export { PtcTooltip as ptc_tooltip };
|