@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.
- package/dist/CHANGELOG.md +1 -0
- package/dist/{DateCellRenderer-p6k-mVZt.cjs → DateCellRenderer-BVM-Q8yx.cjs} +5 -5
- package/dist/DateCellRenderer-BYItGoO_.cjs +1 -0
- package/dist/JsonEditor-BlaSMX26.cjs +1 -0
- package/dist/{MarkdownEditor-CBH7ILah.cjs → MarkdownEditor-5kljDPcm.cjs} +1 -1
- package/dist/{MarkdownEditor-CMRC_XsQ.cjs → MarkdownEditor-C0_gU7Fi.cjs} +1 -1
- package/dist/MarkdownEditorContainer-BqTGQArV.cjs +1 -0
- package/dist/components/Analytics/BarGroup/BarGroup.js +60 -58
- package/dist/components/Grid/constants.js +8 -8
- package/dist/components/MarkdownEditor/MarkdownEditorContainer.js +16 -18
- package/dist/components/New/Dropdown/Dropdown.js +163 -152
- package/dist/components/New/Dropdown/DropdownSubMenuItem.js +75 -55
- package/dist/components/New/InteractiveTooltip/InteractiveTooltip.js +45 -44
- package/dist/components/New/Select/SelectSubMenuItem.js +26 -24
- package/dist/components-manifest.json +7 -3
- package/dist/dial-ui-kit.cjs +2 -2
- package/dist/editors.cjs +1 -1
- package/dist/file-manager.cjs +1 -1
- package/dist/grid.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/lazy-B1eG0EeX.cjs +1 -0
- package/dist/src/components/Analytics/BarGroup/BarGroup.d.ts +9 -2
- package/dist/src/models/dropdown.d.ts +23 -0
- package/dist/src/utils/sub-menu-floating.d.ts +1 -0
- package/dist/{use-file-manager-tabs-CIQjiyK-.cjs → use-file-manager-tabs-dJ-RvTEw.cjs} +1 -1
- package/dist/utils/sub-menu-floating.js +45 -38
- package/package.json +1 -1
- package/dist/DateCellRenderer-DNPEX0I7.cjs +0 -1
- package/dist/JsonEditor-BZCyPc2D.cjs +0 -1
- package/dist/MarkdownEditorContainer-B_6-Gd-T.cjs +0 -1
- package/dist/editor-BKQqPhwX.cjs +0 -1
- package/dist/lazy-CJ-0Pjkj.cjs +0 -1
|
@@ -1,102 +1,105 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useFloating as
|
|
3
|
-
import { useState as _, useRef as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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 = [
|
|
26
|
-
placement:
|
|
26
|
+
trigger: f = [y.Click],
|
|
27
|
+
placement: M,
|
|
27
28
|
disabled: i = !1,
|
|
28
|
-
open:
|
|
29
|
-
defaultOpen:
|
|
30
|
-
onOpenChange:
|
|
31
|
-
closable:
|
|
32
|
-
onClose:
|
|
33
|
-
className:
|
|
34
|
-
overlayContentClassName:
|
|
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:
|
|
37
|
-
outsidePressIgnoreRef:
|
|
38
|
-
outsideClosable:
|
|
39
|
-
allowedPlacements:
|
|
40
|
-
anchorToMouse:
|
|
41
|
-
matchReferenceWidth:
|
|
42
|
-
maxDropdownHeight:
|
|
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
|
|
45
|
-
(e, t,
|
|
46
|
-
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
|
-
[
|
|
49
|
-
),
|
|
50
|
-
|
|
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:
|
|
53
|
-
whileElementsMounted:
|
|
54
|
+
onOpenChange: o,
|
|
55
|
+
whileElementsMounted: ge,
|
|
54
56
|
middleware: [
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
ye({ mainAxis: w, crossAxis: 0 }),
|
|
58
|
+
te ? we({
|
|
57
59
|
alignment: "start",
|
|
58
60
|
crossAxis: !0,
|
|
59
61
|
padding: w,
|
|
60
|
-
allowedPlacements:
|
|
61
|
-
}) :
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
allowedPlacements: G
|
|
63
|
+
}) : ve({ padding: w }),
|
|
64
|
+
xe({ padding: w }),
|
|
65
|
+
Ce({
|
|
64
66
|
padding: w,
|
|
65
|
-
apply({ availableWidth: e, availableHeight: t, elements:
|
|
66
|
-
const
|
|
67
|
-
|
|
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
|
-
),
|
|
72
|
+
), s.style.setProperty(
|
|
71
73
|
"--reference-width",
|
|
72
|
-
|
|
73
|
-
),
|
|
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
|
-
|
|
77
|
+
s.style.maxHeight = `${S ? Math.min(Y, S) : Y}px`;
|
|
76
78
|
}
|
|
77
79
|
})
|
|
78
80
|
]
|
|
79
|
-
}),
|
|
80
|
-
enabled: f.includes(
|
|
81
|
-
}),
|
|
82
|
-
enabled: f.includes(
|
|
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
|
-
}),
|
|
89
|
+
}), se = Ee(g, {
|
|
87
90
|
bubbles: !0,
|
|
88
91
|
referencePress: !1,
|
|
89
92
|
outsidePress: (e) => {
|
|
90
|
-
if (!
|
|
93
|
+
if (!z) return !1;
|
|
91
94
|
const t = e.target;
|
|
92
|
-
return !(
|
|
95
|
+
return !(T?.current && t instanceof Node && T.current.contains(t));
|
|
93
96
|
}
|
|
94
|
-
}),
|
|
95
|
-
ne,
|
|
97
|
+
}), le = Ie(g, { role: "menu" }), { getReferenceProps: ie, getFloatingProps: ce } = Ne([
|
|
96
98
|
oe,
|
|
97
99
|
re,
|
|
98
|
-
se
|
|
99
|
-
|
|
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
|
-
),
|
|
118
|
+
), ae = m(
|
|
116
119
|
(e) => {
|
|
117
|
-
!f.includes(
|
|
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
|
-
)),
|
|
123
|
+
)), o(!0));
|
|
121
124
|
},
|
|
122
|
-
[
|
|
123
|
-
),
|
|
125
|
+
[x, i, o, k, f]
|
|
126
|
+
), de = m(
|
|
124
127
|
(e) => {
|
|
125
|
-
!
|
|
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
|
-
[
|
|
133
|
+
[x, i, k, c, f, o]
|
|
131
134
|
);
|
|
132
|
-
|
|
133
|
-
i && c &&
|
|
134
|
-
}, [i, c,
|
|
135
|
+
W(() => {
|
|
136
|
+
i && c && o(!1);
|
|
137
|
+
}, [i, c, o]);
|
|
135
138
|
const ue = m(
|
|
136
139
|
(e) => {
|
|
137
|
-
if (e.defaultPrevented || !
|
|
140
|
+
if (e.defaultPrevented || !Ge.includes(e.key)) return;
|
|
138
141
|
const t = Array.from(
|
|
139
142
|
e.currentTarget.querySelectorAll(
|
|
140
|
-
|
|
143
|
+
qe
|
|
141
144
|
)
|
|
142
|
-
).filter(
|
|
145
|
+
).filter(ze);
|
|
143
146
|
if (t.length === 0) return;
|
|
144
147
|
e.preventDefault();
|
|
145
|
-
const
|
|
146
|
-
t[
|
|
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
|
-
),
|
|
152
|
+
), B = m(
|
|
150
153
|
(e) => (t) => {
|
|
151
|
-
e.disabled || (e.onClick?.({ key: e.key, domEvent: t }),
|
|
154
|
+
e.disabled || (e.onClick?.({ key: e.key, domEvent: t }), u?.({ key: e.key, domEvent: t }), e.selectable || o(!1));
|
|
152
155
|
},
|
|
153
|
-
[
|
|
154
|
-
),
|
|
155
|
-
a && /* @__PURE__ */
|
|
156
|
-
/* @__PURE__ */
|
|
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:
|
|
163
|
+
className: v("py-1", O),
|
|
161
164
|
"aria-label": "dropdown",
|
|
162
|
-
children:
|
|
163
|
-
if (e.type ===
|
|
164
|
-
return /* @__PURE__ */
|
|
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:
|
|
169
|
-
|
|
171
|
+
className: v(
|
|
172
|
+
Be,
|
|
170
173
|
R
|
|
171
174
|
)
|
|
172
175
|
},
|
|
173
176
|
e.key
|
|
174
177
|
);
|
|
175
|
-
if (e.type ===
|
|
176
|
-
return /* @__PURE__ */
|
|
178
|
+
if (e.type === j.PlainText)
|
|
179
|
+
return /* @__PURE__ */ n(
|
|
177
180
|
"div",
|
|
178
181
|
{
|
|
179
|
-
className:
|
|
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__ */
|
|
189
|
-
|
|
191
|
+
return /* @__PURE__ */ n(
|
|
192
|
+
Ue,
|
|
190
193
|
{
|
|
191
194
|
item: e,
|
|
192
|
-
onRootClose: () =>
|
|
195
|
+
onRootClose: () => o(!1)
|
|
193
196
|
},
|
|
194
197
|
e.key
|
|
195
198
|
);
|
|
196
|
-
const t =
|
|
197
|
-
|
|
198
|
-
Le,
|
|
199
|
+
const t = Ve(e), r = Xe(e), s = /* @__PURE__ */ n(
|
|
200
|
+
je,
|
|
199
201
|
{
|
|
200
|
-
role:
|
|
201
|
-
"aria-checked":
|
|
202
|
-
"aria-current": t ===
|
|
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:
|
|
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__ */
|
|
231
|
+
h && /* @__PURE__ */ n(F, { children: typeof h == "function" ? h() : h })
|
|
221
232
|
] }) : null, [
|
|
222
|
-
|
|
223
|
-
|
|
233
|
+
B,
|
|
234
|
+
d,
|
|
224
235
|
h,
|
|
225
236
|
a,
|
|
226
237
|
P,
|
|
227
|
-
|
|
228
|
-
|
|
238
|
+
o,
|
|
239
|
+
O,
|
|
229
240
|
R
|
|
230
|
-
]),
|
|
231
|
-
onContextMenu:
|
|
232
|
-
onMouseDown:
|
|
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 :
|
|
239
|
-
const
|
|
240
|
-
([
|
|
241
|
-
|
|
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
|
|
246
|
-
}, [c, p.reference,
|
|
247
|
-
/* @__PURE__ */
|
|
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:
|
|
252
|
-
|
|
262
|
+
className: v(
|
|
263
|
+
Ye,
|
|
253
264
|
i && "!cursor-not-allowed opacity-75",
|
|
254
|
-
|
|
265
|
+
X
|
|
255
266
|
),
|
|
256
267
|
"aria-haspopup": "menu",
|
|
257
268
|
"aria-expanded": c,
|
|
258
|
-
"aria-controls":
|
|
259
|
-
...
|
|
260
|
-
children:
|
|
269
|
+
"aria-controls": L,
|
|
270
|
+
...pe,
|
|
271
|
+
children: l
|
|
261
272
|
}
|
|
262
273
|
),
|
|
263
|
-
c && /* @__PURE__ */
|
|
264
|
-
|
|
274
|
+
c && /* @__PURE__ */ n(De, { children: /* @__PURE__ */ n(
|
|
275
|
+
Ae,
|
|
265
276
|
{
|
|
266
|
-
context:
|
|
277
|
+
context: g,
|
|
267
278
|
modal: !1,
|
|
268
|
-
initialFocus:
|
|
279
|
+
initialFocus: Z ? 0 : -1,
|
|
269
280
|
returnFocus: !0,
|
|
270
|
-
children: /* @__PURE__ */
|
|
281
|
+
children: /* @__PURE__ */ N(
|
|
271
282
|
"div",
|
|
272
283
|
{
|
|
273
|
-
id:
|
|
284
|
+
id: L,
|
|
274
285
|
ref: p.setFloating,
|
|
275
|
-
style:
|
|
276
|
-
className:
|
|
277
|
-
|
|
278
|
-
!
|
|
286
|
+
style: ne,
|
|
287
|
+
className: v(
|
|
288
|
+
_e,
|
|
289
|
+
!E && "w-max",
|
|
279
290
|
"overflow-auto",
|
|
280
|
-
|
|
281
|
-
|
|
291
|
+
H,
|
|
292
|
+
q
|
|
282
293
|
),
|
|
283
|
-
...
|
|
294
|
+
...ce({ onKeyDown: ue }),
|
|
284
295
|
children: [
|
|
285
|
-
|
|
286
|
-
|
|
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
|
-
|
|
301
|
+
V?.(e), o(!1);
|
|
291
302
|
}
|
|
292
303
|
}
|
|
293
304
|
) }),
|
|
294
|
-
|
|
305
|
+
fe
|
|
295
306
|
]
|
|
296
307
|
}
|
|
297
308
|
)
|
|
298
309
|
}
|
|
299
310
|
) })
|
|
300
|
-
] });
|
|
311
|
+
] }) });
|
|
301
312
|
};
|
|
302
313
|
export {
|
|
303
|
-
|
|
314
|
+
ut as Dropdown
|
|
304
315
|
};
|
|
@@ -1,64 +1,75 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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:
|
|
14
|
-
|
|
15
|
+
isOpen: t,
|
|
16
|
+
nodeId: p,
|
|
17
|
+
refs: s,
|
|
15
18
|
floatingStyles: b,
|
|
16
|
-
context:
|
|
17
|
-
getReferenceProps:
|
|
18
|
-
getFloatingProps:
|
|
19
|
-
} =
|
|
20
|
-
(e) => (
|
|
21
|
-
e.disabled || (e.onClick?.({ key: e.key, domEvent:
|
|
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
|
-
[
|
|
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__ */
|
|
26
|
-
/* @__PURE__ */
|
|
27
|
-
|
|
44
|
+
return /* @__PURE__ */ c(N, { id: p, children: [
|
|
45
|
+
n.interactiveTooltip ? /* @__PURE__ */ r(
|
|
46
|
+
u,
|
|
28
47
|
{
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
44
|
-
|
|
54
|
+
) : l,
|
|
55
|
+
t && /* @__PURE__ */ r(
|
|
56
|
+
S,
|
|
45
57
|
{
|
|
46
|
-
refs:
|
|
58
|
+
refs: s,
|
|
47
59
|
floatingStyles: b,
|
|
48
|
-
context:
|
|
49
|
-
getFloatingProps:
|
|
60
|
+
context: f,
|
|
61
|
+
getFloatingProps: C,
|
|
50
62
|
role: "menu",
|
|
51
|
-
surfaceClassName:
|
|
52
|
-
children:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
-
|
|
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:
|
|
60
|
-
"aria-checked":
|
|
61
|
-
"aria-current": m(e) ===
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
104
|
+
q as DropdownSubMenuItem
|
|
85
105
|
};
|