@leaflink/stash 51.12.8 → 51.12.9

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.
@@ -1,463 +1,442 @@
1
- import { ref as O, onUnmounted as K, onMounted as Z, onUpdated as J, onDeactivated as Q, onBeforeUnmount as Y, watch as R, nextTick as W, defineComponent as tt, useTemplateRef as M, computed as C, createElementBlock as et, openBlock as ot, normalizeStyle as N, createElementVNode as V, withDirectives as it, normalizeClass as H, renderSlot as L, unref as x, createVNode as $, withCtx as k, createTextVNode as lt, toDisplayString as nt, vShow as at } from "vue";
2
- import st from "lodash-es/uniqueId";
3
- import { b as U, c as rt, d as ut, e as ct } from "./index-DA_ft08e.js";
4
- import { t as dt } from "./locale.js";
5
- import ft from "./Button.js";
6
- import vt from "./Dropdown.js";
7
- import ht from "./Icon.js";
8
- import X from "lodash-es/debounce";
9
- import { DEBOUNCE as q } from "./constants.js";
10
- import { _ as pt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
11
- function wt(e = {}) {
12
- const { duration: t = 300, initialVisible: l = !1 } = e, [o, s] = U(l), [n, i] = U(l), [a, u] = U(!1), r = O(null);
13
- function d() {
14
- r.value !== null && (clearTimeout(r.value), r.value = null);
1
+ import { ref as I, onUnmounted as se, nextTick as V, onMounted as ue, onUpdated as re, onDeactivated as ce, onBeforeUnmount as oe, watch as X, defineComponent as de, useSlots as fe, computed as W, useTemplateRef as U, createElementBlock as ve, openBlock as H, normalizeStyle as z, createBlock as Y, createElementVNode as ee, createCommentVNode as me, resolveDynamicComponent as he, normalizeClass as te, unref as C, withCtx as P, renderSlot as G, createVNode as le, createTextVNode as pe, toDisplayString as ge } from "vue";
2
+ import we from "lodash-es/uniqueId";
3
+ import { b as K, c as Ae, d as Ie, e as Te } from "./index-C14LhAwV.js";
4
+ import { DEBOUNCE as k } from "./constants.js";
5
+ import { t as be } from "./locale.js";
6
+ import Oe from "./Button.js";
7
+ import ye from "./Dropdown.js";
8
+ import Ee from "./Icon.js";
9
+ import Z from "lodash-es/debounce";
10
+ import { _ as Se } from "./_plugin-vue_export-helper-CHgC5LLL.js";
11
+ function _e(e = {}) {
12
+ const { duration: t = 300, initialVisible: a = !1 } = e, [n, l] = K(a), [o, i] = K(a), [s, d] = K(!1), c = I(null);
13
+ function g() {
14
+ c.value !== null && (clearTimeout(c.value), c.value = null);
15
15
  }
16
- function v(h) {
17
- d(), o.value !== h && s(), n.value !== h && i(), a.value && u();
16
+ function v(r) {
17
+ g(), n.value !== r && l(), o.value !== r && i(), s.value && d();
18
18
  }
19
- function p(h) {
20
- d(), h ? (o.value || s(), n.value || i(), a.value && u()) : (n.value && i(), a.value || u(), r.value = setTimeout(() => {
21
- o.value && s(), a.value && u(), r.value = null;
19
+ function w(r) {
20
+ g(), r ? (n.value || l(), o.value || i(), s.value && d()) : (o.value && i(), s.value || d(), c.value = setTimeout(() => {
21
+ n.value && l(), s.value && d(), c.value = null;
22
22
  }, t));
23
23
  }
24
- function g() {
25
- p(!0);
24
+ function A() {
25
+ w(!0);
26
26
  }
27
- function f() {
28
- p(!1);
27
+ function h() {
28
+ w(!1);
29
29
  }
30
- function A() {
31
- d();
30
+ function u() {
31
+ g();
32
32
  }
33
- return K(() => {
34
- A();
33
+ return se(() => {
34
+ u();
35
35
  }), {
36
- isVisible: o,
37
- shouldShow: n,
38
- shouldHide: a,
39
- toggle: p,
40
- show: g,
41
- hide: f,
36
+ isVisible: n,
37
+ shouldShow: o,
38
+ shouldHide: s,
39
+ toggle: w,
40
+ show: A,
41
+ hide: h,
42
42
  setVisible: v,
43
- cleanup: A
43
+ cleanup: u
44
44
  };
45
45
  }
46
- const mt = {
46
+ const De = {
47
47
  TRACKER: -1,
48
48
  DROPDOWN: 1e3
49
- }, z = {
49
+ }, Q = {
50
50
  AUTO_ACTION: "auto-action-",
51
51
  INDEX_BASED: "index-",
52
52
  MORE_MENU: "more-actions-menu-"
53
- }, m = {
54
- ACTION_ID: "data-action-id"
55
- }, gt = 300;
53
+ }, p = {
54
+ ACTION_ID: "data-action-id",
55
+ PROCESSED: "data-more-actions-processed"
56
+ }, ae = 300, L = /* @__PURE__ */ new WeakMap();
56
57
  function j(e) {
57
58
  if (!e)
58
59
  return;
59
- const t = Array.from(e.children), l = /* @__PURE__ */ new Set();
60
- t.forEach((s) => {
61
- const n = s.getAttribute(m.ACTION_ID);
62
- n && l.add(n);
60
+ const t = Array.from(e.children), a = /* @__PURE__ */ new Set();
61
+ t.forEach((l) => {
62
+ const o = l.getAttribute(p.ACTION_ID);
63
+ o && a.add(o);
63
64
  });
64
- let o = 0;
65
- for (; l.has(`auto-action-${o}`); )
66
- o++;
67
- t.forEach((s) => {
68
- s.hasAttribute(m.ACTION_ID) || (s.setAttribute(m.ACTION_ID, `${z.AUTO_ACTION}${o}`), o++);
65
+ let n = 0;
66
+ for (; a.has(`auto-action-${n}`); )
67
+ n++;
68
+ t.forEach((l) => {
69
+ l.hasAttribute(p.ACTION_ID) || (l.setAttribute(p.ACTION_ID, `${Q.AUTO_ACTION}${n}`), n++);
69
70
  });
70
71
  }
71
- function G(e) {
72
+ function ie(e) {
72
73
  const t = /* @__PURE__ */ new Map();
73
- return e.forEach((l, o) => {
74
- const s = l.getAttribute(m.ACTION_ID);
75
- s ? t.set(l, s) : t.set(l, `${z.INDEX_BASED}${o}`);
74
+ return e.forEach((a, n) => {
75
+ const l = a.getAttribute(p.ACTION_ID);
76
+ l ? t.set(a, l) : t.set(a, `${Q.INDEX_BASED}${n}`);
76
77
  }), t;
77
78
  }
78
- function At(e, t) {
79
- const l = [];
80
- e.forEach((o) => {
81
- t.has(o) || l.push(o);
82
- }), l.forEach((o) => {
83
- e.delete(o);
79
+ function Be(e, t) {
80
+ const a = [];
81
+ e.forEach((n) => {
82
+ t.has(n) || a.push(n);
83
+ }), a.forEach((n) => {
84
+ e.delete(n);
84
85
  });
85
86
  }
86
- function P(e, t, l) {
87
- l.has(t) ? e.classList.add("tw-invisible") : e.classList.remove("tw-invisible");
87
+ function ne(e, t, a) {
88
+ const n = L.get(e);
89
+ if (n && (clearTimeout(n), L.delete(e)), a.has(t))
90
+ e.removeAttribute(p.PROCESSED), e.classList.add("tw-invisible");
91
+ else {
92
+ const l = setTimeout(() => {
93
+ e.isConnected && e.setAttribute(p.PROCESSED, "true"), L.delete(e);
94
+ }, k.FAST);
95
+ L.set(e, l), e.classList.remove("tw-invisible");
96
+ }
88
97
  }
89
- function F(e, t, l, o) {
98
+ function J(e, t) {
90
99
  if (!e)
91
100
  return;
92
- const s = Array.from(e.children);
93
- if (t) {
94
- const n = Array.from(t.children);
95
- s.forEach((i, a) => {
96
- if (a < n.length) {
97
- const r = n[a].getAttribute(m.ACTION_ID);
98
- r && i.setAttribute(m.ACTION_ID, r);
99
- }
100
- });
101
- }
102
- s.forEach((n) => {
103
- const i = n.getAttribute(m.ACTION_ID);
104
- o && (typeof o == "string" ? o.split(" ").filter(Boolean).forEach((r) => {
105
- r && n.classList.add(r);
106
- }) : typeof o == "object" && Object.entries(o).forEach(([u, r]) => {
107
- r ? n.classList.add(u) : n.classList.remove(u);
108
- })), i && l.has(i) ? n.classList.remove("tw-hidden") : n.classList.add("tw-hidden");
101
+ Array.from(
102
+ e.querySelectorAll(`[${p.ACTION_ID}]`)
103
+ ).filter((l) => l.querySelectorAll(`[${p.ACTION_ID}]`).length === 0).forEach((l) => {
104
+ const o = l.getAttribute(p.ACTION_ID);
105
+ o && t.has(o) ? l.classList.remove("tw-hidden") : l.classList.add("tw-hidden");
109
106
  });
110
107
  }
111
- function bt({
108
+ function Ce({
112
109
  actionsContainerRef: e,
113
110
  overflowIds: t,
114
- moreDropdownMenuRef: l,
115
- trackerElementRef: o,
116
- itemInDropdownClass: s,
117
- onOverflowChange: n
111
+ moreDropdownMenuRef: a,
112
+ trackerElementRef: n,
113
+ onOverflowChange: l
118
114
  }) {
119
- const i = O(!1), a = O(""), u = rt(o);
120
- function r(f, A, h) {
121
- t.value.clear(), f.forEach((w) => t.value.add(w)), A.forEach((w) => {
122
- const I = h.get(w) || w.getAttribute(m.ACTION_ID) || void 0;
123
- I && P(w, I, t.value);
115
+ const o = I(!1), i = I(""), s = Ae(n);
116
+ function d(h, u, r) {
117
+ t.value.clear(), h.forEach((f) => t.value.add(f)), u.forEach((f) => {
118
+ const m = r.get(f) || f.getAttribute(p.ACTION_ID) || void 0;
119
+ m && ne(f, m, t.value);
124
120
  });
125
121
  }
126
- function d() {
127
- if (!e.value || !o.value) {
128
- i.value = !1;
122
+ function c() {
123
+ if (!e.value || !n.value) {
124
+ o.value = !1;
129
125
  return;
130
126
  }
131
- const f = Array.from(e.value.children), A = G(f), h = /* @__PURE__ */ new Set(), w = window.getComputedStyle(e.value), I = w.columnGap || w.gap, y = I ? parseFloat(I) : 0;
132
- f.forEach((b, E) => {
133
- const c = A.get(b) || b.getAttribute(m.ACTION_ID) || void 0, S = b.getBoundingClientRect();
134
- (E < f.length - 1 ? S.right + y : S.right) > u.left.value && c && h.add(c);
127
+ const h = Array.from(e.value.children), u = ie(h), r = /* @__PURE__ */ new Set(), f = window.getComputedStyle(e.value), m = f.columnGap || f.gap, b = m ? parseFloat(m) : 0;
128
+ h.forEach((_, y) => {
129
+ const O = u.get(_) || _.getAttribute(p.ACTION_ID) || void 0, E = _.getBoundingClientRect();
130
+ (y < h.length - 1 ? E.right + b : E.right) > s.left.value && O && r.add(O);
135
131
  });
136
- const _ = Array.from(t.value).sort().join(","), D = Array.from(h).sort().join(",");
137
- _ !== D && (r(h, f, A), F(
138
- l.value,
139
- e.value,
140
- t.value,
141
- s
142
- ), n && a.value !== D && (a.value = D, n())), i.value = !1;
132
+ const S = Array.from(t.value).sort().join(","), B = Array.from(r).sort().join(",");
133
+ S !== B && (d(r, h, u), J(a.value, t.value), l && i.value !== B && (i.value = B, V(() => {
134
+ l();
135
+ }))), o.value = !1;
143
136
  }
144
- const v = X(d, q.FAST);
145
- function p() {
146
- i.value || !e.value || !o.value || (i.value = !0, v());
137
+ const g = Z(c, k.FAST);
138
+ function v() {
139
+ o.value || !e.value || !n.value || (o.value = !0, g());
147
140
  }
148
- function g() {
149
- v.cancel(), i.value = !1;
141
+ function w() {
142
+ s.update();
143
+ }
144
+ function A() {
145
+ g.cancel(), o.value = !1;
150
146
  }
151
147
  return {
152
- calculateOverflow: p,
153
- applyElementVisibility: P,
154
- updateOverflowState: r,
155
- cleanup: g,
156
- isProcessing: i
148
+ calculateOverflow: v,
149
+ applyElementVisibility: ne,
150
+ updateOverflowState: d,
151
+ updateTrackerBounding: w,
152
+ cleanup: A,
153
+ isProcessing: o
157
154
  };
158
155
  }
159
- function It({
156
+ function Me({
160
157
  actionsContainerRef: e,
161
158
  overflowIds: t,
162
- moreDropdownMenuRef: l,
163
- trackerElementRef: o,
164
- moreDropdownWidth: s,
165
- itemInDropdownClass: n,
166
- calculateMoreButtonWidth: i,
167
- autoDetectActions: a = !0,
168
- onOverflowChange: u
159
+ moreDropdownMenuRef: a,
160
+ trackerElementRef: n,
161
+ moreDropdownWidth: l,
162
+ calculateMoreButtonWidth: o,
163
+ hasMoreActionsSlot: i,
164
+ onOverflowChange: s
169
165
  }) {
170
- const r = O(!1), {
171
- calculateOverflow: d,
172
- applyElementVisibility: v,
173
- updateOverflowState: p,
174
- cleanup: g,
175
- isProcessing: f
176
- } = bt({
166
+ const d = I(!1), {
167
+ calculateOverflow: c,
168
+ applyElementVisibility: g,
169
+ updateOverflowState: v,
170
+ updateTrackerBounding: w,
171
+ cleanup: A,
172
+ isProcessing: h
173
+ } = Ce({
177
174
  actionsContainerRef: e,
178
175
  overflowIds: t,
179
- moreDropdownMenuRef: l,
180
- trackerElementRef: o,
181
- itemInDropdownClass: n,
182
- onOverflowChange: u
176
+ moreDropdownMenuRef: a,
177
+ trackerElementRef: n,
178
+ onOverflowChange: s
183
179
  });
184
- function A() {
185
- t.value.clear(), s.value = 0;
180
+ let u = null, r = null, f = null;
181
+ function m() {
182
+ t.value.clear(), l.value = 0;
186
183
  }
187
- function h() {
188
- if (!e.value)
184
+ function b() {
185
+ r && (r(), r = null), f && (f(), f = null);
186
+ }
187
+ const S = Z(
188
+ () => {
189
+ !e.value || !i.value || (j(e.value), b(), A(), y());
190
+ },
191
+ k.FAST,
192
+ { leading: !1, trailing: !0 }
193
+ );
194
+ function B() {
195
+ if (!e.value || !i.value)
189
196
  return;
190
- const y = Array.from(e.value.children), _ = G(y), D = new Set(_.values());
191
- At(t.value, D), ut(e, d), ct(
192
- y,
193
- (b) => {
194
- if (f.value)
197
+ const O = Array.from(e.value.children), E = ie(O), $ = new Set(E.values());
198
+ Be(t.value, $);
199
+ const { stop: q } = Ie(e, () => {
200
+ w(), c();
201
+ });
202
+ r = q;
203
+ const { stop: T } = Te(
204
+ O,
205
+ (M) => {
206
+ if (h.value)
195
207
  return;
196
- let E = !1;
197
- const c = new Set(t.value);
198
- if (b.forEach((S) => {
199
- const T = S.target, B = _.get(T) || T.getAttribute(m.ACTION_ID) || void 0;
200
- S.intersectionRatio === 1 ? B && c.has(B) && (c.delete(B), E = !0) : B && !c.has(B) && (c.add(B), E = !0);
201
- }), E) {
202
- const S = Array.from(t.value).sort().join(","), T = Array.from(c).sort().join(",");
203
- S !== T && (p(c, y, _), F(
204
- l.value,
205
- e.value,
206
- t.value,
207
- n
208
- ), u && u());
208
+ let D = !1;
209
+ const N = new Set(t.value);
210
+ if (M.forEach((R) => {
211
+ const F = R.target, x = E.get(F) || F.getAttribute(p.ACTION_ID) || void 0;
212
+ R.intersectionRatio === 1 ? x && N.has(x) && (N.delete(x), D = !0) : x && !N.has(x) && (N.add(x), D = !0);
213
+ }), D) {
214
+ const R = Array.from(t.value).sort().join(","), F = Array.from(N).sort().join(",");
215
+ R !== F && (v(N, O, E), J(a.value, t.value), s && V(() => {
216
+ s();
217
+ }));
209
218
  }
210
219
  },
211
220
  {
212
221
  root: e.value
213
222
  }
214
- ), y.forEach((b) => {
215
- const E = _.get(b) || b.getAttribute(m.ACTION_ID) || "";
216
- v(b, E, t.value);
217
- }), d(), F(
218
- l.value,
219
- e.value,
220
- t.value,
221
- n
222
223
  );
224
+ f = T, O.forEach((M) => {
225
+ const D = E.get(M) || M.getAttribute(p.ACTION_ID) || "";
226
+ g(M, D, t.value);
227
+ }), c(), J(a.value, t.value);
223
228
  }
224
- function w() {
225
- e.value && (a && j(e.value), h(), s.value === 0 && (s.value = i()));
229
+ function _() {
230
+ e.value && i.value && (j(e.value), B(), l.value === 0 && (l.value = o()), !u && e.value && (u = new MutationObserver(S), u.observe(e.value, {
231
+ childList: !0,
232
+ // Watch for added/removed children
233
+ subtree: !1
234
+ // Only watch direct children
235
+ })));
226
236
  }
227
- const I = X(
237
+ const y = Z(
228
238
  () => {
229
- r.value || (r.value = !0, w(), r.value = !1);
239
+ d.value || (d.value = !0, _(), d.value = !1);
230
240
  },
231
- q.FAST,
241
+ k.FAST,
232
242
  { leading: !0 }
233
243
  );
234
- Z(() => {
235
- a && j(e.value), w();
236
- }), J(() => {
237
- a && j(e.value), e.value && Array.from(e.value.children).length === 0 && A(), g(), I();
238
- }), Q(() => {
239
- g();
240
- }), Y(() => {
241
- g();
244
+ ue(() => {
245
+ i.value && (j(e.value), _());
246
+ }), re(() => {
247
+ i.value && (j(e.value), e.value && Array.from(e.value.children).length === 0 && m(), b(), A(), y());
248
+ }), ce(() => {
249
+ b(), A(), S.cancel(), y.cancel(), u && (u.disconnect(), u = null);
250
+ }), oe(() => {
251
+ b(), A(), S.cancel(), y.cancel(), u && (u.disconnect(), u = null);
242
252
  });
243
253
  }
244
- function yt({
245
- moreDropdownMenuRef: e,
246
- overflowIds: t,
247
- autoStyleDropdownItems: l,
248
- activeItemId: o
249
- }) {
250
- function s() {
251
- if (!l || !e.value)
252
- return;
253
- Array.from(e.value.children).forEach((i) => {
254
- var d;
255
- if (!(i instanceof HTMLElement))
256
- return;
257
- const a = i.getAttribute(m.ACTION_ID);
258
- if (a && !t.value.has(a)) {
259
- i.classList.add("tw-hidden");
260
- return;
261
- } else
262
- i.classList.remove("tw-hidden");
263
- (d = i.querySelector(".stash-tabs__dropdown-selected-tab-icon")) == null || d.remove();
264
- const u = i.firstElementChild;
265
- u && (u.className = ""), i.className = "", i.classList.add(
266
- "tw-flex",
267
- "tw-items-center",
268
- "tw-justify-between",
269
- "tw-rounded",
270
- "tw-text-sm",
271
- "tw-p-1.5",
272
- "tw-text-left",
273
- "tw-cursor-pointer",
274
- "tw-text-ice-700",
275
- "hover:!tw-bg-ice-200",
276
- "aria-disabled:tw-text-ice-500",
277
- "aria-disabled:tw-pointer-events-none",
278
- "aria-disabled:hover:tw-text-ice-500",
279
- "aria-disabled:hover:tw-bg-inherit",
280
- "aria-disabled:hover:tw-cursor-default",
281
- "aria-selected:tw-bg-blue-100",
282
- "tw-list-none"
283
- );
284
- const r = i.getAttribute("id");
285
- if (r && (o != null && o.value) && r === o.value) {
286
- const v = document.createElement("span");
287
- v.className = "stash-tabs__dropdown-selected-tab-icon", v.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" class="tw-text-blue-500 tw-w-6 tw-h-6" viewBox="0 0 24 24" fill="none"><path fill="currentColor" fill-rule="evenodd" d="M20.707 6.854 9 18.561l-5.707-5.707 1.414-1.414L9 15.733 19.293 5.44l1.414 1.414Z" clip-rule="evenodd"/></svg>', i.appendChild(v);
288
- }
289
- });
290
- }
291
- return {
292
- applyDropdownItemStyling: s
293
- };
294
- }
295
- function Et({
254
+ function Ne({
296
255
  moreDropdownRef: e,
297
256
  actionsContainerRef: t,
298
- moreButtonAlign: l,
299
- hasOverflowActions: o
257
+ moreButtonAlign: a,
258
+ hasOverflowActions: n
300
259
  }) {
301
- const s = () => {
302
- var a;
303
- if (!((a = e.value) != null && a.$el))
260
+ const l = () => {
261
+ var s;
262
+ if (!((s = e.value) != null && s.$el))
304
263
  return 0;
305
264
  const i = e.value.$el.getBoundingClientRect().width;
306
- if (l === "separate" && t.value) {
307
- const u = window.getComputedStyle(t.value), r = parseFloat(u.gap) || 0;
308
- return i + r;
265
+ if (a === "separate" && t.value) {
266
+ const d = window.getComputedStyle(t.value), c = parseFloat(d.gap) || 0;
267
+ return i + c;
309
268
  }
310
269
  return i;
311
- }, n = O(0);
312
- return R(o, (i) => {
313
- i && e.value && W(() => {
314
- const a = s();
315
- a > 0 && (n.value = a);
270
+ }, o = I(0);
271
+ return X(n, (i) => {
272
+ i && e.value && V(() => {
273
+ const s = l();
274
+ s > 0 && (o.value = s);
316
275
  });
317
276
  }), {
318
- calculateMoreButtonWidth: s,
319
- moreButtonWidth: n
277
+ calculateMoreButtonWidth: l,
278
+ moreButtonWidth: o
320
279
  };
321
280
  }
322
- function Ot({ actionsContainerRef: e, overflowIds: t }) {
323
- const l = O(0), o = O(!1), s = () => {
281
+ function xe({ actionsContainerRef: e, overflowIds: t }) {
282
+ const a = I(0), n = I(!1), l = I(!1);
283
+ let o = null;
284
+ const i = () => {
324
285
  if (!e.value) {
325
- l.value = 0;
286
+ a.value = 0;
326
287
  return;
327
288
  }
328
- let n = 0;
329
- const i = Array.from(e.value.children);
330
- i.forEach((a, u) => {
331
- const r = a.classList.contains("tw-invisible"), d = a.getAttribute(m.ACTION_ID);
332
- if (!r && d && !t.value.has(d)) {
333
- const v = a.getBoundingClientRect();
334
- if (n += v.width, u < i.length - 1 && e.value) {
335
- const p = window.getComputedStyle(e.value), g = p.columnGap || p.gap, f = g ? parseFloat(g) : 0;
336
- n += f;
289
+ let c = 0;
290
+ const g = Array.from(e.value.children);
291
+ g.forEach((v, w) => {
292
+ const A = v.getAttribute(p.ACTION_ID), h = !A || !t.value.has(A), u = v.classList.contains("tw-invisible");
293
+ if (h && !u) {
294
+ const r = v.getBoundingClientRect();
295
+ if (c += r.width, w < g.length - 1 && e.value) {
296
+ const f = window.getComputedStyle(e.value), m = f.columnGap || f.gap, b = m ? parseFloat(m) : 0;
297
+ c += b;
337
298
  }
338
299
  }
339
- }), l.value = n;
300
+ }), a.value = c;
301
+ }, s = () => {
302
+ l.value = !0, o && clearTimeout(o), o = setTimeout(() => {
303
+ n.value || (n.value = !0, V(() => {
304
+ V(() => {
305
+ i(), n.value = !1, l.value = !1;
306
+ });
307
+ }));
308
+ }, ae + 100);
340
309
  };
341
- return R(t, () => {
342
- o.value || (o.value = !0, W(() => {
343
- s(), o.value = !1;
344
- }));
310
+ return X(t, () => {
311
+ s();
345
312
  }), {
346
- visibleElementsWidth: l,
347
- isRecalculatingWidth: o,
348
- calculateVisibleElementsWidth: s
313
+ visibleElementsWidth: a,
314
+ isRecalculatingWidth: n,
315
+ isRecalculatingWithDelay: l,
316
+ calculateVisibleElementsWidth: i,
317
+ calculateVisibleElementsWidthDelayed: s,
318
+ cleanup: () => {
319
+ o && (clearTimeout(o), o = null), l.value = !1;
320
+ }
349
321
  };
350
322
  }
351
- const _t = ["id"], St = /* @__PURE__ */ tt({
323
+ const We = ["id"], Ve = /* @__PURE__ */ de({
352
324
  __name: "MoreActions",
353
325
  props: {
354
- dropdownContentClass: { default: void 0 },
355
326
  actionsContainerClass: { default: void 0 },
356
- moreButtonText: { default: () => dt("ll.more") },
327
+ actionsContainerTag: { default: "div" },
328
+ moreButtonText: { default: () => be("ll.more") },
357
329
  width: { default: void 0 },
358
330
  dropdownMode: { default: "default" },
359
- disableAutoDetectActions: { type: Boolean, default: !1 },
360
- autoStyleDropdownItems: { type: Boolean },
361
- activeItemId: { default: void 0 },
362
- moreButtonAlign: { default: "separate" },
363
- itemInDropdownClass: { default: void 0 }
331
+ moreButtonAlign: { default: "separate" }
364
332
  },
365
333
  setup(e) {
366
- const t = e, l = M("actionsContainerRef"), o = M("moreDropdownRef"), s = M("moreDropdownMenuRef"), n = M("trackerElementRef"), i = O(/* @__PURE__ */ new Set()), a = O(!1), u = st(z.MORE_MENU), {
367
- isVisible: r,
368
- shouldShow: d,
369
- toggle: v
370
- } = wt({
371
- duration: gt,
334
+ const t = e, a = fe(), n = W(() => !!a["more-actions"]), l = U("actionsContainerRef"), o = U("moreDropdownRef"), i = U("moreDropdownMenuRef"), s = U("trackerElementRef"), d = I(/* @__PURE__ */ new Set()), c = I(!1), g = we(Q.MORE_MENU), v = I(null), w = I(!1), {
335
+ isVisible: A,
336
+ shouldShow: h,
337
+ toggle: u
338
+ } = _e({
339
+ duration: ae,
372
340
  initialVisible: !1
373
- }), p = C(() => i.value.size > 0), { calculateMoreButtonWidth: g, moreButtonWidth: f } = Et({
341
+ }), r = W(() => d.value.size > 0), { calculateMoreButtonWidth: f, moreButtonWidth: m } = Ne({
374
342
  moreDropdownRef: o,
375
343
  actionsContainerRef: l,
376
344
  moreButtonAlign: t.moreButtonAlign,
377
- hasOverflowActions: p
378
- }), { visibleElementsWidth: A, isRecalculatingWidth: h, calculateVisibleElementsWidth: w } = Ot({
345
+ hasOverflowActions: r
346
+ }), {
347
+ visibleElementsWidth: b,
348
+ isRecalculatingWithDelay: S,
349
+ calculateVisibleElementsWidthDelayed: B,
350
+ cleanup: _
351
+ } = xe({
379
352
  actionsContainerRef: l,
380
- overflowIds: i
381
- }), I = C(() => p.value), y = C(() => a.value.toString()), _ = C(() => I.value ? `calc(100% - ${f.value}px)` : "100%"), D = C(() => t.moreButtonAlign === "together" ? { left: `${A.value}px`, right: "auto" } : { right: "0", left: "auto" });
382
- It({
353
+ overflowIds: d
354
+ }), y = W(() => n.value && r.value && !S.value && w.value), O = W(() => c.value.toString()), E = W(() => y.value ? `calc(100% - ${m.value}px)` : "100%"), $ = W(() => t.moreButtonAlign === "together" ? { left: `${b.value}px`, right: "auto" } : { right: "0", left: "auto" });
355
+ Me({
383
356
  actionsContainerRef: l,
384
- overflowIds: i,
385
- moreDropdownMenuRef: s,
386
- trackerElementRef: n,
387
- moreDropdownWidth: f,
388
- itemInDropdownClass: t.itemInDropdownClass,
389
- calculateMoreButtonWidth: g,
390
- autoDetectActions: !t.disableAutoDetectActions,
391
- onOverflowChange: () => {
392
- h.value || W(() => {
393
- w();
394
- });
357
+ overflowIds: d,
358
+ moreDropdownMenuRef: i,
359
+ trackerElementRef: s,
360
+ moreDropdownWidth: m,
361
+ calculateMoreButtonWidth: f,
362
+ hasMoreActionsSlot: n,
363
+ onOverflowChange: B
364
+ }), X(
365
+ () => n.value && r.value && !S.value,
366
+ (T) => {
367
+ v.value && (clearTimeout(v.value), v.value = null), T ? v.value = setTimeout(() => {
368
+ w.value = !0;
369
+ }, k.FAST) : w.value = !1;
395
370
  }
371
+ ), X(y, (T) => {
372
+ u(T);
396
373
  });
397
- const { applyDropdownItemStyling: b } = yt({
398
- moreDropdownMenuRef: s,
399
- overflowIds: i,
400
- autoStyleDropdownItems: t.autoStyleDropdownItems,
401
- activeItemId: C(() => t.activeItemId)
402
- });
403
- R(I, (c) => {
404
- v(c);
405
- });
406
- function E(c) {
407
- a.value = c, c && t.autoStyleDropdownItems && W(() => b());
374
+ function q(T) {
375
+ c.value = T;
408
376
  }
409
- return (c, S) => (ot(), et("div", {
410
- class: "stash-more-actions tw-relative",
377
+ return oe(() => {
378
+ _(), v.value && clearTimeout(v.value);
379
+ }), (T, M) => (H(), ve("div", {
380
+ class: "stash-more-actions tw-relative tw-overflow-x-hidden",
411
381
  "data-test": "stash-more-actions",
412
- style: N({ width: t.width })
382
+ style: z({ width: t.width })
413
383
  }, [
414
- V("div", {
384
+ (H(), Y(he(t.actionsContainerTag), {
415
385
  ref_key: "actionsContainerRef",
416
386
  ref: l,
417
- style: N({
418
- width: _.value
387
+ "data-test": "stash-more-actions__container",
388
+ style: z({
389
+ width: E.value,
390
+ minWidth: C(m) ? `${C(m)}px` : void 0
419
391
  }),
420
- class: H(["stash-more-actions__container tw-flex tw-items-center tw-gap-2", t.actionsContainerClass])
421
- }, [
422
- L(c.$slots, "actions")
423
- ], 6),
424
- V("div", {
392
+ class: te(["stash-more-actions__container tw-flex tw-items-center tw-gap-2", t.actionsContainerClass])
393
+ }, {
394
+ default: P(() => [
395
+ G(T.$slots, "default")
396
+ ]),
397
+ _: 3
398
+ }, 8, ["style", "class"])),
399
+ ee("div", {
425
400
  ref_key: "trackerElementRef",
426
- ref: n,
401
+ ref: s,
427
402
  class: "stash-more-actions__tracker",
428
- style: N({
403
+ style: z({
429
404
  position: "absolute",
430
405
  right: "0px",
431
406
  top: "0",
432
407
  visibility: "hidden",
433
- width: x(f) + "px",
408
+ width: C(m) + "px",
434
409
  height: "100%",
435
410
  pointerEvents: "none",
436
- zIndex: x(mt).TRACKER
411
+ zIndex: C(De).TRACKER
437
412
  })
438
413
  }, null, 4),
439
- it($(vt, {
414
+ n.value ? (H(), Y(ye, {
415
+ key: 0,
440
416
  ref_key: "moreDropdownRef",
441
417
  ref: o,
442
- "content-class": t.dropdownContentClass,
443
- class: H(["!tw-absolute tw-top-0", x(d) ? "tw-animate-fade-in" : "tw-animate-fade-out"]),
444
- style: N(D.value),
445
- onToggle: E
418
+ class: te([
419
+ "!tw-absolute tw-top-0",
420
+ C(h) ? "tw-animate-fade-in" : "tw-animate-fade-out",
421
+ { "tw-invisible": !C(A) }
422
+ ]),
423
+ style: z($.value),
424
+ onToggle: q
446
425
  }, {
447
- toggle: k(({ toggle: T }) => [
448
- L(c.$slots, "toggle", {
449
- toggle: T,
450
- isOpen: a.value
426
+ toggle: P(({ toggle: D }) => [
427
+ G(T.$slots, "toggle", {
428
+ toggle: D,
429
+ isOpen: c.value
451
430
  }, () => [
452
- $(ft, {
431
+ le(Oe, {
453
432
  class: "button tw-border-gray-500 tw-text-gray-500 tw-flex tw-w-full tw-items-center tw-justify-between tw-border",
454
433
  secondary: "",
455
- "aria-expanded": y.value,
456
- onClick: T
434
+ "aria-expanded": O.value,
435
+ onClick: D
457
436
  }, {
458
- default: k(() => [
459
- lt(nt(t.moreButtonText) + " ", 1),
460
- $(ht, {
437
+ default: P(() => [
438
+ pe(ge(t.moreButtonText) + " ", 1),
439
+ le(Ee, {
461
440
  class: "tw-ml-1.5",
462
441
  name: "action-dots"
463
442
  })
@@ -466,26 +445,25 @@ const _t = ["id"], St = /* @__PURE__ */ tt({
466
445
  }, 1032, ["aria-expanded", "onClick"])
467
446
  ])
468
447
  ]),
469
- default: k(() => [
470
- V("div", {
471
- id: x(u),
448
+ default: P(() => [
449
+ ee("div", {
450
+ id: C(g),
472
451
  ref_key: "moreDropdownMenuRef",
473
- ref: s,
452
+ ref: i,
453
+ "data-test": "stash-more-actions__dropdown",
474
454
  class: "tw-flex tw-flex-col tw-gap-1.5 tw-p-1.5"
475
455
  }, [
476
- L(c.$slots, "actions")
477
- ], 8, _t)
456
+ G(T.$slots, "more-actions")
457
+ ], 8, We)
478
458
  ]),
479
459
  _: 3
480
- }, 8, ["content-class", "class", "style"]), [
481
- [at, x(r)]
482
- ])
460
+ }, 8, ["class", "style"])) : me("", !0)
483
461
  ], 4));
484
462
  }
485
- }), Tt = {}, Dt = {
486
- $style: Tt
487
- }, Ut = /* @__PURE__ */ pt(St, [["__cssModules", Dt]]);
463
+ }), ke = {}, $e = {
464
+ $style: ke
465
+ }, Ge = /* @__PURE__ */ Se(Ve, [["__cssModules", $e]]);
488
466
  export {
489
- Ut as default
467
+ Ge as default
490
468
  };
491
469
  //# sourceMappingURL=MoreActions.js.map