@epam/ai-dial-ui-kit 0.14.0-dev.41 → 0.14.0-dev.45

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 (32) hide show
  1. package/dist/CHANGELOG.md +1 -0
  2. package/dist/{DateCellRenderer-p6k-mVZt.cjs → DateCellRenderer-BVM-Q8yx.cjs} +5 -5
  3. package/dist/DateCellRenderer-BYItGoO_.cjs +1 -0
  4. package/dist/JsonEditor-BlaSMX26.cjs +1 -0
  5. package/dist/{MarkdownEditor-CBH7ILah.cjs → MarkdownEditor-5kljDPcm.cjs} +1 -1
  6. package/dist/{MarkdownEditor-CMRC_XsQ.cjs → MarkdownEditor-C0_gU7Fi.cjs} +1 -1
  7. package/dist/MarkdownEditorContainer-BqTGQArV.cjs +1 -0
  8. package/dist/components/Analytics/BarGroup/BarGroup.js +60 -58
  9. package/dist/components/Grid/constants.js +8 -8
  10. package/dist/components/MarkdownEditor/MarkdownEditorContainer.js +16 -18
  11. package/dist/components/New/Dropdown/Dropdown.js +163 -152
  12. package/dist/components/New/Dropdown/DropdownSubMenuItem.js +75 -55
  13. package/dist/components/New/InteractiveTooltip/InteractiveTooltip.js +45 -44
  14. package/dist/components/New/Select/SelectSubMenuItem.js +26 -24
  15. package/dist/components-manifest.json +7 -3
  16. package/dist/dial-ui-kit.cjs +2 -2
  17. package/dist/editors.cjs +1 -1
  18. package/dist/file-manager.cjs +1 -1
  19. package/dist/grid.cjs +1 -1
  20. package/dist/index.css +1 -1
  21. package/dist/lazy-B1eG0EeX.cjs +1 -0
  22. package/dist/src/components/Analytics/BarGroup/BarGroup.d.ts +9 -2
  23. package/dist/src/models/dropdown.d.ts +23 -0
  24. package/dist/src/utils/sub-menu-floating.d.ts +1 -0
  25. package/dist/{use-file-manager-tabs-CIQjiyK-.cjs → use-file-manager-tabs-dJ-RvTEw.cjs} +1 -1
  26. package/dist/utils/sub-menu-floating.js +45 -38
  27. package/package.json +1 -1
  28. package/dist/DateCellRenderer-DNPEX0I7.cjs +0 -1
  29. package/dist/JsonEditor-BZCyPc2D.cjs +0 -1
  30. package/dist/MarkdownEditorContainer-B_6-Gd-T.cjs +0 -1
  31. package/dist/editor-BKQqPhwX.cjs +0 -1
  32. package/dist/lazy-CJ-0Pjkj.cjs +0 -1
@@ -1,102 +1,105 @@
1
- import { jsxs as A, Fragment as E, jsx as s } from "react/jsx-runtime";
2
- import { useFloating as pe, autoUpdate as me, offset as he, autoPlacement as ye, flip as ge, shift as we, size as xe, useClick as ve, useHover as ke, useDismiss as be, useRole as Ce, useInteractions as Ee, FloatingPortal as Pe, FloatingFocusManager as Me } from "@floating-ui/react";
3
- import { useState as _, useRef as De, useCallback as m, useId as Ae, useEffect as $, useMemo as Ie } from "react";
4
- import { DropdownTrigger as g, DropdownItemType as W } from "../../../types/dropdown.js";
5
- import { MenuItemMark as Ne } from "../../../types/menu-item.js";
6
- import { dropdownGap as w, dropdownDividerClassName as Oe, dropdownBaseClassName as Fe, dropdownListBaseClassName as Re } from "./constants.js";
7
- import { CloseButton as Se } from "../CloseButton/CloseButton.js";
8
- import { MenuItem as Le } from "../MenuItem/MenuItem.js";
9
- import { useThemeScope as Be } from "../ThemeScope/ThemeScope.js";
10
- import { mergeClasses as x } from "../../../utils/merge-classes.js";
11
- import { DropdownSubMenuItem as Te } from "./DropdownSubMenuItem.js";
12
- import { resolveItemMark as Ye, getItemRole as _e } from "./item-mark.js";
13
- const $e = '[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [role="option"]', We = (r) => !r.hasAttribute("disabled") && r.getAttribute("aria-disabled") !== "true", je = ["ArrowDown", "ArrowUp", "Home", "End"], Ke = (r, u, d) => {
14
- if (r === "Home") return 0;
15
- if (r === "End") return d - 1;
16
- const a = r === "ArrowDown" ? 1 : -1;
17
- return u === -1 ? a === 1 ? 0 : d - 1 : (u + a + d) % d;
18
- }, Ue = (r) => "clientWidth" in r ? r.clientWidth : r.getBoundingClientRect?.()?.width ?? 0, ot = ({
19
- children: r,
20
- items: u,
21
- onItemClick: d,
1
+ import { jsxs as N, Fragment as F, jsx as n } from "react/jsx-runtime";
2
+ import { useFloatingNodeId as me, useFloating as he, autoUpdate as ge, offset as ye, autoPlacement as we, flip as ve, shift as xe, size as Ce, useClick as ke, useHover as be, safePolygon as Pe, useDismiss as Ee, useRole as Ie, useInteractions as Ne, FloatingTree as Fe, FloatingNode as Me, FloatingPortal as De, FloatingFocusManager as Ae } from "@floating-ui/react";
3
+ import { useState as _, useRef as Oe, useCallback as m, useId as Re, useEffect as W, useMemo as Te, Fragment as Se } from "react";
4
+ import { InteractiveTooltip as Le } from "../InteractiveTooltip/InteractiveTooltip.js";
5
+ import { DropdownTrigger as y, DropdownItemType as j } from "../../../types/dropdown.js";
6
+ import { MenuItemMark as $e } from "../../../types/menu-item.js";
7
+ import { dropdownGap as w, dropdownDividerClassName as Be, dropdownBaseClassName as Ye, dropdownListBaseClassName as _e } from "./constants.js";
8
+ import { CloseButton as We } from "../CloseButton/CloseButton.js";
9
+ import { MenuItem as je } from "../MenuItem/MenuItem.js";
10
+ import { useThemeScope as Ke } from "../ThemeScope/ThemeScope.js";
11
+ import { mergeClasses as v } from "../../../utils/merge-classes.js";
12
+ import { DropdownSubMenuItem as Ue } from "./DropdownSubMenuItem.js";
13
+ import { resolveItemMark as Ve, getItemRole as Xe } from "./item-mark.js";
14
+ const qe = '[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [role="option"]', ze = (l) => !l.hasAttribute("disabled") && l.getAttribute("aria-disabled") !== "true", Ge = ["ArrowDown", "ArrowUp", "Home", "End"], He = (l, d, u) => {
15
+ if (l === "Home") return 0;
16
+ if (l === "End") return u - 1;
17
+ const a = l === "ArrowDown" ? 1 : -1;
18
+ return d === -1 ? a === 1 ? 0 : u - 1 : (d + a + u) % u;
19
+ }, Je = (l) => "clientWidth" in l ? l.clientWidth : l.getBoundingClientRect?.()?.width ?? 0, ut = ({
20
+ children: l,
21
+ items: d,
22
+ onItemClick: u,
22
23
  menuHeader: a,
23
24
  menuFooter: h,
24
25
  renderOverlay: P,
25
- trigger: f = [g.Click],
26
- placement: I,
26
+ trigger: f = [y.Click],
27
+ placement: M,
27
28
  disabled: i = !1,
28
- open: N,
29
- defaultOpen: j = !1,
30
- onOpenChange: O,
31
- closable: K = !1,
32
- onClose: U,
33
- className: V,
34
- overlayContentClassName: F,
29
+ open: D,
30
+ defaultOpen: K = !1,
31
+ onOpenChange: A,
32
+ closable: U = !1,
33
+ onClose: V,
34
+ className: X,
35
+ overlayContentClassName: O,
35
36
  separatorClassName: R,
36
- listClassName: X,
37
- outsidePressIgnoreRef: S,
38
- outsideClosable: q = !0,
39
- allowedPlacements: z,
40
- anchorToMouse: v = !1,
41
- matchReferenceWidth: M = !0,
42
- maxDropdownHeight: L
37
+ listClassName: q,
38
+ outsidePressIgnoreRef: T,
39
+ outsideClosable: z = !0,
40
+ allowedPlacements: G,
41
+ anchorToMouse: x = !1,
42
+ matchReferenceWidth: E = !0,
43
+ maxDropdownHeight: S
43
44
  }) => {
44
- const G = Be(), [H, J] = _(j), D = N !== void 0, c = D ? !!N : H, k = De(null), [Q, Z] = _(!0), n = m(
45
- (e, t, o) => {
46
- e && Z(o !== "hover" && o !== "safe-polygon"), D || J(e), O?.(e);
45
+ const H = Ke(), [J, Q] = _(K), I = D !== void 0, c = I ? !!D : J, C = Oe(null), [Z, ee] = _(!0), o = m(
46
+ (e, t, r) => {
47
+ e && ee(r !== "hover" && r !== "safe-polygon"), I || Q(e), A?.(e);
47
48
  },
48
- [D, O]
49
- ), B = Ae(), ee = I === void 0, { refs: p, floatingStyles: te, context: y } = pe({
50
- placement: I,
49
+ [I, A]
50
+ ), L = Re(), te = M === void 0, $ = me(), { refs: p, floatingStyles: ne, context: g } = he({
51
+ nodeId: $,
52
+ placement: M,
51
53
  open: c,
52
- onOpenChange: n,
53
- whileElementsMounted: me,
54
+ onOpenChange: o,
55
+ whileElementsMounted: ge,
54
56
  middleware: [
55
- he({ mainAxis: w, crossAxis: 0 }),
56
- ee ? ye({
57
+ ye({ mainAxis: w, crossAxis: 0 }),
58
+ te ? we({
57
59
  alignment: "start",
58
60
  crossAxis: !0,
59
61
  padding: w,
60
- allowedPlacements: z
61
- }) : ge({ padding: w }),
62
- we({ padding: w }),
63
- xe({
62
+ allowedPlacements: G
63
+ }) : ve({ padding: w }),
64
+ xe({ padding: w }),
65
+ Ce({
64
66
  padding: w,
65
- apply({ availableWidth: e, availableHeight: t, elements: o }) {
66
- const l = o.floating, C = Ue(o.reference);
67
- l.style.setProperty(
67
+ apply({ availableWidth: e, availableHeight: t, elements: r }) {
68
+ const s = r.floating, b = Je(r.reference);
69
+ s.style.setProperty(
68
70
  "--fui-available-height",
69
71
  `${Math.floor(t)}px`
70
- ), l.style.setProperty(
72
+ ), s.style.setProperty(
71
73
  "--reference-width",
72
- M ? `${Math.round(C)}px` : "0px"
73
- ), M ? l.style.minWidth = `${Math.round(C)}px` : l.style.removeProperty("min-width"), l.style.maxWidth = `${Math.floor(e)}px`;
74
+ E ? `${Math.round(b)}px` : "0px"
75
+ ), E ? s.style.minWidth = `${Math.round(b)}px` : s.style.removeProperty("min-width"), s.style.maxWidth = `${Math.floor(e)}px`;
74
76
  const Y = Math.floor(t);
75
- l.style.maxHeight = `${L ? Math.min(Y, L) : Y}px`;
77
+ s.style.maxHeight = `${S ? Math.min(Y, S) : Y}px`;
76
78
  }
77
79
  })
78
80
  ]
79
- }), ne = ve(y, {
80
- enabled: f.includes(g.Click) && !i
81
- }), oe = ke(y, {
82
- enabled: f.includes(g.Hover) && !i,
81
+ }), oe = ke(g, {
82
+ enabled: f.includes(y.Click) && !i
83
+ }), re = be(g, {
84
+ enabled: f.includes(y.Hover) && !i,
83
85
  move: !1,
84
86
  restMs: 40,
87
+ handleClose: Pe(),
85
88
  delay: { open: 80, close: 80 }
86
- }), re = be(y, {
89
+ }), se = Ee(g, {
87
90
  bubbles: !0,
88
91
  referencePress: !1,
89
92
  outsidePress: (e) => {
90
- if (!q) return !1;
93
+ if (!z) return !1;
91
94
  const t = e.target;
92
- return !(S?.current && t instanceof Node && S.current.contains(t));
95
+ return !(T?.current && t instanceof Node && T.current.contains(t));
93
96
  }
94
- }), se = Ce(y, { role: "menu" }), { getReferenceProps: le, getFloatingProps: ie } = Ee([
95
- ne,
97
+ }), le = Ie(g, { role: "menu" }), { getReferenceProps: ie, getFloatingProps: ce } = Ne([
96
98
  oe,
97
99
  re,
98
- se
99
- ]), b = m(
100
+ se,
101
+ le
102
+ ]), k = m(
100
103
  (e, t) => {
101
104
  p.setPositionReference({
102
105
  getBoundingClientRect: () => ({
@@ -112,71 +115,71 @@ const $e = '[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]
112
115
  });
113
116
  },
114
117
  [p]
115
- ), ce = m(
118
+ ), ae = m(
116
119
  (e) => {
117
- !f.includes(g.ContextMenu) || i || (e.preventDefault(), v && (b(e.clientX, e.clientY), k.current = document.elementFromPoint(
120
+ !f.includes(y.ContextMenu) || i || (e.preventDefault(), x && (k(e.clientX, e.clientY), C.current = document.elementFromPoint(
118
121
  e.clientX,
119
122
  e.clientY
120
- )), n(!0));
123
+ )), o(!0));
121
124
  },
122
- [v, i, n, b, f]
123
- ), ae = m(
125
+ [x, i, o, k, f]
126
+ ), de = m(
124
127
  (e) => {
125
- !v || i || (f.includes(g.ContextMenu) && c && n(!1), b(e.clientX, e.clientY), k.current = document.elementFromPoint(
128
+ !x || i || (f.includes(y.ContextMenu) && c && o(!1), k(e.clientX, e.clientY), C.current = document.elementFromPoint(
126
129
  e.clientX,
127
130
  e.clientY
128
131
  ));
129
132
  },
130
- [v, i, b, c, f, n]
133
+ [x, i, k, c, f, o]
131
134
  );
132
- $(() => {
133
- i && c && n(!1);
134
- }, [i, c, n]);
135
+ W(() => {
136
+ i && c && o(!1);
137
+ }, [i, c, o]);
135
138
  const ue = m(
136
139
  (e) => {
137
- if (e.defaultPrevented || !je.includes(e.key)) return;
140
+ if (e.defaultPrevented || !Ge.includes(e.key)) return;
138
141
  const t = Array.from(
139
142
  e.currentTarget.querySelectorAll(
140
- $e
143
+ qe
141
144
  )
142
- ).filter(We);
145
+ ).filter(ze);
143
146
  if (t.length === 0) return;
144
147
  e.preventDefault();
145
- const o = e.currentTarget.ownerDocument.activeElement, l = t.findIndex((C) => C === o);
146
- t[Ke(e.key, l, t.length)]?.focus();
148
+ const r = e.currentTarget.ownerDocument.activeElement, s = t.findIndex((b) => b === r);
149
+ t[He(e.key, s, t.length)]?.focus();
147
150
  },
148
151
  []
149
- ), T = m(
152
+ ), B = m(
150
153
  (e) => (t) => {
151
- e.disabled || (e.onClick?.({ key: e.key, domEvent: t }), d?.({ key: e.key, domEvent: t }), e.selectable || n(!1));
154
+ e.disabled || (e.onClick?.({ key: e.key, domEvent: t }), u?.({ key: e.key, domEvent: t }), e.selectable || o(!1));
152
155
  },
153
- [d, n]
154
- ), de = Ie(() => P ? P() : u ? /* @__PURE__ */ A(E, { children: [
155
- a && /* @__PURE__ */ s(E, { children: typeof a == "function" ? a() : a }),
156
- /* @__PURE__ */ s(
156
+ [u, o]
157
+ ), fe = Te(() => P ? P() : d ? /* @__PURE__ */ N(F, { children: [
158
+ a && /* @__PURE__ */ n(F, { children: typeof a == "function" ? a() : a }),
159
+ /* @__PURE__ */ n(
157
160
  "div",
158
161
  {
159
162
  role: "none",
160
- className: x("py-1", F),
163
+ className: v("py-1", O),
161
164
  "aria-label": "dropdown",
162
- children: u.map((e) => {
163
- if (e.type === W.Divider)
164
- return /* @__PURE__ */ s(
165
+ children: d.map((e) => {
166
+ if (e.type === j.Divider)
167
+ return /* @__PURE__ */ n(
165
168
  "div",
166
169
  {
167
170
  role: "separator",
168
- className: x(
169
- Oe,
171
+ className: v(
172
+ Be,
170
173
  R
171
174
  )
172
175
  },
173
176
  e.key
174
177
  );
175
- if (e.type === W.PlainText)
176
- return /* @__PURE__ */ s(
178
+ if (e.type === j.PlainText)
179
+ return /* @__PURE__ */ n(
177
180
  "div",
178
181
  {
179
- className: x(
182
+ className: v(
180
183
  "px-3 py-2 text-secondary dial-caption-text",
181
184
  e.className
182
185
  ),
@@ -185,21 +188,20 @@ const $e = '[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]
185
188
  e.key
186
189
  );
187
190
  if (e.children?.length)
188
- return /* @__PURE__ */ s(
189
- Te,
191
+ return /* @__PURE__ */ n(
192
+ Ue,
190
193
  {
191
194
  item: e,
192
- onRootClose: () => n(!1)
195
+ onRootClose: () => o(!1)
193
196
  },
194
197
  e.key
195
198
  );
196
- const t = Ye(e), o = _e(e);
197
- return /* @__PURE__ */ s(
198
- Le,
199
+ const t = Ve(e), r = Xe(e), s = /* @__PURE__ */ n(
200
+ je,
199
201
  {
200
- role: o,
201
- "aria-checked": o === "menuitem" ? void 0 : !!e.checked,
202
- "aria-current": t === Ne.Highlight && e.checked ? !0 : void 0,
202
+ role: r,
203
+ "aria-checked": r === "menuitem" ? void 0 : !!e.checked,
204
+ "aria-current": t === $e.Highlight && e.checked ? !0 : void 0,
203
205
  "aria-disabled": !!e.disabled,
204
206
  disabled: e.disabled,
205
207
  mark: t,
@@ -209,96 +211,105 @@ const $e = '[role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"]
209
211
  label: e.label,
210
212
  className: e.className,
211
213
  rightControl: e.rightControl,
212
- onClick: T(e),
214
+ onClick: B(e),
213
215
  children: e.renderItem?.(e)
214
- },
215
- e.key
216
+ }
216
217
  );
218
+ return /* @__PURE__ */ n(Se, { children: e.interactiveTooltip ? /* @__PURE__ */ n(
219
+ Le,
220
+ {
221
+ asChild: !0,
222
+ placement: e.interactiveTooltip.placement,
223
+ content: e.interactiveTooltip.content,
224
+ contentClassName: e.interactiveTooltip.contentClassName,
225
+ children: s
226
+ }
227
+ ) : s }, e.key);
217
228
  })
218
229
  }
219
230
  ),
220
- h && /* @__PURE__ */ s(E, { children: typeof h == "function" ? h() : h })
231
+ h && /* @__PURE__ */ n(F, { children: typeof h == "function" ? h() : h })
221
232
  ] }) : null, [
222
- T,
223
- u,
233
+ B,
234
+ d,
224
235
  h,
225
236
  a,
226
237
  P,
227
- n,
228
- F,
238
+ o,
239
+ O,
229
240
  R
230
- ]), fe = le({
231
- onContextMenu: ce,
232
- onMouseDown: ae
241
+ ]), pe = ie({
242
+ onContextMenu: ae,
243
+ onMouseDown: de
233
244
  });
234
- return $(() => {
245
+ return W(() => {
235
246
  if (!c) return;
236
247
  const e = p.reference.current;
237
248
  let t = null;
238
- if (e instanceof Element ? t = e : k.current instanceof Element && (t = k.current), !t) return;
239
- const o = new IntersectionObserver(
240
- ([l]) => {
241
- l.isIntersecting || n(!1);
249
+ if (e instanceof Element ? t = e : C.current instanceof Element && (t = C.current), !t) return;
250
+ const r = new IntersectionObserver(
251
+ ([s]) => {
252
+ s.isIntersecting || o(!1);
242
253
  },
243
254
  { root: null, threshold: 0 }
244
255
  );
245
- return o.observe(t), () => o.disconnect();
246
- }, [c, p.reference, n]), /* @__PURE__ */ A(E, { children: [
247
- /* @__PURE__ */ s(
256
+ return r.observe(t), () => r.disconnect();
257
+ }, [c, p.reference, o]), /* @__PURE__ */ n(Fe, { children: /* @__PURE__ */ N(Me, { id: $, children: [
258
+ /* @__PURE__ */ n(
248
259
  "span",
249
260
  {
250
261
  ref: p.setReference,
251
- className: x(
252
- Fe,
262
+ className: v(
263
+ Ye,
253
264
  i && "!cursor-not-allowed opacity-75",
254
- V
265
+ X
255
266
  ),
256
267
  "aria-haspopup": "menu",
257
268
  "aria-expanded": c,
258
- "aria-controls": B,
259
- ...fe,
260
- children: r
269
+ "aria-controls": L,
270
+ ...pe,
271
+ children: l
261
272
  }
262
273
  ),
263
- c && /* @__PURE__ */ s(Pe, { children: /* @__PURE__ */ s(
264
- Me,
274
+ c && /* @__PURE__ */ n(De, { children: /* @__PURE__ */ n(
275
+ Ae,
265
276
  {
266
- context: y,
277
+ context: g,
267
278
  modal: !1,
268
- initialFocus: Q ? 0 : -1,
279
+ initialFocus: Z ? 0 : -1,
269
280
  returnFocus: !0,
270
- children: /* @__PURE__ */ A(
281
+ children: /* @__PURE__ */ N(
271
282
  "div",
272
283
  {
273
- id: B,
284
+ id: L,
274
285
  ref: p.setFloating,
275
- style: te,
276
- className: x(
277
- Re,
278
- !M && "w-max",
286
+ style: ne,
287
+ className: v(
288
+ _e,
289
+ !E && "w-max",
279
290
  "overflow-auto",
280
- G,
281
- X
291
+ H,
292
+ q
282
293
  ),
283
- ...ie({ onKeyDown: ue }),
294
+ ...ce({ onKeyDown: ue }),
284
295
  children: [
285
- K && /* @__PURE__ */ s("div", { className: "flex items-center justify-between px-2 pt-2", children: /* @__PURE__ */ s(
286
- Se,
296
+ U && /* @__PURE__ */ n("div", { className: "flex items-center justify-between px-2 pt-2", children: /* @__PURE__ */ n(
297
+ We,
287
298
  {
288
299
  ariaLabel: "Close dropdown",
289
300
  onClose: (e) => {
290
- U?.(e), n(!1);
301
+ V?.(e), o(!1);
291
302
  }
292
303
  }
293
304
  ) }),
294
- de
305
+ fe
295
306
  ]
296
307
  }
297
308
  )
298
309
  }
299
310
  ) })
300
- ] });
311
+ ] }) });
301
312
  };
302
313
  export {
303
- ot as Dropdown
314
+ ut as Dropdown
304
315
  };
@@ -1,64 +1,75 @@
1
- import { jsxs as t, Fragment as d, jsx as a } from "react/jsx-runtime";
2
- import { useCallback as g } from "react";
3
- import { MenuItem as l } from "../MenuItem/MenuItem.js";
4
- import { MenuItemMark as k } from "../../../types/menu-item.js";
5
- import { useSubMenuFloating as M, SubMenuPanel as C } from "../../../utils/sub-menu-floating.js";
6
- import { getItemRole as I, resolveItemMark as m } from "./item-mark.js";
7
- import { dropdownGap as F, submenuCaretIcon as S, dropdownSubMenuClassName as y } from "./constants.js";
8
- const R = ({
9
- item: r,
10
- onRootClose: o
1
+ import { jsx as r, jsxs as c, Fragment as v } from "react/jsx-runtime";
2
+ import { FloatingNode as N } from "@floating-ui/react";
3
+ import { useCallback as F, Fragment as I } from "react";
4
+ import { InteractiveTooltip as u } from "../InteractiveTooltip/InteractiveTooltip.js";
5
+ import { MenuItem as d } from "../MenuItem/MenuItem.js";
6
+ import { MenuItemMark as M } from "../../../types/menu-item.js";
7
+ import { useSubMenuFloating as T, SubMenuPanel as S } from "../../../utils/sub-menu-floating.js";
8
+ import { getItemRole as y, resolveItemMark as m } from "./item-mark.js";
9
+ import { dropdownGap as x, submenuCaretIcon as H, dropdownSubMenuClassName as w } from "./constants.js";
10
+ const q = ({
11
+ item: n,
12
+ onRootClose: a
11
13
  }) => {
12
14
  const {
13
- isOpen: s,
14
- refs: u,
15
+ isOpen: t,
16
+ nodeId: p,
17
+ refs: s,
15
18
  floatingStyles: b,
16
- context: p,
17
- getReferenceProps: c,
18
- getFloatingProps: f
19
- } = M(F, "menu", !!r.disabled), i = g(
20
- (e) => (n) => {
21
- e.disabled || (e.onClick?.({ key: e.key, domEvent: n }), e.selectable || o());
19
+ context: f,
20
+ getReferenceProps: g,
21
+ getFloatingProps: C
22
+ } = T(x, "menu", !!n.disabled), k = F(
23
+ (e) => (o) => {
24
+ e.disabled || (e.onClick?.({ key: e.key, domEvent: o }), e.selectable || a());
22
25
  },
23
- [o]
26
+ [a]
27
+ ), l = /* @__PURE__ */ r(
28
+ d,
29
+ {
30
+ ref: s.setReference,
31
+ role: "menuitem",
32
+ "aria-haspopup": "menu",
33
+ "aria-expanded": t,
34
+ "aria-disabled": !!n.disabled,
35
+ disabled: n.disabled,
36
+ icon: n.icon,
37
+ label: n.label,
38
+ trailing: H,
39
+ className: n.className,
40
+ ...g(),
41
+ children: n.renderItem?.(n)
42
+ }
24
43
  );
25
- return /* @__PURE__ */ t(d, { children: [
26
- /* @__PURE__ */ a(
27
- l,
44
+ return /* @__PURE__ */ c(N, { id: p, children: [
45
+ n.interactiveTooltip ? /* @__PURE__ */ r(
46
+ u,
28
47
  {
29
- ref: u.setReference,
30
- role: "menuitem",
31
- "aria-haspopup": "menu",
32
- "aria-expanded": s,
33
- "aria-disabled": !!r.disabled,
34
- disabled: r.disabled,
35
- icon: r.icon,
36
- label: r.label,
37
- trailing: S,
38
- className: r.className,
39
- ...c(),
40
- children: r.renderItem?.(r)
48
+ asChild: !0,
49
+ placement: n.interactiveTooltip.placement,
50
+ content: n.interactiveTooltip.content,
51
+ contentClassName: n.interactiveTooltip.contentClassName,
52
+ children: l
41
53
  }
42
- ),
43
- s && /* @__PURE__ */ a(
44
- C,
54
+ ) : l,
55
+ t && /* @__PURE__ */ r(
56
+ S,
45
57
  {
46
- refs: u,
58
+ refs: s,
47
59
  floatingStyles: b,
48
- context: p,
49
- getFloatingProps: f,
60
+ context: f,
61
+ getFloatingProps: C,
50
62
  role: "menu",
51
- surfaceClassName: y,
52
- children: r.renderSubMenu ? r.renderSubMenu() : /* @__PURE__ */ t(d, { children: [
53
- r.menuHeader && (typeof r.menuHeader == "function" ? r.menuHeader() : r.menuHeader),
54
- r.children.map((e) => {
55
- const n = I(e);
56
- return /* @__PURE__ */ a(
57
- l,
63
+ surfaceClassName: w,
64
+ children: n.renderSubMenu ? n.renderSubMenu() : /* @__PURE__ */ c(v, { children: [
65
+ n.menuHeader && (typeof n.menuHeader == "function" ? n.menuHeader() : n.menuHeader),
66
+ n.children.map((e) => {
67
+ const o = y(e), i = /* @__PURE__ */ r(
68
+ d,
58
69
  {
59
- role: n,
60
- "aria-checked": n === "menuitem" ? void 0 : !!e.checked,
61
- "aria-current": m(e) === k.Highlight && e.checked ? !0 : void 0,
70
+ role: o,
71
+ "aria-checked": o === "menuitem" ? void 0 : !!e.checked,
72
+ "aria-current": m(e) === M.Highlight && e.checked ? !0 : void 0,
62
73
  "aria-disabled": !!e.disabled,
63
74
  disabled: e.disabled,
64
75
  mark: m(e),
@@ -68,18 +79,27 @@ const R = ({
68
79
  label: e.label,
69
80
  className: e.className,
70
81
  rightControl: e.rightControl,
71
- onClick: i(e),
82
+ onClick: k(e),
72
83
  children: e.renderItem?.(e)
73
- },
74
- e.key
84
+ }
75
85
  );
86
+ return /* @__PURE__ */ r(I, { children: e.interactiveTooltip ? /* @__PURE__ */ r(
87
+ u,
88
+ {
89
+ asChild: !0,
90
+ placement: e.interactiveTooltip.placement,
91
+ content: e.interactiveTooltip.content,
92
+ contentClassName: e.interactiveTooltip.contentClassName,
93
+ children: i
94
+ }
95
+ ) : i }, e.key);
76
96
  }),
77
- r.menuFooter && (typeof r.menuFooter == "function" ? r.menuFooter() : r.menuFooter)
97
+ n.menuFooter && (typeof n.menuFooter == "function" ? n.menuFooter() : n.menuFooter)
78
98
  ] })
79
99
  }
80
100
  )
81
101
  ] });
82
102
  };
83
103
  export {
84
- R as DropdownSubMenuItem
104
+ q as DropdownSubMenuItem
85
105
  };