react-semaphor 0.1.524 → 0.1.526
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/brand-studio/index.js +37 -37
- package/dist/briefings/index.js +38 -33
- package/dist/chunks/{calculated-field-identity-Dy_WpDdo.js → calculated-field-identity-D1ofR4KJ.js} +28 -28
- package/dist/chunks/{card-config-utils-CAyjC5Tp.js → card-config-utils-9sv4e-Vb.js} +15 -15
- package/dist/chunks/{switch-CWPcwAZ4.js → code-highlight-994tgM9v.js} +6309 -8642
- package/dist/chunks/dashboard-CsHvEtjN.js +15 -0
- package/dist/chunks/{dashboard-briefing-launcher-CTEyh3FQ.js → dashboard-briefing-launcher-DXz1GhFZ.js} +364 -370
- package/dist/chunks/{dashboard-controls-C3KbYzz-.js → dashboard-controls-Df8qOSrs.js} +163 -168
- package/dist/chunks/dashboard-json-Xldp0qww.js +65 -0
- package/dist/chunks/{edit-dashboard-visual-DqRmfRqN.js → edit-dashboard-visual-COHBqyic.js} +2836 -2829
- package/dist/chunks/editor-action-buttons-DahlP57T.js +2071 -0
- package/dist/chunks/{index-D9HDUSye.js → index-CbjuruKe.js} +1187 -1018
- package/dist/chunks/{matrix-control-sources-B1K7x0SL.js → matrix-control-sources-2VAzGlt8.js} +29 -29
- package/dist/chunks/pre-block-Cq1RqhZX.js +3987 -0
- package/dist/chunks/report-preferences-dialog-BcH-0lR-.js +1232 -0
- package/dist/chunks/search-CJz-QQ0Q.js +24 -0
- package/dist/chunks/{selection-reducer-CvCBQbl2.js → selection-reducer-NF5C07yM.js} +25 -46
- package/dist/chunks/{index-D7GVxl4a.js → semaphor-ready-indicator-BLRDuLr4.js} +55200 -59783
- package/dist/chunks/slider-BYIH4icg.js +877 -0
- package/dist/chunks/switch-XaAACBrJ.js +2234 -0
- package/dist/dashboard/index.js +1 -1
- package/dist/dashboard-authoring/index.js +4 -4
- package/dist/data-app-builder/index.js +67 -67
- package/dist/data-app-sdk/index.js +33 -32
- package/dist/index.js +435 -243
- package/dist/style.css +1 -1
- package/dist/surfboard/index.js +4 -5
- package/dist/types/briefings/index.d.ts +1 -1
- package/dist/types/briefings/schedule.d.ts +49 -2
- package/dist/types/components/briefings/briefing-author/form-primitives.d.ts +1 -1
- package/dist/types/components/briefings/briefing-author/schedule-model.d.ts +12 -2
- package/dist/types/components/dashboard/dashboard-container.d.ts +1 -1
- package/dist/types/components/dashboard/sheet/layout-change-guard.d.ts +1 -1
- package/dist/types/components/dashboard/sheet/sheet-layout.d.ts +1 -1
- package/dist/types/components/editor/editor-main/text-card.d.ts +1 -1
- package/dist/types/components/editor/editor.d.ts +1 -1
- package/dist/types/components/providers/semaphor-context-provider.d.ts +1 -1
- package/dist/types/components/providers/theme-provider-context.d.ts +1 -1
- package/dist/types/components/providers/theme-provider.d.ts +1 -1
- package/dist/types/components/shared/unsaved-changes/use-pristine-snapshot-initializer.d.ts +1 -1
- package/dist/types/components/sharing-and-management/hooks/use-groups.d.ts +5 -1
- package/dist/types/components/sharing-and-management/hooks/use-unified-users.d.ts +9 -1
- package/dist/types/components/sharing-and-management/resource-share-dialog/index.d.ts +1 -1
- package/dist/types/components/sharing-and-management/resource-share-dialog/unified/adapter.d.ts +21 -1
- package/dist/types/components/sharing-and-management/resource-share-dialog/unified/configs.d.ts +12 -0
- package/dist/types/components/sharing-and-management/resource-share-dialog/unified/invite-combobox.d.ts +5 -0
- package/dist/types/components/sharing-and-management/resource-share-dialog/unified/share-shape.d.ts +7 -0
- package/dist/types/components/sharing-and-management/resource-share-dialog/unified/types.d.ts +2 -0
- package/dist/types/components/sharing-and-management/utils/shares-types.d.ts +8 -0
- package/dist/types/components/sharing-and-management/utils/types.d.ts +2 -0
- package/dist/types/components/surfboard/dashboard-plus.d.ts +1 -1
- package/dist/types/components/ui/resizable.d.ts +1 -1
- package/dist/types/components/visual/column-display-utils.d.ts +1 -1
- package/dist/types/components/visual/kpi-visual/kpi-utils.d.ts +1 -1
- package/dist/types/components/visual/settings/color-format.d.ts +1 -1
- package/dist/types/components/visual/visual-utils.d.ts +1 -1
- package/dist/types/lib/actions/data-point-click-action.d.ts +2 -1
- package/dist/types/lib/charts/area-chart.d.ts +1 -1
- package/dist/types/lib/charts/bar-chart.d.ts +1 -1
- package/dist/types/lib/charts/cartesian-data.d.ts +72 -0
- package/dist/types/lib/charts/cartesian-fields.d.ts +60 -0
- package/dist/types/lib/charts/chart-utils.d.ts +3 -0
- package/dist/types/lib/charts/combo-chart.d.ts +1 -1
- package/dist/types/lib/charts/create-chart.d.ts +1 -1
- package/dist/types/lib/charts/line-chart.d.ts +1 -1
- package/dist/types/lib/charts/shared/category-group-axis-plugin.d.ts +23 -0
- package/dist/types/lib/charts/stacked-line-chart.d.ts +2 -0
- package/dist/types/lib/charts/types.d.ts +1 -7
- package/dist/types/lib/dashboard/normalize-dashboard-for-dirty-check.d.ts +1 -1
- package/dist/types/lib/formatters/cartesian-temporal-presentation.d.ts +6 -1
- package/dist/types/lib/hooks/explorer/use-schemas.d.ts +1 -1
- package/dist/types/lib/hooks/use-dashboard.d.ts +2 -2
- package/dist/types/lib/interactions/get-click-context-from-chartjs.d.ts +1 -2
- package/dist/types/lib/stores/editor-store.d.ts +1 -2
- package/dist/types/lib/stores/table-actions.d.ts +2 -1
- package/dist/types/lib/types/token-types.d.ts +0 -12
- package/dist/types/lib/utils.d.ts +0 -2
- package/package.json +2 -1
- package/dist/chunks/dashboard-json-Kc_M7nLP.js +0 -75
- package/dist/chunks/editor-action-buttons-s-ByVR9x.js +0 -2019
- package/dist/chunks/report-preferences-dialog-RAp0DAuw.js +0 -723
- package/dist/types/lib/encrypt-utils.d.ts +0 -9
|
@@ -0,0 +1,2234 @@
|
|
|
1
|
+
import { c as ve } from "./x-CXDkqdur.js";
|
|
2
|
+
import { jsx as u, jsxs as le, Fragment as bt } from "react/jsx-runtime";
|
|
3
|
+
import * as a from "react";
|
|
4
|
+
import Rr, { forwardRef as Pr, useRef as Be, useState as _r, useMemo as Ir, useId as kr, useImperativeHandle as Nr } from "react";
|
|
5
|
+
import "react-dom";
|
|
6
|
+
import { Q as Ee, T as Ar, aB as Xe, J as B, K as L, U as q, V as qe, I as Le, au as ae, at as gt, c as X, M as me, aC as ce, av as Dr, W as Lr, aD as Or, aE as yt, aF as Mr, aG as Fr, aH as zr, aI as Hr, aJ as Kr, aK as $r, aL as Vr, aM as ct, Y as Br, X as Ur } from "./code-highlight-994tgM9v.js";
|
|
7
|
+
import "./validators-CsdOtZI6.js";
|
|
8
|
+
import "./matrix-operation-contract-D32U2CSw.js";
|
|
9
|
+
import "../value-format-preferences/index.js";
|
|
10
|
+
import { c as Z } from "./card-config-utils-9sv4e-Vb.js";
|
|
11
|
+
/**
|
|
12
|
+
* @license lucide-react v0.453.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/
|
|
17
|
+
const Hn = ve("ChartColumn", [
|
|
18
|
+
["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
|
|
19
|
+
["path", { d: "M18 17V9", key: "2bz60n" }],
|
|
20
|
+
["path", { d: "M13 17V5", key: "1frdt8" }],
|
|
21
|
+
["path", { d: "M8 17v-3", key: "17ska0" }]
|
|
22
|
+
]);
|
|
23
|
+
/**
|
|
24
|
+
* @license lucide-react v0.453.0 - ISC
|
|
25
|
+
*
|
|
26
|
+
* This source code is licensed under the ISC license.
|
|
27
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
28
|
+
*/
|
|
29
|
+
const Kn = ve("Info", [
|
|
30
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
31
|
+
["path", { d: "M12 16v-4", key: "1dtifu" }],
|
|
32
|
+
["path", { d: "M12 8h.01", key: "e9boi3" }]
|
|
33
|
+
]);
|
|
34
|
+
/**
|
|
35
|
+
* @license lucide-react v0.453.0 - ISC
|
|
36
|
+
*
|
|
37
|
+
* This source code is licensed under the ISC license.
|
|
38
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
39
|
+
*/
|
|
40
|
+
const $n = ve("SlidersHorizontal", [
|
|
41
|
+
["line", { x1: "21", x2: "14", y1: "4", y2: "4", key: "obuewd" }],
|
|
42
|
+
["line", { x1: "10", x2: "3", y1: "4", y2: "4", key: "1q6298" }],
|
|
43
|
+
["line", { x1: "21", x2: "12", y1: "12", y2: "12", key: "1iu8h1" }],
|
|
44
|
+
["line", { x1: "8", x2: "3", y1: "12", y2: "12", key: "ntss68" }],
|
|
45
|
+
["line", { x1: "21", x2: "16", y1: "20", y2: "20", key: "14d8ph" }],
|
|
46
|
+
["line", { x1: "12", x2: "3", y1: "20", y2: "20", key: "m0wm8r" }],
|
|
47
|
+
["line", { x1: "14", x2: "14", y1: "2", y2: "6", key: "14e1ph" }],
|
|
48
|
+
["line", { x1: "8", x2: "8", y1: "10", y2: "14", key: "1i6ji0" }],
|
|
49
|
+
["line", { x1: "16", x2: "16", y1: "18", y2: "22", key: "1lctlv" }]
|
|
50
|
+
]);
|
|
51
|
+
/**
|
|
52
|
+
* @license lucide-react v0.453.0 - ISC
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the ISC license.
|
|
55
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/
|
|
57
|
+
const Vn = ve("Table2", [
|
|
58
|
+
[
|
|
59
|
+
"path",
|
|
60
|
+
{
|
|
61
|
+
d: "M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",
|
|
62
|
+
key: "gugj83"
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
]);
|
|
66
|
+
/**
|
|
67
|
+
* @license lucide-react v0.453.0 - ISC
|
|
68
|
+
*
|
|
69
|
+
* This source code is licensed under the ISC license.
|
|
70
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
+
*/
|
|
72
|
+
const Bn = ve("Type", [
|
|
73
|
+
["polyline", { points: "4 7 4 4 20 4 20 7", key: "1nosan" }],
|
|
74
|
+
["line", { x1: "9", x2: "15", y1: "20", y2: "20", key: "swin9y" }],
|
|
75
|
+
["line", { x1: "12", x2: "12", y1: "4", y2: "20", key: "1tx1rr" }]
|
|
76
|
+
]);
|
|
77
|
+
/**
|
|
78
|
+
* @license lucide-react v0.453.0 - ISC
|
|
79
|
+
*
|
|
80
|
+
* This source code is licensed under the ISC license.
|
|
81
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
82
|
+
*/
|
|
83
|
+
const Un = ve("Upload", [
|
|
84
|
+
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
|
|
85
|
+
["polyline", { points: "17 8 12 3 7 8", key: "t8dd8p" }],
|
|
86
|
+
["line", { x1: "12", x2: "12", y1: "3", y2: "15", key: "widbto" }]
|
|
87
|
+
]);
|
|
88
|
+
var Ue = "rovingFocusGroup.onEntryFocus", Wr = { bubbles: !1, cancelable: !0 }, Re = "RovingFocusGroup", [Ye, wt, Yr] = Ar(Re), [jr, St] = Ee(
|
|
89
|
+
Re,
|
|
90
|
+
[Yr]
|
|
91
|
+
), [Gr, Xr] = jr(Re), xt = a.forwardRef(
|
|
92
|
+
(e, t) => /* @__PURE__ */ u(Ye.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ u(Ye.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ u(qr, { ...e, ref: t }) }) })
|
|
93
|
+
);
|
|
94
|
+
xt.displayName = Re;
|
|
95
|
+
var qr = a.forwardRef((e, t) => {
|
|
96
|
+
const {
|
|
97
|
+
__scopeRovingFocusGroup: r,
|
|
98
|
+
orientation: o,
|
|
99
|
+
loop: n = !1,
|
|
100
|
+
dir: i,
|
|
101
|
+
currentTabStopId: s,
|
|
102
|
+
defaultCurrentTabStopId: c,
|
|
103
|
+
onCurrentTabStopIdChange: l,
|
|
104
|
+
onEntryFocus: f,
|
|
105
|
+
preventScrollOnEntryFocus: d = !1,
|
|
106
|
+
...h
|
|
107
|
+
} = e, v = a.useRef(null), m = q(t, v), b = qe(i), [P, g] = Le({
|
|
108
|
+
prop: s,
|
|
109
|
+
defaultProp: c ?? null,
|
|
110
|
+
onChange: l,
|
|
111
|
+
caller: Re
|
|
112
|
+
}), [w, _] = a.useState(!1), S = ae(f), k = wt(r), R = a.useRef(!1), [H, K] = a.useState(0);
|
|
113
|
+
return a.useEffect(() => {
|
|
114
|
+
const A = v.current;
|
|
115
|
+
if (A)
|
|
116
|
+
return A.addEventListener(Ue, S), () => A.removeEventListener(Ue, S);
|
|
117
|
+
}, [S]), /* @__PURE__ */ u(
|
|
118
|
+
Gr,
|
|
119
|
+
{
|
|
120
|
+
scope: r,
|
|
121
|
+
orientation: o,
|
|
122
|
+
dir: b,
|
|
123
|
+
loop: n,
|
|
124
|
+
currentTabStopId: P,
|
|
125
|
+
onItemFocus: a.useCallback(
|
|
126
|
+
(A) => g(A),
|
|
127
|
+
[g]
|
|
128
|
+
),
|
|
129
|
+
onItemShiftTab: a.useCallback(() => _(!0), []),
|
|
130
|
+
onFocusableItemAdd: a.useCallback(
|
|
131
|
+
() => K((A) => A + 1),
|
|
132
|
+
[]
|
|
133
|
+
),
|
|
134
|
+
onFocusableItemRemove: a.useCallback(
|
|
135
|
+
() => K((A) => A - 1),
|
|
136
|
+
[]
|
|
137
|
+
),
|
|
138
|
+
children: /* @__PURE__ */ u(
|
|
139
|
+
B.div,
|
|
140
|
+
{
|
|
141
|
+
tabIndex: w || H === 0 ? -1 : 0,
|
|
142
|
+
"data-orientation": o,
|
|
143
|
+
...h,
|
|
144
|
+
ref: m,
|
|
145
|
+
style: { outline: "none", ...e.style },
|
|
146
|
+
onMouseDown: L(e.onMouseDown, () => {
|
|
147
|
+
R.current = !0;
|
|
148
|
+
}),
|
|
149
|
+
onFocus: L(e.onFocus, (A) => {
|
|
150
|
+
const C = !R.current;
|
|
151
|
+
if (A.target === A.currentTarget && C && !w) {
|
|
152
|
+
const M = new CustomEvent(Ue, Wr);
|
|
153
|
+
if (A.currentTarget.dispatchEvent(M), !M.defaultPrevented) {
|
|
154
|
+
const $ = k().filter((j) => j.focusable), de = $.find((j) => j.active), ie = $.find((j) => j.id === P), se = [de, ie, ...$].filter(
|
|
155
|
+
Boolean
|
|
156
|
+
).map((j) => j.ref.current);
|
|
157
|
+
Et(se, d);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
R.current = !1;
|
|
161
|
+
}),
|
|
162
|
+
onBlur: L(e.onBlur, () => _(!1))
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
}
|
|
166
|
+
);
|
|
167
|
+
}), Ct = "RovingFocusGroupItem", Tt = a.forwardRef(
|
|
168
|
+
(e, t) => {
|
|
169
|
+
const {
|
|
170
|
+
__scopeRovingFocusGroup: r,
|
|
171
|
+
focusable: o = !0,
|
|
172
|
+
active: n = !1,
|
|
173
|
+
tabStopId: i,
|
|
174
|
+
children: s,
|
|
175
|
+
...c
|
|
176
|
+
} = e, l = Xe(), f = i || l, d = Xr(Ct, r), h = d.currentTabStopId === f, v = wt(r), { onFocusableItemAdd: m, onFocusableItemRemove: b, currentTabStopId: P } = d;
|
|
177
|
+
return a.useEffect(() => {
|
|
178
|
+
if (o)
|
|
179
|
+
return m(), () => b();
|
|
180
|
+
}, [o, m, b]), /* @__PURE__ */ u(
|
|
181
|
+
Ye.ItemSlot,
|
|
182
|
+
{
|
|
183
|
+
scope: r,
|
|
184
|
+
id: f,
|
|
185
|
+
focusable: o,
|
|
186
|
+
active: n,
|
|
187
|
+
children: /* @__PURE__ */ u(
|
|
188
|
+
B.span,
|
|
189
|
+
{
|
|
190
|
+
tabIndex: h ? 0 : -1,
|
|
191
|
+
"data-orientation": d.orientation,
|
|
192
|
+
...c,
|
|
193
|
+
ref: t,
|
|
194
|
+
onMouseDown: L(e.onMouseDown, (g) => {
|
|
195
|
+
o ? d.onItemFocus(f) : g.preventDefault();
|
|
196
|
+
}),
|
|
197
|
+
onFocus: L(e.onFocus, () => d.onItemFocus(f)),
|
|
198
|
+
onKeyDown: L(e.onKeyDown, (g) => {
|
|
199
|
+
if (g.key === "Tab" && g.shiftKey) {
|
|
200
|
+
d.onItemShiftTab();
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (g.target !== g.currentTarget) return;
|
|
204
|
+
const w = Zr(g, d.orientation, d.dir);
|
|
205
|
+
if (w !== void 0) {
|
|
206
|
+
if (g.metaKey || g.ctrlKey || g.altKey || g.shiftKey) return;
|
|
207
|
+
g.preventDefault();
|
|
208
|
+
let S = v().filter((k) => k.focusable).map((k) => k.ref.current);
|
|
209
|
+
if (w === "last") S.reverse();
|
|
210
|
+
else if (w === "prev" || w === "next") {
|
|
211
|
+
w === "prev" && S.reverse();
|
|
212
|
+
const k = S.indexOf(g.currentTarget);
|
|
213
|
+
S = d.loop ? eo(S, k + 1) : S.slice(k + 1);
|
|
214
|
+
}
|
|
215
|
+
setTimeout(() => Et(S));
|
|
216
|
+
}
|
|
217
|
+
}),
|
|
218
|
+
children: typeof s == "function" ? s({ isCurrentTabStop: h, hasTabStop: P != null }) : s
|
|
219
|
+
}
|
|
220
|
+
)
|
|
221
|
+
}
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
);
|
|
225
|
+
Tt.displayName = Ct;
|
|
226
|
+
var Qr = {
|
|
227
|
+
ArrowLeft: "prev",
|
|
228
|
+
ArrowUp: "prev",
|
|
229
|
+
ArrowRight: "next",
|
|
230
|
+
ArrowDown: "next",
|
|
231
|
+
PageUp: "first",
|
|
232
|
+
Home: "first",
|
|
233
|
+
PageDown: "last",
|
|
234
|
+
End: "last"
|
|
235
|
+
};
|
|
236
|
+
function Jr(e, t) {
|
|
237
|
+
return t !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
|
|
238
|
+
}
|
|
239
|
+
function Zr(e, t, r) {
|
|
240
|
+
const o = Jr(e.key, r);
|
|
241
|
+
if (!(t === "vertical" && ["ArrowLeft", "ArrowRight"].includes(o)) && !(t === "horizontal" && ["ArrowUp", "ArrowDown"].includes(o)))
|
|
242
|
+
return Qr[o];
|
|
243
|
+
}
|
|
244
|
+
function Et(e, t = !1) {
|
|
245
|
+
const r = document.activeElement;
|
|
246
|
+
for (const o of e)
|
|
247
|
+
if (o === r || (o.focus({ preventScroll: t }), document.activeElement !== r)) return;
|
|
248
|
+
}
|
|
249
|
+
function eo(e, t) {
|
|
250
|
+
return e.map((r, o) => e[(t + o) % e.length]);
|
|
251
|
+
}
|
|
252
|
+
var to = xt, ro = Tt, oo = [
|
|
253
|
+
"a",
|
|
254
|
+
"button",
|
|
255
|
+
"div",
|
|
256
|
+
"form",
|
|
257
|
+
"h2",
|
|
258
|
+
"h3",
|
|
259
|
+
"img",
|
|
260
|
+
"input",
|
|
261
|
+
"label",
|
|
262
|
+
"li",
|
|
263
|
+
"nav",
|
|
264
|
+
"ol",
|
|
265
|
+
"p",
|
|
266
|
+
"select",
|
|
267
|
+
"span",
|
|
268
|
+
"svg",
|
|
269
|
+
"ul"
|
|
270
|
+
], no = oo.reduce((e, t) => {
|
|
271
|
+
const r = gt(`Primitive.${t}`), o = a.forwardRef((n, i) => {
|
|
272
|
+
const { asChild: s, ...c } = n, l = s ? r : t;
|
|
273
|
+
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ u(l, { ...c, ref: i });
|
|
274
|
+
});
|
|
275
|
+
return o.displayName = `Primitive.${t}`, { ...e, [t]: o };
|
|
276
|
+
}, {}), ao = "Label", Rt = a.forwardRef((e, t) => /* @__PURE__ */ u(
|
|
277
|
+
no.label,
|
|
278
|
+
{
|
|
279
|
+
...e,
|
|
280
|
+
ref: t,
|
|
281
|
+
onMouseDown: (r) => {
|
|
282
|
+
var n;
|
|
283
|
+
r.target.closest("button, input, select, textarea") || ((n = e.onMouseDown) == null || n.call(e, r), !r.defaultPrevented && r.detail > 1 && r.preventDefault());
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
));
|
|
287
|
+
Rt.displayName = ao;
|
|
288
|
+
var Pt = Rt;
|
|
289
|
+
const io = me(
|
|
290
|
+
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
291
|
+
), so = a.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ u(
|
|
292
|
+
Pt,
|
|
293
|
+
{
|
|
294
|
+
ref: r,
|
|
295
|
+
className: X(io(), e),
|
|
296
|
+
...t
|
|
297
|
+
}
|
|
298
|
+
));
|
|
299
|
+
so.displayName = Pt.displayName;
|
|
300
|
+
const lo = me(
|
|
301
|
+
// Control radius flows from the active Semaphor/shadcn radius variable so dense editor
|
|
302
|
+
// surfaces (`size="xs"`) sit flush next to dialog forms (`size="sm"`)
|
|
303
|
+
// and stock forms (`size="default"`) without the 5px/6px mismatch that
|
|
304
|
+
// used to appear when an xs trigger sat next to a sm input. See
|
|
305
|
+
// CHANGES.md § Control radius.
|
|
306
|
+
"flex w-full rounded-control border border-input bg-background file:border-0 file:bg-transparent file:font-medium placeholder:text-[hsl(var(--semaphor-placeholder-foreground))] focus-visible:border-ring focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
307
|
+
{
|
|
308
|
+
variants: {
|
|
309
|
+
size: {
|
|
310
|
+
default: "h-10 px-3 py-2 text-sm file:text-sm",
|
|
311
|
+
sm: "h-8 px-2.5 py-1.5 text-[13px] file:text-[13px]",
|
|
312
|
+
xs: "h-7 px-2 py-1 text-[12px] file:text-[12px]"
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
defaultVariants: {
|
|
316
|
+
size: "default"
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
), co = a.forwardRef(
|
|
320
|
+
({ className: e, type: t, size: r, ...o }, n) => /* @__PURE__ */ u(
|
|
321
|
+
"input",
|
|
322
|
+
{
|
|
323
|
+
type: t,
|
|
324
|
+
className: X(lo({ size: r, className: e })),
|
|
325
|
+
ref: n,
|
|
326
|
+
...o
|
|
327
|
+
}
|
|
328
|
+
)
|
|
329
|
+
);
|
|
330
|
+
co.displayName = "Input";
|
|
331
|
+
var Oe = "Tabs", [uo] = Ee(Oe, [
|
|
332
|
+
St
|
|
333
|
+
]), _t = St(), [fo, Qe] = uo(Oe), It = a.forwardRef(
|
|
334
|
+
(e, t) => {
|
|
335
|
+
const {
|
|
336
|
+
__scopeTabs: r,
|
|
337
|
+
value: o,
|
|
338
|
+
onValueChange: n,
|
|
339
|
+
defaultValue: i,
|
|
340
|
+
orientation: s = "horizontal",
|
|
341
|
+
dir: c,
|
|
342
|
+
activationMode: l = "automatic",
|
|
343
|
+
...f
|
|
344
|
+
} = e, d = qe(c), [h, v] = Le({
|
|
345
|
+
prop: o,
|
|
346
|
+
onChange: n,
|
|
347
|
+
defaultProp: i ?? "",
|
|
348
|
+
caller: Oe
|
|
349
|
+
});
|
|
350
|
+
return /* @__PURE__ */ u(
|
|
351
|
+
fo,
|
|
352
|
+
{
|
|
353
|
+
scope: r,
|
|
354
|
+
baseId: Xe(),
|
|
355
|
+
value: h,
|
|
356
|
+
onValueChange: v,
|
|
357
|
+
orientation: s,
|
|
358
|
+
dir: d,
|
|
359
|
+
activationMode: l,
|
|
360
|
+
children: /* @__PURE__ */ u(
|
|
361
|
+
B.div,
|
|
362
|
+
{
|
|
363
|
+
dir: d,
|
|
364
|
+
"data-orientation": s,
|
|
365
|
+
...f,
|
|
366
|
+
ref: t
|
|
367
|
+
}
|
|
368
|
+
)
|
|
369
|
+
}
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
);
|
|
373
|
+
It.displayName = Oe;
|
|
374
|
+
var kt = "TabsList", Nt = a.forwardRef(
|
|
375
|
+
(e, t) => {
|
|
376
|
+
const { __scopeTabs: r, loop: o = !0, ...n } = e, i = Qe(kt, r), s = _t(r);
|
|
377
|
+
return /* @__PURE__ */ u(
|
|
378
|
+
to,
|
|
379
|
+
{
|
|
380
|
+
asChild: !0,
|
|
381
|
+
...s,
|
|
382
|
+
orientation: i.orientation,
|
|
383
|
+
dir: i.dir,
|
|
384
|
+
loop: o,
|
|
385
|
+
children: /* @__PURE__ */ u(
|
|
386
|
+
B.div,
|
|
387
|
+
{
|
|
388
|
+
role: "tablist",
|
|
389
|
+
"aria-orientation": i.orientation,
|
|
390
|
+
...n,
|
|
391
|
+
ref: t
|
|
392
|
+
}
|
|
393
|
+
)
|
|
394
|
+
}
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
);
|
|
398
|
+
Nt.displayName = kt;
|
|
399
|
+
var At = "TabsTrigger", Dt = a.forwardRef(
|
|
400
|
+
(e, t) => {
|
|
401
|
+
const { __scopeTabs: r, value: o, disabled: n = !1, ...i } = e, s = Qe(At, r), c = _t(r), l = Mt(s.baseId, o), f = Ft(s.baseId, o), d = o === s.value;
|
|
402
|
+
return /* @__PURE__ */ u(
|
|
403
|
+
ro,
|
|
404
|
+
{
|
|
405
|
+
asChild: !0,
|
|
406
|
+
...c,
|
|
407
|
+
focusable: !n,
|
|
408
|
+
active: d,
|
|
409
|
+
children: /* @__PURE__ */ u(
|
|
410
|
+
B.button,
|
|
411
|
+
{
|
|
412
|
+
type: "button",
|
|
413
|
+
role: "tab",
|
|
414
|
+
"aria-selected": d,
|
|
415
|
+
"aria-controls": f,
|
|
416
|
+
"data-state": d ? "active" : "inactive",
|
|
417
|
+
"data-disabled": n ? "" : void 0,
|
|
418
|
+
disabled: n,
|
|
419
|
+
id: l,
|
|
420
|
+
...i,
|
|
421
|
+
ref: t,
|
|
422
|
+
onMouseDown: L(e.onMouseDown, (h) => {
|
|
423
|
+
!n && h.button === 0 && h.ctrlKey === !1 ? s.onValueChange(o) : h.preventDefault();
|
|
424
|
+
}),
|
|
425
|
+
onKeyDown: L(e.onKeyDown, (h) => {
|
|
426
|
+
[" ", "Enter"].includes(h.key) && s.onValueChange(o);
|
|
427
|
+
}),
|
|
428
|
+
onFocus: L(e.onFocus, () => {
|
|
429
|
+
const h = s.activationMode !== "manual";
|
|
430
|
+
!d && !n && h && s.onValueChange(o);
|
|
431
|
+
})
|
|
432
|
+
}
|
|
433
|
+
)
|
|
434
|
+
}
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
);
|
|
438
|
+
Dt.displayName = At;
|
|
439
|
+
var Lt = "TabsContent", Ot = a.forwardRef(
|
|
440
|
+
(e, t) => {
|
|
441
|
+
const { __scopeTabs: r, value: o, forceMount: n, children: i, ...s } = e, c = Qe(Lt, r), l = Mt(c.baseId, o), f = Ft(c.baseId, o), d = o === c.value, h = a.useRef(d);
|
|
442
|
+
return a.useEffect(() => {
|
|
443
|
+
const v = requestAnimationFrame(() => h.current = !1);
|
|
444
|
+
return () => cancelAnimationFrame(v);
|
|
445
|
+
}, []), /* @__PURE__ */ u(ce, { present: n || d, children: ({ present: v }) => /* @__PURE__ */ u(
|
|
446
|
+
B.div,
|
|
447
|
+
{
|
|
448
|
+
"data-state": d ? "active" : "inactive",
|
|
449
|
+
"data-orientation": c.orientation,
|
|
450
|
+
role: "tabpanel",
|
|
451
|
+
"aria-labelledby": l,
|
|
452
|
+
hidden: !v,
|
|
453
|
+
id: f,
|
|
454
|
+
tabIndex: 0,
|
|
455
|
+
...s,
|
|
456
|
+
ref: t,
|
|
457
|
+
style: {
|
|
458
|
+
...e.style,
|
|
459
|
+
animationDuration: h.current ? "0s" : void 0
|
|
460
|
+
},
|
|
461
|
+
children: v && i
|
|
462
|
+
}
|
|
463
|
+
) });
|
|
464
|
+
}
|
|
465
|
+
);
|
|
466
|
+
Ot.displayName = Lt;
|
|
467
|
+
function Mt(e, t) {
|
|
468
|
+
return `${e}-trigger-${t}`;
|
|
469
|
+
}
|
|
470
|
+
function Ft(e, t) {
|
|
471
|
+
return `${e}-content-${t}`;
|
|
472
|
+
}
|
|
473
|
+
var po = It, zt = Nt, Ht = Dt, Kt = Ot;
|
|
474
|
+
const Wn = po, ho = me("text-muted-foreground", {
|
|
475
|
+
variants: {
|
|
476
|
+
variant: {
|
|
477
|
+
segmented: "inline-flex items-center justify-center rounded-control bg-muted",
|
|
478
|
+
underline: "flex h-auto items-center gap-6 border-b border-border/60 bg-transparent p-0"
|
|
479
|
+
},
|
|
480
|
+
size: {
|
|
481
|
+
// Applied via compoundVariants to segmented only — underline
|
|
482
|
+
// deliberately has no size variant.
|
|
483
|
+
default: "",
|
|
484
|
+
sm: "",
|
|
485
|
+
xs: ""
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
compoundVariants: [
|
|
489
|
+
{ variant: "segmented", size: "default", className: "h-10 p-1" },
|
|
490
|
+
{ variant: "segmented", size: "sm", className: "h-8 p-0.5" },
|
|
491
|
+
{
|
|
492
|
+
variant: "segmented",
|
|
493
|
+
size: "xs",
|
|
494
|
+
className: "h-7 p-0.5"
|
|
495
|
+
}
|
|
496
|
+
],
|
|
497
|
+
defaultVariants: {
|
|
498
|
+
variant: "segmented",
|
|
499
|
+
size: "default"
|
|
500
|
+
}
|
|
501
|
+
}), vo = me(
|
|
502
|
+
"inline-flex items-center justify-center whitespace-nowrap font-medium ring-offset-background transition-all focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50",
|
|
503
|
+
{
|
|
504
|
+
variants: {
|
|
505
|
+
variant: {
|
|
506
|
+
segmented: "rounded-control focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
|
|
507
|
+
underline: "-mb-px border-b-2 border-transparent px-0.5 pb-2.5 text-[13px] font-normal hover:text-foreground focus-visible:text-foreground data-[state=active]:border-foreground data-[state=active]:font-medium data-[state=active]:text-foreground"
|
|
508
|
+
},
|
|
509
|
+
size: {
|
|
510
|
+
default: "",
|
|
511
|
+
sm: "",
|
|
512
|
+
xs: ""
|
|
513
|
+
}
|
|
514
|
+
},
|
|
515
|
+
compoundVariants: [
|
|
516
|
+
{ variant: "segmented", size: "default", className: "px-3 py-1.5 text-sm" },
|
|
517
|
+
{
|
|
518
|
+
variant: "segmented",
|
|
519
|
+
size: "sm",
|
|
520
|
+
className: "px-2.5 py-1 text-[13px]"
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
variant: "segmented",
|
|
524
|
+
size: "xs",
|
|
525
|
+
className: "px-2 py-0.5 text-[12px]"
|
|
526
|
+
}
|
|
527
|
+
],
|
|
528
|
+
defaultVariants: {
|
|
529
|
+
variant: "segmented",
|
|
530
|
+
size: "default"
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
), $t = a.createContext({ variant: "segmented", size: "default" }), mo = a.forwardRef(({ className: e, variant: t, size: r, ...o }, n) => {
|
|
534
|
+
const i = t ?? "segmented", s = r ?? "default";
|
|
535
|
+
return /* @__PURE__ */ u(
|
|
536
|
+
$t.Provider,
|
|
537
|
+
{
|
|
538
|
+
value: { variant: i, size: s },
|
|
539
|
+
children: /* @__PURE__ */ u(
|
|
540
|
+
zt,
|
|
541
|
+
{
|
|
542
|
+
ref: n,
|
|
543
|
+
className: X(
|
|
544
|
+
ho({
|
|
545
|
+
variant: i,
|
|
546
|
+
size: s
|
|
547
|
+
}),
|
|
548
|
+
e
|
|
549
|
+
),
|
|
550
|
+
...o
|
|
551
|
+
}
|
|
552
|
+
)
|
|
553
|
+
}
|
|
554
|
+
);
|
|
555
|
+
});
|
|
556
|
+
mo.displayName = zt.displayName;
|
|
557
|
+
const bo = a.forwardRef(({ className: e, variant: t, size: r, ...o }, n) => {
|
|
558
|
+
const i = a.useContext($t);
|
|
559
|
+
return /* @__PURE__ */ u(
|
|
560
|
+
Ht,
|
|
561
|
+
{
|
|
562
|
+
ref: n,
|
|
563
|
+
className: X(
|
|
564
|
+
vo({
|
|
565
|
+
variant: t ?? i.variant,
|
|
566
|
+
size: r ?? i.size
|
|
567
|
+
}),
|
|
568
|
+
e
|
|
569
|
+
),
|
|
570
|
+
...o
|
|
571
|
+
}
|
|
572
|
+
);
|
|
573
|
+
});
|
|
574
|
+
bo.displayName = Ht.displayName;
|
|
575
|
+
const go = a.forwardRef(({ className: e, ...t }, r) => (
|
|
576
|
+
// Radix sets `tabindex="0"` on content panels so keyboard users can
|
|
577
|
+
// reach them. The default shadcn styling paints a 2px ring around the
|
|
578
|
+
// whole panel on focus, which shows a thick outline around any card
|
|
579
|
+
// rendered inside the panel. Inner controls have their own focus
|
|
580
|
+
// indicators, so we suppress the panel-level halo entirely.
|
|
581
|
+
/* @__PURE__ */ u(
|
|
582
|
+
Kt,
|
|
583
|
+
{
|
|
584
|
+
ref: r,
|
|
585
|
+
className: X(
|
|
586
|
+
"mt-2 focus:outline-none focus-visible:outline-none",
|
|
587
|
+
e
|
|
588
|
+
),
|
|
589
|
+
...t
|
|
590
|
+
}
|
|
591
|
+
)
|
|
592
|
+
));
|
|
593
|
+
go.displayName = Kt.displayName;
|
|
594
|
+
var yo = [
|
|
595
|
+
"a",
|
|
596
|
+
"button",
|
|
597
|
+
"div",
|
|
598
|
+
"form",
|
|
599
|
+
"h2",
|
|
600
|
+
"h3",
|
|
601
|
+
"img",
|
|
602
|
+
"input",
|
|
603
|
+
"label",
|
|
604
|
+
"li",
|
|
605
|
+
"nav",
|
|
606
|
+
"ol",
|
|
607
|
+
"p",
|
|
608
|
+
"select",
|
|
609
|
+
"span",
|
|
610
|
+
"svg",
|
|
611
|
+
"ul"
|
|
612
|
+
], wo = yo.reduce((e, t) => {
|
|
613
|
+
const r = gt(`Primitive.${t}`), o = a.forwardRef((n, i) => {
|
|
614
|
+
const { asChild: s, ...c } = n, l = s ? r : t;
|
|
615
|
+
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ u(l, { ...c, ref: i });
|
|
616
|
+
});
|
|
617
|
+
return o.displayName = `Primitive.${t}`, { ...e, [t]: o };
|
|
618
|
+
}, {}), So = "Separator", dt = "horizontal", xo = ["horizontal", "vertical"], Vt = a.forwardRef((e, t) => {
|
|
619
|
+
const { decorative: r, orientation: o = dt, ...n } = e, i = Co(o) ? o : dt, c = r ? { role: "none" } : { "aria-orientation": i === "vertical" ? i : void 0, role: "separator" };
|
|
620
|
+
return /* @__PURE__ */ u(
|
|
621
|
+
wo.div,
|
|
622
|
+
{
|
|
623
|
+
"data-orientation": i,
|
|
624
|
+
...c,
|
|
625
|
+
...n,
|
|
626
|
+
ref: t
|
|
627
|
+
}
|
|
628
|
+
);
|
|
629
|
+
});
|
|
630
|
+
Vt.displayName = So;
|
|
631
|
+
function Co(e) {
|
|
632
|
+
return xo.includes(e);
|
|
633
|
+
}
|
|
634
|
+
var Bt = Vt;
|
|
635
|
+
const To = a.forwardRef(
|
|
636
|
+
({ className: e, orientation: t = "horizontal", decorative: r = !0, ...o }, n) => /* @__PURE__ */ u(
|
|
637
|
+
Bt,
|
|
638
|
+
{
|
|
639
|
+
ref: n,
|
|
640
|
+
decorative: r,
|
|
641
|
+
orientation: t,
|
|
642
|
+
className: X(
|
|
643
|
+
"shrink-0 bg-border",
|
|
644
|
+
t === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
645
|
+
e
|
|
646
|
+
),
|
|
647
|
+
...o
|
|
648
|
+
}
|
|
649
|
+
)
|
|
650
|
+
);
|
|
651
|
+
To.displayName = Bt.displayName;
|
|
652
|
+
function Eo(e, t) {
|
|
653
|
+
return a.useReducer((r, o) => t[r][o] ?? r, e);
|
|
654
|
+
}
|
|
655
|
+
var Je = "ScrollArea", [Ut] = Ee(Je), [Ro, Y] = Ut(Je), Wt = a.forwardRef(
|
|
656
|
+
(e, t) => {
|
|
657
|
+
const {
|
|
658
|
+
__scopeScrollArea: r,
|
|
659
|
+
type: o = "hover",
|
|
660
|
+
dir: n,
|
|
661
|
+
scrollHideDelay: i = 600,
|
|
662
|
+
...s
|
|
663
|
+
} = e, [c, l] = a.useState(null), [f, d] = a.useState(null), [h, v] = a.useState(null), [m, b] = a.useState(null), [P, g] = a.useState(null), [w, _] = a.useState(0), [S, k] = a.useState(0), [R, H] = a.useState(!1), [K, A] = a.useState(!1), C = q(t, ($) => l($)), M = qe(n);
|
|
664
|
+
return /* @__PURE__ */ u(
|
|
665
|
+
Ro,
|
|
666
|
+
{
|
|
667
|
+
scope: r,
|
|
668
|
+
type: o,
|
|
669
|
+
dir: M,
|
|
670
|
+
scrollHideDelay: i,
|
|
671
|
+
scrollArea: c,
|
|
672
|
+
viewport: f,
|
|
673
|
+
onViewportChange: d,
|
|
674
|
+
content: h,
|
|
675
|
+
onContentChange: v,
|
|
676
|
+
scrollbarX: m,
|
|
677
|
+
onScrollbarXChange: b,
|
|
678
|
+
scrollbarXEnabled: R,
|
|
679
|
+
onScrollbarXEnabledChange: H,
|
|
680
|
+
scrollbarY: P,
|
|
681
|
+
onScrollbarYChange: g,
|
|
682
|
+
scrollbarYEnabled: K,
|
|
683
|
+
onScrollbarYEnabledChange: A,
|
|
684
|
+
onCornerWidthChange: _,
|
|
685
|
+
onCornerHeightChange: k,
|
|
686
|
+
children: /* @__PURE__ */ u(
|
|
687
|
+
B.div,
|
|
688
|
+
{
|
|
689
|
+
dir: M,
|
|
690
|
+
...s,
|
|
691
|
+
ref: C,
|
|
692
|
+
style: {
|
|
693
|
+
position: "relative",
|
|
694
|
+
// Pass corner sizes as CSS vars to reduce re-renders of context consumers
|
|
695
|
+
"--radix-scroll-area-corner-width": w + "px",
|
|
696
|
+
"--radix-scroll-area-corner-height": S + "px",
|
|
697
|
+
...e.style
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
)
|
|
701
|
+
}
|
|
702
|
+
);
|
|
703
|
+
}
|
|
704
|
+
);
|
|
705
|
+
Wt.displayName = Je;
|
|
706
|
+
var Yt = "ScrollAreaViewport", jt = a.forwardRef(
|
|
707
|
+
(e, t) => {
|
|
708
|
+
const { __scopeScrollArea: r, children: o, nonce: n, ...i } = e, s = Y(Yt, r), c = a.useRef(null), l = q(t, c, s.onViewportChange);
|
|
709
|
+
return /* @__PURE__ */ le(bt, { children: [
|
|
710
|
+
/* @__PURE__ */ u(
|
|
711
|
+
"style",
|
|
712
|
+
{
|
|
713
|
+
dangerouslySetInnerHTML: {
|
|
714
|
+
__html: "[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"
|
|
715
|
+
},
|
|
716
|
+
nonce: n
|
|
717
|
+
}
|
|
718
|
+
),
|
|
719
|
+
/* @__PURE__ */ u(
|
|
720
|
+
B.div,
|
|
721
|
+
{
|
|
722
|
+
"data-radix-scroll-area-viewport": "",
|
|
723
|
+
...i,
|
|
724
|
+
ref: l,
|
|
725
|
+
style: {
|
|
726
|
+
/**
|
|
727
|
+
* We don't support `visible` because the intention is to have at least one scrollbar
|
|
728
|
+
* if this component is used and `visible` will behave like `auto` in that case
|
|
729
|
+
* https://developer.mozilla.org/en-US/docs/Web/CSS/overflow#description
|
|
730
|
+
*
|
|
731
|
+
* We don't handle `auto` because the intention is for the native implementation
|
|
732
|
+
* to be hidden if using this component. We just want to ensure the node is scrollable
|
|
733
|
+
* so could have used either `scroll` or `auto` here. We picked `scroll` to prevent
|
|
734
|
+
* the browser from having to work out whether to render native scrollbars or not,
|
|
735
|
+
* we tell it to with the intention of hiding them in CSS.
|
|
736
|
+
*/
|
|
737
|
+
overflowX: s.scrollbarXEnabled ? "scroll" : "hidden",
|
|
738
|
+
overflowY: s.scrollbarYEnabled ? "scroll" : "hidden",
|
|
739
|
+
...e.style
|
|
740
|
+
},
|
|
741
|
+
children: /* @__PURE__ */ u("div", { ref: s.onContentChange, style: { minWidth: "100%", display: "table" }, children: o })
|
|
742
|
+
}
|
|
743
|
+
)
|
|
744
|
+
] });
|
|
745
|
+
}
|
|
746
|
+
);
|
|
747
|
+
jt.displayName = Yt;
|
|
748
|
+
var ee = "ScrollAreaScrollbar", Ze = a.forwardRef(
|
|
749
|
+
(e, t) => {
|
|
750
|
+
const { forceMount: r, ...o } = e, n = Y(ee, e.__scopeScrollArea), { onScrollbarXEnabledChange: i, onScrollbarYEnabledChange: s } = n, c = e.orientation === "horizontal";
|
|
751
|
+
return a.useEffect(() => (c ? i(!0) : s(!0), () => {
|
|
752
|
+
c ? i(!1) : s(!1);
|
|
753
|
+
}), [c, i, s]), n.type === "hover" ? /* @__PURE__ */ u(Po, { ...o, ref: t, forceMount: r }) : n.type === "scroll" ? /* @__PURE__ */ u(_o, { ...o, ref: t, forceMount: r }) : n.type === "auto" ? /* @__PURE__ */ u(Gt, { ...o, ref: t, forceMount: r }) : n.type === "always" ? /* @__PURE__ */ u(et, { ...o, ref: t }) : null;
|
|
754
|
+
}
|
|
755
|
+
);
|
|
756
|
+
Ze.displayName = ee;
|
|
757
|
+
var Po = a.forwardRef((e, t) => {
|
|
758
|
+
const { forceMount: r, ...o } = e, n = Y(ee, e.__scopeScrollArea), [i, s] = a.useState(!1);
|
|
759
|
+
return a.useEffect(() => {
|
|
760
|
+
const c = n.scrollArea;
|
|
761
|
+
let l = 0;
|
|
762
|
+
if (c) {
|
|
763
|
+
const f = () => {
|
|
764
|
+
window.clearTimeout(l), s(!0);
|
|
765
|
+
}, d = () => {
|
|
766
|
+
l = window.setTimeout(() => s(!1), n.scrollHideDelay);
|
|
767
|
+
};
|
|
768
|
+
return c.addEventListener("pointerenter", f), c.addEventListener("pointerleave", d), () => {
|
|
769
|
+
window.clearTimeout(l), c.removeEventListener("pointerenter", f), c.removeEventListener("pointerleave", d);
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
}, [n.scrollArea, n.scrollHideDelay]), /* @__PURE__ */ u(ce, { present: r || i, children: /* @__PURE__ */ u(
|
|
773
|
+
Gt,
|
|
774
|
+
{
|
|
775
|
+
"data-state": i ? "visible" : "hidden",
|
|
776
|
+
...o,
|
|
777
|
+
ref: t
|
|
778
|
+
}
|
|
779
|
+
) });
|
|
780
|
+
}), _o = a.forwardRef((e, t) => {
|
|
781
|
+
const { forceMount: r, ...o } = e, n = Y(ee, e.__scopeScrollArea), i = e.orientation === "horizontal", s = Fe(() => l("SCROLL_END"), 100), [c, l] = Eo("hidden", {
|
|
782
|
+
hidden: {
|
|
783
|
+
SCROLL: "scrolling"
|
|
784
|
+
},
|
|
785
|
+
scrolling: {
|
|
786
|
+
SCROLL_END: "idle",
|
|
787
|
+
POINTER_ENTER: "interacting"
|
|
788
|
+
},
|
|
789
|
+
interacting: {
|
|
790
|
+
SCROLL: "interacting",
|
|
791
|
+
POINTER_LEAVE: "idle"
|
|
792
|
+
},
|
|
793
|
+
idle: {
|
|
794
|
+
HIDE: "hidden",
|
|
795
|
+
SCROLL: "scrolling",
|
|
796
|
+
POINTER_ENTER: "interacting"
|
|
797
|
+
}
|
|
798
|
+
});
|
|
799
|
+
return a.useEffect(() => {
|
|
800
|
+
if (c === "idle") {
|
|
801
|
+
const f = window.setTimeout(() => l("HIDE"), n.scrollHideDelay);
|
|
802
|
+
return () => window.clearTimeout(f);
|
|
803
|
+
}
|
|
804
|
+
}, [c, n.scrollHideDelay, l]), a.useEffect(() => {
|
|
805
|
+
const f = n.viewport, d = i ? "scrollLeft" : "scrollTop";
|
|
806
|
+
if (f) {
|
|
807
|
+
let h = f[d];
|
|
808
|
+
const v = () => {
|
|
809
|
+
const m = f[d];
|
|
810
|
+
h !== m && (l("SCROLL"), s()), h = m;
|
|
811
|
+
};
|
|
812
|
+
return f.addEventListener("scroll", v), () => f.removeEventListener("scroll", v);
|
|
813
|
+
}
|
|
814
|
+
}, [n.viewport, i, l, s]), /* @__PURE__ */ u(ce, { present: r || c !== "hidden", children: /* @__PURE__ */ u(
|
|
815
|
+
et,
|
|
816
|
+
{
|
|
817
|
+
"data-state": c === "hidden" ? "hidden" : "visible",
|
|
818
|
+
...o,
|
|
819
|
+
ref: t,
|
|
820
|
+
onPointerEnter: L(e.onPointerEnter, () => l("POINTER_ENTER")),
|
|
821
|
+
onPointerLeave: L(e.onPointerLeave, () => l("POINTER_LEAVE"))
|
|
822
|
+
}
|
|
823
|
+
) });
|
|
824
|
+
}), Gt = a.forwardRef((e, t) => {
|
|
825
|
+
const r = Y(ee, e.__scopeScrollArea), { forceMount: o, ...n } = e, [i, s] = a.useState(!1), c = e.orientation === "horizontal", l = Fe(() => {
|
|
826
|
+
if (r.viewport) {
|
|
827
|
+
const f = r.viewport.offsetWidth < r.viewport.scrollWidth, d = r.viewport.offsetHeight < r.viewport.scrollHeight;
|
|
828
|
+
s(c ? f : d);
|
|
829
|
+
}
|
|
830
|
+
}, 10);
|
|
831
|
+
return pe(r.viewport, l), pe(r.content, l), /* @__PURE__ */ u(ce, { present: o || i, children: /* @__PURE__ */ u(
|
|
832
|
+
et,
|
|
833
|
+
{
|
|
834
|
+
"data-state": i ? "visible" : "hidden",
|
|
835
|
+
...n,
|
|
836
|
+
ref: t
|
|
837
|
+
}
|
|
838
|
+
) });
|
|
839
|
+
}), et = a.forwardRef((e, t) => {
|
|
840
|
+
const { orientation: r = "vertical", ...o } = e, n = Y(ee, e.__scopeScrollArea), i = a.useRef(null), s = a.useRef(0), [c, l] = a.useState({
|
|
841
|
+
content: 0,
|
|
842
|
+
viewport: 0,
|
|
843
|
+
scrollbar: { size: 0, paddingStart: 0, paddingEnd: 0 }
|
|
844
|
+
}), f = Zt(c.viewport, c.content), d = {
|
|
845
|
+
...o,
|
|
846
|
+
sizes: c,
|
|
847
|
+
onSizesChange: l,
|
|
848
|
+
hasThumb: f > 0 && f < 1,
|
|
849
|
+
onThumbChange: (v) => i.current = v,
|
|
850
|
+
onThumbPointerUp: () => s.current = 0,
|
|
851
|
+
onThumbPointerDown: (v) => s.current = v
|
|
852
|
+
};
|
|
853
|
+
function h(v, m) {
|
|
854
|
+
return Lo(v, s.current, c, m);
|
|
855
|
+
}
|
|
856
|
+
return r === "horizontal" ? /* @__PURE__ */ u(
|
|
857
|
+
Io,
|
|
858
|
+
{
|
|
859
|
+
...d,
|
|
860
|
+
ref: t,
|
|
861
|
+
onThumbPositionChange: () => {
|
|
862
|
+
if (n.viewport && i.current) {
|
|
863
|
+
const v = n.viewport.scrollLeft, m = ut(v, c, n.dir);
|
|
864
|
+
i.current.style.transform = `translate3d(${m}px, 0, 0)`;
|
|
865
|
+
}
|
|
866
|
+
},
|
|
867
|
+
onWheelScroll: (v) => {
|
|
868
|
+
n.viewport && (n.viewport.scrollLeft = v);
|
|
869
|
+
},
|
|
870
|
+
onDragScroll: (v) => {
|
|
871
|
+
n.viewport && (n.viewport.scrollLeft = h(v, n.dir));
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
) : r === "vertical" ? /* @__PURE__ */ u(
|
|
875
|
+
ko,
|
|
876
|
+
{
|
|
877
|
+
...d,
|
|
878
|
+
ref: t,
|
|
879
|
+
onThumbPositionChange: () => {
|
|
880
|
+
if (n.viewport && i.current) {
|
|
881
|
+
const v = n.viewport.scrollTop, m = ut(v, c);
|
|
882
|
+
i.current.style.transform = `translate3d(0, ${m}px, 0)`;
|
|
883
|
+
}
|
|
884
|
+
},
|
|
885
|
+
onWheelScroll: (v) => {
|
|
886
|
+
n.viewport && (n.viewport.scrollTop = v);
|
|
887
|
+
},
|
|
888
|
+
onDragScroll: (v) => {
|
|
889
|
+
n.viewport && (n.viewport.scrollTop = h(v));
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
) : null;
|
|
893
|
+
}), Io = a.forwardRef((e, t) => {
|
|
894
|
+
const { sizes: r, onSizesChange: o, ...n } = e, i = Y(ee, e.__scopeScrollArea), [s, c] = a.useState(), l = a.useRef(null), f = q(t, l, i.onScrollbarXChange);
|
|
895
|
+
return a.useEffect(() => {
|
|
896
|
+
l.current && c(getComputedStyle(l.current));
|
|
897
|
+
}, [l]), /* @__PURE__ */ u(
|
|
898
|
+
qt,
|
|
899
|
+
{
|
|
900
|
+
"data-orientation": "horizontal",
|
|
901
|
+
...n,
|
|
902
|
+
ref: f,
|
|
903
|
+
sizes: r,
|
|
904
|
+
style: {
|
|
905
|
+
bottom: 0,
|
|
906
|
+
left: i.dir === "rtl" ? "var(--radix-scroll-area-corner-width)" : 0,
|
|
907
|
+
right: i.dir === "ltr" ? "var(--radix-scroll-area-corner-width)" : 0,
|
|
908
|
+
"--radix-scroll-area-thumb-width": Me(r) + "px",
|
|
909
|
+
...e.style
|
|
910
|
+
},
|
|
911
|
+
onThumbPointerDown: (d) => e.onThumbPointerDown(d.x),
|
|
912
|
+
onDragScroll: (d) => e.onDragScroll(d.x),
|
|
913
|
+
onWheelScroll: (d, h) => {
|
|
914
|
+
if (i.viewport) {
|
|
915
|
+
const v = i.viewport.scrollLeft + d.deltaX;
|
|
916
|
+
e.onWheelScroll(v), tr(v, h) && d.preventDefault();
|
|
917
|
+
}
|
|
918
|
+
},
|
|
919
|
+
onResize: () => {
|
|
920
|
+
l.current && i.viewport && s && o({
|
|
921
|
+
content: i.viewport.scrollWidth,
|
|
922
|
+
viewport: i.viewport.offsetWidth,
|
|
923
|
+
scrollbar: {
|
|
924
|
+
size: l.current.clientWidth,
|
|
925
|
+
paddingStart: De(s.paddingLeft),
|
|
926
|
+
paddingEnd: De(s.paddingRight)
|
|
927
|
+
}
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
);
|
|
932
|
+
}), ko = a.forwardRef((e, t) => {
|
|
933
|
+
const { sizes: r, onSizesChange: o, ...n } = e, i = Y(ee, e.__scopeScrollArea), [s, c] = a.useState(), l = a.useRef(null), f = q(t, l, i.onScrollbarYChange);
|
|
934
|
+
return a.useEffect(() => {
|
|
935
|
+
l.current && c(getComputedStyle(l.current));
|
|
936
|
+
}, [l]), /* @__PURE__ */ u(
|
|
937
|
+
qt,
|
|
938
|
+
{
|
|
939
|
+
"data-orientation": "vertical",
|
|
940
|
+
...n,
|
|
941
|
+
ref: f,
|
|
942
|
+
sizes: r,
|
|
943
|
+
style: {
|
|
944
|
+
top: 0,
|
|
945
|
+
right: i.dir === "ltr" ? 0 : void 0,
|
|
946
|
+
left: i.dir === "rtl" ? 0 : void 0,
|
|
947
|
+
bottom: "var(--radix-scroll-area-corner-height)",
|
|
948
|
+
"--radix-scroll-area-thumb-height": Me(r) + "px",
|
|
949
|
+
...e.style
|
|
950
|
+
},
|
|
951
|
+
onThumbPointerDown: (d) => e.onThumbPointerDown(d.y),
|
|
952
|
+
onDragScroll: (d) => e.onDragScroll(d.y),
|
|
953
|
+
onWheelScroll: (d, h) => {
|
|
954
|
+
if (i.viewport) {
|
|
955
|
+
const v = i.viewport.scrollTop + d.deltaY;
|
|
956
|
+
e.onWheelScroll(v), tr(v, h) && d.preventDefault();
|
|
957
|
+
}
|
|
958
|
+
},
|
|
959
|
+
onResize: () => {
|
|
960
|
+
l.current && i.viewport && s && o({
|
|
961
|
+
content: i.viewport.scrollHeight,
|
|
962
|
+
viewport: i.viewport.offsetHeight,
|
|
963
|
+
scrollbar: {
|
|
964
|
+
size: l.current.clientHeight,
|
|
965
|
+
paddingStart: De(s.paddingTop),
|
|
966
|
+
paddingEnd: De(s.paddingBottom)
|
|
967
|
+
}
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
);
|
|
972
|
+
}), [No, Xt] = Ut(ee), qt = a.forwardRef((e, t) => {
|
|
973
|
+
const {
|
|
974
|
+
__scopeScrollArea: r,
|
|
975
|
+
sizes: o,
|
|
976
|
+
hasThumb: n,
|
|
977
|
+
onThumbChange: i,
|
|
978
|
+
onThumbPointerUp: s,
|
|
979
|
+
onThumbPointerDown: c,
|
|
980
|
+
onThumbPositionChange: l,
|
|
981
|
+
onDragScroll: f,
|
|
982
|
+
onWheelScroll: d,
|
|
983
|
+
onResize: h,
|
|
984
|
+
...v
|
|
985
|
+
} = e, m = Y(ee, r), [b, P] = a.useState(null), g = q(t, (C) => P(C)), w = a.useRef(null), _ = a.useRef(""), S = m.viewport, k = o.content - o.viewport, R = ae(d), H = ae(l), K = Fe(h, 10);
|
|
986
|
+
function A(C) {
|
|
987
|
+
if (w.current) {
|
|
988
|
+
const M = C.clientX - w.current.left, $ = C.clientY - w.current.top;
|
|
989
|
+
f({ x: M, y: $ });
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
return a.useEffect(() => {
|
|
993
|
+
const C = (M) => {
|
|
994
|
+
const $ = M.target;
|
|
995
|
+
(b == null ? void 0 : b.contains($)) && R(M, k);
|
|
996
|
+
};
|
|
997
|
+
return document.addEventListener("wheel", C, { passive: !1 }), () => document.removeEventListener("wheel", C, { passive: !1 });
|
|
998
|
+
}, [S, b, k, R]), a.useEffect(H, [o, H]), pe(b, K), pe(m.content, K), /* @__PURE__ */ u(
|
|
999
|
+
No,
|
|
1000
|
+
{
|
|
1001
|
+
scope: r,
|
|
1002
|
+
scrollbar: b,
|
|
1003
|
+
hasThumb: n,
|
|
1004
|
+
onThumbChange: ae(i),
|
|
1005
|
+
onThumbPointerUp: ae(s),
|
|
1006
|
+
onThumbPositionChange: H,
|
|
1007
|
+
onThumbPointerDown: ae(c),
|
|
1008
|
+
children: /* @__PURE__ */ u(
|
|
1009
|
+
B.div,
|
|
1010
|
+
{
|
|
1011
|
+
...v,
|
|
1012
|
+
ref: g,
|
|
1013
|
+
style: { position: "absolute", ...v.style },
|
|
1014
|
+
onPointerDown: L(e.onPointerDown, (C) => {
|
|
1015
|
+
C.button === 0 && (C.target.setPointerCapture(C.pointerId), w.current = b.getBoundingClientRect(), _.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", m.viewport && (m.viewport.style.scrollBehavior = "auto"), A(C));
|
|
1016
|
+
}),
|
|
1017
|
+
onPointerMove: L(e.onPointerMove, A),
|
|
1018
|
+
onPointerUp: L(e.onPointerUp, (C) => {
|
|
1019
|
+
const M = C.target;
|
|
1020
|
+
M.hasPointerCapture(C.pointerId) && M.releasePointerCapture(C.pointerId), document.body.style.webkitUserSelect = _.current, m.viewport && (m.viewport.style.scrollBehavior = ""), w.current = null;
|
|
1021
|
+
})
|
|
1022
|
+
}
|
|
1023
|
+
)
|
|
1024
|
+
}
|
|
1025
|
+
);
|
|
1026
|
+
}), Ae = "ScrollAreaThumb", Qt = a.forwardRef(
|
|
1027
|
+
(e, t) => {
|
|
1028
|
+
const { forceMount: r, ...o } = e, n = Xt(Ae, e.__scopeScrollArea);
|
|
1029
|
+
return /* @__PURE__ */ u(ce, { present: r || n.hasThumb, children: /* @__PURE__ */ u(Ao, { ref: t, ...o }) });
|
|
1030
|
+
}
|
|
1031
|
+
), Ao = a.forwardRef(
|
|
1032
|
+
(e, t) => {
|
|
1033
|
+
const { __scopeScrollArea: r, style: o, ...n } = e, i = Y(Ae, r), s = Xt(Ae, r), { onThumbPositionChange: c } = s, l = q(
|
|
1034
|
+
t,
|
|
1035
|
+
(h) => s.onThumbChange(h)
|
|
1036
|
+
), f = a.useRef(void 0), d = Fe(() => {
|
|
1037
|
+
f.current && (f.current(), f.current = void 0);
|
|
1038
|
+
}, 100);
|
|
1039
|
+
return a.useEffect(() => {
|
|
1040
|
+
const h = i.viewport;
|
|
1041
|
+
if (h) {
|
|
1042
|
+
const v = () => {
|
|
1043
|
+
if (d(), !f.current) {
|
|
1044
|
+
const m = Oo(h, c);
|
|
1045
|
+
f.current = m, c();
|
|
1046
|
+
}
|
|
1047
|
+
};
|
|
1048
|
+
return c(), h.addEventListener("scroll", v), () => h.removeEventListener("scroll", v);
|
|
1049
|
+
}
|
|
1050
|
+
}, [i.viewport, d, c]), /* @__PURE__ */ u(
|
|
1051
|
+
B.div,
|
|
1052
|
+
{
|
|
1053
|
+
"data-state": s.hasThumb ? "visible" : "hidden",
|
|
1054
|
+
...n,
|
|
1055
|
+
ref: l,
|
|
1056
|
+
style: {
|
|
1057
|
+
width: "var(--radix-scroll-area-thumb-width)",
|
|
1058
|
+
height: "var(--radix-scroll-area-thumb-height)",
|
|
1059
|
+
...o
|
|
1060
|
+
},
|
|
1061
|
+
onPointerDownCapture: L(e.onPointerDownCapture, (h) => {
|
|
1062
|
+
const m = h.target.getBoundingClientRect(), b = h.clientX - m.left, P = h.clientY - m.top;
|
|
1063
|
+
s.onThumbPointerDown({ x: b, y: P });
|
|
1064
|
+
}),
|
|
1065
|
+
onPointerUp: L(e.onPointerUp, s.onThumbPointerUp)
|
|
1066
|
+
}
|
|
1067
|
+
);
|
|
1068
|
+
}
|
|
1069
|
+
);
|
|
1070
|
+
Qt.displayName = Ae;
|
|
1071
|
+
var tt = "ScrollAreaCorner", Jt = a.forwardRef(
|
|
1072
|
+
(e, t) => {
|
|
1073
|
+
const r = Y(tt, e.__scopeScrollArea), o = !!(r.scrollbarX && r.scrollbarY);
|
|
1074
|
+
return r.type !== "scroll" && o ? /* @__PURE__ */ u(Do, { ...e, ref: t }) : null;
|
|
1075
|
+
}
|
|
1076
|
+
);
|
|
1077
|
+
Jt.displayName = tt;
|
|
1078
|
+
var Do = a.forwardRef((e, t) => {
|
|
1079
|
+
const { __scopeScrollArea: r, ...o } = e, n = Y(tt, r), [i, s] = a.useState(0), [c, l] = a.useState(0), f = !!(i && c);
|
|
1080
|
+
return pe(n.scrollbarX, () => {
|
|
1081
|
+
var h;
|
|
1082
|
+
const d = ((h = n.scrollbarX) == null ? void 0 : h.offsetHeight) || 0;
|
|
1083
|
+
n.onCornerHeightChange(d), l(d);
|
|
1084
|
+
}), pe(n.scrollbarY, () => {
|
|
1085
|
+
var h;
|
|
1086
|
+
const d = ((h = n.scrollbarY) == null ? void 0 : h.offsetWidth) || 0;
|
|
1087
|
+
n.onCornerWidthChange(d), s(d);
|
|
1088
|
+
}), f ? /* @__PURE__ */ u(
|
|
1089
|
+
B.div,
|
|
1090
|
+
{
|
|
1091
|
+
...o,
|
|
1092
|
+
ref: t,
|
|
1093
|
+
style: {
|
|
1094
|
+
width: i,
|
|
1095
|
+
height: c,
|
|
1096
|
+
position: "absolute",
|
|
1097
|
+
right: n.dir === "ltr" ? 0 : void 0,
|
|
1098
|
+
left: n.dir === "rtl" ? 0 : void 0,
|
|
1099
|
+
bottom: 0,
|
|
1100
|
+
...e.style
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
) : null;
|
|
1104
|
+
});
|
|
1105
|
+
function De(e) {
|
|
1106
|
+
return e ? parseInt(e, 10) : 0;
|
|
1107
|
+
}
|
|
1108
|
+
function Zt(e, t) {
|
|
1109
|
+
const r = e / t;
|
|
1110
|
+
return isNaN(r) ? 0 : r;
|
|
1111
|
+
}
|
|
1112
|
+
function Me(e) {
|
|
1113
|
+
const t = Zt(e.viewport, e.content), r = e.scrollbar.paddingStart + e.scrollbar.paddingEnd, o = (e.scrollbar.size - r) * t;
|
|
1114
|
+
return Math.max(o, 18);
|
|
1115
|
+
}
|
|
1116
|
+
function Lo(e, t, r, o = "ltr") {
|
|
1117
|
+
const n = Me(r), i = n / 2, s = t || i, c = n - s, l = r.scrollbar.paddingStart + s, f = r.scrollbar.size - r.scrollbar.paddingEnd - c, d = r.content - r.viewport, h = o === "ltr" ? [0, d] : [d * -1, 0];
|
|
1118
|
+
return er([l, f], h)(e);
|
|
1119
|
+
}
|
|
1120
|
+
function ut(e, t, r = "ltr") {
|
|
1121
|
+
const o = Me(t), n = t.scrollbar.paddingStart + t.scrollbar.paddingEnd, i = t.scrollbar.size - n, s = t.content - t.viewport, c = i - o, l = r === "ltr" ? [0, s] : [s * -1, 0], f = Lr(e, l);
|
|
1122
|
+
return er([0, s], [0, c])(f);
|
|
1123
|
+
}
|
|
1124
|
+
function er(e, t) {
|
|
1125
|
+
return (r) => {
|
|
1126
|
+
if (e[0] === e[1] || t[0] === t[1]) return t[0];
|
|
1127
|
+
const o = (t[1] - t[0]) / (e[1] - e[0]);
|
|
1128
|
+
return t[0] + o * (r - e[0]);
|
|
1129
|
+
};
|
|
1130
|
+
}
|
|
1131
|
+
function tr(e, t) {
|
|
1132
|
+
return e > 0 && e < t;
|
|
1133
|
+
}
|
|
1134
|
+
var Oo = (e, t = () => {
|
|
1135
|
+
}) => {
|
|
1136
|
+
let r = { left: e.scrollLeft, top: e.scrollTop }, o = 0;
|
|
1137
|
+
return function n() {
|
|
1138
|
+
const i = { left: e.scrollLeft, top: e.scrollTop }, s = r.left !== i.left, c = r.top !== i.top;
|
|
1139
|
+
(s || c) && t(), r = i, o = window.requestAnimationFrame(n);
|
|
1140
|
+
}(), () => window.cancelAnimationFrame(o);
|
|
1141
|
+
};
|
|
1142
|
+
function Fe(e, t) {
|
|
1143
|
+
const r = ae(e), o = a.useRef(0);
|
|
1144
|
+
return a.useEffect(() => () => window.clearTimeout(o.current), []), a.useCallback(() => {
|
|
1145
|
+
window.clearTimeout(o.current), o.current = window.setTimeout(r, t);
|
|
1146
|
+
}, [r, t]);
|
|
1147
|
+
}
|
|
1148
|
+
function pe(e, t) {
|
|
1149
|
+
const r = ae(t);
|
|
1150
|
+
Dr(() => {
|
|
1151
|
+
let o = 0;
|
|
1152
|
+
if (e) {
|
|
1153
|
+
const n = new ResizeObserver(() => {
|
|
1154
|
+
cancelAnimationFrame(o), o = window.requestAnimationFrame(r);
|
|
1155
|
+
});
|
|
1156
|
+
return n.observe(e), () => {
|
|
1157
|
+
window.cancelAnimationFrame(o), n.unobserve(e);
|
|
1158
|
+
};
|
|
1159
|
+
}
|
|
1160
|
+
}, [e, r]);
|
|
1161
|
+
}
|
|
1162
|
+
var rr = Wt, Mo = jt, Fo = Jt;
|
|
1163
|
+
const zo = a.forwardRef(({ className: e, children: t, ...r }, o) => /* @__PURE__ */ le(
|
|
1164
|
+
rr,
|
|
1165
|
+
{
|
|
1166
|
+
ref: o,
|
|
1167
|
+
className: X("relative overflow-hidden", e),
|
|
1168
|
+
...r,
|
|
1169
|
+
children: [
|
|
1170
|
+
/* @__PURE__ */ u(Mo, { className: "h-full w-full rounded-[inherit]", children: t }),
|
|
1171
|
+
/* @__PURE__ */ u(or, {}),
|
|
1172
|
+
/* @__PURE__ */ u(Fo, {})
|
|
1173
|
+
]
|
|
1174
|
+
}
|
|
1175
|
+
));
|
|
1176
|
+
zo.displayName = rr.displayName;
|
|
1177
|
+
const or = a.forwardRef(({ className: e, orientation: t = "vertical", ...r }, o) => /* @__PURE__ */ u(
|
|
1178
|
+
Ze,
|
|
1179
|
+
{
|
|
1180
|
+
ref: o,
|
|
1181
|
+
orientation: t,
|
|
1182
|
+
className: X(
|
|
1183
|
+
"flex touch-none select-none transition-colors",
|
|
1184
|
+
t === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
|
|
1185
|
+
t === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
|
|
1186
|
+
e
|
|
1187
|
+
),
|
|
1188
|
+
...r,
|
|
1189
|
+
children: /* @__PURE__ */ u(Qt, { className: "relative flex-1 rounded-full bg-border" })
|
|
1190
|
+
}
|
|
1191
|
+
));
|
|
1192
|
+
or.displayName = Ze.displayName;
|
|
1193
|
+
var Ho = Symbol("radix.slottable");
|
|
1194
|
+
// @__NO_SIDE_EFFECTS__
|
|
1195
|
+
function Ko(e) {
|
|
1196
|
+
const t = ({ children: r }) => /* @__PURE__ */ u(bt, { children: r });
|
|
1197
|
+
return t.displayName = `${e}.Slottable`, t.__radixId = Ho, t;
|
|
1198
|
+
}
|
|
1199
|
+
var [ze] = Ee("Tooltip", [
|
|
1200
|
+
yt
|
|
1201
|
+
]), He = yt(), nr = "TooltipProvider", $o = 700, je = "tooltip.open", [Vo, rt] = ze(nr), ar = (e) => {
|
|
1202
|
+
const {
|
|
1203
|
+
__scopeTooltip: t,
|
|
1204
|
+
delayDuration: r = $o,
|
|
1205
|
+
skipDelayDuration: o = 300,
|
|
1206
|
+
disableHoverableContent: n = !1,
|
|
1207
|
+
children: i
|
|
1208
|
+
} = e, s = a.useRef(!0), c = a.useRef(!1), l = a.useRef(0);
|
|
1209
|
+
return a.useEffect(() => {
|
|
1210
|
+
const f = l.current;
|
|
1211
|
+
return () => window.clearTimeout(f);
|
|
1212
|
+
}, []), /* @__PURE__ */ u(
|
|
1213
|
+
Vo,
|
|
1214
|
+
{
|
|
1215
|
+
scope: t,
|
|
1216
|
+
isOpenDelayedRef: s,
|
|
1217
|
+
delayDuration: r,
|
|
1218
|
+
onOpen: a.useCallback(() => {
|
|
1219
|
+
window.clearTimeout(l.current), s.current = !1;
|
|
1220
|
+
}, []),
|
|
1221
|
+
onClose: a.useCallback(() => {
|
|
1222
|
+
window.clearTimeout(l.current), l.current = window.setTimeout(
|
|
1223
|
+
() => s.current = !0,
|
|
1224
|
+
o
|
|
1225
|
+
);
|
|
1226
|
+
}, [o]),
|
|
1227
|
+
isPointerInTransitRef: c,
|
|
1228
|
+
onPointerInTransitChange: a.useCallback((f) => {
|
|
1229
|
+
c.current = f;
|
|
1230
|
+
}, []),
|
|
1231
|
+
disableHoverableContent: n,
|
|
1232
|
+
children: i
|
|
1233
|
+
}
|
|
1234
|
+
);
|
|
1235
|
+
};
|
|
1236
|
+
ar.displayName = nr;
|
|
1237
|
+
var Te = "Tooltip", [Bo, Pe] = ze(Te), ir = (e) => {
|
|
1238
|
+
const {
|
|
1239
|
+
__scopeTooltip: t,
|
|
1240
|
+
children: r,
|
|
1241
|
+
open: o,
|
|
1242
|
+
defaultOpen: n,
|
|
1243
|
+
onOpenChange: i,
|
|
1244
|
+
disableHoverableContent: s,
|
|
1245
|
+
delayDuration: c
|
|
1246
|
+
} = e, l = rt(Te, e.__scopeTooltip), f = He(t), [d, h] = a.useState(null), v = Xe(), m = a.useRef(0), b = s ?? l.disableHoverableContent, P = c ?? l.delayDuration, g = a.useRef(!1), [w, _] = Le({
|
|
1247
|
+
prop: o,
|
|
1248
|
+
defaultProp: n ?? !1,
|
|
1249
|
+
onChange: (K) => {
|
|
1250
|
+
K ? (l.onOpen(), document.dispatchEvent(new CustomEvent(je))) : l.onClose(), i == null || i(K);
|
|
1251
|
+
},
|
|
1252
|
+
caller: Te
|
|
1253
|
+
}), S = a.useMemo(() => w ? g.current ? "delayed-open" : "instant-open" : "closed", [w]), k = a.useCallback(() => {
|
|
1254
|
+
window.clearTimeout(m.current), m.current = 0, g.current = !1, _(!0);
|
|
1255
|
+
}, [_]), R = a.useCallback(() => {
|
|
1256
|
+
window.clearTimeout(m.current), m.current = 0, _(!1);
|
|
1257
|
+
}, [_]), H = a.useCallback(() => {
|
|
1258
|
+
window.clearTimeout(m.current), m.current = window.setTimeout(() => {
|
|
1259
|
+
g.current = !0, _(!0), m.current = 0;
|
|
1260
|
+
}, P);
|
|
1261
|
+
}, [P, _]);
|
|
1262
|
+
return a.useEffect(() => () => {
|
|
1263
|
+
m.current && (window.clearTimeout(m.current), m.current = 0);
|
|
1264
|
+
}, []), /* @__PURE__ */ u(Hr, { ...f, children: /* @__PURE__ */ u(
|
|
1265
|
+
Bo,
|
|
1266
|
+
{
|
|
1267
|
+
scope: t,
|
|
1268
|
+
contentId: v,
|
|
1269
|
+
open: w,
|
|
1270
|
+
stateAttribute: S,
|
|
1271
|
+
trigger: d,
|
|
1272
|
+
onTriggerChange: h,
|
|
1273
|
+
onTriggerEnter: a.useCallback(() => {
|
|
1274
|
+
l.isOpenDelayedRef.current ? H() : k();
|
|
1275
|
+
}, [l.isOpenDelayedRef, H, k]),
|
|
1276
|
+
onTriggerLeave: a.useCallback(() => {
|
|
1277
|
+
b ? R() : (window.clearTimeout(m.current), m.current = 0);
|
|
1278
|
+
}, [R, b]),
|
|
1279
|
+
onOpen: k,
|
|
1280
|
+
onClose: R,
|
|
1281
|
+
disableHoverableContent: b,
|
|
1282
|
+
children: r
|
|
1283
|
+
}
|
|
1284
|
+
) });
|
|
1285
|
+
};
|
|
1286
|
+
ir.displayName = Te;
|
|
1287
|
+
var Ge = "TooltipTrigger", sr = a.forwardRef(
|
|
1288
|
+
(e, t) => {
|
|
1289
|
+
const { __scopeTooltip: r, ...o } = e, n = Pe(Ge, r), i = rt(Ge, r), s = He(r), c = a.useRef(null), l = q(t, c, n.onTriggerChange), f = a.useRef(!1), d = a.useRef(!1), h = a.useCallback(() => f.current = !1, []);
|
|
1290
|
+
return a.useEffect(() => () => document.removeEventListener("pointerup", h), [h]), /* @__PURE__ */ u(Kr, { asChild: !0, ...s, children: /* @__PURE__ */ u(
|
|
1291
|
+
B.button,
|
|
1292
|
+
{
|
|
1293
|
+
"aria-describedby": n.open ? n.contentId : void 0,
|
|
1294
|
+
"data-state": n.stateAttribute,
|
|
1295
|
+
...o,
|
|
1296
|
+
ref: l,
|
|
1297
|
+
onPointerMove: L(e.onPointerMove, (v) => {
|
|
1298
|
+
v.pointerType !== "touch" && !d.current && !i.isPointerInTransitRef.current && (n.onTriggerEnter(), d.current = !0);
|
|
1299
|
+
}),
|
|
1300
|
+
onPointerLeave: L(e.onPointerLeave, () => {
|
|
1301
|
+
n.onTriggerLeave(), d.current = !1;
|
|
1302
|
+
}),
|
|
1303
|
+
onPointerDown: L(e.onPointerDown, () => {
|
|
1304
|
+
n.open && n.onClose(), f.current = !0, document.addEventListener("pointerup", h, { once: !0 });
|
|
1305
|
+
}),
|
|
1306
|
+
onFocus: L(e.onFocus, () => {
|
|
1307
|
+
f.current || n.onOpen();
|
|
1308
|
+
}),
|
|
1309
|
+
onBlur: L(e.onBlur, n.onClose),
|
|
1310
|
+
onClick: L(e.onClick, n.onClose)
|
|
1311
|
+
}
|
|
1312
|
+
) });
|
|
1313
|
+
}
|
|
1314
|
+
);
|
|
1315
|
+
sr.displayName = Ge;
|
|
1316
|
+
var ot = "TooltipPortal", [Uo, Wo] = ze(ot, {
|
|
1317
|
+
forceMount: void 0
|
|
1318
|
+
}), lr = (e) => {
|
|
1319
|
+
const { __scopeTooltip: t, forceMount: r, children: o, container: n } = e, i = Pe(ot, t);
|
|
1320
|
+
return /* @__PURE__ */ u(Uo, { scope: t, forceMount: r, children: /* @__PURE__ */ u(ce, { present: r || i.open, children: /* @__PURE__ */ u(Or, { asChild: !0, container: n, children: o }) }) });
|
|
1321
|
+
};
|
|
1322
|
+
lr.displayName = ot;
|
|
1323
|
+
var he = "TooltipContent", cr = a.forwardRef(
|
|
1324
|
+
(e, t) => {
|
|
1325
|
+
const r = Wo(he, e.__scopeTooltip), { forceMount: o = r.forceMount, side: n = "top", ...i } = e, s = Pe(he, e.__scopeTooltip);
|
|
1326
|
+
return /* @__PURE__ */ u(ce, { present: o || s.open, children: s.disableHoverableContent ? /* @__PURE__ */ u(dr, { side: n, ...i, ref: t }) : /* @__PURE__ */ u(Yo, { side: n, ...i, ref: t }) });
|
|
1327
|
+
}
|
|
1328
|
+
), Yo = a.forwardRef((e, t) => {
|
|
1329
|
+
const r = Pe(he, e.__scopeTooltip), o = rt(he, e.__scopeTooltip), n = a.useRef(null), i = q(t, n), [s, c] = a.useState(null), { trigger: l, onClose: f } = r, d = n.current, { onPointerInTransitChange: h } = o, v = a.useCallback(() => {
|
|
1330
|
+
c(null), h(!1);
|
|
1331
|
+
}, [h]), m = a.useCallback(
|
|
1332
|
+
(b, P) => {
|
|
1333
|
+
const g = b.currentTarget, w = { x: b.clientX, y: b.clientY }, _ = qo(w, g.getBoundingClientRect()), S = Qo(w, _), k = Jo(P.getBoundingClientRect()), R = en([...S, ...k]);
|
|
1334
|
+
c(R), h(!0);
|
|
1335
|
+
},
|
|
1336
|
+
[h]
|
|
1337
|
+
);
|
|
1338
|
+
return a.useEffect(() => () => v(), [v]), a.useEffect(() => {
|
|
1339
|
+
if (l && d) {
|
|
1340
|
+
const b = (g) => m(g, d), P = (g) => m(g, l);
|
|
1341
|
+
return l.addEventListener("pointerleave", b), d.addEventListener("pointerleave", P), () => {
|
|
1342
|
+
l.removeEventListener("pointerleave", b), d.removeEventListener("pointerleave", P);
|
|
1343
|
+
};
|
|
1344
|
+
}
|
|
1345
|
+
}, [l, d, m, v]), a.useEffect(() => {
|
|
1346
|
+
if (s) {
|
|
1347
|
+
const b = (P) => {
|
|
1348
|
+
const g = P.target, w = { x: P.clientX, y: P.clientY }, _ = (l == null ? void 0 : l.contains(g)) || (d == null ? void 0 : d.contains(g)), S = !Zo(w, s);
|
|
1349
|
+
_ ? v() : S && (v(), f());
|
|
1350
|
+
};
|
|
1351
|
+
return document.addEventListener("pointermove", b), () => document.removeEventListener("pointermove", b);
|
|
1352
|
+
}
|
|
1353
|
+
}, [l, d, s, f, v]), /* @__PURE__ */ u(dr, { ...e, ref: i });
|
|
1354
|
+
}), [jo, Go] = ze(Te, { isInside: !1 }), Xo = /* @__PURE__ */ Ko("TooltipContent"), dr = a.forwardRef(
|
|
1355
|
+
(e, t) => {
|
|
1356
|
+
const {
|
|
1357
|
+
__scopeTooltip: r,
|
|
1358
|
+
children: o,
|
|
1359
|
+
"aria-label": n,
|
|
1360
|
+
onEscapeKeyDown: i,
|
|
1361
|
+
onPointerDownOutside: s,
|
|
1362
|
+
...c
|
|
1363
|
+
} = e, l = Pe(he, r), f = He(r), { onClose: d } = l;
|
|
1364
|
+
return a.useEffect(() => (document.addEventListener(je, d), () => document.removeEventListener(je, d)), [d]), a.useEffect(() => {
|
|
1365
|
+
if (l.trigger) {
|
|
1366
|
+
const h = (v) => {
|
|
1367
|
+
const m = v.target;
|
|
1368
|
+
m != null && m.contains(l.trigger) && d();
|
|
1369
|
+
};
|
|
1370
|
+
return window.addEventListener("scroll", h, { capture: !0 }), () => window.removeEventListener("scroll", h, { capture: !0 });
|
|
1371
|
+
}
|
|
1372
|
+
}, [l.trigger, d]), /* @__PURE__ */ u(
|
|
1373
|
+
Mr,
|
|
1374
|
+
{
|
|
1375
|
+
asChild: !0,
|
|
1376
|
+
disableOutsidePointerEvents: !1,
|
|
1377
|
+
onEscapeKeyDown: i,
|
|
1378
|
+
onPointerDownOutside: s,
|
|
1379
|
+
onFocusOutside: (h) => h.preventDefault(),
|
|
1380
|
+
onDismiss: d,
|
|
1381
|
+
children: /* @__PURE__ */ le(
|
|
1382
|
+
Fr,
|
|
1383
|
+
{
|
|
1384
|
+
"data-state": l.stateAttribute,
|
|
1385
|
+
...f,
|
|
1386
|
+
...c,
|
|
1387
|
+
ref: t,
|
|
1388
|
+
style: {
|
|
1389
|
+
...c.style,
|
|
1390
|
+
"--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
1391
|
+
"--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
|
|
1392
|
+
"--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
|
|
1393
|
+
"--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
|
|
1394
|
+
"--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
|
|
1395
|
+
},
|
|
1396
|
+
children: [
|
|
1397
|
+
/* @__PURE__ */ u(Xo, { children: o }),
|
|
1398
|
+
/* @__PURE__ */ u(jo, { scope: r, isInside: !0, children: /* @__PURE__ */ u(zr, { id: l.contentId, role: "tooltip", children: n || o }) })
|
|
1399
|
+
]
|
|
1400
|
+
}
|
|
1401
|
+
)
|
|
1402
|
+
}
|
|
1403
|
+
);
|
|
1404
|
+
}
|
|
1405
|
+
);
|
|
1406
|
+
cr.displayName = he;
|
|
1407
|
+
var ur = "TooltipArrow", fr = a.forwardRef(
|
|
1408
|
+
(e, t) => {
|
|
1409
|
+
const { __scopeTooltip: r, ...o } = e, n = He(r);
|
|
1410
|
+
return Go(
|
|
1411
|
+
ur,
|
|
1412
|
+
r
|
|
1413
|
+
).isInside ? null : /* @__PURE__ */ u($r, { ...n, ...o, ref: t });
|
|
1414
|
+
}
|
|
1415
|
+
);
|
|
1416
|
+
fr.displayName = ur;
|
|
1417
|
+
function qo(e, t) {
|
|
1418
|
+
const r = Math.abs(t.top - e.y), o = Math.abs(t.bottom - e.y), n = Math.abs(t.right - e.x), i = Math.abs(t.left - e.x);
|
|
1419
|
+
switch (Math.min(r, o, n, i)) {
|
|
1420
|
+
case i:
|
|
1421
|
+
return "left";
|
|
1422
|
+
case n:
|
|
1423
|
+
return "right";
|
|
1424
|
+
case r:
|
|
1425
|
+
return "top";
|
|
1426
|
+
case o:
|
|
1427
|
+
return "bottom";
|
|
1428
|
+
default:
|
|
1429
|
+
throw new Error("unreachable");
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
function Qo(e, t, r = 5) {
|
|
1433
|
+
const o = [];
|
|
1434
|
+
switch (t) {
|
|
1435
|
+
case "top":
|
|
1436
|
+
o.push(
|
|
1437
|
+
{ x: e.x - r, y: e.y + r },
|
|
1438
|
+
{ x: e.x + r, y: e.y + r }
|
|
1439
|
+
);
|
|
1440
|
+
break;
|
|
1441
|
+
case "bottom":
|
|
1442
|
+
o.push(
|
|
1443
|
+
{ x: e.x - r, y: e.y - r },
|
|
1444
|
+
{ x: e.x + r, y: e.y - r }
|
|
1445
|
+
);
|
|
1446
|
+
break;
|
|
1447
|
+
case "left":
|
|
1448
|
+
o.push(
|
|
1449
|
+
{ x: e.x + r, y: e.y - r },
|
|
1450
|
+
{ x: e.x + r, y: e.y + r }
|
|
1451
|
+
);
|
|
1452
|
+
break;
|
|
1453
|
+
case "right":
|
|
1454
|
+
o.push(
|
|
1455
|
+
{ x: e.x - r, y: e.y - r },
|
|
1456
|
+
{ x: e.x - r, y: e.y + r }
|
|
1457
|
+
);
|
|
1458
|
+
break;
|
|
1459
|
+
}
|
|
1460
|
+
return o;
|
|
1461
|
+
}
|
|
1462
|
+
function Jo(e) {
|
|
1463
|
+
const { top: t, right: r, bottom: o, left: n } = e;
|
|
1464
|
+
return [
|
|
1465
|
+
{ x: n, y: t },
|
|
1466
|
+
{ x: r, y: t },
|
|
1467
|
+
{ x: r, y: o },
|
|
1468
|
+
{ x: n, y: o }
|
|
1469
|
+
];
|
|
1470
|
+
}
|
|
1471
|
+
function Zo(e, t) {
|
|
1472
|
+
const { x: r, y: o } = e;
|
|
1473
|
+
let n = !1;
|
|
1474
|
+
for (let i = 0, s = t.length - 1; i < t.length; s = i++) {
|
|
1475
|
+
const c = t[i], l = t[s], f = c.x, d = c.y, h = l.x, v = l.y;
|
|
1476
|
+
d > o != v > o && r < (h - f) * (o - d) / (v - d) + f && (n = !n);
|
|
1477
|
+
}
|
|
1478
|
+
return n;
|
|
1479
|
+
}
|
|
1480
|
+
function en(e) {
|
|
1481
|
+
const t = e.slice();
|
|
1482
|
+
return t.sort((r, o) => r.x < o.x ? -1 : r.x > o.x ? 1 : r.y < o.y ? -1 : r.y > o.y ? 1 : 0), tn(t);
|
|
1483
|
+
}
|
|
1484
|
+
function tn(e) {
|
|
1485
|
+
if (e.length <= 1) return e.slice();
|
|
1486
|
+
const t = [];
|
|
1487
|
+
for (let o = 0; o < e.length; o++) {
|
|
1488
|
+
const n = e[o];
|
|
1489
|
+
for (; t.length >= 2; ) {
|
|
1490
|
+
const i = t[t.length - 1], s = t[t.length - 2];
|
|
1491
|
+
if ((i.x - s.x) * (n.y - s.y) >= (i.y - s.y) * (n.x - s.x)) t.pop();
|
|
1492
|
+
else break;
|
|
1493
|
+
}
|
|
1494
|
+
t.push(n);
|
|
1495
|
+
}
|
|
1496
|
+
t.pop();
|
|
1497
|
+
const r = [];
|
|
1498
|
+
for (let o = e.length - 1; o >= 0; o--) {
|
|
1499
|
+
const n = e[o];
|
|
1500
|
+
for (; r.length >= 2; ) {
|
|
1501
|
+
const i = r[r.length - 1], s = r[r.length - 2];
|
|
1502
|
+
if ((i.x - s.x) * (n.y - s.y) >= (i.y - s.y) * (n.x - s.x)) r.pop();
|
|
1503
|
+
else break;
|
|
1504
|
+
}
|
|
1505
|
+
r.push(n);
|
|
1506
|
+
}
|
|
1507
|
+
return r.pop(), t.length === 1 && r.length === 1 && t[0].x === r[0].x && t[0].y === r[0].y ? t : t.concat(r);
|
|
1508
|
+
}
|
|
1509
|
+
var rn = ar, on = ir, nn = sr, an = lr, pr = cr, sn = fr;
|
|
1510
|
+
const Yn = rn, jn = on, Gn = nn, ln = a.forwardRef(({ className: e, sideOffset: t = 4, forceMount: r, ...o }, n) => (
|
|
1511
|
+
// Thread `forceMount` to both Portal and Content. If a caller forces
|
|
1512
|
+
// the tooltip mounted (e.g., for framer-motion exit animations or
|
|
1513
|
+
// layout measurement on a closed tooltip), the outer Portal must also
|
|
1514
|
+
// stay mounted — otherwise the subtree is unmounted regardless of
|
|
1515
|
+
// what the Content receives.
|
|
1516
|
+
/* @__PURE__ */ u(an, { forceMount: r, children: /* @__PURE__ */ u(Vr, { children: /* @__PURE__ */ u(
|
|
1517
|
+
pr,
|
|
1518
|
+
{
|
|
1519
|
+
ref: n,
|
|
1520
|
+
sideOffset: t,
|
|
1521
|
+
forceMount: r,
|
|
1522
|
+
className: X(
|
|
1523
|
+
// Inverted dark tooltip on light bg (and vice versa) — Linear-style.
|
|
1524
|
+
// Small, tight, no border, subtle shadow. See src/components/ui/CHANGES.md.
|
|
1525
|
+
"z-50 overflow-hidden rounded-control bg-foreground px-2 py-1 text-[12px] text-background shadow-sm animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
1526
|
+
e
|
|
1527
|
+
),
|
|
1528
|
+
...o
|
|
1529
|
+
}
|
|
1530
|
+
) }) })
|
|
1531
|
+
));
|
|
1532
|
+
ln.displayName = pr.displayName;
|
|
1533
|
+
const Xn = sn;
|
|
1534
|
+
var hr = {}, F = Z && Z.__assign || function() {
|
|
1535
|
+
return F = Object.assign || function(e) {
|
|
1536
|
+
for (var t, r = 1, o = arguments.length; r < o; r++) {
|
|
1537
|
+
t = arguments[r];
|
|
1538
|
+
for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
|
|
1539
|
+
}
|
|
1540
|
+
return e;
|
|
1541
|
+
}, F.apply(this, arguments);
|
|
1542
|
+
}, cn = Z && Z.__createBinding || (Object.create ? function(e, t, r, o) {
|
|
1543
|
+
o === void 0 && (o = r);
|
|
1544
|
+
var n = Object.getOwnPropertyDescriptor(t, r);
|
|
1545
|
+
(!n || ("get" in n ? !t.__esModule : n.writable || n.configurable)) && (n = { enumerable: !0, get: function() {
|
|
1546
|
+
return t[r];
|
|
1547
|
+
} }), Object.defineProperty(e, o, n);
|
|
1548
|
+
} : function(e, t, r, o) {
|
|
1549
|
+
o === void 0 && (o = r), e[o] = t[r];
|
|
1550
|
+
}), dn = Z && Z.__setModuleDefault || (Object.create ? function(e, t) {
|
|
1551
|
+
Object.defineProperty(e, "default", { enumerable: !0, value: t });
|
|
1552
|
+
} : function(e, t) {
|
|
1553
|
+
e.default = t;
|
|
1554
|
+
}), un = Z && Z.__importStar || function(e) {
|
|
1555
|
+
if (e && e.__esModule) return e;
|
|
1556
|
+
var t = {};
|
|
1557
|
+
if (e != null) for (var r in e) r !== "default" && Object.prototype.hasOwnProperty.call(e, r) && cn(t, e, r);
|
|
1558
|
+
return dn(t, e), t;
|
|
1559
|
+
}, fn = Z && Z.__rest || function(e, t) {
|
|
1560
|
+
var r = {};
|
|
1561
|
+
for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (r[o] = e[o]);
|
|
1562
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
1563
|
+
for (var n = 0, o = Object.getOwnPropertySymbols(e); n < o.length; n++)
|
|
1564
|
+
t.indexOf(o[n]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[n]) && (r[o[n]] = e[o[n]]);
|
|
1565
|
+
return r;
|
|
1566
|
+
};
|
|
1567
|
+
Object.defineProperty(hr, "__esModule", { value: !0 });
|
|
1568
|
+
var W = un(Rr), pn = 89, ke = 90, hn = 77, ft = 57, pt = 219, ht = 222, vt = 192, mt = 100, vn = 3e3, mn = typeof window < "u" && "navigator" in window && /Win/i.test(navigator.platform), We = typeof window < "u" && "navigator" in window && /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform), Ne = "npm__react-simple-code-editor__textarea", bn = (
|
|
1569
|
+
/* CSS */
|
|
1570
|
+
`
|
|
1571
|
+
/**
|
|
1572
|
+
* Reset the text fill color so that placeholder is visible
|
|
1573
|
+
*/
|
|
1574
|
+
.`.concat(Ne, `:empty {
|
|
1575
|
+
-webkit-text-fill-color: inherit !important;
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
/**
|
|
1579
|
+
* Hack to apply on some CSS on IE10 and IE11
|
|
1580
|
+
*/
|
|
1581
|
+
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
|
|
1582
|
+
/**
|
|
1583
|
+
* IE doesn't support '-webkit-text-fill-color'
|
|
1584
|
+
* So we use 'color: transparent' to make the text transparent on IE
|
|
1585
|
+
* Unlike other browsers, it doesn't affect caret color in IE
|
|
1586
|
+
*/
|
|
1587
|
+
.`).concat(Ne, ` {
|
|
1588
|
+
color: transparent !important;
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
.`).concat(Ne, `::selection {
|
|
1592
|
+
background-color: #accef7 !important;
|
|
1593
|
+
color: transparent !important;
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
`)
|
|
1597
|
+
), gn = W.forwardRef(function(t, r) {
|
|
1598
|
+
var o = t.autoFocus, n = t.disabled, i = t.form, s = t.highlight, c = t.ignoreTabKey, l = c === void 0 ? !1 : c, f = t.insertSpaces, d = f === void 0 ? !0 : f, h = t.maxLength, v = t.minLength, m = t.name, b = t.onBlur, P = t.onClick, g = t.onFocus, w = t.onKeyDown, _ = t.onKeyUp, S = t.onValueChange, k = t.padding, R = k === void 0 ? 0 : k, H = t.placeholder, K = t.preClassName, A = t.readOnly, C = t.required, M = t.style, $ = t.tabSize, de = $ === void 0 ? 2 : $, ie = t.textareaClassName, be = t.textareaId, se = t.value, j = fn(t, ["autoFocus", "disabled", "form", "highlight", "ignoreTabKey", "insertSpaces", "maxLength", "minLength", "name", "onBlur", "onClick", "onFocus", "onKeyDown", "onKeyUp", "onValueChange", "padding", "placeholder", "preClassName", "readOnly", "required", "style", "tabSize", "textareaClassName", "textareaId", "value"]), D = W.useRef({
|
|
1599
|
+
stack: [],
|
|
1600
|
+
offset: -1
|
|
1601
|
+
}), T = W.useRef(null), E = W.useState(!0), N = E[0], z = E[1], G = {
|
|
1602
|
+
paddingTop: typeof R == "object" ? R.top : R,
|
|
1603
|
+
paddingRight: typeof R == "object" ? R.right : R,
|
|
1604
|
+
paddingBottom: typeof R == "object" ? R.bottom : R,
|
|
1605
|
+
paddingLeft: typeof R == "object" ? R.left : R
|
|
1606
|
+
}, Q = s(se), te = function(p, I) {
|
|
1607
|
+
return p.substring(0, I).split(`
|
|
1608
|
+
`);
|
|
1609
|
+
}, _e = W.useCallback(function(p, I) {
|
|
1610
|
+
var y, x, O;
|
|
1611
|
+
I === void 0 && (I = !1);
|
|
1612
|
+
var V = D.current, re = V.stack, ge = V.offset;
|
|
1613
|
+
if (re.length && ge > -1) {
|
|
1614
|
+
D.current.stack = re.slice(0, ge + 1);
|
|
1615
|
+
var ye = D.current.stack.length;
|
|
1616
|
+
if (ye > mt) {
|
|
1617
|
+
var fe = ye - mt;
|
|
1618
|
+
D.current.stack = re.slice(fe, ye), D.current.offset = Math.max(D.current.offset - fe, 0);
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
var J = Date.now();
|
|
1622
|
+
if (I) {
|
|
1623
|
+
var ne = D.current.stack[D.current.offset];
|
|
1624
|
+
if (ne && J - ne.timestamp < vn) {
|
|
1625
|
+
var we = /[^a-z0-9]([a-z0-9]+)$/i, U = (y = te(ne.value, ne.selectionStart).pop()) === null || y === void 0 ? void 0 : y.match(we), Se = (x = te(p.value, p.selectionStart).pop()) === null || x === void 0 ? void 0 : x.match(we);
|
|
1626
|
+
if (U != null && U[1] && (!((O = Se == null ? void 0 : Se[1]) === null || O === void 0) && O.startsWith(U[1]))) {
|
|
1627
|
+
D.current.stack[D.current.offset] = F(F({}, p), { timestamp: J });
|
|
1628
|
+
return;
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
D.current.stack.push(F(F({}, p), { timestamp: J })), D.current.offset++;
|
|
1633
|
+
}, []), nt = W.useCallback(function() {
|
|
1634
|
+
var p = T.current;
|
|
1635
|
+
if (p) {
|
|
1636
|
+
var I = p.value, y = p.selectionStart, x = p.selectionEnd;
|
|
1637
|
+
_e({
|
|
1638
|
+
value: I,
|
|
1639
|
+
selectionStart: y,
|
|
1640
|
+
selectionEnd: x
|
|
1641
|
+
});
|
|
1642
|
+
}
|
|
1643
|
+
}, [_e]), $e = function(p) {
|
|
1644
|
+
var I = T.current;
|
|
1645
|
+
I && (I.value = p.value, I.selectionStart = p.selectionStart, I.selectionEnd = p.selectionEnd, S == null || S(p.value));
|
|
1646
|
+
}, ue = function(p) {
|
|
1647
|
+
var I = T.current, y = D.current.stack[D.current.offset];
|
|
1648
|
+
y && I && (D.current.stack[D.current.offset] = F(F({}, y), { selectionStart: I.selectionStart, selectionEnd: I.selectionEnd })), _e(p), $e(p);
|
|
1649
|
+
}, Sr = function() {
|
|
1650
|
+
var p = D.current, I = p.stack, y = p.offset, x = I[y - 1];
|
|
1651
|
+
x && ($e(x), D.current.offset = Math.max(y - 1, 0));
|
|
1652
|
+
}, xr = function() {
|
|
1653
|
+
var p = D.current, I = p.stack, y = p.offset, x = I[y + 1];
|
|
1654
|
+
x && ($e(x), D.current.offset = Math.min(y + 1, I.length - 1));
|
|
1655
|
+
}, Cr = function(p) {
|
|
1656
|
+
if (!(w && (w(p), p.defaultPrevented))) {
|
|
1657
|
+
p.key === "Escape" && p.currentTarget.blur();
|
|
1658
|
+
var I = p.currentTarget, y = I.value, x = I.selectionStart, O = I.selectionEnd, V = (d ? " " : " ").repeat(de);
|
|
1659
|
+
if (p.key === "Tab" && !l && N)
|
|
1660
|
+
if (p.preventDefault(), p.shiftKey) {
|
|
1661
|
+
var re = te(y, x), ge = re.length - 1, ye = te(y, O).length - 1, fe = y.split(`
|
|
1662
|
+
`).map(function(xe, it) {
|
|
1663
|
+
return it >= ge && it <= ye && xe.startsWith(V) ? xe.substring(V.length) : xe;
|
|
1664
|
+
}).join(`
|
|
1665
|
+
`);
|
|
1666
|
+
if (y !== fe) {
|
|
1667
|
+
var J = re[ge];
|
|
1668
|
+
ue({
|
|
1669
|
+
value: fe,
|
|
1670
|
+
// Move the start cursor if first line in selection was modified
|
|
1671
|
+
// It was modified only if it started with a tab
|
|
1672
|
+
selectionStart: J != null && J.startsWith(V) ? x - V.length : x,
|
|
1673
|
+
// Move the end cursor by total number of characters removed
|
|
1674
|
+
selectionEnd: O - (y.length - fe.length)
|
|
1675
|
+
});
|
|
1676
|
+
}
|
|
1677
|
+
} else if (x !== O) {
|
|
1678
|
+
var re = te(y, x), ne = re.length - 1, we = te(y, O).length - 1, J = re[ne];
|
|
1679
|
+
ue({
|
|
1680
|
+
value: y.split(`
|
|
1681
|
+
`).map(function(st, lt) {
|
|
1682
|
+
return lt >= ne && lt <= we ? V + st : st;
|
|
1683
|
+
}).join(`
|
|
1684
|
+
`),
|
|
1685
|
+
// Move the start cursor by number of characters added in first line of selection
|
|
1686
|
+
// Don't move it if it there was no text before cursor
|
|
1687
|
+
selectionStart: J && /\S/.test(J) ? x + V.length : x,
|
|
1688
|
+
// Move the end cursor by total number of characters added
|
|
1689
|
+
selectionEnd: O + V.length * (we - ne + 1)
|
|
1690
|
+
});
|
|
1691
|
+
} else {
|
|
1692
|
+
var U = x + V.length;
|
|
1693
|
+
ue({
|
|
1694
|
+
// Insert tab character at caret
|
|
1695
|
+
value: y.substring(0, x) + V + y.substring(O),
|
|
1696
|
+
// Update caret position
|
|
1697
|
+
selectionStart: U,
|
|
1698
|
+
selectionEnd: U
|
|
1699
|
+
});
|
|
1700
|
+
}
|
|
1701
|
+
else if (p.key === "Backspace") {
|
|
1702
|
+
var Se = x !== O, Er = y.substring(0, x);
|
|
1703
|
+
if (Er.endsWith(V) && !Se) {
|
|
1704
|
+
p.preventDefault();
|
|
1705
|
+
var U = x - V.length;
|
|
1706
|
+
ue({
|
|
1707
|
+
// Remove tab character at caret
|
|
1708
|
+
value: y.substring(0, x - V.length) + y.substring(O),
|
|
1709
|
+
// Update caret position
|
|
1710
|
+
selectionStart: U,
|
|
1711
|
+
selectionEnd: U
|
|
1712
|
+
});
|
|
1713
|
+
}
|
|
1714
|
+
} else if (p.key === "Enter") {
|
|
1715
|
+
if (x === O) {
|
|
1716
|
+
var Ve = te(y, x).pop(), Ie = Ve == null ? void 0 : Ve.match(/^\s+/);
|
|
1717
|
+
if (Ie != null && Ie[0]) {
|
|
1718
|
+
p.preventDefault();
|
|
1719
|
+
var at = `
|
|
1720
|
+
` + Ie[0], U = x + at.length;
|
|
1721
|
+
ue({
|
|
1722
|
+
// Insert indentation character at caret
|
|
1723
|
+
value: y.substring(0, x) + at + y.substring(O),
|
|
1724
|
+
// Update caret position
|
|
1725
|
+
selectionStart: U,
|
|
1726
|
+
selectionEnd: U
|
|
1727
|
+
});
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
} else if (p.keyCode === ft || p.keyCode === pt || p.keyCode === ht || p.keyCode === vt) {
|
|
1731
|
+
var oe = void 0;
|
|
1732
|
+
p.keyCode === ft && p.shiftKey ? oe = ["(", ")"] : p.keyCode === pt ? p.shiftKey ? oe = ["{", "}"] : oe = ["[", "]"] : p.keyCode === ht ? p.shiftKey ? oe = ['"', '"'] : oe = ["'", "'"] : p.keyCode === vt && !p.shiftKey && (oe = ["`", "`"]), x !== O && oe && (p.preventDefault(), ue({
|
|
1733
|
+
value: y.substring(0, x) + oe[0] + y.substring(x, O) + oe[1] + y.substring(O),
|
|
1734
|
+
// Update caret position
|
|
1735
|
+
selectionStart: x,
|
|
1736
|
+
selectionEnd: O + 2
|
|
1737
|
+
}));
|
|
1738
|
+
} else (We ? (
|
|
1739
|
+
// Trigger undo with ⌘+Z on Mac
|
|
1740
|
+
p.metaKey && p.keyCode === ke
|
|
1741
|
+
) : (
|
|
1742
|
+
// Trigger undo with Ctrl+Z on other platforms
|
|
1743
|
+
p.ctrlKey && p.keyCode === ke
|
|
1744
|
+
)) && !p.shiftKey && !p.altKey ? (p.preventDefault(), Sr()) : (We ? (
|
|
1745
|
+
// Trigger redo with ⌘+Shift+Z on Mac
|
|
1746
|
+
p.metaKey && p.keyCode === ke && p.shiftKey
|
|
1747
|
+
) : mn ? (
|
|
1748
|
+
// Trigger redo with Ctrl+Y on Windows
|
|
1749
|
+
p.ctrlKey && p.keyCode === pn
|
|
1750
|
+
) : (
|
|
1751
|
+
// Trigger redo with Ctrl+Shift+Z on other platforms
|
|
1752
|
+
p.ctrlKey && p.keyCode === ke && p.shiftKey
|
|
1753
|
+
)) && !p.altKey ? (p.preventDefault(), xr()) : p.keyCode === hn && p.ctrlKey && (!We || p.shiftKey) && (p.preventDefault(), z(function(xe) {
|
|
1754
|
+
return !xe;
|
|
1755
|
+
}));
|
|
1756
|
+
}
|
|
1757
|
+
}, Tr = function(p) {
|
|
1758
|
+
var I = p.currentTarget, y = I.value, x = I.selectionStart, O = I.selectionEnd;
|
|
1759
|
+
_e({
|
|
1760
|
+
value: y,
|
|
1761
|
+
selectionStart: x,
|
|
1762
|
+
selectionEnd: O
|
|
1763
|
+
}, !0), S(y);
|
|
1764
|
+
};
|
|
1765
|
+
return W.useEffect(function() {
|
|
1766
|
+
nt();
|
|
1767
|
+
}, [nt]), W.useImperativeHandle(r, function() {
|
|
1768
|
+
return {
|
|
1769
|
+
get session() {
|
|
1770
|
+
return {
|
|
1771
|
+
history: D.current
|
|
1772
|
+
};
|
|
1773
|
+
},
|
|
1774
|
+
set session(p) {
|
|
1775
|
+
D.current = p.history;
|
|
1776
|
+
}
|
|
1777
|
+
};
|
|
1778
|
+
}, []), W.createElement(
|
|
1779
|
+
"div",
|
|
1780
|
+
F({}, j, { style: F(F({}, Ce.container), M) }),
|
|
1781
|
+
W.createElement("pre", F({ className: K, "aria-hidden": "true", style: F(F(F({}, Ce.editor), Ce.highlight), G) }, typeof Q == "string" ? { dangerouslySetInnerHTML: { __html: Q + "<br />" } } : { children: Q })),
|
|
1782
|
+
W.createElement("textarea", { ref: function(p) {
|
|
1783
|
+
return T.current = p;
|
|
1784
|
+
}, style: F(F(F({}, Ce.editor), Ce.textarea), G), className: Ne + (ie ? " ".concat(ie) : ""), id: be, value: se, onChange: Tr, onKeyDown: Cr, onClick: P, onKeyUp: _, onFocus: g, onBlur: b, disabled: n, form: i, maxLength: h, minLength: v, name: m, placeholder: H, readOnly: A, required: C, autoFocus: o, autoCapitalize: "off", autoComplete: "off", autoCorrect: "off", spellCheck: !1, "data-gramm": !1 }),
|
|
1785
|
+
W.createElement("style", { dangerouslySetInnerHTML: { __html: bn } })
|
|
1786
|
+
);
|
|
1787
|
+
}), Ce = {
|
|
1788
|
+
container: {
|
|
1789
|
+
position: "relative",
|
|
1790
|
+
textAlign: "left",
|
|
1791
|
+
boxSizing: "border-box",
|
|
1792
|
+
padding: 0,
|
|
1793
|
+
overflow: "hidden"
|
|
1794
|
+
},
|
|
1795
|
+
textarea: {
|
|
1796
|
+
position: "absolute",
|
|
1797
|
+
top: 0,
|
|
1798
|
+
left: 0,
|
|
1799
|
+
height: "100%",
|
|
1800
|
+
width: "100%",
|
|
1801
|
+
resize: "none",
|
|
1802
|
+
color: "inherit",
|
|
1803
|
+
overflow: "hidden",
|
|
1804
|
+
MozOsxFontSmoothing: "grayscale",
|
|
1805
|
+
WebkitFontSmoothing: "antialiased",
|
|
1806
|
+
WebkitTextFillColor: "transparent"
|
|
1807
|
+
},
|
|
1808
|
+
highlight: {
|
|
1809
|
+
position: "relative",
|
|
1810
|
+
pointerEvents: "none"
|
|
1811
|
+
},
|
|
1812
|
+
editor: {
|
|
1813
|
+
margin: 0,
|
|
1814
|
+
border: 0,
|
|
1815
|
+
background: "none",
|
|
1816
|
+
boxSizing: "inherit",
|
|
1817
|
+
display: "inherit",
|
|
1818
|
+
fontFamily: "inherit",
|
|
1819
|
+
fontSize: "inherit",
|
|
1820
|
+
fontStyle: "inherit",
|
|
1821
|
+
fontVariantLigatures: "inherit",
|
|
1822
|
+
fontWeight: "inherit",
|
|
1823
|
+
letterSpacing: "inherit",
|
|
1824
|
+
lineHeight: "inherit",
|
|
1825
|
+
tabSize: "inherit",
|
|
1826
|
+
textIndent: "inherit",
|
|
1827
|
+
textRendering: "inherit",
|
|
1828
|
+
textTransform: "inherit",
|
|
1829
|
+
whiteSpace: "pre-wrap",
|
|
1830
|
+
wordBreak: "keep-all",
|
|
1831
|
+
overflowWrap: "break-word"
|
|
1832
|
+
}
|
|
1833
|
+
}, yn = hr.default = gn;
|
|
1834
|
+
function wn(e, t, r, o) {
|
|
1835
|
+
const n = t.map((c, l) => ({ chip: c, index: l })).sort((c, l) => c.chip.start - l.chip.start), i = [];
|
|
1836
|
+
let s = 0;
|
|
1837
|
+
for (const { chip: c, index: l } of n)
|
|
1838
|
+
c.start < s || c.end > e.length || (c.start > s && i.push(e.slice(s, c.start)), i.push(
|
|
1839
|
+
/* @__PURE__ */ u(
|
|
1840
|
+
"span",
|
|
1841
|
+
{
|
|
1842
|
+
"data-chip-index": l,
|
|
1843
|
+
"data-tone": c.tone,
|
|
1844
|
+
"data-state": l === r ? "active" : l === o ? "hover" : void 0,
|
|
1845
|
+
className: "code-editor-chip",
|
|
1846
|
+
children: e.slice(c.start, c.end)
|
|
1847
|
+
},
|
|
1848
|
+
l
|
|
1849
|
+
)
|
|
1850
|
+
), s = c.end);
|
|
1851
|
+
return s < e.length && i.push(e.slice(s)), i;
|
|
1852
|
+
}
|
|
1853
|
+
function Sn({
|
|
1854
|
+
value: e,
|
|
1855
|
+
onValueChange: t,
|
|
1856
|
+
language: r,
|
|
1857
|
+
readOnly: o = !1,
|
|
1858
|
+
embedded: n = !1,
|
|
1859
|
+
hideLineNumbers: i = !1,
|
|
1860
|
+
flushGutter: s = !1,
|
|
1861
|
+
dense: c = !1,
|
|
1862
|
+
wrapLines: l = !1,
|
|
1863
|
+
placeholder: f,
|
|
1864
|
+
ariaLabel: d,
|
|
1865
|
+
onKeyDown: h,
|
|
1866
|
+
className: v,
|
|
1867
|
+
textareaId: m,
|
|
1868
|
+
chips: b,
|
|
1869
|
+
activeChipIndex: P,
|
|
1870
|
+
onChipClick: g
|
|
1871
|
+
}, w) {
|
|
1872
|
+
const _ = Be(null), S = Be(null), k = Be(null), [R, H] = _r(
|
|
1873
|
+
null
|
|
1874
|
+
), K = !!(b && b.length > 0), A = K && !o && !!g, C = c ? { top: 6, right: 8, bottom: 6, left: 8 } : {
|
|
1875
|
+
top: 16,
|
|
1876
|
+
right: 24,
|
|
1877
|
+
bottom: 16,
|
|
1878
|
+
// Tighten the leading gap when the gutter is flush — the gutter's
|
|
1879
|
+
// own right padding is the only thing separating line numbers from
|
|
1880
|
+
// the code, and 16px there ends up visually ~28px with the gutter.
|
|
1881
|
+
left: s ? 8 : 16
|
|
1882
|
+
}, M = Ir(() => e.split(`
|
|
1883
|
+
`).length, [e]), $ = Math.max(2, String(M).length), de = kr(), ie = m ?? de, be = d ?? f;
|
|
1884
|
+
Nr(
|
|
1885
|
+
w,
|
|
1886
|
+
() => ({
|
|
1887
|
+
captureSession() {
|
|
1888
|
+
const T = S.current, E = _.current, N = E == null ? void 0 : E.querySelector("textarea");
|
|
1889
|
+
return !T || !E || !N ? null : {
|
|
1890
|
+
session: T.session,
|
|
1891
|
+
selectionStart: N.selectionStart,
|
|
1892
|
+
selectionEnd: N.selectionEnd,
|
|
1893
|
+
scrollTop: E.scrollTop,
|
|
1894
|
+
scrollLeft: E.scrollLeft,
|
|
1895
|
+
wasFocused: document.activeElement === N
|
|
1896
|
+
};
|
|
1897
|
+
},
|
|
1898
|
+
restoreSession(T) {
|
|
1899
|
+
const E = S.current, N = _.current, z = N == null ? void 0 : N.querySelector("textarea");
|
|
1900
|
+
if (!E || !N || !z) return;
|
|
1901
|
+
E.session = T.session;
|
|
1902
|
+
const G = z.value.length, Q = Math.min(T.selectionStart, G), te = Math.min(T.selectionEnd, G);
|
|
1903
|
+
z.setSelectionRange(Q, te), N.scrollTop = T.scrollTop, N.scrollLeft = T.scrollLeft, T.wasFocused && z.focus();
|
|
1904
|
+
},
|
|
1905
|
+
focus() {
|
|
1906
|
+
var T, E;
|
|
1907
|
+
(E = (T = _.current) == null ? void 0 : T.querySelector("textarea")) == null || E.focus();
|
|
1908
|
+
},
|
|
1909
|
+
getChipRect(T) {
|
|
1910
|
+
var z;
|
|
1911
|
+
const E = (z = k.current) == null ? void 0 : z.querySelector(
|
|
1912
|
+
`[data-chip-index="${T}"]`
|
|
1913
|
+
), N = E == null ? void 0 : E.getClientRects();
|
|
1914
|
+
return N && N.length > 0 ? N[N.length - 1] : null;
|
|
1915
|
+
}
|
|
1916
|
+
}),
|
|
1917
|
+
[]
|
|
1918
|
+
);
|
|
1919
|
+
const se = (T, E) => {
|
|
1920
|
+
var z;
|
|
1921
|
+
const N = (z = k.current) == null ? void 0 : z.querySelectorAll(
|
|
1922
|
+
'[data-tone="pending"]'
|
|
1923
|
+
);
|
|
1924
|
+
if (!N) return null;
|
|
1925
|
+
for (const G of Array.from(N))
|
|
1926
|
+
for (const Q of Array.from(G.getClientRects()))
|
|
1927
|
+
if (T >= Q.left - 1 && T <= Q.right + 1 && E >= Q.top && E <= Q.bottom)
|
|
1928
|
+
return Number(G.dataset.chipIndex);
|
|
1929
|
+
return null;
|
|
1930
|
+
}, j = (T) => {
|
|
1931
|
+
const E = se(T.clientX, T.clientY);
|
|
1932
|
+
E !== R && H(E);
|
|
1933
|
+
}, D = (T) => {
|
|
1934
|
+
var G;
|
|
1935
|
+
if (T.button !== 0 || !b) return;
|
|
1936
|
+
const E = se(T.clientX, T.clientY);
|
|
1937
|
+
if (E === null) return;
|
|
1938
|
+
const N = (G = _.current) == null ? void 0 : G.querySelector("textarea"), z = b[E];
|
|
1939
|
+
!N || !z || N.selectionStart !== N.selectionEnd && (N.selectionStart < z.start || N.selectionEnd > z.end) || g == null || g(E);
|
|
1940
|
+
};
|
|
1941
|
+
return /* @__PURE__ */ le(
|
|
1942
|
+
"div",
|
|
1943
|
+
{
|
|
1944
|
+
ref: _,
|
|
1945
|
+
className: `code-editor relative h-full min-h-0 overflow-auto font-mono text-[12px] leading-[1.55] ${n ? "" : "rounded-control border border-border"}${l ? " code-editor--wrap" : ""}${v ? ` ${v}` : ""}`,
|
|
1946
|
+
children: [
|
|
1947
|
+
be ? /* @__PURE__ */ u("label", { htmlFor: ie, className: "sr-only", children: be }) : null,
|
|
1948
|
+
/* @__PURE__ */ le(
|
|
1949
|
+
"div",
|
|
1950
|
+
{
|
|
1951
|
+
className: l ? "flex min-h-full w-full" : "flex min-h-full min-w-max",
|
|
1952
|
+
children: [
|
|
1953
|
+
i ? null : /* @__PURE__ */ u(
|
|
1954
|
+
"div",
|
|
1955
|
+
{
|
|
1956
|
+
"aria-hidden": !0,
|
|
1957
|
+
className: `shrink-0 select-none border-r border-border/60 py-4 text-center text-muted-foreground/60 [font-variant-numeric:tabular-nums] ${s ? "px-2" : "px-3"}${l ? "" : " sticky left-0 z-[1] bg-inherit"}`,
|
|
1958
|
+
style: {
|
|
1959
|
+
minWidth: `calc(${$}ch + ${s ? "1rem" : "1.5rem"})`
|
|
1960
|
+
},
|
|
1961
|
+
children: Array.from({ length: M }, (T, E) => /* @__PURE__ */ u("div", { children: E + 1 }, E))
|
|
1962
|
+
}
|
|
1963
|
+
),
|
|
1964
|
+
/* @__PURE__ */ le(
|
|
1965
|
+
"div",
|
|
1966
|
+
{
|
|
1967
|
+
className: `${l ? "relative min-w-0 flex-1" : "relative flex-1"}${A && R !== null ? " code-editor--chip-hover" : ""}`,
|
|
1968
|
+
onMouseMove: A ? j : void 0,
|
|
1969
|
+
onMouseLeave: A ? () => H(null) : void 0,
|
|
1970
|
+
onMouseUp: A ? D : void 0,
|
|
1971
|
+
children: [
|
|
1972
|
+
K && b ? (
|
|
1973
|
+
// Painted before the editor so the highlighted text sits on
|
|
1974
|
+
// top. Same padding and wrap rules as the <pre> overlay
|
|
1975
|
+
// (`code-editor-pre` picks up the wrap CSS; word-break
|
|
1976
|
+
// mirrors react-simple-code-editor's inline style).
|
|
1977
|
+
/* @__PURE__ */ u(
|
|
1978
|
+
"div",
|
|
1979
|
+
{
|
|
1980
|
+
ref: k,
|
|
1981
|
+
"aria-hidden": !0,
|
|
1982
|
+
className: "code-editor-pre code-editor-chip-layer pointer-events-none absolute inset-0",
|
|
1983
|
+
style: {
|
|
1984
|
+
paddingTop: C.top,
|
|
1985
|
+
paddingRight: C.right,
|
|
1986
|
+
paddingBottom: C.bottom,
|
|
1987
|
+
paddingLeft: C.left,
|
|
1988
|
+
wordBreak: "keep-all"
|
|
1989
|
+
},
|
|
1990
|
+
children: wn(
|
|
1991
|
+
e,
|
|
1992
|
+
b,
|
|
1993
|
+
P,
|
|
1994
|
+
A ? R : null
|
|
1995
|
+
)
|
|
1996
|
+
}
|
|
1997
|
+
)
|
|
1998
|
+
) : null,
|
|
1999
|
+
f && e.length === 0 ? /* @__PURE__ */ u(
|
|
2000
|
+
"div",
|
|
2001
|
+
{
|
|
2002
|
+
"aria-hidden": !0,
|
|
2003
|
+
className: "pointer-events-none absolute inset-0 whitespace-pre-wrap font-mono text-[12px] leading-[1.55] text-muted-foreground/70",
|
|
2004
|
+
style: {
|
|
2005
|
+
paddingTop: C.top,
|
|
2006
|
+
paddingRight: C.right,
|
|
2007
|
+
paddingBottom: C.bottom,
|
|
2008
|
+
paddingLeft: C.left
|
|
2009
|
+
},
|
|
2010
|
+
children: f
|
|
2011
|
+
}
|
|
2012
|
+
) : null,
|
|
2013
|
+
/* @__PURE__ */ u(
|
|
2014
|
+
yn,
|
|
2015
|
+
{
|
|
2016
|
+
ref: S,
|
|
2017
|
+
value: e,
|
|
2018
|
+
onValueChange: t ?? (() => {
|
|
2019
|
+
}),
|
|
2020
|
+
highlight: (T) => ct.highlight(T, ct.languages[r], r),
|
|
2021
|
+
padding: C,
|
|
2022
|
+
placeholder: f,
|
|
2023
|
+
textareaClassName: o ? "code-editor-textarea code-editor-textarea-readonly" : "code-editor-textarea",
|
|
2024
|
+
preClassName: "code-editor-pre",
|
|
2025
|
+
className: "h-full w-full",
|
|
2026
|
+
style: {
|
|
2027
|
+
fontFamily: "inherit",
|
|
2028
|
+
fontSize: "inherit",
|
|
2029
|
+
lineHeight: "inherit"
|
|
2030
|
+
},
|
|
2031
|
+
readOnly: o,
|
|
2032
|
+
onKeyDown: h,
|
|
2033
|
+
textareaId: ie
|
|
2034
|
+
}
|
|
2035
|
+
)
|
|
2036
|
+
]
|
|
2037
|
+
}
|
|
2038
|
+
)
|
|
2039
|
+
]
|
|
2040
|
+
}
|
|
2041
|
+
)
|
|
2042
|
+
]
|
|
2043
|
+
}
|
|
2044
|
+
);
|
|
2045
|
+
}
|
|
2046
|
+
const qn = Pr(Sn);
|
|
2047
|
+
var Ke = "Switch", [xn] = Ee(Ke), [Cn, Tn] = xn(Ke), vr = a.forwardRef(
|
|
2048
|
+
(e, t) => {
|
|
2049
|
+
const {
|
|
2050
|
+
__scopeSwitch: r,
|
|
2051
|
+
name: o,
|
|
2052
|
+
checked: n,
|
|
2053
|
+
defaultChecked: i,
|
|
2054
|
+
required: s,
|
|
2055
|
+
disabled: c,
|
|
2056
|
+
value: l = "on",
|
|
2057
|
+
onCheckedChange: f,
|
|
2058
|
+
form: d,
|
|
2059
|
+
...h
|
|
2060
|
+
} = e, [v, m] = a.useState(null), b = q(t, (S) => m(S)), P = a.useRef(!1), g = v ? d || !!v.closest("form") : !0, [w, _] = Le({
|
|
2061
|
+
prop: n,
|
|
2062
|
+
defaultProp: i ?? !1,
|
|
2063
|
+
onChange: f,
|
|
2064
|
+
caller: Ke
|
|
2065
|
+
});
|
|
2066
|
+
return /* @__PURE__ */ le(Cn, { scope: r, checked: w, disabled: c, children: [
|
|
2067
|
+
/* @__PURE__ */ u(
|
|
2068
|
+
B.button,
|
|
2069
|
+
{
|
|
2070
|
+
type: "button",
|
|
2071
|
+
role: "switch",
|
|
2072
|
+
"aria-checked": w,
|
|
2073
|
+
"aria-required": s,
|
|
2074
|
+
"data-state": yr(w),
|
|
2075
|
+
"data-disabled": c ? "" : void 0,
|
|
2076
|
+
disabled: c,
|
|
2077
|
+
value: l,
|
|
2078
|
+
...h,
|
|
2079
|
+
ref: b,
|
|
2080
|
+
onClick: L(e.onClick, (S) => {
|
|
2081
|
+
_((k) => !k), g && (P.current = S.isPropagationStopped(), P.current || S.stopPropagation());
|
|
2082
|
+
})
|
|
2083
|
+
}
|
|
2084
|
+
),
|
|
2085
|
+
g && /* @__PURE__ */ u(
|
|
2086
|
+
gr,
|
|
2087
|
+
{
|
|
2088
|
+
control: v,
|
|
2089
|
+
bubbles: !P.current,
|
|
2090
|
+
name: o,
|
|
2091
|
+
value: l,
|
|
2092
|
+
checked: w,
|
|
2093
|
+
required: s,
|
|
2094
|
+
disabled: c,
|
|
2095
|
+
form: d,
|
|
2096
|
+
style: { transform: "translateX(-100%)" }
|
|
2097
|
+
}
|
|
2098
|
+
)
|
|
2099
|
+
] });
|
|
2100
|
+
}
|
|
2101
|
+
);
|
|
2102
|
+
vr.displayName = Ke;
|
|
2103
|
+
var mr = "SwitchThumb", br = a.forwardRef(
|
|
2104
|
+
(e, t) => {
|
|
2105
|
+
const { __scopeSwitch: r, ...o } = e, n = Tn(mr, r);
|
|
2106
|
+
return /* @__PURE__ */ u(
|
|
2107
|
+
B.span,
|
|
2108
|
+
{
|
|
2109
|
+
"data-state": yr(n.checked),
|
|
2110
|
+
"data-disabled": n.disabled ? "" : void 0,
|
|
2111
|
+
...o,
|
|
2112
|
+
ref: t
|
|
2113
|
+
}
|
|
2114
|
+
);
|
|
2115
|
+
}
|
|
2116
|
+
);
|
|
2117
|
+
br.displayName = mr;
|
|
2118
|
+
var En = "SwitchBubbleInput", gr = a.forwardRef(
|
|
2119
|
+
({
|
|
2120
|
+
__scopeSwitch: e,
|
|
2121
|
+
control: t,
|
|
2122
|
+
checked: r,
|
|
2123
|
+
bubbles: o = !0,
|
|
2124
|
+
...n
|
|
2125
|
+
}, i) => {
|
|
2126
|
+
const s = a.useRef(null), c = q(s, i), l = Br(r), f = Ur(t);
|
|
2127
|
+
return a.useEffect(() => {
|
|
2128
|
+
const d = s.current;
|
|
2129
|
+
if (!d) return;
|
|
2130
|
+
const h = window.HTMLInputElement.prototype, m = Object.getOwnPropertyDescriptor(
|
|
2131
|
+
h,
|
|
2132
|
+
"checked"
|
|
2133
|
+
).set;
|
|
2134
|
+
if (l !== r && m) {
|
|
2135
|
+
const b = new Event("click", { bubbles: o });
|
|
2136
|
+
m.call(d, r), d.dispatchEvent(b);
|
|
2137
|
+
}
|
|
2138
|
+
}, [l, r, o]), /* @__PURE__ */ u(
|
|
2139
|
+
"input",
|
|
2140
|
+
{
|
|
2141
|
+
type: "checkbox",
|
|
2142
|
+
"aria-hidden": !0,
|
|
2143
|
+
defaultChecked: r,
|
|
2144
|
+
...n,
|
|
2145
|
+
tabIndex: -1,
|
|
2146
|
+
ref: c,
|
|
2147
|
+
style: {
|
|
2148
|
+
...n.style,
|
|
2149
|
+
...f,
|
|
2150
|
+
position: "absolute",
|
|
2151
|
+
pointerEvents: "none",
|
|
2152
|
+
opacity: 0,
|
|
2153
|
+
margin: 0
|
|
2154
|
+
}
|
|
2155
|
+
}
|
|
2156
|
+
);
|
|
2157
|
+
}
|
|
2158
|
+
);
|
|
2159
|
+
gr.displayName = En;
|
|
2160
|
+
function yr(e) {
|
|
2161
|
+
return e ? "checked" : "unchecked";
|
|
2162
|
+
}
|
|
2163
|
+
var wr = vr, Rn = br;
|
|
2164
|
+
const Pn = me(
|
|
2165
|
+
"peer inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/20 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
|
|
2166
|
+
{
|
|
2167
|
+
variants: {
|
|
2168
|
+
size: {
|
|
2169
|
+
default: "h-6 w-11",
|
|
2170
|
+
sm: "h-[22px] w-[36px]",
|
|
2171
|
+
xs: "h-4 w-7"
|
|
2172
|
+
}
|
|
2173
|
+
},
|
|
2174
|
+
defaultVariants: {
|
|
2175
|
+
size: "default"
|
|
2176
|
+
}
|
|
2177
|
+
}
|
|
2178
|
+
), _n = me(
|
|
2179
|
+
"pointer-events-none block rounded-full bg-background shadow-sm ring-0 transition-transform data-[state=unchecked]:translate-x-0",
|
|
2180
|
+
{
|
|
2181
|
+
variants: {
|
|
2182
|
+
size: {
|
|
2183
|
+
default: "h-5 w-5 data-[state=checked]:translate-x-5",
|
|
2184
|
+
sm: "size-4 data-[state=checked]:translate-x-4",
|
|
2185
|
+
xs: "h-3 w-3 data-[state=checked]:translate-x-3"
|
|
2186
|
+
}
|
|
2187
|
+
},
|
|
2188
|
+
defaultVariants: {
|
|
2189
|
+
size: "default"
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
), In = a.forwardRef(({ className: e, size: t, ...r }, o) => /* @__PURE__ */ u(
|
|
2193
|
+
wr,
|
|
2194
|
+
{
|
|
2195
|
+
className: X(Pn({ size: t, className: e })),
|
|
2196
|
+
...r,
|
|
2197
|
+
ref: o,
|
|
2198
|
+
children: /* @__PURE__ */ u(Rn, { className: X(_n({ size: t })) })
|
|
2199
|
+
}
|
|
2200
|
+
));
|
|
2201
|
+
In.displayName = wr.displayName;
|
|
2202
|
+
export {
|
|
2203
|
+
sn as A,
|
|
2204
|
+
qn as C,
|
|
2205
|
+
Kn as I,
|
|
2206
|
+
so as L,
|
|
2207
|
+
an as P,
|
|
2208
|
+
to as R,
|
|
2209
|
+
$n as S,
|
|
2210
|
+
Wn as T,
|
|
2211
|
+
Un as U,
|
|
2212
|
+
Mo as V,
|
|
2213
|
+
mo as a,
|
|
2214
|
+
bo as b,
|
|
2215
|
+
zo as c,
|
|
2216
|
+
go as d,
|
|
2217
|
+
Bn as e,
|
|
2218
|
+
Hn as f,
|
|
2219
|
+
Vn as g,
|
|
2220
|
+
To as h,
|
|
2221
|
+
Yn as i,
|
|
2222
|
+
jn as j,
|
|
2223
|
+
Gn as k,
|
|
2224
|
+
ln as l,
|
|
2225
|
+
co as m,
|
|
2226
|
+
In as n,
|
|
2227
|
+
Xn as o,
|
|
2228
|
+
or as p,
|
|
2229
|
+
St as q,
|
|
2230
|
+
ro as r,
|
|
2231
|
+
rr as s,
|
|
2232
|
+
Fo as t,
|
|
2233
|
+
pr as u
|
|
2234
|
+
};
|