@proximus/lavender-tabs 1.4.7-alpha.8 → 1.4.7-beta.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/Tabs.d.ts +0 -3
- package/dist/index.es.js +25 -35
- package/package.json +1 -1
package/dist/Tabs.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { type Tab } from './Tab.ts';
|
|
|
3
3
|
import { type TabPanel } from './TabPanel.ts';
|
|
4
4
|
export declare class Tabs extends HTMLElement {
|
|
5
5
|
#private;
|
|
6
|
-
private readonly _label;
|
|
7
6
|
internals: ElementInternals;
|
|
8
7
|
template: () => string;
|
|
9
8
|
static get observedAttributes(): string[];
|
|
@@ -24,8 +23,6 @@ export declare class Tabs extends HTMLElement {
|
|
|
24
23
|
get $tabPanels(): NodeListOf<TabPanel>;
|
|
25
24
|
get $prefixButton(): HTMLButtonElement;
|
|
26
25
|
get $suffixButton(): HTMLButtonElement;
|
|
27
|
-
get label(): string;
|
|
28
|
-
set label(value: string);
|
|
29
26
|
get inverted(): boolean;
|
|
30
27
|
get ariaLabelNext(): string;
|
|
31
28
|
get ariaLabelPrevious(): string;
|
package/dist/index.es.js
CHANGED
|
@@ -3,11 +3,11 @@ var f = (r) => {
|
|
|
3
3
|
};
|
|
4
4
|
var A = (r, t, e) => t.has(r) || f("Cannot " + e);
|
|
5
5
|
var x = (r, t, e) => t.has(r) ? f("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, e);
|
|
6
|
-
var
|
|
6
|
+
var l = (r, t, e) => (A(r, t, "access private method"), e);
|
|
7
7
|
import "@proximus/lavender-button-icon";
|
|
8
8
|
const k = "*{font-family:var(--px-font-family)}:host{background-color:var(--px-color-background-container-default-default)}:host(:first-child),:host(:first-child) button{border-radius:var(--px-radius-main) var(--px-radius-none) var(--px-radius-none) var(--px-radius-main)}:host(:last-of-type),:host(:last-of-type) button{border-radius:var(--px-radius-none) var(--px-radius-main) var(--px-radius-main) var(--px-radius-none)}:host([selected]){background-color:var(--px-color-background-state-active-default);border-radius:var(--px-radius-main)!important}:host([selected])>button{cursor:auto;padding-block:var(--px-padding-m-mobile);color:var(--px-color-text-neutral-inverted)}button{background:none;border:none;margin:0;padding:var(--px-padding-s-mobile);cursor:pointer;height:inherit;width:inherit;font-size:var(--px-text-size-label-l-mobile);font-weight:var(--px-font-weight-title);text-wrap:nowrap;color:var(--px-color-text-neutral-default);outline:none}:host(:focus-visible){outline-offset:var(--px-focus-offset-mobile);outline:var(--px-focus-outline-mobile) solid var(--px-color-border-focus-outline-default)}:host(:not([selected])) button:hover{background-color:var(--px-color-background-state-hover-default)}:host([inverted]) button{color:var(--px-color-text-neutral-inverted)}:host([inverted]:not([selected])) button:hover{background-color:var(--px-color-background-state-hover-inverted)}:host([inverted][selected]) button{color:var(--px-color-text-brand-default)}:host([inverted]:focus-visible){outline-color:var(--px-color-border-focus-outline-inverted)}@media only screen and (min-width: 768px){button{padding:var(--px-padding-s-desktop);font-size:var(--px-text-size-label-l-desktop)}:host[selected]>button{padding-block:var(--px-padding-m-desktop)}}@media only screen and (min-width: 1025px){button{padding:var(--px-padding-s-desktop);font-size:var(--px-text-size-label-l-desktop)}:host[selected]>button{padding-block:var(--px-padding-m-desktop)}}", m = new CSSStyleSheet();
|
|
9
9
|
m.replaceSync(k);
|
|
10
|
-
const g = "px.lavender.tab.selected",
|
|
10
|
+
const g = "px.lavender.tab.selected", y = "px-tab-connected";
|
|
11
11
|
class S extends HTMLElement {
|
|
12
12
|
constructor() {
|
|
13
13
|
var t;
|
|
@@ -22,7 +22,7 @@ class S extends HTMLElement {
|
|
|
22
22
|
}
|
|
23
23
|
connectedCallback() {
|
|
24
24
|
this.role = "tab", this.internals && (this.internals.role = "tab"), this.ariaSelected = `${this.selected}`, this.slot = "tabs", this.dispatchEvent(
|
|
25
|
-
new CustomEvent(
|
|
25
|
+
new CustomEvent(y, { bubbles: !0, composed: !0 })
|
|
26
26
|
), this.addEventListener("click", () => {
|
|
27
27
|
this.selected = !0;
|
|
28
28
|
});
|
|
@@ -69,15 +69,15 @@ class S extends HTMLElement {
|
|
|
69
69
|
}), this.focus(), this.tabIndex = 0, this.internals && (this.internals.ariaSelected = "true"), this.ariaSelected = "true");
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
var o, d,
|
|
75
|
-
class
|
|
72
|
+
const T = '*{font-family:var(--px-font-family)}#container{display:flex;flex-direction:column;align-items:flex-start;gap:var(--px-spacing-default-mobile)}#tab-container{position:relative;width:100%}#tab-container>#previous{position:absolute;top:.75em;left:-1.5em}#tab-container>#next{position:absolute;top:.75em;right:-1.5em}#panels{width:100%}#tablist{display:flex;align-items:center;scrollbar-width:none;overflow:scroll;width:100%;box-sizing:border-box;margin:calc(calc(var(--px-focus-outline-mobile) + var(--px-focus-offset-mobile)) * -1);padding:calc(var(--px-focus-outline-mobile) + var(--px-focus-offset-mobile))}#tablist::-webkit-scrollbar{display:none}:host([inverted]) #tablist ::slotted(px-tab){background-color:var(--px-color-background-container-default-inverted)}:host([inverted]) #tablist ::slotted(px-tab[selected=""]){background-color:var(--px-color-background-state-active-inverted)}:host([inverted]) #tablist ::slotted(px-tab[selected=""])>button{color:var(--px-color-text-brand-default)}:host([inverted]) button[role=tab]{color:var(--px-color-text-neutral-inverted)}:host([inverted]) button[aria-selected=""]{color:var(--px-color-text-brand-default)}@media only screen and (min-width: 768px){#container{gap:var(--px-spacing-default-desktop)}#tablist{margin:calc(calc(var(--px-focus-outline-tablet) + var(--px-focus-offset-tablet)) * -1);padding:calc(var(--px-focus-outline-tablet) + var(--px-focus-offset-tablet))}}@media only screen and (min-width: 1025px){#container{gap:var(--px-spacing-default-desktop)}#tablist{margin:calc(calc(var(--px-focus-outline-desktop) + var(--px-focus-offset-desktop)) * -1);padding:calc(var(--px-focus-outline-desktop) + var(--px-focus-offset-desktop))}}', u = new CSSStyleSheet();
|
|
73
|
+
u.replaceSync(T);
|
|
74
|
+
var o, d, $;
|
|
75
|
+
class E extends HTMLElement {
|
|
76
76
|
constructor() {
|
|
77
77
|
var e;
|
|
78
78
|
super();
|
|
79
79
|
x(this, o);
|
|
80
|
-
this.
|
|
80
|
+
this.template = () => `
|
|
81
81
|
<div id="container">
|
|
82
82
|
<div id="tab-container">
|
|
83
83
|
<px-button-icon id="previous" aria-hidden="true">
|
|
@@ -96,11 +96,10 @@ class T extends HTMLElement {
|
|
|
96
96
|
</div>
|
|
97
97
|
`, this.handleNextPreviousDisplay = () => {
|
|
98
98
|
this.$prefixButton && this.$suffixButton && (this.$prefixButton.style.display = this.shouldDisplayScrollLeftButton() ? "" : "none", this.$suffixButton.style.display = this.shouldDisplayScrollRightButton() ? "" : "none");
|
|
99
|
-
}, this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = this.template(), this.shadowRoot.adoptedStyleSheets = [
|
|
99
|
+
}, this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = this.template(), this.shadowRoot.adoptedStyleSheets = [u], this.internals = (e = this.attachInternals) == null ? void 0 : e.call(this);
|
|
100
100
|
}
|
|
101
101
|
static get observedAttributes() {
|
|
102
102
|
return [
|
|
103
|
-
"label",
|
|
104
103
|
"inverted",
|
|
105
104
|
"aria-label-next",
|
|
106
105
|
"aria-label-previous",
|
|
@@ -109,9 +108,6 @@ class T extends HTMLElement {
|
|
|
109
108
|
}
|
|
110
109
|
attributeChangedCallback(e, s, i) {
|
|
111
110
|
switch (e) {
|
|
112
|
-
case "label":
|
|
113
|
-
this.label = i;
|
|
114
|
-
break;
|
|
115
111
|
case "aria-label-next":
|
|
116
112
|
this.hasAttribute("hide-controls") || this.$suffixButton.setAttribute("aria-label", i || "Next tab");
|
|
117
113
|
break;
|
|
@@ -122,16 +118,16 @@ class T extends HTMLElement {
|
|
|
122
118
|
);
|
|
123
119
|
break;
|
|
124
120
|
case "hide-controls":
|
|
125
|
-
|
|
121
|
+
l(this, o, $).call(this, i);
|
|
126
122
|
break;
|
|
127
123
|
case "inverted":
|
|
128
|
-
|
|
124
|
+
l(this, o, d).call(this, i);
|
|
129
125
|
break;
|
|
130
126
|
}
|
|
131
127
|
}
|
|
132
128
|
connectedCallback() {
|
|
133
129
|
var e, s;
|
|
134
|
-
this
|
|
130
|
+
this.role = "tablist", this.internals && (this.internals.role = "tablist"), this.addEventListener(
|
|
135
131
|
g,
|
|
136
132
|
(i) => {
|
|
137
133
|
[...this.$tabPanels].forEach((a) => {
|
|
@@ -140,11 +136,11 @@ class T extends HTMLElement {
|
|
|
140
136
|
a.getAttribute("name") !== i.detail.tabName && a.hasAttribute("selected") && a.removeAttribute("selected");
|
|
141
137
|
});
|
|
142
138
|
}
|
|
143
|
-
), this.addEventListener(
|
|
144
|
-
this.handleNextPreviousDisplay(), this.inverted &&
|
|
145
|
-
}), this.handleNextPreviousDisplay(),
|
|
146
|
-
var a,
|
|
147
|
-
(i.key === "ArrowRight" || i.key === "ArrowLeft") && ((
|
|
139
|
+
), this.addEventListener(y, () => {
|
|
140
|
+
this.handleNextPreviousDisplay(), this.inverted && l(this, o, d).call(this, this.getAttribute("inverted"));
|
|
141
|
+
}), this.handleNextPreviousDisplay(), l(this, o, d).call(this, this.getAttribute("inverted")), this.addEventListener("keydown", (i) => {
|
|
142
|
+
var a, n;
|
|
143
|
+
(i.key === "ArrowRight" || i.key === "ArrowLeft") && ((n = (a = document.activeElement) == null ? void 0 : a.localName) != null && n.endsWith("-tab")) && this.navigateToTab(i.key === "ArrowRight" ? "right" : "left");
|
|
148
144
|
}), (e = this.$prefixButton) == null || e.addEventListener("click", (i) => {
|
|
149
145
|
i.stopPropagation(), this.$tabList.scrollTo({
|
|
150
146
|
left: this.$tabList.scrollLeft - 100,
|
|
@@ -200,12 +196,6 @@ class T extends HTMLElement {
|
|
|
200
196
|
get $suffixButton() {
|
|
201
197
|
return this.shadowRoot.querySelector("#next");
|
|
202
198
|
}
|
|
203
|
-
get label() {
|
|
204
|
-
return this.$tabList.getAttribute("aria-labelledby");
|
|
205
|
-
}
|
|
206
|
-
set label(e) {
|
|
207
|
-
this.$tabList.setAttribute("aria-labelledby", e);
|
|
208
|
-
}
|
|
209
199
|
get inverted() {
|
|
210
200
|
return this.hasAttribute("inverted");
|
|
211
201
|
}
|
|
@@ -217,13 +207,13 @@ class T extends HTMLElement {
|
|
|
217
207
|
}
|
|
218
208
|
}
|
|
219
209
|
o = new WeakSet(), d = function(e) {
|
|
220
|
-
var s, i, a,
|
|
221
|
-
e === "" ? ((s = this.$prefixButton) == null || s.setAttribute("inverted", ""), (i = this.$suffixButton) == null || i.setAttribute("inverted", ""), (a = this.$activePanel) == null || a.setAttribute("inverted", ""), (
|
|
210
|
+
var s, i, a, n, b, h, p, v;
|
|
211
|
+
e === "" ? ((s = this.$prefixButton) == null || s.setAttribute("inverted", ""), (i = this.$suffixButton) == null || i.setAttribute("inverted", ""), (a = this.$activePanel) == null || a.setAttribute("inverted", ""), (n = this.$activeTab) == null || n.setAttribute("inverted", ""), [...this.$tabs].forEach((c) => {
|
|
222
212
|
c.setAttribute("inverted", "");
|
|
223
|
-
})) : ((
|
|
213
|
+
})) : ((b = this.$prefixButton) == null || b.removeAttribute("inverted"), (h = this.$suffixButton) == null || h.removeAttribute("inverted"), (p = this.$activePanel) == null || p.removeAttribute("inverted"), (v = this.$activeTab) == null || v.removeAttribute("inverted"), [...this.$tabs].forEach((c) => {
|
|
224
214
|
c.removeAttribute("inverted");
|
|
225
215
|
}));
|
|
226
|
-
},
|
|
216
|
+
}, $ = function(e) {
|
|
227
217
|
e === "" ? (this.$prefixButton.remove(), this.$suffixButton.remove()) : (this.$suffixButton.setAttribute(
|
|
228
218
|
"aria-label",
|
|
229
219
|
this.ariaLabelNext || "Next tab"
|
|
@@ -232,13 +222,13 @@ o = new WeakSet(), d = function(e) {
|
|
|
232
222
|
this.ariaLabelPrevious || "Previous tab"
|
|
233
223
|
));
|
|
234
224
|
};
|
|
235
|
-
class
|
|
225
|
+
class L extends HTMLElement {
|
|
236
226
|
constructor() {
|
|
237
227
|
super(), this.template = () => `
|
|
238
228
|
<div role="tabpanel" tabindex="0">
|
|
239
229
|
<slot></slot>
|
|
240
230
|
</div>
|
|
241
|
-
`, this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = this.template(), this.shadowRoot.adoptedStyleSheets = [
|
|
231
|
+
`, this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = this.template(), this.shadowRoot.adoptedStyleSheets = [u];
|
|
242
232
|
}
|
|
243
233
|
static get observedAttributes() {
|
|
244
234
|
return ["name", "selected"];
|
|
@@ -265,7 +255,7 @@ class E extends HTMLElement {
|
|
|
265
255
|
return this.shadowRoot.querySelector('[role="tabpanel"]');
|
|
266
256
|
}
|
|
267
257
|
}
|
|
268
|
-
class w extends
|
|
258
|
+
class w extends E {
|
|
269
259
|
constructor() {
|
|
270
260
|
super();
|
|
271
261
|
}
|
|
@@ -283,7 +273,7 @@ class B extends S {
|
|
|
283
273
|
}
|
|
284
274
|
}
|
|
285
275
|
customElements.get("px-tab") || customElements.define("px-tab", B);
|
|
286
|
-
class P extends
|
|
276
|
+
class P extends L {
|
|
287
277
|
constructor() {
|
|
288
278
|
super();
|
|
289
279
|
}
|