@kong-ui-public/page-layout 0.3.2-pr.3501.a440ad144.0 → 0.3.2
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 +402 -0
- package/dist/page-layout.umd.js +1 -0
- package/dist/style.css +1 -0
- package/dist/types/components/PageLayout.vue.d.ts +12 -0
- package/dist/types/components/PageLayout.vue.d.ts.map +1 -0
- package/dist/types/components/PageLayoutTabs.vue.d.ts +21 -0
- package/dist/types/components/PageLayoutTabs.vue.d.ts.map +1 -0
- package/dist/types/composables/index.d.ts +6 -0
- package/dist/types/composables/index.d.ts.map +1 -0
- package/dist/types/composables/useI18n.d.ts +9 -0
- package/dist/types/composables/useI18n.d.ts.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/symbols.d.ts +2 -0
- package/dist/types/symbols.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +3 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/types/page-layout-tabs.d.ts +22 -0
- package/dist/types/types/page-layout-tabs.d.ts.map +1 -0
- package/dist/types/types/page-layout.d.ts +50 -0
- package/dist/types/types/page-layout.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import { getCurrentScope as rt, onScopeDispose as ut, toValue as x, watch as j, computed as h, shallowRef as lt, getCurrentInstance as ct, onMounted as Q, defineComponent as X, useCssVars as dt, unref as d, inject as R, useTemplateRef as U, ref as K, onBeforeUnmount as vt, resolveComponent as D, openBlock as r, createElementBlock as p, createElementVNode as S, normalizeClass as E, Fragment as O, renderList as z, createBlock as $, resolveDynamicComponent as W, mergeProps as Y, withKeys as tt, withModifiers as A, withCtx as C, renderSlot as _, createTextVNode as V, toDisplayString as L, createVNode as F, createCommentVNode as g, nextTick as Z, provide as ft, onUnmounted as bt, createSlots as pt, normalizeProps as yt, guardReactiveProps as mt } from "vue";
|
|
2
|
+
import { useRouter as et, useRoute as gt } from "vue-router";
|
|
3
|
+
import { createI18n as ht, i18nTComponent as kt } from "@kong-ui-public/i18n";
|
|
4
|
+
import { ChevronDownIcon as Tt, ArrowTopLeftIcon as wt, StarFillIcon as St, StarIcon as $t } from "@kong/icons";
|
|
5
|
+
const _t = "Go back", Ct = {
|
|
6
|
+
save_shortcut: "Save page to shortcuts",
|
|
7
|
+
remove_shortcut: "Remove page from shortcuts"
|
|
8
|
+
}, It = {
|
|
9
|
+
more_button: {
|
|
10
|
+
label: "More",
|
|
11
|
+
aria_label: "More tabs"
|
|
12
|
+
}
|
|
13
|
+
}, Dt = {
|
|
14
|
+
back_button: _t,
|
|
15
|
+
favorite_button: Ct,
|
|
16
|
+
tabs: It
|
|
17
|
+
};
|
|
18
|
+
function Pt() {
|
|
19
|
+
const t = ht("en-us", Dt);
|
|
20
|
+
return {
|
|
21
|
+
i18n: t,
|
|
22
|
+
i18nT: kt(t)
|
|
23
|
+
// Translation component <i18n-t>
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
const at = {
|
|
27
|
+
useI18n: Pt
|
|
28
|
+
}, M = "16px", Bt = "16px";
|
|
29
|
+
function Kt(t, o) {
|
|
30
|
+
return rt() ? (ut(t, o), !0) : !1;
|
|
31
|
+
}
|
|
32
|
+
const Ft = typeof window < "u" && typeof document < "u";
|
|
33
|
+
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
34
|
+
const H = () => {
|
|
35
|
+
};
|
|
36
|
+
function Rt(t, o) {
|
|
37
|
+
function e(...n) {
|
|
38
|
+
return new Promise((v, i) => {
|
|
39
|
+
Promise.resolve(t(() => o.apply(this, n), {
|
|
40
|
+
fn: o,
|
|
41
|
+
thisArg: this,
|
|
42
|
+
args: n
|
|
43
|
+
})).then(v).catch(i);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return e;
|
|
47
|
+
}
|
|
48
|
+
function zt(t, o = {}) {
|
|
49
|
+
let e, n, v = H;
|
|
50
|
+
const i = (u) => {
|
|
51
|
+
clearTimeout(u), v(), v = H;
|
|
52
|
+
};
|
|
53
|
+
let y;
|
|
54
|
+
return (u) => {
|
|
55
|
+
const b = x(t), c = x(o.maxWait);
|
|
56
|
+
return e && i(e), b <= 0 || c !== void 0 && c <= 0 ? (n && (i(n), n = void 0), Promise.resolve(u())) : new Promise((l, w) => {
|
|
57
|
+
v = o.rejectOnCancel ? w : l, y = u, c && !n && (n = setTimeout(() => {
|
|
58
|
+
e && i(e), n = void 0, l(y());
|
|
59
|
+
}, c)), e = setTimeout(() => {
|
|
60
|
+
n && i(n), n = void 0, l(u());
|
|
61
|
+
}, b);
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
// @__NO_SIDE_EFFECTS__
|
|
66
|
+
function Lt(t, o = 200, e = {}) {
|
|
67
|
+
return Rt(zt(o, e), t);
|
|
68
|
+
}
|
|
69
|
+
const xt = Ft ? window : void 0;
|
|
70
|
+
function q(t) {
|
|
71
|
+
var o;
|
|
72
|
+
const e = x(t);
|
|
73
|
+
return (o = e == null ? void 0 : e.$el) !== null && o !== void 0 ? o : e;
|
|
74
|
+
}
|
|
75
|
+
// @__NO_SIDE_EFFECTS__
|
|
76
|
+
function Et() {
|
|
77
|
+
const t = lt(!1), o = ct();
|
|
78
|
+
return o && Q(() => {
|
|
79
|
+
t.value = !0;
|
|
80
|
+
}, o), t;
|
|
81
|
+
}
|
|
82
|
+
// @__NO_SIDE_EFFECTS__
|
|
83
|
+
function At(t) {
|
|
84
|
+
const o = /* @__PURE__ */ Et();
|
|
85
|
+
return h(() => (o.value, !!t()));
|
|
86
|
+
}
|
|
87
|
+
function Nt(t, o, e = {}) {
|
|
88
|
+
const { window: n = xt, ...v } = e;
|
|
89
|
+
let i;
|
|
90
|
+
const y = /* @__PURE__ */ At(() => n && "ResizeObserver" in n), m = () => {
|
|
91
|
+
i && (i.disconnect(), i = void 0);
|
|
92
|
+
}, u = j(h(() => {
|
|
93
|
+
const c = x(t);
|
|
94
|
+
return Array.isArray(c) ? c.map((l) => q(l)) : [q(c)];
|
|
95
|
+
}), (c) => {
|
|
96
|
+
if (m(), y.value && n) {
|
|
97
|
+
i = new ResizeObserver(o);
|
|
98
|
+
for (const l of c) l && i.observe(l, v);
|
|
99
|
+
}
|
|
100
|
+
}, {
|
|
101
|
+
immediate: !0,
|
|
102
|
+
flush: "post"
|
|
103
|
+
}), b = () => {
|
|
104
|
+
m(), u();
|
|
105
|
+
};
|
|
106
|
+
return Kt(b), {
|
|
107
|
+
isSupported: y,
|
|
108
|
+
stop: b
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
const Ot = {
|
|
112
|
+
ref: "page-layout-tabs",
|
|
113
|
+
class: "page-layout-tabs",
|
|
114
|
+
"data-testid": "page-layout-tabs"
|
|
115
|
+
}, Vt = { key: 0 }, Wt = ["aria-label"], Mt = {
|
|
116
|
+
key: 0,
|
|
117
|
+
class: "layout-loader-container"
|
|
118
|
+
}, jt = /* @__PURE__ */ X({
|
|
119
|
+
__name: "PageLayoutTabs",
|
|
120
|
+
props: {
|
|
121
|
+
tabs: { default: () => [] }
|
|
122
|
+
},
|
|
123
|
+
setup(t) {
|
|
124
|
+
dt((f) => ({
|
|
125
|
+
v5db9dc57: d(i)
|
|
126
|
+
}));
|
|
127
|
+
const { i18n: { t: o } } = at.useI18n(), e = et(), n = R("app:navigateTo", null), v = (f) => {
|
|
128
|
+
if (typeof f.to != "string") {
|
|
129
|
+
e.push(f.to);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (typeof n != "function") {
|
|
133
|
+
window.location.href = f.to;
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
n(f.to);
|
|
137
|
+
}, i = Bt, y = U("page-layout-tabs"), m = U("page-layout-tabs-list"), u = K(t.tabs.length), b = K(!1), c = h(() => t.tabs.slice(0, u.value)), l = h(() => t.tabs.slice(u.value)), w = async () => {
|
|
138
|
+
var I, s, a;
|
|
139
|
+
if (!y.value || !m.value)
|
|
140
|
+
return;
|
|
141
|
+
b.value = !1, u.value = t.tabs.length, await Z();
|
|
142
|
+
const f = ((I = y.value) == null ? void 0 : I.getBoundingClientRect().width) - parseInt(i) * 2;
|
|
143
|
+
let T = (s = m.value) == null ? void 0 : s.getBoundingClientRect().width;
|
|
144
|
+
if (!f || !T) {
|
|
145
|
+
b.value = !0;
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const B = 50;
|
|
149
|
+
for (; T + B > f && u.value > 1; )
|
|
150
|
+
u.value--, await Z(), T = ((a = m.value) == null ? void 0 : a.getBoundingClientRect().width) || 0;
|
|
151
|
+
b.value = !0;
|
|
152
|
+
};
|
|
153
|
+
let k = null;
|
|
154
|
+
const P = () => {
|
|
155
|
+
k && clearTimeout(k), k = setTimeout(() => {
|
|
156
|
+
w();
|
|
157
|
+
}, 150);
|
|
158
|
+
};
|
|
159
|
+
return Q(() => {
|
|
160
|
+
w(), Nt(y, P);
|
|
161
|
+
}), vt(() => {
|
|
162
|
+
k && clearTimeout(k);
|
|
163
|
+
}), j(() => t.tabs, () => {
|
|
164
|
+
w();
|
|
165
|
+
}, { deep: !0 }), (f, T) => {
|
|
166
|
+
const B = D("KDropdownItem"), I = D("KDropdown"), s = D("KSkeletonBox");
|
|
167
|
+
return r(), p("nav", Ot, [
|
|
168
|
+
S("ul", {
|
|
169
|
+
ref: "page-layout-tabs-list",
|
|
170
|
+
class: E({ "layout-computing": !b.value })
|
|
171
|
+
}, [
|
|
172
|
+
(r(!0), p(O, null, z(c.value, (a) => (r(), p("li", {
|
|
173
|
+
key: `${a.key}-tab`
|
|
174
|
+
}, [
|
|
175
|
+
(r(), $(W(typeof a.to == "string" ? "a" : "router-link"), Y({ ref_for: !0 }, typeof a.to == "string" ? { href: a.to } : { to: a.to }, {
|
|
176
|
+
"aria-current": a.active ? "page" : void 0,
|
|
177
|
+
class: ["tab-link", { active: a.active }],
|
|
178
|
+
"data-testid": a.dataTestId ? a.dataTestId : `page-layout-tab-${a.key}`,
|
|
179
|
+
tabindex: "0",
|
|
180
|
+
onClick: A((N) => v(a), ["prevent"]),
|
|
181
|
+
onKeydown: tt(A((N) => v(a), ["prevent"]), ["enter"])
|
|
182
|
+
}), {
|
|
183
|
+
default: C(() => [
|
|
184
|
+
_(f.$slots, `tab-${a.key}`, { tab: a }, () => [
|
|
185
|
+
V(L(a.label), 1)
|
|
186
|
+
], !0)
|
|
187
|
+
]),
|
|
188
|
+
_: 2
|
|
189
|
+
}, 1040, ["aria-current", "class", "data-testid", "onClick", "onKeydown"]))
|
|
190
|
+
]))), 128)),
|
|
191
|
+
t.tabs.length > u.value ? (r(), p("li", Vt, [
|
|
192
|
+
F(I, { "kpop-attributes": {
|
|
193
|
+
placement: "bottom-end",
|
|
194
|
+
popoverElementAttributes: { "data-testid": "tabs-overflow-dropdown-popover" }
|
|
195
|
+
} }, {
|
|
196
|
+
items: C(() => [
|
|
197
|
+
(r(!0), p(O, null, z(l.value, (a) => (r(), $(B, {
|
|
198
|
+
key: `${a.key}-dropdown-item`,
|
|
199
|
+
"aria-current": a.active ? "page" : void 0,
|
|
200
|
+
"data-testid": a.dataTestId ? a.dataTestId : `page-layout-tab-${a.key}`,
|
|
201
|
+
item: {
|
|
202
|
+
label: a.label,
|
|
203
|
+
value: a.key,
|
|
204
|
+
to: a.to
|
|
205
|
+
},
|
|
206
|
+
selected: a.active
|
|
207
|
+
}, {
|
|
208
|
+
default: C(() => [
|
|
209
|
+
_(f.$slots, `tab-${a.key}`, { tab: a }, () => [
|
|
210
|
+
V(L(a.label), 1)
|
|
211
|
+
], !0)
|
|
212
|
+
]),
|
|
213
|
+
_: 2
|
|
214
|
+
}, 1032, ["aria-current", "data-testid", "item", "selected"]))), 128))
|
|
215
|
+
]),
|
|
216
|
+
default: C(() => [
|
|
217
|
+
S("button", {
|
|
218
|
+
"aria-label": d(o)("tabs.more_button.aria_label"),
|
|
219
|
+
class: E(["tab-link overflow-dropdown-trigger", { active: l.value.find((a) => a.active) }]),
|
|
220
|
+
"data-testid": "tabs-overflow-dropdown-button"
|
|
221
|
+
}, [
|
|
222
|
+
V(L(d(o)("tabs.more_button.label")) + " ", 1),
|
|
223
|
+
F(d(Tt), {
|
|
224
|
+
decorative: "",
|
|
225
|
+
size: `var(--kui-icon-size-30, ${d(M)})`
|
|
226
|
+
}, null, 8, ["size"])
|
|
227
|
+
], 10, Wt)
|
|
228
|
+
]),
|
|
229
|
+
_: 3
|
|
230
|
+
})
|
|
231
|
+
])) : g("", !0)
|
|
232
|
+
], 2),
|
|
233
|
+
b.value ? g("", !0) : (r(), p("div", Mt, [
|
|
234
|
+
(r(), p(O, null, z(3, (a) => F(s, {
|
|
235
|
+
key: `layout-loader-${a}`,
|
|
236
|
+
height: "1",
|
|
237
|
+
width: "5"
|
|
238
|
+
})), 64))
|
|
239
|
+
]))
|
|
240
|
+
], 512);
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
}), ot = (t, o) => {
|
|
244
|
+
const e = t.__vccOpts || t;
|
|
245
|
+
for (const [n, v] of o)
|
|
246
|
+
e[n] = v;
|
|
247
|
+
return e;
|
|
248
|
+
}, Gt = /* @__PURE__ */ ot(jt, [["__scopeId", "data-v-31debc7a"]]), J = Symbol("nested-page-layout-detection"), Ut = {
|
|
249
|
+
class: "kong-ui-public-page-layout",
|
|
250
|
+
"data-testid": "kong-ui-public-page-layout"
|
|
251
|
+
}, Zt = {
|
|
252
|
+
key: 0,
|
|
253
|
+
class: "page-layout-header",
|
|
254
|
+
"data-testid": "page-layout-header"
|
|
255
|
+
}, Ht = { class: "page-header-container" }, qt = { class: "page-header-start" }, Jt = { class: "title-container" }, Qt = {
|
|
256
|
+
key: 1,
|
|
257
|
+
class: "page-layout-title-wrapper"
|
|
258
|
+
}, Xt = {
|
|
259
|
+
class: "page-layout-title",
|
|
260
|
+
"data-testid": "page-layout-title"
|
|
261
|
+
}, Yt = ["aria-label"], te = {
|
|
262
|
+
key: 3,
|
|
263
|
+
class: "title-after-container"
|
|
264
|
+
}, ee = {
|
|
265
|
+
key: 0,
|
|
266
|
+
class: "page-header-actions-container"
|
|
267
|
+
}, ae = /* @__PURE__ */ X({
|
|
268
|
+
__name: "PageLayout",
|
|
269
|
+
props: {
|
|
270
|
+
breadcrumbs: { default: () => [] },
|
|
271
|
+
title: {},
|
|
272
|
+
backTo: {},
|
|
273
|
+
tabs: { default: () => [] },
|
|
274
|
+
pageShortcutData: {}
|
|
275
|
+
},
|
|
276
|
+
setup(t) {
|
|
277
|
+
const o = R("app:navigateTo", null), e = R("app:pageShortcutsContext", null), { i18n: { t: n } } = at.useI18n(), v = et(), i = gt(), y = h(() => !!(t.tabs && t.tabs.length)), m = h(() => typeof t.backTo == "string"), u = h(() => !!t.pageShortcutData && !!t.pageShortcutData.entityType && !!t.pageShortcutData.label), b = h(() => u.value && !!e && "onFavoriteToggle" in e && typeof e.onFavoriteToggle == "function"), c = K(0), l = h(() => !!e && ("isFavorite" in e && typeof e.isFavorite == "function" && e.isFavorite(t.pageShortcutData) === !0 || // TODO: Remove this once isPageFavorite() is removed from the context
|
|
278
|
+
"isPageFavorite" in e && typeof e.isPageFavorite == "function" && e.isPageFavorite(t.pageShortcutData) === !0)), w = async () => {
|
|
279
|
+
if (t.backTo) {
|
|
280
|
+
if (typeof t.backTo == "object") {
|
|
281
|
+
v.push(t.backTo);
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
if (typeof o != "function") {
|
|
285
|
+
window.location.href = t.backTo;
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
await o(t.backTo);
|
|
289
|
+
}
|
|
290
|
+
}, k = K(0), P = h(() => k.value > 0);
|
|
291
|
+
ft(J, () => (k.value++, () => {
|
|
292
|
+
k.value--;
|
|
293
|
+
}));
|
|
294
|
+
const f = R(J, null), T = K(null);
|
|
295
|
+
typeof f == "function" && (T.value = f());
|
|
296
|
+
const B = () => {
|
|
297
|
+
var s;
|
|
298
|
+
e.onFavoriteToggle({ ...t.pageShortcutData, path: ((s = t.pageShortcutData) == null ? void 0 : s.path) || i.fullPath });
|
|
299
|
+
};
|
|
300
|
+
bt(() => {
|
|
301
|
+
var s;
|
|
302
|
+
(s = T.value) == null || s.call(T);
|
|
303
|
+
});
|
|
304
|
+
const I = /* @__PURE__ */ Lt(() => {
|
|
305
|
+
var s;
|
|
306
|
+
!P.value && u.value && e && "onEntityPageVisit" in e && typeof e.onEntityPageVisit == "function" && (e.onEntityPageVisit({ ...t.pageShortcutData, path: ((s = t.pageShortcutData) == null ? void 0 : s.path) || (i == null ? void 0 : i.fullPath) }), c.value++);
|
|
307
|
+
}, 500);
|
|
308
|
+
return j([() => t.pageShortcutData, () => i == null ? void 0 : i.fullPath], () => {
|
|
309
|
+
I();
|
|
310
|
+
}, { immediate: !0, deep: !0 }), (s, a) => {
|
|
311
|
+
const N = D("KBreadcrumbs"), nt = D("KTooltip"), it = D("router-view");
|
|
312
|
+
return r(), p("div", Ut, [
|
|
313
|
+
P.value ? g("", !0) : (r(), p("div", Zt, [
|
|
314
|
+
S("div", Ht, [
|
|
315
|
+
S("div", qt, [
|
|
316
|
+
t.breadcrumbs && t.breadcrumbs.length ? (r(), $(N, {
|
|
317
|
+
key: 0,
|
|
318
|
+
class: "header-breadcrumbs",
|
|
319
|
+
"data-testid": "page-layout-breadcrumbs",
|
|
320
|
+
"item-max-width": "25ch",
|
|
321
|
+
items: t.breadcrumbs
|
|
322
|
+
}, null, 8, ["items"])) : g("", !0),
|
|
323
|
+
S("div", Jt, [
|
|
324
|
+
t.backTo ? (r(), $(W(m.value ? "a" : "router-link"), Y({ key: 0 }, m.value ? { href: t.backTo } : { to: t.backTo }, {
|
|
325
|
+
"aria-label": d(n)("back_button"),
|
|
326
|
+
class: "navigate-back",
|
|
327
|
+
"data-testid": "page-layout-navigate-back",
|
|
328
|
+
tabindex: "0",
|
|
329
|
+
onClick: A(w, ["prevent"]),
|
|
330
|
+
onKeydown: tt(A(w, ["prevent"]), ["enter"])
|
|
331
|
+
}), {
|
|
332
|
+
default: C(() => [
|
|
333
|
+
F(d(wt), {
|
|
334
|
+
decorative: "",
|
|
335
|
+
size: `var(--kui-icon-size-30, ${d(M)})`
|
|
336
|
+
}, null, 8, ["size"])
|
|
337
|
+
]),
|
|
338
|
+
_: 1
|
|
339
|
+
}, 16, ["aria-label", "onKeydown"])) : g("", !0),
|
|
340
|
+
t.title || s.$slots.title ? (r(), p("span", Qt, [
|
|
341
|
+
_(s.$slots, "title", {}, () => [
|
|
342
|
+
S("h1", Xt, L(t.title), 1)
|
|
343
|
+
], !0)
|
|
344
|
+
])) : g("", !0),
|
|
345
|
+
b.value ? (r(), p("div", {
|
|
346
|
+
key: c.value,
|
|
347
|
+
class: "favorite-button-container"
|
|
348
|
+
}, [
|
|
349
|
+
F(nt, {
|
|
350
|
+
placement: "right",
|
|
351
|
+
text: l.value ? d(n)("favorite_button.remove_shortcut") : d(n)("favorite_button.save_shortcut")
|
|
352
|
+
}, {
|
|
353
|
+
default: C(() => [
|
|
354
|
+
S("button", {
|
|
355
|
+
"aria-label": l.value ? d(n)("favorite_button.remove_shortcut") : d(n)("favorite_button.save_shortcut"),
|
|
356
|
+
class: E(["favorite-button", { active: l.value }]),
|
|
357
|
+
"data-testid": "page-layout-favorite-button",
|
|
358
|
+
type: "button",
|
|
359
|
+
onClick: B
|
|
360
|
+
}, [
|
|
361
|
+
(r(), $(W(l.value ? d(St) : d($t)), {
|
|
362
|
+
decorative: "",
|
|
363
|
+
size: `var(--kui-icon-size-30, ${d(M)})`
|
|
364
|
+
}, null, 8, ["size"]))
|
|
365
|
+
], 10, Yt)
|
|
366
|
+
]),
|
|
367
|
+
_: 1
|
|
368
|
+
}, 8, ["text"])
|
|
369
|
+
])) : g("", !0),
|
|
370
|
+
s.$slots["title-after"] ? (r(), p("div", te, [
|
|
371
|
+
_(s.$slots, "title-after", {}, void 0, !0)
|
|
372
|
+
])) : g("", !0)
|
|
373
|
+
])
|
|
374
|
+
]),
|
|
375
|
+
s.$slots.actions ? (r(), p("div", ee, [
|
|
376
|
+
_(s.$slots, "actions", {}, void 0, !0)
|
|
377
|
+
])) : g("", !0)
|
|
378
|
+
]),
|
|
379
|
+
y.value ? (r(), $(Gt, {
|
|
380
|
+
key: 0,
|
|
381
|
+
tabs: t.tabs
|
|
382
|
+
}, pt({ _: 2 }, [
|
|
383
|
+
z(t.tabs, (G) => ({
|
|
384
|
+
name: `tab-${G.key}`,
|
|
385
|
+
fn: C((st) => [
|
|
386
|
+
_(s.$slots, `tab-${G.key}`, yt(mt(st)), void 0, !0)
|
|
387
|
+
])
|
|
388
|
+
}))
|
|
389
|
+
]), 1032, ["tabs"])) : g("", !0)
|
|
390
|
+
])),
|
|
391
|
+
S("div", {
|
|
392
|
+
class: E(["page-layout-content", { "has-nested-page-layout": P.value }])
|
|
393
|
+
}, [
|
|
394
|
+
y.value ? (r(), $(it, { key: 0 })) : _(s.$slots, "default", { key: 1 }, void 0, !0)
|
|
395
|
+
], 2)
|
|
396
|
+
]);
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
}), re = /* @__PURE__ */ ot(ae, [["__scopeId", "data-v-54d02c86"]]);
|
|
400
|
+
export {
|
|
401
|
+
re as PageLayout
|
|
402
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(b,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):(b=typeof globalThis<"u"?globalThis:b||self,t(b["kong-ui-public-page-layout"]={},b.Vue,b.VueRouter,b["kong-ui-public-i18n"],b.KongIcons))})(this,function(b,t,S,_,T){"use strict";const K={back_button:"Go back",favorite_button:{save_shortcut:"Save page to shortcuts",remove_shortcut:"Remove page from shortcuts"},tabs:{more_button:{label:"More",aria_label:"More tabs"}}};function z(){const e=_.createI18n("en-us",K);return{i18n:e,i18nT:_.i18nTComponent(e)}}const D={useI18n:z},V="16px",F="16px";function L(e,n){return t.getCurrentScope()?(t.onScopeDispose(e,n),!0):!1}const R=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const $=()=>{};function M(e,n){function o(...r){return new Promise((u,i)=>{Promise.resolve(e(()=>n.apply(this,r),{fn:n,thisArg:this,args:r})).then(u).catch(i)})}return o}function O(e,n={}){let o,r,u=$;const i=s=>{clearTimeout(s),u(),u=$};let f;return s=>{const p=t.toValue(e),d=t.toValue(n.maxWait);return o&&i(o),p<=0||d!==void 0&&d<=0?(r&&(i(r),r=void 0),Promise.resolve(s())):new Promise((l,g)=>{u=n.rejectOnCancel?g:l,f=s,d&&!r&&(r=setTimeout(()=>{o&&i(o),r=void 0,l(f())},d)),o=setTimeout(()=>{r&&i(r),r=void 0,l(s())},p)})}}function A(e,n=200,o={}){return M(O(n,o),e)}const j=R?window:void 0;function E(e){var n;const o=t.toValue(e);return(n=o==null?void 0:o.$el)!==null&&n!==void 0?n:o}function W(){const e=t.shallowRef(!1),n=t.getCurrentInstance();return n&&t.onMounted(()=>{e.value=!0},n),e}function G(e){const n=W();return t.computed(()=>(n.value,!!e()))}function q(e,n,o={}){const{window:r=j,...u}=o;let i;const f=G(()=>r&&"ResizeObserver"in r),y=()=>{i&&(i.disconnect(),i=void 0)},s=t.watch(t.computed(()=>{const d=t.toValue(e);return Array.isArray(d)?d.map(l=>E(l)):[E(d)]}),d=>{if(y(),f.value&&r){i=new ResizeObserver(n);for(const l of d)l&&i.observe(l,u)}},{immediate:!0,flush:"post"}),p=()=>{y(),s()};return L(p),{isSupported:f,stop:p}}const U={ref:"page-layout-tabs",class:"page-layout-tabs","data-testid":"page-layout-tabs"},Z={key:0},H=["aria-label"],J={key:0,class:"layout-loader-container"},Q=t.defineComponent({__name:"PageLayoutTabs",props:{tabs:{default:()=>[]}},setup(e){t.useCssVars(m=>({v5db9dc57:t.unref(i)}));const{i18n:{t:n}}=D.useI18n(),o=S.useRouter(),r=t.inject("app:navigateTo",null),u=m=>{if(typeof m.to!="string"){o.push(m.to);return}if(typeof r!="function"){window.location.href=m.to;return}r(m.to)},i=F,f=t.useTemplateRef("page-layout-tabs"),y=t.useTemplateRef("page-layout-tabs-list"),s=t.ref(e.tabs.length),p=t.ref(!1),d=t.computed(()=>e.tabs.slice(0,s.value)),l=t.computed(()=>e.tabs.slice(s.value)),g=async()=>{var B,c,a;if(!f.value||!y.value)return;p.value=!1,s.value=e.tabs.length,await t.nextTick();const m=((B=f.value)==null?void 0:B.getBoundingClientRect().width)-parseInt(i)*2;let h=(c=y.value)==null?void 0:c.getBoundingClientRect().width;if(!m||!h){p.value=!0;return}const w=50;for(;h+w>m&&s.value>1;)s.value--,await t.nextTick(),h=((a=y.value)==null?void 0:a.getBoundingClientRect().width)||0;p.value=!0};let k=null;const C=()=>{k&&clearTimeout(k),k=setTimeout(()=>{g()},150)};return t.onMounted(()=>{g(),q(f,C)}),t.onBeforeUnmount(()=>{k&&clearTimeout(k)}),t.watch(()=>e.tabs,()=>{g()},{deep:!0}),(m,h)=>{const w=t.resolveComponent("KDropdownItem"),B=t.resolveComponent("KDropdown"),c=t.resolveComponent("KSkeletonBox");return t.openBlock(),t.createElementBlock("nav",U,[t.createElementVNode("ul",{ref:"page-layout-tabs-list",class:t.normalizeClass({"layout-computing":!p.value})},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,a=>(t.openBlock(),t.createElementBlock("li",{key:`${a.key}-tab`},[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(typeof a.to=="string"?"a":"router-link"),t.mergeProps({ref_for:!0},typeof a.to=="string"?{href:a.to}:{to:a.to},{"aria-current":a.active?"page":void 0,class:["tab-link",{active:a.active}],"data-testid":a.dataTestId?a.dataTestId:`page-layout-tab-${a.key}`,tabindex:"0",onClick:t.withModifiers(N=>u(a),["prevent"]),onKeydown:t.withKeys(t.withModifiers(N=>u(a),["prevent"]),["enter"])}),{default:t.withCtx(()=>[t.renderSlot(m.$slots,`tab-${a.key}`,{tab:a},()=>[t.createTextVNode(t.toDisplayString(a.label),1)],!0)]),_:2},1040,["aria-current","class","data-testid","onClick","onKeydown"]))]))),128)),e.tabs.length>s.value?(t.openBlock(),t.createElementBlock("li",Z,[t.createVNode(B,{"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(l.value,a=>(t.openBlock(),t.createBlock(w,{key:`${a.key}-dropdown-item`,"aria-current":a.active?"page":void 0,"data-testid":a.dataTestId?a.dataTestId:`page-layout-tab-${a.key}`,item:{label:a.label,value:a.key,to:a.to},selected:a.active},{default:t.withCtx(()=>[t.renderSlot(m.$slots,`tab-${a.key}`,{tab:a},()=>[t.createTextVNode(t.toDisplayString(a.label),1)],!0)]),_:2},1032,["aria-current","data-testid","item","selected"]))),128))]),default:t.withCtx(()=>[t.createElementVNode("button",{"aria-label":t.unref(n)("tabs.more_button.aria_label"),class:t.normalizeClass(["tab-link overflow-dropdown-trigger",{active:l.value.find(a=>a.active)}]),"data-testid":"tabs-overflow-dropdown-button"},[t.createTextVNode(t.toDisplayString(t.unref(n)("tabs.more_button.label"))+" ",1),t.createVNode(t.unref(T.ChevronDownIcon),{decorative:"",size:`var(--kui-icon-size-30, ${t.unref(V)})`},null,8,["size"])],10,H)]),_:3})])):t.createCommentVNode("",!0)],2),p.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",J,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(3,a=>t.createVNode(c,{key:`layout-loader-${a}`,height:"1",width:"5"})),64))]))],512)}}}),P=(e,n)=>{const o=e.__vccOpts||e;for(const[r,u]of n)o[r]=u;return o},X=P(Q,[["__scopeId","data-v-31debc7a"]]),I=Symbol("nested-page-layout-detection"),Y={class:"kong-ui-public-page-layout","data-testid":"kong-ui-public-page-layout"},v={key:0,class:"page-layout-header","data-testid":"page-layout-header"},tt={class:"page-header-container"},et={class:"page-header-start"},ot={class:"title-container"},at={key:1,class:"page-layout-title-wrapper"},nt={class:"page-layout-title","data-testid":"page-layout-title"},rt=["aria-label"],it={key:3,class:"title-after-container"},ct={key:0,class:"page-header-actions-container"},st=P(t.defineComponent({__name:"PageLayout",props:{breadcrumbs:{default:()=>[]},title:{},backTo:{},tabs:{default:()=>[]},pageShortcutData:{}},setup(e){const n=t.inject("app:navigateTo",null),o=t.inject("app:pageShortcutsContext",null),{i18n:{t:r}}=D.useI18n(),u=S.useRouter(),i=S.useRoute(),f=t.computed(()=>!!(e.tabs&&e.tabs.length)),y=t.computed(()=>typeof e.backTo=="string"),s=t.computed(()=>!!e.pageShortcutData&&!!e.pageShortcutData.entityType&&!!e.pageShortcutData.label),p=t.computed(()=>s.value&&!!o&&"onFavoriteToggle"in o&&typeof o.onFavoriteToggle=="function"),d=t.ref(0),l=t.computed(()=>!!o&&("isFavorite"in o&&typeof o.isFavorite=="function"&&o.isFavorite(e.pageShortcutData)===!0||"isPageFavorite"in o&&typeof o.isPageFavorite=="function"&&o.isPageFavorite(e.pageShortcutData)===!0)),g=async()=>{if(e.backTo){if(typeof e.backTo=="object"){u.push(e.backTo);return}if(typeof n!="function"){window.location.href=e.backTo;return}await n(e.backTo)}},k=t.ref(0),C=t.computed(()=>k.value>0);t.provide(I,()=>(k.value++,()=>{k.value--}));const m=t.inject(I,null),h=t.ref(null);typeof m=="function"&&(h.value=m());const w=()=>{var c;o.onFavoriteToggle({...e.pageShortcutData,path:((c=e.pageShortcutData)==null?void 0:c.path)||i.fullPath})};t.onUnmounted(()=>{var c;(c=h.value)==null||c.call(h)});const B=A(()=>{var c;!C.value&&s.value&&o&&"onEntityPageVisit"in o&&typeof o.onEntityPageVisit=="function"&&(o.onEntityPageVisit({...e.pageShortcutData,path:((c=e.pageShortcutData)==null?void 0:c.path)||(i==null?void 0:i.fullPath)}),d.value++)},500);return t.watch([()=>e.pageShortcutData,()=>i==null?void 0:i.fullPath],()=>{B()},{immediate:!0,deep:!0}),(c,a)=>{const N=t.resolveComponent("KBreadcrumbs"),lt=t.resolveComponent("KTooltip"),dt=t.resolveComponent("router-view");return t.openBlock(),t.createElementBlock("div",Y,[C.value?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",v,[t.createElementVNode("div",tt,[t.createElementVNode("div",et,[e.breadcrumbs&&e.breadcrumbs.length?(t.openBlock(),t.createBlock(N,{key:0,class:"header-breadcrumbs","data-testid":"page-layout-breadcrumbs","item-max-width":"25ch",items:e.breadcrumbs},null,8,["items"])):t.createCommentVNode("",!0),t.createElementVNode("div",ot,[e.backTo?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(y.value?"a":"router-link"),t.mergeProps({key:0},y.value?{href:e.backTo}:{to:e.backTo},{"aria-label":t.unref(r)("back_button"),class:"navigate-back","data-testid":"page-layout-navigate-back",tabindex:"0",onClick:t.withModifiers(g,["prevent"]),onKeydown:t.withKeys(t.withModifiers(g,["prevent"]),["enter"])}),{default:t.withCtx(()=>[t.createVNode(t.unref(T.ArrowTopLeftIcon),{decorative:"",size:`var(--kui-icon-size-30, ${t.unref(V)})`},null,8,["size"])]),_:1},16,["aria-label","onKeydown"])):t.createCommentVNode("",!0),e.title||c.$slots.title?(t.openBlock(),t.createElementBlock("span",at,[t.renderSlot(c.$slots,"title",{},()=>[t.createElementVNode("h1",nt,t.toDisplayString(e.title),1)],!0)])):t.createCommentVNode("",!0),p.value?(t.openBlock(),t.createElementBlock("div",{key:d.value,class:"favorite-button-container"},[t.createVNode(lt,{placement:"right",text:l.value?t.unref(r)("favorite_button.remove_shortcut"):t.unref(r)("favorite_button.save_shortcut")},{default:t.withCtx(()=>[t.createElementVNode("button",{"aria-label":l.value?t.unref(r)("favorite_button.remove_shortcut"):t.unref(r)("favorite_button.save_shortcut"),class:t.normalizeClass(["favorite-button",{active:l.value}]),"data-testid":"page-layout-favorite-button",type:"button",onClick:w},[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(l.value?t.unref(T.StarFillIcon):t.unref(T.StarIcon)),{decorative:"",size:`var(--kui-icon-size-30, ${t.unref(V)})`},null,8,["size"]))],10,rt)]),_:1},8,["text"])])):t.createCommentVNode("",!0),c.$slots["title-after"]?(t.openBlock(),t.createElementBlock("div",it,[t.renderSlot(c.$slots,"title-after",{},void 0,!0)])):t.createCommentVNode("",!0)])]),c.$slots.actions?(t.openBlock(),t.createElementBlock("div",ct,[t.renderSlot(c.$slots,"actions",{},void 0,!0)])):t.createCommentVNode("",!0)]),f.value?(t.openBlock(),t.createBlock(X,{key:0,tabs:e.tabs},t.createSlots({_:2},[t.renderList(e.tabs,x=>({name:`tab-${x.key}`,fn:t.withCtx(ut=>[t.renderSlot(c.$slots,`tab-${x.key}`,t.normalizeProps(t.guardReactiveProps(ut)),void 0,!0)])}))]),1032,["tabs"])):t.createCommentVNode("",!0)])),t.createElementVNode("div",{class:t.normalizeClass(["page-layout-content",{"has-nested-page-layout":C.value}])},[f.value?(t.openBlock(),t.createBlock(dt,{key:0})):t.renderSlot(c.$slots,"default",{key:1},void 0,!0)],2)])}}}),[["__scopeId","data-v-54d02c86"]]);b.PageLayout=st,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.page-layout-tabs[data-v-31debc7a]{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(--v5db9dc57);padding:var(--kui-space-0, 0px) var(--v5db9dc57);position:relative;width:100%}.page-layout-tabs a[data-v-31debc7a],.page-layout-tabs button[data-v-31debc7a]{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-31debc7a]{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-31debc7a]{height:0;visibility:hidden}.page-layout-tabs ul li[data-v-31debc7a]{display:flex}.page-layout-tabs ul li .tab-link[data-v-31debc7a]{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-31debc7a]: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-31debc7a]: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-31debc7a]{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-31debc7a]{font-weight:500!important;font-weight:var(--kui-font-weight-medium, 500)!important}.page-layout-tabs .layout-loader-container[data-v-31debc7a]{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(--v5db9dc57);position:absolute}.kong-ui-public-page-layout[data-v-54d02c86]{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-54d02c86]{background-color:#fff;background-color:var(--kui-color-background, #ffffff);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-54d02c86]{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-54d02c86] .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-54d02c86] .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-54d02c86]{align-items:flex-end;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-54d02c86],.kong-ui-public-page-layout .page-layout-header .page-header-container .page-header-start .title-container .favorite-button[data-v-54d02c86]{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-54d02c86]:hover,.kong-ui-public-page-layout .page-layout-header .page-header-container .page-header-start .title-container .favorite-button[data-v-54d02c86]: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-54d02c86]:focus-visible,.kong-ui-public-page-layout .page-layout-header .page-header-container .page-header-start .title-container .favorite-button[data-v-54d02c86]: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-wrapper[data-v-54d02c86]>*{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-start .title-container .favorite-button-container[data-v-54d02c86]{align-self:center;display:flex;margin-left:4px;margin-left:var(--kui-space-20, 4px)}.kong-ui-public-page-layout .page-layout-header .page-header-container .page-header-start .title-container .favorite-button-container .favorite-button[data-v-54d02c86]{color:#afb7c5;color:var(--kui-color-text-neutral-weak, #afb7c5);padding:0;padding:var(--kui-space-0, 0px)}.kong-ui-public-page-layout .page-layout-header .page-header-container .page-header-start .title-container .favorite-button-container .favorite-button[data-v-54d02c86]:hover{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 .favorite-button-container .favorite-button.active[data-v-54d02c86]{color:#ffc400;color:var(--kui-color-text-warning-weak, #ffc400)}.kong-ui-public-page-layout .page-layout-header .page-header-container .page-header-start .title-container .title-after-container[data-v-54d02c86]{align-items:flex-end;display:flex;gap:6px;gap:var(--kui-space-30, 6px);margin-left:4px;margin-left:var(--kui-space-20, 4px)}.kong-ui-public-page-layout .page-layout-header .page-header-container .page-header-actions-container[data-v-54d02c86]{align-items:center;display:flex;gap:6px;gap:var(--kui-space-30, 6px)}.kong-ui-public-page-layout .page-layout-header:not(:has(.page-layout-tabs)) .page-header-container[data-v-54d02c86]{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-54d02c86]{background-color:#f9fafb;background-color:var(--kui-color-background-neutral-weakest, #f9fafb);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-54d02c86]{padding:0;padding:var(--kui-space-0, 0px)}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PageLayoutProps, PageLayoutSlots } from '../types';
|
|
2
|
+
type __VLS_Slots = PageLayoutSlots;
|
|
3
|
+
declare const __VLS_base: import("vue").DefineComponent<PageLayoutProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<PageLayoutProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
4
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
5
|
+
declare const _default: typeof __VLS_export;
|
|
6
|
+
export default _default;
|
|
7
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
8
|
+
new (): {
|
|
9
|
+
$slots: S;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=PageLayout.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageLayout.vue.d.ts","sourceRoot":"","sources":["../../../src/components/PageLayout.vue"],"names":[],"mappings":"AAyXA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAoB,MAAM,UAAU,CAAA;AAmBlF,KAAK,WAAW,GAAG,eAAe,CAAC;AAuXnC,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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PageLayoutTabsProps, PageLayoutTab } from '../types';
|
|
2
|
+
declare var __VLS_11: `tab-${string}`, __VLS_12: {
|
|
3
|
+
tab: PageLayoutTab;
|
|
4
|
+
}, __VLS_33: `tab-${string}`, __VLS_34: {
|
|
5
|
+
tab: PageLayoutTab;
|
|
6
|
+
};
|
|
7
|
+
type __VLS_Slots = {} & {
|
|
8
|
+
[K in NonNullable<typeof __VLS_11>]?: (props: typeof __VLS_12) => any;
|
|
9
|
+
} & {
|
|
10
|
+
[K in NonNullable<typeof __VLS_33>]?: (props: typeof __VLS_34) => any;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_base: import("vue").DefineComponent<PageLayoutTabsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<PageLayoutTabsProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
16
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
17
|
+
new (): {
|
|
18
|
+
$slots: S;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=PageLayoutTabs.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PageLayoutTabs.vue.d.ts","sourceRoot":"","sources":["../../../src/components/PageLayoutTabs.vue"],"names":[],"mappings":"AA6SA,OAAO,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAuUlE,QAAA,IAAI,QAAQ,iBAAW,EAAE,QAAQ;;CAAU,EAAE,QAAQ,iBAAW,EAAE,QAAQ;;CAAY,CAAE;AACxF,KAAK,WAAW,GAAG,EAAE,GACnB;KAAG,CAAC,IAAI,WAAW,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG;CAAE,GACzE;KAAG,CAAC,IAAI,WAAW,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG;CAAE,CAAC;AAQ5E,QAAA,MAAM,UAAU,kTAEd,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composables/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAA;;;;AAE/B,wBAEC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createI18n, i18nTComponent } from '@kong-ui-public/i18n';
|
|
2
|
+
import english from '../locales/en.json';
|
|
3
|
+
interface UseI18nReturn {
|
|
4
|
+
i18n: ReturnType<typeof createI18n<typeof english>>;
|
|
5
|
+
i18nT: ReturnType<typeof i18nTComponent<typeof english>>;
|
|
6
|
+
}
|
|
7
|
+
export default function useI18n(): UseI18nReturn;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=useI18n.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useI18n.d.ts","sourceRoot":"","sources":["../../../src/composables/useI18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACjE,OAAO,OAAO,MAAM,oBAAoB,CAAA;AAExC,UAAU,aAAa;IACrB,IAAI,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC,CAAA;IACnD,KAAK,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,OAAO,OAAO,CAAC,CAAC,CAAA;CACzD;AAED,MAAM,CAAC,OAAO,UAAU,OAAO,IAAI,aAAa,CAO/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,6BAA6B,CAAA;AAEpD,OAAO,EAAE,UAAU,EAAE,CAAA;AAErB,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symbols.d.ts","sourceRoot":"","sources":["../../src/symbols.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,eAAyC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { RouteLocationRaw } from 'vue-router';
|
|
2
|
+
export interface PageLayoutTab {
|
|
3
|
+
/** The unique kebab-case key of the tab */
|
|
4
|
+
key: string;
|
|
5
|
+
/** The display text of the navbar tab */
|
|
6
|
+
label: string;
|
|
7
|
+
/** The [Vue Router `to` object](https://router.vuejs.org/api/interfaces/RouterLinkProps.html#to) or a URL path (relative or absolute) to navigate to on click */
|
|
8
|
+
to: string | RouteLocationRaw;
|
|
9
|
+
/** Is the navbar tab active */
|
|
10
|
+
active?: boolean;
|
|
11
|
+
/** The data-testid attribute to apply to the navbar tab. Auto-generated if not provided */
|
|
12
|
+
dataTestId?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface PageLayoutTabsProps {
|
|
15
|
+
tabs?: PageLayoutTab[];
|
|
16
|
+
}
|
|
17
|
+
export interface PageLayoutTabsSlots {
|
|
18
|
+
[key: `tab-${string}`]: (props: {
|
|
19
|
+
tab: PageLayoutTab;
|
|
20
|
+
}) => any;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=page-layout-tabs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-layout-tabs.d.ts","sourceRoot":"","sources":["../../../src/types/page-layout-tabs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,MAAM,WAAW,aAAa;IAC5B,2CAA2C;IAC3C,GAAG,EAAE,MAAM,CAAA;IACX,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAA;IACb,iKAAiK;IACjK,EAAE,EAAE,MAAM,GAAG,gBAAgB,CAAA;IAC7B,+BAA+B;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,2FAA2F;IAC3F,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,aAAa,EAAE,CAAA;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,CAAC,GAAG,EAAE,OAAO,MAAM,EAAE,GAAG,CAAC,KAAK,EAAE;QAAE,GAAG,EAAE,aAAa,CAAA;KAAE,KAAK,GAAG,CAAA;CAC/D"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { BreadcrumbItem } from '@kong/kongponents';
|
|
2
|
+
import type { PageLayoutTab } from './';
|
|
3
|
+
import type { RouteLocationRaw } from 'vue-router';
|
|
4
|
+
export interface PageShortcutData {
|
|
5
|
+
/** The display label of the page shortcut */
|
|
6
|
+
label: string;
|
|
7
|
+
/** The URL path of the page shortcut */
|
|
8
|
+
path?: string;
|
|
9
|
+
/** The entity type of the page shortcut (snake_case, e.g. "gateway_service") */
|
|
10
|
+
entityType: string;
|
|
11
|
+
/** The display label of the parent entity */
|
|
12
|
+
parentLabel?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface PageLayoutProps {
|
|
15
|
+
/** Breadcrumb items */
|
|
16
|
+
breadcrumbs?: BreadcrumbItem[];
|
|
17
|
+
/** Page title */
|
|
18
|
+
title?: string;
|
|
19
|
+
/** The URL to navigate back to when the back button is clicked */
|
|
20
|
+
backTo?: string | RouteLocationRaw;
|
|
21
|
+
/** Tabs */
|
|
22
|
+
tabs?: PageLayoutTab[];
|
|
23
|
+
/** Providing this prop "marks" the current page as an entity page that can be added to shortcuts (favorites and recents) */
|
|
24
|
+
pageShortcutData?: PageShortcutData;
|
|
25
|
+
}
|
|
26
|
+
export interface PageLayoutSlots {
|
|
27
|
+
/**
|
|
28
|
+
* Default slot for page content
|
|
29
|
+
*/
|
|
30
|
+
default?(): any;
|
|
31
|
+
/**
|
|
32
|
+
* Actions slot for page actions
|
|
33
|
+
*/
|
|
34
|
+
actions?(): any;
|
|
35
|
+
/**
|
|
36
|
+
* Title slot for page title
|
|
37
|
+
*/
|
|
38
|
+
title?(): any;
|
|
39
|
+
/**
|
|
40
|
+
* Title after slot for page title after content
|
|
41
|
+
*/
|
|
42
|
+
'title-after'?(): any;
|
|
43
|
+
/**
|
|
44
|
+
* Per-tab slot for customizing the rendering of a specific tab. Slot name is `tab-${tab.key}`.
|
|
45
|
+
*/
|
|
46
|
+
[key: `tab-${string}`]: (props: {
|
|
47
|
+
tab: PageLayoutTab;
|
|
48
|
+
}) => any;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=page-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-layout.d.ts","sourceRoot":"","sources":["../../../src/types/page-layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAA;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,MAAM,WAAW,gBAAgB;IAC/B,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAA;IACb,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,gFAAgF;IAChF,UAAU,EAAE,MAAM,CAAA;IAClB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,uBAAuB;IACvB,WAAW,CAAC,EAAE,cAAc,EAAE,CAAA;IAC9B,iBAAiB;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAA;IAClC,WAAW;IACX,IAAI,CAAC,EAAE,aAAa,EAAE,CAAA;IACtB,4HAA4H;IAC5H,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;CACpC;AAED,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,OAAO,CAAC,IAAI,GAAG,CAAA;IACf;;OAEG;IACH,OAAO,CAAC,IAAI,GAAG,CAAA;IACf;;OAEG;IACH,KAAK,CAAC,IAAI,GAAG,CAAA;IACb;;OAEG;IACH,aAAa,CAAC,IAAI,GAAG,CAAA;IACrB;;OAEG;IACH,CAAC,GAAG,EAAE,OAAO,MAAM,EAAE,GAAG,CAAC,KAAK,EAAE;QAAE,GAAG,EAAE,aAAa,CAAA;KAAE,KAAK,GAAG,CAAA;CAC/D"}
|