@zealsolutions/zeal-ui 1.0.0-alpha.351 → 1.0.0-alpha.353

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.
@@ -0,0 +1,365 @@
1
+ import { useSlots as ae, computed as v, openBlock as r, createElementBlock as b, normalizeClass as T, createElementVNode as d, renderSlot as p, createCommentVNode as $, createVNode as y, withCtx as f, mergeModels as J, ref as i, useModel as fe, onMounted as ve, watch as Q, createTextVNode as E, toDisplayString as Y, createBlock as N, resolveDynamicComponent as pe, unref as W, withDirectives as Z, normalizeStyle as ee, withKeys as he, withModifiers as te, vModelText as me, Fragment as ye, renderList as be, vShow as we, nextTick as ge } from "vue";
2
+ import { _ as xe } from "./OpacityScaleTransition-CtMzqccC.js";
3
+ import { _ as ke } from "./OpacityTranslateTransition-fF3EnRwC.js";
4
+ import { _ as $e } from "./OpacityTransition-D4EuhJnX.js";
5
+ import { i as q, g as _e } from "./axiosHelpers-BGXP7XLq.js";
6
+ import { _ as Se } from "./TruncateText-BOyOYUV6.js";
7
+ import { _ as Ce } from "./InfiniteScroll-BYCNEoaA.js";
8
+ import Ie from "./CircleStatusIcon-C4Av0hTY.js";
9
+ import { a as De, u as Be, w as Te, b as Me } from "./index-D9ihCfA2.js";
10
+ import { _ as Ve } from "./BaseDropdownButton-BD1CMHuM.js";
11
+ import Le from "./MagnifyingGlassIcon-ChYNIA-H.js";
12
+ import Ue from "./XMarkIcon-DKJ_--uA.js";
13
+ import Pe from "./CheckIcon-D0-G6sID.js";
14
+ import { _ as Ke } from "./_plugin-vue_export-helper-CHgC5LLL.js";
15
+ const Ee = { class: "flex h-full items-center space-x-3" }, Ne = { key: 0 }, We = {
16
+ key: 0,
17
+ class: "absolute w-3 inset-y-0 right-4 flex items-center justify-center"
18
+ }, le = {
19
+ __name: "DropdownMenuItem",
20
+ props: {
21
+ selected: {
22
+ type: Boolean,
23
+ default: !1
24
+ },
25
+ active: {
26
+ type: Boolean,
27
+ default: !1
28
+ }
29
+ },
30
+ setup(n) {
31
+ const _ = n, x = ae(), M = v(() => x.prefix && q(x.prefix()[0].type)), V = v(() => x.suffix && q(x.suffix()[0].type)), h = v(() => _.selected ? "bg-app-950 text-white" : _.active ? "bg-steel-300 dark:bg-surface-hover text-black-950 dark:text-content" : "bg-surface-raised text-black-950 dark:text-content");
32
+ return (l, z) => (r(), b("li", {
33
+ class: T(["relative items-center select-none h-[38px] pl-4 text-style-input", [
34
+ h.value,
35
+ V.value ? "pr-8" : "pr-4"
36
+ ]])
37
+ }, [
38
+ d("div", Ee, [
39
+ M.value ? (r(), b("div", Ne, [
40
+ p(l.$slots, "prefix")
41
+ ])) : $("", !0),
42
+ y(Se, {
43
+ active: n.active,
44
+ class: "rotate-0"
45
+ }, {
46
+ default: f(() => [
47
+ p(l.$slots, "default")
48
+ ]),
49
+ _: 3
50
+ }, 8, ["active"])
51
+ ]),
52
+ V.value ? (r(), b("span", We, [
53
+ p(l.$slots, "suffix")
54
+ ])) : $("", !0)
55
+ ], 2));
56
+ }
57
+ }, qe = { class: "relative" }, ze = {
58
+ key: 0,
59
+ class: "bg-steel-100 dark:bg-surface border-b-0"
60
+ }, Ae = { class: "relative cursor-default select-none h-[38px] pl-4 text-black-950 dark:text-content text-style-input pr-5" }, je = { class: "flex h-full items-center space-x-3" }, He = { class: "relative h-2.5 w-2.5" }, Re = ["placeholder", "onKeydown", "disabled"], Fe = { class: "absolute w-3 inset-y-0 right-4 flex items-center justify-center" }, Oe = { class: "text-style-base-body focus:outline-none" }, B = 38, dt = {
61
+ __name: "DropdownMenu",
62
+ props: /* @__PURE__ */ J({
63
+ displayRows: {
64
+ type: Number,
65
+ default: 5
66
+ },
67
+ data: {
68
+ type: Array,
69
+ default: () => []
70
+ },
71
+ placeholder: {
72
+ type: String,
73
+ default: "Choose an option"
74
+ },
75
+ searchPlaceholder: {
76
+ type: String,
77
+ default: "Search"
78
+ },
79
+ fetchUrl: {
80
+ type: [String, null],
81
+ default: null,
82
+ required: !1
83
+ },
84
+ fetchParams: {
85
+ type: Object,
86
+ default: () => {
87
+ },
88
+ required: !1
89
+ },
90
+ searchUrl: {
91
+ type: [String, null],
92
+ default: null,
93
+ required: !1
94
+ },
95
+ idKey: {
96
+ type: String,
97
+ required: !1,
98
+ default: "id"
99
+ },
100
+ valKey: {
101
+ type: String,
102
+ required: !1,
103
+ default: "val"
104
+ },
105
+ responseCallback: {
106
+ type: [Function, null],
107
+ default: null
108
+ },
109
+ searchable: {
110
+ type: Boolean,
111
+ default: !1
112
+ },
113
+ fitContent: {
114
+ type: Boolean,
115
+ default: !1
116
+ },
117
+ forceWidth: {
118
+ type: String,
119
+ default: ""
120
+ },
121
+ maxWidth: {
122
+ type: String,
123
+ default: "none"
124
+ },
125
+ buttonPosition: {
126
+ type: String,
127
+ default: "left"
128
+ },
129
+ scrollable: {
130
+ type: Boolean,
131
+ default: !0
132
+ },
133
+ showBorder: {
134
+ type: Boolean,
135
+ default: !0
136
+ },
137
+ disabled: {
138
+ type: Boolean,
139
+ default: !1
140
+ }
141
+ }, {
142
+ modelValue: {},
143
+ modelModifiers: {}
144
+ }),
145
+ emits: /* @__PURE__ */ J(["error"], ["update:modelValue"]),
146
+ setup(n, { emit: _ }) {
147
+ const { width: x, height: M } = De(), h = Be(Me).smaller("sm"), l = n, z = _, A = ae(), oe = v(() => A.buttonIcon && q(A.buttonIcon()[0].type)), S = i(null), u = i(null), j = i(null), m = fe(n, "modelValue"), o = i(null), L = v(() => !m.value || k.value.length === 0 ? null : k.value.find((e) => e.id === m.value)), U = i(5), se = v(() => l.scrollable ? l.displayRows * B + 24 : "none"), C = i("down"), c = i(!1), H = i(0), s = i(l.data), k = i(l.data), w = i(""), I = v(() => l.buttonPosition === "left"), ne = v(() => h.value ? "origin-bottom" : C.value === "down" ? I.value ? "origin-top-left" : "origin-top-right" : I.value ? "origin-bottom-left" : "origin-bottom-right");
148
+ let R = null, F = null;
149
+ const D = i(!1), P = () => {
150
+ l.disabled || (c.value = !c.value, m.value !== void 0 && (o.value = m.value), c.value ? ge(() => {
151
+ u.value.$el.scrollTop = H.value;
152
+ }) : o.value = null);
153
+ }, K = (e) => {
154
+ H.value = u.value.$el.scrollTop, m.value = e, c.value = !1;
155
+ }, O = (e) => {
156
+ o.value = e;
157
+ }, G = () => {
158
+ let e = j.value.getBoundingClientRect();
159
+ S.value.style.display = "block";
160
+ let a = S.value.clientHeight;
161
+ S.value.style.display = "none", e.top + e.height + a > window.innerHeight ? (C.value = "up", U.value = -a - e.height - 5) : (C.value = "down", U.value = 5);
162
+ }, ie = (e) => {
163
+ e.preventDefault(), u.value.$el.focus(), w.value !== "" && (o.value = s.value[0].id), o.value === null && (o.value = s.value[0].id);
164
+ }, re = (e) => {
165
+ e.preventDefault();
166
+ let a = Math.floor(u.value.$el.scrollTop / B);
167
+ if (e.key === "Escape" && (o.value = null, c.value = !1), e.key === "ArrowDown") {
168
+ let t;
169
+ s.value.length > 0 ? (t = s.value.findIndex((g) => g.id === o.value), t < s.value.length - 1 && (o.value = s.value[t + 1].id)) : ((o.value === null || o.value < F) && o.value++, t = o.value - 1), t - a > l.displayRows - 2 && (u.value.$el.scrollTop += B);
170
+ }
171
+ if (e.key === "ArrowUp") {
172
+ let t;
173
+ s.value.length > 0 ? (t = s.value.findIndex((g) => g.id === o.value), t > 0 && (o.value = s.value[t - 1].id)) : o.value === null ? t = 0 : (o.value > 1 && o.value--, t = o.value - 1), t - a < 2 && (u.value.$el.scrollTop -= B);
174
+ }
175
+ (e.key === "Enter" || e.key === "Tab") && (K(o.value), c.value = !1);
176
+ }, ue = () => {
177
+ l.searchable ? S.value.getElementsByTagName("input")[0].focus() : u.value.$el.focus();
178
+ }, ce = (e) => {
179
+ }, X = () => {
180
+ w.value = "";
181
+ }, de = v(() => {
182
+ let e = `margin-top: ${U.value}px; max-width: ${l.maxWidth};`;
183
+ return l.forceWidth !== "" && !h.value && (e += `width: ${l.forceWidth};`), e;
184
+ });
185
+ return ve(() => {
186
+ u.value.canEmit = !1, G(), l.fetchUrl !== null && _e(l.fetchUrl, l.fetchParams).then((e) => {
187
+ l.responseCallback !== null ? s.value = l.responseCallback(e.data) : s.value = e.data.map((a, t) => ({
188
+ id: a[l.idKey] || t,
189
+ val: a[l.valKey]
190
+ })), k.value = s.value;
191
+ }).catch((e) => {
192
+ z("error", e);
193
+ }), l.data.length === 0 && (F = u.value.$el.getElementsByTagName("li").length);
194
+ }), Q([x, M], () => {
195
+ h.value || G();
196
+ }), Q(() => l.data, (e) => {
197
+ const a = e || [];
198
+ k.value = a;
199
+ const t = w.value.trim();
200
+ s.value = l.searchUrl === null && t !== "" ? a.filter((g) => g.val.toLowerCase().includes(t.toLowerCase())) : a;
201
+ }), Te(w, (e) => {
202
+ let a = e.trim();
203
+ a !== R && (l.searchUrl !== null ? navValTrimmed === "" && (s.value = k.value) : s.value = k.value.filter((t) => t.val.toLowerCase().includes(a.toLowerCase())), R = a);
204
+ }, { debounce: l.searchUrl ? 300 : 0, maxWait: l.searchUrl ? 1e3 : void 0 }), (e, a) => (r(), b("div", qe, [
205
+ d("div", {
206
+ ref_key: "button",
207
+ ref: j,
208
+ class: T(["flex", [I.value ? "justify-start" : "justify-end", { "opacity-50 pointer-events-none cursor-not-allowed": n.disabled, "bg-steel-100 dark:bg-surface": n.disabled }]])
209
+ }, [
210
+ p(e.$slots, "button", {
211
+ selectedItem: L.value,
212
+ toggleDropdown: P,
213
+ showDropdown: c.value,
214
+ dropdownDirection: C.value
215
+ }, () => [
216
+ y(Ve, {
217
+ "show-button-icon": oe.value,
218
+ "show-dropdown": c.value,
219
+ "dropdown-direction": C.value,
220
+ onClick: P,
221
+ class: T(n.fitContent ? "w-fit" : "w-full")
222
+ }, {
223
+ buttonIcon: f(() => [
224
+ p(e.$slots, "buttonIcon")
225
+ ]),
226
+ default: f(() => [
227
+ E(Y(L.value ? L.value.val : n.placeholder) + " ", 1)
228
+ ]),
229
+ _: 3
230
+ }, 8, ["show-button-icon", "show-dropdown", "dropdown-direction", "class"])
231
+ ])
232
+ ], 2),
233
+ y($e, null, {
234
+ default: f(() => [
235
+ c.value ? (r(), b("div", {
236
+ key: 0,
237
+ class: "fixed inset-0 top-0 left-0 z-10 bg-black-950/85 sm:bg-[transparent]",
238
+ onClick: P
239
+ })) : $("", !0)
240
+ ]),
241
+ _: 1
242
+ }),
243
+ (r(), N(pe(W(h) ? ke : xe), {
244
+ "enter-active-class": W(h) ? "transition-all duration-200 ease-in delay-100" : "transition-all ease-out duration-75 scale-100",
245
+ "leave-active-class": W(h) ? "transition-all duration-200 ease-out" : "transition-all ease-in duration-75 scale-100",
246
+ onAfterEnter: ue
247
+ }, {
248
+ default: f(() => [
249
+ Z(d("div", {
250
+ ref_key: "container",
251
+ ref: S,
252
+ class: T(["fixed bottom-[75px] left-2.5 w-[calc(100%-20px)] sm:bottom-auto sm:absolute flex flex-col z-20 rounded-[20px] border-steel-400 dark:border-line-strong overflow-hidden shadow-zeal-md", [
253
+ ne.value,
254
+ n.fitContent ? "sm:w-fit" : "sm:w-full",
255
+ I.value ? "sm:left-0" : "sm:left-auto sm:right-0",
256
+ n.showBorder ? "border-[1px]" : "border-0"
257
+ ]]),
258
+ style: ee(de.value)
259
+ }, [
260
+ p(e.$slots, "search", {
261
+ searchString: w.value,
262
+ clearSearch: X,
263
+ inputDisabled: D.value
264
+ }, () => [
265
+ n.searchable ? (r(), b("div", ze, [
266
+ d("div", Ae, [
267
+ d("div", je, [
268
+ d("div", He, [
269
+ y(Le, { class: "absolute scale-[0.8182] -left-1 -top-1 origin-top-left text-steel-600 dark:text-content-muted" })
270
+ ]),
271
+ d("div", null, [
272
+ Z(d("input", {
273
+ type: "text",
274
+ class: "w-full text-style-input bg-[transparent] focus:outline-none focus:ring-0 border-0 px-0",
275
+ tabindex: "-1",
276
+ placeholder: n.searchPlaceholder,
277
+ "onUpdate:modelValue": a[0] || (a[0] = (t) => w.value = t),
278
+ onKeydown: he(te(ie, ["self"]), ["tab"]),
279
+ disabled: D.value
280
+ }, null, 40, Re), [
281
+ [me, w.value]
282
+ ])
283
+ ])
284
+ ]),
285
+ d("span", Fe, [
286
+ y(Ue, {
287
+ class: "scale-[0.8182] text-steel-700 dark:text-content-muted cursor-pointer",
288
+ onClick: X
289
+ })
290
+ ])
291
+ ])
292
+ ])) : $("", !0)
293
+ ]),
294
+ y(Ce, {
295
+ ref_key: "list",
296
+ ref: u,
297
+ down: !1,
298
+ tabindex: "-1",
299
+ class: "w-full py-0 ring-inset focus:outline-none",
300
+ style: ee(`max-height: ${se.value}px;`),
301
+ onLoad: ce,
302
+ onKeydown: te(re, ["self"]),
303
+ onFocus: a[1] || (a[1] = (t) => D.value = !0),
304
+ onBlur: a[2] || (a[2] = (t) => D.value = !1)
305
+ }, {
306
+ default: f(() => [
307
+ d("ul", Oe, [
308
+ p(e.$slots, "default", {
309
+ itemList: s.value,
310
+ setActive: O,
311
+ selectItem: K,
312
+ selectedId: m.value,
313
+ activeId: o.value
314
+ }, () => [
315
+ (r(!0), b(ye, null, be(s.value, (t) => (r(), N(le, {
316
+ key: t.id,
317
+ selected: t.id === m.value,
318
+ active: t.id === o.value,
319
+ onClick: (g) => K(t.id),
320
+ onMouseenter: (g) => O(t.id)
321
+ }, {
322
+ prefix: f(() => [
323
+ y(Ie)
324
+ ]),
325
+ suffix: f(() => [
326
+ t.id === m.value ? (r(), N(Pe, { key: 0 })) : $("", !0)
327
+ ]),
328
+ default: f(() => [
329
+ E(Y(t.val) + " ", 1)
330
+ ]),
331
+ _: 2
332
+ }, 1032, ["selected", "active", "onClick", "onMouseenter"]))), 128))
333
+ ]),
334
+ (n.searchable || n.fetchUrl !== null) && s.value.length === 0 ? p(e.$slots, "empty", { key: 0 }, () => [
335
+ y(le, { tabindex: "-1" }, {
336
+ default: f(() => [
337
+ E(" No items found ")
338
+ ]),
339
+ _: 1
340
+ })
341
+ ]) : $("", !0)
342
+ ])
343
+ ]),
344
+ _: 3
345
+ }, 8, ["style"])
346
+ ], 6), [
347
+ [we, c.value]
348
+ ])
349
+ ]),
350
+ _: 3
351
+ }, 40, ["enter-active-class", "leave-active-class"]))
352
+ ]));
353
+ }
354
+ }, Ge = {}, Xe = { class: "relative flex items-center cursor-default select-none h-[38px] pl-4 pr-4 rotate-0" };
355
+ function Je(n, _) {
356
+ return r(), b("li", Xe, [
357
+ p(n.$slots, "default")
358
+ ]);
359
+ }
360
+ const ft = /* @__PURE__ */ Ke(Ge, [["render", Je]]);
361
+ export {
362
+ ft as D,
363
+ le as _,
364
+ dt as a
365
+ };
@@ -1,5 +1,5 @@
1
1
  import { ref as s, onMounted as u, openBlock as f, createElementBlock as p, renderSlot as m } from "vue";
2
- import { c as r } from "./index-CedrSBIl.js";
2
+ import { c as r } from "./index-D9ihCfA2.js";
3
3
  const w = {
4
4
  __name: "InfiniteScroll",
5
5
  props: {
@@ -1,10 +1,10 @@
1
1
  import { openBlock as u, createElementBlock as h, createElementVNode as r, normalizeClass as f, renderSlot as k, ref as g, watch as T, createBlock as b, resolveDynamicComponent as j, withCtx as t, toDisplayString as O, createCommentVNode as A, useAttrs as E, computed as M, resolveComponent as L, createVNode as a, mergeProps as B, unref as v, mergeModels as W, useModel as z, normalizeStyle as $, Fragment as R, renderList as U, createTextVNode as m } from "vue";
2
- import { u as F, d as G, b as X } from "./index-CedrSBIl.js";
2
+ import { u as F, d as G, b as X } from "./index-D9ihCfA2.js";
3
3
  import { _ as N } from "./OpacityTransition-D4EuhJnX.js";
4
4
  import { _ as H } from "./ProclusLogo-By7XypEC.js";
5
5
  import J from "./BarsIcon-CY8KeVq7.js";
6
6
  import K from "./XMarkIcon-DKJ_--uA.js";
7
- import { a as S, _ as p, D as q } from "./DropdownMenuTextItem-CFa5UL5j.js";
7
+ import { a as S, _ as p, D as q } from "./DropdownMenuTextItem-D3P837Ef.js";
8
8
  import Q from "./UserIcon-18Fdcxc7.js";
9
9
  import Y from "./SlidersIcon-DOirWVZO.js";
10
10
  import Z from "./UserGearIcon-AsvyYngF.js";