@kommo-crm/crm-react-ui-kit 1.1.1-beta.6 → 1.1.1-beta.8

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 (70) hide show
  1. package/dist/components/ContextMenu/ContextMenu.context.d.ts +4 -2
  2. package/dist/components/ContextMenu/ContextMenu.context.d.ts.map +1 -1
  3. package/dist/components/ContextMenu/ContextMenu.context.js +7 -4
  4. package/dist/components/ContextMenu/ContextMenu.d.ts.map +1 -1
  5. package/dist/components/ContextMenu/ContextMenu.js +102 -90
  6. package/dist/components/ContextMenu/ContextMenu.props.d.ts +22 -0
  7. package/dist/components/ContextMenu/ContextMenu.props.d.ts.map +1 -1
  8. package/dist/components/ContextMenu/components/Arrow/Arrow.js +1 -1
  9. package/dist/components/ContextMenu/components/CheckboxItem/CheckboxItem.d.ts +1 -0
  10. package/dist/components/ContextMenu/components/CheckboxItem/CheckboxItem.d.ts.map +1 -1
  11. package/dist/components/ContextMenu/components/CheckboxItem/CheckboxItem.js +45 -40
  12. package/dist/components/ContextMenu/components/CheckboxItem/CheckboxItem.props.d.ts +4 -0
  13. package/dist/components/ContextMenu/components/CheckboxItem/CheckboxItem.props.d.ts.map +1 -1
  14. package/dist/components/ContextMenu/components/Content/Content.d.ts.map +1 -1
  15. package/dist/components/ContextMenu/components/Content/Content.js +2 -2
  16. package/dist/components/ContextMenu/components/Content/index.js +1 -1
  17. package/dist/components/ContextMenu/components/Group/Group.js +1 -1
  18. package/dist/components/ContextMenu/components/Item/Item.d.ts.map +1 -1
  19. package/dist/components/ContextMenu/components/Item/Item.js +80 -75
  20. package/dist/components/ContextMenu/components/Item/Item.props.d.ts +6 -0
  21. package/dist/components/ContextMenu/components/Item/Item.props.d.ts.map +1 -1
  22. package/dist/components/ContextMenu/components/ItemIndicator/ItemIndicator.js +1 -1
  23. package/dist/components/ContextMenu/components/Label/Label.js +1 -1
  24. package/dist/components/ContextMenu/components/Portal/Portal.js +1 -1
  25. package/dist/components/ContextMenu/components/RadioGroup/RadioGroup.js +1 -1
  26. package/dist/components/ContextMenu/components/RadioItem/RadioItem.d.ts +1 -0
  27. package/dist/components/ContextMenu/components/RadioItem/RadioItem.d.ts.map +1 -1
  28. package/dist/components/ContextMenu/components/RadioItem/RadioItem.js +50 -45
  29. package/dist/components/ContextMenu/components/RadioItem/RadioItem.props.d.ts +4 -0
  30. package/dist/components/ContextMenu/components/RadioItem/RadioItem.props.d.ts.map +1 -1
  31. package/dist/components/ContextMenu/components/Separator/Separator.js +1 -1
  32. package/dist/components/ContextMenu/components/Sub/Sub.d.ts +5 -5
  33. package/dist/components/ContextMenu/components/Sub/Sub.d.ts.map +1 -1
  34. package/dist/components/ContextMenu/components/Sub/Sub.js +54 -55
  35. package/dist/components/ContextMenu/components/Sub/Sub.types.d.ts +7 -0
  36. package/dist/components/ContextMenu/components/Sub/Sub.types.d.ts.map +1 -0
  37. package/dist/components/ContextMenu/components/Sub/Sub.types.js +1 -0
  38. package/dist/components/ContextMenu/components/Sub/index.d.ts +1 -0
  39. package/dist/components/ContextMenu/components/Sub/index.d.ts.map +1 -1
  40. package/dist/components/ContextMenu/components/SubContent/SubContent.d.ts.map +1 -1
  41. package/dist/components/ContextMenu/components/SubContent/SubContent.js +26 -25
  42. package/dist/components/ContextMenu/components/SubRoot/SubRoot.d.ts.map +1 -1
  43. package/dist/components/ContextMenu/components/SubRoot/SubRoot.js +71 -66
  44. package/dist/components/ContextMenu/components/SubRoot/SubRoot.props.d.ts +8 -0
  45. package/dist/components/ContextMenu/components/SubRoot/SubRoot.props.d.ts.map +1 -1
  46. package/dist/components/ContextMenu/components/SubRoot/components/Content/Content.js +2 -2
  47. package/dist/components/ContextMenu/components/SubRoot/components/Trigger/Trigger.d.ts.map +1 -1
  48. package/dist/components/ContextMenu/components/SubRoot/components/Trigger/Trigger.js +38 -40
  49. package/dist/components/ContextMenu/components/SubTrigger/SubTrigger.js +3 -3
  50. package/dist/components/ContextMenu/components/Trigger/Trigger.js +1 -1
  51. package/dist/components/ContextMenu/hooks/index.js +1 -1
  52. package/dist/components/ContextMenu/hooks/useContentPositioning/useContentPositioning.js +1 -1
  53. package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.d.ts +2 -1
  54. package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.d.ts.map +1 -1
  55. package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.js +72 -61
  56. package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.types.d.ts +4 -0
  57. package/dist/components/ContextMenu/hooks/useContextMenu/useContextMenu.types.d.ts.map +1 -1
  58. package/dist/components/ContextMenu/hooks/useContextMenuSub/useContextMenuSub.d.ts.map +1 -1
  59. package/dist/components/ContextMenu/hooks/useContextMenuSub/useContextMenuSub.js +51 -49
  60. package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.d.ts +1 -1
  61. package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.d.ts.map +1 -1
  62. package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.js +71 -63
  63. package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.types.d.ts +4 -0
  64. package/dist/components/ContextMenu/hooks/useContextMenuSubMenu/useContextMenuSubMenu.types.d.ts.map +1 -1
  65. package/dist/components/ContextMenu/index.d.ts +1 -0
  66. package/dist/components/ContextMenu/index.d.ts.map +1 -1
  67. package/dist/components/ContextMenu/index.js +1 -1
  68. package/dist/{index-BA3njR2k.mjs → index-CYWNqEqR.mjs} +1 -1
  69. package/dist/{useContentPositioning-DO7ZotnD.mjs → useContentPositioning-BLEFxO0N.mjs} +66 -65
  70. package/package.json +1 -1
@@ -1,114 +1,119 @@
1
1
  import { jsx as b } from "react/jsx-runtime";
2
- import { forwardRef as K, useMemo as N, useId as W, useState as v, useRef as Y, useEffect as G } from "react";
3
- import { I as J } from "../../../../index-BA3njR2k.mjs";
4
- import { c as y } from "../../../../index-L8X2o7IH.mjs";
5
- import { mergeRefs as Q } from "../../../../lib/utils.js";
6
- import { useLevelContext as T } from "../../providers/LevelProvider/LevelProvider.js";
7
- import { useContextMenuContext as U } from "../../ContextMenu.context.js";
8
- import { hasItemIcon as k } from "../../utils/hasItemIcon/hasItemIcon.js";
9
- import "../../../../useContentPositioning-DO7ZotnD.mjs";
2
+ import { forwardRef as G, useMemo as D, useId as J, useState as R, useRef as Q, useEffect as T } from "react";
3
+ import { I as U } from "../../../../index-CYWNqEqR.mjs";
4
+ import { c as F } from "../../../../index-L8X2o7IH.mjs";
5
+ import { mergeRefs as V } from "../../../../lib/utils.js";
6
+ import { useLevelContext as X } from "../../providers/LevelProvider/LevelProvider.js";
7
+ import { useContextMenuContext as Z } from "../../ContextMenu.context.js";
8
+ import { hasItemIcon as O } from "../../utils/hasItemIcon/hasItemIcon.js";
9
+ import "../../../../useContentPositioning-BLEFxO0N.mjs";
10
10
  import "../Content/Content.utils.js";
11
- import { useContextMenuItemFocus as V } from "../../hooks/useContextMenuItemFocus/useContextMenuItemFocus.js";
12
- import { ContextMenuItemProvider as X } from "./Item.context.js";
13
- import '../../../../assets/Item2.css';const Z = "_item_zkanf_1", R = {
14
- item: Z
15
- }, s = "ContextMenu.Item", $ = K((t, p) => {
16
- const { hasItemWithIcon: x } = T(s);
11
+ import { useContextMenuItemFocus as $ } from "../../hooks/useContextMenuItemFocus/useContextMenuItemFocus.js";
12
+ import { ContextMenuItemProvider as ee } from "./Item.context.js";
13
+ import '../../../../assets/Item2.css';const te = "_item_zkanf_1", _ = {
14
+ item: te
15
+ }, s = "ContextMenu.Item", ne = G((t, p) => {
16
+ const { hasItemWithIcon: M } = X(s);
17
17
  if ("isSelectable" in t && t.isSelectable === !1) {
18
18
  const {
19
19
  className: e,
20
- children: I,
21
- isSelectable: j,
22
- hasIconCheckFn: q = k,
23
- ...z
24
- } = t, B = N(() => q(I), [I]);
20
+ children: C,
21
+ isSelectable: B,
22
+ hasIconCheckFn: K = O,
23
+ ...W
24
+ } = t, Y = D(() => K(C), [C]);
25
25
  return /* @__PURE__ */ b(
26
26
  "div",
27
27
  {
28
28
  ref: p,
29
- className: y(R.item, e),
30
- "data-not-selectable": !j,
31
- "data-no-icon-align": B || !x ? "" : void 0,
32
- ...z,
33
- children: I
29
+ className: F(_.item, e),
30
+ "data-not-selectable": !B,
31
+ "data-no-icon-align": Y || !M ? "" : void 0,
32
+ ...W,
33
+ children: C
34
34
  }
35
35
  );
36
36
  }
37
37
  const {
38
- className: D,
39
- children: a,
40
- isDisabled: C,
41
- isDanger: F,
42
- hasIconCheckFn: _ = k,
43
- onSelect: i,
44
- onFocus: r,
45
- onMouseEnter: c,
46
- onBlur: m,
47
- onMouseLeave: u,
48
- onKeyDown: l,
49
- ...w
50
- } = t, A = W(), [M, S] = v(!1), [o, E] = v(!1), n = Y(null), H = N(() => _(a), [a]), { closeMenuImmediately: L } = U(s), {
51
- dataHighlighted: O,
52
- onFocus: d,
53
- onMouseEnter: f,
54
- onBlur: h,
55
- onMouseLeave: g
56
- } = V({
38
+ className: w,
39
+ children: i,
40
+ isDisabled: x,
41
+ isDanger: A,
42
+ hasIconCheckFn: E = O,
43
+ onSelect: a,
44
+ onClick: r,
45
+ onFocus: c,
46
+ onMouseEnter: m,
47
+ onBlur: u,
48
+ onMouseLeave: l,
49
+ onKeyDown: d,
50
+ isCloseMenuOnClick: S = !0,
51
+ ...H
52
+ } = t, L = J(), [v, N] = R(!1), [n, P] = R(!1), o = Q(null), j = D(() => E(i), [i]), { closeMenuImmediately: k, isCloseOnClick: y } = Z(s), {
53
+ dataHighlighted: q,
54
+ onFocus: f,
55
+ onMouseEnter: h,
56
+ onBlur: g,
57
+ onMouseLeave: I
58
+ } = $({
57
59
  displayName: s,
58
- id: A,
59
- isDisabled: C,
60
- hasSubmenu: o
60
+ id: L,
61
+ isDisabled: x,
62
+ hasSubmenu: n
61
63
  });
62
- G(() => {
63
- if (!n.current)
64
+ T(() => {
65
+ if (!o.current)
64
66
  return;
65
- const e = n.current.querySelector("[data-submenu-trigger]");
66
- E(!!e);
67
- }, [n]);
68
- const P = (e) => {
69
- o && e.key === "ArrowRight" && S(!0), l == null || l(e);
67
+ const e = o.current.querySelector("[data-submenu-trigger]");
68
+ P(!!e);
69
+ }, [o]);
70
+ const z = (e) => {
71
+ n && e.key === "ArrowRight" && N(!0), d == null || d(e);
70
72
  };
71
73
  return /* @__PURE__ */ b(
72
- X,
74
+ ee,
73
75
  {
74
- hasSubmenu: o,
75
- subMenuOpen: M,
76
- setSubMenuOpen: S,
76
+ hasSubmenu: n,
77
+ subMenuOpen: v,
78
+ setSubMenuOpen: N,
77
79
  children: /* @__PURE__ */ b(
78
- J,
80
+ U,
79
81
  {
80
- ref: Q(p, n),
81
- className: y(R.item, D),
82
- disabled: C,
82
+ ref: V(p, o),
83
+ className: F(_.item, w),
84
+ disabled: x,
83
85
  "data-item": !0,
84
- "data-danger": F ? "" : void 0,
85
- "data-no-icon-align": H || !x ? "" : void 0,
86
- "data-has-submenu": o ? "" : void 0,
86
+ "data-danger": A ? "" : void 0,
87
+ "data-no-icon-align": j || !M ? "" : void 0,
88
+ "data-has-submenu": n ? "" : void 0,
87
89
  onSelect: (e) => {
88
- i == null || i(e), L(!0);
90
+ a == null || a(e), y && S && k(!0);
89
91
  },
90
- "data-highlighted": M || O,
92
+ onClick: (e) => {
93
+ e.preventDefault(), r == null || r(e), y && S && k(!0);
94
+ },
95
+ "data-highlighted": v || q,
91
96
  onFocus: (e) => {
92
- d == null || d(), r == null || r(e);
97
+ f == null || f(), c == null || c(e);
93
98
  },
94
99
  onMouseEnter: (e) => {
95
- f == null || f(e), c == null || c(e);
100
+ h == null || h(e), m == null || m(e);
96
101
  },
97
102
  onBlur: (e) => {
98
- h == null || h(), m == null || m(e);
103
+ g == null || g(), u == null || u(e);
99
104
  },
100
105
  onMouseLeave: (e) => {
101
- g == null || g(e), u == null || u(e);
106
+ I == null || I(e), l == null || l(e);
102
107
  },
103
- onKeyDown: P,
104
- ...w,
105
- children: a
108
+ onKeyDown: z,
109
+ ...H,
110
+ children: i
106
111
  }
107
112
  )
108
113
  }
109
114
  );
110
115
  });
111
- $.displayName = s;
116
+ ne.displayName = s;
112
117
  export {
113
- $ as Item
118
+ ne as Item
114
119
  };
@@ -15,6 +15,12 @@ export type SelectableItemProps = RadixItemProps & {
15
15
  * By default, the `hasItemIcon` from utils is used.
16
16
  */
17
17
  hasIconCheckFn?: (children: React.ReactNode) => boolean;
18
+ /**
19
+ * Whether the item should close the menu when clicked.
20
+ *
21
+ * @default true
22
+ */
23
+ isCloseMenuOnClick?: boolean;
18
24
  };
19
25
  export type NotSelectableItemProps = React.ComponentPropsWithRef<'div'> & {
20
26
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Item.props.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/components/Item/Item.props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEnF,KAAK,cAAc,GAAG,IAAI,CACxB,KAAK,CAAC,qBAAqB,CAAC,OAAO,qBAAqB,CAAC,EACzD,UAAU,CACX,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,GAAG;IACjD;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,KAAK,OAAO,CAAC;CACzD,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC,qBAAqB,CAAC,KAAK,CAAC,GAAG;IACxE;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,KAAK,OAAO,CAAC;CACzD,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,mBAAmB,GAAG,sBAAsB,CAAC;AAErE,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C"}
1
+ {"version":3,"file":"Item.props.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/components/Item/Item.props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEnF,KAAK,cAAc,GAAG,IAAI,CACxB,KAAK,CAAC,qBAAqB,CAAC,OAAO,qBAAqB,CAAC,EACzD,UAAU,CACX,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,GAAG;IACjD;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,KAAK,OAAO,CAAC;IACxD;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC,qBAAqB,CAAC,KAAK,CAAC,GAAG;IACxE;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,KAAK,OAAO,CAAC;CACzD,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,mBAAmB,GAAG,sBAAsB,CAAC;AAErE,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
2
  import { forwardRef as c, useRef as f, useEffect as a } from "react";
3
- import { e as d } from "../../../../index-BA3njR2k.mjs";
3
+ import { e as d } from "../../../../index-CYWNqEqR.mjs";
4
4
  import { c as p } from "../../../../index-L8X2o7IH.mjs";
5
5
  import { mergeRefs as I } from "../../../../lib/utils.js";
6
6
  import { useLevelContext as l } from "../../providers/LevelProvider/LevelProvider.js";
@@ -1,6 +1,6 @@
1
1
  import { jsx as m } from "react/jsx-runtime";
2
2
  import { forwardRef as s } from "react";
3
- import { L as n } from "../../../../index-BA3njR2k.mjs";
3
+ import { L as n } from "../../../../index-CYWNqEqR.mjs";
4
4
  import { c } from "../../../../index-L8X2o7IH.mjs";
5
5
  import { useLevelContext as i } from "../../providers/LevelProvider/LevelProvider.js";
6
6
  import { hasItemIcon as b } from "../../utils/hasItemIcon/hasItemIcon.js";
@@ -1,4 +1,4 @@
1
- import { P as o } from "../../../../index-BA3njR2k.mjs";
1
+ import { P as o } from "../../../../index-CYWNqEqR.mjs";
2
2
  const t = "ContextMenu.Portal", a = o;
3
3
  a.displayName = t;
4
4
  export {
@@ -1,5 +1,5 @@
1
1
  import { jsx as a } from "react/jsx-runtime";
2
- import { a as n } from "../../../../index-BA3njR2k.mjs";
2
+ import { a as n } from "../../../../index-CYWNqEqR.mjs";
3
3
  const r = "ContextMenu.RadioGroup", i = ({
4
4
  onChange: t,
5
5
  ...e
@@ -275,5 +275,6 @@ export declare const RadioItem: React.ForwardRefExoticComponent<{
275
275
  } & {
276
276
  isDisabled?: boolean;
277
277
  hasIconCheckFn?: (children: React.ReactNode) => boolean;
278
+ isCloseMenuOnClick?: boolean;
278
279
  } & React.RefAttributes<HTMLDivElement>>;
279
280
  //# sourceMappingURL=RadioItem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioItem.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/components/RadioItem/RadioItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAkB1D,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sCAFqB,SAEtC;wCA0EJ,CAAC"}
1
+ {"version":3,"file":"RadioItem.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/components/RadioItem/RadioItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAkB1D,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sCAFqB,SAEtC;;wCAyFJ,CAAC"}
@@ -1,70 +1,75 @@
1
- import { jsx as A } from "react/jsx-runtime";
2
- import { forwardRef as j, useId as u, useMemo as w } from "react";
3
- import { f as H } from "../../../../index-BA3njR2k.mjs";
4
- import { c as P } from "../../../../index-L8X2o7IH.mjs";
5
- import { useLevelContext as W } from "../../providers/LevelProvider/LevelProvider.js";
6
- import { useContextMenuContext as Y } from "../../ContextMenu.context.js";
7
- import { hasItemIcon as b } from "../../utils/hasItemIcon/hasItemIcon.js";
8
- import "../../../../useContentPositioning-DO7ZotnD.mjs";
1
+ import { jsx as w } from "react/jsx-runtime";
2
+ import { forwardRef as D, useId as H, useMemo as P } from "react";
3
+ import { f as W } from "../../../../index-CYWNqEqR.mjs";
4
+ import { c as Y } from "../../../../index-L8X2o7IH.mjs";
5
+ import { useLevelContext as b } from "../../providers/LevelProvider/LevelProvider.js";
6
+ import { useContextMenuContext as q } from "../../ContextMenu.context.js";
7
+ import { hasItemIcon as v } from "../../utils/hasItemIcon/hasItemIcon.js";
8
+ import "../../../../useContentPositioning-BLEFxO0N.mjs";
9
9
  import "../Content/Content.utils.js";
10
- import { useContextMenuItemFocus as k } from "../../hooks/useContextMenuItemFocus/useContextMenuItemFocus.js";
11
- import '../../../../assets/RadioItem.css';const q = "_radio_item_14d4r_1", z = {
12
- radio_item: q
13
- }, i = "ContextMenu.RadioItem", D = j(
10
+ import { useContextMenuItemFocus as z } from "../../hooks/useContextMenuItemFocus/useContextMenuItemFocus.js";
11
+ import '../../../../assets/RadioItem.css';const G = "_radio_item_14d4r_1", J = {
12
+ radio_item: G
13
+ }, m = "ContextMenu.RadioItem", K = D(
14
14
  ({
15
- className: I,
16
- children: m,
17
- isDisabled: x,
18
- hasIconCheckFn: _ = b,
15
+ className: R,
16
+ children: i,
17
+ isDisabled: _,
18
+ hasIconCheckFn: h = v,
19
19
  onFocus: o,
20
- onMouseEnter: a,
21
- onBlur: r,
20
+ onMouseEnter: r,
21
+ onBlur: a,
22
22
  onMouseLeave: s,
23
23
  onSelect: d,
24
- ...g
25
- }, n) => {
26
- const C = u(), { hasItemWithIcon: N } = W(i), { closeMenuImmediately: R } = Y(i), {
27
- dataHighlighted: h,
24
+ onClick: f,
25
+ isCloseMenuOnClick: c = !0,
26
+ ...u
27
+ }, y) => {
28
+ const n = H(), { hasItemWithIcon: A } = b(m), { closeMenuImmediately: g, isCloseOnClick: N } = q(m), {
29
+ dataHighlighted: C,
28
30
  onFocus: p,
29
- onMouseEnter: f,
30
- onBlur: c,
31
- onMouseLeave: e
32
- } = k({
33
- displayName: i,
34
- id: C,
35
- isDisabled: x
36
- }), y = w(() => _(m), [m]);
37
- return /* @__PURE__ */ A(
38
- H,
31
+ onMouseEnter: e,
32
+ onBlur: x,
33
+ onMouseLeave: I
34
+ } = z({
35
+ displayName: m,
36
+ id: n,
37
+ isDisabled: _
38
+ }), j = P(() => h(i), [i]);
39
+ return /* @__PURE__ */ w(
40
+ W,
39
41
  {
40
- ref: n,
41
- className: P(z.radio_item, I),
42
- disabled: x,
42
+ ref: y,
43
+ className: Y(J.radio_item, R),
44
+ disabled: _,
43
45
  "data-item": !0,
44
- "data-no-icon-align": y || !N ? "" : void 0,
45
- "data-highlighted": h,
46
+ "data-no-icon-align": j || !A ? "" : void 0,
47
+ "data-highlighted": C,
46
48
  onSelect: (t) => {
47
- R(!0), d == null || d(t);
49
+ d == null || d(t), N && c && g(!0);
50
+ },
51
+ onClick: (t) => {
52
+ t.preventDefault(), f == null || f(t), N && c && g(!0);
48
53
  },
49
54
  onFocus: (t) => {
50
55
  p == null || p(), o == null || o(t);
51
56
  },
52
57
  onMouseEnter: (t) => {
53
- f == null || f(t), a == null || a(t);
58
+ e == null || e(t), r == null || r(t);
54
59
  },
55
60
  onBlur: (t) => {
56
- c == null || c(), r == null || r(t);
61
+ x == null || x(), a == null || a(t);
57
62
  },
58
63
  onMouseLeave: (t) => {
59
- e == null || e(t), s == null || s(t);
64
+ I == null || I(t), s == null || s(t);
60
65
  },
61
- ...g,
62
- children: m
66
+ ...u,
67
+ children: i
63
68
  }
64
69
  );
65
70
  }
66
71
  );
67
- D.displayName = i;
72
+ K.displayName = m;
68
73
  export {
69
- D as RadioItem
74
+ K as RadioItem
70
75
  };
@@ -12,6 +12,10 @@ export type RadioItemProps = RadixRadioItemProps & {
12
12
  * By default, the `hasItemIcon` from utils is used.
13
13
  */
14
14
  hasIconCheckFn?: (children: React.ReactNode) => boolean;
15
+ /**
16
+ * Whether the RadioItem should close the menu when clicked.
17
+ */
18
+ isCloseMenuOnClick?: boolean;
15
19
  };
16
20
  export {};
17
21
  //# sourceMappingURL=RadioItem.props.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioItem.props.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/components/RadioItem/RadioItem.props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,IAAI,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAE7F,KAAK,mBAAmB,GAAG,IAAI,CAC7B,wBAAwB,CAAC,OAAO,0BAA0B,CAAC,EAC3D,UAAU,CACX,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,mBAAmB,GAAG;IACjD;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,KAAK,OAAO,CAAC;CACzD,CAAC"}
1
+ {"version":3,"file":"RadioItem.props.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/components/RadioItem/RadioItem.props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,IAAI,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAE7F,KAAK,mBAAmB,GAAG,IAAI,CAC7B,wBAAwB,CAAC,OAAO,0BAA0B,CAAC,EAC3D,UAAU,CACX,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,mBAAmB,GAAG;IACjD;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,KAAK,OAAO,CAAC;IACxD;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
2
  import { forwardRef as e } from "react";
3
- import { g as s } from "../../../../index-BA3njR2k.mjs";
3
+ import { g as s } from "../../../../index-CYWNqEqR.mjs";
4
4
  import { c as p } from "../../../../index-L8X2o7IH.mjs";
5
5
  import '../../../../assets/Separator.css';const m = "_separator_1k8lw_1", c = {
6
6
  separator: m
@@ -1,7 +1,7 @@
1
1
  import { default as React } from 'react';
2
- import { SubProps } from './Sub.props';
3
- export declare const Sub: {
4
- ({ children, mode, onOpen, defaultOpen, ...rest }: SubProps): React.JSX.Element;
5
- displayName: string;
6
- };
2
+ import { ContextMenuSubHandle } from './Sub.types';
3
+ export declare const Sub: React.ForwardRefExoticComponent<Omit<import('@radix-ui/react-dropdown-menu').DropdownMenuSubProps, "onOpenChange"> & {
4
+ mode?: import('../..').ContextMenuModeType;
5
+ onOpen?: (open: boolean) => void;
6
+ } & React.RefAttributes<ContextMenuSubHandle>>;
7
7
  //# sourceMappingURL=Sub.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Sub.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/components/Sub/Sub.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,eAAO,MAAM,GAAG;uDAOb,QAAQ;;CAwCV,CAAC"}
1
+ {"version":3,"file":"Sub.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/components/Sub/Sub.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAQ/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,eAAO,MAAM,GAAG;;;8CAiDf,CAAC"}
@@ -1,61 +1,60 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import { S as l } from "../../../../index-BA3njR2k.mjs";
3
- import "react";
4
- import { ContextMenuMode as x } from "../../ContextMenu.enums.js";
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { forwardRef as b, useImperativeHandle as x } from "react";
3
+ import { S as C } from "../../../../index-CYWNqEqR.mjs";
4
+ import { ContextMenuMode as O } from "../../ContextMenu.enums.js";
5
5
  import "../../providers/LevelProvider/LevelProvider.js";
6
- import "../../../../useContentPositioning-DO7ZotnD.mjs";
6
+ import "../../ContextMenu.context.js";
7
+ import "../../../../useContentPositioning-BLEFxO0N.mjs";
7
8
  import "../Content/Content.utils.js";
8
- import { useContextMenuSub as C } from "../../hooks/useContextMenuSub/useContextMenuSub.js";
9
- import { ContextMenuSubProvider as O, DISPLAY_NAME as t } from "./Sub.context.js";
10
- const f = ({
11
- children: i,
12
- mode: e = x.HOVER,
13
- onOpen: m,
14
- defaultOpen: o,
15
- ...p
16
- }) => {
17
- const {
18
- open: n,
19
- setOpen: a,
20
- animatedOpen: s,
21
- startAnimation: u,
22
- handleMouseEnter: d,
23
- handleMouseLeave: M,
24
- handleOpenChange: h,
25
- triggerId: S,
26
- onOpenByKeyboard: b
27
- } = C({
28
- displayName: t,
29
- mode: e,
30
- defaultOpen: o,
31
- onOpen: m
32
- });
33
- return /* @__PURE__ */ r(
34
- O,
35
- {
9
+ import { useContextMenuSub as g } from "../../hooks/useContextMenuSub/useContextMenuSub.js";
10
+ import { ContextMenuSubProvider as v, DISPLAY_NAME as m } from "./Sub.context.js";
11
+ const y = b(
12
+ ({ children: a, mode: e = O.HOVER, onOpen: i, defaultOpen: o, ...p }, s) => {
13
+ const {
14
+ open: r,
15
+ setOpen: n,
16
+ animatedOpen: u,
17
+ startAnimation: d,
18
+ handleMouseEnter: M,
19
+ handleMouseLeave: f,
20
+ handleOpenChange: h,
21
+ triggerId: l,
22
+ onOpenByKeyboard: S
23
+ } = g({
24
+ displayName: m,
36
25
  mode: e,
37
- open: n,
38
- setOpen: a,
39
- animatedOpen: s,
40
26
  defaultOpen: o,
41
- startAnimation: u,
42
- onMouseEnter: d,
43
- onMouseLeave: M,
44
- onOpenByKeyboard: b,
45
- triggerId: S,
46
- children: /* @__PURE__ */ r(
47
- l,
48
- {
49
- open: n,
50
- onOpenChange: h,
51
- ...p,
52
- children: i
53
- }
54
- )
55
- }
56
- );
57
- };
58
- f.displayName = t;
27
+ onOpen: i
28
+ });
29
+ return x(s, () => ({
30
+ setOpen: n
31
+ })), /* @__PURE__ */ t(
32
+ v,
33
+ {
34
+ mode: e,
35
+ open: r,
36
+ setOpen: n,
37
+ animatedOpen: u,
38
+ defaultOpen: o,
39
+ startAnimation: d,
40
+ onMouseEnter: M,
41
+ onMouseLeave: f,
42
+ onOpenByKeyboard: S,
43
+ triggerId: l,
44
+ children: /* @__PURE__ */ t(
45
+ C,
46
+ {
47
+ open: r,
48
+ onOpenChange: h,
49
+ ...p,
50
+ children: a
51
+ }
52
+ )
53
+ }
54
+ );
55
+ }
56
+ );
57
+ y.displayName = m;
59
58
  export {
60
- f as Sub
59
+ y as Sub
61
60
  };
@@ -0,0 +1,7 @@
1
+ export type ContextMenuSubHandle = {
2
+ /**
3
+ * Sets the open state of the submenu.
4
+ */
5
+ setOpen: (value: boolean) => void;
6
+ };
7
+ //# sourceMappingURL=Sub.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sub.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/components/Sub/Sub.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG;IACjC;;OAEG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACnC,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export { Sub } from './Sub';
2
2
  export { type SubProps } from './Sub.props';
3
+ export { type ContextMenuSubHandle } from './Sub.types';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/components/Sub/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/components/Sub/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SubContent.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/components/SubContent/SubContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgD,MAAM,OAAO,CAAC;AAiBrE,eAAO,MAAM,UAAU,+LAoGtB,CAAC"}
1
+ {"version":3,"file":"SubContent.d.ts","sourceRoot":"","sources":["../../../../../src/components/ContextMenu/components/SubContent/SubContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgD,MAAM,OAAO,CAAC;AAiBrE,eAAO,MAAM,UAAU,+LAuGtB,CAAC"}