@kong-ui-public/page-layout 0.2.6 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/page-layout.es.js
CHANGED
|
@@ -1,152 +1,153 @@
|
|
|
1
|
-
import { watch as
|
|
2
|
-
import { useRouter as
|
|
3
|
-
import { createI18n as
|
|
4
|
-
import { ArrowTopLeftIcon as
|
|
5
|
-
const
|
|
1
|
+
import { watch as X, computed as T, toValue as K, unref as h, defineComponent as F, useCssVars as Y, inject as j, useTemplateRef as V, ref as x, onMounted as ee, onBeforeUnmount as te, resolveComponent as I, openBlock as i, createElementBlock as d, createElementVNode as g, normalizeClass as B, Fragment as N, renderList as R, createBlock as k, resolveDynamicComponent as H, withKeys as A, withModifiers as w, withCtx as S, createTextVNode as G, toDisplayString as P, createVNode as z, createCommentVNode as m, nextTick as W, provide as ae, onUnmounted as oe, renderSlot as U } from "vue";
|
|
2
|
+
import { useRouter as q } from "vue-router";
|
|
3
|
+
import { createI18n as ne, i18nTComponent as se } from "@kong-ui-public/i18n";
|
|
4
|
+
import { ArrowTopLeftIcon as ie } from "@kong/icons";
|
|
5
|
+
const le = "Go back", ue = {
|
|
6
6
|
more_button: {
|
|
7
7
|
label: "More",
|
|
8
8
|
aria_label: "More tabs"
|
|
9
9
|
}
|
|
10
|
-
},
|
|
11
|
-
|
|
10
|
+
}, ce = {
|
|
11
|
+
back_button: le,
|
|
12
|
+
tabs: ue
|
|
12
13
|
};
|
|
13
|
-
function
|
|
14
|
-
const e =
|
|
14
|
+
function re() {
|
|
15
|
+
const e = ne("en-us", ce);
|
|
15
16
|
return {
|
|
16
17
|
i18n: e,
|
|
17
|
-
i18nT:
|
|
18
|
+
i18nT: se(e)
|
|
18
19
|
// Translation component <i18n-t>
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
|
-
const
|
|
22
|
-
useI18n:
|
|
23
|
-
},
|
|
22
|
+
const J = {
|
|
23
|
+
useI18n: re
|
|
24
|
+
}, de = "16px", ve = "16px", be = typeof window < "u" && typeof document < "u";
|
|
24
25
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
25
26
|
const ye = Object.prototype.toString, fe = (e) => ye.call(e) === "[object Object]";
|
|
26
|
-
function
|
|
27
|
+
function O(e) {
|
|
27
28
|
return Array.isArray(e) ? e : [e];
|
|
28
29
|
}
|
|
29
30
|
function pe(e, l, n) {
|
|
30
|
-
return
|
|
31
|
+
return X(e, l, {
|
|
31
32
|
...n,
|
|
32
33
|
immediate: !0
|
|
33
34
|
});
|
|
34
35
|
}
|
|
35
|
-
const
|
|
36
|
-
function
|
|
36
|
+
const me = be ? window : void 0;
|
|
37
|
+
function ge(e) {
|
|
37
38
|
var l;
|
|
38
39
|
const n = K(e);
|
|
39
40
|
return (l = n == null ? void 0 : n.$el) !== null && l !== void 0 ? l : n;
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
+
function he(...e) {
|
|
42
43
|
const l = (o, a, s, u) => (o.addEventListener(a, s, u), () => o.removeEventListener(a, s, u)), n = T(() => {
|
|
43
|
-
const o =
|
|
44
|
+
const o = O(K(e[0])).filter((a) => a != null);
|
|
44
45
|
return o.every((a) => typeof a != "string") ? o : void 0;
|
|
45
46
|
});
|
|
46
47
|
return pe(() => {
|
|
47
48
|
var o, a;
|
|
48
49
|
return [
|
|
49
|
-
(o = (a = n.value) === null || a === void 0 ? void 0 : a.map((s) =>
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
(o = (a = n.value) === null || a === void 0 ? void 0 : a.map((s) => ge(s))) !== null && o !== void 0 ? o : [me].filter((s) => s != null),
|
|
51
|
+
O(K(n.value ? e[1] : e[0])),
|
|
52
|
+
O(h(n.value ? e[2] : e[1])),
|
|
52
53
|
K(n.value ? e[3] : e[2])
|
|
53
54
|
];
|
|
54
|
-
}, ([o, a, s, u],
|
|
55
|
+
}, ([o, a, s, u], f, r) => {
|
|
55
56
|
if (!(o != null && o.length) || !(a != null && a.length) || !(s != null && s.length)) return;
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
const v = fe(u) ? { ...u } : u, p = o.flatMap((c) => a.flatMap((_) => s.map((b) => l(c, _, b, v))));
|
|
58
|
+
r(() => {
|
|
59
|
+
p.forEach((c) => c());
|
|
59
60
|
});
|
|
60
61
|
}, { flush: "post" });
|
|
61
62
|
}
|
|
62
|
-
const
|
|
63
|
+
const ke = {
|
|
63
64
|
ref: "page-layout-tabs",
|
|
64
65
|
class: "page-layout-tabs",
|
|
65
66
|
"data-testid": "page-layout-tabs"
|
|
66
|
-
},
|
|
67
|
+
}, Te = { key: 0 }, we = ["aria-label"], _e = { class: "overflowing-items-count" }, Ie = {
|
|
67
68
|
key: 0,
|
|
68
69
|
class: "layout-loader-container"
|
|
69
|
-
},
|
|
70
|
+
}, Ce = /* @__PURE__ */ F({
|
|
70
71
|
__name: "PageLayoutTabs",
|
|
71
72
|
props: {
|
|
72
73
|
tabs: { default: () => [] }
|
|
73
74
|
},
|
|
74
75
|
setup(e) {
|
|
75
|
-
|
|
76
|
-
e372aee6:
|
|
76
|
+
Y((y) => ({
|
|
77
|
+
e372aee6: h(s)
|
|
77
78
|
}));
|
|
78
|
-
const { i18n: { t: l } } =
|
|
79
|
-
if (typeof
|
|
80
|
-
n.push(
|
|
79
|
+
const { i18n: { t: l } } = J.useI18n(), n = q(), o = j("app:navigateTo", null), a = (y) => {
|
|
80
|
+
if (typeof y.to != "string") {
|
|
81
|
+
n.push(y.to);
|
|
81
82
|
return;
|
|
82
83
|
}
|
|
83
84
|
if (typeof o != "function") {
|
|
84
|
-
window.location.href =
|
|
85
|
+
window.location.href = y.to;
|
|
85
86
|
return;
|
|
86
87
|
}
|
|
87
|
-
o(
|
|
88
|
-
}, s =
|
|
88
|
+
o(y.to);
|
|
89
|
+
}, s = ve, u = V("page-layout-tabs"), f = V("page-layout-tabs-list"), r = x(e.tabs.length), v = x(!1), p = T(() => e.tabs.slice(0, r.value)), c = T(() => e.tabs.slice(r.value)), _ = async () => {
|
|
89
90
|
var $, L, t;
|
|
90
|
-
if (!u.value || !
|
|
91
|
+
if (!u.value || !f.value)
|
|
91
92
|
return;
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
let C = (L =
|
|
95
|
-
if (!
|
|
96
|
-
|
|
93
|
+
v.value = !1, r.value = e.tabs.length, await W();
|
|
94
|
+
const y = (($ = u.value) == null ? void 0 : $.getBoundingClientRect().width) - parseInt(s) * 2;
|
|
95
|
+
let C = (L = f.value) == null ? void 0 : L.getBoundingClientRect().width;
|
|
96
|
+
if (!y || !C) {
|
|
97
|
+
v.value = !0;
|
|
97
98
|
return;
|
|
98
99
|
}
|
|
99
|
-
const
|
|
100
|
-
for (; C +
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
const E = 50;
|
|
101
|
+
for (; C + E > y && r.value > 1; )
|
|
102
|
+
r.value--, await W(), C = ((t = f.value) == null ? void 0 : t.getBoundingClientRect().width) || 0;
|
|
103
|
+
v.value = !0;
|
|
103
104
|
};
|
|
104
|
-
let
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
let b = null;
|
|
106
|
+
const D = () => {
|
|
107
|
+
b && clearTimeout(b), b = setTimeout(() => {
|
|
108
|
+
_();
|
|
108
109
|
}, 150);
|
|
109
110
|
};
|
|
110
|
-
return
|
|
111
|
-
|
|
112
|
-
}),
|
|
113
|
-
|
|
114
|
-
}), (
|
|
115
|
-
const
|
|
116
|
-
return i(), d("nav",
|
|
111
|
+
return ee(() => {
|
|
112
|
+
_(), he(window, "resize", D);
|
|
113
|
+
}), te(() => {
|
|
114
|
+
b && clearTimeout(b);
|
|
115
|
+
}), (y, C) => {
|
|
116
|
+
const E = I("KDropdownItem"), $ = I("KDropdown"), L = I("KSkeletonBox");
|
|
117
|
+
return i(), d("nav", ke, [
|
|
117
118
|
g("ul", {
|
|
118
119
|
ref: "page-layout-tabs-list",
|
|
119
|
-
class: B({ "layout-computing": !
|
|
120
|
+
class: B({ "layout-computing": !v.value })
|
|
120
121
|
}, [
|
|
121
|
-
(i(!0), d(
|
|
122
|
+
(i(!0), d(N, null, R(p.value, (t) => (i(), d("li", {
|
|
122
123
|
key: `${t.key}-tab`
|
|
123
124
|
}, [
|
|
124
|
-
(i(), k(
|
|
125
|
+
(i(), k(H(typeof t.to == "string" ? "a" : "router-link"), {
|
|
125
126
|
"aria-current": t.active ? "page" : void 0,
|
|
126
127
|
class: B(["tab-link", { active: t.active }]),
|
|
127
128
|
"data-testid": t.dataTestId ? t.dataTestId : `page-layout-tab-${t.key}`,
|
|
128
129
|
href: typeof t.to == "string" ? t.to : void 0,
|
|
129
130
|
tabindex: "0",
|
|
130
131
|
to: typeof t.to == "string" ? void 0 : t.to,
|
|
131
|
-
onClick:
|
|
132
|
+
onClick: w((M) => a(t), ["prevent"]),
|
|
132
133
|
onKeydown: [
|
|
133
|
-
A(
|
|
134
|
-
A(
|
|
134
|
+
A(w((M) => a(t), ["prevent"]), ["enter"]),
|
|
135
|
+
A(w((M) => a(t), ["prevent"]), ["space"])
|
|
135
136
|
]
|
|
136
137
|
}, {
|
|
137
138
|
default: S(() => [
|
|
138
|
-
|
|
139
|
+
G(P(t.label), 1)
|
|
139
140
|
]),
|
|
140
141
|
_: 2
|
|
141
142
|
}, 1064, ["aria-current", "class", "data-testid", "href", "to", "onClick", "onKeydown"]))
|
|
142
143
|
]))), 128)),
|
|
143
|
-
e.tabs.length >
|
|
144
|
-
|
|
144
|
+
e.tabs.length > r.value ? (i(), d("li", Te, [
|
|
145
|
+
z($, { "kpop-attributes": {
|
|
145
146
|
placement: "bottom-end",
|
|
146
147
|
popoverElementAttributes: { "data-testid": "tabs-overflow-dropdown-popover" }
|
|
147
148
|
} }, {
|
|
148
149
|
items: S(() => [
|
|
149
|
-
(i(!0), d(
|
|
150
|
+
(i(!0), d(N, null, R(c.value, (t) => (i(), k(E, {
|
|
150
151
|
key: `${t.key}-dropdown-item`,
|
|
151
152
|
"aria-current": t.active ? "page" : void 0,
|
|
152
153
|
"data-testid": t.dataTestId ? t.dataTestId : `page-layout-tab-${t.key}`,
|
|
@@ -160,20 +161,20 @@ const he = {
|
|
|
160
161
|
]),
|
|
161
162
|
default: S(() => [
|
|
162
163
|
g("button", {
|
|
163
|
-
"aria-label":
|
|
164
|
-
class: B(["tab-link overflow-dropdown-trigger", { active:
|
|
164
|
+
"aria-label": h(l)("tabs.more_button.aria_label"),
|
|
165
|
+
class: B(["tab-link overflow-dropdown-trigger", { active: c.value.find((t) => t.active) }]),
|
|
165
166
|
"data-testid": "tabs-overflow-dropdown-button"
|
|
166
167
|
}, [
|
|
167
|
-
|
|
168
|
-
g("span",
|
|
169
|
-
], 10,
|
|
168
|
+
G(P(h(l)("tabs.more_button.label")) + " ", 1),
|
|
169
|
+
g("span", _e, P(e.tabs.length - r.value), 1)
|
|
170
|
+
], 10, we)
|
|
170
171
|
]),
|
|
171
172
|
_: 1
|
|
172
173
|
})
|
|
173
|
-
])) :
|
|
174
|
+
])) : m("", !0)
|
|
174
175
|
], 2),
|
|
175
|
-
|
|
176
|
-
(i(), d(
|
|
176
|
+
v.value ? m("", !0) : (i(), d("div", Ie, [
|
|
177
|
+
(i(), d(N, null, R(3, (t) => z(L, {
|
|
177
178
|
key: `layout-loader-${t}`,
|
|
178
179
|
height: "1",
|
|
179
180
|
width: "5"
|
|
@@ -182,26 +183,26 @@ const he = {
|
|
|
182
183
|
], 512);
|
|
183
184
|
};
|
|
184
185
|
}
|
|
185
|
-
}),
|
|
186
|
+
}), Q = (e, l) => {
|
|
186
187
|
const n = e.__vccOpts || e;
|
|
187
188
|
for (const [o, a] of l)
|
|
188
189
|
n[o] = a;
|
|
189
190
|
return n;
|
|
190
|
-
},
|
|
191
|
+
}, $e = /* @__PURE__ */ Q(Ce, [["__scopeId", "data-v-a0346736"]]), Z = Symbol("nested-page-layout-detection"), Le = {
|
|
191
192
|
class: "kong-ui-public-page-layout",
|
|
192
193
|
"data-testid": "kong-ui-public-page-layout"
|
|
193
|
-
},
|
|
194
|
+
}, Ke = {
|
|
194
195
|
key: 0,
|
|
195
196
|
class: "page-layout-header",
|
|
196
197
|
"data-testid": "page-layout-header"
|
|
197
|
-
},
|
|
198
|
+
}, Be = { class: "page-header-container" }, Se = { class: "page-header-start" }, Pe = { class: "title-container" }, xe = {
|
|
198
199
|
key: 1,
|
|
199
200
|
class: "page-layout-title",
|
|
200
201
|
"data-testid": "page-layout-title"
|
|
201
|
-
},
|
|
202
|
+
}, Ae = {
|
|
202
203
|
key: 0,
|
|
203
204
|
class: "page-header-actions-container"
|
|
204
|
-
},
|
|
205
|
+
}, De = /* @__PURE__ */ F({
|
|
205
206
|
__name: "PageLayout",
|
|
206
207
|
props: {
|
|
207
208
|
breadcrumbs: { default: () => [] },
|
|
@@ -210,10 +211,10 @@ const he = {
|
|
|
210
211
|
tabs: { default: () => [] }
|
|
211
212
|
},
|
|
212
213
|
setup(e) {
|
|
213
|
-
const l =
|
|
214
|
+
const l = j("app:navigateTo", null), { i18n: { t: n } } = J.useI18n(), o = q(), a = T(() => !!(e.tabs && e.tabs.length)), s = T(() => typeof e.backTo == "string"), u = async () => {
|
|
214
215
|
if (e.backTo) {
|
|
215
216
|
if (typeof e.backTo == "object") {
|
|
216
|
-
|
|
217
|
+
o.push(e.backTo);
|
|
217
218
|
return;
|
|
218
219
|
}
|
|
219
220
|
if (typeof l != "function") {
|
|
@@ -222,66 +223,70 @@ const he = {
|
|
|
222
223
|
}
|
|
223
224
|
await l(e.backTo);
|
|
224
225
|
}
|
|
225
|
-
},
|
|
226
|
-
|
|
227
|
-
|
|
226
|
+
}, f = x(0), r = T(() => f.value > 0);
|
|
227
|
+
ae(Z, () => (f.value++, () => {
|
|
228
|
+
f.value--;
|
|
228
229
|
}));
|
|
229
|
-
const
|
|
230
|
-
return typeof
|
|
231
|
-
var
|
|
232
|
-
(
|
|
233
|
-
}), (
|
|
234
|
-
const
|
|
235
|
-
return i(), d("div",
|
|
236
|
-
|
|
237
|
-
g("div",
|
|
238
|
-
g("div",
|
|
239
|
-
e.breadcrumbs && e.breadcrumbs.length ? (i(), k(
|
|
230
|
+
const v = j(Z, null), p = x(null);
|
|
231
|
+
return typeof v == "function" && (p.value = v()), oe(() => {
|
|
232
|
+
var c;
|
|
233
|
+
(c = p.value) == null || c.call(p);
|
|
234
|
+
}), (c, _) => {
|
|
235
|
+
const b = I("KBreadcrumbs"), D = I("router-view");
|
|
236
|
+
return i(), d("div", Le, [
|
|
237
|
+
r.value ? m("", !0) : (i(), d("div", Ke, [
|
|
238
|
+
g("div", Be, [
|
|
239
|
+
g("div", Se, [
|
|
240
|
+
e.breadcrumbs && e.breadcrumbs.length ? (i(), k(b, {
|
|
240
241
|
key: 0,
|
|
241
242
|
class: "header-breadcrumbs",
|
|
242
243
|
"data-testid": "page-layout-breadcrumbs",
|
|
243
244
|
items: e.breadcrumbs
|
|
244
|
-
}, null, 8, ["items"])) :
|
|
245
|
-
g("div",
|
|
246
|
-
e.backTo ? (i(), k(
|
|
245
|
+
}, null, 8, ["items"])) : m("", !0),
|
|
246
|
+
g("div", Pe, [
|
|
247
|
+
e.backTo ? (i(), k(H(s.value ? "a" : "router-link"), {
|
|
247
248
|
key: 0,
|
|
249
|
+
"aria-label": h(n)("back_button"),
|
|
248
250
|
class: "navigate-back",
|
|
249
251
|
"data-testid": "page-layout-navigate-back",
|
|
250
|
-
href:
|
|
252
|
+
href: s.value ? e.backTo : void 0,
|
|
251
253
|
tabindex: "0",
|
|
252
|
-
to:
|
|
253
|
-
onClick:
|
|
254
|
+
to: s.value ? void 0 : e.backTo,
|
|
255
|
+
onClick: w(u, ["prevent"]),
|
|
254
256
|
onKeydown: [
|
|
255
|
-
A(
|
|
256
|
-
A(
|
|
257
|
+
A(w(u, ["prevent"]), ["enter"]),
|
|
258
|
+
A(w(u, ["prevent"]), ["space"])
|
|
257
259
|
]
|
|
258
260
|
}, {
|
|
259
261
|
default: S(() => [
|
|
260
|
-
|
|
262
|
+
z(h(ie), {
|
|
263
|
+
decorative: "",
|
|
264
|
+
size: h(de)
|
|
265
|
+
}, null, 8, ["size"])
|
|
261
266
|
]),
|
|
262
267
|
_: 1
|
|
263
|
-
}, 40, ["href", "to", "onKeydown"])) :
|
|
264
|
-
e.title ? (i(), d("h1",
|
|
268
|
+
}, 40, ["aria-label", "href", "to", "onKeydown"])) : m("", !0),
|
|
269
|
+
e.title ? (i(), d("h1", xe, P(e.title), 1)) : m("", !0)
|
|
265
270
|
])
|
|
266
271
|
]),
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
])) :
|
|
272
|
+
c.$slots.actions ? (i(), d("div", Ae, [
|
|
273
|
+
U(c.$slots, "actions", {}, void 0, !0)
|
|
274
|
+
])) : m("", !0)
|
|
270
275
|
]),
|
|
271
|
-
|
|
276
|
+
a.value ? (i(), k($e, {
|
|
272
277
|
key: 0,
|
|
273
278
|
tabs: e.tabs
|
|
274
|
-
}, null, 8, ["tabs"])) :
|
|
279
|
+
}, null, 8, ["tabs"])) : m("", !0)
|
|
275
280
|
])),
|
|
276
281
|
g("div", {
|
|
277
|
-
class: B(["page-layout-content", { "has-nested-page-layout":
|
|
282
|
+
class: B(["page-layout-content", { "has-nested-page-layout": r.value }])
|
|
278
283
|
}, [
|
|
279
|
-
|
|
284
|
+
a.value ? (i(), k(D, { key: 0 })) : U(c.$slots, "default", { key: 1 }, void 0, !0)
|
|
280
285
|
], 2)
|
|
281
286
|
]);
|
|
282
287
|
};
|
|
283
288
|
}
|
|
284
|
-
}),
|
|
289
|
+
}), je = /* @__PURE__ */ Q(De, [["__scopeId", "data-v-83a31618"]]);
|
|
285
290
|
export {
|
|
286
|
-
|
|
291
|
+
je as PageLayout
|
|
287
292
|
};
|
package/dist/page-layout.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(u,
|
|
1
|
+
(function(u,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("vue-router"),require("@kong-ui-public/i18n"),require("@kong/icons")):typeof define=="function"&&define.amd?define(["exports","vue","vue-router","@kong-ui-public/i18n","@kong/icons"],t):(u=typeof globalThis<"u"?globalThis:u||self,t(u["kong-ui-public-page-layout"]={},u.Vue,u.VueRouter,u["kong-ui-public-i18n"],u.KongIcons))})(this,function(u,t,_,E,L){"use strict";const S={back_button:"Go back",tabs:{more_button:{label:"More",aria_label:"More tabs"}}};function K(){const e=E.createI18n("en-us",S);return{i18n:e,i18nT:E.i18nTComponent(e)}}const N={useI18n:K},x="16px",D="16px",P=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const M=Object.prototype.toString,j=e=>M.call(e)==="[object Object]";function T(e){return Array.isArray(e)?e:[e]}function A(e,c,l){return t.watch(e,c,{...l,immediate:!0})}const R=P?window:void 0;function z(e){var c;const l=t.toValue(e);return(c=l==null?void 0:l.$el)!==null&&c!==void 0?c:l}function O(...e){const c=(a,n,i,s)=>(a.addEventListener(n,i,s),()=>a.removeEventListener(n,i,s)),l=t.computed(()=>{const a=T(t.toValue(e[0])).filter(n=>n!=null);return a.every(n=>typeof n!="string")?a:void 0});return A(()=>{var a,n;return[(a=(n=l.value)===null||n===void 0?void 0:n.map(i=>z(i)))!==null&&a!==void 0?a:[R].filter(i=>i!=null),T(t.toValue(l.value?e[1]:e[0])),T(t.unref(l.value?e[2]:e[1])),t.toValue(l.value?e[3]:e[2])]},([a,n,i,s],y,d)=>{if(!(a!=null&&a.length)||!(n!=null&&n.length)||!(i!=null&&i.length))return;const m=j(s)?{...s}:s,k=a.flatMap(r=>n.flatMap(b=>i.map(p=>c(r,b,p,m))));d(()=>{k.forEach(r=>r())})},{flush:"post"})}const G={ref:"page-layout-tabs",class:"page-layout-tabs","data-testid":"page-layout-tabs"},W={key:0},q=["aria-label"],U={class:"overflowing-items-count"},F={key:0,class:"layout-loader-container"},Z=t.defineComponent({__name:"PageLayoutTabs",props:{tabs:{default:()=>[]}},setup(e){t.useCssVars(f=>({e372aee6:t.unref(i)}));const{i18n:{t:c}}=N.useI18n(),l=_.useRouter(),a=t.inject("app:navigateTo",null),n=f=>{if(typeof f.to!="string"){l.push(f.to);return}if(typeof a!="function"){window.location.href=f.to;return}a(f.to)},i=D,s=t.useTemplateRef("page-layout-tabs"),y=t.useTemplateRef("page-layout-tabs-list"),d=t.ref(e.tabs.length),m=t.ref(!1),k=t.computed(()=>e.tabs.slice(0,d.value)),r=t.computed(()=>e.tabs.slice(d.value)),b=async()=>{var h,B,o;if(!s.value||!y.value)return;m.value=!1,d.value=e.tabs.length,await t.nextTick();const f=((h=s.value)==null?void 0:h.getBoundingClientRect().width)-parseInt(i)*2;let g=(B=y.value)==null?void 0:B.getBoundingClientRect().width;if(!f||!g){m.value=!0;return}const w=50;for(;g+w>f&&d.value>1;)d.value--,await t.nextTick(),g=((o=y.value)==null?void 0:o.getBoundingClientRect().width)||0;m.value=!0};let p=null;const C=()=>{p&&clearTimeout(p),p=setTimeout(()=>{b()},150)};return t.onMounted(()=>{b(),O(window,"resize",C)}),t.onBeforeUnmount(()=>{p&&clearTimeout(p)}),(f,g)=>{const w=t.resolveComponent("KDropdownItem"),h=t.resolveComponent("KDropdown"),B=t.resolveComponent("KSkeletonBox");return t.openBlock(),t.createElementBlock("nav",G,[t.createElementVNode("ul",{ref:"page-layout-tabs-list",class:t.normalizeClass({"layout-computing":!m.value})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.value,o=>(t.openBlock(),t.createElementBlock("li",{key:`${o.key}-tab`},[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(typeof o.to=="string"?"a":"router-link"),{"aria-current":o.active?"page":void 0,class:t.normalizeClass(["tab-link",{active:o.active}]),"data-testid":o.dataTestId?o.dataTestId:`page-layout-tab-${o.key}`,href:typeof o.to=="string"?o.to:void 0,tabindex:"0",to:typeof o.to=="string"?void 0:o.to,onClick:t.withModifiers($=>n(o),["prevent"]),onKeydown:[t.withKeys(t.withModifiers($=>n(o),["prevent"]),["enter"]),t.withKeys(t.withModifiers($=>n(o),["prevent"]),["space"])]},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(o.label),1)]),_:2},1064,["aria-current","class","data-testid","href","to","onClick","onKeydown"]))]))),128)),e.tabs.length>d.value?(t.openBlock(),t.createElementBlock("li",W,[t.createVNode(h,{"kpop-attributes":{placement:"bottom-end",popoverElementAttributes:{"data-testid":"tabs-overflow-dropdown-popover"}}},{items:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,o=>(t.openBlock(),t.createBlock(w,{key:`${o.key}-dropdown-item`,"aria-current":o.active?"page":void 0,"data-testid":o.dataTestId?o.dataTestId:`page-layout-tab-${o.key}`,item:{label:o.label,value:o.key,to:o.to},selected:o.active},null,8,["aria-current","data-testid","item","selected"]))),128))]),default:t.withCtx(()=>[t.createElementVNode("button",{"aria-label":t.unref(c)("tabs.more_button.aria_label"),class:t.normalizeClass(["tab-link overflow-dropdown-trigger",{active:r.value.find(o=>o.active)}]),"data-testid":"tabs-overflow-dropdown-button"},[t.createTextVNode(t.toDisplayString(t.unref(c)("tabs.more_button.label"))+" ",1),t.createElementVNode("span",U,t.toDisplayString(e.tabs.length-d.value),1)],10,q)]),_:1})])):t.createCommentVNode("",!0)],2),m.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",F,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(3,o=>t.createVNode(B,{key:`layout-loader-${o}`,height:"1",width:"5"})),64))]))],512)}}}),V=(e,c)=>{const l=e.__vccOpts||e;for(const[a,n]of c)l[a]=n;return l},H=V(Z,[["__scopeId","data-v-a0346736"]]),I=Symbol("nested-page-layout-detection"),J={class:"kong-ui-public-page-layout","data-testid":"kong-ui-public-page-layout"},Q={key:0,class:"page-layout-header","data-testid":"page-layout-header"},X={class:"page-header-container"},Y={class:"page-header-start"},v={class:"title-container"},tt={key:1,class:"page-layout-title","data-testid":"page-layout-title"},et={key:0,class:"page-header-actions-container"},ot=V(t.defineComponent({__name:"PageLayout",props:{breadcrumbs:{default:()=>[]},title:{},backTo:{},tabs:{default:()=>[]}},setup(e){const c=t.inject("app:navigateTo",null),{i18n:{t:l}}=N.useI18n(),a=_.useRouter(),n=t.computed(()=>!!(e.tabs&&e.tabs.length)),i=t.computed(()=>typeof e.backTo=="string"),s=async()=>{if(e.backTo){if(typeof e.backTo=="object"){a.push(e.backTo);return}if(typeof c!="function"){window.location.href=e.backTo;return}await c(e.backTo)}},y=t.ref(0),d=t.computed(()=>y.value>0);t.provide(I,()=>(y.value++,()=>{y.value--}));const m=t.inject(I,null),k=t.ref(null);return typeof m=="function"&&(k.value=m()),t.onUnmounted(()=>{var r;(r=k.value)==null||r.call(k)}),(r,b)=>{const p=t.resolveComponent("KBreadcrumbs"),C=t.resolveComponent("router-view");return t.openBlock(),t.createElementBlock("div",J,[d.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Q,[t.createElementVNode("div",X,[t.createElementVNode("div",Y,[e.breadcrumbs&&e.breadcrumbs.length?(t.openBlock(),t.createBlock(p,{key:0,class:"header-breadcrumbs","data-testid":"page-layout-breadcrumbs",items:e.breadcrumbs},null,8,["items"])):t.createCommentVNode("",!0),t.createElementVNode("div",v,[e.backTo?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(i.value?"a":"router-link"),{key:0,"aria-label":t.unref(l)("back_button"),class:"navigate-back","data-testid":"page-layout-navigate-back",href:i.value?e.backTo:void 0,tabindex:"0",to:i.value?void 0:e.backTo,onClick:t.withModifiers(s,["prevent"]),onKeydown:[t.withKeys(t.withModifiers(s,["prevent"]),["enter"]),t.withKeys(t.withModifiers(s,["prevent"]),["space"])]},{default:t.withCtx(()=>[t.createVNode(t.unref(L.ArrowTopLeftIcon),{decorative:"",size:t.unref(x)},null,8,["size"])]),_:1},40,["aria-label","href","to","onKeydown"])):t.createCommentVNode("",!0),e.title?(t.openBlock(),t.createElementBlock("h1",tt,t.toDisplayString(e.title),1)):t.createCommentVNode("",!0)])]),r.$slots.actions?(t.openBlock(),t.createElementBlock("div",et,[t.renderSlot(r.$slots,"actions",{},void 0,!0)])):t.createCommentVNode("",!0)]),n.value?(t.openBlock(),t.createBlock(H,{key:0,tabs:e.tabs},null,8,["tabs"])):t.createCommentVNode("",!0)])),t.createElementVNode("div",{class:t.normalizeClass(["page-layout-content",{"has-nested-page-layout":d.value}])},[n.value?(t.openBlock(),t.createBlock(C,{key:0})):t.renderSlot(r.$slots,"default",{key:1},void 0,!0)],2)])}}}),[["__scopeId","data-v-83a31618"]]);u.PageLayout=ot,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.page-layout-tabs[data-v-a0346736]{align-items:flex-end;border-bottom:1px solid #e0e4ea;border-bottom:var(--kui-border-width-10, 1px) solid var(--kui-color-border, #e0e4ea);box-sizing:border-box;display:flex;height:34px;overflow-x:clip;padding:0px var(--e372aee6);padding:var(--kui-space-0, 0px) var(--e372aee6);position:relative;width:100%}.page-layout-tabs a[data-v-a0346736],.page-layout-tabs button[data-v-a0346736]{background-color:transparent;background-color:var(--kui-color-background-transparent, transparent);border:none;color:inherit;cursor:pointer;outline:none;padding:0;padding:var(--kui-space-0, 0px);text-decoration:none}.page-layout-tabs ul[data-v-a0346736]{display:flex;gap:20px;gap:var(--kui-space-70, 20px);list-style:none;margin:0;margin:var(--kui-space-0, 0px);margin-bottom:-1px;margin-bottom:calc(-1 * var(--kui-border-width-10, 1px));max-width:100%;padding:0;padding:var(--kui-space-0, 0px)}.page-layout-tabs ul.layout-computing[data-v-a0346736]{height:0;visibility:hidden}.page-layout-tabs ul li[data-v-a0346736]{display:flex}.page-layout-tabs ul li .tab-link[data-v-a0346736]{align-items:center;border-bottom:2px solid transparent;border-bottom:var(--kui-border-width-20, 2px) solid var(--kui-color-border-transparent, transparent);border-radius:4px 4px 0 0;border-radius:var(--kui-border-radius-20, 4px) var(--kui-border-radius-20, 4px) var(--kui-border-radius-0, 0px) var(--kui-border-radius-0, 0px);color:#52596e;color:var(--kui-color-text-neutral-strong, #52596e);cursor:pointer;display:flex;font-size:12px;font-size:var(--kui-font-size-20, 12px);font-weight:500;font-weight:var(--kui-font-weight-medium, 500);gap:6px;gap:var(--kui-space-30, 6px);line-height:20px;line-height:var(--kui-line-height-30, 20px);padding:6px 0;padding:var(--kui-space-30, 6px) var(--kui-space-0, 0px);transition:color .2s ease-in,border-color .2s ease-in,font-weight .2s ease-in;white-space:nowrap}.page-layout-tabs ul li .tab-link[data-v-a0346736]:hover{border-bottom:2px solid #afb7c5;border-bottom:var(--kui-border-width-20, 2px) solid var(--kui-color-border-neutral-weak, #afb7c5);color:#000933;color:var(--kui-color-text, #000933)}.page-layout-tabs ul li .tab-link[data-v-a0346736]:focus-visible{box-shadow:0 0 0 4px #0044f433;box-shadow:var(--kui-shadow-focus, 0px 0px 0px 4px rgba(0, 68, 244, .2))}.page-layout-tabs ul li .tab-link.active[data-v-a0346736]{border-bottom:2px solid #0044f4;border-bottom:var(--kui-border-width-20, 2px) solid var(--kui-color-border-primary, #0044f4);color:#0044f4!important;color:var(--kui-color-text-primary, #0044f4)!important;font-weight:600;font-weight:var(--kui-font-weight-semibold, 600)}.page-layout-tabs ul li .tab-link.overflow-dropdown-trigger[data-v-a0346736]{color:#000933;color:var(--kui-color-text, #000933);font-weight:500!important;font-weight:var(--kui-font-weight-medium, 500)!important}.page-layout-tabs ul li .tab-link.overflow-dropdown-trigger .overflowing-items-count[data-v-a0346736]{background-color:#e0e4ea;background-color:var(--kui-color-background-neutral-weaker, #e0e4ea);border-radius:100px;border-radius:var(--kui-border-radius-round, 100px);color:#52596e;color:var(--kui-color-text-neutral-strong, #52596e);font-size:11px;font-weight:600;font-weight:var(--kui-font-weight-semibold, 600);line-height:12px;padding:2px 6px;padding:var(--kui-space-10, 2px) var(--kui-space-30, 6px)}.page-layout-tabs ul li .tab-link.overflow-dropdown-trigger.active .overflowing-items-count[data-v-a0346736]{background-color:#eefaff;background-color:var(--kui-color-background-primary-weakest, #eefaff);color:#0044f4;color:var(--kui-color-text-primary, #0044f4)}.page-layout-tabs .layout-loader-container[data-v-a0346736]{align-items:center;display:flex;gap:20px;gap:var(--kui-space-70, 20px);height:34px;top:0;right:0;bottom:0;left:0;left:var(--e372aee6);position:absolute}.kong-ui-public-page-layout[data-v-
|
|
1
|
+
.page-layout-tabs[data-v-a0346736]{align-items:flex-end;border-bottom:1px solid #e0e4ea;border-bottom:var(--kui-border-width-10, 1px) solid var(--kui-color-border, #e0e4ea);box-sizing:border-box;display:flex;height:34px;overflow-x:clip;padding:0px var(--e372aee6);padding:var(--kui-space-0, 0px) var(--e372aee6);position:relative;width:100%}.page-layout-tabs a[data-v-a0346736],.page-layout-tabs button[data-v-a0346736]{background-color:transparent;background-color:var(--kui-color-background-transparent, transparent);border:none;color:inherit;cursor:pointer;outline:none;padding:0;padding:var(--kui-space-0, 0px);text-decoration:none}.page-layout-tabs ul[data-v-a0346736]{display:flex;gap:20px;gap:var(--kui-space-70, 20px);list-style:none;margin:0;margin:var(--kui-space-0, 0px);margin-bottom:-1px;margin-bottom:calc(-1 * var(--kui-border-width-10, 1px));max-width:100%;padding:0;padding:var(--kui-space-0, 0px)}.page-layout-tabs ul.layout-computing[data-v-a0346736]{height:0;visibility:hidden}.page-layout-tabs ul li[data-v-a0346736]{display:flex}.page-layout-tabs ul li .tab-link[data-v-a0346736]{align-items:center;border-bottom:2px solid transparent;border-bottom:var(--kui-border-width-20, 2px) solid var(--kui-color-border-transparent, transparent);border-radius:4px 4px 0 0;border-radius:var(--kui-border-radius-20, 4px) var(--kui-border-radius-20, 4px) var(--kui-border-radius-0, 0px) var(--kui-border-radius-0, 0px);color:#52596e;color:var(--kui-color-text-neutral-strong, #52596e);cursor:pointer;display:flex;font-size:12px;font-size:var(--kui-font-size-20, 12px);font-weight:500;font-weight:var(--kui-font-weight-medium, 500);gap:6px;gap:var(--kui-space-30, 6px);line-height:20px;line-height:var(--kui-line-height-30, 20px);padding:6px 0;padding:var(--kui-space-30, 6px) var(--kui-space-0, 0px);transition:color .2s ease-in,border-color .2s ease-in,font-weight .2s ease-in;white-space:nowrap}.page-layout-tabs ul li .tab-link[data-v-a0346736]:hover{border-bottom:2px solid #afb7c5;border-bottom:var(--kui-border-width-20, 2px) solid var(--kui-color-border-neutral-weak, #afb7c5);color:#000933;color:var(--kui-color-text, #000933)}.page-layout-tabs ul li .tab-link[data-v-a0346736]:focus-visible{box-shadow:0 0 0 4px #0044f433;box-shadow:var(--kui-shadow-focus, 0px 0px 0px 4px rgba(0, 68, 244, .2))}.page-layout-tabs ul li .tab-link.active[data-v-a0346736]{border-bottom:2px solid #0044f4;border-bottom:var(--kui-border-width-20, 2px) solid var(--kui-color-border-primary, #0044f4);color:#0044f4!important;color:var(--kui-color-text-primary, #0044f4)!important;font-weight:600;font-weight:var(--kui-font-weight-semibold, 600)}.page-layout-tabs ul li .tab-link.overflow-dropdown-trigger[data-v-a0346736]{color:#000933;color:var(--kui-color-text, #000933);font-weight:500!important;font-weight:var(--kui-font-weight-medium, 500)!important}.page-layout-tabs ul li .tab-link.overflow-dropdown-trigger .overflowing-items-count[data-v-a0346736]{background-color:#e0e4ea;background-color:var(--kui-color-background-neutral-weaker, #e0e4ea);border-radius:100px;border-radius:var(--kui-border-radius-round, 100px);color:#52596e;color:var(--kui-color-text-neutral-strong, #52596e);font-size:11px;font-weight:600;font-weight:var(--kui-font-weight-semibold, 600);line-height:12px;padding:2px 6px;padding:var(--kui-space-10, 2px) var(--kui-space-30, 6px)}.page-layout-tabs ul li .tab-link.overflow-dropdown-trigger.active .overflowing-items-count[data-v-a0346736]{background-color:#eefaff;background-color:var(--kui-color-background-primary-weakest, #eefaff);color:#0044f4;color:var(--kui-color-text-primary, #0044f4)}.page-layout-tabs .layout-loader-container[data-v-a0346736]{align-items:center;display:flex;gap:20px;gap:var(--kui-space-70, 20px);height:34px;top:0;right:0;bottom:0;left:0;left:var(--e372aee6);position:absolute}.kong-ui-public-page-layout[data-v-83a31618]{box-sizing:border-box;font-family:Inter,Roboto,Helvetica,sans-serif;font-family:var(--kui-font-family-text, "Inter", Roboto, Helvetica, sans-serif)}.kong-ui-public-page-layout .page-layout-header[data-v-83a31618]{display:flex;flex-direction:column;gap:8px;gap:var(--kui-space-40, 8px)}.kong-ui-public-page-layout .page-layout-header .page-header-container[data-v-83a31618]{align-items:flex-end;display:flex;gap:6px;gap:var(--kui-space-30, 6px);justify-content:space-between;padding:16px 16px 0;padding:var(--kui-space-60, 16px) var(--kui-space-60, 16px) var(--kui-space-0, 0px) var(--kui-space-60, 16px)}.kong-ui-public-page-layout .page-layout-header .page-header-container .page-header-start .header-breadcrumbs[data-v-83a31618] .breadcrumbs-item-container:first-child .breadcrumbs-item{padding-left:0;padding-left:var(--kui-space-0, 0px)}.kong-ui-public-page-layout .page-layout-header .page-header-container .page-header-start .header-breadcrumbs[data-v-83a31618] .breadcrumbs-item-container .breadcrumbs-item.active .breadcrumbs-text{color:#6c7489;color:var(--kui-color-text-neutral, #6c7489)}.kong-ui-public-page-layout .page-layout-header .page-header-container .page-header-start .title-container[data-v-83a31618]{align-items:center;display:flex;gap:4px;gap:var(--kui-space-20, 4px)}.kong-ui-public-page-layout .page-layout-header .page-header-container .page-header-start .title-container .navigate-back[data-v-83a31618]{background-color:transparent;background-color:var(--kui-color-background-transparent, transparent);border:none;border-radius:4px;border-radius:var(--kui-border-radius-20, 4px);color:#6c7489;color:var(--kui-color-text-neutral, #6c7489);cursor:pointer;outline:none;padding:4px;padding:var(--kui-space-20, 4px);transition:background-color .2s ease-in,color .2s ease-in}.kong-ui-public-page-layout .page-layout-header .page-header-container .page-header-start .title-container .navigate-back[data-v-83a31618]:hover{color:#000933;color:var(--kui-color-text, #000933)}.kong-ui-public-page-layout .page-layout-header .page-header-container .page-header-start .title-container .navigate-back[data-v-83a31618]:focus-visible{box-shadow:0 0 0 4px #0044f433;box-shadow:var(--kui-shadow-focus, 0px 0px 0px 4px rgba(0, 68, 244, .2))}.kong-ui-public-page-layout .page-layout-header .page-header-container .page-header-start .title-container .page-layout-title[data-v-83a31618]{color:#000933;color:var(--kui-color-text, #000933);font-size:18px;font-size:var(--kui-font-size-50, 18px);font-weight:600;font-weight:var(--kui-font-weight-semibold, 600);line-height:24px;line-height:var(--kui-line-height-40, 24px);margin:0;margin:var(--kui-space-0, 0px)}.kong-ui-public-page-layout .page-layout-header .page-header-container .page-header-actions-container[data-v-83a31618]{align-items:flex-end;display:flex;gap:6px;gap:var(--kui-space-30, 6px);justify-content:flex-end}.kong-ui-public-page-layout .page-layout-header:not(:has(.page-layout-tabs)) .page-header-container[data-v-83a31618]{border-bottom:1px solid #e0e4ea;border-bottom:var(--kui-border-width-10, 1px) solid var(--kui-color-border, #e0e4ea);padding:16px;padding:var(--kui-space-60, 16px)}.kong-ui-public-page-layout .page-layout-content[data-v-83a31618]{display:flex;flex-direction:column;gap:12px;gap:var(--kui-space-50, 12px);padding:16px;padding:var(--kui-space-60, 16px)}.kong-ui-public-page-layout .page-layout-content.has-nested-page-layout[data-v-83a31618]{padding:0;padding:var(--kui-space-0, 0px)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageLayout.vue.d.ts","sourceRoot":"","sources":["../../../src/components/PageLayout.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PageLayout.vue.d.ts","sourceRoot":"","sources":["../../../src/components/PageLayout.vue"],"names":[],"mappings":"AAsQA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAiBhE,KAAK,WAAW,GAAG,eAAe,CAAC;AAkQnC,QAAA,MAAM,UAAU,0SAEd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|