@florid-kit/components 3.1.4 → 3.1.5
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/components/side-panel.d.ts +2 -0
- package/components/side-panel.mjs +323 -313
- package/package.json +1 -1
|
@@ -57,7 +57,9 @@ export declare class OccitaneSidePanel extends OccitaneSidePanel_base {
|
|
|
57
57
|
private _restoreFocusToOrigin;
|
|
58
58
|
private handleKeyDown;
|
|
59
59
|
private getDeepActiveElement;
|
|
60
|
+
private wrapFocus;
|
|
60
61
|
private trapFocus;
|
|
62
|
+
private isUnavailableElement;
|
|
61
63
|
private getFocusableElements;
|
|
62
64
|
openPanel(): void;
|
|
63
65
|
closePanel(): void;
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { E as p, i as
|
|
2
|
-
import { n as
|
|
3
|
-
import { f as
|
|
1
|
+
import { E as p, i as k, a as g, m as C, x as h, t as S } from "../performance-mixin-D7YmSeqN.mjs";
|
|
2
|
+
import { n as s } from "../property-S_Y9cb04.mjs";
|
|
3
|
+
import { f as m } from "../css-C8WrrxT-.mjs";
|
|
4
4
|
import { i as E, m as P } from "../element-internals-Dw7LndlH.mjs";
|
|
5
|
-
import { e as
|
|
6
|
-
import { g as
|
|
5
|
+
import { e as x, o as A, a as _ } from "../icons-registry.mjs";
|
|
6
|
+
import { g as I } from "../svg-utils-DOL__czZ.mjs";
|
|
7
7
|
import { o as F } from "../unsafe-svg-BipL_msF.mjs";
|
|
8
8
|
import "./icon-button.mjs";
|
|
9
|
-
import { i as
|
|
10
|
-
import { f as
|
|
9
|
+
import { i as z, t as L, e as O } from "../directive-oAbCiebi.mjs";
|
|
10
|
+
import { f as R } from "../directive-helpers-BHuwIghp.mjs";
|
|
11
11
|
/**
|
|
12
12
|
* @license
|
|
13
13
|
* Copyright 2023 Google LLC
|
|
14
14
|
* SPDX-License-Identifier: Apache-2.0
|
|
15
15
|
*/
|
|
16
|
-
function T(
|
|
17
|
-
|
|
18
|
-
const o =
|
|
16
|
+
function T(t) {
|
|
17
|
+
t.addInitializer((e) => {
|
|
18
|
+
const o = e;
|
|
19
19
|
o.addEventListener("click", async (i) => {
|
|
20
|
-
const { type: n, [E]:
|
|
21
|
-
if (!(!
|
|
20
|
+
const { type: n, [E]: r } = o, { form: l } = r;
|
|
21
|
+
if (!(!l || n === "button") && (await new Promise((b) => {
|
|
22
22
|
setTimeout(b);
|
|
23
23
|
}), !i.defaultPrevented)) {
|
|
24
24
|
if (n === "reset") {
|
|
25
|
-
|
|
25
|
+
l.reset();
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
l.addEventListener(
|
|
29
29
|
"submit",
|
|
30
30
|
(b) => {
|
|
31
31
|
Object.defineProperty(b, "submitter", {
|
|
@@ -35,7 +35,7 @@ function T(e) {
|
|
|
35
35
|
});
|
|
36
36
|
},
|
|
37
37
|
{ capture: !0, once: !0 }
|
|
38
|
-
),
|
|
38
|
+
), r.setFormValue(o.value), l.requestSubmit();
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
});
|
|
@@ -45,54 +45,54 @@ function T(e) {
|
|
|
45
45
|
* Copyright 2017 Google LLC
|
|
46
46
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
47
47
|
*/
|
|
48
|
-
const
|
|
48
|
+
const v = (t, e) => {
|
|
49
49
|
var i;
|
|
50
|
-
const o =
|
|
50
|
+
const o = t._$AN;
|
|
51
51
|
if (o === void 0) return !1;
|
|
52
|
-
for (const n of o) (i = n._$AO) == null || i.call(n,
|
|
52
|
+
for (const n of o) (i = n._$AO) == null || i.call(n, e, !1), v(n, e);
|
|
53
53
|
return !0;
|
|
54
|
-
},
|
|
55
|
-
let
|
|
54
|
+
}, y = (t) => {
|
|
55
|
+
let e, o;
|
|
56
56
|
do {
|
|
57
|
-
if ((
|
|
58
|
-
o =
|
|
57
|
+
if ((e = t._$AM) === void 0) break;
|
|
58
|
+
o = e._$AN, o.delete(t), t = e;
|
|
59
59
|
} while ((o == null ? void 0 : o.size) === 0);
|
|
60
|
-
},
|
|
61
|
-
for (let
|
|
62
|
-
let o =
|
|
63
|
-
if (o === void 0)
|
|
64
|
-
else if (o.has(
|
|
65
|
-
o.add(
|
|
60
|
+
}, B = (t) => {
|
|
61
|
+
for (let e; e = t._$AM; t = e) {
|
|
62
|
+
let o = e._$AN;
|
|
63
|
+
if (o === void 0) e._$AN = o = /* @__PURE__ */ new Set();
|
|
64
|
+
else if (o.has(t)) break;
|
|
65
|
+
o.add(t), M(e);
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
|
-
function
|
|
69
|
-
this._$AN !== void 0 ? (
|
|
68
|
+
function q(t) {
|
|
69
|
+
this._$AN !== void 0 ? (y(this), this._$AM = t, B(this)) : this._$AM = t;
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function H(t, e = !1, o = 0) {
|
|
72
72
|
const i = this._$AH, n = this._$AN;
|
|
73
|
-
if (n !== void 0 && n.size !== 0) if (
|
|
74
|
-
else i != null && (
|
|
75
|
-
else
|
|
73
|
+
if (n !== void 0 && n.size !== 0) if (e) if (Array.isArray(i)) for (let r = o; r < i.length; r++) v(i[r], !1), y(i[r]);
|
|
74
|
+
else i != null && (v(i, !1), y(i));
|
|
75
|
+
else v(this, t);
|
|
76
76
|
}
|
|
77
|
-
const
|
|
78
|
-
|
|
77
|
+
const M = (t) => {
|
|
78
|
+
t.type == L.CHILD && (t._$AP ?? (t._$AP = H), t._$AQ ?? (t._$AQ = q));
|
|
79
79
|
};
|
|
80
|
-
class K extends
|
|
80
|
+
class K extends z {
|
|
81
81
|
constructor() {
|
|
82
82
|
super(...arguments), this._$AN = void 0;
|
|
83
83
|
}
|
|
84
|
-
_$AT(
|
|
85
|
-
super._$AT(
|
|
84
|
+
_$AT(e, o, i) {
|
|
85
|
+
super._$AT(e, o, i), B(this), this.isConnected = e._$AU;
|
|
86
86
|
}
|
|
87
|
-
_$AO(
|
|
87
|
+
_$AO(e, o = !0) {
|
|
88
88
|
var i, n;
|
|
89
|
-
|
|
89
|
+
e !== this.isConnected && (this.isConnected = e, e ? (i = this.reconnected) == null || i.call(this) : (n = this.disconnected) == null || n.call(this)), o && (v(this, e), y(this));
|
|
90
90
|
}
|
|
91
|
-
setValue(
|
|
92
|
-
if (
|
|
91
|
+
setValue(e) {
|
|
92
|
+
if (R(this._$Ct)) this._$Ct._$AI(e, this);
|
|
93
93
|
else {
|
|
94
94
|
const o = [...this._$Ct._$AH];
|
|
95
|
-
o[this._$Ci] =
|
|
95
|
+
o[this._$Ci] = e, this._$Ct._$AI(o, this, 0);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
disconnected() {
|
|
@@ -100,118 +100,118 @@ class K extends O {
|
|
|
100
100
|
reconnected() {
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
class
|
|
103
|
+
class j extends K {
|
|
104
104
|
constructor() {
|
|
105
105
|
super(...arguments), this.prevData = {};
|
|
106
106
|
}
|
|
107
|
-
render(
|
|
107
|
+
render(e) {
|
|
108
108
|
return p;
|
|
109
109
|
}
|
|
110
|
-
update(
|
|
110
|
+
update(e, [o]) {
|
|
111
111
|
var i;
|
|
112
|
-
this.element !==
|
|
112
|
+
this.element !== e.element && (this.element = e.element), this.host = ((i = e.options) === null || i === void 0 ? void 0 : i.host) || this.element, this.apply(o), this.groom(o), this.prevData = { ...o };
|
|
113
113
|
}
|
|
114
|
-
apply(
|
|
115
|
-
if (!
|
|
114
|
+
apply(e) {
|
|
115
|
+
if (!e)
|
|
116
116
|
return;
|
|
117
117
|
const { prevData: o, element: i } = this;
|
|
118
|
-
for (const n in
|
|
119
|
-
const
|
|
120
|
-
|
|
118
|
+
for (const n in e) {
|
|
119
|
+
const r = e[n];
|
|
120
|
+
r !== o[n] && (i[n] = r);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
groom(
|
|
123
|
+
groom(e) {
|
|
124
124
|
const { prevData: o, element: i } = this;
|
|
125
125
|
if (o)
|
|
126
126
|
for (const n in o)
|
|
127
|
-
(!
|
|
127
|
+
(!e || !(n in e) && i[n] === o[n]) && (i[n] = void 0);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
class
|
|
130
|
+
class N extends j {
|
|
131
131
|
constructor() {
|
|
132
132
|
super(...arguments), this.eventData = {};
|
|
133
133
|
}
|
|
134
|
-
apply(
|
|
135
|
-
if (
|
|
136
|
-
for (const o in
|
|
137
|
-
const i =
|
|
134
|
+
apply(e) {
|
|
135
|
+
if (e)
|
|
136
|
+
for (const o in e) {
|
|
137
|
+
const i = e[o];
|
|
138
138
|
i !== this.eventData[o] && this.applyEvent(o, i);
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
applyEvent(
|
|
141
|
+
applyEvent(e, o) {
|
|
142
142
|
const { prevData: i, element: n } = this;
|
|
143
|
-
this.eventData[
|
|
143
|
+
this.eventData[e] = o, i[e] && n.removeEventListener(e, this, o), n.addEventListener(e, this, o);
|
|
144
144
|
}
|
|
145
|
-
groom(
|
|
145
|
+
groom(e) {
|
|
146
146
|
const { prevData: o, element: i } = this;
|
|
147
147
|
if (o)
|
|
148
148
|
for (const n in o)
|
|
149
|
-
(!
|
|
149
|
+
(!e || !(n in e) && i[n] === o[n]) && this.groomEvent(n, o[n]);
|
|
150
150
|
}
|
|
151
|
-
groomEvent(
|
|
151
|
+
groomEvent(e, o) {
|
|
152
152
|
const { element: i } = this;
|
|
153
|
-
delete this.eventData[
|
|
153
|
+
delete this.eventData[e], i.removeEventListener(e, this, o);
|
|
154
154
|
}
|
|
155
|
-
handleEvent(
|
|
156
|
-
const o = this.eventData[
|
|
157
|
-
typeof o == "function" ? o.call(this.host,
|
|
155
|
+
handleEvent(e) {
|
|
156
|
+
const o = this.eventData[e.type];
|
|
157
|
+
typeof o == "function" ? o.call(this.host, e) : o.handleEvent(e);
|
|
158
158
|
}
|
|
159
159
|
disconnected() {
|
|
160
|
-
const { eventData:
|
|
161
|
-
for (const i in
|
|
162
|
-
const n = i.slice(1),
|
|
163
|
-
o.removeEventListener(n, this,
|
|
160
|
+
const { eventData: e, element: o } = this;
|
|
161
|
+
for (const i in e) {
|
|
162
|
+
const n = i.slice(1), r = e[i];
|
|
163
|
+
o.removeEventListener(n, this, r);
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
reconnected() {
|
|
167
|
-
const { eventData:
|
|
168
|
-
for (const i in
|
|
169
|
-
const n = i.slice(1),
|
|
170
|
-
o.addEventListener(n, this,
|
|
167
|
+
const { eventData: e, element: o } = this;
|
|
168
|
+
for (const i in e) {
|
|
169
|
+
const n = i.slice(1), r = e[i];
|
|
170
|
+
o.addEventListener(n, this, r);
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
class
|
|
175
|
-
apply(
|
|
176
|
-
if (!
|
|
174
|
+
class V extends N {
|
|
175
|
+
apply(e) {
|
|
176
|
+
if (!e)
|
|
177
177
|
return;
|
|
178
178
|
const { prevData: o, element: i } = this;
|
|
179
|
-
for (const n in
|
|
180
|
-
const
|
|
181
|
-
if (
|
|
179
|
+
for (const n in e) {
|
|
180
|
+
const r = e[n];
|
|
181
|
+
if (r === o[n])
|
|
182
182
|
continue;
|
|
183
|
-
const
|
|
183
|
+
const l = n.slice(1);
|
|
184
184
|
switch (n[0]) {
|
|
185
185
|
case "@":
|
|
186
|
-
this.eventData[
|
|
186
|
+
this.eventData[l] = r, this.applyEvent(l, r);
|
|
187
187
|
break;
|
|
188
188
|
case ".":
|
|
189
|
-
i[
|
|
189
|
+
i[l] = r;
|
|
190
190
|
break;
|
|
191
191
|
case "?":
|
|
192
|
-
|
|
192
|
+
r ? i.setAttribute(l, "") : i.removeAttribute(l);
|
|
193
193
|
break;
|
|
194
194
|
default:
|
|
195
|
-
|
|
195
|
+
r != null ? i.setAttribute(n, String(r)) : i.removeAttribute(n);
|
|
196
196
|
break;
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
|
-
groom(
|
|
200
|
+
groom(e) {
|
|
201
201
|
const { prevData: o, element: i } = this;
|
|
202
202
|
if (o)
|
|
203
203
|
for (const n in o) {
|
|
204
|
-
const
|
|
205
|
-
if (!
|
|
204
|
+
const r = n.slice(1);
|
|
205
|
+
if (!e || !(n in e) && i[r] === o[n])
|
|
206
206
|
switch (n[0]) {
|
|
207
207
|
case "@":
|
|
208
|
-
this.groomEvent(
|
|
208
|
+
this.groomEvent(r, o[n]);
|
|
209
209
|
break;
|
|
210
210
|
case ".":
|
|
211
|
-
i[
|
|
211
|
+
i[r] = void 0;
|
|
212
212
|
break;
|
|
213
213
|
case "?":
|
|
214
|
-
i.removeAttribute(
|
|
214
|
+
i.removeAttribute(r);
|
|
215
215
|
break;
|
|
216
216
|
default:
|
|
217
217
|
i.removeAttribute(n);
|
|
@@ -220,29 +220,29 @@ class X extends V {
|
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
-
const
|
|
224
|
-
var
|
|
225
|
-
for (var n = i > 1 ? void 0 : i ?
|
|
226
|
-
(
|
|
227
|
-
return i && n &&
|
|
223
|
+
const $ = O(V);
|
|
224
|
+
var X = Object.defineProperty, U = Object.getOwnPropertyDescriptor, c = (t, e, o, i) => {
|
|
225
|
+
for (var n = i > 1 ? void 0 : i ? U(e, o) : e, r = t.length - 1, l; r >= 0; r--)
|
|
226
|
+
(l = t[r]) && (n = (i ? l(e, o, n) : l(n)) || n);
|
|
227
|
+
return i && n && X(e, o, n), n;
|
|
228
228
|
};
|
|
229
|
-
let
|
|
229
|
+
let a = class extends C(g) {
|
|
230
230
|
constructor() {
|
|
231
|
-
super(...arguments), this.open = !1, this.showHeader = !0, this.showFooter = !1, this.showHeaderStartIcon = !1, this.headerTitle = "", this.headerTitleClassName = "panel-title", this.labelDialog = "", this.labelAriaDialogPanel = "", this.addToBagProductCount = "", this.closeButtonLabel = "Close the modal", this.goBackButtonLabel = "Go back to", this.firstButtonLabel = "Close", this.firstButtonVariant = "primary", this.firstButtonProps = {}, this.onFirstButtonClickClose = !1, this.secondButtonLabel = "", this.secondButtonVariant = "secondary", this.secondButtonProps = {}, this.onSecondButtonClickClose = !1, this.stickyFooter = !1, this.disablePortal = !1, this.zIndex = 99, this.initialized = !1, this.showDetail = !1, this.isHidingDetail = !1, this.previousFocusedElement = null, this.previousFocusedSelector = null, this._hideTimeout = null, this._onOpenDetail = async (
|
|
231
|
+
super(...arguments), this.open = !1, this.showHeader = !0, this.showFooter = !1, this.showHeaderStartIcon = !1, this.headerTitle = "", this.headerTitleClassName = "panel-title", this.labelDialog = "", this.labelAriaDialogPanel = "", this.addToBagProductCount = "", this.closeButtonLabel = "Close the modal", this.goBackButtonLabel = "Go back to", this.firstButtonLabel = "Close", this.firstButtonVariant = "primary", this.firstButtonProps = {}, this.onFirstButtonClickClose = !1, this.secondButtonLabel = "", this.secondButtonVariant = "secondary", this.secondButtonProps = {}, this.onSecondButtonClickClose = !1, this.stickyFooter = !1, this.disablePortal = !1, this.zIndex = 99, this.initialized = !1, this.showDetail = !1, this.isHidingDetail = !1, this.previousFocusedElement = null, this.previousFocusedSelector = null, this._hideTimeout = null, this._onOpenDetail = async (t) => {
|
|
232
232
|
var o, i;
|
|
233
|
-
const
|
|
234
|
-
if (this._detailOriginEl =
|
|
233
|
+
const e = ((o = t.detail) == null ? void 0 : o.origin) ?? document.activeElement;
|
|
234
|
+
if (this._detailOriginEl = e, this._detailOriginClass = (e == null ? void 0 : e.className) ?? "", this.showDetail = !0, this.showHeaderStartIcon = !0, await this.updateComplete, this._detailOriginClass) {
|
|
235
235
|
const n = (i = this.shadowRoot) == null ? void 0 : i.querySelector(".detail-view");
|
|
236
236
|
n && n.setAttribute("fromelement", this._detailOriginClass);
|
|
237
237
|
}
|
|
238
238
|
await this.focusDetailReturnBtn();
|
|
239
|
-
}, this._detailOriginEl = null, this._detailOriginClass = "", this.handleKeyDown = (
|
|
240
|
-
this.open && (
|
|
241
|
-
}, this.handleClosePanel = (
|
|
242
|
-
if (
|
|
239
|
+
}, this._detailOriginEl = null, this._detailOriginClass = "", this.handleKeyDown = (t) => {
|
|
240
|
+
this.open && (t.key === "Escape" ? this.closePanel() : t.key === "Tab" && this.trapFocus(t));
|
|
241
|
+
}, this.handleClosePanel = (t) => {
|
|
242
|
+
if (t instanceof KeyboardEvent && t.key !== "Enter" && t.key !== " ")
|
|
243
243
|
return;
|
|
244
|
-
|
|
245
|
-
const
|
|
244
|
+
t.preventDefault(), t.stopPropagation();
|
|
245
|
+
const e = t.currentTarget, o = (e == null ? void 0 : e.getAttribute("data-role")) === "back";
|
|
246
246
|
if (this.showDetail && o) {
|
|
247
247
|
this.isHidingDetail = !0;
|
|
248
248
|
const i = this.renderRoot.querySelector(".content"), n = async () => {
|
|
@@ -250,10 +250,10 @@ let l = class extends S(x) {
|
|
|
250
250
|
};
|
|
251
251
|
if (i) {
|
|
252
252
|
this.showHeaderStartIcon = !1;
|
|
253
|
-
const
|
|
254
|
-
this.showDetail = !1, this.isHidingDetail = !1, i.removeEventListener("animationend",
|
|
253
|
+
const r = () => {
|
|
254
|
+
this.showDetail = !1, this.isHidingDetail = !1, i.removeEventListener("animationend", r), n();
|
|
255
255
|
};
|
|
256
|
-
i.addEventListener("animationend",
|
|
256
|
+
i.addEventListener("animationend", r);
|
|
257
257
|
} else
|
|
258
258
|
this.showDetail = !1, this.isHidingDetail = !1, this.showHeaderStartIcon = !1;
|
|
259
259
|
return;
|
|
@@ -262,121 +262,131 @@ let l = class extends S(x) {
|
|
|
262
262
|
};
|
|
263
263
|
}
|
|
264
264
|
focusFirstInPanel() {
|
|
265
|
-
var
|
|
266
|
-
(i = this.getFocusableElements().
|
|
265
|
+
var e, o, i;
|
|
266
|
+
(i = this.getFocusableElements().filter((n) => !!n && !n.hasAttribute("disabled"))[0] ?? ((e = this.shadowRoot) == null ? void 0 : e.querySelector(".close-btn")) ?? ((o = this.shadowRoot) == null ? void 0 : o.querySelector(".panel"))) == null || i.focus({ preventScroll: !0 });
|
|
267
267
|
}
|
|
268
|
-
resolveFocusable(
|
|
268
|
+
resolveFocusable(t) {
|
|
269
269
|
var o;
|
|
270
|
-
const
|
|
271
|
-
return
|
|
270
|
+
const e = t.tagName.toLowerCase();
|
|
271
|
+
return e === "o-icon-button" || e === "o-button" ? ((o = t.shadowRoot) == null ? void 0 : o.querySelector("button, .button")) ?? t : t;
|
|
272
272
|
}
|
|
273
273
|
connectedCallback() {
|
|
274
274
|
super.connectedCallback(), !this.disablePortal && this.parentElement !== document.body && document.body.appendChild(this), this.addEventListener("keydown", this.handleKeyDown), this.updateComplete.then(() => {
|
|
275
275
|
this.initialized = !0;
|
|
276
|
-
}), this.addEventListener("open-detail", this._onOpenDetail), this.addEventListener("focusin", (
|
|
277
|
-
|
|
276
|
+
}), this.addEventListener("open-detail", this._onOpenDetail), this.addEventListener("focusin", (t) => {
|
|
277
|
+
t.composedPath()[0] === this && this.focusFirstInPanel();
|
|
278
278
|
});
|
|
279
279
|
}
|
|
280
280
|
disconnectedCallback() {
|
|
281
281
|
document.body.style.overflow = "", document.body.removeAttribute("data-side-panel"), this.removeEventListener("keydown", this.handleKeyDown), super.disconnectedCallback(), this.removeEventListener("open-detail", this._onOpenDetail);
|
|
282
282
|
}
|
|
283
283
|
async focusDetailReturnBtn() {
|
|
284
|
-
var n,
|
|
284
|
+
var n, r, l, b, f;
|
|
285
285
|
await this.updateComplete;
|
|
286
|
-
const
|
|
287
|
-
if (
|
|
286
|
+
const t = this.getDeepActiveElement(document);
|
|
287
|
+
if (t && t !== document.body)
|
|
288
288
|
try {
|
|
289
|
-
|
|
289
|
+
t.blur();
|
|
290
290
|
} catch {
|
|
291
291
|
}
|
|
292
292
|
await new Promise(requestAnimationFrame);
|
|
293
|
-
const
|
|
294
|
-
if (!
|
|
295
|
-
|
|
293
|
+
const e = (n = this.shadowRoot) == null ? void 0 : n.querySelector(".detail-view .return-btn");
|
|
294
|
+
if (!e) return;
|
|
295
|
+
e.updateComplete && await e.updateComplete, (b = (l = ((r = e.shadowRoot) == null ? void 0 : r.querySelector("button")) ?? e) == null ? void 0 : l.focus) == null || b.call(l, { preventScroll: !0 });
|
|
296
296
|
const i = (f = this.shadowRoot) == null ? void 0 : f.querySelector('.panel[role="dialog"]');
|
|
297
297
|
i && i.setAttribute("aria-label", this.labelAriaDialogPanel || "panel-title");
|
|
298
298
|
}
|
|
299
299
|
_restoreFocusToOrigin() {
|
|
300
|
-
var
|
|
301
|
-
const
|
|
302
|
-
!
|
|
300
|
+
var e, o;
|
|
301
|
+
const t = this._detailOriginEl;
|
|
302
|
+
!t || !document.contains(t) || ((o = (e = document.activeElement) == null ? void 0 : e.blur) == null || o.call(e), requestAnimationFrame(() => {
|
|
303
303
|
var n;
|
|
304
|
-
|
|
304
|
+
t.classList.add("a--tabfocus"), (((n = t.shadowRoot) == null ? void 0 : n.querySelector('button, .button, [tabindex]:not([tabindex="-1"])')) ?? null ?? t).focus({ preventScroll: !0 });
|
|
305
305
|
}));
|
|
306
306
|
}
|
|
307
|
-
getDeepActiveElement(
|
|
308
|
-
let
|
|
309
|
-
for (;
|
|
310
|
-
|
|
311
|
-
return
|
|
307
|
+
getDeepActiveElement(t = this.shadowRoot) {
|
|
308
|
+
let e = t.activeElement;
|
|
309
|
+
for (; e && e.shadowRoot && e.shadowRoot.activeElement; )
|
|
310
|
+
e = e.shadowRoot.activeElement;
|
|
311
|
+
return e;
|
|
312
312
|
}
|
|
313
|
-
|
|
314
|
-
var
|
|
315
|
-
if (
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
313
|
+
wrapFocus(t, e, o) {
|
|
314
|
+
var r;
|
|
315
|
+
if (!o.length) {
|
|
316
|
+
t.preventDefault(), t.stopPropagation(), (r = this.renderRoot.querySelector(".panel")) == null || r.focus({ preventScroll: !0 });
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
const i = o[0], n = o[o.length - 1];
|
|
320
|
+
!e || !o.includes(e) ? (t.preventDefault(), t.stopPropagation(), (t.shiftKey ? n : i).focus({ preventScroll: !0 })) : !t.shiftKey && e === n ? (t.preventDefault(), t.stopPropagation(), i.focus({ preventScroll: !0 })) : t.shiftKey && e === i && (t.preventDefault(), t.stopPropagation(), n.focus({ preventScroll: !0 }));
|
|
321
|
+
}
|
|
322
|
+
trapFocus(t) {
|
|
323
|
+
if (t.key !== "Tab") return;
|
|
324
|
+
const e = this.shadowRoot;
|
|
325
|
+
if (!e) return;
|
|
326
|
+
const o = t.composedPath()[0] ?? this.getDeepActiveElement(document);
|
|
319
327
|
if (this.showDetail) {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
e.preventDefault(), e.stopPropagation(), v.focus({ preventScroll: !0 });
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
if (!e.shiftKey && v && o === v) {
|
|
326
|
-
e.preventDefault(), e.stopPropagation(), (((s = t.querySelector(".detail-scroller")) == null ? void 0 : s.querySelector(
|
|
327
|
-
l.focusablesSelector
|
|
328
|
-
)) ?? f ?? v).focus({ preventScroll: !0 });
|
|
329
|
-
return;
|
|
330
|
-
}
|
|
328
|
+
this.wrapFocus(t, o, this.getFocusableElements());
|
|
329
|
+
return;
|
|
331
330
|
}
|
|
332
331
|
if (document.querySelector("#refineandsortpopin")) {
|
|
333
|
-
const
|
|
334
|
-
|
|
332
|
+
const r = e.querySelector(".close-btn"), l = r ? this.resolveFocusable(r) : null, b = e.querySelector(".js-clear-refinements"), f = b ? this.resolveFocusable(b) : null, w = (D) => {
|
|
333
|
+
t.preventDefault(), t.stopPropagation(), D.focus();
|
|
335
334
|
};
|
|
336
|
-
if (
|
|
337
|
-
if (!
|
|
338
|
-
if (
|
|
335
|
+
if (l && f) {
|
|
336
|
+
if (!t.shiftKey && o === f) return w(l);
|
|
337
|
+
if (t.shiftKey && o === l) return w(f);
|
|
339
338
|
}
|
|
340
339
|
}
|
|
341
340
|
const n = this.renderRoot.querySelector(".close-btn");
|
|
342
|
-
if (!
|
|
343
|
-
|
|
344
|
-
const
|
|
341
|
+
if (!t.shiftKey && n && n.contains(o)) {
|
|
342
|
+
t.preventDefault();
|
|
343
|
+
const r = this.renderRoot.querySelector(
|
|
345
344
|
".o-whats-inside--content p"
|
|
346
345
|
);
|
|
347
|
-
|
|
346
|
+
if (r) {
|
|
347
|
+
r.focus();
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
348
350
|
}
|
|
351
|
+
this.wrapFocus(t, o, this.getFocusableElements());
|
|
352
|
+
}
|
|
353
|
+
isUnavailableElement(t) {
|
|
354
|
+
if (!(t instanceof HTMLElement)) return !1;
|
|
355
|
+
if (t.disabled || t.hasAttribute("disabled") || t.getAttribute("tabindex") === "-1" || t.closest("[hidden], [inert], [aria-hidden='true']")) return !0;
|
|
356
|
+
const e = t.ownerDocument.defaultView, o = e == null ? void 0 : e.getComputedStyle(t);
|
|
357
|
+
return (o == null ? void 0 : o.display) === "none" || (o == null ? void 0 : o.visibility) === "hidden" || (o == null ? void 0 : o.visibility) === "collapse";
|
|
349
358
|
}
|
|
350
359
|
getFocusableElements() {
|
|
351
|
-
const
|
|
352
|
-
if (!
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
const s = [n.matches(l.focusablesSelector) ? n : []];
|
|
359
|
-
if (!["o-icon-button", "o-button"].includes(n.tagName.toLowerCase())) {
|
|
360
|
-
const b = Array.from(
|
|
361
|
-
n instanceof HTMLSlotElement ? n.assignedElements({ flatten: !0 }) : []
|
|
362
|
-
).filter(t).flatMap(o), f = Array.from(
|
|
363
|
-
((a = n.shadowRoot) == null ? void 0 : a.querySelectorAll("*")) || []
|
|
364
|
-
).filter(t).flatMap(o);
|
|
365
|
-
s.push(...b, ...f);
|
|
360
|
+
const t = this.showDetail ? this.renderRoot.querySelector(".detail-view") : this.renderRoot.querySelector(".panel");
|
|
361
|
+
if (!t) return [];
|
|
362
|
+
const e = (r) => this.isUnavailableElement(r) ? !1 : r.matches(a.focusablesSelector), o = [], i = /* @__PURE__ */ new Set(), n = (r) => {
|
|
363
|
+
if (i.has(r) || (i.add(r), r instanceof HTMLElement && r.closest("[hidden], [inert], [aria-hidden='true']"))) return;
|
|
364
|
+
if (e(r)) {
|
|
365
|
+
const f = this.resolveFocusable(r);
|
|
366
|
+
f && !this.isUnavailableElement(f) && o.push(f);
|
|
366
367
|
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
368
|
+
const l = r.tagName.toLowerCase();
|
|
369
|
+
if (l === "o-icon-button" || l === "o-button") return;
|
|
370
|
+
if (r instanceof HTMLSlotElement) {
|
|
371
|
+
r.assignedElements({ flatten: !0 }).forEach(n);
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
const b = r.shadowRoot;
|
|
375
|
+
b && Array.from(b.children).forEach(n), Array.from(r.children).forEach(n);
|
|
376
|
+
};
|
|
377
|
+
return n(t), o;
|
|
370
378
|
}
|
|
371
379
|
openPanel() {
|
|
372
|
-
var
|
|
373
|
-
this.removeAttribute("hidden"), this.getBoundingClientRect(), this.previousFocusedElement = document.activeElement, this.previousFocusedSelector = (
|
|
374
|
-
const
|
|
375
|
-
|
|
380
|
+
var e;
|
|
381
|
+
this.removeAttribute("hidden"), this.getBoundingClientRect(), this.previousFocusedElement = document.activeElement, this.previousFocusedSelector = (e = this.previousFocusedElement) == null ? void 0 : e.getAttribute("paneltarget"), this.open = !0, document.body.style.overflow = "hidden", document.body.setAttribute("data-side-panel", "open");
|
|
382
|
+
const t = this.renderRoot.querySelector(".panel");
|
|
383
|
+
t && t.setAttribute("aria-modal", "true"), this.updateComplete.then(async () => {
|
|
376
384
|
var o, i;
|
|
377
385
|
if (this.showHeader) {
|
|
378
|
-
const n = (o = this.shadowRoot) == null ? void 0 : o.querySelector(".panel .close-btn")
|
|
379
|
-
|
|
386
|
+
const n = (o = this.shadowRoot) == null ? void 0 : o.querySelector(".panel .close-btn");
|
|
387
|
+
n != null && n.updateComplete && await n.updateComplete;
|
|
388
|
+
const r = this.resolveFocusable(n);
|
|
389
|
+
(i = r == null ? void 0 : r.focus) == null || i.call(r, { preventScroll: !0 });
|
|
380
390
|
} else
|
|
381
391
|
this.focusFirstInPanel();
|
|
382
392
|
}), this.dispatchEvent(
|
|
@@ -386,35 +396,35 @@ let l = class extends S(x) {
|
|
|
386
396
|
closePanel() {
|
|
387
397
|
var o, i, n;
|
|
388
398
|
this.open = !1, this.showDetail = !1, document.body.style.overflow = "", document.body.removeAttribute("data-side-panel");
|
|
389
|
-
let
|
|
390
|
-
|
|
391
|
-
const
|
|
392
|
-
|
|
399
|
+
let t = this.previousFocusedElement;
|
|
400
|
+
t != null && t.isConnected || (t = document.querySelector(`[paneltarget="${this.previousFocusedSelector}"]`)), (t == null ? void 0 : t.tagName.toLowerCase()) === "o-button" ? (n = (i = (o = t.shadowRoot) == null ? void 0 : o.querySelector(".button")) == null ? void 0 : i.focus) == null || n.call(i) : t == null || t.focus();
|
|
401
|
+
const e = this.renderRoot.querySelector(".panel");
|
|
402
|
+
e && e.removeAttribute("aria-modal"), this.dispatchEvent(
|
|
393
403
|
new CustomEvent("close", { bubbles: !0, composed: !0 })
|
|
394
404
|
);
|
|
395
405
|
}
|
|
396
|
-
handleFirstClick(
|
|
397
|
-
|
|
406
|
+
handleFirstClick(t) {
|
|
407
|
+
t instanceof KeyboardEvent && t.key !== "Enter" && t.key !== " " || (t.preventDefault(), t.stopPropagation(), this.onFirstButtonClickClose && this.closePanel(), this.dispatchEvent(
|
|
398
408
|
new CustomEvent("firstbuttonclick", {
|
|
399
409
|
bubbles: !0,
|
|
400
410
|
composed: !0,
|
|
401
411
|
cancelable: !0,
|
|
402
412
|
detail: {
|
|
403
413
|
button: "first",
|
|
404
|
-
target:
|
|
414
|
+
target: t.target
|
|
405
415
|
}
|
|
406
416
|
})
|
|
407
417
|
));
|
|
408
418
|
}
|
|
409
|
-
handleSecondClick(
|
|
410
|
-
|
|
419
|
+
handleSecondClick(t) {
|
|
420
|
+
t instanceof KeyboardEvent && t.key !== "Enter" && t.key !== " " || (t.preventDefault(), t.stopPropagation(), this.onSecondButtonClickClose && this.closePanel(), this.dispatchEvent(
|
|
411
421
|
new CustomEvent("secondbuttonclick", {
|
|
412
422
|
bubbles: !0,
|
|
413
423
|
composed: !0,
|
|
414
424
|
cancelable: !0,
|
|
415
425
|
detail: {
|
|
416
426
|
button: "second",
|
|
417
|
-
target:
|
|
427
|
+
target: t.target
|
|
418
428
|
}
|
|
419
429
|
})
|
|
420
430
|
));
|
|
@@ -425,7 +435,7 @@ let l = class extends S(x) {
|
|
|
425
435
|
}, 500);
|
|
426
436
|
}
|
|
427
437
|
render() {
|
|
428
|
-
const
|
|
438
|
+
const t = this.showHeader ? h`
|
|
429
439
|
<div tabindex="-1" part="header" class="header ${this.showDetail ? "detail-view-header" : ""}">
|
|
430
440
|
${this.showHeaderStartIcon ? h`
|
|
431
441
|
<o-icon-button
|
|
@@ -458,14 +468,14 @@ let l = class extends S(x) {
|
|
|
458
468
|
aria-describedby="panel-title"
|
|
459
469
|
></o-icon-button>
|
|
460
470
|
</div>
|
|
461
|
-
` : null,
|
|
471
|
+
` : null, e = this.showFooter ? h`
|
|
462
472
|
<div class="footer" part="footer">
|
|
463
473
|
${this.firstButtonVariant && this.firstButtonLabel ? h`
|
|
464
474
|
<o-button
|
|
465
475
|
.variant=${this.firstButtonVariant}
|
|
466
476
|
@click=${this.handleFirstClick}
|
|
467
477
|
@keydown=${this.handleFirstClick}
|
|
468
|
-
${
|
|
478
|
+
${$(this.firstButtonProps)}
|
|
469
479
|
>
|
|
470
480
|
${this.firstButtonLabel}
|
|
471
481
|
</o-button>
|
|
@@ -475,7 +485,7 @@ let l = class extends S(x) {
|
|
|
475
485
|
.variant=${this.secondButtonVariant}
|
|
476
486
|
@click=${this.handleSecondClick}
|
|
477
487
|
@keydown=${this.handleSecondClick}
|
|
478
|
-
${
|
|
488
|
+
${$(this.secondButtonProps)}
|
|
479
489
|
>
|
|
480
490
|
${this.secondButtonLabel}
|
|
481
491
|
</o-button>
|
|
@@ -493,13 +503,13 @@ let l = class extends S(x) {
|
|
|
493
503
|
tabindex="-1"
|
|
494
504
|
>
|
|
495
505
|
<div role="document">
|
|
496
|
-
${
|
|
506
|
+
${t}
|
|
497
507
|
|
|
498
508
|
<div part="content" class="content ${this.isHidingDetail ? "slide-out-right" : ""} ${this.showDetail ? "with-detail" : ""}">
|
|
499
509
|
|
|
500
510
|
${this.showDetail ? h`
|
|
501
511
|
<div class="detail-view">
|
|
502
|
-
${
|
|
512
|
+
${t}
|
|
503
513
|
<div class="detail-content">
|
|
504
514
|
<div class="detail-scroller">
|
|
505
515
|
<slot name="detail"></slot>
|
|
@@ -509,14 +519,14 @@ let l = class extends S(x) {
|
|
|
509
519
|
` : h`<slot></slot>`}
|
|
510
520
|
</div>
|
|
511
521
|
|
|
512
|
-
${this.stickyFooter ? null :
|
|
522
|
+
${this.stickyFooter ? null : e}
|
|
513
523
|
</div>
|
|
514
|
-
${this.stickyFooter ?
|
|
524
|
+
${this.stickyFooter ? e : null}
|
|
515
525
|
</div>
|
|
516
526
|
`;
|
|
517
527
|
}
|
|
518
528
|
};
|
|
519
|
-
|
|
529
|
+
a.styles = k`
|
|
520
530
|
:host {
|
|
521
531
|
--z-overlay: 99;
|
|
522
532
|
--z-panel: 100;
|
|
@@ -658,7 +668,7 @@ l.styles = C`
|
|
|
658
668
|
|
|
659
669
|
.panel:focus-visible,
|
|
660
670
|
.close-btn:focus-visible {
|
|
661
|
-
${
|
|
671
|
+
${m}
|
|
662
672
|
}
|
|
663
673
|
|
|
664
674
|
[role="document"] {
|
|
@@ -759,114 +769,114 @@ l.styles = C`
|
|
|
759
769
|
box-sizing: border-box;
|
|
760
770
|
}
|
|
761
771
|
`;
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
...
|
|
772
|
+
a.focusablesSelector = 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"]), o-icon-button, o-button';
|
|
773
|
+
a.focusablesCustomElementsSelector = "o-icon-button, o-button";
|
|
774
|
+
a.shadowRootOptions = {
|
|
775
|
+
...g.shadowRootOptions,
|
|
766
776
|
// This helps send focus into the first focusable in shadow when host is focused
|
|
767
777
|
delegatesFocus: !0
|
|
768
778
|
};
|
|
769
779
|
c([
|
|
770
|
-
|
|
771
|
-
],
|
|
780
|
+
s({ type: Boolean, reflect: !0 })
|
|
781
|
+
], a.prototype, "open", 2);
|
|
772
782
|
c([
|
|
773
|
-
|
|
774
|
-
],
|
|
783
|
+
s({ type: Boolean })
|
|
784
|
+
], a.prototype, "showHeader", 2);
|
|
775
785
|
c([
|
|
776
|
-
|
|
777
|
-
],
|
|
786
|
+
s({ type: Boolean })
|
|
787
|
+
], a.prototype, "showFooter", 2);
|
|
778
788
|
c([
|
|
779
|
-
|
|
780
|
-
],
|
|
789
|
+
s({ type: Boolean })
|
|
790
|
+
], a.prototype, "showHeaderStartIcon", 2);
|
|
781
791
|
c([
|
|
782
|
-
|
|
783
|
-
],
|
|
792
|
+
s({ type: String })
|
|
793
|
+
], a.prototype, "headerTitle", 2);
|
|
784
794
|
c([
|
|
785
|
-
|
|
786
|
-
],
|
|
795
|
+
s({ type: String })
|
|
796
|
+
], a.prototype, "headerTitleClassName", 2);
|
|
787
797
|
c([
|
|
788
|
-
|
|
789
|
-
],
|
|
798
|
+
s({ type: String })
|
|
799
|
+
], a.prototype, "labelDialog", 2);
|
|
790
800
|
c([
|
|
791
|
-
|
|
792
|
-
],
|
|
801
|
+
s({ type: String })
|
|
802
|
+
], a.prototype, "labelAriaDialogPanel", 2);
|
|
793
803
|
c([
|
|
794
|
-
|
|
795
|
-
],
|
|
804
|
+
s({ type: String })
|
|
805
|
+
], a.prototype, "addToBagProductCount", 2);
|
|
796
806
|
c([
|
|
797
|
-
|
|
798
|
-
],
|
|
807
|
+
s({ type: String })
|
|
808
|
+
], a.prototype, "closeButtonLabel", 2);
|
|
799
809
|
c([
|
|
800
|
-
|
|
801
|
-
],
|
|
810
|
+
s({ type: String })
|
|
811
|
+
], a.prototype, "goBackButtonLabel", 2);
|
|
802
812
|
c([
|
|
803
|
-
|
|
804
|
-
],
|
|
813
|
+
s({ type: String })
|
|
814
|
+
], a.prototype, "firstButtonLabel", 2);
|
|
805
815
|
c([
|
|
806
|
-
|
|
807
|
-
],
|
|
816
|
+
s({ type: String })
|
|
817
|
+
], a.prototype, "firstButtonVariant", 2);
|
|
808
818
|
c([
|
|
809
|
-
|
|
810
|
-
],
|
|
819
|
+
s({ type: Object })
|
|
820
|
+
], a.prototype, "firstButtonProps", 2);
|
|
811
821
|
c([
|
|
812
|
-
|
|
813
|
-
],
|
|
822
|
+
s({ type: Boolean })
|
|
823
|
+
], a.prototype, "onFirstButtonClickClose", 2);
|
|
814
824
|
c([
|
|
815
|
-
|
|
816
|
-
],
|
|
825
|
+
s({ type: String })
|
|
826
|
+
], a.prototype, "secondButtonLabel", 2);
|
|
817
827
|
c([
|
|
818
|
-
|
|
819
|
-
],
|
|
828
|
+
s({ type: String })
|
|
829
|
+
], a.prototype, "secondButtonVariant", 2);
|
|
820
830
|
c([
|
|
821
|
-
|
|
822
|
-
],
|
|
831
|
+
s({ type: Object })
|
|
832
|
+
], a.prototype, "secondButtonProps", 2);
|
|
823
833
|
c([
|
|
824
|
-
|
|
825
|
-
],
|
|
834
|
+
s({ type: Boolean })
|
|
835
|
+
], a.prototype, "onSecondButtonClickClose", 2);
|
|
826
836
|
c([
|
|
827
|
-
|
|
828
|
-
],
|
|
837
|
+
s({ type: Boolean, reflect: !0 })
|
|
838
|
+
], a.prototype, "stickyFooter", 2);
|
|
829
839
|
c([
|
|
830
|
-
|
|
831
|
-
],
|
|
840
|
+
s({ type: Boolean })
|
|
841
|
+
], a.prototype, "disablePortal", 2);
|
|
832
842
|
c([
|
|
833
|
-
|
|
834
|
-
],
|
|
843
|
+
s({ type: Number })
|
|
844
|
+
], a.prototype, "zIndex", 2);
|
|
835
845
|
c([
|
|
836
|
-
|
|
837
|
-
],
|
|
846
|
+
s({ type: Boolean, reflect: !0 })
|
|
847
|
+
], a.prototype, "initialized", 2);
|
|
838
848
|
c([
|
|
839
|
-
|
|
840
|
-
],
|
|
849
|
+
s({ type: Boolean })
|
|
850
|
+
], a.prototype, "showDetail", 2);
|
|
841
851
|
c([
|
|
842
|
-
|
|
843
|
-
],
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
],
|
|
847
|
-
var
|
|
848
|
-
for (var n = i > 1 ? void 0 : i ?
|
|
849
|
-
(
|
|
850
|
-
return i && n &&
|
|
852
|
+
s({ type: Boolean })
|
|
853
|
+
], a.prototype, "isHidingDetail", 2);
|
|
854
|
+
a = c([
|
|
855
|
+
S("o-side-panel")
|
|
856
|
+
], a);
|
|
857
|
+
var W = Object.defineProperty, G = Object.getOwnPropertyDescriptor, u = (t, e, o, i) => {
|
|
858
|
+
for (var n = i > 1 ? void 0 : i ? G(e, o) : e, r = t.length - 1, l; r >= 0; r--)
|
|
859
|
+
(l = t[r]) && (n = (i ? l(e, o, n) : l(n)) || n);
|
|
860
|
+
return i && n && W(e, o, n), n;
|
|
851
861
|
};
|
|
852
|
-
const
|
|
853
|
-
let d = class extends
|
|
862
|
+
const Q = C(P(g)), at = ["primary", "secondary", "ghost", "tertiary", "link"];
|
|
863
|
+
let d = class extends Q {
|
|
854
864
|
constructor() {
|
|
855
865
|
super(...arguments), this.type = "submit", this.value = "", this.variant = "primary", this.text = "", this.textsecond = "", this.fullwidth = !1, this.disabled = !1, this.startIconModel = "", this.endIconModel = "", this.startIcon = !1, this.endIcon = !1, this.panelTarget = "", this.href = "", this.target = "", this.underlined = !1, this.withbadge = !1, this.hideRoleButton = !1, this.describedBy = null, this.ariaExpanded = null;
|
|
856
866
|
}
|
|
857
867
|
get name() {
|
|
858
868
|
return this.getAttribute("name") ?? "";
|
|
859
869
|
}
|
|
860
|
-
set name(
|
|
861
|
-
this.setAttribute("name",
|
|
870
|
+
set name(t) {
|
|
871
|
+
this.setAttribute("name", t);
|
|
862
872
|
}
|
|
863
873
|
get form() {
|
|
864
874
|
return this[E].form;
|
|
865
875
|
}
|
|
866
|
-
handleClick(
|
|
867
|
-
if (!(
|
|
868
|
-
const
|
|
869
|
-
|
|
876
|
+
handleClick(t) {
|
|
877
|
+
if (!(t instanceof KeyboardEvent && !["Enter", " "].includes(t.key)) && this.panelTarget) {
|
|
878
|
+
const e = document.getElementById(this.panelTarget);
|
|
879
|
+
e instanceof a && (e != null && e.openPanel) && typeof e.openPanel == "function" ? (t.preventDefault(), e.openPanel()) : console.warn(`[o-button] No side panel with id="${this.panelTarget}" found or it does not have an openPanel method.`);
|
|
870
880
|
}
|
|
871
881
|
}
|
|
872
882
|
render() {
|
|
@@ -875,28 +885,28 @@ let d = class extends J {
|
|
|
875
885
|
connectedCallback() {
|
|
876
886
|
var o, i;
|
|
877
887
|
super.connectedCallback();
|
|
878
|
-
const
|
|
879
|
-
(
|
|
888
|
+
const t = (o = this.startIconModel) == null ? void 0 : o.startsWith("occ-"), e = (i = this.endIconModel) == null ? void 0 : i.startsWith("occ-");
|
|
889
|
+
(t || e) && (t && x(this.startIconModel), e && x(this.endIconModel), this._unsubOcc = A(() => this.requestUpdate()));
|
|
880
890
|
}
|
|
881
891
|
disconnectedCallback() {
|
|
882
|
-
var
|
|
883
|
-
(
|
|
892
|
+
var t;
|
|
893
|
+
(t = this._unsubOcc) == null || t.call(this), super.disconnectedCallback();
|
|
884
894
|
}
|
|
885
|
-
renderIcon(
|
|
886
|
-
const
|
|
887
|
-
if (!
|
|
888
|
-
const o =
|
|
895
|
+
renderIcon(t) {
|
|
896
|
+
const e = t === "start" ? this.startIconModel : this.endIconModel;
|
|
897
|
+
if (!e) return p;
|
|
898
|
+
const o = _[e] ?? "";
|
|
889
899
|
if (!o) return p;
|
|
890
|
-
const i =
|
|
891
|
-
return h`<span class="${
|
|
900
|
+
const i = I(o);
|
|
901
|
+
return h`<span class="${t === "start" ? "icon-start" : "icon-end"}">${F(i)}</span>`;
|
|
892
902
|
}
|
|
893
903
|
renderButton() {
|
|
894
|
-
const
|
|
904
|
+
const t = this.text || this.textsecond;
|
|
895
905
|
return h`
|
|
896
906
|
<button type=${this.type} class="button" ?disabled=${this.disabled} @click=${this.handleClick} @keydown=${this.handleClick}
|
|
897
907
|
aria-describedby=${this.describedBy || p} aria-expanded=${this.ariaExpanded || p} >
|
|
898
908
|
${this.startIcon ? this.renderIcon("start") : p}
|
|
899
|
-
${
|
|
909
|
+
${t ? h`
|
|
900
910
|
${this.text ? h`<span class="text">${this.text}</span>` : p}
|
|
901
911
|
${this.textsecond ? h`<span class="text">${this.textsecond}</span>` : p}
|
|
902
912
|
${this.withbadge ? h`<slot></slot>` : p}
|
|
@@ -906,7 +916,7 @@ let d = class extends J {
|
|
|
906
916
|
`;
|
|
907
917
|
}
|
|
908
918
|
renderLink() {
|
|
909
|
-
const
|
|
919
|
+
const t = this.text || this.textsecond;
|
|
910
920
|
return h`
|
|
911
921
|
<a
|
|
912
922
|
href=${this.href}
|
|
@@ -919,7 +929,7 @@ let d = class extends J {
|
|
|
919
929
|
aria-describedby=${this.describedBy || p}
|
|
920
930
|
>
|
|
921
931
|
${this.startIcon ? this.renderIcon("start") : p}
|
|
922
|
-
${
|
|
932
|
+
${t ? h`
|
|
923
933
|
${this.text ? h`<span>${this.text}</span>` : p}
|
|
924
934
|
${this.textsecond ? h`<span>${this.textsecond}</span>` : p}
|
|
925
935
|
` : h`<slot></slot>`}
|
|
@@ -930,7 +940,7 @@ let d = class extends J {
|
|
|
930
940
|
};
|
|
931
941
|
T(d);
|
|
932
942
|
d.formAssociated = !0;
|
|
933
|
-
d.styles =
|
|
943
|
+
d.styles = k`
|
|
934
944
|
:host {
|
|
935
945
|
--button-border: transparent;
|
|
936
946
|
--badge-outer-width: 19px;
|
|
@@ -943,7 +953,7 @@ d.styles = C`
|
|
|
943
953
|
}
|
|
944
954
|
|
|
945
955
|
:host(.a--tabfocus) .button {
|
|
946
|
-
${
|
|
956
|
+
${m};
|
|
947
957
|
}
|
|
948
958
|
|
|
949
959
|
:host([fullwidth]) {
|
|
@@ -1094,7 +1104,7 @@ d.styles = C`
|
|
|
1094
1104
|
}
|
|
1095
1105
|
|
|
1096
1106
|
.button:focus-visible {
|
|
1097
|
-
${
|
|
1107
|
+
${m};
|
|
1098
1108
|
}
|
|
1099
1109
|
|
|
1100
1110
|
span.text + span.text::before {
|
|
@@ -1186,67 +1196,67 @@ d.styles = C`
|
|
|
1186
1196
|
}
|
|
1187
1197
|
`;
|
|
1188
1198
|
u([
|
|
1189
|
-
|
|
1199
|
+
s()
|
|
1190
1200
|
], d.prototype, "type", 2);
|
|
1191
1201
|
u([
|
|
1192
|
-
|
|
1202
|
+
s()
|
|
1193
1203
|
], d.prototype, "value", 2);
|
|
1194
1204
|
u([
|
|
1195
|
-
|
|
1205
|
+
s({ type: String, reflect: !0 })
|
|
1196
1206
|
], d.prototype, "variant", 2);
|
|
1197
1207
|
u([
|
|
1198
|
-
|
|
1208
|
+
s({ type: String })
|
|
1199
1209
|
], d.prototype, "text", 2);
|
|
1200
1210
|
u([
|
|
1201
|
-
|
|
1211
|
+
s({ type: String })
|
|
1202
1212
|
], d.prototype, "textsecond", 2);
|
|
1203
1213
|
u([
|
|
1204
|
-
|
|
1214
|
+
s({ type: Boolean, reflect: !0 })
|
|
1205
1215
|
], d.prototype, "fullwidth", 2);
|
|
1206
1216
|
u([
|
|
1207
|
-
|
|
1217
|
+
s({ type: Boolean, reflect: !0 })
|
|
1208
1218
|
], d.prototype, "disabled", 2);
|
|
1209
1219
|
u([
|
|
1210
|
-
|
|
1220
|
+
s({ type: String })
|
|
1211
1221
|
], d.prototype, "startIconModel", 2);
|
|
1212
1222
|
u([
|
|
1213
|
-
|
|
1223
|
+
s({ type: String })
|
|
1214
1224
|
], d.prototype, "endIconModel", 2);
|
|
1215
1225
|
u([
|
|
1216
|
-
|
|
1226
|
+
s({ type: Boolean, reflect: !0, attribute: "starticon" })
|
|
1217
1227
|
], d.prototype, "startIcon", 2);
|
|
1218
1228
|
u([
|
|
1219
|
-
|
|
1229
|
+
s({ type: Boolean, reflect: !0, attribute: "endicon" })
|
|
1220
1230
|
], d.prototype, "endIcon", 2);
|
|
1221
1231
|
u([
|
|
1222
|
-
|
|
1232
|
+
s({ type: String, attribute: "paneltarget" })
|
|
1223
1233
|
], d.prototype, "panelTarget", 2);
|
|
1224
1234
|
u([
|
|
1225
|
-
|
|
1235
|
+
s({ type: String })
|
|
1226
1236
|
], d.prototype, "href", 2);
|
|
1227
1237
|
u([
|
|
1228
|
-
|
|
1238
|
+
s({ type: String })
|
|
1229
1239
|
], d.prototype, "target", 2);
|
|
1230
1240
|
u([
|
|
1231
|
-
|
|
1241
|
+
s({ type: Boolean, reflect: !0 })
|
|
1232
1242
|
], d.prototype, "underlined", 2);
|
|
1233
1243
|
u([
|
|
1234
|
-
|
|
1244
|
+
s({ type: Boolean, reflect: !0 })
|
|
1235
1245
|
], d.prototype, "withbadge", 2);
|
|
1236
1246
|
u([
|
|
1237
|
-
|
|
1247
|
+
s({ type: Boolean, reflect: !0 })
|
|
1238
1248
|
], d.prototype, "hideRoleButton", 2);
|
|
1239
1249
|
u([
|
|
1240
|
-
|
|
1250
|
+
s({ reflect: !0, attribute: "describedby" })
|
|
1241
1251
|
], d.prototype, "describedBy", 2);
|
|
1242
1252
|
u([
|
|
1243
|
-
|
|
1253
|
+
s({ reflect: !0, attribute: "expanded" })
|
|
1244
1254
|
], d.prototype, "ariaExpanded", 2);
|
|
1245
1255
|
d = u([
|
|
1246
|
-
|
|
1256
|
+
S("o-button")
|
|
1247
1257
|
], d);
|
|
1248
1258
|
export {
|
|
1249
1259
|
d as O,
|
|
1250
|
-
|
|
1251
|
-
|
|
1260
|
+
a as OccitaneSidePanel,
|
|
1261
|
+
at as v
|
|
1252
1262
|
};
|