@ynput/ayon-frontend-shared 0.6.5 → 0.6.6

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,8 +1,8 @@
1
1
  import rt from "styled-components";
2
2
  import { E as Mt } from "./EmptyPlaceholder.es.js";
3
3
  import { jsx as L, jsxs as Q, Fragment as yt } from "react/jsx-runtime";
4
- import X, { useRef as Z, useEffect as U, useLayoutEffect as st, useState as lt, useCallback as bt } from "react";
5
- import { M as xt, a as Et, b as Pt, c as K, D as $, d as Lt, e as Rt, S as Ct, F as St } from "./MenuItem.es.js";
4
+ import X, { useRef as Z, useEffect as U, useLayoutEffect as st, useState as lt, useCallback as xt } from "react";
5
+ import { M as Et, a as bt, b as Pt, c as K, D as $, d as Lt, e as Rt, S as Ct, F as St } from "./MenuItem.es.js";
6
6
  import { Icon as Tt, Button as Ot } from "@ynput/ayon-react-components";
7
7
  import "@module-federation/enhanced/runtime";
8
8
  import "./searchTerms.es.js";
@@ -18,7 +18,7 @@ import kt from "clsx";
18
18
  import { createPortal as Dt } from "react-dom";
19
19
  import "react-redux";
20
20
  import { c as Ht } from "./copyToClipboard.es.js";
21
- const ie = rt(Mt)`
21
+ const re = rt(Mt)`
22
22
  display: flex;
23
23
  flex-direction: column;
24
24
  justify-content: center;
@@ -36,7 +36,7 @@ const ie = rt(Mt)`
36
36
  h3 {
37
37
  font-size: 18px;
38
38
  }
39
- `, re = rt.div`
39
+ `, se = rt.div`
40
40
  display: flex;
41
41
  flex-direction: column;
42
42
  flex-grow: 1;
@@ -52,238 +52,240 @@ const ie = rt(Mt)`
52
52
  text-transform: capitalize;
53
53
  }
54
54
  `, ot = ({
55
- items: a,
56
- handleClick: i,
57
- onSubMenu: c,
58
- onSubMenuLayout: o,
55
+ items: c,
56
+ handleClick: o,
57
+ onSubMenu: r,
58
+ onSubMenuLayout: i,
59
59
  subMenu: f,
60
60
  level: d,
61
- id: l = "root-menu",
61
+ id: a = "root-menu",
62
62
  parentRef: e,
63
63
  parentEl: p,
64
- style: r,
64
+ style: s,
65
65
  placement: h,
66
66
  onClose: m,
67
67
  onMenuClose: R,
68
68
  itemClassName: t,
69
- itemStyle: s,
69
+ itemStyle: l,
70
70
  setPowerpackDialog: u,
71
71
  ...x
72
72
  }) => {
73
- const v = Z({}), _ = Z(null), j = (g, k, D) => {
74
- const C = v.current[k], H = _.current;
75
- if (!C || !H) return;
76
- const F = (H.offsetParent ?? document.body).getBoundingClientRect(), S = C.getBoundingClientRect(), y = (H.querySelector("menu") ?? H).getBoundingClientRect(), V = window.innerWidth, I = window.innerHeight, w = 8, P = Math.max(240, y.width), T = Math.min(
77
- D.length * 36 + 16,
73
+ const v = Z({}), _ = Z(null), j = (g, D, H) => {
74
+ const C = v.current[D], A = _.current;
75
+ if (!C || !A) return;
76
+ const F = (A.offsetParent ?? document.body).getBoundingClientRect(), S = C.getBoundingClientRect(), M = (A.querySelector("menu") ?? A).getBoundingClientRect(), q = window.innerWidth, I = window.innerHeight, w = 8, P = Math.max(240, M.width), T = Math.min(
77
+ H.length * 36 + 16,
78
78
  I - K - w
79
- ), b = 4, O = () => Math.max(w, y.left - P - b), B = () => y.right + b, W = B() + P <= V - w, A = O() >= w;
80
- let n, M;
81
- h === "left" && A ? (n = "left", M = O()) : W ? (n = "right", M = B()) : A ? (n = "left", M = O()) : (n = "left", M = Math.max(w, V - P - w));
82
- let q = S.top - 8;
83
- q + T > I - w && (q = I - T - w), q = Math.max(K, q);
84
- const J = n === "left" ? M - 16 : M;
85
- c?.(g, {
86
- id: k,
79
+ ), y = 4, B = () => Math.max(w, M.left - P - y), O = () => M.right + y, V = O() + P <= q - w, W = B() >= w;
80
+ let b, n;
81
+ h === "left" && W ? (b = "left", n = B()) : V ? (b = "right", n = O()) : W ? (b = "left", n = B()) : (b = "left", n = Math.max(w, q - P - w));
82
+ let N = S.top - 8;
83
+ N + T > I - w && (N = I - T - w), N = Math.max(K, N);
84
+ const J = b === "left" ? n - 16 : n;
85
+ r?.(g, {
86
+ id: D,
87
87
  style: {
88
- top: q - F.top,
88
+ top: N - F.top,
89
89
  left: J - F.left,
90
- maxHeight: I - q - w
90
+ maxHeight: I - N - w
91
91
  },
92
- items: D,
92
+ items: H,
93
93
  level: d,
94
- placement: n,
94
+ placement: b,
95
95
  // Pass the actual menu-item element so sub-menu measurement uses the <li>
96
96
  // instead of whatever inner span the mouse event bubbled from.
97
97
  parentEl: C
98
98
  });
99
99
  }, dt = (g) => {
100
- f && c?.(g, { id: "parent", items: [] });
100
+ f && r?.(g, { id: "parent", items: [] });
101
101
  };
102
102
  return U(() => {
103
103
  f && _.current && _.current.querySelectorAll("li, button")[0]?.focus();
104
104
  }, [f]), st(() => {
105
- if (!f || !_.current || !e || !o || !l) return;
106
- const g = _.current, k = e, D = k.closest(".menu-list, .sub-menu");
107
- if (!D) return;
108
- const C = g.querySelector("menu") ?? g, H = D.querySelector("menu") ?? D, F = (g.offsetParent ?? document.body).getBoundingClientRect(), S = g.getBoundingClientRect(), E = C.getBoundingClientRect(), y = H.getBoundingClientRect(), V = k.getBoundingClientRect(), I = E.left - S.left, w = E.width, P = window.innerWidth, T = window.innerHeight, b = 8, O = 4, B = () => Math.max(b, y.left - w - O), W = () => y.right + O, A = W() + w <= P - b, n = B() >= b;
109
- let M, N;
110
- h === "left" && n ? (M = "left", N = B()) : A ? (M = "right", N = W()) : n ? (M = "left", N = B()) : (M = "left", N = Math.max(b, P - w - b));
111
- const Y = C.querySelector(":scope > li")?.getBoundingClientRect(), J = V.top, pt = Y ? Y.top : S.top + 8, mt = J - pt, tt = C.scrollHeight;
105
+ if (!f || !_.current || !e || !i || !a) return;
106
+ const g = _.current, D = e, H = D.closest(".menu-list, .sub-menu");
107
+ if (!H) return;
108
+ const C = g.querySelector("menu") ?? g, A = H.querySelector("menu") ?? H, F = (g.offsetParent ?? document.body).getBoundingClientRect(), S = g.getBoundingClientRect(), E = C.getBoundingClientRect(), M = A.getBoundingClientRect(), q = D.getBoundingClientRect(), I = E.left - S.left, w = E.width, P = window.innerWidth, T = window.innerHeight, y = 8, B = 4, O = () => Math.max(y, M.left - w - B), V = () => M.right + B, W = V() + w <= P - y, b = O() >= y;
109
+ let n, k;
110
+ h === "left" && b ? (n = "left", k = O()) : W ? (n = "right", k = V()) : b ? (n = "left", k = O()) : (n = "left", k = Math.max(y, P - w - y));
111
+ const Y = C.querySelector(":scope > li")?.getBoundingClientRect(), J = q.top, pt = Y ? Y.top : S.top + 8, mt = J - pt, tt = C.scrollHeight;
112
112
  let z = S.top + mt;
113
- if (z + tt > T - b) {
114
- const wt = Math.min(tt, T - K - b);
115
- z = T - wt - b;
113
+ if (z + tt > T - y) {
114
+ const wt = Math.min(tt, T - K - y);
115
+ z = T - wt - y;
116
116
  }
117
117
  z = Math.max(K, z);
118
- const gt = M === "left" ? N - I : N, et = z - F.top, nt = gt - F.left, ht = typeof r?.top == "number" ? r.top : parseFloat(String(r?.top)), vt = typeof r?.left == "number" ? r.left : parseFloat(String(r?.left));
119
- (Math.abs(et - ht) > 1 || Math.abs(nt - vt) > 1) && o(
120
- l,
121
- { top: et, left: nt, maxHeight: T - z - b },
122
- M
118
+ const gt = n === "left" ? k - I : k, et = z - F.top, nt = gt - F.left, ht = typeof s?.top == "number" ? s.top : parseFloat(String(s?.top)), vt = typeof s?.left == "number" ? s.left : parseFloat(String(s?.left));
119
+ (Math.abs(et - ht) > 1 || Math.abs(nt - vt) > 1) && i(
120
+ a,
121
+ { top: et, left: nt, maxHeight: T - z - y },
122
+ n
123
123
  );
124
- }, [f, a, e, l, h, r?.top, r?.left, o]), /* @__PURE__ */ L(
125
- xt,
124
+ }, [f, c, e, a, h, s?.top, s?.left, i]), /* @__PURE__ */ L(
125
+ Et,
126
126
  {
127
- style: { paddingLeft: f ? 16 : 0, ...r },
127
+ style: { paddingLeft: f ? 16 : 0, ...s },
128
128
  className: f ? "sub-menu" : "menu-list",
129
- id: l,
129
+ id: a,
130
130
  onMouseLeave: dt,
131
131
  ...x,
132
132
  ref: _,
133
- children: /* @__PURE__ */ L(Et, { children: a.filter((g) => !g.hidden).map((g, k) => {
133
+ children: /* @__PURE__ */ L(bt, { children: c.filter((g) => !g.hidden).map((g, D) => {
134
134
  if (g.node)
135
135
  return g.node;
136
- if (g?.id === "divider" || g?.separator) return /* @__PURE__ */ L("hr", {}, k);
136
+ if (g?.id === "divider" || g?.separator) return /* @__PURE__ */ L("hr", {}, D);
137
137
  const {
138
- label: D,
138
+ label: H,
139
139
  icon: C,
140
- img: H,
140
+ img: A,
141
141
  highlighted: G,
142
142
  onClick: F,
143
143
  link: S,
144
144
  items: E = [],
145
- id: y,
146
- disableClose: V,
145
+ id: M,
146
+ disableClose: q,
147
147
  selected: I,
148
148
  disabled: w,
149
149
  powerFeature: P,
150
150
  active: T,
151
- reserveActiveSlot: b,
151
+ reserveActiveSlot: y,
152
+ endActions: B,
152
153
  ...O
153
- } = g, { powerLicense: B } = ct(), W = !B && P, A = (n) => {
154
+ } = g, { powerLicense: V } = ct(), W = !V && P, b = (n) => {
154
155
  n.preventDefault(), n.stopPropagation(), P && u?.(P), R?.();
155
156
  };
156
157
  return /* @__PURE__ */ L(
157
158
  Pt,
158
159
  {
159
160
  tabIndex: 0,
160
- label: D,
161
+ label: H,
161
162
  icon: C,
162
- img: H,
163
+ img: A,
163
164
  highlighted: G,
164
165
  items: E,
165
166
  selected: I,
166
167
  disabled: w,
167
168
  powerFeature: P,
168
169
  active: T,
169
- reserveActiveSlot: b,
170
+ reserveActiveSlot: y,
171
+ endActions: B,
170
172
  isLink: S,
171
- onClick: (n) => W ? A(n) : E.length ? j(n, y, E) : i(n, F, S, V),
173
+ onClick: (n) => W ? b(n) : E.length ? j(n, M, E) : o(n, F, S, q),
172
174
  onKeyDown: (n) => {
173
- n.key === "Enter" && (W ? A(n) : E.length ? j(n, y, E) : i(n, F, S));
174
- const M = !n.target.nextSibling;
175
- n.key === "Tab" && M && !n.shiftKey && (n.preventDefault(), n.stopPropagation(), _.current?.querySelectorAll("li, button")[0]?.focus()), n.key === "Escape" && f && e && (n.preventDefault(), n.stopPropagation(), e.focus(), m?.(y));
175
+ n.key === "Enter" && (W ? b(n) : E.length ? j(n, M, E) : o(n, F, S));
176
+ const k = !n.target.nextSibling;
177
+ n.key === "Tab" && k && !n.shiftKey && (n.preventDefault(), n.stopPropagation(), _.current?.querySelectorAll("li, button")[0]?.focus()), n.key === "Escape" && f && e && (n.preventDefault(), n.stopPropagation(), e.focus(), m?.(M));
176
178
  },
177
- style: { paddingRight: E.length ? "0" : "16px", ...s },
178
- ref: (n) => v.current[y] = n,
179
- onMouseEnter: (n) => j(n, y, E),
180
- onMouseLeave: (n) => j(n, y, []),
179
+ style: { paddingRight: E.length ? "0" : "16px", ...l },
180
+ ref: (n) => v.current[M] = n,
181
+ onMouseEnter: (n) => j(n, M, E),
182
+ onMouseLeave: (n) => j(n, M, []),
181
183
  className: `${t} ${O.className || ""}`,
182
184
  ...O,
183
185
  children: !!E.length && /* @__PURE__ */ L(Tt, { icon: "arrow_right", style: { marginLeft: "auto" } })
184
186
  },
185
- `${y}-${k}`
187
+ `${M}-${D}`
186
188
  );
187
189
  }) })
188
190
  }
189
191
  );
190
192
  };
191
- function Ft(a, i, c = "right") {
192
- if (!a) return null;
193
- const o = a.getBoundingClientRect(), f = i?.getBoundingClientRect(), d = f?.width || 200, l = f?.height || 300, e = 8, p = window.innerWidth, r = window.innerHeight;
194
- let h = o.bottom + 8 - $, m;
193
+ function At(c, o, r = "right") {
194
+ if (!c) return null;
195
+ const i = c.getBoundingClientRect(), f = o?.getBoundingClientRect(), d = f?.width || 200, a = f?.height || 300, e = 8, p = window.innerWidth, s = window.innerHeight;
196
+ let h = i.bottom + 8 - $, m;
195
197
  const R = K - $;
196
- if (h + $ + l > r - e) {
197
- const t = o.top - 8 - l - $;
198
+ if (h + $ + a > s - e) {
199
+ const t = i.top - 8 - a - $;
198
200
  t >= R && (h = t);
199
201
  }
200
- if (h = Math.max(R, h), c === "right") {
201
- const t = o.right - d;
202
- t >= e ? m = t : m = o.left;
202
+ if (h = Math.max(R, h), r === "right") {
203
+ const t = i.right - d;
204
+ t >= e ? m = t : m = i.left;
203
205
  } else {
204
- const t = o.left;
205
- t + d <= p - e ? m = t : m = o.right - d;
206
+ const t = i.left;
207
+ t + d <= p - e ? m = t : m = i.right - d;
206
208
  }
207
- return m !== void 0 && (m = Math.max(e, Math.min(m, p - d - e))), { top: h, left: m, maxHeight: r - (h + $) - e };
209
+ return m !== void 0 && (m = Math.max(e, Math.min(m, p - d - e))), { top: h, left: m, maxHeight: s - (h + $) - e };
208
210
  }
209
- function It(a, i, c = "right") {
210
- const [o, f] = lt(null), d = Z(null), l = bt(() => {
211
- let e = a;
212
- if (!e && i && (e = document.getElementById(i)), !e) {
213
- i && console.warn(`Target element with id '${i}' not found`);
211
+ function Ft(c, o, r = "right") {
212
+ const [i, f] = lt(null), d = Z(null), a = xt(() => {
213
+ let e = c;
214
+ if (!e && o && (e = document.getElementById(o)), !e) {
215
+ o && console.warn(`Target element with id '${o}' not found`);
214
216
  return;
215
217
  }
216
218
  if (!d.current) return;
217
- const p = Ft(e, d.current, c);
219
+ const p = At(e, d.current, r);
218
220
  p && f(
219
- (r) => r && Math.abs(r.top - p.top) < 1 && Math.abs((r.left ?? 0) - (p.left ?? 0)) < 1 && Math.abs((r.maxHeight ?? 0) - (p.maxHeight ?? 0)) < 1 ? r : p
221
+ (s) => s && Math.abs(s.top - p.top) < 1 && Math.abs((s.left ?? 0) - (p.left ?? 0)) < 1 && Math.abs((s.maxHeight ?? 0) - (p.maxHeight ?? 0)) < 1 ? s : p
220
222
  );
221
- }, [a, i, c]);
223
+ }, [c, o, r]);
222
224
  return st(() => {
223
- l();
224
- }, [l]), U(() => {
225
- const e = () => requestAnimationFrame(l);
225
+ a();
226
+ }, [a]), U(() => {
227
+ const e = () => requestAnimationFrame(a);
226
228
  return window.addEventListener("resize", e, { passive: !0 }), window.addEventListener("scroll", e, { passive: !0 }), () => {
227
229
  window.removeEventListener("resize", e), window.removeEventListener("scroll", e);
228
230
  };
229
- }, [l]), U(() => {
231
+ }, [a]), U(() => {
230
232
  if (!d.current) return;
231
233
  const e = new ResizeObserver(() => {
232
- l();
234
+ a();
233
235
  });
234
236
  return e.observe(d.current), () => {
235
237
  e.disconnect();
236
238
  };
237
- }, [l]), { position: o, menuRef: d };
239
+ }, [a]), { position: i, menuRef: d };
238
240
  }
239
- const it = "ayon-menu-dialog", ft = "ayon-menu-content", se = ({
240
- id: a,
241
- target: i,
242
- targetId: c = "",
243
- align: o = "right",
241
+ const it = "ayon-menu-dialog", ft = "ayon-menu-content", le = ({
242
+ id: c,
243
+ target: o,
244
+ targetId: r = "",
245
+ align: i = "right",
244
246
  theme: f = "light",
245
247
  children: d,
246
- ...l
248
+ ...a
247
249
  }) => {
248
- const { menuOpen: e, setMenuOpen: p, navigate: r } = at(), h = e === a, m = () => {
250
+ const { menuOpen: e, setMenuOpen: p, navigate: s } = at(), h = e === c, m = () => {
249
251
  p(!1);
250
252
  }, R = (t) => {
251
- console.log("navigate and close"), m(), !r && t ? console.log("navigate not found") : r && t && r(t);
253
+ console.log("navigate and close"), m(), !s && t ? console.log("navigate not found") : s && t && s(t);
252
254
  };
253
255
  return h ? /* @__PURE__ */ L(
254
- Bt,
256
+ It,
255
257
  {
256
258
  handleClose: m,
257
259
  handleNavigate: R,
258
- target: i,
259
- targetId: c,
260
- align: o,
260
+ target: o,
261
+ targetId: r,
262
+ align: i,
261
263
  theme: f,
262
264
  children: d,
263
- ...l
265
+ ...a
264
266
  }
265
267
  ) : null;
266
- }, Bt = ({
267
- handleClose: a,
268
- handleNavigate: i,
269
- target: c,
270
- targetId: o,
268
+ }, It = ({
269
+ handleClose: c,
270
+ handleNavigate: o,
271
+ target: r,
272
+ targetId: i,
271
273
  align: f = "right",
272
274
  children: d,
273
- ...l
275
+ ...a
274
276
  }) => {
275
- const { position: e, menuRef: p } = It(c ?? null, o ?? "", f);
277
+ const { position: e, menuRef: p } = Ft(r ?? null, i ?? "", f);
276
278
  U(() => {
277
279
  e && p.current && p.current.querySelectorAll("li, button")[0]?.focus();
278
280
  }, [e]);
279
- const r = (t) => {
280
- t.key === "Escape" && a();
281
+ const s = (t) => {
282
+ t.key === "Escape" && c();
281
283
  }, h = (t) => {
282
- t.target.id === it && a();
283
- }, m = X.Children.map(d, (t, s) => X.isValidElement(t) ? X.cloneElement(t, {
284
- onClose: a,
285
- index: s,
286
- navigate: i
284
+ t.target.id === it && c();
285
+ }, m = X.Children.map(d, (t, l) => X.isValidElement(t) ? X.cloneElement(t, {
286
+ onClose: c,
287
+ index: l,
288
+ navigate: o
287
289
  }) : t);
288
290
  return Dt(
289
291
  /* @__PURE__ */ L(
@@ -291,8 +293,8 @@ const it = "ayon-menu-dialog", ft = "ayon-menu-content", se = ({
291
293
  {
292
294
  open: !0,
293
295
  onClick: h,
294
- onKeyDown: r,
295
- ...l,
296
+ onKeyDown: s,
297
+ ...a,
296
298
  id: it,
297
299
  children: /* @__PURE__ */ L(
298
300
  Rt,
@@ -308,62 +310,62 @@ const it = "ayon-menu-dialog", ft = "ayon-menu-content", se = ({
308
310
  ),
309
311
  document.body
310
312
  );
311
- }, ut = (a, i) => {
312
- for (const c of a) {
313
- if (c.id === i) return c.items?.length ? c.items : void 0;
314
- const o = c.items?.length ? ut(c.items, i) : void 0;
315
- if (o) return o;
313
+ }, ut = (c, o) => {
314
+ for (const r of c) {
315
+ if (r.id === o) return r.items?.length ? r.items : void 0;
316
+ const i = r.items?.length ? ut(r.items, o) : void 0;
317
+ if (i) return i;
316
318
  }
317
- }, Nt = (a, i) => a.length === i.length && a.every(
318
- (c, o) => c.id === i[o].id && c.icon === i[o].icon && c.selected === i[o].selected && c.active === i[o].active
319
- ), le = ({ menu: a = [], onClose: i, header: c, footer: o = "" }) => {
320
- const { setPowerpackDialog: f } = ct(), { setMenuOpen: d } = at(), [l, e] = lt([]), p = (t, s, u, x) => {
321
- if (u) return i?.();
322
- s?.(t), !x && i && i();
323
- }, r = (t, s) => {
324
- if (s.items.length) {
325
- if (!l.find((u) => u.id === s.id)) {
326
- const u = s.parentEl ?? t.currentTarget ?? t.target;
319
+ }, Bt = (c = [], o = []) => c.length === o.length && c.every((r, i) => r.icon === o[i].icon && r.tooltip === o[i].tooltip), Nt = (c, o) => c.length === o.length && c.every(
320
+ (r, i) => r.id === o[i].id && r.icon === o[i].icon && r.selected === o[i].selected && r.active === o[i].active && Bt(r.endActions, o[i].endActions)
321
+ ), ce = ({ menu: c = [], onClose: o, header: r, footer: i = "" }) => {
322
+ const { setPowerpackDialog: f } = ct(), { setMenuOpen: d } = at(), [a, e] = lt([]), p = (t, l, u, x) => {
323
+ if (u) return o?.();
324
+ l?.(t), !x && o && o();
325
+ }, s = (t, l) => {
326
+ if (l.items.length) {
327
+ if (!a.find((u) => u.id === l.id)) {
328
+ const u = l.parentEl ?? t.currentTarget ?? t.target;
327
329
  e([
328
- ...l.filter((x) => x.level < (s.level || 0) + 1),
330
+ ...a.filter((x) => x.level < (l.level || 0) + 1),
329
331
  {
330
- ...s,
331
- id: s.id,
332
- level: (s.level || 0) + 1,
332
+ ...l,
333
+ id: l.id,
334
+ level: (l.level || 0) + 1,
333
335
  parentRef: u
334
336
  }
335
337
  ]);
336
338
  }
337
339
  } else
338
- e(l.filter((u) => u.level <= (s.level || 0)));
339
- }, h = (t, s = {}) => {
340
+ e(a.filter((u) => u.level <= (l.level || 0)));
341
+ }, h = (t, l = {}) => {
340
342
  const u = t.relatedTarget;
341
343
  if (!u) return;
342
344
  if (u.tagName === "DIALOG") return e([]);
343
- typeof u.closest == "function" && u.closest(`#${ft}`) || l.find((v) => v.id === u.id) || e(l.filter((v) => v.level <= (s.level || 0) + 1));
344
- }, m = (t, s) => {
345
- t.type === "mouseenter" || t.type === "keydown" ? r(t, s) : t.type === "mouseleave" && h(t, s);
345
+ typeof u.closest == "function" && u.closest(`#${ft}`) || a.find((v) => v.id === u.id) || e(a.filter((v) => v.level <= (l.level || 0) + 1));
346
+ }, m = (t, l) => {
347
+ t.type === "mouseenter" || t.type === "keydown" ? s(t, l) : t.type === "mouseleave" && h(t, l);
346
348
  };
347
349
  U(() => {
348
350
  e((t) => {
349
351
  if (!t.length) return t;
350
- const s = t.flatMap((x) => {
351
- const v = ut(a, x.id);
352
+ const l = t.flatMap((x) => {
353
+ const v = ut(c, x.id);
352
354
  return v ? [{ ...x, items: v }] : [];
353
355
  });
354
- return s.length === t.length && s.every((x, v) => Nt(x.items, t[v].items)) ? t : s;
356
+ return l.length === t.length && l.every((x, v) => Nt(x.items, t[v].items)) ? t : l;
355
357
  });
356
- }, [a]);
357
- const R = (t, s, u) => {
358
- e((x) => x.map((v) => v.id === t ? { ...v, style: s, placement: u } : v));
358
+ }, [c]);
359
+ const R = (t, l, u) => {
360
+ e((x) => x.map((v) => v.id === t ? { ...v, style: l, placement: u } : v));
359
361
  };
360
362
  return /* @__PURE__ */ Q(yt, { children: [
361
363
  /* @__PURE__ */ Q(Ct, { children: [
362
- c && c,
364
+ r && r,
363
365
  /* @__PURE__ */ L(
364
366
  ot,
365
367
  {
366
- items: a,
368
+ items: c,
367
369
  handleClick: p,
368
370
  onSubMenu: m,
369
371
  level: 0,
@@ -371,12 +373,12 @@ const it = "ayon-menu-dialog", ft = "ayon-menu-content", se = ({
371
373
  onMenuClose: () => d(!1)
372
374
  }
373
375
  ),
374
- o && /* @__PURE__ */ Q(St, { children: [
375
- o,
376
- /* @__PURE__ */ L(Ot, { icon: "content_copy", variant: "text", onClick: () => Ht(o) })
376
+ i && /* @__PURE__ */ Q(St, { children: [
377
+ i,
378
+ /* @__PURE__ */ L(Ot, { icon: "content_copy", variant: "text", onClick: () => Ht(i) })
377
379
  ] })
378
380
  ] }),
379
- l.map((t, s) => /* @__PURE__ */ L(
381
+ a.map((t, l) => /* @__PURE__ */ L(
380
382
  ot,
381
383
  {
382
384
  ...t,
@@ -386,22 +388,22 @@ const it = "ayon-menu-dialog", ft = "ayon-menu-content", se = ({
386
388
  subMenu: !0,
387
389
  onSubMenu: m,
388
390
  onSubMenuLayout: R,
389
- onClose: () => e(l.filter((u) => u.id !== t.id)),
391
+ onClose: () => e(a.filter((u) => u.id !== t.id)),
390
392
  onMenuClose: () => d(!1),
391
- onChange: r,
393
+ onChange: s,
392
394
  setPowerpackDialog: f,
393
395
  itemClassName: void 0,
394
396
  itemStyle: void 0
395
397
  },
396
- s
398
+ l
397
399
  ))
398
400
  ] });
399
401
  };
400
402
  export {
401
- ie as E,
402
- se as M,
403
- le as a,
404
- re as b,
403
+ re as E,
404
+ le as M,
405
+ ce as a,
406
+ se as b,
405
407
  ft as c,
406
408
  it as d,
407
409
  ot as e