@ptcwebops/ptcw-design 5.8.9 → 5.9.1
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/blog-detail-content_21.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/ptc-collapse-list.cjs.entry.js +7 -6
- package/dist/cjs/ptc-ellipsis-dropdown.cjs.entry.js +128 -3
- package/dist/cjs/ptc-tab-list.cjs.entry.js +110 -2
- package/dist/cjs/ptc-value-led-layout.cjs.entry.js +7 -6
- package/dist/cjs/ptcw-design.cjs.js +1 -1
- package/dist/cjs/tab-content.cjs.entry.js +12 -2
- package/dist/cjs/tab-header.cjs.entry.js +7 -1
- package/dist/collection/components/ptc-collapse-list/ptc-collapse-list.js +7 -6
- package/dist/collection/components/ptc-ellipsis-dropdown/ptc-ellipsis-dropdown.css +8 -0
- package/dist/collection/components/ptc-ellipsis-dropdown/ptc-ellipsis-dropdown.js +138 -2
- package/dist/collection/components/ptc-jumbotron/ptc-jumbotron.css +7 -5
- package/dist/collection/components/ptc-tab-list/ptc-tab-list.css +5 -1
- package/dist/collection/components/ptc-tab-list/ptc-tab-list.js +148 -2
- package/dist/collection/components/ptc-value-led-layout/ptc-value-led-layout.js +7 -12
- package/dist/collection/components/tab-content/tab-content.css +0 -7
- package/dist/collection/components/tab-content/tab-content.js +11 -1
- package/dist/collection/components/tab-header/tab-header.css +12 -0
- package/dist/collection/components/tab-header/tab-header.js +6 -0
- package/dist/custom-elements/index.js +275 -24
- package/dist/esm/blog-detail-content_21.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/ptc-collapse-list.entry.js +7 -6
- package/dist/esm/ptc-ellipsis-dropdown.entry.js +128 -3
- package/dist/esm/ptc-tab-list.entry.js +110 -2
- package/dist/esm/ptc-value-led-layout.entry.js +7 -6
- package/dist/esm/ptcw-design.js +1 -1
- package/dist/esm/tab-content.entry.js +13 -3
- package/dist/esm/tab-header.entry.js +8 -2
- package/dist/ptcw-design/p-2c2f895a.entry.js +1 -0
- package/dist/ptcw-design/p-37480ed1.entry.js +1 -0
- package/dist/ptcw-design/p-38a56ed6.entry.js +1 -0
- package/dist/ptcw-design/p-5441b0b9.entry.js +1 -0
- package/dist/ptcw-design/p-8038bf31.entry.js +1 -0
- package/dist/ptcw-design/p-849655f7.entry.js +1 -0
- package/dist/ptcw-design/p-f618e1d4.entry.js +1 -0
- package/dist/ptcw-design/ptcw-design.esm.js +1 -1
- package/dist/types/components/ptc-ellipsis-dropdown/ptc-ellipsis-dropdown.d.ts +12 -0
- package/dist/types/components/ptc-tab-list/ptc-tab-list.d.ts +12 -0
- package/dist/types/components/ptc-value-led-layout/ptc-value-led-layout.d.ts +0 -1
- package/dist/types/components/tab-content/tab-content.d.ts +4 -0
- package/dist/types/components/tab-header/tab-header.d.ts +1 -0
- package/dist/types/components.d.ts +2 -0
- package/dist/types/utils/interfaces.d.ts +2 -0
- package/package.json +1 -1
- package/readme.md +1 -1
- package/dist/ptcw-design/p-21a3fd97.entry.js +0 -1
- package/dist/ptcw-design/p-47c97f32.entry.js +0 -1
- package/dist/ptcw-design/p-5a96b4ce.entry.js +0 -1
- package/dist/ptcw-design/p-5d8333af.entry.js +0 -1
- package/dist/ptcw-design/p-754fe9f4.entry.js +0 -1
- package/dist/ptcw-design/p-904abfc9.entry.js +0 -1
- package/dist/ptcw-design/p-c642d666.entry.js +0 -1
|
@@ -4,12 +4,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-63ddc79c.js');
|
|
6
6
|
|
|
7
|
-
const ptcEllipsisDropdownCss = "h1,h2,h3,h4,h5,h6,p,ul,li,ptc-subnav,ptc-tab-list,ptc-link,ptc-square-card,.hyphenate-text,ptc-footer{word-break:break-word;hyphens:manual;-webkit-hyphens:manual;-moz-hyphens:manual;-ms-hyphens:manual}@supports (hyphenate-limit-chars: 12 3 3){h1,h2,h3,h4,h5,h6,p,ul,li,ptc-subnav,ptc-tab-list,ptc-link,ptc-square-card,.hyphenate-text,ptc-footer{hyphens:auto;-webkit-hyphenate-limit-before:3;-webkit-hyphenate-limit-after:3;hyphenate-limit-chars:12 3 3;hyphenate-limit-lines:2;hyphenate-limit-last:always;hyphenate-limit-zone:6%;-webkit-hyphens:auto;-webkit-hyphenate-limit-before:3;-webkit-hyphenate-limit-after:3;-webkit-hyphenate-limit-chars:12 3 3;-webkit-hyphenate-limit-lines:2;-moz-hyphens:auto;-moz-hyphenate-limit-chars:12 3 3;-moz-hyphenate-limit-lines:2;-ms-hyphens:auto;-ms-hyphenate-limit-chars:12 3 3;-ms-hyphenate-limit-lines:2}}.ellipsis-icon{box-sizing:border-box;border:1px solid var(--color-gray-08);border-radius:2px;vertical-align:middle;height:18px;width:18px;text-align:center;display:flex;align-items:center;justify-content:center;transition:background-color var(--ptc-ease-out) var(--ptc-transition-medium), border-color var(--ptc-ease-out) var(--ptc-transition-medium)}.ellipsis-icon:hover{background-color:var(--color-gray-04);border-color:var(--color-gray-04)}.ellipsis-icon icon-asset{display:inline-block}.ellipsis-icon icon-asset svg{margin:0 auto;display:block;width:10px !important;height:10px !important}.ellipsis-icon.active{background-color:var(--color-green-07);border-color:var(--color-green-07)}.ellipsis-icon.active::after{content:\"\";width:32px;height:2px;display:inline-block;background-color:var(--color-green-07);position:absolute;bottom:-11px}@media only screen and (min-width: 1440px){.ellipsis-icon.active::after{bottom:-17px}}.ptc-ellipsis-dropdown{position:relative;display:inline-block;cursor:pointer;padding:2px 0 14px 0;border-bottom:2px solid var(--color-green-07);margin:0 1rem -1px 1rem;box-sizing:border-box}@media only screen and (min-width: 768px){.ptc-ellipsis-dropdown.default{padding:0px;border-bottom:none;margin:0;height:44px;width:44px;display:flex;justify-content:center;align-content:center;flex-wrap:wrap}}.ptc-ellipsis-dropdown.tab-with-banner{padding:0px 0 16px 0;margin:0 1rem -2.5px 1rem}@media only screen and (min-width: 992px){.ptc-ellipsis-dropdown.tab-with-banner{padding:0px 0px 1rem 0px;border-bottom:none;margin:0;height:100%;width:44px;display:flex;justify-content:center;align-content:center;flex-wrap:wrap}}.ptc-ellipsis-dropdown.tab-with-banner .ellipsis-icon.active::after{bottom:-2px}.ptc-ellipsis-dropdown.tab-with-banner .dropdown-container{display:none;margin-top:16px;box-shadow:0 6px 16px rgba(0, 0, 0, 0.24);border-radius:4px;position:absolute;z-index:1010;background:var(--color-white);padding:0.8rem 0;right:auto;left:0;min-width:max-content;width:100%}@media only screen and (min-width: 992px){.ptc-ellipsis-dropdown.tab-with-banner .dropdown-container{right:0;left:auto;top:50%;margin-top:22px}}.ptc-ellipsis-dropdown.tab-with-banner.show .dropdown-container{display:inline-block}@media only screen and (min-width: 1440px){.ptc-ellipsis-dropdown{height:34px;width:34px}}.ptc-ellipsis-dropdown .mob-drop{color:var(--color-gray-10);font-size:var(--ptc-font-size-small);font-weight:var(--ptc-font-weight-bold);line-height:var(--ptc-line-height-p);font-family:\"Raleway\";font-style:normal;display:flex;align-items:center}.ptc-ellipsis-dropdown .mob-drop svg{display:inline-block;vertical-align:middle;margin:4px 0px 0px 12px;min-width:12px}.dropdown-container{display:none;margin-top:16px;box-shadow:0 6px 16px rgba(0, 0, 0, 0.24);border-radius:4px;position:absolute;z-index:1010;background:var(--color-white);padding:0.8rem 0;right:auto;left:0;min-width:max-content;width:100%}@media only screen and (min-width: 768px){.dropdown-container{right:0;left:auto;margin-top:48px}}@media only screen and (min-width: 1440px){.dropdown-container{margin-top:45px}}.dropdown-container .selected-drop .dropdown-item span{position:relative;font-weight:var(--ptc-font-weight-bold)}.dropdown-container .selected-drop .dropdown-item span::before{content:\"\";width:2px;height:60%;background:var(--color-green-07);display:block;left:16px;position:absolute;top:20%}.show .dropdown-container{display:inline-block}";
|
|
7
|
+
const ptcEllipsisDropdownCss = "h1,h2,h3,h4,h5,h6,p,ul,li,ptc-subnav,ptc-tab-list,ptc-link,ptc-square-card,.hyphenate-text,ptc-footer{word-break:break-word;hyphens:manual;-webkit-hyphens:manual;-moz-hyphens:manual;-ms-hyphens:manual}@supports (hyphenate-limit-chars: 12 3 3){h1,h2,h3,h4,h5,h6,p,ul,li,ptc-subnav,ptc-tab-list,ptc-link,ptc-square-card,.hyphenate-text,ptc-footer{hyphens:auto;-webkit-hyphenate-limit-before:3;-webkit-hyphenate-limit-after:3;hyphenate-limit-chars:12 3 3;hyphenate-limit-lines:2;hyphenate-limit-last:always;hyphenate-limit-zone:6%;-webkit-hyphens:auto;-webkit-hyphenate-limit-before:3;-webkit-hyphenate-limit-after:3;-webkit-hyphenate-limit-chars:12 3 3;-webkit-hyphenate-limit-lines:2;-moz-hyphens:auto;-moz-hyphenate-limit-chars:12 3 3;-moz-hyphenate-limit-lines:2;-ms-hyphens:auto;-ms-hyphenate-limit-chars:12 3 3;-ms-hyphenate-limit-lines:2}}.ellipsis-icon{box-sizing:border-box;border:1px solid var(--color-gray-08);border-radius:2px;vertical-align:middle;height:18px;width:18px;text-align:center;display:flex;align-items:center;justify-content:center;transition:background-color var(--ptc-ease-out) var(--ptc-transition-medium), border-color var(--ptc-ease-out) var(--ptc-transition-medium)}.ellipsis-icon:hover{background-color:var(--color-gray-04);border-color:var(--color-gray-04)}.ellipsis-icon icon-asset{display:inline-block}.ellipsis-icon icon-asset svg{margin:0 auto;display:block;width:10px !important;height:10px !important}.ellipsis-icon.active{background-color:var(--color-green-07);border-color:var(--color-green-07)}.ellipsis-icon.active::after{content:\"\";width:32px;height:2px;display:inline-block;background-color:var(--color-green-07);position:absolute;bottom:-11px}@media only screen and (min-width: 1440px){.ellipsis-icon.active::after{bottom:-17px}}.ptc-ellipsis-dropdown{position:relative;display:inline-block;cursor:pointer;padding:2px 0 14px 0;border-bottom:2px solid var(--color-green-07);margin:0 1rem -1px 1rem;box-sizing:border-box}@media only screen and (min-width: 768px){.ptc-ellipsis-dropdown.default{padding:0px;border-bottom:none;margin:0;height:44px;width:44px;display:flex;justify-content:center;align-content:center;flex-wrap:wrap}}.ptc-ellipsis-dropdown.tab-with-banner{padding:0px 0 16px 0;margin:0 1rem -2.5px 1rem}@media only screen and (min-width: 992px){.ptc-ellipsis-dropdown.tab-with-banner{padding:0px 0px 1rem 0px;border-bottom:none;margin:0;height:100%;width:44px;display:flex;justify-content:center;align-content:center;flex-wrap:wrap}}.ptc-ellipsis-dropdown.tab-with-banner .ellipsis-icon.active::after{bottom:-2px}.ptc-ellipsis-dropdown.tab-with-banner .dropdown-container{display:none;margin-top:16px;box-shadow:0 6px 16px rgba(0, 0, 0, 0.24);border-radius:4px;position:absolute;z-index:1010;background:var(--color-white);padding:0.8rem 0;right:auto;left:0;min-width:max-content;width:100%}@media only screen and (min-width: 992px){.ptc-ellipsis-dropdown.tab-with-banner .dropdown-container{right:0;left:auto;top:50%;margin-top:22px}}.ptc-ellipsis-dropdown.tab-with-banner.show .dropdown-container{display:inline-block}@media only screen and (min-width: 1440px){.ptc-ellipsis-dropdown{height:34px;width:34px}}.ptc-ellipsis-dropdown .mob-drop{color:var(--color-gray-10);font-size:var(--ptc-font-size-small);font-weight:var(--ptc-font-weight-bold);line-height:var(--ptc-line-height-p);font-family:\"Raleway\";font-style:normal;display:flex;align-items:center}.ptc-ellipsis-dropdown .mob-drop svg{display:inline-block;vertical-align:middle;margin:4px 0px 0px 12px;min-width:12px}.dropdown-container{display:none;margin-top:16px;box-shadow:0 6px 16px rgba(0, 0, 0, 0.24);border-radius:4px;position:absolute;z-index:1010;background:var(--color-white);padding:0.8rem 0;right:auto;left:0;min-width:max-content;width:100%}@media only screen and (min-width: 768px){.dropdown-container{right:0;left:auto;margin-top:48px}}@media only screen and (min-width: 1440px){.dropdown-container{margin-top:45px}}.dropdown-container .selected-drop .dropdown-item span{position:relative;font-weight:var(--ptc-font-weight-bold)}.dropdown-container .selected-drop .dropdown-item span::before{content:\"\";width:2px;height:60%;background:var(--color-green-07);display:block;left:16px;position:absolute;top:20%}.show .dropdown-container{display:inline-block}dropdown-item:focus-visible{outline:none}dropdown-item:focus-visible .dropdown-item{border-radius:var(--ptc-border-radius-standard);outline:5px solid var(--keyboard-nav-outline)}";
|
|
8
8
|
|
|
9
9
|
const PtcEllipsisDropdown = class {
|
|
10
10
|
constructor(hostRef) {
|
|
11
11
|
index.registerInstance(this, hostRef);
|
|
12
12
|
this.itemSelected = index.createEvent(this, "itemSelected", 7);
|
|
13
|
+
this.menuitemNodes = [];
|
|
14
|
+
this.firstMenuitem = false;
|
|
15
|
+
this.lastMenuitem = false;
|
|
13
16
|
this.dataItems = [];
|
|
14
17
|
this.selectedTab = undefined;
|
|
15
18
|
this.isDropdownOpen = false;
|
|
@@ -17,6 +20,7 @@ const PtcEllipsisDropdown = class {
|
|
|
17
20
|
this.isIPad = undefined;
|
|
18
21
|
this.dropdownType = "default";
|
|
19
22
|
}
|
|
23
|
+
//firstChars = [];
|
|
20
24
|
dropdownToggle(e) {
|
|
21
25
|
e.currentTarget.classList.toggle("show");
|
|
22
26
|
this.isDropdownOpen = e.currentTarget.classList.contains("show");
|
|
@@ -35,20 +39,141 @@ const PtcEllipsisDropdown = class {
|
|
|
35
39
|
this.isMobile = window.innerWidth < 768;
|
|
36
40
|
this.isIPad = window.innerWidth < 992 || screen.width < 992;
|
|
37
41
|
}
|
|
42
|
+
onEscClicked() {
|
|
43
|
+
var _a;
|
|
44
|
+
let container = (_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.ptc-ellipsis-dropdown');
|
|
45
|
+
//this.host.focus();
|
|
46
|
+
if (container) {
|
|
47
|
+
container.classList.remove('show');
|
|
48
|
+
this.isDropdownOpen = false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
38
51
|
componentWillLoad() {
|
|
39
52
|
this.isMobile = window.innerWidth < 768;
|
|
40
53
|
this.isIPad = window.innerWidth < 992 || screen.width < 992;
|
|
41
54
|
}
|
|
55
|
+
onMenuitemKeydown(event) {
|
|
56
|
+
var tgt = event.currentTarget, key = event.key, flag = false;
|
|
57
|
+
if (event.ctrlKey || event.altKey || event.metaKey) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (event.shiftKey) ;
|
|
61
|
+
else {
|
|
62
|
+
switch (key) {
|
|
63
|
+
case 'Up':
|
|
64
|
+
case 'ArrowUp':
|
|
65
|
+
this.setFocusToPreviousMenuitem(tgt);
|
|
66
|
+
flag = true;
|
|
67
|
+
break;
|
|
68
|
+
case 'ArrowDown':
|
|
69
|
+
case 'Down':
|
|
70
|
+
this.setFocusToNextMenuitem(tgt);
|
|
71
|
+
flag = true;
|
|
72
|
+
break;
|
|
73
|
+
case 'Home':
|
|
74
|
+
case 'PageUp':
|
|
75
|
+
this.setFocusToFirstMenuitem();
|
|
76
|
+
flag = true;
|
|
77
|
+
break;
|
|
78
|
+
case 'End':
|
|
79
|
+
case 'PageDown':
|
|
80
|
+
this.setFocusToLastMenuitem();
|
|
81
|
+
flag = true;
|
|
82
|
+
break;
|
|
83
|
+
case 'Tab':
|
|
84
|
+
this.onEscClicked();
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (flag) {
|
|
89
|
+
event.stopPropagation();
|
|
90
|
+
event.preventDefault();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
setFocusToMenuitem(newMenuitem) {
|
|
94
|
+
this.menuitemNodes.forEach(function (item) {
|
|
95
|
+
if (item === newMenuitem) {
|
|
96
|
+
item.tabIndex = 0;
|
|
97
|
+
newMenuitem.focus();
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
item.tabIndex = -1;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
setFocusToFirstMenuitem() {
|
|
105
|
+
this.setFocusToMenuitem(this.firstMenuitem);
|
|
106
|
+
}
|
|
107
|
+
setFocusToLastMenuitem() {
|
|
108
|
+
this.setFocusToMenuitem(this.lastMenuitem);
|
|
109
|
+
}
|
|
110
|
+
setFocusToPreviousMenuitem(currentMenuitem) {
|
|
111
|
+
var newMenuitem, index;
|
|
112
|
+
if (currentMenuitem === this.firstMenuitem) {
|
|
113
|
+
newMenuitem = this.lastMenuitem;
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
index = this.menuitemNodes.indexOf(currentMenuitem);
|
|
117
|
+
newMenuitem = this.menuitemNodes[index - 1];
|
|
118
|
+
}
|
|
119
|
+
this.setFocusToMenuitem(newMenuitem);
|
|
120
|
+
return newMenuitem;
|
|
121
|
+
}
|
|
122
|
+
setFocusToNextMenuitem(currentMenuitem) {
|
|
123
|
+
var newMenuitem, index;
|
|
124
|
+
if (currentMenuitem === this.lastMenuitem) {
|
|
125
|
+
newMenuitem = this.firstMenuitem;
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
index = this.menuitemNodes.indexOf(currentMenuitem);
|
|
129
|
+
newMenuitem = this.menuitemNodes[index + 1];
|
|
130
|
+
}
|
|
131
|
+
this.setFocusToMenuitem(newMenuitem);
|
|
132
|
+
return newMenuitem;
|
|
133
|
+
}
|
|
134
|
+
componentDidLoad() {
|
|
135
|
+
setTimeout(() => {
|
|
136
|
+
this.menuitems = this.host.shadowRoot.querySelectorAll('dropdown-item');
|
|
137
|
+
for (var i = 0; i < this.menuitems.length; i++) {
|
|
138
|
+
var menuitem = this.menuitems[i];
|
|
139
|
+
this.menuitemNodes.push(menuitem);
|
|
140
|
+
menuitem.tabIndex = -1;
|
|
141
|
+
menuitem.addEventListener('keydown', this.onMenuitemKeydown.bind(this));
|
|
142
|
+
if (!this.firstMenuitem) {
|
|
143
|
+
this.firstMenuitem = menuitem;
|
|
144
|
+
}
|
|
145
|
+
this.lastMenuitem = menuitem;
|
|
146
|
+
}
|
|
147
|
+
}, 100);
|
|
148
|
+
const ellp = this.host.shadowRoot.querySelector('.ptc-ellipsis-dropdown');
|
|
149
|
+
this.host.addEventListener('keydown', (event) => {
|
|
150
|
+
// Open dropdown on 'Enter' key press
|
|
151
|
+
if (event.key === 'Enter') {
|
|
152
|
+
ellp.click();
|
|
153
|
+
}
|
|
154
|
+
if (event.key === 'ArrowDown') {
|
|
155
|
+
this.host.shadowRoot.querySelectorAll('dropdown-item')[0].focus();
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
if (this.isMobile || (this.isIPad && this.dropdownType === 'tab-with-banner')) {
|
|
159
|
+
this.host.setAttribute('tabindex', '0');
|
|
160
|
+
}
|
|
161
|
+
}
|
|
42
162
|
render() {
|
|
43
163
|
let activeTab = this.dataItems.find(z => z.isSelected == true);
|
|
44
164
|
let isActive = false;
|
|
45
165
|
if (activeTab) {
|
|
46
166
|
isActive = true;
|
|
47
167
|
}
|
|
48
|
-
return (index.h("div", { class: this.dropdownType == 'tab-with-banner' ? "ptc-ellipsis-dropdown tab-with-banner" : "ptc-ellipsis-dropdown default", onClick: (e) => this.dropdownToggle(e) }, (this.isMobile || (this.isIPad && this.dropdownType === 'tab-with-banner')) ? (index.h("div", { class: 'mob-drop' }, index.h("span", { class: 'opt-name' }, this.dataItems.map((item) => item.isSelected ? item.text : '')), index.h("svg", { width: "12", height: "9", viewBox: "0 0 12 9", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M1 1.65723L5.94975 6.60697L10.8995 1.65723", stroke: "#00890B", "stroke-width": "2", "stroke-linecap": "round" })))) : (index.h("div", { class: isActive || this.isDropdownOpen ? "ellipsis-icon active" : "ellipsis-icon" }, index.h("icon-asset", { type: "ptc", size: "xxx-small", name: "ellipsis", color: isActive || this.isDropdownOpen ? 'white' : 'black' }))), index.h("div", { class: "dropdown-container" }, index.h("slot", { name: "dropdown" }), this.dataItems.map(dataItem => {
|
|
168
|
+
return (index.h("div", { class: this.dropdownType == 'tab-with-banner' ? "ptc-ellipsis-dropdown tab-with-banner" : "ptc-ellipsis-dropdown default", onClick: (e) => this.dropdownToggle(e) }, (this.isMobile || (this.isIPad && this.dropdownType === 'tab-with-banner')) ? (index.h("div", { class: 'mob-drop' }, index.h("span", { class: 'opt-name' }, this.dataItems.map((item) => item.isSelected ? item.text : '')), index.h("svg", { width: "12", height: "9", viewBox: "0 0 12 9", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("path", { d: "M1 1.65723L5.94975 6.60697L10.8995 1.65723", stroke: "#00890B", "stroke-width": "2", "stroke-linecap": "round" })))) : (index.h("div", { class: isActive || this.isDropdownOpen ? "ellipsis-icon active" : "ellipsis-icon" }, index.h("icon-asset", { type: "ptc", size: "xxx-small", name: "ellipsis", color: isActive || this.isDropdownOpen ? 'white' : 'black' }))), index.h("div", { class: "dropdown-container", role: "menu", "aria-labelledby": "menubutton1" }, index.h("slot", { name: "dropdown" }), this.dataItems.map((dataItem) => {
|
|
49
169
|
let activeClass = dataItem.value == this.selectedTab ? 'active' : '';
|
|
50
170
|
let activeDropdown = dataItem.isSelected ? 'selected-drop' : '';
|
|
51
|
-
return (index.h("dropdown-item", { class: activeClass + activeDropdown + 'mf-listen'
|
|
171
|
+
return (index.h("dropdown-item", { role: "menuitem", class: activeClass + activeDropdown + 'mf-listen', onKeyDown: (e) => {
|
|
172
|
+
if (e.key === 'Enter') {
|
|
173
|
+
e.preventDefault();
|
|
174
|
+
this.onItemSelected(dataItem);
|
|
175
|
+
}
|
|
176
|
+
} }, index.h("span", { onClick: (e) => {
|
|
52
177
|
e.preventDefault();
|
|
53
178
|
this.onItemSelected(dataItem);
|
|
54
179
|
} }, dataItem.text)));
|
|
@@ -4,16 +4,21 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-63ddc79c.js');
|
|
6
6
|
|
|
7
|
-
const ptcTabListCss = "h1,h2,h3,h4,h5,h6,p,ul,li,ptc-subnav,ptc-tab-list,ptc-link,ptc-square-card,.hyphenate-text,ptc-footer{word-break:break-word;hyphens:manual;-webkit-hyphens:manual;-moz-hyphens:manual;-ms-hyphens:manual}@supports (hyphenate-limit-chars: 12 3 3){h1,h2,h3,h4,h5,h6,p,ul,li,ptc-subnav,ptc-tab-list,ptc-link,ptc-square-card,.hyphenate-text,ptc-footer{hyphens:auto;-webkit-hyphenate-limit-before:3;-webkit-hyphenate-limit-after:3;hyphenate-limit-chars:12 3 3;hyphenate-limit-lines:2;hyphenate-limit-last:always;hyphenate-limit-zone:6%;-webkit-hyphens:auto;-webkit-hyphenate-limit-before:3;-webkit-hyphenate-limit-after:3;-webkit-hyphenate-limit-chars:12 3 3;-webkit-hyphenate-limit-lines:2;-moz-hyphens:auto;-moz-hyphenate-limit-chars:12 3 3;-moz-hyphenate-limit-lines:2;-ms-hyphens:auto;-ms-hyphenate-limit-chars:12 3 3;-ms-hyphenate-limit-lines:2}}ptc-tab-list{display:block;position:relative;color:var(--color-gray-12)}ptc-tab-list.tab-with-banner{background-color:var(--color-white);padding:24px 16px 16px 16px;border-radius:4px}@media only screen and (min-width: 992px){ptc-tab-list.tab-with-banner{padding:24px}}ptc-tab-list.tab-with-banner .tabs-content{padding:16px 0 0 0}ptc-tab-list.tab-with-banner .tabs-content p:not(video-js p),ptc-tab-list.tab-with-banner .tabs-content span:not(video-js span),ptc-tab-list.tab-with-banner .tabs-content h1:not(video-js h1),ptc-tab-list.tab-with-banner .tabs-content h2:not(video-js h2),ptc-tab-list.tab-with-banner .tabs-content h3:not(video-js h3),ptc-tab-list.tab-with-banner .tabs-content h4:not(video-js h4),ptc-tab-list.tab-with-banner .tabs-content h5:not(video-js h5),ptc-tab-list.tab-with-banner .tabs-content h6:not(video-js h6),ptc-tab-list.tab-with-banner .tabs-content ul:not(video-js ul),ptc-tab-list.tab-with-banner .tabs-content li:not(video-js li),ptc-tab-list.tab-with-banner .tabs-content table:not(video-js table){color:var(--color-gray-12)}@media only screen and (min-width: 992px){ptc-tab-list.tab-with-banner .tabs-content{padding:24px 0 0 0}}@media only screen and (min-width: 992px){ptc-tab-list.tab-with-banner .tabs-header{align-items:stretch;padding-left:0rem;width:calc(100% - 44px);display:flex;justify-content:space-between;align-items:center;flex-direction:row;padding-right:0}ptc-tab-list.tab-with-banner tab-header{padding:0 16px;display:flex;align-items:center;flex:1 0 0;align-self:stretch;text-align:center;flex-direction:column;align-items:center}}ptc-tab-list.tab-with-banner .tab-header{padding:0 0 1rem 0}@media only screen and (min-width: 992px){ptc-tab-list.tab-with-banner .tab-header{min-width:200px;white-space:normal;height:100%;align-content:center;transition:var(--ptc-transition-medium) var(--ptc-ease-inout);-webkit-transition:var(--ptc-transition-medium) var(--ptc-ease-inout);-o-transition:var(--ptc-transition-medium) var(--ptc-ease-inout)}ptc-tab-list.tab-with-banner .tab-header:hover{color:var(--color-gray-10)}}@media (min-width: 1080px){ptc-tab-list.tab-with-banner .tab-header{min-width:230px}}@media only screen and (min-width: 1200px){ptc-tab-list.tab-with-banner .tab-header{min-width:200px}}@media only screen and (min-width: 1440px){ptc-tab-list.tab-with-banner .tab-header{min-width:175px}}ptc-tab-list.tab-with-banner .tabs-header-container{display:flex}.tabs-header-container{width:100%;border-bottom:2px solid var(--color-gray-02);position:relative}.tabs-header{display:flex;padding-left:1.5rem;padding-right:1.5rem;transition:opacity ease-out 250ms;opacity:0;width:90%}.tabs-header.active{opacity:1}.tabs-content{padding:40px 28px 28px;min-height:300px}.ellipsis-btn{display:none}@media only screen and (min-width: 768px){.ellipsis-btn.default{position:absolute;top:auto;right:0;bottom:9px}}@media only screen and (min-width: 1440px){.ellipsis-btn.default{bottom:15px}}@media only screen and (min-width: 1440px){.ellipsis-btn{bottom:15px}}.ellipsis-btn.active{display:block}tab-header{padding-right:48px}";
|
|
7
|
+
const ptcTabListCss = "h1,h2,h3,h4,h5,h6,p,ul,li,ptc-subnav,ptc-tab-list,ptc-link,ptc-square-card,.hyphenate-text,ptc-footer{word-break:break-word;hyphens:manual;-webkit-hyphens:manual;-moz-hyphens:manual;-ms-hyphens:manual}@supports (hyphenate-limit-chars: 12 3 3){h1,h2,h3,h4,h5,h6,p,ul,li,ptc-subnav,ptc-tab-list,ptc-link,ptc-square-card,.hyphenate-text,ptc-footer{hyphens:auto;-webkit-hyphenate-limit-before:3;-webkit-hyphenate-limit-after:3;hyphenate-limit-chars:12 3 3;hyphenate-limit-lines:2;hyphenate-limit-last:always;hyphenate-limit-zone:6%;-webkit-hyphens:auto;-webkit-hyphenate-limit-before:3;-webkit-hyphenate-limit-after:3;-webkit-hyphenate-limit-chars:12 3 3;-webkit-hyphenate-limit-lines:2;-moz-hyphens:auto;-moz-hyphenate-limit-chars:12 3 3;-moz-hyphenate-limit-lines:2;-ms-hyphens:auto;-ms-hyphenate-limit-chars:12 3 3;-ms-hyphenate-limit-lines:2}}ptc-tab-list{display:block;position:relative;color:var(--color-gray-12)}ptc-tab-list.tab-with-banner{background-color:var(--color-white);padding:24px 16px 16px 16px;border-radius:4px}@media only screen and (min-width: 992px){ptc-tab-list.tab-with-banner{padding:24px}}ptc-tab-list.tab-with-banner .tabs-content{padding:16px 0 0 0}ptc-tab-list.tab-with-banner .tabs-content p:not(video-js p),ptc-tab-list.tab-with-banner .tabs-content span:not(video-js span),ptc-tab-list.tab-with-banner .tabs-content h1:not(video-js h1),ptc-tab-list.tab-with-banner .tabs-content h2:not(video-js h2),ptc-tab-list.tab-with-banner .tabs-content h3:not(video-js h3),ptc-tab-list.tab-with-banner .tabs-content h4:not(video-js h4),ptc-tab-list.tab-with-banner .tabs-content h5:not(video-js h5),ptc-tab-list.tab-with-banner .tabs-content h6:not(video-js h6),ptc-tab-list.tab-with-banner .tabs-content ul:not(video-js ul),ptc-tab-list.tab-with-banner .tabs-content li:not(video-js li),ptc-tab-list.tab-with-banner .tabs-content table:not(video-js table){color:var(--color-gray-12)}@media only screen and (min-width: 992px){ptc-tab-list.tab-with-banner .tabs-content{padding:24px 0 0 0}}@media only screen and (min-width: 992px){ptc-tab-list.tab-with-banner .tabs-header{align-items:stretch;padding-left:0rem;width:calc(100% - 44px);display:flex;justify-content:space-between;align-items:center;flex-direction:row;padding-right:0}ptc-tab-list.tab-with-banner tab-header{padding:0 16px;display:flex;align-items:center;flex:1 0 0;align-self:stretch;text-align:center;flex-direction:column;align-items:center}}ptc-tab-list.tab-with-banner .tab-header{padding:0 0 1rem 0}@media only screen and (min-width: 992px){ptc-tab-list.tab-with-banner .tab-header{min-width:200px;white-space:normal;height:100%;align-content:center;transition:var(--ptc-transition-medium) var(--ptc-ease-inout);-webkit-transition:var(--ptc-transition-medium) var(--ptc-ease-inout);-o-transition:var(--ptc-transition-medium) var(--ptc-ease-inout)}ptc-tab-list.tab-with-banner .tab-header:hover{color:var(--color-gray-10)}}@media (min-width: 1080px){ptc-tab-list.tab-with-banner .tab-header{min-width:230px}}@media only screen and (min-width: 1200px){ptc-tab-list.tab-with-banner .tab-header{min-width:200px}}@media only screen and (min-width: 1440px){ptc-tab-list.tab-with-banner .tab-header{min-width:175px}}ptc-tab-list.tab-with-banner .tabs-header-container{display:flex}.tabs-header-container{width:100%;border-bottom:2px solid var(--color-gray-02);position:relative}.tabs-header{display:flex;padding-left:1.5rem;padding-right:1.5rem;transition:opacity ease-out 250ms;opacity:0;width:90%}.tabs-header.active{opacity:1}.tabs-content{padding:40px 28px 28px;min-height:300px}.ellipsis-btn{display:none}@media only screen and (min-width: 768px){.ellipsis-btn.default{position:absolute;top:auto;right:0;bottom:9px}}@media only screen and (min-width: 1440px){.ellipsis-btn.default{bottom:15px}}@media only screen and (min-width: 1440px){.ellipsis-btn{bottom:15px}}.ellipsis-btn.active{display:inline-block}.ellipsis-btn:focus-visible{border-radius:var(--ptc-border-radius-standard);outline:5px solid var(--keyboard-nav-outline)}tab-header{padding-right:48px}";
|
|
8
8
|
|
|
9
9
|
const PtcTabList = class {
|
|
10
10
|
constructor(hostRef) {
|
|
11
11
|
index.registerInstance(this, hostRef);
|
|
12
12
|
this.tabChange = index.createEvent(this, "tabChange", 7);
|
|
13
|
+
this.escClicked = index.createEvent(this, "escClicked", 7);
|
|
13
14
|
this.type = undefined;
|
|
14
15
|
this.isMobile = undefined;
|
|
15
16
|
this.isMobileTabWithBanner = undefined;
|
|
16
17
|
this.selectedValue = undefined;
|
|
18
|
+
this.dropdownItemsCount = 0;
|
|
19
|
+
}
|
|
20
|
+
closeDropdown() {
|
|
21
|
+
this.escClicked.emit();
|
|
17
22
|
}
|
|
18
23
|
componentWillLoad() {
|
|
19
24
|
this.isMobile = window.innerWidth < 768;
|
|
@@ -24,6 +29,14 @@ const PtcTabList = class {
|
|
|
24
29
|
this.calculateHeaderTabsRendering();
|
|
25
30
|
/*const [group] = this.tabGroup;
|
|
26
31
|
this.selectGroup(group);*/
|
|
32
|
+
this.ellipsisDropdown = this.host.querySelector('ptc-ellipsis-dropdown');
|
|
33
|
+
this.ellipsisDropdown.addEventListener('keydown', this.onKeydown.bind(this));
|
|
34
|
+
const tabsHeaderEl = Array.from(this.host.querySelectorAll('tab-header'));
|
|
35
|
+
tabsHeaderEl.forEach((tab, i) => {
|
|
36
|
+
if ((tabsHeaderEl.length - this.dropdownItemsCount) == (i + 1)) {
|
|
37
|
+
this.lastVisibleTab = tab;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
27
40
|
}
|
|
28
41
|
onSelectedTab(event) {
|
|
29
42
|
let self = this;
|
|
@@ -31,6 +44,14 @@ const PtcTabList = class {
|
|
|
31
44
|
event.detail.then(res => {
|
|
32
45
|
if (group.header.name === res.name) {
|
|
33
46
|
self.selectGroup(group);
|
|
47
|
+
// Set the selected tab's tabindex to 0
|
|
48
|
+
group.header.el.setAttribute('tabindex', '0');
|
|
49
|
+
// Focus the selected tab
|
|
50
|
+
group.header.el.focus();
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
// Set other tabs' tabindex to -1
|
|
54
|
+
group.header.el.setAttribute('tabindex', '-1');
|
|
34
55
|
}
|
|
35
56
|
});
|
|
36
57
|
});
|
|
@@ -78,6 +99,7 @@ const PtcTabList = class {
|
|
|
78
99
|
if (activateDropDown) {
|
|
79
100
|
dropdown.classList.add('active');
|
|
80
101
|
dropdown.dataItems = hiddenTabs.reverse();
|
|
102
|
+
this.dropdownItemsCount = dropdown.dataItems.length;
|
|
81
103
|
}
|
|
82
104
|
else {
|
|
83
105
|
dropdown.classList.remove('active');
|
|
@@ -98,7 +120,7 @@ const PtcTabList = class {
|
|
|
98
120
|
if (headerCount === tabsHeaderEl.length) {
|
|
99
121
|
headerComplete = true;
|
|
100
122
|
}
|
|
101
|
-
headerData.push(res);
|
|
123
|
+
headerData.push(Object.assign(Object.assign({}, res), { el }));
|
|
102
124
|
}));
|
|
103
125
|
this.tabsHeader = headerData;
|
|
104
126
|
const tabsContentEl = Array.from(this.host.querySelectorAll('tab-content'));
|
|
@@ -124,6 +146,92 @@ const PtcTabList = class {
|
|
|
124
146
|
self.selectGroup(group);
|
|
125
147
|
}
|
|
126
148
|
}, 3100); // Increased time interval from 100 to 3100 to fix the preload skeleton issue
|
|
149
|
+
tabsHeaderEl.forEach((header, index) => {
|
|
150
|
+
// console.log(header);
|
|
151
|
+
header.setAttribute('id', 'tab-' + (index + 1));
|
|
152
|
+
header.setAttribute('role', 'tab');
|
|
153
|
+
header.setAttribute('aria-selected', index === 0 ? 'true' : 'false');
|
|
154
|
+
header.setAttribute('tabindex', index === 0 ? '0' : '-1'); // Set tabindex based on index
|
|
155
|
+
header.setAttribute('aria-controls', 'tab-panel-' + (index + 1));
|
|
156
|
+
header.addEventListener('keydown', this.onKeydown.bind(this));
|
|
157
|
+
if (!this.firstTab) {
|
|
158
|
+
this.firstTab = header;
|
|
159
|
+
}
|
|
160
|
+
this.lastTab = header;
|
|
161
|
+
});
|
|
162
|
+
tabsContentEl.forEach((panel, index) => {
|
|
163
|
+
panel.setAttribute('id', 'tabpanel-' + (index + 1));
|
|
164
|
+
panel.setAttribute('role', 'tabpanel');
|
|
165
|
+
panel.setAttribute('aria-labelledby', 'tab-' + (index + 1));
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
moveFocusToTab(currentTab) {
|
|
169
|
+
currentTab.focus();
|
|
170
|
+
}
|
|
171
|
+
moveFocusToPreviousTab(currentTab) {
|
|
172
|
+
if (currentTab === this.firstTab || currentTab == this.ellipsisDropdown) {
|
|
173
|
+
this.ellipsisDropdown.setAttribute('tabindex', '-1');
|
|
174
|
+
if (this.dropdownItemsCount == 0) {
|
|
175
|
+
this.moveFocusToTab(this.lastTab);
|
|
176
|
+
}
|
|
177
|
+
else if (currentTab == this.ellipsisDropdown) {
|
|
178
|
+
this.moveFocusToTab(this.lastVisibleTab);
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
this.ellipsisDropdown.setAttribute('tabindex', '0');
|
|
182
|
+
this.ellipsisDropdown.focus();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
const index = this.tabsHeader.findIndex(tab => tab.el === currentTab);
|
|
187
|
+
this.moveFocusToTab(this.tabsHeader[index - 1].el);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
moveFocusToNextTab(currentTab) {
|
|
191
|
+
this.ellipsisDropdown.setAttribute('tabindex', '-1');
|
|
192
|
+
if (currentTab === this.lastTab || currentTab === this.lastVisibleTab) {
|
|
193
|
+
if (this.dropdownItemsCount == 0) {
|
|
194
|
+
this.moveFocusToTab(this.firstTab);
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
this.ellipsisDropdown.setAttribute('tabindex', '0');
|
|
198
|
+
this.ellipsisDropdown.focus();
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
const index = this.tabsHeader.findIndex(tab => tab.el === currentTab);
|
|
203
|
+
this.moveFocusToTab(this.tabsHeader[index + 1].el);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
onKeydown(event) {
|
|
207
|
+
const currentTab = event.currentTarget;
|
|
208
|
+
let flag = false;
|
|
209
|
+
switch (event.key) {
|
|
210
|
+
case 'ArrowLeft':
|
|
211
|
+
this.moveFocusToPreviousTab(currentTab);
|
|
212
|
+
flag = true;
|
|
213
|
+
break;
|
|
214
|
+
case 'ArrowRight':
|
|
215
|
+
this.moveFocusToNextTab(currentTab);
|
|
216
|
+
flag = true;
|
|
217
|
+
break;
|
|
218
|
+
case 'Escape':
|
|
219
|
+
this.closeDropdown();
|
|
220
|
+
flag = true;
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
if (flag) {
|
|
224
|
+
event.stopPropagation();
|
|
225
|
+
event.preventDefault();
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
async toggleTabGroup(name) {
|
|
229
|
+
let self = this;
|
|
230
|
+
this.tabGroup.forEach(group => {
|
|
231
|
+
if (group.header.name === name) {
|
|
232
|
+
self.selectGroup(group);
|
|
233
|
+
}
|
|
234
|
+
});
|
|
127
235
|
}
|
|
128
236
|
selectGroup(group) {
|
|
129
237
|
let self = this;
|
|
@@ -54,12 +54,13 @@ const PtcValueLedLayout = class {
|
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
57
|
+
// @Listen('scroll', { target: 'window' })
|
|
58
|
+
// handleScroll() {
|
|
59
|
+
// const activeListItem = this.hostElement.shadowRoot.querySelector('.vl-list-wrap ul li.active');
|
|
60
|
+
// if (activeListItem) {
|
|
61
|
+
// activeListItem.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'start' });
|
|
62
|
+
// }
|
|
63
|
+
// }
|
|
63
64
|
handleWheel( /*event: WheelEvent*/) {
|
|
64
65
|
//console.log(event);
|
|
65
66
|
this.setActiveItem();
|