@theh0n/ui 1.1.3 → 1.1.4
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/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +410 -366
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as I, ref as O, computed as y, openBlock as l, createElementBlock as u, normalizeClass as k, Fragment as Z, renderList as ae, createElementVNode as m, renderSlot as C, toDisplayString as x, createCommentVNode as b, createVNode as A, Transition as q, withCtx as H, withDirectives as he, vShow as ve, watch as E, shallowRef as ie, createBlock as V, Teleport as J, unref as _, normalizeStyle as R, resolveDynamicComponent as K, normalizeProps as me, mergeProps as X, createTextVNode as j, onMounted as G, onUnmounted as ye, withModifiers as F, onBeforeUnmount as pe, nextTick as ge } from "vue";
|
|
2
2
|
import './index.css';const te = {
|
|
3
3
|
colors: {
|
|
4
4
|
primary: "#171f2a",
|
|
@@ -24,15 +24,15 @@ function _e(e) {
|
|
|
24
24
|
const n = ne(te);
|
|
25
25
|
return le(n, e);
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function be(e) {
|
|
28
28
|
if (typeof window > "u" || typeof document > "u")
|
|
29
29
|
return;
|
|
30
|
-
const n = document.documentElement, t =
|
|
31
|
-
Object.entries(t).forEach(([
|
|
32
|
-
n.style.setProperty(
|
|
30
|
+
const n = document.documentElement, t = ke(e);
|
|
31
|
+
Object.entries(t).forEach(([r, o]) => {
|
|
32
|
+
n.style.setProperty(r, o);
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function ke(e) {
|
|
36
36
|
return {
|
|
37
37
|
"--h0n-primary": e.colors.primary,
|
|
38
38
|
"--h0n-secondary": e.colors.secondary,
|
|
@@ -51,14 +51,14 @@ function be(e) {
|
|
|
51
51
|
}
|
|
52
52
|
function le(e, n) {
|
|
53
53
|
const t = Array.isArray(e) ? [...e] : { ...e };
|
|
54
|
-
return n && Object.entries(n).forEach(([
|
|
54
|
+
return n && Object.entries(n).forEach(([r, o]) => {
|
|
55
55
|
if (o === void 0)
|
|
56
56
|
return;
|
|
57
|
-
const v = e[
|
|
58
|
-
oe(v) && oe(o) ? t[
|
|
57
|
+
const v = e[r];
|
|
58
|
+
oe(v) && oe(o) ? t[r] = le(
|
|
59
59
|
v,
|
|
60
60
|
o
|
|
61
|
-
) : t[
|
|
61
|
+
) : t[r] = o;
|
|
62
62
|
}), t;
|
|
63
63
|
}
|
|
64
64
|
function ne(e) {
|
|
@@ -67,10 +67,10 @@ function ne(e) {
|
|
|
67
67
|
function oe(e) {
|
|
68
68
|
return Object.prototype.toString.call(e) === "[object Object]";
|
|
69
69
|
}
|
|
70
|
-
const
|
|
70
|
+
const $e = ["disabled", "aria-expanded", "aria-controls", "onClick"], we = { class: "h0n-ui-accordion__title" }, Ce = { class: "h0n-ui-accordion__title-text" }, xe = {
|
|
71
71
|
key: 0,
|
|
72
72
|
class: "h0n-ui-accordion__badge"
|
|
73
|
-
},
|
|
73
|
+
}, Oe = ["id", "aria-label"], Ie = { class: "h0n-ui-accordion__body-inner" }, Se = { key: 0 }, Be = /* @__PURE__ */ I({
|
|
74
74
|
__name: "Accordion",
|
|
75
75
|
props: {
|
|
76
76
|
items: { default: () => [] },
|
|
@@ -81,85 +81,85 @@ const ke = ["disabled", "aria-expanded", "aria-controls", "onClick"], $e = { cla
|
|
|
81
81
|
},
|
|
82
82
|
emits: ["update:modelValue", "toggle"],
|
|
83
83
|
setup(e, { emit: n }) {
|
|
84
|
-
const t = e,
|
|
85
|
-
function o(
|
|
86
|
-
return
|
|
84
|
+
const t = e, r = n;
|
|
85
|
+
function o(a) {
|
|
86
|
+
return a == null ? [] : Array.isArray(a) ? t.multiple ? a : a.slice(0, 1) : [a];
|
|
87
87
|
}
|
|
88
|
-
const v = O(o(t.defaultOpen)),
|
|
88
|
+
const v = O(o(t.defaultOpen)), f = y(
|
|
89
89
|
() => t.modelValue !== void 0 ? o(t.modelValue) : v.value
|
|
90
|
-
),
|
|
91
|
-
function
|
|
92
|
-
return
|
|
90
|
+
), h = y(() => new Set(f.value));
|
|
91
|
+
function d(a) {
|
|
92
|
+
return h.value.has(a);
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
t.modelValue === void 0 && (v.value =
|
|
94
|
+
function c(a) {
|
|
95
|
+
t.modelValue === void 0 && (v.value = a), r("update:modelValue", t.multiple ? a : a[0] ?? null);
|
|
96
96
|
}
|
|
97
|
-
function p(
|
|
98
|
-
const
|
|
97
|
+
function p(a) {
|
|
98
|
+
const i = [...f.value];
|
|
99
99
|
if (t.multiple) {
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
|
|
100
|
+
const w = new Set(i);
|
|
101
|
+
w.has(a) ? w.delete(a) : w.add(a);
|
|
102
|
+
const B = Array.from(w);
|
|
103
|
+
c(B), r("toggle", { id: a, open: w.has(a) });
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
|
-
const
|
|
107
|
-
|
|
106
|
+
const s = i[0] === a;
|
|
107
|
+
c(s ? [] : [a]), r("toggle", { id: a, open: !s });
|
|
108
108
|
}
|
|
109
|
-
function
|
|
110
|
-
return `h0n-ui-accordion-body-${String(
|
|
109
|
+
function S(a) {
|
|
110
|
+
return `h0n-ui-accordion-body-${String(a)}`;
|
|
111
111
|
}
|
|
112
|
-
function
|
|
113
|
-
return
|
|
112
|
+
function T(a) {
|
|
113
|
+
return a.querySelector(".h0n-ui-accordion__body-inner");
|
|
114
114
|
}
|
|
115
|
-
function
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
function L(a) {
|
|
116
|
+
const i = a, s = T(i);
|
|
117
|
+
s && (i.style.height = "0px", i.style.opacity = "0", requestAnimationFrame(() => {
|
|
118
|
+
i.style.height = `${s.scrollHeight}px`, i.style.opacity = "1";
|
|
119
119
|
}));
|
|
120
120
|
}
|
|
121
|
-
function P(
|
|
122
|
-
const
|
|
123
|
-
|
|
121
|
+
function P(a) {
|
|
122
|
+
const i = a;
|
|
123
|
+
i.style.height = "auto", i.style.opacity = "";
|
|
124
124
|
}
|
|
125
|
-
function
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
125
|
+
function D(a) {
|
|
126
|
+
const i = a, s = T(i);
|
|
127
|
+
s && (i.style.height = `${s.scrollHeight}px`, i.style.opacity = "1", i.offsetHeight, requestAnimationFrame(() => {
|
|
128
|
+
i.style.height = "0px", i.style.opacity = "0";
|
|
129
129
|
}));
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
const
|
|
133
|
-
|
|
131
|
+
function g(a) {
|
|
132
|
+
const i = a;
|
|
133
|
+
i.style.height = "", i.style.opacity = "";
|
|
134
134
|
}
|
|
135
|
-
return (
|
|
136
|
-
class:
|
|
135
|
+
return (a, i) => (l(), u("div", {
|
|
136
|
+
class: k(["h0n-ui-accordion", { "is-compact": e.compact }])
|
|
137
137
|
}, [
|
|
138
|
-
(
|
|
139
|
-
key:
|
|
140
|
-
class:
|
|
141
|
-
"is-open":
|
|
142
|
-
"is-disabled": !!
|
|
138
|
+
(l(!0), u(Z, null, ae(e.items, (s) => (l(), u("div", {
|
|
139
|
+
key: s.id,
|
|
140
|
+
class: k(["h0n-ui-accordion__item", {
|
|
141
|
+
"is-open": d(s.id),
|
|
142
|
+
"is-disabled": !!s.disabled
|
|
143
143
|
}])
|
|
144
144
|
}, [
|
|
145
145
|
m("button", {
|
|
146
146
|
class: "h0n-ui-accordion__header",
|
|
147
147
|
type: "button",
|
|
148
|
-
disabled:
|
|
149
|
-
"aria-expanded":
|
|
150
|
-
"aria-controls":
|
|
151
|
-
onClick: (
|
|
148
|
+
disabled: s.disabled,
|
|
149
|
+
"aria-expanded": d(s.id) ? "true" : "false",
|
|
150
|
+
"aria-controls": S(s.id),
|
|
151
|
+
onClick: ($) => p(s.id)
|
|
152
152
|
}, [
|
|
153
|
-
m("span",
|
|
154
|
-
|
|
155
|
-
item:
|
|
156
|
-
open:
|
|
153
|
+
m("span", we, [
|
|
154
|
+
C(a.$slots, "header", {
|
|
155
|
+
item: s,
|
|
156
|
+
open: d(s.id)
|
|
157
157
|
}, () => [
|
|
158
|
-
m("span",
|
|
159
|
-
|
|
158
|
+
m("span", Ce, x(s.title), 1),
|
|
159
|
+
s.badge ? (l(), u("span", xe, x(s.badge), 1)) : b("", !0)
|
|
160
160
|
])
|
|
161
161
|
]),
|
|
162
|
-
|
|
162
|
+
i[0] || (i[0] = m("svg", {
|
|
163
163
|
class: "h0n-ui-accordion__chevron",
|
|
164
164
|
viewBox: "0 0 20 20",
|
|
165
165
|
"aria-hidden": "true"
|
|
@@ -173,31 +173,31 @@ const ke = ["disabled", "aria-expanded", "aria-controls", "onClick"], $e = { cla
|
|
|
173
173
|
"stroke-linejoin": "round"
|
|
174
174
|
})
|
|
175
175
|
], -1))
|
|
176
|
-
], 8,
|
|
177
|
-
|
|
176
|
+
], 8, $e),
|
|
177
|
+
A(q, {
|
|
178
178
|
name: "h0n-ui-accordion",
|
|
179
|
-
onEnter:
|
|
179
|
+
onEnter: L,
|
|
180
180
|
onAfterEnter: P,
|
|
181
|
-
onLeave:
|
|
182
|
-
onAfterLeave:
|
|
181
|
+
onLeave: D,
|
|
182
|
+
onAfterLeave: g
|
|
183
183
|
}, {
|
|
184
|
-
default:
|
|
185
|
-
|
|
184
|
+
default: H(() => [
|
|
185
|
+
he(m("div", {
|
|
186
186
|
class: "h0n-ui-accordion__body",
|
|
187
|
-
id:
|
|
187
|
+
id: S(s.id),
|
|
188
188
|
role: "region",
|
|
189
|
-
"aria-label":
|
|
189
|
+
"aria-label": s.title
|
|
190
190
|
}, [
|
|
191
|
-
m("div",
|
|
192
|
-
|
|
193
|
-
item:
|
|
194
|
-
open:
|
|
191
|
+
m("div", Ie, [
|
|
192
|
+
C(a.$slots, "body", {
|
|
193
|
+
item: s,
|
|
194
|
+
open: d(s.id)
|
|
195
195
|
}, () => [
|
|
196
|
-
|
|
196
|
+
s.body ? (l(), u("p", Se, x(s.body), 1)) : b("", !0)
|
|
197
197
|
])
|
|
198
198
|
])
|
|
199
|
-
], 8,
|
|
200
|
-
[
|
|
199
|
+
], 8, Oe), [
|
|
200
|
+
[ve, d(s.id)]
|
|
201
201
|
])
|
|
202
202
|
]),
|
|
203
203
|
_: 2
|
|
@@ -209,60 +209,60 @@ const ke = ["disabled", "aria-expanded", "aria-controls", "onClick"], $e = { cla
|
|
|
209
209
|
function Q() {
|
|
210
210
|
return typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : Date.now().toString(36) + Math.random().toString(36).slice(2, 10);
|
|
211
211
|
}
|
|
212
|
-
const se = 1e4,
|
|
213
|
-
function
|
|
214
|
-
const e = y(() =>
|
|
215
|
-
function n(
|
|
216
|
-
return
|
|
212
|
+
const se = 1e4, z = O([]);
|
|
213
|
+
function N() {
|
|
214
|
+
const e = y(() => z.value.at(-1) ?? null);
|
|
215
|
+
function n(h) {
|
|
216
|
+
return z.value.findIndex((d) => d.id === h);
|
|
217
217
|
}
|
|
218
|
-
function t(
|
|
219
|
-
const
|
|
220
|
-
return
|
|
218
|
+
function t(h) {
|
|
219
|
+
const d = n(h);
|
|
220
|
+
return d === -1 ? se : se + d * 2;
|
|
221
221
|
}
|
|
222
|
-
function
|
|
223
|
-
return t(
|
|
222
|
+
function r(h) {
|
|
223
|
+
return t(h) + 1;
|
|
224
224
|
}
|
|
225
|
-
function o(
|
|
226
|
-
const
|
|
227
|
-
return v(
|
|
225
|
+
function o(h) {
|
|
226
|
+
const d = h.id ?? Q();
|
|
227
|
+
return v(d), z.value.push({
|
|
228
228
|
showOverlay: !0,
|
|
229
229
|
closeOnOverlay: !0,
|
|
230
230
|
closeOnEsc: !0,
|
|
231
|
-
...
|
|
232
|
-
id:
|
|
233
|
-
}),
|
|
231
|
+
...h,
|
|
232
|
+
id: d
|
|
233
|
+
}), d;
|
|
234
234
|
}
|
|
235
|
-
function v(
|
|
236
|
-
const
|
|
237
|
-
|
|
235
|
+
function v(h) {
|
|
236
|
+
const d = n(h);
|
|
237
|
+
d !== -1 && z.value.splice(d, 1);
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function f() {
|
|
240
240
|
e.value?.onRequestClose?.();
|
|
241
241
|
}
|
|
242
|
-
return
|
|
243
|
-
() =>
|
|
244
|
-
(
|
|
245
|
-
document.documentElement.classList.toggle("no-scroll",
|
|
242
|
+
return E(
|
|
243
|
+
() => z.value.length,
|
|
244
|
+
(h) => {
|
|
245
|
+
document.documentElement.classList.toggle("no-scroll", h > 0);
|
|
246
246
|
},
|
|
247
247
|
{ immediate: !0 }
|
|
248
248
|
), {
|
|
249
|
-
stack:
|
|
249
|
+
stack: z,
|
|
250
250
|
top: e,
|
|
251
251
|
push: o,
|
|
252
252
|
remove: v,
|
|
253
|
-
requestCloseTop:
|
|
253
|
+
requestCloseTop: f,
|
|
254
254
|
getBackdropZIndex: t,
|
|
255
|
-
getContentZIndex:
|
|
255
|
+
getContentZIndex: r
|
|
256
256
|
};
|
|
257
257
|
}
|
|
258
|
-
const
|
|
258
|
+
const M = ie(null);
|
|
259
259
|
let W = null;
|
|
260
|
-
function
|
|
261
|
-
const e =
|
|
262
|
-
function n(
|
|
260
|
+
function Re() {
|
|
261
|
+
const e = N();
|
|
262
|
+
function n(r) {
|
|
263
263
|
return new Promise((o) => {
|
|
264
264
|
const v = Q();
|
|
265
|
-
W = o,
|
|
265
|
+
W = o, M.value = { ...r, id: v }, e.push({
|
|
266
266
|
id: v,
|
|
267
267
|
showOverlay: !0,
|
|
268
268
|
closeOnOverlay: !0,
|
|
@@ -271,66 +271,66 @@ function Be() {
|
|
|
271
271
|
});
|
|
272
272
|
});
|
|
273
273
|
}
|
|
274
|
-
function t(
|
|
275
|
-
if (!
|
|
276
|
-
const o =
|
|
277
|
-
|
|
274
|
+
function t(r) {
|
|
275
|
+
if (!M.value) return;
|
|
276
|
+
const o = M.value.id;
|
|
277
|
+
M.value = null, e.remove(o), W?.(r), W = null;
|
|
278
278
|
}
|
|
279
279
|
return {
|
|
280
|
-
active:
|
|
280
|
+
active: M,
|
|
281
281
|
open: n,
|
|
282
282
|
close: t
|
|
283
283
|
};
|
|
284
284
|
}
|
|
285
|
-
const
|
|
285
|
+
const Te = {
|
|
286
286
|
class: "h0n-alert",
|
|
287
287
|
role: "dialog",
|
|
288
288
|
"aria-modal": "true"
|
|
289
|
-
},
|
|
289
|
+
}, Le = {
|
|
290
290
|
key: 0,
|
|
291
291
|
class: "h0n-alert__header"
|
|
292
|
-
},
|
|
292
|
+
}, ze = { class: "h0n-alert__title" }, Ee = { class: "h0n-alert__body" }, Ve = { key: 1 }, Ae = /* @__PURE__ */ I({
|
|
293
293
|
__name: "Alert",
|
|
294
294
|
setup(e) {
|
|
295
|
-
const { active: n, close: t } =
|
|
296
|
-
() => n.value ?
|
|
295
|
+
const { active: n, close: t } = Re(), { getContentZIndex: r } = N(), o = () => t(!0), v = () => t(!1), f = () => t(!0), h = y(() => n.value?.type === "info"), d = y(
|
|
296
|
+
() => n.value ? r(n.value.id) : void 0
|
|
297
297
|
);
|
|
298
|
-
return (
|
|
299
|
-
|
|
298
|
+
return (c, p) => (l(), V(J, { to: "body" }, [
|
|
299
|
+
A(q, {
|
|
300
300
|
name: "h0n-alert-scale",
|
|
301
301
|
appear: ""
|
|
302
302
|
}, {
|
|
303
|
-
default:
|
|
304
|
-
_(n) ? (
|
|
303
|
+
default: H(() => [
|
|
304
|
+
_(n) ? (l(), u("div", {
|
|
305
305
|
key: 0,
|
|
306
306
|
class: "h0n-alert-layer",
|
|
307
|
-
style:
|
|
307
|
+
style: R({ zIndex: d.value })
|
|
308
308
|
}, [
|
|
309
|
-
m("section",
|
|
310
|
-
_(n).title ||
|
|
311
|
-
|
|
312
|
-
m("h4",
|
|
309
|
+
m("section", Te, [
|
|
310
|
+
_(n).title || c.$slots.header ? (l(), u("header", Le, [
|
|
311
|
+
C(c.$slots, "header", {}, () => [
|
|
312
|
+
m("h4", ze, x(_(n).title), 1)
|
|
313
313
|
], !0)
|
|
314
|
-
])) :
|
|
315
|
-
m("div",
|
|
316
|
-
_(n).component ? (
|
|
314
|
+
])) : b("", !0),
|
|
315
|
+
m("div", Ee, [
|
|
316
|
+
_(n).component ? (l(), V(K(_(n).component), me(X({ key: 0 }, _(n).props)), null, 16)) : _(n).message ? (l(), u("p", Ve, x(_(n).message), 1)) : b("", !0)
|
|
317
317
|
]),
|
|
318
318
|
m("footer", {
|
|
319
|
-
class:
|
|
319
|
+
class: k(["h0n-alert__actions", { "is-single": h.value }])
|
|
320
320
|
}, [
|
|
321
|
-
|
|
321
|
+
h.value ? (l(), u("button", {
|
|
322
322
|
key: 0,
|
|
323
323
|
class: "h0n-alert__btn h0n-alert__btn--primary",
|
|
324
324
|
type: "button",
|
|
325
|
-
onClick:
|
|
326
|
-
}, " Ok ")) : (
|
|
325
|
+
onClick: f
|
|
326
|
+
}, " Ok ")) : (l(), u(Z, { key: 1 }, [
|
|
327
327
|
m("button", {
|
|
328
328
|
class: "h0n-alert__btn is-danger",
|
|
329
329
|
type: "button",
|
|
330
330
|
onClick: v
|
|
331
331
|
}, " Cancel "),
|
|
332
332
|
m("button", {
|
|
333
|
-
class:
|
|
333
|
+
class: k(["h0n-alert__btn h0n-alert__btn--primary", {
|
|
334
334
|
"is-danger": _(n).type === "danger"
|
|
335
335
|
}]),
|
|
336
336
|
type: "button",
|
|
@@ -339,18 +339,18 @@ const Re = {
|
|
|
339
339
|
], 64))
|
|
340
340
|
], 2)
|
|
341
341
|
])
|
|
342
|
-
], 4)) :
|
|
342
|
+
], 4)) : b("", !0)
|
|
343
343
|
]),
|
|
344
344
|
_: 3
|
|
345
345
|
})
|
|
346
346
|
]));
|
|
347
347
|
}
|
|
348
|
-
}),
|
|
348
|
+
}), He = (e, n) => {
|
|
349
349
|
const t = e.__vccOpts || e;
|
|
350
|
-
for (const [
|
|
351
|
-
t[
|
|
350
|
+
for (const [r, o] of n)
|
|
351
|
+
t[r] = o;
|
|
352
352
|
return t;
|
|
353
|
-
},
|
|
353
|
+
}, Pe = /* @__PURE__ */ He(Ae, [["__scopeId", "data-v-290cad87"]]), re = /* @__PURE__ */ I({
|
|
354
354
|
__name: "Spinner",
|
|
355
355
|
props: {
|
|
356
356
|
size: {},
|
|
@@ -358,8 +358,8 @@ const Re = {
|
|
|
358
358
|
},
|
|
359
359
|
setup(e) {
|
|
360
360
|
const t = e.size ?? "md";
|
|
361
|
-
return (
|
|
362
|
-
class:
|
|
361
|
+
return (r, o) => (l(), u("div", {
|
|
362
|
+
class: k(["h0n-ui-spinner", [`h0n-ui-spinner--${_(t)}`, e.color]]),
|
|
363
363
|
role: "status",
|
|
364
364
|
"aria-label": "Loading"
|
|
365
365
|
}, null, 2));
|
|
@@ -370,14 +370,14 @@ const Re = {
|
|
|
370
370
|
}, Ue = {
|
|
371
371
|
key: 1,
|
|
372
372
|
class: "h0n-ui-btn__label"
|
|
373
|
-
},
|
|
373
|
+
}, qe = {
|
|
374
374
|
key: 2,
|
|
375
375
|
class: "h0n-ui-btn__spinner",
|
|
376
376
|
"aria-hidden": "true"
|
|
377
|
-
},
|
|
377
|
+
}, Ne = {
|
|
378
378
|
key: 3,
|
|
379
379
|
class: "h0n-ui-btn__icon h0n-ui-btn__icon--right"
|
|
380
|
-
},
|
|
380
|
+
}, je = /* @__PURE__ */ I({
|
|
381
381
|
__name: "Button",
|
|
382
382
|
props: {
|
|
383
383
|
text: {},
|
|
@@ -394,74 +394,74 @@ const Re = {
|
|
|
394
394
|
},
|
|
395
395
|
emits: ["click", "done", "error"],
|
|
396
396
|
setup(e, { emit: n }) {
|
|
397
|
-
const t = e,
|
|
397
|
+
const t = e, r = n, o = O(!1), v = y(() => t.loading !== void 0), f = y(
|
|
398
398
|
() => v.value ? !!t.loading : o.value
|
|
399
399
|
);
|
|
400
|
-
function
|
|
401
|
-
v.value || (o.value =
|
|
400
|
+
function h(c) {
|
|
401
|
+
v.value || (o.value = c);
|
|
402
402
|
}
|
|
403
|
-
async function
|
|
404
|
-
if (!(t.disabled ||
|
|
403
|
+
async function d(c) {
|
|
404
|
+
if (!(t.disabled || f.value) && (r("click", c), !!t.action))
|
|
405
405
|
try {
|
|
406
|
-
|
|
406
|
+
h(!0), await t.action(), r("done");
|
|
407
407
|
} catch (p) {
|
|
408
|
-
|
|
408
|
+
r("error", p);
|
|
409
409
|
} finally {
|
|
410
|
-
|
|
410
|
+
h(!1);
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
|
-
return (
|
|
414
|
-
class:
|
|
413
|
+
return (c, p) => (l(), u("button", {
|
|
414
|
+
class: k(["h0n-ui-btn", [
|
|
415
415
|
`h0n-ui-btn--${e.variant}`,
|
|
416
416
|
`h0n-ui-btn--${e.size}`,
|
|
417
417
|
`h0n-ui-btn--text-${e.position}`,
|
|
418
418
|
{
|
|
419
|
-
"h0n-ui-btn--loading":
|
|
419
|
+
"h0n-ui-btn--loading": f.value,
|
|
420
420
|
"h0n-ui-btn--pill": e.pill,
|
|
421
421
|
"h0n-ui-btn--radius": e.border,
|
|
422
422
|
"h0n-ui-btn--block": e.block
|
|
423
423
|
}
|
|
424
424
|
]]),
|
|
425
425
|
type: e.type,
|
|
426
|
-
disabled: e.disabled ||
|
|
427
|
-
"aria-busy":
|
|
428
|
-
onClick:
|
|
426
|
+
disabled: e.disabled || f.value,
|
|
427
|
+
"aria-busy": f.value ? "true" : void 0,
|
|
428
|
+
onClick: d
|
|
429
429
|
}, [
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
])) :
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
])) : (
|
|
436
|
-
|
|
437
|
-
|
|
430
|
+
c.$slots.left && !f.value ? (l(), u("span", Me, [
|
|
431
|
+
C(c.$slots, "left")
|
|
432
|
+
])) : b("", !0),
|
|
433
|
+
f.value ? (l(), u("span", qe, [
|
|
434
|
+
A(re, { size: "sm" })
|
|
435
|
+
])) : (l(), u("span", Ue, [
|
|
436
|
+
C(c.$slots, "default", {}, () => [
|
|
437
|
+
j(x(e.text), 1)
|
|
438
438
|
])
|
|
439
439
|
])),
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
])) :
|
|
440
|
+
c.$slots.right && !f.value ? (l(), u("span", Ne, [
|
|
441
|
+
C(c.$slots, "right")
|
|
442
|
+
])) : b("", !0)
|
|
443
443
|
], 10, De));
|
|
444
444
|
}
|
|
445
|
-
}),
|
|
445
|
+
}), Fe = { class: "h0n-ui-card" }, We = {
|
|
446
446
|
key: 0,
|
|
447
447
|
class: "h0n-ui-card--title"
|
|
448
|
-
},
|
|
448
|
+
}, Ze = /* @__PURE__ */ I({
|
|
449
449
|
__name: "Card",
|
|
450
450
|
props: {
|
|
451
451
|
title: {}
|
|
452
452
|
},
|
|
453
453
|
setup(e) {
|
|
454
|
-
return (n, t) => (
|
|
455
|
-
e.title ? (
|
|
456
|
-
|
|
454
|
+
return (n, t) => (l(), u("section", Fe, [
|
|
455
|
+
e.title ? (l(), u("p", We, x(e.title), 1)) : b("", !0),
|
|
456
|
+
C(n.$slots, "default")
|
|
457
457
|
]));
|
|
458
458
|
}
|
|
459
|
-
}),
|
|
460
|
-
function
|
|
461
|
-
const e =
|
|
462
|
-
function n(
|
|
459
|
+
}), U = ie(null);
|
|
460
|
+
function Je() {
|
|
461
|
+
const e = N();
|
|
462
|
+
function n(r) {
|
|
463
463
|
const o = Q();
|
|
464
|
-
|
|
464
|
+
U.value = { ...r, id: o }, e.push({
|
|
465
465
|
id: o,
|
|
466
466
|
showOverlay: !0,
|
|
467
467
|
closeOnOverlay: !0,
|
|
@@ -470,98 +470,140 @@ function Ze() {
|
|
|
470
470
|
});
|
|
471
471
|
}
|
|
472
472
|
function t() {
|
|
473
|
-
|
|
473
|
+
U.value && (e.remove(U.value.id), U.value = null);
|
|
474
474
|
}
|
|
475
475
|
return {
|
|
476
|
-
active:
|
|
476
|
+
active: U,
|
|
477
477
|
open: n,
|
|
478
478
|
close: t
|
|
479
479
|
};
|
|
480
480
|
}
|
|
481
|
-
const
|
|
481
|
+
const Ke = { class: "content-title-dialog" }, Xe = {
|
|
482
482
|
key: 0,
|
|
483
483
|
class: "title-dialog"
|
|
484
|
-
},
|
|
484
|
+
}, Ge = {
|
|
485
485
|
key: 0,
|
|
486
486
|
class: "h0n-dialog-bg-hero"
|
|
487
|
-
},
|
|
487
|
+
}, Qe = { class: "h0n-dialog-content" }, Ye = /* @__PURE__ */ I({
|
|
488
488
|
__name: "Dialog",
|
|
489
489
|
setup(e) {
|
|
490
|
-
const { active: n, close: t } =
|
|
491
|
-
|
|
490
|
+
const { active: n, close: t } = Je(), { getContentZIndex: r } = N(), o = O("bottom");
|
|
491
|
+
E(
|
|
492
492
|
() => n.value?.side,
|
|
493
|
-
(
|
|
494
|
-
|
|
493
|
+
(g) => {
|
|
494
|
+
g && (o.value = g);
|
|
495
495
|
},
|
|
496
496
|
{ immediate: !0 }
|
|
497
497
|
);
|
|
498
|
-
const v = y(() => `h0n-slide-${o.value}`),
|
|
499
|
-
() => n.value ?
|
|
500
|
-
),
|
|
501
|
-
|
|
498
|
+
const v = y(() => `h0n-slide-${o.value}`), f = y(
|
|
499
|
+
() => n.value ? r(n.value.id) : void 0
|
|
500
|
+
), h = y(() => n.value?.backgroundUrl?.trim() ?? ""), d = O(""), c = /* @__PURE__ */ new Set();
|
|
501
|
+
let p = 0;
|
|
502
|
+
const S = y(() => h.value.length > 0), T = y(
|
|
503
|
+
() => d.value.length > 0
|
|
504
|
+
), L = (g) => new Promise((a) => {
|
|
505
|
+
setTimeout(a, g);
|
|
506
|
+
}), P = (g) => new Promise((a, i) => {
|
|
507
|
+
const s = new Image();
|
|
508
|
+
s.decoding = "async", s.fetchPriority = "low", s.onload = async () => {
|
|
509
|
+
try {
|
|
510
|
+
typeof s.decode == "function" && await s.decode();
|
|
511
|
+
} catch {
|
|
512
|
+
}
|
|
513
|
+
a();
|
|
514
|
+
}, s.onerror = () => {
|
|
515
|
+
i(new Error("Failed to load dialog background image"));
|
|
516
|
+
}, s.src = g;
|
|
517
|
+
}), D = y(() => T.value ? {
|
|
518
|
+
"--h0n-dialog-bg-image": `url("${d.value.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}")`
|
|
502
519
|
} : void 0);
|
|
503
|
-
return (
|
|
504
|
-
|
|
520
|
+
return E(
|
|
521
|
+
h,
|
|
522
|
+
async (g, a, i) => {
|
|
523
|
+
const s = ++p;
|
|
524
|
+
let $ = !1;
|
|
525
|
+
if (i(() => {
|
|
526
|
+
$ = !0;
|
|
527
|
+
}), d.value = "", !!g) {
|
|
528
|
+
if (c.has(g)) {
|
|
529
|
+
d.value = g;
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
if (await L(140), !($ || s !== p))
|
|
533
|
+
try {
|
|
534
|
+
if (await P(g), $ || s !== p) return;
|
|
535
|
+
c.add(g), d.value = g;
|
|
536
|
+
} catch {
|
|
537
|
+
if ($ || s !== p) return;
|
|
538
|
+
d.value = "";
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
},
|
|
542
|
+
{ immediate: !0 }
|
|
543
|
+
), (g, a) => (l(), V(J, { to: "body" }, [
|
|
544
|
+
A(q, {
|
|
505
545
|
name: v.value,
|
|
506
546
|
appear: ""
|
|
507
547
|
}, {
|
|
508
|
-
default:
|
|
509
|
-
_(n) ? (
|
|
548
|
+
default: H(() => [
|
|
549
|
+
_(n) ? (l(), u("div", {
|
|
510
550
|
key: 0,
|
|
511
|
-
class:
|
|
512
|
-
style:
|
|
551
|
+
class: k(["h0n-dialog-layer", `is-${o.value}`]),
|
|
552
|
+
style: R({ zIndex: f.value })
|
|
513
553
|
}, [
|
|
514
554
|
m("section", {
|
|
515
|
-
class:
|
|
555
|
+
class: k(["h0n-dialog-panel", [
|
|
516
556
|
`is-${_(n).side}`,
|
|
517
|
-
{ "has-background-image":
|
|
557
|
+
{ "has-background-image": S.value }
|
|
518
558
|
]]),
|
|
519
|
-
style:
|
|
559
|
+
style: R(D.value)
|
|
520
560
|
}, [
|
|
521
561
|
m("header", {
|
|
522
|
-
class:
|
|
562
|
+
class: k(["h0n-dialog-header", [
|
|
523
563
|
`is-${_(n).side}`,
|
|
524
|
-
{ "has-background-image":
|
|
564
|
+
{ "has-background-image": S.value }
|
|
525
565
|
]])
|
|
526
566
|
}, [
|
|
527
|
-
m("div",
|
|
528
|
-
_(n).title ? (
|
|
529
|
-
|
|
567
|
+
m("div", Ke, [
|
|
568
|
+
_(n).title ? (l(), u("p", Xe, x(_(n).title), 1)) : b("", !0),
|
|
569
|
+
C(g.$slots, "dialogHeader")
|
|
530
570
|
]),
|
|
531
571
|
m("button", {
|
|
532
572
|
class: "h0n-dialog-close",
|
|
533
|
-
onClick:
|
|
573
|
+
onClick: a[0] || (a[0] = (i) => _(t)())
|
|
534
574
|
}, " x ")
|
|
535
575
|
], 2),
|
|
536
|
-
|
|
537
|
-
m("div", {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
576
|
+
S.value ? (l(), u("div", Ge, [
|
|
577
|
+
m("div", {
|
|
578
|
+
class: k(["h0n-dialog-bg-image", { "is-loaded": T.value }])
|
|
579
|
+
}, null, 2)
|
|
580
|
+
])) : b("", !0),
|
|
581
|
+
m("div", Qe, [
|
|
582
|
+
(l(), V(K(_(n).component), X(_(n).props, { onClose: _(t) }), null, 16, ["onClose"]))
|
|
541
583
|
])
|
|
542
584
|
], 6)
|
|
543
|
-
], 6)) :
|
|
585
|
+
], 6)) : b("", !0)
|
|
544
586
|
]),
|
|
545
587
|
_: 3
|
|
546
588
|
}, 8, ["name"])
|
|
547
589
|
]));
|
|
548
590
|
}
|
|
549
|
-
}),
|
|
591
|
+
}), et = { class: "h0n-ui-menu-item__left" }, tt = {
|
|
550
592
|
key: 0,
|
|
551
593
|
class: "h0n-ui-menu-item__icon"
|
|
552
|
-
},
|
|
594
|
+
}, nt = { class: "h0n-ui-menu-item__text" }, ot = {
|
|
553
595
|
key: 0,
|
|
554
596
|
class: "h0n-ui-menu-item__desc"
|
|
555
|
-
},
|
|
597
|
+
}, st = {
|
|
556
598
|
key: 0,
|
|
557
599
|
class: "h0n-ui-menu-item__right"
|
|
558
|
-
},
|
|
600
|
+
}, at = {
|
|
559
601
|
key: 0,
|
|
560
602
|
class: "h0n-ui-menu-item__right-text"
|
|
561
|
-
},
|
|
603
|
+
}, it = {
|
|
562
604
|
key: 0,
|
|
563
605
|
class: "h0n-ui-menu-item__chevron"
|
|
564
|
-
},
|
|
606
|
+
}, lt = /* @__PURE__ */ I({
|
|
565
607
|
__name: "Menu",
|
|
566
608
|
props: {
|
|
567
609
|
title: {},
|
|
@@ -576,60 +618,60 @@ const Je = { class: "content-title-dialog" }, Ke = {
|
|
|
576
618
|
},
|
|
577
619
|
emits: ["click"],
|
|
578
620
|
setup(e, { emit: n }) {
|
|
579
|
-
const t = e,
|
|
621
|
+
const t = e, r = n, o = y(() => !!t.to), v = y(() => t.as ?? (o.value ? "a" : "div")), f = y(() => t.chevron !== void 0 ? t.chevron : o.value), h = y(() => t.disabled ? {
|
|
580
622
|
role: "button",
|
|
581
623
|
tabindex: -1
|
|
582
624
|
} : t.as ? t.to ? { to: t.to } : {} : o.value ? { href: "#" } : { role: "button", tabindex: 0 });
|
|
583
|
-
function
|
|
625
|
+
function d(c) {
|
|
584
626
|
if (t.disabled) {
|
|
585
|
-
|
|
627
|
+
c.preventDefault(), c.stopPropagation();
|
|
586
628
|
return;
|
|
587
629
|
}
|
|
588
|
-
!t.as && o.value &&
|
|
630
|
+
!t.as && o.value && c.preventDefault(), r("click", c);
|
|
589
631
|
}
|
|
590
|
-
return (
|
|
632
|
+
return (c, p) => (l(), V(K(v.value), X({ class: "h0n-ui-menu-item" }, h.value, {
|
|
591
633
|
"aria-disabled": e.disabled || void 0,
|
|
592
|
-
onClick:
|
|
634
|
+
onClick: d
|
|
593
635
|
}), {
|
|
594
|
-
default:
|
|
595
|
-
m("div",
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
636
|
+
default: H(() => [
|
|
637
|
+
m("div", et, [
|
|
638
|
+
c.$slots.icon || e.icon ? (l(), u("div", tt, [
|
|
639
|
+
C(c.$slots, "icon", {}, () => [
|
|
640
|
+
j(x(e.icon), 1)
|
|
599
641
|
])
|
|
600
|
-
])) :
|
|
601
|
-
m("div",
|
|
642
|
+
])) : b("", !0),
|
|
643
|
+
m("div", nt, [
|
|
602
644
|
m("p", {
|
|
603
|
-
class:
|
|
645
|
+
class: k(["h0n-ui-menu-item__title", { "is-danger": e.danger }])
|
|
604
646
|
}, [
|
|
605
|
-
|
|
606
|
-
|
|
647
|
+
C(c.$slots, "title", {}, () => [
|
|
648
|
+
j(x(e.title), 1)
|
|
607
649
|
])
|
|
608
650
|
], 2),
|
|
609
|
-
e.description ||
|
|
610
|
-
|
|
611
|
-
|
|
651
|
+
e.description || c.$slots.description ? (l(), u("p", ot, [
|
|
652
|
+
C(c.$slots, "description", {}, () => [
|
|
653
|
+
j(x(e.description), 1)
|
|
612
654
|
])
|
|
613
|
-
])) :
|
|
655
|
+
])) : b("", !0)
|
|
614
656
|
])
|
|
615
657
|
]),
|
|
616
|
-
e.right ||
|
|
617
|
-
|
|
618
|
-
e.right ? (
|
|
658
|
+
e.right || c.$slots.right || f.value ? (l(), u("div", st, [
|
|
659
|
+
C(c.$slots, "right", {}, () => [
|
|
660
|
+
e.right ? (l(), u("p", at, x(e.right), 1)) : b("", !0)
|
|
619
661
|
]),
|
|
620
|
-
|
|
621
|
-
])) :
|
|
662
|
+
f.value ? (l(), u("span", it, "›")) : b("", !0)
|
|
663
|
+
])) : b("", !0)
|
|
622
664
|
]),
|
|
623
665
|
_: 3
|
|
624
666
|
}, 16, ["aria-disabled"]));
|
|
625
667
|
}
|
|
626
|
-
}),
|
|
668
|
+
}), rt = {
|
|
627
669
|
key: 0,
|
|
628
670
|
class: "h0n-ui-image__loader"
|
|
629
|
-
},
|
|
671
|
+
}, ct = {
|
|
630
672
|
key: 1,
|
|
631
673
|
class: "h0n-ui-image__error"
|
|
632
|
-
},
|
|
674
|
+
}, ut = ["src"], dt = ["src", "alt"], ft = /* @__PURE__ */ I({
|
|
633
675
|
__name: "Image",
|
|
634
676
|
props: {
|
|
635
677
|
src: {},
|
|
@@ -641,81 +683,81 @@ const Je = { class: "content-title-dialog" }, Ke = {
|
|
|
641
683
|
},
|
|
642
684
|
setup(e) {
|
|
643
685
|
const n = e, t = O("loading");
|
|
644
|
-
function
|
|
686
|
+
function r() {
|
|
645
687
|
t.value = "loading";
|
|
646
|
-
const
|
|
647
|
-
|
|
688
|
+
const f = new Image();
|
|
689
|
+
f.src = n.src, f.onload = () => {
|
|
648
690
|
t.value = "loaded";
|
|
649
|
-
},
|
|
691
|
+
}, f.onerror = () => {
|
|
650
692
|
t.value = "error";
|
|
651
693
|
};
|
|
652
694
|
}
|
|
653
695
|
G(() => {
|
|
654
696
|
if (n.lazy && "IntersectionObserver" in window) {
|
|
655
|
-
const
|
|
656
|
-
|
|
697
|
+
const f = new IntersectionObserver(([h]) => {
|
|
698
|
+
h.isIntersecting && (r(), f.disconnect());
|
|
657
699
|
});
|
|
658
|
-
|
|
700
|
+
f.observe(document.body);
|
|
659
701
|
} else
|
|
660
|
-
|
|
661
|
-
}),
|
|
702
|
+
r();
|
|
703
|
+
}), E(() => n.src, r);
|
|
662
704
|
const o = y(() => ({
|
|
663
705
|
borderRadius: typeof n.radius == "number" ? `${n.radius}px` : n.radius
|
|
664
706
|
})), v = y(() => ({
|
|
665
707
|
objectFit: n.fit
|
|
666
708
|
}));
|
|
667
|
-
return (
|
|
668
|
-
class:
|
|
669
|
-
style:
|
|
709
|
+
return (f, h) => (l(), u("div", {
|
|
710
|
+
class: k(["h0n-ui-image", t.value]),
|
|
711
|
+
style: R(o.value)
|
|
670
712
|
}, [
|
|
671
|
-
t.value === "loading" ? (
|
|
672
|
-
e.fallback ? (
|
|
713
|
+
t.value === "loading" ? (l(), u("div", rt)) : t.value === "error" ? (l(), u("div", ct, [
|
|
714
|
+
e.fallback ? (l(), u("img", {
|
|
673
715
|
key: 0,
|
|
674
716
|
src: e.fallback
|
|
675
|
-
}, null, 8,
|
|
676
|
-
])) : (
|
|
717
|
+
}, null, 8, ut)) : b("", !0)
|
|
718
|
+
])) : (l(), u("img", {
|
|
677
719
|
key: 2,
|
|
678
720
|
src: e.src,
|
|
679
721
|
alt: e.alt,
|
|
680
|
-
style:
|
|
722
|
+
style: R(v.value),
|
|
681
723
|
draggable: "false"
|
|
682
|
-
}, null, 12,
|
|
724
|
+
}, null, 12, dt))
|
|
683
725
|
], 6));
|
|
684
726
|
}
|
|
685
|
-
}),
|
|
727
|
+
}), ht = /* @__PURE__ */ I({
|
|
686
728
|
__name: "Overlay",
|
|
687
729
|
setup(e) {
|
|
688
|
-
const { top: n, getBackdropZIndex: t, requestCloseTop:
|
|
730
|
+
const { top: n, getBackdropZIndex: t, requestCloseTop: r } = N(), o = y(() => !!n.value && n.value.showOverlay !== !1), v = y(() => {
|
|
689
731
|
if (n.value?.id)
|
|
690
732
|
return t(n.value.id);
|
|
691
733
|
});
|
|
692
|
-
function
|
|
734
|
+
function f() {
|
|
693
735
|
}
|
|
694
|
-
function
|
|
736
|
+
function h(c) {
|
|
695
737
|
const p = n.value;
|
|
696
|
-
!p || p.closeOnOverlay === !1 ||
|
|
738
|
+
!p || p.closeOnOverlay === !1 || r();
|
|
697
739
|
}
|
|
698
|
-
function
|
|
740
|
+
function d(c) {
|
|
699
741
|
const p = n.value;
|
|
700
|
-
!p || p.closeOnEsc === !1 ||
|
|
742
|
+
!p || p.closeOnEsc === !1 || c.key === "Escape" && r();
|
|
701
743
|
}
|
|
702
|
-
return G(() => window.addEventListener("keydown",
|
|
703
|
-
|
|
704
|
-
default:
|
|
705
|
-
o.value ? (
|
|
744
|
+
return G(() => window.addEventListener("keydown", d)), ye(() => window.removeEventListener("keydown", d)), (c, p) => (l(), V(J, { to: "body" }, [
|
|
745
|
+
A(q, { name: "h0n-ui-fade" }, {
|
|
746
|
+
default: H(() => [
|
|
747
|
+
o.value ? (l(), u("div", {
|
|
706
748
|
key: 0,
|
|
707
749
|
class: "h0n-ui-overlay",
|
|
708
|
-
style:
|
|
709
|
-
onPointerdown: F(
|
|
710
|
-
onPointerup: F(
|
|
711
|
-
onClick: F(
|
|
712
|
-
}, null, 36)) :
|
|
750
|
+
style: R({ zIndex: v.value }),
|
|
751
|
+
onPointerdown: F(f, ["self", "prevent", "stop"]),
|
|
752
|
+
onPointerup: F(f, ["self", "prevent", "stop"]),
|
|
753
|
+
onClick: F(h, ["self", "prevent", "stop"])
|
|
754
|
+
}, null, 36)) : b("", !0)
|
|
713
755
|
]),
|
|
714
756
|
_: 1
|
|
715
757
|
})
|
|
716
758
|
]));
|
|
717
759
|
}
|
|
718
|
-
}),
|
|
760
|
+
}), vt = /* @__PURE__ */ I({
|
|
719
761
|
__name: "Skeleton",
|
|
720
762
|
props: {
|
|
721
763
|
width: { default: "100%" },
|
|
@@ -725,7 +767,7 @@ const Je = { class: "content-title-dialog" }, Ke = {
|
|
|
725
767
|
animated: { type: Boolean, default: !0 }
|
|
726
768
|
},
|
|
727
769
|
setup(e) {
|
|
728
|
-
const n = e, t = (o) => typeof o == "number" ? `${o}px` : o,
|
|
770
|
+
const n = e, t = (o) => typeof o == "number" ? `${o}px` : o, r = y(() => {
|
|
729
771
|
const o = {
|
|
730
772
|
width: t(n.width),
|
|
731
773
|
height: t(n.height),
|
|
@@ -733,15 +775,15 @@ const Je = { class: "content-title-dialog" }, Ke = {
|
|
|
733
775
|
};
|
|
734
776
|
return n.variant === "circle" ? { ...o, borderRadius: "999px" } : n.variant === "round" ? { ...o, borderRadius: "14px" } : o;
|
|
735
777
|
});
|
|
736
|
-
return (o, v) => (
|
|
737
|
-
class:
|
|
738
|
-
style:
|
|
778
|
+
return (o, v) => (l(), u("div", {
|
|
779
|
+
class: k(["h0n-skeleton", { "is-animated": e.animated }]),
|
|
780
|
+
style: R(r.value)
|
|
739
781
|
}, null, 6));
|
|
740
782
|
}
|
|
741
|
-
}),
|
|
783
|
+
}), mt = { class: "h0n-tabs" }, yt = ["onClick"], pt = { class: "h0n-tabs__label" }, gt = {
|
|
742
784
|
key: 0,
|
|
743
785
|
class: "h0n-tabs__content"
|
|
744
|
-
}, _t = /* @__PURE__ */
|
|
786
|
+
}, _t = /* @__PURE__ */ I({
|
|
745
787
|
__name: "Tabs",
|
|
746
788
|
props: {
|
|
747
789
|
modelValue: {},
|
|
@@ -749,60 +791,62 @@ const Je = { class: "content-title-dialog" }, Ke = {
|
|
|
749
791
|
},
|
|
750
792
|
emits: ["update:modelValue"],
|
|
751
793
|
setup(e, { emit: n }) {
|
|
752
|
-
const t = e,
|
|
753
|
-
() => t.tabs.findIndex((
|
|
754
|
-
), v = O(null),
|
|
794
|
+
const t = e, r = n, o = y(
|
|
795
|
+
() => t.tabs.findIndex((i) => i.value === t.modelValue)
|
|
796
|
+
), v = O(null), f = O(null), h = O(0), d = O(0), c = O("forward");
|
|
755
797
|
let p = 0;
|
|
756
|
-
const
|
|
757
|
-
|
|
758
|
-
},
|
|
759
|
-
const
|
|
760
|
-
return
|
|
761
|
-
},
|
|
762
|
-
const
|
|
763
|
-
if (await
|
|
764
|
-
const
|
|
765
|
-
if (!
|
|
766
|
-
|
|
798
|
+
const S = () => {
|
|
799
|
+
L("auto");
|
|
800
|
+
}, T = () => {
|
|
801
|
+
const i = f.value;
|
|
802
|
+
return i ? i.querySelector(".h0n-tabs__tab.is-active") : null;
|
|
803
|
+
}, L = async (i = "smooth") => {
|
|
804
|
+
const s = ++p;
|
|
805
|
+
if (await ge(), s !== p) return;
|
|
806
|
+
const $ = f.value, w = T(), B = v.value;
|
|
807
|
+
if (!w || !$) {
|
|
808
|
+
h.value = 0, d.value = 0;
|
|
767
809
|
return;
|
|
768
810
|
}
|
|
769
|
-
const
|
|
770
|
-
if (
|
|
771
|
-
const
|
|
772
|
-
Math.abs(
|
|
811
|
+
const ce = w.querySelector(".h0n-tabs__label") ?? w, ue = $.getBoundingClientRect(), Y = ce.getBoundingClientRect();
|
|
812
|
+
if (h.value = Y.left - ue.left, d.value = Y.width, !B) return;
|
|
813
|
+
const de = w.offsetLeft + w.offsetWidth / 2 - B.clientWidth / 2, fe = Math.max(B.scrollWidth - B.clientWidth, 0), ee = Math.min(Math.max(de, 0), fe);
|
|
814
|
+
Math.abs(B.scrollLeft - ee) < 1 || B.scrollTo({
|
|
773
815
|
left: ee,
|
|
774
|
-
behavior:
|
|
816
|
+
behavior: i
|
|
775
817
|
});
|
|
776
818
|
}, P = y(() => ({
|
|
777
819
|
left: "0px",
|
|
778
|
-
width: `${
|
|
779
|
-
transform: `translateX(${
|
|
820
|
+
width: `${d.value}px`,
|
|
821
|
+
transform: `translateX(${h.value}px)`
|
|
780
822
|
}));
|
|
781
|
-
|
|
823
|
+
E(
|
|
782
824
|
() => o.value,
|
|
783
|
-
(
|
|
784
|
-
if (
|
|
785
|
-
|
|
825
|
+
(i, s) => {
|
|
826
|
+
if (s === void 0 || s === -1 || i === -1) {
|
|
827
|
+
c.value = "forward";
|
|
786
828
|
return;
|
|
787
829
|
}
|
|
788
|
-
|
|
830
|
+
c.value = i >= s ? "forward" : "backward";
|
|
789
831
|
}
|
|
790
832
|
);
|
|
791
|
-
const
|
|
792
|
-
() =>
|
|
793
|
-
),
|
|
794
|
-
|
|
833
|
+
const D = y(
|
|
834
|
+
() => c.value === "forward" ? "h0n-tabs-slide-left" : "h0n-tabs-slide-right"
|
|
835
|
+
), g = y(
|
|
836
|
+
() => t.tabs.length > 0 && t.tabs.length <= 3
|
|
837
|
+
), a = (i) => {
|
|
838
|
+
r("update:modelValue", i);
|
|
795
839
|
};
|
|
796
840
|
return G(() => {
|
|
797
|
-
|
|
798
|
-
}),
|
|
799
|
-
p++, window.removeEventListener("resize",
|
|
800
|
-
}),
|
|
841
|
+
L("auto"), window.addEventListener("resize", S);
|
|
842
|
+
}), pe(() => {
|
|
843
|
+
p++, window.removeEventListener("resize", S);
|
|
844
|
+
}), E(
|
|
801
845
|
() => [t.modelValue, t.tabs.length],
|
|
802
846
|
() => {
|
|
803
|
-
|
|
847
|
+
L();
|
|
804
848
|
}
|
|
805
|
-
), (
|
|
849
|
+
), (i, s) => (l(), u("div", mt, [
|
|
806
850
|
m("div", {
|
|
807
851
|
ref_key: "scrollerRef",
|
|
808
852
|
ref: v,
|
|
@@ -810,72 +854,72 @@ const Je = { class: "content-title-dialog" }, Ke = {
|
|
|
810
854
|
}, [
|
|
811
855
|
m("div", {
|
|
812
856
|
ref_key: "listRef",
|
|
813
|
-
ref:
|
|
814
|
-
class: "h0n-tabs__list"
|
|
857
|
+
ref: f,
|
|
858
|
+
class: k(["h0n-tabs__list", { "is-even": g.value }])
|
|
815
859
|
}, [
|
|
816
|
-
(
|
|
817
|
-
key: `${String(
|
|
818
|
-
class:
|
|
860
|
+
(l(!0), u(Z, null, ae(e.tabs, ($, w) => (l(), u("button", {
|
|
861
|
+
key: `${String($.value)}-${w}`,
|
|
862
|
+
class: k(["h0n-tabs__tab", { "is-active": $.value === e.modelValue }]),
|
|
819
863
|
type: "button",
|
|
820
|
-
onClick: (
|
|
864
|
+
onClick: (B) => a($.value)
|
|
821
865
|
}, [
|
|
822
|
-
m("span",
|
|
823
|
-
], 10,
|
|
866
|
+
m("span", pt, x($.label), 1)
|
|
867
|
+
], 10, yt))), 128)),
|
|
824
868
|
m("span", {
|
|
825
869
|
class: "h0n-tabs__indicator",
|
|
826
|
-
style:
|
|
870
|
+
style: R(P.value)
|
|
827
871
|
}, null, 4)
|
|
828
|
-
],
|
|
872
|
+
], 2)
|
|
829
873
|
], 512),
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
name:
|
|
874
|
+
i.$slots.default ? (l(), u("div", gt, [
|
|
875
|
+
A(q, {
|
|
876
|
+
name: D.value,
|
|
833
877
|
mode: "out-in"
|
|
834
878
|
}, {
|
|
835
|
-
default:
|
|
836
|
-
(
|
|
879
|
+
default: H(() => [
|
|
880
|
+
(l(), u("div", {
|
|
837
881
|
key: e.modelValue,
|
|
838
882
|
class: "h0n-tabs__panel"
|
|
839
883
|
}, [
|
|
840
|
-
|
|
884
|
+
C(i.$slots, "default", { activeTab: e.modelValue })
|
|
841
885
|
]))
|
|
842
886
|
]),
|
|
843
887
|
_: 3
|
|
844
888
|
}, 8, ["name"])
|
|
845
|
-
])) :
|
|
889
|
+
])) : b("", !0)
|
|
846
890
|
]));
|
|
847
891
|
}
|
|
848
892
|
});
|
|
849
|
-
function
|
|
850
|
-
const n =
|
|
893
|
+
function bt(e) {
|
|
894
|
+
const n = kt(e);
|
|
851
895
|
return {
|
|
852
896
|
install(t) {
|
|
853
|
-
t.component("H0Accordion",
|
|
897
|
+
t.component("H0Accordion", Be), t.component("H0Alert", Pe), t.component("H0Button", je), t.component("H0Card", Ze), t.component("H0Dialog", Ye), t.component("H0Spinner", re), t.component("H0Menu", lt), t.component("H0Image", ft), t.component("H0Overlay", ht), t.component("H0Skeleton", vt), t.component("H0Tabs", _t), be(n.theme);
|
|
854
898
|
}
|
|
855
899
|
};
|
|
856
900
|
}
|
|
857
|
-
const
|
|
858
|
-
function
|
|
901
|
+
const Ct = bt();
|
|
902
|
+
function kt(e) {
|
|
859
903
|
return {
|
|
860
904
|
autoRegisterComponents: e?.autoRegisterComponents ?? !0,
|
|
861
905
|
theme: _e(e?.theme)
|
|
862
906
|
};
|
|
863
907
|
}
|
|
864
908
|
export {
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
909
|
+
Be as Accordion,
|
|
910
|
+
Pe as Alert,
|
|
911
|
+
je as Button,
|
|
912
|
+
Ze as Card,
|
|
913
|
+
Ye as Dialog,
|
|
914
|
+
ft as Image,
|
|
915
|
+
lt as Menu,
|
|
916
|
+
ht as Overlay,
|
|
917
|
+
vt as Skeleton,
|
|
874
918
|
re as Spinner,
|
|
875
919
|
_t as Tabs,
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
920
|
+
bt as createH0NPlugin,
|
|
921
|
+
Ct as h0nUi,
|
|
922
|
+
N as useOverlayStack,
|
|
923
|
+
Re as useWebAlert,
|
|
924
|
+
Je as useWebDialog
|
|
881
925
|
};
|