@ynput/ayon-frontend-shared 0.7.4 → 0.7.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.
Files changed (52) hide show
  1. package/dist/DetailsPanel.es.js +376 -380
  2. package/dist/ListTable.es.js +2 -2
  3. package/dist/NewEntity.es.js +26 -26
  4. package/dist/ProjectTreeTable.es.js +2521 -2510
  5. package/dist/ProjectsTable.es.js +3 -3
  6. package/dist/Slicer.es.js +32 -32
  7. package/dist/Views.es.js +1 -1
  8. package/dist/chunks/ColumnDropIndicator.es.js +2 -2
  9. package/dist/chunks/ColumnHeaderMenuUI.es.js +1 -1
  10. package/dist/chunks/EntityPath.es.js +1 -1
  11. package/dist/chunks/EntityPickerDialog.es.js +481 -460
  12. package/dist/chunks/EntityTooltip.es.js +1 -1
  13. package/dist/chunks/Feed.es.js +11 -10
  14. package/dist/chunks/FilterErrorActions.es.js +1 -1
  15. package/dist/chunks/GroupSettingsFallback.es.js +2 -2
  16. package/dist/chunks/Menu.es.js +250 -247
  17. package/dist/chunks/MetaWidget.es.js +2 -2
  18. package/dist/chunks/PlayableIcon.es.js +368 -368
  19. package/dist/chunks/ProjectFoldersContext.es.js +237 -0
  20. package/dist/chunks/ReviewablesSelector.es.js +1223 -1170
  21. package/dist/chunks/SimpleTable.es.js +301 -296
  22. package/dist/chunks/Slicer.es.js +418 -410
  23. package/dist/chunks/TableExportContextInstance.es.js +428 -382
  24. package/dist/chunks/ThumbnailUploaderContext.es.js +48 -0
  25. package/dist/chunks/Watchers.es.js +2 -2
  26. package/dist/chunks/{ColumnDropIndicator.styled.es.js → addonColumnTags.es.js} +60 -47
  27. package/dist/components.es.js +1404 -1274
  28. package/dist/context.es.js +559 -657
  29. package/dist/hooks.es.js +2 -2
  30. package/dist/index.es.js +2 -2
  31. package/dist/types/Actions.d.ts +16 -16
  32. package/dist/types/ContextMenu.d.ts +16 -16
  33. package/dist/types/DetailsPanel.d.ts +16 -16
  34. package/dist/types/EntityPickerDialog.d.ts +61 -18
  35. package/dist/types/Feed.d.ts +16 -16
  36. package/dist/types/ListTable.d.ts +16 -16
  37. package/dist/types/NewEntity.d.ts +16 -16
  38. package/dist/types/ProjectTreeTable.d.ts +135 -33
  39. package/dist/types/ProjectsTable.d.ts +16 -16
  40. package/dist/types/RepresentationsList.d.ts +16 -16
  41. package/dist/types/SimpleTable.d.ts +16 -16
  42. package/dist/types/Slicer.d.ts +16 -16
  43. package/dist/types/Views.d.ts +16 -16
  44. package/dist/types/api.d.ts +16 -16
  45. package/dist/types/components.d.ts +226 -39
  46. package/dist/types/context.d.ts +24 -16
  47. package/dist/types/hooks.d.ts +16 -16
  48. package/dist/types/index.d.ts +16 -16
  49. package/dist/types/util.d.ts +16 -16
  50. package/package.json +3 -3
  51. package/dist/chunks/ProjectContext.es.js +0 -158
  52. package/dist/chunks/useQueryArgumentChangeLoading.es.js +0 -11
@@ -1,9 +1,9 @@
1
- import { jsxs as Q, jsx as f, Fragment as ke } from "react/jsx-runtime";
2
- import te, { forwardRef as Ee, useRef as oe, useEffect as Y, useLayoutEffect as ce, useState as de, useCallback as Le } from "react";
3
- import { Button as pe, Icon as K, ShortcutTag as Pe } from "@ynput/ayon-react-components";
4
- import A, { keyframes as Re } from "styled-components";
5
- import { isArray as Ce } from "lodash";
6
- import { Link as Se } from "react-router-dom";
1
+ import { jsxs as Q, jsx as u, Fragment as Me } from "react/jsx-runtime";
2
+ import te, { forwardRef as ke, useRef as oe, useEffect as Y, useLayoutEffect as le, useState as ce, useCallback as Ee } from "react";
3
+ import { Button as de, Icon as K, ShortcutTag as Le } from "@ynput/ayon-react-components";
4
+ import A, { keyframes as Pe } from "styled-components";
5
+ import { isArray as Re } from "lodash";
6
+ import { Link as Ce } from "react-router-dom";
7
7
  import fe from "clsx";
8
8
  import "@module-federation/enhanced/runtime";
9
9
  import "@ynput/ayon-addon/host";
@@ -11,15 +11,15 @@ import "react-toastify";
11
11
  import "./searchTerms.es.js";
12
12
  import "./getUris.es.js";
13
13
  import "primereact/confirmdialog";
14
- import { b as ne, u as ue } from "./TableExportContextInstance.es.js";
14
+ import { b as ne, u as pe } from "./TableExportContextInstance.es.js";
15
15
  import "uuid";
16
16
  import "axios";
17
17
  import "semver";
18
18
  import "./ContextMenuContextInstance.es.js";
19
- import { createPortal as Te } from "react-dom";
19
+ import { createPortal as Se } from "react-dom";
20
20
  import "react-redux";
21
- import { c as Ne } from "./copyToClipboard.es.js";
22
- const z = 42, Ae = 8, U = z + Ae, De = A.dialog`
21
+ import { c as Te } from "./copyToClipboard.es.js";
22
+ const z = 42, Ne = 8, U = z + Ne, Ae = A.dialog`
23
23
  position: fixed;
24
24
  margin: 0;
25
25
  inset: 0;
@@ -41,7 +41,7 @@ const z = 42, Ae = 8, U = z + Ae, De = A.dialog`
41
41
  display: none;
42
42
  }
43
43
  padding-bottom: 60px;
44
- `, Ie = Re`
44
+ `, De = Pe`
45
45
  from {
46
46
  scale: 0.95;
47
47
  opacity: 0.6;
@@ -64,7 +64,7 @@ const z = 42, Ae = 8, U = z + Ae, De = A.dialog`
64
64
  z-index: 30;
65
65
 
66
66
  /* animate */
67
- animation: ${Ie} 0.03s ease-in forwards;
67
+ animation: ${De} 0.03s ease-in forwards;
68
68
 
69
69
  /* transform origin based on alignment */
70
70
  &.right {
@@ -88,7 +88,7 @@ const z = 42, Ae = 8, U = z + Ae, De = A.dialog`
88
88
  color: var(--md-sys-color-on-surface, #fff) !important;
89
89
  }
90
90
  }
91
- `, He = A.section`
91
+ `, Ie = A.section`
92
92
  position: relative;
93
93
  display: flex;
94
94
  flex-direction: column;
@@ -101,7 +101,7 @@ const z = 42, Ae = 8, U = z + Ae, De = A.dialog`
101
101
  color: var(--md-sys-color-on-surface);
102
102
  z-index: 10;
103
103
  overflow: hidden;
104
- `, _e = A.div`
104
+ `, He = A.div`
105
105
  position: relative;
106
106
  border-radius: 8px;
107
107
  display: flex;
@@ -125,7 +125,7 @@ const z = 42, Ae = 8, U = z + Ae, De = A.dialog`
125
125
  overflow-x: hidden;
126
126
  }
127
127
  }
128
- `, Be = A.menu`
128
+ `, _e = A.menu`
129
129
  /* reset defaults */
130
130
  display: flex;
131
131
  list-style-type: none;
@@ -160,7 +160,7 @@ const z = 42, Ae = 8, U = z + Ae, De = A.dialog`
160
160
  opacity: 0.5;
161
161
  border-color: var(--md-sys-color-surface-container-highest);
162
162
  }
163
- `, Fe = A.li`
163
+ `, Be = A.li`
164
164
  display: flex;
165
165
  padding: 6px 16px 6px 12px;
166
166
  justify-content: flex-start;
@@ -269,13 +269,13 @@ const z = 42, Ae = 8, U = z + Ae, De = A.dialog`
269
269
  }
270
270
  background-color: unset;
271
271
  }
272
- `, We = A.div`
272
+ `, Fe = A.div`
273
273
  display: flex;
274
274
  align-items: center;
275
275
  gap: var(--base-gap-small);
276
276
  margin-left: auto;
277
277
  padding-left: 24px;
278
- `, $e = A(pe)`
278
+ `, We = A(de)`
279
279
  margin-left: auto;
280
280
  &.hasIcon {
281
281
  padding: 4px;
@@ -288,11 +288,11 @@ const z = 42, Ae = 8, U = z + Ae, De = A.dialog`
288
288
  background-color: var(--md-sys-color-on-primary);
289
289
  color: var(--md-sys-color-primary);
290
290
  }
291
- `, ze = A.img`
291
+ `, $e = A.img`
292
292
  width: 18px;
293
293
  height: 18px;
294
294
  object-fit: contain;
295
- `, qe = A.footer`
295
+ `, ze = A.footer`
296
296
  position: relative;
297
297
  display: flex;
298
298
  padding: 8px;
@@ -321,114 +321,114 @@ const z = 42, Ae = 8, U = z + Ae, De = A.dialog`
321
321
  display: flex;
322
322
  }
323
323
  }
324
- `, me = Ee(
324
+ `, ue = ke(
325
325
  ({
326
- label: s,
327
- icon: n,
326
+ label: a,
327
+ icon: i,
328
328
  hoverIcon: r,
329
- img: i,
330
- highlighted: d,
331
- notification: u,
332
- selected: c,
329
+ img: n,
330
+ highlighted: f,
331
+ notification: p,
332
+ selected: l,
333
333
  danger: t,
334
- items: m = [],
335
- className: a,
334
+ items: g = [],
335
+ className: c,
336
336
  isLink: h,
337
- isDev: g,
337
+ isDev: m,
338
338
  shortcut: L,
339
339
  disabled: e,
340
- powerFeature: l,
341
- active: p,
340
+ powerFeature: s,
341
+ active: d,
342
342
  reserveActiveSlot: w,
343
- endActions: b = [],
343
+ endActions: y = [],
344
344
  ...N
345
345
  }, q) => {
346
- const J = Ce(s) ? s : [s], { powerLicense: v } = ne(), C = !v && l, S = /* @__PURE__ */ Q(
347
- Fe,
346
+ const J = Re(a) ? a : [a], { powerLicense: v } = ne(), C = !v && s, S = /* @__PURE__ */ Q(
347
+ Be,
348
348
  {
349
349
  ref: q,
350
350
  className: fe(
351
351
  "menu-item",
352
352
  {
353
- highlighted: d,
354
- selected: c,
355
- notification: u,
353
+ highlighted: f,
354
+ selected: l,
355
+ notification: p,
356
356
  danger: t,
357
- dev: g,
357
+ dev: m,
358
358
  disabled: e,
359
359
  power: C
360
360
  },
361
- a
361
+ c
362
362
  ),
363
363
  ...N,
364
364
  "aria-label": J.join(", "),
365
365
  children: [
366
- n && /* @__PURE__ */ f(K, { icon: n, className: r ? "hover-swap-default" : void 0 }),
367
- r && /* @__PURE__ */ f(K, { icon: r, className: "hover-swap" }),
368
- i && /* @__PURE__ */ f(ze, { src: i, alt: `${s} icon` }),
369
- J.map((y, x) => /* @__PURE__ */ f("span", { children: y }, x)),
370
- L && /* @__PURE__ */ f(Pe, { style: { minWidth: 22, textAlign: "center" }, align: "right", children: L }),
371
- (p || w) && /* @__PURE__ */ f(
366
+ i && /* @__PURE__ */ u(K, { icon: i, className: r ? "hover-swap-default" : void 0 }),
367
+ r && /* @__PURE__ */ u(K, { icon: r, className: "hover-swap" }),
368
+ n && /* @__PURE__ */ u($e, { src: n, alt: `${a} icon` }),
369
+ J.map((b, x) => /* @__PURE__ */ u("span", { children: b }, x)),
370
+ L && /* @__PURE__ */ u(Le, { style: { minWidth: 22, textAlign: "center" }, align: "right", children: L }),
371
+ (d || w) && /* @__PURE__ */ u(
372
372
  K,
373
373
  {
374
374
  icon: "check",
375
- style: { marginLeft: "auto", visibility: p ? "visible" : "hidden" }
375
+ style: { marginLeft: "auto", visibility: d ? "visible" : "hidden" }
376
376
  }
377
377
  ),
378
- !!b.length && /* @__PURE__ */ f(We, { children: b.map((y) => /* @__PURE__ */ f(
379
- $e,
378
+ !!y.length && /* @__PURE__ */ u(Fe, { children: y.map((b) => /* @__PURE__ */ u(
379
+ We,
380
380
  {
381
381
  variant: "text",
382
- icon: y.icon,
382
+ icon: b.icon,
383
383
  className: "menu-item-end-action",
384
- "data-tooltip": y.tooltip,
385
- "aria-label": y.tooltip,
384
+ "data-tooltip": b.tooltip,
385
+ "aria-label": b.tooltip,
386
386
  onClick: (x) => {
387
- x.stopPropagation(), y.onClick(x);
387
+ x.stopPropagation(), b.onClick(x);
388
388
  },
389
389
  onKeyDown: (x) => x.stopPropagation()
390
390
  },
391
- y.icon
391
+ b.icon
392
392
  )) }),
393
- C && /* @__PURE__ */ f(K, { icon: "bolt", className: "power-bolt" }),
394
- !!m.length && /* @__PURE__ */ f(K, { icon: "arrow_right", className: "more" })
393
+ C && /* @__PURE__ */ u(K, { icon: "bolt", className: "power-bolt" }),
394
+ !!g.length && /* @__PURE__ */ u(K, { icon: "arrow_right", className: "more" })
395
395
  ]
396
396
  }
397
397
  );
398
- return h ? /* @__PURE__ */ f(Se, { to: h, target: N.target, children: S }) : S;
398
+ return h ? /* @__PURE__ */ u(Ce, { to: h, target: N.target, children: S }) : S;
399
399
  }
400
400
  );
401
- me.displayName = "MenuItem";
401
+ ue.displayName = "MenuItem";
402
402
  const ae = ({
403
- items: s,
404
- handleClick: n,
403
+ items: a,
404
+ handleClick: i,
405
405
  onSubMenu: r,
406
- onSubMenuLayout: i,
407
- subMenu: d,
408
- level: u,
409
- id: c = "root-menu",
406
+ onSubMenuLayout: n,
407
+ subMenu: f,
408
+ level: p,
409
+ id: l = "root-menu",
410
410
  parentRef: t,
411
- parentEl: m,
412
- style: a,
411
+ parentEl: g,
412
+ style: c,
413
413
  placement: h,
414
- onClose: g,
414
+ onClose: m,
415
415
  onMenuClose: L,
416
416
  itemClassName: e,
417
- itemStyle: l,
418
- setPowerpackDialog: p,
417
+ itemStyle: s,
418
+ setPowerpackDialog: d,
419
419
  ...w
420
420
  }) => {
421
- const b = oe({}), N = oe(null), q = (v, C, S) => {
422
- const y = b.current[C], x = N.current;
423
- if (!y || !x) return;
424
- const _ = (x.offsetParent ?? document.body).getBoundingClientRect(), D = y.getBoundingClientRect(), k = (x.querySelector("menu") ?? x).getBoundingClientRect(), V = window.innerWidth, B = window.innerHeight, M = 8, T = Math.max(240, k.width), I = Math.min(
421
+ const y = oe({}), N = oe(null), q = (v, C, S) => {
422
+ const b = y.current[C], x = N.current;
423
+ if (!b || !x) return;
424
+ const _ = (x.offsetParent ?? document.body).getBoundingClientRect(), D = b.getBoundingClientRect(), k = (x.querySelector("menu") ?? x).getBoundingClientRect(), V = window.innerWidth, B = window.innerHeight, M = 8, T = Math.max(240, k.width), O = Math.min(
425
425
  S.length * 36 + 16,
426
426
  B - U - M
427
- ), E = 4, F = () => Math.max(M, k.left - T - E), O = () => k.right + E, j = O() + T <= V - M, $ = F() >= M;
427
+ ), E = 4, F = () => Math.max(M, k.left - T - E), I = () => k.right + E, j = I() + T <= V - M, $ = F() >= M;
428
428
  let R, o;
429
- h === "left" && $ ? (R = "left", o = F()) : j ? (R = "right", o = O()) : $ ? (R = "left", o = F()) : (R = "left", o = Math.max(M, V - T - M));
429
+ h === "left" && $ ? (R = "left", o = F()) : j ? (R = "right", o = I()) : $ ? (R = "left", o = F()) : (R = "left", o = Math.max(M, V - T - M));
430
430
  let W = D.top - 8;
431
- W + I > B - M && (W = B - I - M), W = Math.max(U, W);
431
+ W + O > B - M && (W = B - O - M), W = Math.max(U, W);
432
432
  const ee = R === "left" ? o - 16 : o;
433
433
  r?.(v, {
434
434
  id: C,
@@ -438,53 +438,53 @@ const ae = ({
438
438
  maxHeight: B - W - M
439
439
  },
440
440
  items: S,
441
- level: u,
441
+ level: p,
442
442
  placement: R,
443
443
  // Pass the actual menu-item element so sub-menu measurement uses the <li>
444
444
  // instead of whatever inner span the mouse event bubbled from.
445
- parentEl: y
445
+ parentEl: b
446
446
  });
447
447
  }, J = (v) => {
448
- d && r?.(v, { id: "parent", items: [] });
448
+ f && r?.(v, { id: "parent", items: [] });
449
449
  };
450
450
  return Y(() => {
451
- d && N.current && N.current.querySelectorAll("li, button")[0]?.focus();
452
- }, [d]), ce(() => {
453
- if (!d || !N.current || !t || !i || !c) return;
451
+ f && N.current && N.current.querySelectorAll("li, button")[0]?.focus();
452
+ }, [f]), le(() => {
453
+ if (!f || !N.current || !t || !n || !l) return;
454
454
  const v = N.current, C = t, S = C.closest(".menu-list, .sub-menu");
455
455
  if (!S) return;
456
- const y = v.querySelector("menu") ?? v, x = S.querySelector("menu") ?? S, _ = (v.offsetParent ?? document.body).getBoundingClientRect(), D = v.getBoundingClientRect(), P = y.getBoundingClientRect(), k = x.getBoundingClientRect(), V = C.getBoundingClientRect(), B = P.left - D.left, M = P.width, T = window.innerWidth, I = window.innerHeight, E = 8, F = 4, O = () => Math.max(E, k.left - M - F), j = () => k.right + F, $ = j() + M <= T - E, R = O() >= E;
456
+ const b = v.querySelector("menu") ?? v, x = S.querySelector("menu") ?? S, _ = (v.offsetParent ?? document.body).getBoundingClientRect(), D = v.getBoundingClientRect(), P = b.getBoundingClientRect(), k = x.getBoundingClientRect(), V = C.getBoundingClientRect(), B = P.left - D.left, M = P.width, T = window.innerWidth, O = window.innerHeight, E = 8, F = 4, I = () => Math.max(E, k.left - M - F), j = () => k.right + F, $ = j() + M <= T - E, R = I() >= E;
457
457
  let o, H;
458
- h === "left" && R ? (o = "left", H = O()) : $ ? (o = "right", H = j()) : R ? (o = "left", H = O()) : (o = "left", H = Math.max(E, T - M - E));
459
- const Z = y.querySelector(":scope > li")?.getBoundingClientRect(), ee = V.top, ve = Z ? Z.top : D.top + 8, be = ee - ve, ie = y.scrollHeight;
460
- let G = D.top + be;
461
- if (G + ie > I - E) {
462
- const Me = Math.min(ie, I - U - E);
463
- G = I - Me - E;
458
+ h === "left" && R ? (o = "left", H = I()) : $ ? (o = "right", H = j()) : R ? (o = "left", H = I()) : (o = "left", H = Math.max(E, T - M - E));
459
+ const Z = b.querySelector(":scope > li")?.getBoundingClientRect(), ee = V.top, he = Z ? Z.top : D.top + 8, ve = ee - he, ie = b.scrollHeight;
460
+ let G = D.top + ve;
461
+ if (G + ie > O - E) {
462
+ const xe = Math.min(ie, O - U - E);
463
+ G = O - xe - E;
464
464
  }
465
465
  G = Math.max(U, G);
466
- const ye = o === "left" ? H - B : H, re = G - _.top, se = ye - _.left, we = typeof a?.top == "number" ? a.top : parseFloat(String(a?.top)), xe = typeof a?.left == "number" ? a.left : parseFloat(String(a?.left));
467
- (Math.abs(re - we) > 1 || Math.abs(se - xe) > 1) && i(
468
- c,
469
- { top: re, left: se, maxHeight: I - G - E },
466
+ const ye = o === "left" ? H - B : H, re = G - _.top, se = ye - _.left, be = typeof c?.top == "number" ? c.top : parseFloat(String(c?.top)), we = typeof c?.left == "number" ? c.left : parseFloat(String(c?.left));
467
+ (Math.abs(re - be) > 1 || Math.abs(se - we) > 1) && n(
468
+ l,
469
+ { top: re, left: se, maxHeight: O - G - E },
470
470
  o
471
471
  );
472
- }, [d, s, t, c, h, a?.top, a?.left, i]), /* @__PURE__ */ f(
473
- _e,
472
+ }, [f, a, t, l, h, c?.top, c?.left, n]), /* @__PURE__ */ u(
473
+ He,
474
474
  {
475
- style: { paddingLeft: d ? 16 : 0, ...a },
476
- className: d ? "sub-menu" : "menu-list",
477
- id: c,
475
+ style: { paddingLeft: f ? 16 : 0, ...c },
476
+ className: f ? "sub-menu" : "menu-list",
477
+ id: l,
478
478
  onMouseLeave: J,
479
479
  ...w,
480
480
  ref: N,
481
- children: /* @__PURE__ */ f(Be, { children: s.filter((v) => !v.hidden).map((v, C) => {
481
+ children: /* @__PURE__ */ u(_e, { children: a.filter((v) => !v.hidden).map((v, C) => {
482
482
  if (v.node)
483
483
  return v.node;
484
- if (v?.id === "divider" || v?.separator) return /* @__PURE__ */ f("hr", {}, C);
484
+ if (v?.id === "divider" || v?.separator) return /* @__PURE__ */ u("hr", {}, C);
485
485
  const {
486
486
  label: S,
487
- icon: y,
487
+ icon: b,
488
488
  img: x,
489
489
  highlighted: X,
490
490
  onClick: _,
@@ -495,42 +495,42 @@ const ae = ({
495
495
  selected: B,
496
496
  disabled: M,
497
497
  powerFeature: T,
498
- active: I,
498
+ active: O,
499
499
  reserveActiveSlot: E,
500
500
  endActions: F,
501
- ...O
501
+ ...I
502
502
  } = v, { powerLicense: j } = ne(), $ = !j && T, R = (o) => {
503
- o.preventDefault(), o.stopPropagation(), T && p?.(T), L?.();
503
+ o.preventDefault(), o.stopPropagation(), T && d?.(T), L?.();
504
504
  };
505
- return /* @__PURE__ */ f(
506
- me,
505
+ return /* @__PURE__ */ u(
506
+ ue,
507
507
  {
508
508
  tabIndex: 0,
509
509
  label: S,
510
- icon: y,
510
+ icon: b,
511
511
  img: x,
512
512
  highlighted: X,
513
513
  items: P,
514
514
  selected: B,
515
515
  disabled: M,
516
516
  powerFeature: T,
517
- active: I,
517
+ active: O,
518
518
  reserveActiveSlot: E,
519
519
  endActions: F,
520
520
  isLink: D,
521
- onClick: (o) => $ ? R(o) : P.length ? q(o, k, P) : n(o, _, D, V),
521
+ onClick: (o) => $ ? R(o) : P.length ? q(o, k, P) : i(o, _, D, V),
522
522
  onKeyDown: (o) => {
523
- o.key === "Enter" && ($ ? R(o) : P.length ? q(o, k, P) : n(o, _, D));
523
+ o.key === "Enter" && ($ ? R(o) : P.length ? q(o, k, P) : i(o, _, D));
524
524
  const H = !o.target.nextSibling;
525
- o.key === "Tab" && H && !o.shiftKey && (o.preventDefault(), o.stopPropagation(), N.current?.querySelectorAll("li, button")[0]?.focus()), o.key === "Escape" && d && t && (o.preventDefault(), o.stopPropagation(), t.focus(), g?.(k));
525
+ o.key === "Tab" && H && !o.shiftKey && (o.preventDefault(), o.stopPropagation(), N.current?.querySelectorAll("li, button")[0]?.focus()), o.key === "Escape" && f && t && (o.preventDefault(), o.stopPropagation(), t.focus(), m?.(k));
526
526
  },
527
- style: { paddingRight: P.length ? "0" : "16px", ...l },
528
- ref: (o) => b.current[k] = o,
527
+ style: { paddingRight: P.length ? "0" : "16px", ...s },
528
+ ref: (o) => y.current[k] = o,
529
529
  onMouseEnter: (o) => q(o, k, P),
530
530
  onMouseLeave: (o) => q(o, k, []),
531
- className: `${e} ${O.className || ""}`,
532
- ...O,
533
- children: !!P.length && /* @__PURE__ */ f(K, { icon: "arrow_right", style: { marginLeft: "auto" } })
531
+ className: `${e} ${I.className || ""}`,
532
+ ...I,
533
+ children: !!P.length && /* @__PURE__ */ u(K, { icon: "arrow_right", style: { marginLeft: "auto" } })
534
534
  },
535
535
  `${k}-${C}`
536
536
  );
@@ -538,219 +538,222 @@ const ae = ({
538
538
  }
539
539
  );
540
540
  };
541
- function Ve(s, n, r = "right") {
542
- if (!s) return null;
543
- const i = s.getBoundingClientRect(), d = n?.getBoundingClientRect(), u = d?.width || 200, c = d?.height || 300, t = 8, m = window.innerWidth, a = window.innerHeight;
544
- let h = i.bottom + 8 - z, g;
541
+ function qe(a, i, r = "right") {
542
+ if (!a) return null;
543
+ const n = a.getBoundingClientRect(), f = i?.getBoundingClientRect(), p = f?.width || 200, l = f?.height || 300, t = 8, g = window.innerWidth, c = window.innerHeight;
544
+ let h = n.bottom + 8 - z, m;
545
545
  const L = U - z;
546
- if (h + z + c > a - t) {
547
- const e = i.top - 8 - c - z;
546
+ if (h + z + l > c - t) {
547
+ const e = n.top - 8 - l - z;
548
548
  e >= L && (h = e);
549
549
  }
550
550
  if (h = Math.max(L, h), r === "right") {
551
- const e = i.right - u;
552
- e >= t ? g = e : g = i.left;
551
+ const e = n.right - p;
552
+ e >= t ? m = e : m = n.left;
553
553
  } else {
554
- const e = i.left;
555
- e + u <= m - t ? g = e : g = i.right - u;
554
+ const e = n.left;
555
+ e + p <= g - t ? m = e : m = n.right - p;
556
556
  }
557
- return g !== void 0 && (g = Math.max(t, Math.min(g, m - u - t))), { top: h, left: g, maxHeight: a - (h + z) - t };
557
+ return m !== void 0 && (m = Math.max(t, Math.min(m, g - p - t))), { top: h, left: m, maxHeight: c - (h + z) - t };
558
558
  }
559
- function je(s, n, r = "right") {
560
- const [i, d] = de(null), u = oe(null), c = Le(() => {
561
- let t = s;
562
- if (!t && n && (t = document.getElementById(n)), !t) {
563
- n && console.warn(`Target element with id '${n}' not found`);
559
+ function Ve(a, i, r = "right") {
560
+ const [n, f] = ce(null), p = oe(null), l = Ee(() => {
561
+ let t = a;
562
+ if (!t && i && (t = document.getElementById(i)), !t) {
563
+ i && console.warn(`Target element with id '${i}' not found`);
564
564
  return;
565
565
  }
566
- if (!u.current) return;
567
- const m = Ve(t, u.current, r);
568
- m && d(
569
- (a) => a && Math.abs(a.top - m.top) < 1 && Math.abs((a.left ?? 0) - (m.left ?? 0)) < 1 && Math.abs((a.maxHeight ?? 0) - (m.maxHeight ?? 0)) < 1 ? a : m
566
+ if (!p.current) return;
567
+ const g = qe(t, p.current, r);
568
+ g && f(
569
+ (c) => c && Math.abs(c.top - g.top) < 1 && Math.abs((c.left ?? 0) - (g.left ?? 0)) < 1 && Math.abs((c.maxHeight ?? 0) - (g.maxHeight ?? 0)) < 1 ? c : g
570
570
  );
571
- }, [s, n, r]);
572
- return ce(() => {
573
- c();
574
- }, [c]), Y(() => {
575
- const t = () => requestAnimationFrame(c);
571
+ }, [a, i, r]);
572
+ return le(() => {
573
+ l();
574
+ }, [l]), Y(() => {
575
+ const t = () => requestAnimationFrame(l);
576
576
  return window.addEventListener("resize", t, { passive: !0 }), window.addEventListener("scroll", t, { passive: !0 }), () => {
577
577
  window.removeEventListener("resize", t), window.removeEventListener("scroll", t);
578
578
  };
579
- }, [c]), Y(() => {
580
- if (!u.current) return;
579
+ }, [l]), Y(() => {
580
+ if (!p.current) return;
581
581
  const t = new ResizeObserver(() => {
582
- c();
582
+ l();
583
583
  });
584
- return t.observe(u.current), () => {
584
+ return t.observe(p.current), () => {
585
585
  t.disconnect();
586
586
  };
587
- }, [c]), { position: i, menuRef: u };
587
+ }, [l]), { position: n, menuRef: p };
588
588
  }
589
- const le = "ayon-menu-dialog", ge = "ayon-menu-content", ht = ({
590
- id: s,
591
- target: n,
589
+ const je = "ayon-menu-dialog", me = "ayon-menu-content", ht = ({
590
+ id: a,
591
+ target: i,
592
592
  targetId: r = "",
593
- align: i = "right",
594
- theme: d = "light",
595
- children: u,
596
- ...c
593
+ align: n = "right",
594
+ theme: f = "light",
595
+ isOpen: p,
596
+ onDismiss: l,
597
+ children: t,
598
+ ...g
597
599
  }) => {
598
- const { menuOpen: t, setMenuOpen: m, navigate: a } = ue(), h = t === s, g = () => {
599
- m(!1);
600
- }, L = (e) => {
601
- console.log("navigate and close"), g(), !a && e ? console.log("navigate not found") : a && e && a(e);
600
+ const { menuOpen: c, setMenuOpen: h, navigate: m } = pe(), L = p ?? c === a, e = () => {
601
+ p !== void 0 ? l?.() : h(!1);
602
+ }, s = (d) => {
603
+ console.log("navigate and close"), e(), !m && d ? console.log("navigate not found") : m && d && m(d);
602
604
  };
603
- return h ? /* @__PURE__ */ f(
605
+ return L ? /* @__PURE__ */ u(
604
606
  Ge,
605
607
  {
606
- handleClose: g,
607
- handleNavigate: L,
608
- target: n,
608
+ handleClose: e,
609
+ handleNavigate: s,
610
+ target: i,
609
611
  targetId: r,
610
- align: i,
611
- theme: d,
612
- children: u,
613
- ...c
612
+ align: n,
613
+ theme: f,
614
+ children: t,
615
+ ...g
614
616
  }
615
617
  ) : null;
616
618
  }, Ge = ({
617
- handleClose: s,
618
- handleNavigate: n,
619
+ handleClose: a,
620
+ handleNavigate: i,
619
621
  target: r,
620
- targetId: i,
621
- align: d = "right",
622
- children: u,
623
- ...c
622
+ targetId: n,
623
+ align: f = "right",
624
+ children: p,
625
+ ...l
624
626
  }) => {
625
- const { position: t, menuRef: m } = je(r ?? null, i ?? "", d);
627
+ const { position: t, menuRef: g } = Ve(r ?? null, n ?? "", f);
626
628
  Y(() => {
627
- t && m.current && m.current.querySelectorAll("li, button")[0]?.focus();
629
+ t && g.current && g.current.querySelectorAll("li, button")[0]?.focus();
628
630
  }, [t]);
629
- const a = (e) => {
630
- e.key === "Escape" && s();
631
+ const c = (e) => {
632
+ if (e.key !== "Escape") return;
633
+ e.preventDefault(), e.stopPropagation(), a(), (r ?? (n ? document.getElementById(n) : null))?.focus();
631
634
  }, h = (e) => {
632
- e.target.id === le && s();
633
- }, g = te.Children.map(u, (e, l) => te.isValidElement(e) ? te.cloneElement(e, {
634
- onClose: s,
635
- index: l,
636
- navigate: n
635
+ e.target === e.currentTarget && a();
636
+ }, m = te.Children.map(p, (e, s) => te.isValidElement(e) ? te.cloneElement(e, {
637
+ onClose: a,
638
+ index: s,
639
+ navigate: i
637
640
  }) : e);
638
- return Te(
639
- /* @__PURE__ */ f(
640
- De,
641
+ return Se(
642
+ /* @__PURE__ */ u(
643
+ Ae,
641
644
  {
642
645
  open: !0,
643
646
  onClick: h,
644
- onKeyDown: a,
645
- ...c,
646
- id: le,
647
- children: /* @__PURE__ */ f(
647
+ onKeyDown: c,
648
+ ...l,
649
+ id: je,
650
+ children: /* @__PURE__ */ u(
648
651
  Oe,
649
652
  {
650
- id: ge,
653
+ id: me,
651
654
  style: t || { top: 0, left: 0, opacity: 0, visibility: "hidden" },
652
- className: fe(d),
653
- ref: m,
654
- children: g
655
+ className: fe(f),
656
+ ref: g,
657
+ children: m
655
658
  }
656
659
  )
657
660
  }
658
661
  ),
659
662
  document.body
660
663
  );
661
- }, he = (s, n) => {
662
- for (const r of s) {
663
- if (r.id === n) return r.items?.length ? r.items : void 0;
664
- const i = r.items?.length ? he(r.items, n) : void 0;
665
- if (i) return i;
664
+ }, ge = (a, i) => {
665
+ for (const r of a) {
666
+ if (r.id === i) return r.items?.length ? r.items : void 0;
667
+ const n = r.items?.length ? ge(r.items, i) : void 0;
668
+ if (n) return n;
666
669
  }
667
- }, Ke = (s = [], n = []) => s.length === n.length && s.every((r, i) => r.icon === n[i].icon && r.tooltip === n[i].tooltip), Ue = (s, n) => s.length === n.length && s.every(
668
- (r, i) => r.id === n[i].id && r.icon === n[i].icon && r.selected === n[i].selected && r.active === n[i].active && Ke(r.endActions, n[i].endActions)
669
- ), vt = ({ menu: s = [], onClose: n, header: r, footer: i = "" }) => {
670
- const { setPowerpackDialog: d } = ne(), { setMenuOpen: u } = ue(), [c, t] = de([]), m = (e, l, p, w) => {
671
- if (p) return n?.();
672
- l?.(e), !w && n && n();
673
- }, a = (e, l) => {
674
- if (l.items.length) {
675
- if (!c.find((p) => p.id === l.id)) {
676
- const p = l.parentEl ?? e.currentTarget ?? e.target;
670
+ }, Ke = (a = [], i = []) => a.length === i.length && a.every((r, n) => r.icon === i[n].icon && r.tooltip === i[n].tooltip), Ue = (a, i) => a.length === i.length && a.every(
671
+ (r, n) => r.id === i[n].id && r.icon === i[n].icon && r.selected === i[n].selected && r.active === i[n].active && Ke(r.endActions, i[n].endActions)
672
+ ), vt = ({ menu: a = [], onClose: i, header: r, footer: n = "" }) => {
673
+ const { setPowerpackDialog: f } = ne(), { setMenuOpen: p } = pe(), [l, t] = ce([]), g = (e, s, d, w) => {
674
+ if (d) return i?.();
675
+ s?.(e), !w && i && i();
676
+ }, c = (e, s) => {
677
+ if (s.items.length) {
678
+ if (!l.find((d) => d.id === s.id)) {
679
+ const d = s.parentEl ?? e.currentTarget ?? e.target;
677
680
  t([
678
- ...c.filter((w) => w.level < (l.level || 0) + 1),
681
+ ...l.filter((w) => w.level < (s.level || 0) + 1),
679
682
  {
680
- ...l,
681
- id: l.id,
682
- level: (l.level || 0) + 1,
683
- parentRef: p
683
+ ...s,
684
+ id: s.id,
685
+ level: (s.level || 0) + 1,
686
+ parentRef: d
684
687
  }
685
688
  ]);
686
689
  }
687
690
  } else
688
- t(c.filter((p) => p.level <= (l.level || 0)));
689
- }, h = (e, l = {}) => {
690
- const p = e.relatedTarget;
691
- if (!p) return;
692
- if (p.tagName === "DIALOG") return t([]);
693
- typeof p.closest == "function" && p.closest(`#${ge}`) || c.find((b) => b.id === p.id) || t(c.filter((b) => b.level <= (l.level || 0) + 1));
694
- }, g = (e, l) => {
695
- e.type === "mouseenter" || e.type === "keydown" ? a(e, l) : e.type === "mouseleave" && h(e, l);
691
+ t(l.filter((d) => d.level <= (s.level || 0)));
692
+ }, h = (e, s = {}) => {
693
+ const d = e.relatedTarget;
694
+ if (!d) return;
695
+ if (d.tagName === "DIALOG") return t([]);
696
+ typeof d.closest == "function" && d.closest(`#${me}`) || l.find((y) => y.id === d.id) || t(l.filter((y) => y.level <= (s.level || 0) + 1));
697
+ }, m = (e, s) => {
698
+ e.type === "mouseenter" || e.type === "keydown" ? c(e, s) : e.type === "mouseleave" && h(e, s);
696
699
  };
697
700
  Y(() => {
698
701
  t((e) => {
699
702
  if (!e.length) return e;
700
- const l = e.flatMap((w) => {
701
- const b = he(s, w.id);
702
- return b ? [{ ...w, items: b }] : [];
703
+ const s = e.flatMap((w) => {
704
+ const y = ge(a, w.id);
705
+ return y ? [{ ...w, items: y }] : [];
703
706
  });
704
- return l.length === e.length && l.every((w, b) => Ue(w.items, e[b].items)) ? e : l;
707
+ return s.length === e.length && s.every((w, y) => Ue(w.items, e[y].items)) ? e : s;
705
708
  });
706
- }, [s]);
707
- const L = (e, l, p) => {
708
- t((w) => w.map((b) => b.id === e ? { ...b, style: l, placement: p } : b));
709
+ }, [a]);
710
+ const L = (e, s, d) => {
711
+ t((w) => w.map((y) => y.id === e ? { ...y, style: s, placement: d } : y));
709
712
  };
710
- return /* @__PURE__ */ Q(ke, { children: [
711
- /* @__PURE__ */ Q(He, { children: [
713
+ return /* @__PURE__ */ Q(Me, { children: [
714
+ /* @__PURE__ */ Q(Ie, { children: [
712
715
  r && r,
713
- /* @__PURE__ */ f(
716
+ /* @__PURE__ */ u(
714
717
  ae,
715
718
  {
716
- items: s,
717
- handleClick: m,
718
- onSubMenu: g,
719
+ items: a,
720
+ handleClick: g,
721
+ onSubMenu: m,
719
722
  level: 0,
720
- setPowerpackDialog: d,
721
- onMenuClose: () => u(!1)
723
+ setPowerpackDialog: f,
724
+ onMenuClose: () => p(!1)
722
725
  }
723
726
  ),
724
- i && /* @__PURE__ */ Q(qe, { children: [
725
- i,
726
- /* @__PURE__ */ f(pe, { icon: "content_copy", variant: "text", onClick: () => Ne(i) })
727
+ n && /* @__PURE__ */ Q(ze, { children: [
728
+ n,
729
+ /* @__PURE__ */ u(de, { icon: "content_copy", variant: "text", onClick: () => Te(n) })
727
730
  ] })
728
731
  ] }),
729
- c.map((e, l) => /* @__PURE__ */ f(
732
+ l.map((e, s) => /* @__PURE__ */ u(
730
733
  ae,
731
734
  {
732
735
  ...e,
733
736
  parentRef: e.parentRef || null,
734
737
  style: e.style || {},
735
- handleClick: m,
738
+ handleClick: g,
736
739
  subMenu: !0,
737
- onSubMenu: g,
740
+ onSubMenu: m,
738
741
  onSubMenuLayout: L,
739
- onClose: () => t(c.filter((p) => p.id !== e.id)),
740
- onMenuClose: () => u(!1),
741
- onChange: a,
742
- setPowerpackDialog: d,
742
+ onClose: () => t(l.filter((d) => d.id !== e.id)),
743
+ onMenuClose: () => p(!1),
744
+ onChange: c,
745
+ setPowerpackDialog: f,
743
746
  itemClassName: void 0,
744
747
  itemStyle: void 0
745
748
  },
746
- l
749
+ s
747
750
  ))
748
751
  ] });
749
752
  };
750
753
  export {
751
754
  ht as M,
752
755
  vt as a,
753
- ge as b,
754
- le as c,
756
+ me as b,
757
+ je as c,
755
758
  ae as d
756
759
  };