@qredence/fleet 0.5.1 → 0.5.5
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/CHANGELOG.md +7 -0
- package/bin/fleet-prime.mjs +6 -0
- package/dist/web/client/assets/action-swap-roll-DX5o_33Q.js +1 -0
- package/dist/web/client/assets/artifacts-panel-C3yewUBP.js +1 -0
- package/dist/web/client/assets/{chat-CsepBQwy.js → chat-W-yOMyG_.js} +1 -1
- package/dist/web/client/assets/chat-command-palette-D0xDK1j4.js +1 -0
- package/dist/web/client/assets/command-CQzrtjyj.js +2 -0
- package/dist/web/client/assets/{fleet-pi-tool-renderer-BD_ZAjlG.js → fleet-pi-tool-renderer-B0Y7ou0U.js} +16 -16
- package/dist/web/client/assets/generative-text-renderer-SS9c1kNX.js +6 -0
- package/dist/web/client/assets/globals-D_Hy9bT1.css +2 -0
- package/dist/web/client/assets/{index-DweoFRMs.js → index-C9FloFgj.js} +2 -2
- package/dist/web/client/assets/{ipython-tool-BfeIa0nK.js → ipython-tool-BrMePqD-.js} +1 -1
- package/dist/web/client/assets/{openui-renderer-DlUo6ehT.js → openui-renderer-CCfQqUfE.js} +5 -5
- package/dist/web/client/assets/{prime-agent-artifacts-CHGb5V_j.js → prime-agent-artifacts-C-g1VPiW.js} +1 -1
- package/dist/web/client/assets/range-65lubOFp.js +2 -0
- package/dist/web/client/assets/repl-panel-CCh4ly7J.js +1 -0
- package/dist/web/client/assets/routes-DSTyx_J0.js +16 -0
- package/dist/web/client/assets/session-insights-panel-CQdT90Op.js +1 -0
- package/dist/web/client/assets/subagent-chat-panel-D-qw4uWb.js +1 -0
- package/dist/web/client/assets/subagent-transcript-C7oRwEEP.js +1 -0
- package/dist/web/client/assets/subagents-panel-aSMWZP9p.js +1 -0
- package/dist/web/client/assets/{tool-result-CBzwwUE9.js → tool-result-C2NvnN32.js} +3 -3
- package/dist/web/server/{_tanstack-start-manifest_v-bDUlyKY0-KFW35JRO.js → _tanstack-start-manifest_v-DZc7dwm7-6ZQLGXB7.js} +13 -13
- package/dist/web/server/{artifacts-panel-D9w1DHAN-FGRDCYU2.js → artifacts-panel-Bt7YUzm4-NCBMXJ25.js} +15 -15
- package/dist/web/server/{chat-command-palette-BaenPkCN-BHSOPGU4.js → chat-command-palette-Co1L3rUY-RQLNME4T.js} +33 -12
- package/dist/web/server/{chunk-KPNGZR2R.js → chunk-2V6B62OF.js} +204 -204
- package/dist/web/server/{chunk-44IVTHDV.js → chunk-3HUI75QM.js} +60 -60
- package/dist/web/server/{chunk-5AVQZ4AZ.js → chunk-4UBOIY2S.js} +2 -1
- package/dist/web/server/{chunk-Y6LJ4WBI.js → chunk-56HSKUBD.js} +699 -691
- package/dist/web/server/{chunk-RPROZ2JC.js → chunk-5RQ6QAZX.js} +133 -133
- package/dist/web/server/{chunk-PWK2HJIV.js → chunk-6D524OCJ.js} +175 -175
- package/dist/web/server/{chunk-FBOO3G67.js → chunk-AECEK3K7.js} +6 -6
- package/dist/web/server/{chunk-VHCAD46L.js → chunk-AWFOBHH4.js} +4 -4
- package/dist/web/server/{chunk-FVWDJNXR.js → chunk-BEMDNODD.js} +1 -1
- package/dist/web/server/{chunk-X2TUFLTP.js → chunk-BLVCDQ7E.js} +438 -438
- package/dist/web/server/{chunk-EIVNRYP3.js → chunk-FZRBAPUM.js} +2 -2
- package/dist/web/server/chunk-KOIPYBJF.js +3773 -0
- package/dist/web/server/{chunk-XYYNYFFD.js → chunk-LSIHVSUT.js} +2 -2
- package/dist/web/server/{chunk-H64JLONZ.js → chunk-PDRD2X5G.js} +2 -2
- package/dist/web/server/{chunk-FE4KN6T2.js → chunk-RX62LUDV.js} +4 -4
- package/dist/web/server/chunk-SR65ARVS.js +192 -0
- package/dist/web/server/{chunk-WK7CQS2N.js → chunk-SZ65K4CO.js} +48 -48
- package/dist/web/server/{chunk-DO3TVNGA.js → chunk-TO3YPLNZ.js} +6 -6
- package/dist/web/server/{chunk-3IKSPTYI.js → chunk-UKINNXJY.js} +2 -2
- package/dist/web/server/{chunk-M2FGGPNA.js → chunk-VGDP4YDU.js} +70 -45
- package/dist/web/server/{chunk-PCJ5EKFE.js → chunk-VRLTWOVJ.js} +11 -6
- package/dist/web/server/{chunk-HBZ6YKRB.js → chunk-WN77JNYY.js} +2 -2
- package/dist/web/server/{chunk-2U7PWSJX.js → chunk-WZNZQNI4.js} +231 -3633
- package/dist/web/server/{chunk-B2F6MLVZ.js → chunk-XFVL5ITL.js} +2246 -2228
- package/dist/web/server/{chunk-3GSFXWL5.js → chunk-XLCTCC4W.js} +3 -3
- package/dist/web/server/{chunk-AZZHUVJR.js → chunk-Y4MHIA7B.js} +18 -26
- package/dist/web/server/{fleet-pi-tool-renderer-lJvZWmBJ-4M5YI6VS.js → fleet-pi-tool-renderer-CE45vM6T-2UQN6RJM.js} +11 -9
- package/dist/web/server/{fork-picker-dialog-BZzfxdQd-Y725VJ7G.js → fork-picker-dialog-DCzuGelH-TN2Q5OXI.js} +5 -5
- package/dist/web/server/{openui-renderer-Cg4RSE9k-7BTJIYZJ.js → openui-renderer-c36_GYes-HX46N4M5.js} +11 -11
- package/dist/web/server/{repl-panel-BEQrC2ef-V3YEZ7EO.js → repl-panel-D9E8nkQy-L45ZNG2V.js} +4 -3
- package/dist/web/server/{router-CEahIUpn-SRG7XKIH.js → router-_ZpegqiQ-QIE44PIB.js} +1737 -1370
- package/dist/web/server/{routes-BznemByz-F4DJAYIM.js → routes-Ct81-8Tq-LHRMOS7R.js} +2882 -2330
- package/dist/web/server/server.js +3 -3
- package/dist/web/server/{session-insights-panel-JfeTHE0d-3HZB3ZWI.js → session-insights-panel-BHZyKDTo-LRMAMA3O.js} +4 -2
- package/dist/web/server/{settings-dialog-DgeBMORv-7SRSENPM.js → settings-dialog-B4uUS6f--AZ4I4ZOT.js} +142 -142
- package/dist/web/server/{start-CLAD7RcD-56S4BWMM.js → start-BYVnok_H-IA6TWGA3.js} +1 -1
- package/dist/web/server/subagent-chat-panel-C97S3WID-DLOAD5TG.js +63 -0
- package/dist/web/server/subagents-panel-iHpvMIZy-LI6XK66M.js +181 -0
- package/dist/web/server/{workspace-panel-y54P79_B-VPIYUXF6.js → workspace-panel-CHPoiXEo-YB4WS3MK.js} +2 -2
- package/package.json +5 -5
- package/dist/web/client/assets/artifacts-panel-CX62LQ13.js +0 -1
- package/dist/web/client/assets/chat-command-palette-C4sSf8Kg.js +0 -1
- package/dist/web/client/assets/collapsible-DmyYcezk.js +0 -1
- package/dist/web/client/assets/command-CB6emP8m.js +0 -2
- package/dist/web/client/assets/conversation-turns-ByFoWPXe.js +0 -6
- package/dist/web/client/assets/globals-CqqQdk2S.css +0 -2
- package/dist/web/client/assets/range-vSJ7Ux_5.js +0 -2
- package/dist/web/client/assets/repl-panel-DiGS6uCw.js +0 -1
- package/dist/web/client/assets/routes-CxlNCi_v.js +0 -16
- package/dist/web/client/assets/session-insights-panel-DwmwiikS.js +0 -1
- package/dist/web/client/assets/subagents-panel-DGnsK6Nx.js +0 -1
- package/dist/web/server/chunk-ZEVZFLIY.js +0 -334
- package/dist/web/server/subagents-panel-CzZe3co7-2VZ5JTWF.js +0 -332
|
@@ -2,61 +2,17 @@ import {
|
|
|
2
2
|
createLucideIcon
|
|
3
3
|
} from "./chunk-E26EAQIM.js";
|
|
4
4
|
|
|
5
|
-
// web/app/dist/server/assets/
|
|
5
|
+
// web/app/dist/server/assets/createBaseUIEventDetails-Di_Q3Zih.js
|
|
6
6
|
import * as React$1 from "react";
|
|
7
7
|
import { createElement as createElement2 } from "react";
|
|
8
8
|
import * as ReactDOM from "react-dom";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
var UNINITIALIZED = {};
|
|
17
|
-
function useRefWithInit(init, initArg) {
|
|
18
|
-
const ref = React$1.useRef(UNINITIALIZED);
|
|
19
|
-
if (ref.current === UNINITIALIZED) ref.current = init(initArg);
|
|
20
|
-
return ref;
|
|
21
|
-
}
|
|
22
|
-
var noop = () => {
|
|
23
|
-
};
|
|
24
|
-
var useIsoLayoutEffect = typeof document !== "undefined" ? React$1.useLayoutEffect : noop;
|
|
25
|
-
function createFormatErrorMessage(baseUrl, prefix) {
|
|
26
|
-
return function formatErrorMessage2(code, ...args) {
|
|
27
|
-
const url = new URL(baseUrl);
|
|
28
|
-
url.searchParams.set("code", code.toString());
|
|
29
|
-
args.forEach((arg) => url.searchParams.append("args[]", arg));
|
|
30
|
-
return `${prefix} error #${code}; visit ${url} for the full message.`;
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
var formatErrorMessage = createFormatErrorMessage("https://base-ui.com/production-error", "Base UI");
|
|
34
|
-
var majorVersion = parseInt(React$1.version, 10);
|
|
35
|
-
function isReactVersionAtLeast(reactVersionToCheck) {
|
|
36
|
-
return majorVersion >= reactVersionToCheck;
|
|
37
|
-
}
|
|
38
|
-
var SafeReact = { ...React$1 };
|
|
39
|
-
var useInsertionEffect$1 = SafeReact.useInsertionEffect;
|
|
40
|
-
var useSafeInsertionEffect = useInsertionEffect$1 && useInsertionEffect$1 !== SafeReact.useLayoutEffect ? useInsertionEffect$1 : (fn) => fn();
|
|
41
|
-
function useStableCallback(callback) {
|
|
42
|
-
const stable = useRefWithInit(createStableCallback).current;
|
|
43
|
-
stable.next = callback;
|
|
44
|
-
useSafeInsertionEffect(stable.effect);
|
|
45
|
-
return stable.trampoline;
|
|
46
|
-
}
|
|
47
|
-
function createStableCallback() {
|
|
48
|
-
const stable = {
|
|
49
|
-
next: void 0,
|
|
50
|
-
callback: assertNotCalled,
|
|
51
|
-
trampoline: (...args) => stable.callback?.(...args),
|
|
52
|
-
effect: () => {
|
|
53
|
-
stable.callback = stable.next;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
return stable;
|
|
57
|
-
}
|
|
58
|
-
function assertNotCalled() {
|
|
59
|
-
}
|
|
9
|
+
var X = createLucideIcon("x", [["path", {
|
|
10
|
+
d: "M18 6 6 18",
|
|
11
|
+
key: "1bl5f8"
|
|
12
|
+
}], ["path", {
|
|
13
|
+
d: "m6 6 12 12",
|
|
14
|
+
key: "d8bk6v"
|
|
15
|
+
}]]);
|
|
60
16
|
function hasWindow() {
|
|
61
17
|
return typeof window !== "undefined";
|
|
62
18
|
}
|
|
@@ -169,163 +125,37 @@ function getOverflowAncestors(node, list, traverseIframes) {
|
|
|
169
125
|
function getFrameElement(win) {
|
|
170
126
|
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
171
127
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
var EMPTY = null;
|
|
179
|
-
globalThis.requestAnimationFrame;
|
|
180
|
-
var Scheduler = class {
|
|
181
|
-
callbacks = [];
|
|
182
|
-
callbacksCount = 0;
|
|
183
|
-
nextId = 1;
|
|
184
|
-
startId = 1;
|
|
185
|
-
isScheduled = false;
|
|
186
|
-
tick = (timestamp) => {
|
|
187
|
-
this.isScheduled = false;
|
|
188
|
-
const currentCallbacks = this.callbacks;
|
|
189
|
-
const currentCallbacksCount = this.callbacksCount;
|
|
190
|
-
this.callbacks = [];
|
|
191
|
-
this.callbacksCount = 0;
|
|
192
|
-
this.startId = this.nextId;
|
|
193
|
-
if (currentCallbacksCount > 0) for (let i = 0; i < currentCallbacks.length; i += 1) currentCallbacks[i]?.(timestamp);
|
|
194
|
-
};
|
|
195
|
-
request(fn) {
|
|
196
|
-
const id = this.nextId;
|
|
197
|
-
this.nextId += 1;
|
|
198
|
-
this.callbacks.push(fn);
|
|
199
|
-
this.callbacksCount += 1;
|
|
200
|
-
if (!this.isScheduled || false) {
|
|
201
|
-
requestAnimationFrame(this.tick);
|
|
202
|
-
this.isScheduled = true;
|
|
203
|
-
}
|
|
204
|
-
return id;
|
|
205
|
-
}
|
|
206
|
-
cancel(id) {
|
|
207
|
-
const index = id - this.startId;
|
|
208
|
-
if (index < 0 || index >= this.callbacks.length) return;
|
|
209
|
-
this.callbacks[index] = null;
|
|
210
|
-
this.callbacksCount -= 1;
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
|
-
var scheduler = new Scheduler();
|
|
214
|
-
var AnimationFrame = class AnimationFrame2 {
|
|
215
|
-
static create() {
|
|
216
|
-
return new AnimationFrame2();
|
|
217
|
-
}
|
|
218
|
-
static request(fn) {
|
|
219
|
-
return scheduler.request(fn);
|
|
220
|
-
}
|
|
221
|
-
static cancel(id) {
|
|
222
|
-
return scheduler.cancel(id);
|
|
223
|
-
}
|
|
224
|
-
currentId = EMPTY;
|
|
225
|
-
/**
|
|
226
|
-
* Executes `fn` after `delay`, clearing any previously scheduled call.
|
|
227
|
-
*/
|
|
228
|
-
request(fn) {
|
|
229
|
-
this.cancel();
|
|
230
|
-
this.currentId = scheduler.request(() => {
|
|
231
|
-
this.currentId = EMPTY;
|
|
232
|
-
fn();
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
cancel = () => {
|
|
236
|
-
if (this.currentId !== EMPTY) {
|
|
237
|
-
scheduler.cancel(this.currentId);
|
|
238
|
-
this.currentId = EMPTY;
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
disposeEffect = () => {
|
|
242
|
-
return this.cancel;
|
|
243
|
-
};
|
|
244
|
-
};
|
|
245
|
-
function useAnimationFrame() {
|
|
246
|
-
const timeout = useRefWithInit(AnimationFrame.create).current;
|
|
247
|
-
useOnMount(timeout.disposeEffect);
|
|
248
|
-
return timeout;
|
|
249
|
-
}
|
|
250
|
-
function useMergedRefs(a, b, c, d) {
|
|
251
|
-
const forkRef = useRefWithInit(createForkRef).current;
|
|
252
|
-
if (didChange(forkRef, a, b, c, d)) update(forkRef, [
|
|
253
|
-
a,
|
|
254
|
-
b,
|
|
255
|
-
c,
|
|
256
|
-
d
|
|
257
|
-
]);
|
|
258
|
-
return forkRef.callback;
|
|
259
|
-
}
|
|
260
|
-
function useMergedRefsN(refs) {
|
|
261
|
-
const forkRef = useRefWithInit(createForkRef).current;
|
|
262
|
-
if (didChangeN(forkRef, refs)) update(forkRef, refs);
|
|
263
|
-
return forkRef.callback;
|
|
264
|
-
}
|
|
265
|
-
function createForkRef() {
|
|
266
|
-
return {
|
|
267
|
-
callback: null,
|
|
268
|
-
cleanup: null,
|
|
269
|
-
refs: []
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
function didChange(forkRef, a, b, c, d) {
|
|
273
|
-
return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d;
|
|
128
|
+
var SafeReact = { ...React$1 };
|
|
129
|
+
var UNINITIALIZED = {};
|
|
130
|
+
function useRefWithInit(init, initArg) {
|
|
131
|
+
const ref = React$1.useRef(UNINITIALIZED);
|
|
132
|
+
if (ref.current === UNINITIALIZED) ref.current = init(initArg);
|
|
133
|
+
return ref;
|
|
274
134
|
}
|
|
275
|
-
|
|
276
|
-
|
|
135
|
+
var useInsertionEffect$1 = SafeReact.useInsertionEffect;
|
|
136
|
+
var useSafeInsertionEffect = useInsertionEffect$1 && useInsertionEffect$1 !== SafeReact.useLayoutEffect ? useInsertionEffect$1 : (fn) => fn();
|
|
137
|
+
function useStableCallback(callback) {
|
|
138
|
+
const stable = useRefWithInit(createStableCallback).current;
|
|
139
|
+
stable.next = callback;
|
|
140
|
+
useSafeInsertionEffect(stable.effect);
|
|
141
|
+
return stable.trampoline;
|
|
277
142
|
}
|
|
278
|
-
function
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
if (forkRef.cleanup) {
|
|
286
|
-
forkRef.cleanup();
|
|
287
|
-
forkRef.cleanup = null;
|
|
288
|
-
}
|
|
289
|
-
if (instance != null) {
|
|
290
|
-
const cleanupCallbacks = Array(refs.length).fill(null);
|
|
291
|
-
for (let i = 0; i < refs.length; i += 1) {
|
|
292
|
-
const ref = refs[i];
|
|
293
|
-
if (ref == null) continue;
|
|
294
|
-
switch (typeof ref) {
|
|
295
|
-
case "function": {
|
|
296
|
-
const refCleanup = ref(instance);
|
|
297
|
-
if (typeof refCleanup === "function") cleanupCallbacks[i] = refCleanup;
|
|
298
|
-
break;
|
|
299
|
-
}
|
|
300
|
-
case "object":
|
|
301
|
-
ref.current = instance;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
forkRef.cleanup = () => {
|
|
305
|
-
for (let i = 0; i < refs.length; i += 1) {
|
|
306
|
-
const ref = refs[i];
|
|
307
|
-
if (ref == null) continue;
|
|
308
|
-
switch (typeof ref) {
|
|
309
|
-
case "function": {
|
|
310
|
-
const cleanupCallback = cleanupCallbacks[i];
|
|
311
|
-
if (typeof cleanupCallback === "function") cleanupCallback();
|
|
312
|
-
else ref(null);
|
|
313
|
-
break;
|
|
314
|
-
}
|
|
315
|
-
case "object":
|
|
316
|
-
ref.current = null;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
};
|
|
143
|
+
function createStableCallback() {
|
|
144
|
+
const stable = {
|
|
145
|
+
next: void 0,
|
|
146
|
+
callback: assertNotCalled,
|
|
147
|
+
trampoline: (...args) => stable.callback?.(...args),
|
|
148
|
+
effect: () => {
|
|
149
|
+
stable.callback = stable.next;
|
|
320
150
|
}
|
|
321
151
|
};
|
|
152
|
+
return stable;
|
|
322
153
|
}
|
|
323
|
-
function
|
|
324
|
-
if (!/* @__PURE__ */ React$1.isValidElement(element)) return null;
|
|
325
|
-
const reactElement = element;
|
|
326
|
-
const propsWithRef = reactElement.props;
|
|
327
|
-
return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;
|
|
154
|
+
function assertNotCalled() {
|
|
328
155
|
}
|
|
156
|
+
var noop = () => {
|
|
157
|
+
};
|
|
158
|
+
var useIsoLayoutEffect = typeof document !== "undefined" ? React$1.useLayoutEffect : noop;
|
|
329
159
|
function mergeObjects(a, b) {
|
|
330
160
|
if (a && !b) return a;
|
|
331
161
|
if (!a && b) return b;
|
|
@@ -334,26 +164,6 @@ function mergeObjects(a, b) {
|
|
|
334
164
|
...b
|
|
335
165
|
};
|
|
336
166
|
}
|
|
337
|
-
function getStateAttributesProps(state, customMapping) {
|
|
338
|
-
const props = {};
|
|
339
|
-
for (const key in state) {
|
|
340
|
-
const value = state[key];
|
|
341
|
-
if (customMapping?.hasOwnProperty(key)) {
|
|
342
|
-
const customProps = customMapping[key](value);
|
|
343
|
-
if (customProps != null) Object.assign(props, customProps);
|
|
344
|
-
continue;
|
|
345
|
-
}
|
|
346
|
-
if (value === true) props[`data-${key.toLowerCase()}`] = "";
|
|
347
|
-
else if (value) props[`data-${key.toLowerCase()}`] = value.toString();
|
|
348
|
-
}
|
|
349
|
-
return props;
|
|
350
|
-
}
|
|
351
|
-
function resolveClassName(className, state) {
|
|
352
|
-
return typeof className === "function" ? className(state) : className;
|
|
353
|
-
}
|
|
354
|
-
function resolveStyle(style, state) {
|
|
355
|
-
return typeof style === "function" ? style(state) : style;
|
|
356
|
-
}
|
|
357
167
|
var EMPTY_PROPS = {};
|
|
358
168
|
function mergeProps(a, b, c, d, e) {
|
|
359
169
|
if (!c && !d && !e && !a) return createInitialMergedProps(b);
|
|
@@ -459,8 +269,277 @@ function mergeClassNames(ourClassName, theirClassName) {
|
|
|
459
269
|
function isSyntheticEvent(event) {
|
|
460
270
|
return event != null && typeof event === "object" && "nativeEvent" in event;
|
|
461
271
|
}
|
|
462
|
-
function
|
|
463
|
-
|
|
272
|
+
function createFormatErrorMessage(baseUrl, prefix) {
|
|
273
|
+
return function formatErrorMessage2(code, ...args) {
|
|
274
|
+
const url = new URL(baseUrl);
|
|
275
|
+
url.searchParams.set("code", code.toString());
|
|
276
|
+
args.forEach((arg) => url.searchParams.append("args[]", arg));
|
|
277
|
+
return `${prefix} error #${code}; visit ${url} for the full message.`;
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
var formatErrorMessage = createFormatErrorMessage("https://base-ui.com/production-error", "Base UI");
|
|
281
|
+
var CompositeRootContext = /* @__PURE__ */ React$1.createContext(void 0);
|
|
282
|
+
function useCompositeRootContext(optional = false) {
|
|
283
|
+
const context = React$1.useContext(CompositeRootContext);
|
|
284
|
+
if (context === void 0 && !optional) throw new Error(formatErrorMessage(16));
|
|
285
|
+
return context;
|
|
286
|
+
}
|
|
287
|
+
function useFocusableWhenDisabled(parameters) {
|
|
288
|
+
const { focusableWhenDisabled, disabled: disabled2, composite = false, tabIndex: tabIndexProp = 0, isNativeButton } = parameters;
|
|
289
|
+
const isFocusableComposite = composite && focusableWhenDisabled !== false;
|
|
290
|
+
const isNonFocusableComposite = composite && focusableWhenDisabled === false;
|
|
291
|
+
return { props: React$1.useMemo(() => {
|
|
292
|
+
const additionalProps = { onKeyDown(event) {
|
|
293
|
+
if (disabled2 && focusableWhenDisabled && event.key !== "Tab") event.preventDefault();
|
|
294
|
+
} };
|
|
295
|
+
if (!composite) {
|
|
296
|
+
additionalProps.tabIndex = tabIndexProp;
|
|
297
|
+
if (!isNativeButton && disabled2) additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1;
|
|
298
|
+
}
|
|
299
|
+
if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled2) additionalProps["aria-disabled"] = disabled2;
|
|
300
|
+
if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) additionalProps.disabled = disabled2;
|
|
301
|
+
return additionalProps;
|
|
302
|
+
}, [
|
|
303
|
+
composite,
|
|
304
|
+
disabled2,
|
|
305
|
+
focusableWhenDisabled,
|
|
306
|
+
isFocusableComposite,
|
|
307
|
+
isNonFocusableComposite,
|
|
308
|
+
isNativeButton,
|
|
309
|
+
tabIndexProp
|
|
310
|
+
]) };
|
|
311
|
+
}
|
|
312
|
+
function dispatchClickWithModifiers(target, sourceEvent, { detail = 0 } = {}) {
|
|
313
|
+
target.dispatchEvent(new (getWindow(target)).PointerEvent("click", {
|
|
314
|
+
bubbles: true,
|
|
315
|
+
cancelable: true,
|
|
316
|
+
composed: true,
|
|
317
|
+
detail,
|
|
318
|
+
shiftKey: sourceEvent.shiftKey,
|
|
319
|
+
ctrlKey: sourceEvent.ctrlKey,
|
|
320
|
+
altKey: sourceEvent.altKey,
|
|
321
|
+
metaKey: sourceEvent.metaKey
|
|
322
|
+
}));
|
|
323
|
+
}
|
|
324
|
+
function useButton(parameters = {}) {
|
|
325
|
+
const { disabled: disabled2 = false, focusableWhenDisabled, tabIndex = 0, native: isNativeButton = true, composite: compositeProp } = parameters;
|
|
326
|
+
const elementRef = React$1.useRef(null);
|
|
327
|
+
const compositeRootContext = useCompositeRootContext(true);
|
|
328
|
+
const isCompositeItem = compositeProp ?? compositeRootContext !== void 0;
|
|
329
|
+
const { props: focusableWhenDisabledProps } = useFocusableWhenDisabled({
|
|
330
|
+
focusableWhenDisabled,
|
|
331
|
+
disabled: disabled2,
|
|
332
|
+
composite: isCompositeItem,
|
|
333
|
+
tabIndex,
|
|
334
|
+
isNativeButton
|
|
335
|
+
});
|
|
336
|
+
const updateDisabled = React$1.useCallback(() => {
|
|
337
|
+
const element = elementRef.current;
|
|
338
|
+
if (!isButtonElement(element)) return;
|
|
339
|
+
if (isCompositeItem && disabled2 && focusableWhenDisabledProps.disabled === void 0 && element.disabled) element.disabled = false;
|
|
340
|
+
}, [
|
|
341
|
+
disabled2,
|
|
342
|
+
focusableWhenDisabledProps.disabled,
|
|
343
|
+
isCompositeItem
|
|
344
|
+
]);
|
|
345
|
+
useIsoLayoutEffect(updateDisabled, [updateDisabled]);
|
|
346
|
+
return {
|
|
347
|
+
getButtonProps: React$1.useCallback((externalProps = {}) => {
|
|
348
|
+
const { onClick: externalOnClick, onMouseDown: externalOnMouseDown, onKeyUp: externalOnKeyUp, onKeyDown: externalOnKeyDown, onPointerDown: externalOnPointerDown, ...otherExternalProps } = externalProps;
|
|
349
|
+
return mergeProps({
|
|
350
|
+
onClick(event) {
|
|
351
|
+
if (disabled2) {
|
|
352
|
+
event.preventDefault();
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
externalOnClick?.(event);
|
|
356
|
+
},
|
|
357
|
+
onMouseDown(event) {
|
|
358
|
+
if (!disabled2) externalOnMouseDown?.(event);
|
|
359
|
+
},
|
|
360
|
+
onKeyDown(event) {
|
|
361
|
+
if (disabled2) return;
|
|
362
|
+
makeEventPreventable(event);
|
|
363
|
+
externalOnKeyDown?.(event);
|
|
364
|
+
if (event.baseUIHandlerPrevented) return;
|
|
365
|
+
const isCurrentTarget = event.target === event.currentTarget;
|
|
366
|
+
const currentTarget = event.currentTarget;
|
|
367
|
+
const isButton = isButtonElement(currentTarget);
|
|
368
|
+
const isLink = !isNativeButton && isValidLinkElement(currentTarget);
|
|
369
|
+
const shouldClick = isCurrentTarget && (isNativeButton ? isButton : !isLink);
|
|
370
|
+
const isEnterKey = event.key === "Enter";
|
|
371
|
+
const isSpaceKey = event.key === " ";
|
|
372
|
+
const role = currentTarget.getAttribute("role");
|
|
373
|
+
const isTextNavigationRole = role?.startsWith("menuitem") || role === "option" || role === "gridcell";
|
|
374
|
+
if (isCurrentTarget && isCompositeItem && isSpaceKey) {
|
|
375
|
+
if (event.defaultPrevented && isTextNavigationRole) return;
|
|
376
|
+
event.preventDefault();
|
|
377
|
+
if (!isNativeButton || isButton) {
|
|
378
|
+
event.preventBaseUIHandler();
|
|
379
|
+
dispatchClickWithModifiers(currentTarget, event);
|
|
380
|
+
}
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
if (!shouldClick || isNativeButton || !isSpaceKey && !isEnterKey) {
|
|
384
|
+
if (isCurrentTarget && isLink && isSpaceKey) event.preventDefault();
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
if (event.defaultPrevented) return;
|
|
388
|
+
event.preventDefault();
|
|
389
|
+
if (isEnterKey) {
|
|
390
|
+
event.preventBaseUIHandler();
|
|
391
|
+
dispatchClickWithModifiers(currentTarget, event);
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
onKeyUp(event) {
|
|
395
|
+
if (disabled2) return;
|
|
396
|
+
makeEventPreventable(event);
|
|
397
|
+
externalOnKeyUp?.(event);
|
|
398
|
+
if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === " ") {
|
|
399
|
+
event.preventDefault();
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
if (event.baseUIHandlerPrevented) return;
|
|
403
|
+
if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && !event.defaultPrevented && event.key === " ") {
|
|
404
|
+
event.preventBaseUIHandler();
|
|
405
|
+
dispatchClickWithModifiers(event.currentTarget, event);
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
onPointerDown(event) {
|
|
409
|
+
if (disabled2) {
|
|
410
|
+
event.preventDefault();
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
externalOnPointerDown?.(event);
|
|
414
|
+
}
|
|
415
|
+
}, isNativeButton ? { type: "button" } : { role: "button" }, focusableWhenDisabledProps, otherExternalProps);
|
|
416
|
+
}, [
|
|
417
|
+
disabled2,
|
|
418
|
+
focusableWhenDisabledProps,
|
|
419
|
+
isCompositeItem,
|
|
420
|
+
isNativeButton
|
|
421
|
+
]),
|
|
422
|
+
buttonRef: useStableCallback((element) => {
|
|
423
|
+
elementRef.current = element;
|
|
424
|
+
updateDisabled();
|
|
425
|
+
})
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
function isButtonElement(elem) {
|
|
429
|
+
return isHTMLElement(elem) && elem.tagName === "BUTTON";
|
|
430
|
+
}
|
|
431
|
+
function isValidLinkElement(elem) {
|
|
432
|
+
return isHTMLElement(elem) && elem.tagName === "A" && Boolean(elem.href);
|
|
433
|
+
}
|
|
434
|
+
function useMergedRefs(a, b, c, d) {
|
|
435
|
+
const forkRef = useRefWithInit(createForkRef).current;
|
|
436
|
+
if (didChange(forkRef, a, b, c, d)) update(forkRef, [
|
|
437
|
+
a,
|
|
438
|
+
b,
|
|
439
|
+
c,
|
|
440
|
+
d
|
|
441
|
+
]);
|
|
442
|
+
return forkRef.callback;
|
|
443
|
+
}
|
|
444
|
+
function useMergedRefsN(refs) {
|
|
445
|
+
const forkRef = useRefWithInit(createForkRef).current;
|
|
446
|
+
if (didChangeN(forkRef, refs)) update(forkRef, refs);
|
|
447
|
+
return forkRef.callback;
|
|
448
|
+
}
|
|
449
|
+
function createForkRef() {
|
|
450
|
+
return {
|
|
451
|
+
callback: null,
|
|
452
|
+
cleanup: null,
|
|
453
|
+
refs: []
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
function didChange(forkRef, a, b, c, d) {
|
|
457
|
+
return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d;
|
|
458
|
+
}
|
|
459
|
+
function didChangeN(forkRef, newRefs) {
|
|
460
|
+
return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]);
|
|
461
|
+
}
|
|
462
|
+
function update(forkRef, refs) {
|
|
463
|
+
forkRef.refs = refs;
|
|
464
|
+
if (refs.every((ref) => ref == null)) {
|
|
465
|
+
forkRef.callback = null;
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
forkRef.callback = (instance) => {
|
|
469
|
+
if (forkRef.cleanup) {
|
|
470
|
+
forkRef.cleanup();
|
|
471
|
+
forkRef.cleanup = null;
|
|
472
|
+
}
|
|
473
|
+
if (instance != null) {
|
|
474
|
+
const cleanupCallbacks = Array(refs.length).fill(null);
|
|
475
|
+
for (let i = 0; i < refs.length; i += 1) {
|
|
476
|
+
const ref = refs[i];
|
|
477
|
+
if (ref == null) continue;
|
|
478
|
+
switch (typeof ref) {
|
|
479
|
+
case "function": {
|
|
480
|
+
const refCleanup = ref(instance);
|
|
481
|
+
if (typeof refCleanup === "function") cleanupCallbacks[i] = refCleanup;
|
|
482
|
+
break;
|
|
483
|
+
}
|
|
484
|
+
case "object":
|
|
485
|
+
ref.current = instance;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
forkRef.cleanup = () => {
|
|
489
|
+
for (let i = 0; i < refs.length; i += 1) {
|
|
490
|
+
const ref = refs[i];
|
|
491
|
+
if (ref == null) continue;
|
|
492
|
+
switch (typeof ref) {
|
|
493
|
+
case "function": {
|
|
494
|
+
const cleanupCallback = cleanupCallbacks[i];
|
|
495
|
+
if (typeof cleanupCallback === "function") cleanupCallback();
|
|
496
|
+
else ref(null);
|
|
497
|
+
break;
|
|
498
|
+
}
|
|
499
|
+
case "object":
|
|
500
|
+
ref.current = null;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
var majorVersion = parseInt(React$1.version, 10);
|
|
508
|
+
function isReactVersionAtLeast(reactVersionToCheck) {
|
|
509
|
+
return majorVersion >= reactVersionToCheck;
|
|
510
|
+
}
|
|
511
|
+
function getReactElementRef(element) {
|
|
512
|
+
if (!/* @__PURE__ */ React$1.isValidElement(element)) return null;
|
|
513
|
+
const reactElement = element;
|
|
514
|
+
const propsWithRef = reactElement.props;
|
|
515
|
+
return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null;
|
|
516
|
+
}
|
|
517
|
+
function NOOP() {
|
|
518
|
+
}
|
|
519
|
+
var EMPTY_ARRAY = Object.freeze([]);
|
|
520
|
+
var EMPTY_OBJECT = Object.freeze({});
|
|
521
|
+
function getStateAttributesProps(state, customMapping) {
|
|
522
|
+
const props = {};
|
|
523
|
+
for (const key in state) {
|
|
524
|
+
const value = state[key];
|
|
525
|
+
if (customMapping?.hasOwnProperty(key)) {
|
|
526
|
+
const customProps = customMapping[key](value);
|
|
527
|
+
if (customProps != null) Object.assign(props, customProps);
|
|
528
|
+
continue;
|
|
529
|
+
}
|
|
530
|
+
if (value === true) props[`data-${key.toLowerCase()}`] = "";
|
|
531
|
+
else if (value) props[`data-${key.toLowerCase()}`] = value.toString();
|
|
532
|
+
}
|
|
533
|
+
return props;
|
|
534
|
+
}
|
|
535
|
+
function resolveClassName(className, state) {
|
|
536
|
+
return typeof className === "function" ? className(state) : className;
|
|
537
|
+
}
|
|
538
|
+
function resolveStyle(style, state) {
|
|
539
|
+
return typeof style === "function" ? style(state) : style;
|
|
540
|
+
}
|
|
541
|
+
function useRenderElement(element, componentProps, params = {}) {
|
|
542
|
+
const renderProp = componentProps.render;
|
|
464
543
|
const outProps = useRenderElementProps(componentProps, params);
|
|
465
544
|
if (params.enabled === false) return null;
|
|
466
545
|
return evaluateRenderProp(element, renderProp, outProps, params.state ?? EMPTY_OBJECT);
|
|
@@ -482,42 +561,123 @@ function useRenderElementProps(componentProps, params = {}) {
|
|
|
482
561
|
]);
|
|
483
562
|
else outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref);
|
|
484
563
|
}
|
|
485
|
-
if (!enabled) return EMPTY_OBJECT;
|
|
486
|
-
if (className !== void 0) outProps.className = mergeClassNames(outProps.className, className);
|
|
487
|
-
if (style !== void 0) outProps.style = mergeObjects(outProps.style, style);
|
|
488
|
-
return outProps;
|
|
489
|
-
}
|
|
490
|
-
function resolveRenderFunctionProps(props) {
|
|
491
|
-
if (Array.isArray(props)) return mergePropsN(props);
|
|
492
|
-
return mergeProps(void 0, props);
|
|
493
|
-
}
|
|
494
|
-
var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
|
|
495
|
-
function evaluateRenderProp(element, render, props, state) {
|
|
496
|
-
if (render) {
|
|
497
|
-
if (typeof render === "function") return render(props, state);
|
|
498
|
-
const mergedProps = mergeProps(props, render.props);
|
|
499
|
-
mergedProps.ref = props.ref;
|
|
500
|
-
let newElement = render;
|
|
501
|
-
if (newElement?.$$typeof === REACT_LAZY_TYPE) newElement = React$1.Children.toArray(render)[0];
|
|
502
|
-
return /* @__PURE__ */ React$1.cloneElement(newElement, mergedProps);
|
|
564
|
+
if (!enabled) return EMPTY_OBJECT;
|
|
565
|
+
if (className !== void 0) outProps.className = mergeClassNames(outProps.className, className);
|
|
566
|
+
if (style !== void 0) outProps.style = mergeObjects(outProps.style, style);
|
|
567
|
+
return outProps;
|
|
568
|
+
}
|
|
569
|
+
function resolveRenderFunctionProps(props) {
|
|
570
|
+
if (Array.isArray(props)) return mergePropsN(props);
|
|
571
|
+
return mergeProps(void 0, props);
|
|
572
|
+
}
|
|
573
|
+
var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy");
|
|
574
|
+
function evaluateRenderProp(element, render, props, state) {
|
|
575
|
+
if (render) {
|
|
576
|
+
if (typeof render === "function") return render(props, state);
|
|
577
|
+
const mergedProps = mergeProps(props, render.props);
|
|
578
|
+
mergedProps.ref = props.ref;
|
|
579
|
+
let newElement = render;
|
|
580
|
+
if (newElement?.$$typeof === REACT_LAZY_TYPE) newElement = React$1.Children.toArray(render)[0];
|
|
581
|
+
return /* @__PURE__ */ React$1.cloneElement(newElement, mergedProps);
|
|
582
|
+
}
|
|
583
|
+
if (element) {
|
|
584
|
+
if (typeof element === "string") return renderTag(element, props);
|
|
585
|
+
}
|
|
586
|
+
throw new Error(formatErrorMessage(8));
|
|
587
|
+
}
|
|
588
|
+
function renderTag(Tag, props) {
|
|
589
|
+
if (Tag === "button") return /* @__PURE__ */ createElement2("button", {
|
|
590
|
+
type: "button",
|
|
591
|
+
...props,
|
|
592
|
+
key: props.key
|
|
593
|
+
});
|
|
594
|
+
if (Tag === "img") return /* @__PURE__ */ createElement2("img", {
|
|
595
|
+
alt: "",
|
|
596
|
+
...props,
|
|
597
|
+
key: props.key
|
|
598
|
+
});
|
|
599
|
+
return /* @__PURE__ */ React$1.createElement(Tag, props);
|
|
600
|
+
}
|
|
601
|
+
function useOnMount(fn) {
|
|
602
|
+
React$1.useEffect(fn, EMPTY_ARRAY);
|
|
603
|
+
}
|
|
604
|
+
function addEventListener(target, type, listener, options) {
|
|
605
|
+
target.addEventListener(type, listener, options);
|
|
606
|
+
return () => {
|
|
607
|
+
target.removeEventListener(type, listener, options);
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
var EMPTY = null;
|
|
611
|
+
globalThis.requestAnimationFrame;
|
|
612
|
+
var Scheduler = class {
|
|
613
|
+
callbacks = [];
|
|
614
|
+
callbacksCount = 0;
|
|
615
|
+
nextId = 1;
|
|
616
|
+
startId = 1;
|
|
617
|
+
isScheduled = false;
|
|
618
|
+
tick = (timestamp) => {
|
|
619
|
+
this.isScheduled = false;
|
|
620
|
+
const currentCallbacks = this.callbacks;
|
|
621
|
+
const currentCallbacksCount = this.callbacksCount;
|
|
622
|
+
this.callbacks = [];
|
|
623
|
+
this.callbacksCount = 0;
|
|
624
|
+
this.startId = this.nextId;
|
|
625
|
+
if (currentCallbacksCount > 0) for (let i = 0; i < currentCallbacks.length; i += 1) currentCallbacks[i]?.(timestamp);
|
|
626
|
+
};
|
|
627
|
+
request(fn) {
|
|
628
|
+
const id = this.nextId;
|
|
629
|
+
this.nextId += 1;
|
|
630
|
+
this.callbacks.push(fn);
|
|
631
|
+
this.callbacksCount += 1;
|
|
632
|
+
if (!this.isScheduled || false) {
|
|
633
|
+
requestAnimationFrame(this.tick);
|
|
634
|
+
this.isScheduled = true;
|
|
635
|
+
}
|
|
636
|
+
return id;
|
|
637
|
+
}
|
|
638
|
+
cancel(id) {
|
|
639
|
+
const index = id - this.startId;
|
|
640
|
+
if (index < 0 || index >= this.callbacks.length) return;
|
|
641
|
+
this.callbacks[index] = null;
|
|
642
|
+
this.callbacksCount -= 1;
|
|
643
|
+
}
|
|
644
|
+
};
|
|
645
|
+
var scheduler = new Scheduler();
|
|
646
|
+
var AnimationFrame = class AnimationFrame2 {
|
|
647
|
+
static create() {
|
|
648
|
+
return new AnimationFrame2();
|
|
649
|
+
}
|
|
650
|
+
static request(fn) {
|
|
651
|
+
return scheduler.request(fn);
|
|
652
|
+
}
|
|
653
|
+
static cancel(id) {
|
|
654
|
+
return scheduler.cancel(id);
|
|
503
655
|
}
|
|
504
|
-
|
|
505
|
-
|
|
656
|
+
currentId = EMPTY;
|
|
657
|
+
/**
|
|
658
|
+
* Executes `fn` after `delay`, clearing any previously scheduled call.
|
|
659
|
+
*/
|
|
660
|
+
request(fn) {
|
|
661
|
+
this.cancel();
|
|
662
|
+
this.currentId = scheduler.request(() => {
|
|
663
|
+
this.currentId = EMPTY;
|
|
664
|
+
fn();
|
|
665
|
+
});
|
|
506
666
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
return
|
|
667
|
+
cancel = () => {
|
|
668
|
+
if (this.currentId !== EMPTY) {
|
|
669
|
+
scheduler.cancel(this.currentId);
|
|
670
|
+
this.currentId = EMPTY;
|
|
671
|
+
}
|
|
672
|
+
};
|
|
673
|
+
disposeEffect = () => {
|
|
674
|
+
return this.cancel;
|
|
675
|
+
};
|
|
676
|
+
};
|
|
677
|
+
function useAnimationFrame() {
|
|
678
|
+
const timeout = useRefWithInit(AnimationFrame.create).current;
|
|
679
|
+
useOnMount(timeout.disposeEffect);
|
|
680
|
+
return timeout;
|
|
521
681
|
}
|
|
522
682
|
var TransitionStatusDataAttributes = /* @__PURE__ */ (function(TransitionStatusDataAttributes2) {
|
|
523
683
|
TransitionStatusDataAttributes2["startingStyle"] = "data-starting-style";
|
|
@@ -621,159 +781,6 @@ function useId$1(idOverride, prefix) {
|
|
|
621
781
|
}
|
|
622
782
|
return useGlobalId(idOverride, prefix);
|
|
623
783
|
}
|
|
624
|
-
var CompositeRootContext = /* @__PURE__ */ React$1.createContext(void 0);
|
|
625
|
-
function useCompositeRootContext(optional = false) {
|
|
626
|
-
const context = React$1.useContext(CompositeRootContext);
|
|
627
|
-
if (context === void 0 && !optional) throw new Error(formatErrorMessage(16));
|
|
628
|
-
return context;
|
|
629
|
-
}
|
|
630
|
-
function useFocusableWhenDisabled(parameters) {
|
|
631
|
-
const { focusableWhenDisabled, disabled: disabled2, composite = false, tabIndex: tabIndexProp = 0, isNativeButton } = parameters;
|
|
632
|
-
const isFocusableComposite = composite && focusableWhenDisabled !== false;
|
|
633
|
-
const isNonFocusableComposite = composite && focusableWhenDisabled === false;
|
|
634
|
-
return { props: React$1.useMemo(() => {
|
|
635
|
-
const additionalProps = { onKeyDown(event) {
|
|
636
|
-
if (disabled2 && focusableWhenDisabled && event.key !== "Tab") event.preventDefault();
|
|
637
|
-
} };
|
|
638
|
-
if (!composite) {
|
|
639
|
-
additionalProps.tabIndex = tabIndexProp;
|
|
640
|
-
if (!isNativeButton && disabled2) additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1;
|
|
641
|
-
}
|
|
642
|
-
if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled2) additionalProps["aria-disabled"] = disabled2;
|
|
643
|
-
if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) additionalProps.disabled = disabled2;
|
|
644
|
-
return additionalProps;
|
|
645
|
-
}, [
|
|
646
|
-
composite,
|
|
647
|
-
disabled2,
|
|
648
|
-
focusableWhenDisabled,
|
|
649
|
-
isFocusableComposite,
|
|
650
|
-
isNonFocusableComposite,
|
|
651
|
-
isNativeButton,
|
|
652
|
-
tabIndexProp
|
|
653
|
-
]) };
|
|
654
|
-
}
|
|
655
|
-
function dispatchClickWithModifiers(target, sourceEvent, { detail = 0 } = {}) {
|
|
656
|
-
target.dispatchEvent(new (getWindow(target)).PointerEvent("click", {
|
|
657
|
-
bubbles: true,
|
|
658
|
-
cancelable: true,
|
|
659
|
-
composed: true,
|
|
660
|
-
detail,
|
|
661
|
-
shiftKey: sourceEvent.shiftKey,
|
|
662
|
-
ctrlKey: sourceEvent.ctrlKey,
|
|
663
|
-
altKey: sourceEvent.altKey,
|
|
664
|
-
metaKey: sourceEvent.metaKey
|
|
665
|
-
}));
|
|
666
|
-
}
|
|
667
|
-
function useButton(parameters = {}) {
|
|
668
|
-
const { disabled: disabled2 = false, focusableWhenDisabled, tabIndex = 0, native: isNativeButton = true, composite: compositeProp } = parameters;
|
|
669
|
-
const elementRef = React$1.useRef(null);
|
|
670
|
-
const compositeRootContext = useCompositeRootContext(true);
|
|
671
|
-
const isCompositeItem = compositeProp ?? compositeRootContext !== void 0;
|
|
672
|
-
const { props: focusableWhenDisabledProps } = useFocusableWhenDisabled({
|
|
673
|
-
focusableWhenDisabled,
|
|
674
|
-
disabled: disabled2,
|
|
675
|
-
composite: isCompositeItem,
|
|
676
|
-
tabIndex,
|
|
677
|
-
isNativeButton
|
|
678
|
-
});
|
|
679
|
-
const updateDisabled = React$1.useCallback(() => {
|
|
680
|
-
const element = elementRef.current;
|
|
681
|
-
if (!isButtonElement(element)) return;
|
|
682
|
-
if (isCompositeItem && disabled2 && focusableWhenDisabledProps.disabled === void 0 && element.disabled) element.disabled = false;
|
|
683
|
-
}, [
|
|
684
|
-
disabled2,
|
|
685
|
-
focusableWhenDisabledProps.disabled,
|
|
686
|
-
isCompositeItem
|
|
687
|
-
]);
|
|
688
|
-
useIsoLayoutEffect(updateDisabled, [updateDisabled]);
|
|
689
|
-
return {
|
|
690
|
-
getButtonProps: React$1.useCallback((externalProps = {}) => {
|
|
691
|
-
const { onClick: externalOnClick, onMouseDown: externalOnMouseDown, onKeyUp: externalOnKeyUp, onKeyDown: externalOnKeyDown, onPointerDown: externalOnPointerDown, ...otherExternalProps } = externalProps;
|
|
692
|
-
return mergeProps({
|
|
693
|
-
onClick(event) {
|
|
694
|
-
if (disabled2) {
|
|
695
|
-
event.preventDefault();
|
|
696
|
-
return;
|
|
697
|
-
}
|
|
698
|
-
externalOnClick?.(event);
|
|
699
|
-
},
|
|
700
|
-
onMouseDown(event) {
|
|
701
|
-
if (!disabled2) externalOnMouseDown?.(event);
|
|
702
|
-
},
|
|
703
|
-
onKeyDown(event) {
|
|
704
|
-
if (disabled2) return;
|
|
705
|
-
makeEventPreventable(event);
|
|
706
|
-
externalOnKeyDown?.(event);
|
|
707
|
-
if (event.baseUIHandlerPrevented) return;
|
|
708
|
-
const isCurrentTarget = event.target === event.currentTarget;
|
|
709
|
-
const currentTarget = event.currentTarget;
|
|
710
|
-
const isButton = isButtonElement(currentTarget);
|
|
711
|
-
const isLink = !isNativeButton && isValidLinkElement(currentTarget);
|
|
712
|
-
const shouldClick = isCurrentTarget && (isNativeButton ? isButton : !isLink);
|
|
713
|
-
const isEnterKey = event.key === "Enter";
|
|
714
|
-
const isSpaceKey = event.key === " ";
|
|
715
|
-
const role = currentTarget.getAttribute("role");
|
|
716
|
-
const isTextNavigationRole = role?.startsWith("menuitem") || role === "option" || role === "gridcell";
|
|
717
|
-
if (isCurrentTarget && isCompositeItem && isSpaceKey) {
|
|
718
|
-
if (event.defaultPrevented && isTextNavigationRole) return;
|
|
719
|
-
event.preventDefault();
|
|
720
|
-
if (!isNativeButton || isButton) {
|
|
721
|
-
event.preventBaseUIHandler();
|
|
722
|
-
dispatchClickWithModifiers(currentTarget, event);
|
|
723
|
-
}
|
|
724
|
-
return;
|
|
725
|
-
}
|
|
726
|
-
if (!shouldClick || isNativeButton || !isSpaceKey && !isEnterKey) {
|
|
727
|
-
if (isCurrentTarget && isLink && isSpaceKey) event.preventDefault();
|
|
728
|
-
return;
|
|
729
|
-
}
|
|
730
|
-
if (event.defaultPrevented) return;
|
|
731
|
-
event.preventDefault();
|
|
732
|
-
if (isEnterKey) {
|
|
733
|
-
event.preventBaseUIHandler();
|
|
734
|
-
dispatchClickWithModifiers(currentTarget, event);
|
|
735
|
-
}
|
|
736
|
-
},
|
|
737
|
-
onKeyUp(event) {
|
|
738
|
-
if (disabled2) return;
|
|
739
|
-
makeEventPreventable(event);
|
|
740
|
-
externalOnKeyUp?.(event);
|
|
741
|
-
if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === " ") {
|
|
742
|
-
event.preventDefault();
|
|
743
|
-
return;
|
|
744
|
-
}
|
|
745
|
-
if (event.baseUIHandlerPrevented) return;
|
|
746
|
-
if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && !event.defaultPrevented && event.key === " ") {
|
|
747
|
-
event.preventBaseUIHandler();
|
|
748
|
-
dispatchClickWithModifiers(event.currentTarget, event);
|
|
749
|
-
}
|
|
750
|
-
},
|
|
751
|
-
onPointerDown(event) {
|
|
752
|
-
if (disabled2) {
|
|
753
|
-
event.preventDefault();
|
|
754
|
-
return;
|
|
755
|
-
}
|
|
756
|
-
externalOnPointerDown?.(event);
|
|
757
|
-
}
|
|
758
|
-
}, isNativeButton ? { type: "button" } : { role: "button" }, focusableWhenDisabledProps, otherExternalProps);
|
|
759
|
-
}, [
|
|
760
|
-
disabled2,
|
|
761
|
-
focusableWhenDisabledProps,
|
|
762
|
-
isCompositeItem,
|
|
763
|
-
isNativeButton
|
|
764
|
-
]),
|
|
765
|
-
buttonRef: useStableCallback((element) => {
|
|
766
|
-
elementRef.current = element;
|
|
767
|
-
updateDisabled();
|
|
768
|
-
})
|
|
769
|
-
};
|
|
770
|
-
}
|
|
771
|
-
function isButtonElement(elem) {
|
|
772
|
-
return isHTMLElement(elem) && elem.tagName === "BUTTON";
|
|
773
|
-
}
|
|
774
|
-
function isValidLinkElement(elem) {
|
|
775
|
-
return isHTMLElement(elem) && elem.tagName === "A" && Boolean(elem.href);
|
|
776
|
-
}
|
|
777
784
|
var none = "none";
|
|
778
785
|
var triggerPress = "trigger-press";
|
|
779
786
|
var triggerHover = "trigger-hover";
|
|
@@ -813,24 +820,9 @@ function createChangeEventDetails(reason, event, trigger, customProperties) {
|
|
|
813
820
|
...custom
|
|
814
821
|
};
|
|
815
822
|
}
|
|
816
|
-
var X = createLucideIcon("x", [["path", {
|
|
817
|
-
d: "M18 6 6 18",
|
|
818
|
-
key: "1bl5f8"
|
|
819
|
-
}], ["path", {
|
|
820
|
-
d: "m6 6 12 12",
|
|
821
|
-
key: "d8bk6v"
|
|
822
|
-
}]]);
|
|
823
823
|
|
|
824
824
|
export {
|
|
825
|
-
|
|
826
|
-
EMPTY_ARRAY,
|
|
827
|
-
EMPTY_OBJECT,
|
|
828
|
-
useOnMount,
|
|
829
|
-
useRefWithInit,
|
|
830
|
-
useIsoLayoutEffect,
|
|
831
|
-
formatErrorMessage,
|
|
832
|
-
isReactVersionAtLeast,
|
|
833
|
-
useStableCallback,
|
|
825
|
+
X,
|
|
834
826
|
getNodeName,
|
|
835
827
|
getWindow,
|
|
836
828
|
getDocumentElement,
|
|
@@ -850,23 +842,32 @@ export {
|
|
|
850
842
|
getParentNode,
|
|
851
843
|
getOverflowAncestors,
|
|
852
844
|
getFrameElement,
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
845
|
+
useRefWithInit,
|
|
846
|
+
useStableCallback,
|
|
847
|
+
useIsoLayoutEffect,
|
|
848
|
+
mergeProps,
|
|
849
|
+
formatErrorMessage,
|
|
850
|
+
CompositeRootContext,
|
|
851
|
+
useCompositeRootContext,
|
|
852
|
+
dispatchClickWithModifiers,
|
|
853
|
+
useButton,
|
|
856
854
|
useMergedRefs,
|
|
855
|
+
isReactVersionAtLeast,
|
|
856
|
+
NOOP,
|
|
857
|
+
EMPTY_ARRAY,
|
|
858
|
+
EMPTY_OBJECT,
|
|
857
859
|
resolveStyle,
|
|
858
|
-
mergeProps,
|
|
859
860
|
useRenderElement,
|
|
861
|
+
useOnMount,
|
|
862
|
+
addEventListener,
|
|
863
|
+
AnimationFrame,
|
|
864
|
+
useAnimationFrame,
|
|
860
865
|
TransitionStatusDataAttributes,
|
|
861
866
|
transitionStatusMapping,
|
|
862
867
|
resolveRef,
|
|
863
868
|
useAnimationsFinished,
|
|
864
869
|
useOpenChangeComplete,
|
|
865
870
|
useId$1,
|
|
866
|
-
CompositeRootContext,
|
|
867
|
-
useCompositeRootContext,
|
|
868
|
-
dispatchClickWithModifiers,
|
|
869
|
-
useButton,
|
|
870
871
|
none,
|
|
871
872
|
triggerPress,
|
|
872
873
|
triggerHover,
|
|
@@ -883,8 +884,7 @@ export {
|
|
|
883
884
|
initial,
|
|
884
885
|
imperativeAction,
|
|
885
886
|
windowResize,
|
|
886
|
-
createChangeEventDetails
|
|
887
|
-
X
|
|
887
|
+
createChangeEventDetails
|
|
888
888
|
};
|
|
889
889
|
/**
|
|
890
890
|
* @license lucide-react v1.33.0 - ISC
|