@acronis-platform/ui-react 0.57.1 → 0.60.0
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/components/ui/area-chart/area-chart.js +177 -0
- package/dist/components/ui/area-chart/area-chart.js.map +1 -0
- package/dist/components/ui/bar-chart/bar-chart.js +184 -78
- package/dist/components/ui/bar-chart/bar-chart.js.map +1 -1
- package/dist/components/ui/button-icon-input/button-icon-input.js +36 -0
- package/dist/components/ui/button-icon-input/button-icon-input.js.map +1 -0
- package/dist/components/ui/button-menu/button-menu.js +1 -1
- package/dist/components/ui/button-menu/button-menu.js.map +1 -1
- package/dist/components/ui/calendar/calendar.js +17 -15
- package/dist/components/ui/calendar/calendar.js.map +1 -1
- package/dist/components/ui/card-filter/card-filter.js +40 -27
- package/dist/components/ui/card-filter/card-filter.js.map +1 -1
- package/dist/components/ui/carousel-dialog/carousel-dialog.js +87 -0
- package/dist/components/ui/carousel-dialog/carousel-dialog.js.map +1 -0
- package/dist/components/ui/category-bar/category-bar.js +126 -0
- package/dist/components/ui/category-bar/category-bar.js.map +1 -0
- package/dist/components/ui/chart/chart-format.js +40 -0
- package/dist/components/ui/chart/chart-format.js.map +1 -0
- package/dist/components/ui/chart/chart.js.map +1 -1
- package/dist/components/ui/chart-state/chart-state.js +42 -0
- package/dist/components/ui/chart-state/chart-state.js.map +1 -0
- package/dist/components/ui/chip/chip.js +13 -13
- package/dist/components/ui/chip/chip.js.map +1 -1
- package/dist/components/ui/composed-chart/composed-chart.js +135 -0
- package/dist/components/ui/composed-chart/composed-chart.js.map +1 -0
- package/dist/components/ui/confidence-cone/confidence-cone.js +223 -0
- package/dist/components/ui/confidence-cone/confidence-cone.js.map +1 -0
- package/dist/components/ui/date-range-picker/date-range-picker.js +21 -21
- package/dist/components/ui/date-range-picker/date-range-picker.js.map +1 -1
- package/dist/components/ui/dialog/dialog.js +248 -76
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/components/ui/dialog-footer-carousel/dialog-footer-carousel.js +57 -0
- package/dist/components/ui/dialog-footer-carousel/dialog-footer-carousel.js.map +1 -0
- package/dist/components/ui/dialog-footer-default/dialog-footer-default.js +26 -0
- package/dist/components/ui/dialog-footer-default/dialog-footer-default.js.map +1 -0
- package/dist/components/ui/dialog-welcome/dialog-welcome.js +272 -0
- package/dist/components/ui/dialog-welcome/dialog-welcome.js.map +1 -0
- package/dist/components/ui/dropdown-menu/dropdown-menu.js +21 -21
- package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/ui/filter-search/filter-search.js +91 -90
- package/dist/components/ui/filter-search/filter-search.js.map +1 -1
- package/dist/components/ui/funnel-chart/funnel-chart.js +87 -0
- package/dist/components/ui/funnel-chart/funnel-chart.js.map +1 -0
- package/dist/components/ui/histogram/histogram.js +136 -0
- package/dist/components/ui/histogram/histogram.js.map +1 -0
- package/dist/components/ui/input/input.js.map +1 -1
- package/dist/components/ui/input-otp/input-otp.js +104 -0
- package/dist/components/ui/input-otp/input-otp.js.map +1 -0
- package/dist/components/ui/input-password/input-password.js +120 -0
- package/dist/components/ui/input-password/input-password.js.map +1 -0
- package/dist/components/ui/input-text/input-text.js +9 -9
- package/dist/components/ui/input-text/input-text.js.map +1 -1
- package/dist/components/ui/line-chart/line-chart.js +234 -0
- package/dist/components/ui/line-chart/line-chart.js.map +1 -0
- package/dist/components/ui/link/link.js +5 -5
- package/dist/components/ui/link/link.js.map +1 -1
- package/dist/components/ui/loading/loading.js +79 -0
- package/dist/components/ui/loading/loading.js.map +1 -0
- package/dist/components/ui/meter/meter.js +93 -0
- package/dist/components/ui/meter/meter.js.map +1 -0
- package/dist/components/ui/metric/metric.js +185 -0
- package/dist/components/ui/metric/metric.js.map +1 -0
- package/dist/components/ui/pie-chart/pie-chart.js +113 -0
- package/dist/components/ui/pie-chart/pie-chart.js.map +1 -0
- package/dist/components/ui/popover/popover.js +57 -27
- package/dist/components/ui/popover/popover.js.map +1 -1
- package/dist/components/ui/radar-chart/radar-chart.js +74 -0
- package/dist/components/ui/radar-chart/radar-chart.js.map +1 -0
- package/dist/components/ui/radial-bar-chart/radial-bar-chart.js +69 -0
- package/dist/components/ui/radial-bar-chart/radial-bar-chart.js.map +1 -0
- package/dist/components/ui/sankey-chart/sankey-chart.js +192 -0
- package/dist/components/ui/sankey-chart/sankey-chart.js.map +1 -0
- package/dist/components/ui/scatter-chart/scatter-chart.js +130 -0
- package/dist/components/ui/scatter-chart/scatter-chart.js.map +1 -0
- package/dist/components/ui/search/search.js +16 -16
- package/dist/components/ui/search/search.js.map +1 -1
- package/dist/components/ui/sheet/sheet-details.js +16 -16
- package/dist/components/ui/sheet/sheet-details.js.map +1 -1
- package/dist/components/ui/spinner/spinner.js.map +1 -1
- package/dist/components/ui/timeline/timeline.js +175 -0
- package/dist/components/ui/timeline/timeline.js.map +1 -0
- package/dist/components/ui/toolbar/toolbar.js +82 -92
- package/dist/components/ui/toolbar/toolbar.js.map +1 -1
- package/dist/components/ui/treemap/treemap.js +83 -0
- package/dist/components/ui/treemap/treemap.js.map +1 -0
- package/dist/components/ui/trend-indicator/trend-indicator.js +97 -0
- package/dist/components/ui/trend-indicator/trend-indicator.js.map +1 -0
- package/dist/index.js +461 -400
- package/dist/index.js.map +1 -1
- package/dist/lib/breakpoints.js +9 -6
- package/dist/lib/breakpoints.js.map +1 -1
- package/dist/node_modules/.pnpm/embla-carousel-react@8.6.0_react@19.2.6/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js +25 -0
- package/dist/node_modules/.pnpm/embla-carousel-react@8.6.0_react@19.2.6/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js.map +1 -0
- package/dist/node_modules/.pnpm/embla-carousel-reactive-utils@8.6.0_embla-carousel@8.6.0/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +36 -0
- package/dist/node_modules/.pnpm/embla-carousel-reactive-utils@8.6.0_embla-carousel@8.6.0/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js.map +1 -0
- package/dist/node_modules/.pnpm/embla-carousel@8.6.0/node_modules/embla-carousel/esm/embla-carousel.esm.js +1205 -0
- package/dist/node_modules/.pnpm/embla-carousel@8.6.0/node_modules/embla-carousel/esm/embla-carousel.esm.js.map +1 -0
- package/dist/react.js +461 -400
- package/dist/react.js.map +1 -1
- package/dist/src/components/ui/area-chart/area-chart.d.ts +34 -0
- package/dist/src/components/ui/area-chart/index.d.ts +1 -0
- package/dist/src/components/ui/avatar/avatar.d.ts +1 -1
- package/dist/src/components/ui/bar-chart/bar-chart.d.ts +30 -5
- package/dist/src/components/ui/bar-chart/index.d.ts +1 -1
- package/dist/src/components/ui/button-icon-input/button-icon-input.d.ts +21 -0
- package/dist/src/components/ui/button-icon-input/index.d.ts +1 -0
- package/dist/src/components/ui/card-filter/card-filter.d.ts +5 -0
- package/dist/src/components/ui/carousel-dialog/carousel-dialog.d.ts +28 -0
- package/dist/src/components/ui/carousel-dialog/index.d.ts +1 -0
- package/dist/src/components/ui/category-bar/category-bar.d.ts +51 -0
- package/dist/src/components/ui/category-bar/index.d.ts +1 -0
- package/dist/src/components/ui/chart/__tests__/chart-format.test.d.ts +1 -0
- package/dist/src/components/ui/chart/chart-format.d.ts +111 -0
- package/dist/src/components/ui/chart/chart.d.ts +2 -0
- package/dist/src/components/ui/chart/index.d.ts +3 -1
- package/dist/src/components/ui/chart-state/chart-state.d.ts +11 -0
- package/dist/src/components/ui/chart-state/index.d.ts +1 -0
- package/dist/src/components/ui/composed-chart/composed-chart.d.ts +33 -0
- package/dist/src/components/ui/composed-chart/index.d.ts +1 -0
- package/dist/src/components/ui/confidence-cone/confidence-cone.d.ts +62 -0
- package/dist/src/components/ui/confidence-cone/index.d.ts +1 -0
- package/dist/src/components/ui/dialog/dialog.d.ts +105 -9
- package/dist/src/components/ui/dialog/dialog.docs.d.ts +82 -5
- package/dist/src/components/ui/dialog/index.d.ts +1 -1
- package/dist/src/components/ui/dialog-footer-carousel/dialog-footer-carousel.d.ts +9 -0
- package/dist/src/components/ui/dialog-footer-carousel/index.d.ts +1 -0
- package/dist/src/components/ui/dialog-footer-default/dialog-footer-default.d.ts +11 -0
- package/dist/src/components/ui/dialog-footer-default/index.d.ts +1 -0
- package/dist/src/components/ui/dialog-welcome/dialog-welcome.d.ts +54 -0
- package/dist/src/components/ui/dialog-welcome/dialog-welcome.docs.d.ts +55 -0
- package/dist/src/components/ui/dialog-welcome/index.d.ts +1 -0
- package/dist/src/components/ui/filter-search/filter-search.d.ts +1 -1
- package/dist/src/components/ui/funnel-chart/funnel-chart.d.ts +39 -0
- package/dist/src/components/ui/funnel-chart/index.d.ts +1 -0
- package/dist/src/components/ui/histogram/histogram.d.ts +40 -0
- package/dist/src/components/ui/histogram/index.d.ts +1 -0
- package/dist/src/components/ui/input-otp/index.d.ts +1 -0
- package/dist/src/components/ui/input-otp/input-otp.d.ts +23 -0
- package/dist/src/components/ui/input-password/index.d.ts +1 -0
- package/dist/src/components/ui/input-password/input-password.d.ts +21 -0
- package/dist/src/components/ui/line-chart/index.d.ts +1 -0
- package/dist/src/components/ui/line-chart/line-chart.d.ts +68 -0
- package/dist/src/components/ui/loading/index.d.ts +1 -0
- package/dist/src/components/ui/loading/loading.d.ts +13 -0
- package/dist/src/components/ui/meter/index.d.ts +1 -0
- package/dist/src/components/ui/meter/meter.d.ts +25 -0
- package/dist/src/components/ui/metric/index.d.ts +1 -0
- package/dist/src/components/ui/metric/metric.d.ts +37 -0
- package/dist/src/components/ui/pie-chart/index.d.ts +1 -0
- package/dist/src/components/ui/pie-chart/pie-chart.d.ts +54 -0
- package/dist/src/components/ui/popover/index.d.ts +1 -1
- package/dist/src/components/ui/popover/popover.d.ts +13 -1
- package/dist/src/components/ui/radar-chart/index.d.ts +1 -0
- package/dist/src/components/ui/radar-chart/radar-chart.d.ts +40 -0
- package/dist/src/components/ui/radial-bar-chart/index.d.ts +1 -0
- package/dist/src/components/ui/radial-bar-chart/radial-bar-chart.d.ts +45 -0
- package/dist/src/components/ui/sankey-chart/index.d.ts +2 -0
- package/dist/src/components/ui/sankey-chart/sankey-chart.d.ts +69 -0
- package/dist/src/components/ui/scatter-chart/index.d.ts +1 -0
- package/dist/src/components/ui/scatter-chart/scatter-chart.d.ts +35 -0
- package/dist/src/components/ui/stack/stack.d.ts +1 -1
- package/dist/src/components/ui/timeline/index.d.ts +1 -0
- package/dist/src/components/ui/timeline/timeline.d.ts +41 -0
- package/dist/src/components/ui/treemap/index.d.ts +1 -0
- package/dist/src/components/ui/treemap/treemap.d.ts +44 -0
- package/dist/src/components/ui/trend-indicator/index.d.ts +1 -0
- package/dist/src/components/ui/trend-indicator/trend-indicator.d.ts +32 -0
- package/dist/src/index.d.ts +27 -2
- package/dist/ui-react.css +1 -1
- package/package.json +5 -4
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { jsx as e, jsxs as w, Fragment as L } from "react/jsx-runtime";
|
|
2
|
+
import * as c from "react";
|
|
3
|
+
import U from "../../../node_modules/.pnpm/embla-carousel-react@8.6.0_react@19.2.6/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js";
|
|
4
|
+
import { cn as _ } from "../../../lib/utils.js";
|
|
5
|
+
import { useDocDir as q } from "../../../lib/use-doc-dir.js";
|
|
6
|
+
import { DialogRoot as G, DialogContent as H, DialogClose as J, DialogTitle as K, DialogDescription as O } from "../dialog/dialog.js";
|
|
7
|
+
import { DialogFooterCarousel as Q } from "../dialog-footer-carousel/dialog-footer-carousel.js";
|
|
8
|
+
import { Button as M } from "../button/button.js";
|
|
9
|
+
function F({
|
|
10
|
+
image: s,
|
|
11
|
+
title: l,
|
|
12
|
+
description: r,
|
|
13
|
+
active: a,
|
|
14
|
+
withBottomPadding: i = !0
|
|
15
|
+
}) {
|
|
16
|
+
return /* @__PURE__ */ w(
|
|
17
|
+
"div",
|
|
18
|
+
{
|
|
19
|
+
className: _(
|
|
20
|
+
"flex w-full flex-col items-center gap-3 pt-4",
|
|
21
|
+
i && "pb-4"
|
|
22
|
+
),
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ e("div", { className: "w-full overflow-hidden rounded-lg px-4", children: /* @__PURE__ */ e("div", { className: "flex h-[272px] w-full items-center justify-center rounded bg-[var(--ui-background-surface-active)]", children: s }) }),
|
|
25
|
+
/* @__PURE__ */ w("div", { className: "flex w-full flex-col items-center gap-1 px-4 text-center", children: [
|
|
26
|
+
a ? /* @__PURE__ */ e(K, { className: "w-full flex-none text-center", children: l }) : /* @__PURE__ */ e("p", { className: "w-full text-2xl font-normal leading-8 text-foreground", children: l }),
|
|
27
|
+
a ? /* @__PURE__ */ e(O, { className: "w-full flex-none text-center text-sm leading-6 text-foreground", children: r }) : /* @__PURE__ */ e("p", { className: "w-full text-sm leading-6 text-foreground", children: r })
|
|
28
|
+
] })
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
const E = [
|
|
34
|
+
{ title: "Title", description: "Feature description." },
|
|
35
|
+
{ title: "Title", description: "Feature description." },
|
|
36
|
+
{ title: "Title", description: "Feature description." }
|
|
37
|
+
];
|
|
38
|
+
function X({
|
|
39
|
+
slideCount: s,
|
|
40
|
+
selectedIndexProp: l,
|
|
41
|
+
onSelectedIndexChange: r
|
|
42
|
+
}) {
|
|
43
|
+
const a = q(), i = l !== void 0, d = Math.min(
|
|
44
|
+
Math.max(l ?? 0, 0),
|
|
45
|
+
Math.max(s - 1, 0)
|
|
46
|
+
), [p, t] = U({
|
|
47
|
+
loop: !1,
|
|
48
|
+
direction: a,
|
|
49
|
+
startIndex: d
|
|
50
|
+
}), [v, N] = c.useState(0), o = Math.min(
|
|
51
|
+
Math.max(l ?? v, 0),
|
|
52
|
+
Math.max(s - 1, 0)
|
|
53
|
+
), f = c.useRef(r);
|
|
54
|
+
c.useEffect(() => {
|
|
55
|
+
f.current = r;
|
|
56
|
+
}, [r]);
|
|
57
|
+
const m = c.useRef(i);
|
|
58
|
+
m.current = i;
|
|
59
|
+
const n = c.useRef(o);
|
|
60
|
+
n.current = o, c.useEffect(() => {
|
|
61
|
+
if (!t) return;
|
|
62
|
+
const u = () => {
|
|
63
|
+
var x;
|
|
64
|
+
const h = t.selectedScrollSnap();
|
|
65
|
+
if (m.current) {
|
|
66
|
+
if (!f.current) {
|
|
67
|
+
h !== n.current && t.scrollTo(n.current, !0);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
h !== n.current && f.current(h);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
N(h), (x = f.current) == null || x.call(f, h);
|
|
74
|
+
};
|
|
75
|
+
return u(), t.on("select", u), t.on("reInit", u), () => {
|
|
76
|
+
t.off("select", u), t.off("reInit", u);
|
|
77
|
+
};
|
|
78
|
+
}, [t]), c.useEffect(() => {
|
|
79
|
+
l === void 0 || !t || t.selectedScrollSnap() !== o && t.scrollTo(o, !0);
|
|
80
|
+
}, [t, l, o]);
|
|
81
|
+
const D = c.useRef(!0);
|
|
82
|
+
c.useEffect(() => {
|
|
83
|
+
if (t) {
|
|
84
|
+
if (D.current) {
|
|
85
|
+
D.current = !1;
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
t.reInit({ direction: a });
|
|
89
|
+
}
|
|
90
|
+
}, [t, a]);
|
|
91
|
+
const R = c.useCallback(
|
|
92
|
+
(u) => {
|
|
93
|
+
i ? r == null || r(u) : t == null || t.scrollTo(u);
|
|
94
|
+
},
|
|
95
|
+
[i, t, r]
|
|
96
|
+
), g = c.useCallback(() => {
|
|
97
|
+
i ? r == null || r(Math.max(o - 1, 0)) : t == null || t.scrollPrev();
|
|
98
|
+
}, [i, t, r, o]), k = c.useCallback(() => {
|
|
99
|
+
i ? r == null || r(Math.min(o + 1, s - 1)) : t == null || t.scrollNext();
|
|
100
|
+
}, [i, t, r, o, s]), T = o === s - 1 ? "end" : o === 0 ? "start" : "middle";
|
|
101
|
+
return {
|
|
102
|
+
emblaRef: p,
|
|
103
|
+
selectedIndex: o,
|
|
104
|
+
handleSelectIndex: R,
|
|
105
|
+
handleBack: g,
|
|
106
|
+
handleNext: k,
|
|
107
|
+
footerVariant: T
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function Y({
|
|
111
|
+
slides: s,
|
|
112
|
+
selectedIndex: l,
|
|
113
|
+
emblaRef: r,
|
|
114
|
+
footerVariant: a,
|
|
115
|
+
onSelectIndex: i,
|
|
116
|
+
onBack: d,
|
|
117
|
+
onNext: p,
|
|
118
|
+
onPrimaryAction: t,
|
|
119
|
+
backLabel: v,
|
|
120
|
+
nextLabel: N,
|
|
121
|
+
primaryLabel: o,
|
|
122
|
+
goToSlideLabel: f
|
|
123
|
+
}) {
|
|
124
|
+
return /* @__PURE__ */ w(L, { children: [
|
|
125
|
+
/* @__PURE__ */ e("div", { ref: r, className: "w-full overflow-hidden", children: /* @__PURE__ */ e("div", { className: "flex", children: s.map((m, n) => /* @__PURE__ */ e(
|
|
126
|
+
"div",
|
|
127
|
+
{
|
|
128
|
+
className: "min-w-0 shrink-0 grow-0 basis-full",
|
|
129
|
+
"aria-hidden": n !== l || void 0,
|
|
130
|
+
inert: n !== l,
|
|
131
|
+
children: /* @__PURE__ */ e(
|
|
132
|
+
F,
|
|
133
|
+
{
|
|
134
|
+
image: m.image,
|
|
135
|
+
title: m.title,
|
|
136
|
+
description: m.description,
|
|
137
|
+
active: n === l
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
},
|
|
141
|
+
n
|
|
142
|
+
)) }) }),
|
|
143
|
+
/* @__PURE__ */ e(
|
|
144
|
+
Q,
|
|
145
|
+
{
|
|
146
|
+
variant: a,
|
|
147
|
+
slideCount: s.length,
|
|
148
|
+
selectedIndex: l,
|
|
149
|
+
onSelectIndex: i,
|
|
150
|
+
onBack: d,
|
|
151
|
+
onNext: p,
|
|
152
|
+
onPrimaryAction: t,
|
|
153
|
+
backLabel: v,
|
|
154
|
+
nextLabel: N,
|
|
155
|
+
primaryLabel: o,
|
|
156
|
+
goToSlideLabel: f
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
] });
|
|
160
|
+
}
|
|
161
|
+
function Z({
|
|
162
|
+
image: s,
|
|
163
|
+
title: l,
|
|
164
|
+
description: r,
|
|
165
|
+
primaryLabel: a,
|
|
166
|
+
onPrimaryAction: i,
|
|
167
|
+
closeLabel: d,
|
|
168
|
+
onCloseAction: p
|
|
169
|
+
}) {
|
|
170
|
+
return /* @__PURE__ */ w("div", { className: "flex w-full flex-col items-center gap-3 pb-4", children: [
|
|
171
|
+
/* @__PURE__ */ e(
|
|
172
|
+
F,
|
|
173
|
+
{
|
|
174
|
+
image: s,
|
|
175
|
+
title: l,
|
|
176
|
+
description: r,
|
|
177
|
+
active: !0,
|
|
178
|
+
withBottomPadding: !1
|
|
179
|
+
}
|
|
180
|
+
),
|
|
181
|
+
/* @__PURE__ */ w("div", { className: "flex w-full flex-col items-center gap-2 px-4", children: [
|
|
182
|
+
/* @__PURE__ */ e(M, { onClick: i, children: a ?? "Call to action" }),
|
|
183
|
+
/* @__PURE__ */ e(
|
|
184
|
+
J,
|
|
185
|
+
{
|
|
186
|
+
onClick: p,
|
|
187
|
+
render: /* @__PURE__ */ e(M, { variant: "ghost", children: d })
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
] })
|
|
191
|
+
] });
|
|
192
|
+
}
|
|
193
|
+
const $ = c.forwardRef(
|
|
194
|
+
({
|
|
195
|
+
variant: s = "carousel",
|
|
196
|
+
slides: l = E,
|
|
197
|
+
selectedIndex: r,
|
|
198
|
+
onSelectedIndexChange: a,
|
|
199
|
+
backLabel: i,
|
|
200
|
+
nextLabel: d,
|
|
201
|
+
goToSlideLabel: p,
|
|
202
|
+
image: t,
|
|
203
|
+
title: v = "Title",
|
|
204
|
+
description: N = "Feature description.",
|
|
205
|
+
closeLabel: o = "Close",
|
|
206
|
+
onCloseAction: f,
|
|
207
|
+
primaryLabel: m,
|
|
208
|
+
onPrimaryAction: n,
|
|
209
|
+
portal: D,
|
|
210
|
+
portalContainer: R,
|
|
211
|
+
keepMounted: g,
|
|
212
|
+
className: k,
|
|
213
|
+
...T
|
|
214
|
+
}, u) => {
|
|
215
|
+
const h = s === "carousel", x = l.length > 0 ? l : E, B = x.length, {
|
|
216
|
+
emblaRef: b,
|
|
217
|
+
selectedIndex: W,
|
|
218
|
+
handleSelectIndex: j,
|
|
219
|
+
handleBack: V,
|
|
220
|
+
handleNext: y,
|
|
221
|
+
footerVariant: z
|
|
222
|
+
} = X({
|
|
223
|
+
slideCount: B,
|
|
224
|
+
selectedIndexProp: r,
|
|
225
|
+
onSelectedIndexChange: a
|
|
226
|
+
});
|
|
227
|
+
return /* @__PURE__ */ e(G, { ...T, children: /* @__PURE__ */ e(
|
|
228
|
+
H,
|
|
229
|
+
{
|
|
230
|
+
ref: u,
|
|
231
|
+
size: "sm",
|
|
232
|
+
portal: D,
|
|
233
|
+
portalContainer: R,
|
|
234
|
+
keepMounted: g,
|
|
235
|
+
className: k,
|
|
236
|
+
children: h ? /* @__PURE__ */ e(
|
|
237
|
+
Y,
|
|
238
|
+
{
|
|
239
|
+
slides: x,
|
|
240
|
+
selectedIndex: W,
|
|
241
|
+
emblaRef: b,
|
|
242
|
+
footerVariant: z,
|
|
243
|
+
onSelectIndex: j,
|
|
244
|
+
onBack: V,
|
|
245
|
+
onNext: y,
|
|
246
|
+
onPrimaryAction: n,
|
|
247
|
+
backLabel: i,
|
|
248
|
+
nextLabel: d,
|
|
249
|
+
primaryLabel: m,
|
|
250
|
+
goToSlideLabel: p
|
|
251
|
+
}
|
|
252
|
+
) : /* @__PURE__ */ e(
|
|
253
|
+
Z,
|
|
254
|
+
{
|
|
255
|
+
image: t,
|
|
256
|
+
title: v,
|
|
257
|
+
description: N,
|
|
258
|
+
primaryLabel: m,
|
|
259
|
+
onPrimaryAction: n,
|
|
260
|
+
closeLabel: o,
|
|
261
|
+
onCloseAction: f
|
|
262
|
+
}
|
|
263
|
+
)
|
|
264
|
+
}
|
|
265
|
+
) });
|
|
266
|
+
}
|
|
267
|
+
);
|
|
268
|
+
$.displayName = "DialogWelcome";
|
|
269
|
+
export {
|
|
270
|
+
$ as DialogWelcome
|
|
271
|
+
};
|
|
272
|
+
//# sourceMappingURL=dialog-welcome.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog-welcome.js","sources":["../../../../src/components/ui/dialog-welcome/dialog-welcome.tsx"],"sourcesContent":["import * as React from 'react';\nimport useEmblaCarousel from 'embla-carousel-react';\n\nimport { cn } from '@/lib/utils';\nimport { useDocDir } from '@/lib/use-doc-dir';\n\nimport { Button } from '../button';\nimport {\n DialogClose,\n DialogContent,\n type DialogContentProps,\n DialogDescription,\n DialogRoot,\n DialogTitle,\n} from '../dialog';\nimport {\n DialogFooterCarousel,\n type DialogFooterCarouselVariant,\n} from '../dialog-footer-carousel';\n\n// Ports Figma's \"DialogWelcome\" component (node 7162:26459, variants\n// carousel/single): a `Container` (reuses the generic `DialogContent` popup\n// chrome — bg/radius/shadow already match the `--ui-dialog-container-*` tier)\n// around a `DialogBody` (Image + Title + Description) and, for\n// `variant=\"carousel\"`, a `DialogFooterCarousel` driven by a real Embla\n// instance built from scratch here — no import from any existing carousel\n// implementation.\n\nexport interface DialogWelcomeSlide {\n /** Illustration/media for the slide. Falls back to a placeholder surface when omitted. */\n image?: React.ReactNode;\n title: string;\n description: string;\n}\n\nexport type DialogWelcomeVariant = 'carousel' | 'single';\n\ninterface DialogWelcomeSlideBodyProps {\n image?: React.ReactNode;\n title: string;\n description: string;\n /** Whether this slide currently owns the dialog's accessible name/description. */\n active: boolean;\n /**\n * Whether this renders the DialogBody's own bottom padding (Figma's\n * `py-16` applied around the whole body). `false` when more DialogBody\n * content (e.g. the `single` variant's buttons) follows, so the caller can\n * apply the correct `gap-12` between them instead of stacking padding on\n * top of a gap.\n */\n withBottomPadding?: boolean;\n}\n\nfunction DialogWelcomeSlideBody({\n image,\n title,\n description,\n active,\n withBottomPadding = true,\n}: DialogWelcomeSlideBodyProps) {\n return (\n <div\n className={cn(\n 'flex w-full flex-col items-center gap-3 pt-4',\n withBottomPadding && 'pb-4'\n )}\n >\n <div className=\"w-full overflow-hidden rounded-lg px-4\">\n <div className=\"flex h-[272px] w-full items-center justify-center rounded bg-[var(--ui-background-surface-active)]\">\n {image}\n </div>\n </div>\n <div className=\"flex w-full flex-col items-center gap-1 px-4 text-center\">\n {active ? (\n <DialogTitle className=\"w-full flex-none text-center\">\n {title}\n </DialogTitle>\n ) : (\n <p className=\"w-full text-2xl font-normal leading-8 text-foreground\">\n {title}\n </p>\n )}\n {active ? (\n <DialogDescription className=\"w-full flex-none text-center text-sm leading-6 text-foreground\">\n {description}\n </DialogDescription>\n ) : (\n <p className=\"w-full text-sm leading-6 text-foreground\">\n {description}\n </p>\n )}\n </div>\n </div>\n );\n}\n\nconst DEFAULT_SLIDES: DialogWelcomeSlide[] = [\n { title: 'Title', description: 'Feature description.' },\n { title: 'Title', description: 'Feature description.' },\n { title: 'Title', description: 'Feature description.' },\n];\n\ninterface UseDialogWelcomeCarouselOptions {\n slideCount: number;\n selectedIndexProp?: number;\n onSelectedIndexChange?: (index: number) => void;\n}\n\nfunction useDialogWelcomeCarousel({\n slideCount,\n selectedIndexProp,\n onSelectedIndexChange,\n}: UseDialogWelcomeCarouselOptions) {\n const dir = useDocDir();\n const isControlled = selectedIndexProp !== undefined;\n // Mount Embla already on the (clamped) controlled slide instead of its\n // default 0 — otherwise the initial `onSelect()` below reports a phantom\n // \"slide 0\" before the resync effect corrects it, which a consumer wiring\n // analytics off `onSelectedIndexChange` would log as a real event.\n const initialIndex = Math.min(\n Math.max(selectedIndexProp ?? 0, 0),\n Math.max(slideCount - 1, 0)\n );\n const [emblaRef, emblaApi] = useEmblaCarousel({\n loop: false,\n direction: dir,\n startIndex: initialIndex,\n });\n const [internalIndex, setInternalIndex] = React.useState(0);\n // Two-sided: an out-of-range (e.g. negative) `selectedIndex` must still\n // resolve to a real slide, or no slide would carry the dialog's\n // Title/Description (see dialog-welcome/accessibility.md's one-active-slide\n // invariant).\n const selectedIndex = Math.min(\n Math.max(selectedIndexProp ?? internalIndex, 0),\n Math.max(slideCount - 1, 0)\n );\n\n // `onSelectedIndexChange` is read from a ref, not a `useEffect` dependency,\n // so an inline (non-memoized) consumer callback can't force this effect to\n // re-subscribe — which would call `onSelect()` again on the same slide and,\n // if the consumer's callback triggers a re-render, loop indefinitely.\n const onSelectedIndexChangeRef = React.useRef(onSelectedIndexChange);\n React.useEffect(() => {\n onSelectedIndexChangeRef.current = onSelectedIndexChange;\n }, [onSelectedIndexChange]);\n\n // Read fresh on every Embla event without forcing the subscription effect\n // below to resubscribe (same reasoning as `onSelectedIndexChangeRef`).\n const isControlledRef = React.useRef(isControlled);\n isControlledRef.current = isControlled;\n const selectedIndexRef = React.useRef(selectedIndex);\n selectedIndexRef.current = selectedIndex;\n\n React.useEffect(() => {\n if (!emblaApi) return;\n const onSelect = () => {\n const index = emblaApi.selectedScrollSnap();\n if (isControlledRef.current) {\n if (!onSelectedIndexChangeRef.current) {\n // Embla is draggable regardless of controlled state, so a swipe can\n // still move it physically even though clicks are correctly no-ops\n // in this configuration (controlled with no way to move the prop\n // forward). Snap back instead of leaving the visible slide diverged\n // from the one carrying the dialog's accessible name.\n if (index !== selectedIndexRef.current) {\n emblaApi.scrollTo(selectedIndexRef.current, true);\n }\n return;\n }\n // A click/dot handler reports the new index directly, then the resync\n // effect below drives Embla to match via `scrollTo`, which re-emits\n // this same `select` event. Only forward it when it disagrees with\n // the last known controlled index, or a single navigation double-\n // fires the consumer's `onSelectedIndexChange` (e.g. analytics).\n if (index !== selectedIndexRef.current) {\n onSelectedIndexChangeRef.current(index);\n }\n return;\n }\n setInternalIndex(index);\n onSelectedIndexChangeRef.current?.(index);\n };\n onSelect();\n emblaApi.on('select', onSelect);\n emblaApi.on('reInit', onSelect);\n return () => {\n emblaApi.off('select', onSelect);\n emblaApi.off('reInit', onSelect);\n };\n }, [emblaApi]);\n\n React.useEffect(() => {\n if (selectedIndexProp === undefined || !emblaApi) return;\n if (emblaApi.selectedScrollSnap() !== selectedIndex) {\n // `jump: true` — a controlled `selectedIndex` change snaps instantly\n // rather than animating. Without it, the initial sync on mount races\n // the smooth-scroll animation, so an immediate screenshot (e.g. VR)\n // can catch a mid-scroll frame instead of the settled slide.\n emblaApi.scrollTo(selectedIndex, true);\n }\n }, [emblaApi, selectedIndexProp, selectedIndex]);\n\n // Skip the first time this effect sees a non-null `emblaApi` — Embla was\n // already constructed with that render's `dir` (see `useEmblaCarousel`\n // above), so re-running `reInit` immediately is redundant. Worse, Embla's\n // `reInit` synchronously re-emits `'reInit'` even when nothing changed,\n // which would re-invoke the `onSelect` listener registered by the mount\n // effect above and double-fire `onSelectedIndexChange` on mount. Only a\n // genuine post-mount `dir` change (e.g. `useDocDir`'s SSR-safe resync, or\n // the document's `dir` actually flipping at runtime) should call `reInit`.\n const skipNextReInitRef = React.useRef(true);\n React.useEffect(() => {\n if (!emblaApi) return;\n if (skipNextReInitRef.current) {\n skipNextReInitRef.current = false;\n return;\n }\n emblaApi.reInit({ direction: dir });\n }, [emblaApi, dir]);\n\n // Controlled mode never drives Embla directly from Back/Next/dot clicks —\n // only the resync effect above (keyed to `selectedIndexProp`) does. This\n // keeps Embla's physical position from drifting away from the prop when a\n // consumer passes `selectedIndex` without wiring `onSelectedIndexChange`.\n const handleSelectIndex = React.useCallback(\n (index: number) => {\n if (isControlled) {\n onSelectedIndexChange?.(index);\n } else {\n emblaApi?.scrollTo(index);\n }\n },\n [isControlled, emblaApi, onSelectedIndexChange]\n );\n const handleBack = React.useCallback(() => {\n if (isControlled) {\n onSelectedIndexChange?.(Math.max(selectedIndex - 1, 0));\n } else {\n emblaApi?.scrollPrev();\n }\n }, [isControlled, emblaApi, onSelectedIndexChange, selectedIndex]);\n const handleNext = React.useCallback(() => {\n if (isControlled) {\n onSelectedIndexChange?.(Math.min(selectedIndex + 1, slideCount - 1));\n } else {\n emblaApi?.scrollNext();\n }\n }, [isControlled, emblaApi, onSelectedIndexChange, selectedIndex, slideCount]);\n\n // Check `slideCount - 1` first: for a single-slide carousel, index 0 is\n // both the first AND last slide, and 'end' (unlocking the primary action)\n // must win.\n const footerVariant: DialogFooterCarouselVariant =\n selectedIndex === slideCount - 1\n ? 'end'\n : selectedIndex === 0\n ? 'start'\n : 'middle';\n\n return {\n emblaRef,\n selectedIndex,\n handleSelectIndex,\n handleBack,\n handleNext,\n footerVariant,\n };\n}\n\ninterface ContainerCarouselProps {\n slides: DialogWelcomeSlide[];\n selectedIndex: number;\n emblaRef: ReturnType<typeof useEmblaCarousel>[0];\n footerVariant: DialogFooterCarouselVariant;\n onSelectIndex: (index: number) => void;\n onBack: () => void;\n onNext: () => void;\n onPrimaryAction?: () => void;\n backLabel?: string;\n nextLabel?: string;\n primaryLabel?: string;\n goToSlideLabel?: (index: number, count: number) => string;\n}\n\nfunction ContainerCarousel({\n slides,\n selectedIndex,\n emblaRef,\n footerVariant,\n onSelectIndex,\n onBack,\n onNext,\n onPrimaryAction,\n backLabel,\n nextLabel,\n primaryLabel,\n goToSlideLabel,\n}: ContainerCarouselProps) {\n return (\n <>\n <div ref={emblaRef} className=\"w-full overflow-hidden\">\n <div className=\"flex\">\n {slides.map((slide, index) => (\n <div\n key={index}\n className=\"min-w-0 shrink-0 grow-0 basis-full\"\n aria-hidden={index !== selectedIndex || undefined}\n inert={index !== selectedIndex}\n >\n <DialogWelcomeSlideBody\n image={slide.image}\n title={slide.title}\n description={slide.description}\n active={index === selectedIndex}\n />\n </div>\n ))}\n </div>\n </div>\n <DialogFooterCarousel\n variant={footerVariant}\n slideCount={slides.length}\n selectedIndex={selectedIndex}\n onSelectIndex={onSelectIndex}\n onBack={onBack}\n onNext={onNext}\n onPrimaryAction={onPrimaryAction}\n backLabel={backLabel}\n nextLabel={nextLabel}\n primaryLabel={primaryLabel}\n goToSlideLabel={goToSlideLabel}\n />\n </>\n );\n}\n\ninterface ContainerNoSlidesProps {\n image?: React.ReactNode;\n title: string;\n description: string;\n primaryLabel?: string;\n onPrimaryAction?: () => void;\n closeLabel: string;\n onCloseAction?: () => void;\n}\n\nfunction ContainerNoSlides({\n image,\n title,\n description,\n primaryLabel,\n onPrimaryAction,\n closeLabel,\n onCloseAction,\n}: ContainerNoSlidesProps) {\n return (\n <div className=\"flex w-full flex-col items-center gap-3 pb-4\">\n <DialogWelcomeSlideBody\n image={image}\n title={title}\n description={description}\n active\n withBottomPadding={false}\n />\n <div className=\"flex w-full flex-col items-center gap-2 px-4\">\n <Button onClick={onPrimaryAction}>\n {primaryLabel ?? 'Call to action'}\n </Button>\n <DialogClose\n onClick={onCloseAction}\n render={<Button variant=\"ghost\">{closeLabel}</Button>}\n />\n </div>\n </div>\n );\n}\n\ntype DialogRootProps = React.ComponentPropsWithoutRef<typeof DialogRoot>;\n\nexport interface DialogWelcomeProps extends Omit<DialogRootProps, 'children'> {\n /** Selects the Figma-defined layout. Defaults to `'carousel'`. */\n variant?: DialogWelcomeVariant;\n /** Slides shown one at a time (`variant=\"carousel\"`). Defaults to a 3-slide placeholder. */\n slides?: DialogWelcomeSlide[];\n /** Controls the active slide (`variant=\"carousel\"`). Uncontrolled when omitted. */\n selectedIndex?: number;\n /** Fires whenever the active slide changes (`variant=\"carousel\"`). */\n onSelectedIndexChange?: (index: number) => void;\n /** `Back` button label (`variant=\"carousel\"`). Defaults to `'Back'`. */\n backLabel?: string;\n /** `Next` button label (`variant=\"carousel\"`). Defaults to `'Next'`. */\n nextLabel?: string;\n /** Builds each carousel dot's accessible name (`variant=\"carousel\"`). */\n goToSlideLabel?: (index: number, count: number) => string;\n /** Illustration/media (`variant=\"single\"`). */\n image?: React.ReactNode;\n /** Title (`variant=\"single\"`). Defaults to `'Title'`. */\n title?: string;\n /** Description (`variant=\"single\"`). Defaults to `'Feature description.'`. */\n description?: string;\n /** `Close` link label (`variant=\"single\"`). Defaults to `'Close'`. */\n closeLabel?: string;\n /** Fires when `Close` (`variant=\"single\"`) is activated, before the dialog closes. */\n onCloseAction?: () => void;\n /**\n * Call-to-action button label — the last carousel slide's button\n * (`variant=\"carousel\"`) or the single body's primary button\n * (`variant=\"single\"`). Defaults to `'Call to action'`.\n */\n primaryLabel?: string;\n /** Fires when the call-to-action button is activated. */\n onPrimaryAction?: () => void;\n /** Render inside a portal (forwarded to `DialogContent`). Defaults to `true`. */\n portal?: boolean;\n /** Portal container (forwarded to `DialogContent`). */\n portalContainer?: DialogContentProps['portalContainer'];\n /** Keep the content mounted while closed (forwarded to `DialogContent`). */\n keepMounted?: DialogContentProps['keepMounted'];\n /** Extra classes merged onto the popup container. */\n className?: string;\n}\n\nconst DialogWelcome = React.forwardRef<HTMLDivElement, DialogWelcomeProps>(\n (\n {\n variant = 'carousel',\n slides = DEFAULT_SLIDES,\n selectedIndex: selectedIndexProp,\n onSelectedIndexChange,\n backLabel,\n nextLabel,\n goToSlideLabel,\n image,\n title = 'Title',\n description = 'Feature description.',\n closeLabel = 'Close',\n onCloseAction,\n primaryLabel,\n onPrimaryAction,\n portal,\n portalContainer,\n keepMounted,\n className,\n ...rootProps\n },\n ref\n ) => {\n const isCarousel = variant === 'carousel';\n // An explicit `slides={[]}` would otherwise mount no Title/Description\n // and suppress the footer, leaving the dialog with no accessible name —\n // fall back to the default placeholder slides instead.\n const resolvedSlides = slides.length > 0 ? slides : DEFAULT_SLIDES;\n const slideCount = resolvedSlides.length;\n\n const {\n emblaRef,\n selectedIndex,\n handleSelectIndex,\n handleBack,\n handleNext,\n footerVariant,\n } = useDialogWelcomeCarousel({\n slideCount,\n selectedIndexProp,\n onSelectedIndexChange,\n });\n\n return (\n <DialogRoot {...rootProps}>\n <DialogContent\n ref={ref}\n size=\"sm\"\n portal={portal}\n portalContainer={portalContainer}\n keepMounted={keepMounted}\n className={className}\n >\n {isCarousel ? (\n <ContainerCarousel\n slides={resolvedSlides}\n selectedIndex={selectedIndex}\n emblaRef={emblaRef}\n footerVariant={footerVariant}\n onSelectIndex={handleSelectIndex}\n onBack={handleBack}\n onNext={handleNext}\n onPrimaryAction={onPrimaryAction}\n backLabel={backLabel}\n nextLabel={nextLabel}\n primaryLabel={primaryLabel}\n goToSlideLabel={goToSlideLabel}\n />\n ) : (\n <ContainerNoSlides\n image={image}\n title={title}\n description={description}\n primaryLabel={primaryLabel}\n onPrimaryAction={onPrimaryAction}\n closeLabel={closeLabel}\n onCloseAction={onCloseAction}\n />\n )}\n </DialogContent>\n </DialogRoot>\n );\n }\n);\nDialogWelcome.displayName = 'DialogWelcome';\n\nexport { DialogWelcome };\n"],"names":["DialogWelcomeSlideBody","image","title","description","active","withBottomPadding","jsxs","cn","jsx","DialogTitle","DialogDescription","DEFAULT_SLIDES","useDialogWelcomeCarousel","slideCount","selectedIndexProp","onSelectedIndexChange","dir","useDocDir","isControlled","initialIndex","emblaRef","emblaApi","useEmblaCarousel","internalIndex","setInternalIndex","React","selectedIndex","onSelectedIndexChangeRef","isControlledRef","selectedIndexRef","onSelect","index","_a","skipNextReInitRef","handleSelectIndex","handleBack","handleNext","footerVariant","ContainerCarousel","slides","onSelectIndex","onBack","onNext","onPrimaryAction","backLabel","nextLabel","primaryLabel","goToSlideLabel","Fragment","slide","DialogFooterCarousel","ContainerNoSlides","closeLabel","onCloseAction","Button","DialogClose","DialogWelcome","variant","portal","portalContainer","keepMounted","className","rootProps","ref","isCarousel","resolvedSlides","DialogRoot","DialogContent"],"mappings":";;;;;;;;AAqDA,SAASA,EAAuB;AAAA,EAC9B,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,QAAAC;AAAA,EACA,mBAAAC,IAAoB;AACtB,GAAgC;AAC9B,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACT;AAAA,QACAF,KAAqB;AAAA,MAAA;AAAA,MAGvB,UAAA;AAAA,QAAA,gBAAAG,EAAC,OAAA,EAAI,WAAU,0CACb,UAAA,gBAAAA,EAAC,SAAI,WAAU,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Q2B;AAAA,YACR,eAAAvC;AAAA,YACA,UAAAN;AAAA,YACA,eAAAiB;AAAA,YACA,eAAeH;AAAA,YACf,QAAQC;AAAA,YACR,QAAQC;AAAA,YACR,iBAAAO;AAAA,YACA,WAAAC;AAAA,YACA,WAAAC;AAAA,YACA,cAAAC;AAAA,YACA,gBAAAC;AAAA,UAAA;AAAA,QAAA,IAGF,gBAAAvC;AAAA,UAAC2C;AAAA,UAAA;AAAA,YACC,OAAAlD;AAAA,YACA,OAAAC;AAAA,YACA,aAAAC;AAAA,YACA,cAAA2C;AAAA,YACA,iBAAAH;AAAA,YACA,YAAAS;AAAA,YACA,eAAAC;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA,GAGN;AAAA,EAEJ;AACF;AACAG,EAAc,cAAc;"}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
1
|
+
import { jsx as r, jsxs as g } from "react/jsx-runtime";
|
|
2
2
|
import * as d from "react";
|
|
3
3
|
import { Menu as o } from "@base-ui/react/menu";
|
|
4
4
|
import { ChevronRightIcon as h } from "@acronis-platform/icons-react/stroke-mono";
|
|
5
5
|
import { cn as a } from "../../../lib/utils.js";
|
|
6
6
|
import { usePortalContainer as x } from "../../../lib/portal-container.js";
|
|
7
|
-
const _ = o.Root, k = o.Trigger, M = d.forwardRef(({ className: n, ...
|
|
7
|
+
const _ = o.Root, k = o.Trigger, M = d.forwardRef(({ className: n, ...e }, t) => /* @__PURE__ */ r(
|
|
8
8
|
o.Group,
|
|
9
9
|
{
|
|
10
|
-
ref:
|
|
10
|
+
ref: t,
|
|
11
11
|
className: a(
|
|
12
12
|
"flex flex-col items-start overflow-clip gap-[var(--ui-button-menu-dropdown-section-list-gap)] px-[var(--ui-button-menu-dropdown-section-container-padding-x)] py-[var(--ui-button-menu-dropdown-section-container-padding-y)] [&:not(:first-child)]:border-t [&:not(:first-child)]:border-[length:var(--ui-button-menu-dropdown-section-container-border-width)] [&:not(:first-child)]:border-[var(--ui-button-menu-dropdown-section-container-border-color)]",
|
|
13
13
|
n
|
|
14
14
|
),
|
|
15
|
-
...
|
|
15
|
+
...e
|
|
16
16
|
}
|
|
17
17
|
));
|
|
18
18
|
M.displayName = "DropdownMenuGroup";
|
|
19
19
|
const G = o.Portal, j = o.SubmenuRoot, p = "z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden flex flex-col gap-[var(--ui-button-menu-dropdown-container-gap)] bg-[var(--ui-button-menu-dropdown-container-color)] border-solid border-[length:var(--ui-button-menu-dropdown-container-border-width)] border-[var(--ui-button-menu-dropdown-container-border-color)] rounded-[var(--ui-button-menu-dropdown-container-border-radius)] px-[var(--ui-button-menu-dropdown-container-padding-x)] py-[var(--ui-button-menu-dropdown-container-padding-y)] shadow-md outline-none duration-200 data-[open]:animate-in data-[closed]:animate-out data-[open]:fade-in-0 data-[closed]:fade-out-0 data-[open]:zoom-in-95 data-[closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2", c = "relative flex w-full shrink-0 cursor-default select-none items-start gap-[var(--ui-button-menu-dropdown-item-container-gap)] min-h-[var(--ui-button-menu-dropdown-item-container-height)] px-[var(--ui-button-menu-dropdown-item-container-padding-x)] py-[var(--ui-button-menu-dropdown-item-container-padding-y)] text-sm font-semibold leading-6 outline-none transition-colors bg-[var(--ui-button-menu-dropdown-item-container-color-idle)] text-[var(--ui-button-menu-dropdown-item-label-color)] [&_svg]:text-[var(--ui-button-menu-dropdown-item-icon-color)] data-[highlighted]:bg-[var(--ui-button-menu-dropdown-item-container-color-hover)] data-[highlighted]:active:bg-[var(--ui-button-menu-dropdown-item-container-color-active)] [&:focus-visible:not(:hover)]:rounded-[3px] [&:focus-visible:not(:hover)]:ring-[3px] [&:focus-visible:not(:hover)]:ring-inset [&:focus-visible:not(:hover)]:ring-[var(--ui-focus-primary)] data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", N = d.forwardRef(
|
|
20
20
|
({
|
|
21
21
|
className: n,
|
|
22
|
-
side:
|
|
23
|
-
align:
|
|
22
|
+
side: e,
|
|
23
|
+
align: t,
|
|
24
24
|
sideOffset: i = 4,
|
|
25
25
|
portal: u = !0,
|
|
26
26
|
portalContainer: m,
|
|
27
27
|
keepMounted: l,
|
|
28
28
|
...b
|
|
29
29
|
}, w) => {
|
|
30
|
-
const v = x(),
|
|
30
|
+
const v = x(), f = m ?? v, s = /* @__PURE__ */ r(
|
|
31
31
|
o.Positioner,
|
|
32
32
|
{
|
|
33
|
-
side:
|
|
34
|
-
align:
|
|
33
|
+
side: e,
|
|
34
|
+
align: t,
|
|
35
35
|
sideOffset: i,
|
|
36
36
|
className: "z-50",
|
|
37
37
|
children: /* @__PURE__ */ r(
|
|
@@ -44,55 +44,55 @@ const G = o.Portal, j = o.SubmenuRoot, p = "z-50 min-w-[8rem] overflow-y-auto ov
|
|
|
44
44
|
)
|
|
45
45
|
}
|
|
46
46
|
);
|
|
47
|
-
return u ? /* @__PURE__ */ r(o.Portal, { container:
|
|
47
|
+
return u ? /* @__PURE__ */ r(o.Portal, { container: f, keepMounted: l, children: s }) : s;
|
|
48
48
|
}
|
|
49
49
|
);
|
|
50
50
|
N.displayName = "DropdownMenuContent";
|
|
51
|
-
const D = d.forwardRef(({ className: n, sideOffset:
|
|
51
|
+
const D = d.forwardRef(({ className: n, sideOffset: e = 4, ...t }, i) => /* @__PURE__ */ r(o.Positioner, { sideOffset: e, className: "z-50", children: /* @__PURE__ */ r(
|
|
52
52
|
o.Popup,
|
|
53
53
|
{
|
|
54
54
|
ref: i,
|
|
55
55
|
className: a(p, n),
|
|
56
|
-
...
|
|
56
|
+
...t
|
|
57
57
|
}
|
|
58
58
|
) }));
|
|
59
59
|
D.displayName = "DropdownMenuSubContent";
|
|
60
|
-
const y = d.forwardRef(({ className: n, inset:
|
|
60
|
+
const y = d.forwardRef(({ className: n, inset: e, ...t }, i) => /* @__PURE__ */ r(
|
|
61
61
|
o.Item,
|
|
62
62
|
{
|
|
63
63
|
ref: i,
|
|
64
|
-
className: a(c,
|
|
65
|
-
...
|
|
64
|
+
className: a(c, e && "ps-8", n),
|
|
65
|
+
...t
|
|
66
66
|
}
|
|
67
67
|
));
|
|
68
68
|
y.displayName = "DropdownMenuItem";
|
|
69
|
-
const C = d.forwardRef(({ className: n, inset:
|
|
69
|
+
const C = d.forwardRef(({ className: n, inset: e, children: t, ...i }, u) => /* @__PURE__ */ g(
|
|
70
70
|
o.SubmenuTrigger,
|
|
71
71
|
{
|
|
72
72
|
ref: u,
|
|
73
73
|
className: a(
|
|
74
74
|
c,
|
|
75
75
|
"data-[popup-open]:bg-[var(--ui-button-menu-dropdown-item-container-color-active)]",
|
|
76
|
-
|
|
76
|
+
e && "ps-8",
|
|
77
77
|
n
|
|
78
78
|
),
|
|
79
79
|
...i,
|
|
80
80
|
children: [
|
|
81
|
-
|
|
82
|
-
/* @__PURE__ */ r(h, { className: "ms-auto text-[var(--ui-button-menu-dropdown-extras-cascade-icon-color)] rtl:rotate-180" })
|
|
81
|
+
t,
|
|
82
|
+
/* @__PURE__ */ r(h, { className: "ms-auto self-center text-[var(--ui-button-menu-dropdown-extras-cascade-icon-color)] rtl:rotate-180" })
|
|
83
83
|
]
|
|
84
84
|
}
|
|
85
85
|
));
|
|
86
86
|
C.displayName = "DropdownMenuSubTrigger";
|
|
87
87
|
function R({
|
|
88
88
|
className: n,
|
|
89
|
-
...
|
|
89
|
+
...e
|
|
90
90
|
}) {
|
|
91
91
|
return /* @__PURE__ */ r(
|
|
92
92
|
"span",
|
|
93
93
|
{
|
|
94
94
|
className: a("ms-auto shrink-0 text-sm font-normal leading-6 text-[var(--ui-button-menu-dropdown-extras-shortcut-label-color)]", n),
|
|
95
|
-
...
|
|
95
|
+
...e
|
|
96
96
|
}
|
|
97
97
|
);
|
|
98
98
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-menu.js","sources":["../../../../src/components/ui/dropdown-menu/dropdown-menu.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Menu as MenuPrimitive } from '@base-ui/react/menu';\nimport { ChevronRightIcon } from '@acronis-platform/icons-react/stroke-mono';\n\nimport { cn } from '@/lib/utils';\nimport { usePortalContainer } from '@/lib/portal-container';\n\n// A menu of actions anchored to a trigger, built on the Base UI Menu primitive\n// (positioning, focus management, typeahead, outside-press / Esc dismissal,\n// ARIA). Themed from the `--ui-button-menu-dropdown-*` token tier generated by\n// @acronis-platform/tokens-pd (ButtonMenu/default.css). Enter/exit animations\n// use `tw-animate-css` keyed to data-[open]/[closed]/[side].\n\nconst DropdownMenu = MenuPrimitive.Root;\nconst DropdownMenuTrigger = MenuPrimitive.Trigger;\nconst DropdownMenuGroup = React.forwardRef<\n React.ElementRef<typeof MenuPrimitive.Group>,\n React.ComponentPropsWithoutRef<typeof MenuPrimitive.Group>\n>(({ className, ...props }, ref) => (\n <MenuPrimitive.Group\n ref={ref}\n className={cn(\n 'flex flex-col items-start overflow-clip gap-[var(--ui-button-menu-dropdown-section-list-gap)] px-[var(--ui-button-menu-dropdown-section-container-padding-x)] py-[var(--ui-button-menu-dropdown-section-container-padding-y)] [&:not(:first-child)]:border-t [&:not(:first-child)]:border-[length:var(--ui-button-menu-dropdown-section-container-border-width)] [&:not(:first-child)]:border-[var(--ui-button-menu-dropdown-section-container-border-color)]',\n className\n )}\n {...props}\n />\n));\nDropdownMenuGroup.displayName = 'DropdownMenuGroup';\nconst DropdownMenuPortal = MenuPrimitive.Portal;\nconst DropdownMenuSub = MenuPrimitive.SubmenuRoot;\n\nconst popupClassName =\n 'z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden flex flex-col gap-[var(--ui-button-menu-dropdown-container-gap)] bg-[var(--ui-button-menu-dropdown-container-color)] border-solid border-[length:var(--ui-button-menu-dropdown-container-border-width)] border-[var(--ui-button-menu-dropdown-container-border-color)] rounded-[var(--ui-button-menu-dropdown-container-border-radius)] px-[var(--ui-button-menu-dropdown-container-padding-x)] py-[var(--ui-button-menu-dropdown-container-padding-y)] shadow-md outline-none duration-200 data-[open]:animate-in data-[closed]:animate-out data-[open]:fade-in-0 data-[closed]:fade-out-0 data-[open]:zoom-in-95 data-[closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2';\n\nconst itemClassName =\n 'relative flex w-full shrink-0 cursor-default select-none items-start gap-[var(--ui-button-menu-dropdown-item-container-gap)] min-h-[var(--ui-button-menu-dropdown-item-container-height)] px-[var(--ui-button-menu-dropdown-item-container-padding-x)] py-[var(--ui-button-menu-dropdown-item-container-padding-y)] text-sm font-semibold leading-6 outline-none transition-colors bg-[var(--ui-button-menu-dropdown-item-container-color-idle)] text-[var(--ui-button-menu-dropdown-item-label-color)] [&_svg]:text-[var(--ui-button-menu-dropdown-item-icon-color)] data-[highlighted]:bg-[var(--ui-button-menu-dropdown-item-container-color-hover)] data-[highlighted]:active:bg-[var(--ui-button-menu-dropdown-item-container-color-active)] [&:focus-visible:not(:hover)]:rounded-[3px] [&:focus-visible:not(:hover)]:ring-[3px] [&:focus-visible:not(:hover)]:ring-inset [&:focus-visible:not(:hover)]:ring-[var(--ui-focus-primary)] data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0';\n\nexport interface DropdownMenuContentProps\n extends React.ComponentPropsWithoutRef<typeof MenuPrimitive.Popup> {\n side?: MenuPrimitive.Positioner.Props['side'];\n align?: MenuPrimitive.Positioner.Props['align'];\n sideOffset?: number;\n /** Render inside a portal (default `true`). */\n portal?: boolean;\n /** Portal container — pass a shadow-root mount for isolated-style previews. */\n portalContainer?: MenuPrimitive.Portal.Props['container'];\n keepMounted?: MenuPrimitive.Portal.Props['keepMounted'];\n}\n\nconst DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof MenuPrimitive.Popup>,\n DropdownMenuContentProps\n>(\n (\n {\n className,\n side,\n align,\n sideOffset = 4,\n portal = true,\n portalContainer,\n keepMounted,\n ...props\n },\n ref\n ) => {\n const ctxContainer = usePortalContainer();\n const resolvedContainer = portalContainer ?? ctxContainer;\n\n const positioner = (\n <MenuPrimitive.Positioner\n side={side}\n align={align}\n sideOffset={sideOffset}\n className=\"z-50\"\n >\n <MenuPrimitive.Popup\n ref={ref}\n className={cn(popupClassName, className)}\n {...props}\n />\n </MenuPrimitive.Positioner>\n );\n return portal ? (\n <MenuPrimitive.Portal container={resolvedContainer} keepMounted={keepMounted}>\n {positioner}\n </MenuPrimitive.Portal>\n ) : (\n positioner\n );\n }\n);\nDropdownMenuContent.displayName = 'DropdownMenuContent';\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof MenuPrimitive.Popup>,\n React.ComponentPropsWithoutRef<typeof MenuPrimitive.Popup> & {\n sideOffset?: number;\n }\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <MenuPrimitive.Positioner sideOffset={sideOffset} className=\"z-50\">\n <MenuPrimitive.Popup\n ref={ref}\n className={cn(popupClassName, className)}\n {...props}\n />\n </MenuPrimitive.Positioner>\n));\nDropdownMenuSubContent.displayName = 'DropdownMenuSubContent';\n\nconst DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof MenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof MenuPrimitive.Item> & { inset?: boolean }\n>(({ className, inset, ...props }, ref) => (\n <MenuPrimitive.Item\n ref={ref}\n className={cn(itemClassName, inset && 'ps-8', className)}\n {...props}\n />\n));\nDropdownMenuItem.displayName = 'DropdownMenuItem';\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof MenuPrimitive.SubmenuTrigger>,\n React.ComponentPropsWithoutRef<typeof MenuPrimitive.SubmenuTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <MenuPrimitive.SubmenuTrigger\n ref={ref}\n className={cn(\n itemClassName,\n 'data-[popup-open]:bg-[var(--ui-button-menu-dropdown-item-container-color-active)]',\n inset && 'ps-8',\n className\n )}\n {...props}\n >\n {children}\n <ChevronRightIcon className=\"ms-auto text-[var(--ui-button-menu-dropdown-extras-cascade-icon-color)] rtl:rotate-180\" />\n </MenuPrimitive.SubmenuTrigger>\n));\nDropdownMenuSubTrigger.displayName = 'DropdownMenuSubTrigger';\n\n\nfunction DropdownMenuShortcut({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) {\n return (\n <span\n className={cn('ms-auto shrink-0 text-sm font-normal leading-6 text-[var(--ui-button-menu-dropdown-extras-shortcut-label-color)]', className)}\n {...props}\n />\n );\n}\nDropdownMenuShortcut.displayName = 'DropdownMenuShortcut';\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuPortal,\n};\n"],"names":["DropdownMenu","MenuPrimitive","DropdownMenuTrigger","DropdownMenuGroup","React","className","props","ref","jsx","cn","DropdownMenuPortal","DropdownMenuSub","popupClassName","itemClassName","DropdownMenuContent","side","align","sideOffset","portal","portalContainer","keepMounted","ctxContainer","usePortalContainer","resolvedContainer","positioner","DropdownMenuSubContent","DropdownMenuItem","inset","DropdownMenuSubTrigger","children","jsxs","ChevronRightIcon","DropdownMenuShortcut"],"mappings":";;;;;;AAaA,MAAMA,IAAeC,EAAc,MAC7BC,IAAsBD,EAAc,SACpCE,IAAoBC,EAAM,WAG9B,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAACP,EAAc;AAAA,EAAd;AAAA,IACC,KAAAM;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAJ;AAAA,IAAA;AAA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WAAAC,GAAW,OAAAsB,GAAO,GAAGrB,KAASC,MACjC,gBAAAC;AAAA,EAACP,EAAc;AAAA,EAAd;AAAA,IACC,KAAAM;AAAA,IACA,WAAWE,EAAGI,GAAec,KAAS,QAAQtB,CAAS;AAAA,IACtD,GAAGC;AAAA,EAAA;AACN,CACD;AACDoB,EAAiB,cAAc;AAE/B,MAAME,IAAyBxB,EAAM,WAKnC,CAAC,EAAE,WAAAC,GAAW,OAAAsB,GAAO,UAAAE,GAAU,GAAGvB,KAASC,MAC3C,gBAAAuB;AAAA,EAAC7B,EAAc;AAAA,EAAd;AAAA,IACC,KAAAM;AAAA,IACA,WAAWE;AAAA,MACTI;AAAA,MACA;AAAA,MACAc,KAAS;AAAA,MACTtB;AAAA,IAAA;AAAA,IAED,GAAGC;AAAA,IAEH,UAAA;AAAA,MAAAuB;AAAA,MACD,gBAAArB,EAACuB,GAAA,EAAiB,WAAU,yFAAA,CAAyF;AAAA,IAAA;AAAA,EAAA;AACvH,CACD;AACDH,EAAuB,cAAc;AAGrC,SAASI,EAAqB;AAAA,EAC5B,WAAA3B;AAAA,EACA,GAAGC;AACL,GAA0C;AACxC,SACE,gBAAAE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAG,oHAAoHJ,CAAS;AAAA,MAC1I,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV;AACA0B,EAAqB,cAAc;"}
|
|
1
|
+
{"version":3,"file":"dropdown-menu.js","sources":["../../../../src/components/ui/dropdown-menu/dropdown-menu.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Menu as MenuPrimitive } from '@base-ui/react/menu';\nimport { ChevronRightIcon } from '@acronis-platform/icons-react/stroke-mono';\n\nimport { cn } from '@/lib/utils';\nimport { usePortalContainer } from '@/lib/portal-container';\n\n// A menu of actions anchored to a trigger, built on the Base UI Menu primitive\n// (positioning, focus management, typeahead, outside-press / Esc dismissal,\n// ARIA). Themed from the `--ui-button-menu-dropdown-*` token tier generated by\n// @acronis-platform/tokens-pd (ButtonMenu/default.css). Enter/exit animations\n// use `tw-animate-css` keyed to data-[open]/[closed]/[side].\n\nconst DropdownMenu = MenuPrimitive.Root;\nconst DropdownMenuTrigger = MenuPrimitive.Trigger;\nconst DropdownMenuGroup = React.forwardRef<\n React.ElementRef<typeof MenuPrimitive.Group>,\n React.ComponentPropsWithoutRef<typeof MenuPrimitive.Group>\n>(({ className, ...props }, ref) => (\n <MenuPrimitive.Group\n ref={ref}\n className={cn(\n 'flex flex-col items-start overflow-clip gap-[var(--ui-button-menu-dropdown-section-list-gap)] px-[var(--ui-button-menu-dropdown-section-container-padding-x)] py-[var(--ui-button-menu-dropdown-section-container-padding-y)] [&:not(:first-child)]:border-t [&:not(:first-child)]:border-[length:var(--ui-button-menu-dropdown-section-container-border-width)] [&:not(:first-child)]:border-[var(--ui-button-menu-dropdown-section-container-border-color)]',\n className\n )}\n {...props}\n />\n));\nDropdownMenuGroup.displayName = 'DropdownMenuGroup';\nconst DropdownMenuPortal = MenuPrimitive.Portal;\nconst DropdownMenuSub = MenuPrimitive.SubmenuRoot;\n\nconst popupClassName =\n 'z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden flex flex-col gap-[var(--ui-button-menu-dropdown-container-gap)] bg-[var(--ui-button-menu-dropdown-container-color)] border-solid border-[length:var(--ui-button-menu-dropdown-container-border-width)] border-[var(--ui-button-menu-dropdown-container-border-color)] rounded-[var(--ui-button-menu-dropdown-container-border-radius)] px-[var(--ui-button-menu-dropdown-container-padding-x)] py-[var(--ui-button-menu-dropdown-container-padding-y)] shadow-md outline-none duration-200 data-[open]:animate-in data-[closed]:animate-out data-[open]:fade-in-0 data-[closed]:fade-out-0 data-[open]:zoom-in-95 data-[closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2';\n\nconst itemClassName =\n 'relative flex w-full shrink-0 cursor-default select-none items-start gap-[var(--ui-button-menu-dropdown-item-container-gap)] min-h-[var(--ui-button-menu-dropdown-item-container-height)] px-[var(--ui-button-menu-dropdown-item-container-padding-x)] py-[var(--ui-button-menu-dropdown-item-container-padding-y)] text-sm font-semibold leading-6 outline-none transition-colors bg-[var(--ui-button-menu-dropdown-item-container-color-idle)] text-[var(--ui-button-menu-dropdown-item-label-color)] [&_svg]:text-[var(--ui-button-menu-dropdown-item-icon-color)] data-[highlighted]:bg-[var(--ui-button-menu-dropdown-item-container-color-hover)] data-[highlighted]:active:bg-[var(--ui-button-menu-dropdown-item-container-color-active)] [&:focus-visible:not(:hover)]:rounded-[3px] [&:focus-visible:not(:hover)]:ring-[3px] [&:focus-visible:not(:hover)]:ring-inset [&:focus-visible:not(:hover)]:ring-[var(--ui-focus-primary)] data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0';\n\nexport interface DropdownMenuContentProps\n extends React.ComponentPropsWithoutRef<typeof MenuPrimitive.Popup> {\n side?: MenuPrimitive.Positioner.Props['side'];\n align?: MenuPrimitive.Positioner.Props['align'];\n sideOffset?: number;\n /** Render inside a portal (default `true`). */\n portal?: boolean;\n /** Portal container — pass a shadow-root mount for isolated-style previews. */\n portalContainer?: MenuPrimitive.Portal.Props['container'];\n keepMounted?: MenuPrimitive.Portal.Props['keepMounted'];\n}\n\nconst DropdownMenuContent = React.forwardRef<\n React.ElementRef<typeof MenuPrimitive.Popup>,\n DropdownMenuContentProps\n>(\n (\n {\n className,\n side,\n align,\n sideOffset = 4,\n portal = true,\n portalContainer,\n keepMounted,\n ...props\n },\n ref\n ) => {\n const ctxContainer = usePortalContainer();\n const resolvedContainer = portalContainer ?? ctxContainer;\n\n const positioner = (\n <MenuPrimitive.Positioner\n side={side}\n align={align}\n sideOffset={sideOffset}\n className=\"z-50\"\n >\n <MenuPrimitive.Popup\n ref={ref}\n className={cn(popupClassName, className)}\n {...props}\n />\n </MenuPrimitive.Positioner>\n );\n return portal ? (\n <MenuPrimitive.Portal container={resolvedContainer} keepMounted={keepMounted}>\n {positioner}\n </MenuPrimitive.Portal>\n ) : (\n positioner\n );\n }\n);\nDropdownMenuContent.displayName = 'DropdownMenuContent';\n\nconst DropdownMenuSubContent = React.forwardRef<\n React.ElementRef<typeof MenuPrimitive.Popup>,\n React.ComponentPropsWithoutRef<typeof MenuPrimitive.Popup> & {\n sideOffset?: number;\n }\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <MenuPrimitive.Positioner sideOffset={sideOffset} className=\"z-50\">\n <MenuPrimitive.Popup\n ref={ref}\n className={cn(popupClassName, className)}\n {...props}\n />\n </MenuPrimitive.Positioner>\n));\nDropdownMenuSubContent.displayName = 'DropdownMenuSubContent';\n\nconst DropdownMenuItem = React.forwardRef<\n React.ElementRef<typeof MenuPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof MenuPrimitive.Item> & { inset?: boolean }\n>(({ className, inset, ...props }, ref) => (\n <MenuPrimitive.Item\n ref={ref}\n className={cn(itemClassName, inset && 'ps-8', className)}\n {...props}\n />\n));\nDropdownMenuItem.displayName = 'DropdownMenuItem';\n\nconst DropdownMenuSubTrigger = React.forwardRef<\n React.ElementRef<typeof MenuPrimitive.SubmenuTrigger>,\n React.ComponentPropsWithoutRef<typeof MenuPrimitive.SubmenuTrigger> & {\n inset?: boolean;\n }\n>(({ className, inset, children, ...props }, ref) => (\n <MenuPrimitive.SubmenuTrigger\n ref={ref}\n className={cn(\n itemClassName,\n 'data-[popup-open]:bg-[var(--ui-button-menu-dropdown-item-container-color-active)]',\n inset && 'ps-8',\n className\n )}\n {...props}\n >\n {children}\n <ChevronRightIcon className=\"ms-auto self-center text-[var(--ui-button-menu-dropdown-extras-cascade-icon-color)] rtl:rotate-180\" />\n </MenuPrimitive.SubmenuTrigger>\n));\nDropdownMenuSubTrigger.displayName = 'DropdownMenuSubTrigger';\n\n\nfunction DropdownMenuShortcut({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) {\n return (\n <span\n className={cn('ms-auto shrink-0 text-sm font-normal leading-6 text-[var(--ui-button-menu-dropdown-extras-shortcut-label-color)]', className)}\n {...props}\n />\n );\n}\nDropdownMenuShortcut.displayName = 'DropdownMenuShortcut';\n\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuPortal,\n};\n"],"names":["DropdownMenu","MenuPrimitive","DropdownMenuTrigger","DropdownMenuGroup","React","className","props","ref","jsx","cn","DropdownMenuPortal","DropdownMenuSub","popupClassName","itemClassName","DropdownMenuContent","side","align","sideOffset","portal","portalContainer","keepMounted","ctxContainer","usePortalContainer","resolvedContainer","positioner","DropdownMenuSubContent","DropdownMenuItem","inset","DropdownMenuSubTrigger","children","jsxs","ChevronRightIcon","DropdownMenuShortcut"],"mappings":";;;;;;AAaA,MAAMA,IAAeC,EAAc,MAC7BC,IAAsBD,EAAc,SACpCE,IAAoBC,EAAM,WAG9B,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAACP,EAAc;AAAA,EAAd;AAAA,IACC,KAAAM;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAJ;AAAA,IAAA;AAAA,IAED,GAAGC;AAAA,EAAA;AACN,CACD;AACDH,EAAkB,cAAc;AAChC,MAAMO,IAAqBT,EAAc,QACnCU,IAAkBV,EAAc,aAEhCW,IACJ,g0BAEIC,IACJ,2gCAcIC,IAAsBV,EAAM;AAAA,EAIhC,CACE;AAAA,IACE,WAAAC;AAAA,IACA,MAAAU;AAAA,IACA,OAAAC;AAAA,IACA,YAAAC,IAAa;AAAA,IACb,QAAAC,IAAS;AAAA,IACT,iBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,GAAGd;AAAA,EAAA,GAELC,MACG;AACH,UAAMc,IAAeC,EA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