@marimo-team/islands 0.17.8 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Combination-BH_L276x.js → Combination-D68fi0fY.js} +22 -21
- package/dist/{ConnectedDataExplorerComponent-WbiFXhKG.js → ConnectedDataExplorerComponent-BUgUSo2B.js} +7 -7
- package/dist/{any-language-editor-YPQMljy9.js → any-language-editor-BS-Z5AY5.js} +3 -3
- package/dist/assets/__vite-browser-external-CSegkGa0.js +1 -0
- package/dist/assets/{worker-BrDpRi2I.js → worker-CiT2i-Vo.js} +2 -2
- package/dist/{error-banner-BqE1uF21.js → error-banner-CPLhCPHA.js} +24 -24
- package/dist/{esm-hR1r0nyt.js → esm-DxgKy8Wv.js} +1 -1
- package/dist/{formats-dvT8nDgH.js → formats-oddMfm9_.js} +27 -7
- package/dist/{glide-data-editor-B26PhZvE.js → glide-data-editor-BFv4VQnc.js} +4 -4
- package/dist/{label-D3LNCORf.js → label-Dsm6T1fr.js} +72 -72
- package/dist/main.js +359 -250
- package/dist/{mermaid-Dl3ywmV2.js → mermaid-BeGlg1JH.js} +2 -2
- package/dist/{react-vega-ypEMYp9o.js → react-vega-DDXWt_PN.js} +852 -1544
- package/dist/{react-vega-BIDT9Ttp.js → react-vega-DV2IwPx_.js} +1 -1
- package/dist/{spec-qDDGe5hl.js → spec-BotzCMo3.js} +2 -2
- package/dist/style.css +1 -1
- package/dist/{types-2eTEqSwS.js → types-IRrkdH-H.js} +14 -14
- package/dist/{useAsyncData-6gisQ4pR.js → useAsyncData-CsSW6_Zh.js} +1 -1
- package/dist/{useTheme-B-2frT0L.js → useTheme-D56Xlrez.js} +1 -0
- package/dist/{vega-component-C-bCSv1b.js → vega-component-CLjz4see.js} +6 -6
- package/package.json +2 -2
- package/src/components/chat/chat-panel.tsx +6 -2
- package/src/components/data-table/TableActions.tsx +18 -14
- package/src/components/data-table/data-table.tsx +3 -0
- package/src/components/editor/chrome/panels/packages-panel.tsx +3 -1
- package/src/components/editor/file-tree/__tests__/file-expolorer.test.ts +178 -0
- package/src/components/editor/file-tree/file-explorer.tsx +70 -1
- package/src/components/pages/home-page.tsx +8 -3
- package/src/core/ai/tools/__tests__/registry.test.ts +6 -2
- package/src/core/ai/tools/registry.ts +5 -2
- package/src/core/cells/__tests__/session.test.ts +0 -9
- package/src/core/cells/session.ts +0 -1
- package/src/core/codemirror/copilot/client.ts +21 -1
- package/src/core/codemirror/copilot/copilot-config.tsx +29 -1
- package/src/core/config/__tests__/config-schema.test.ts +2 -0
- package/src/core/config/config-schema.ts +1 -0
- package/src/core/packages/__tests__/package-input-utils.test.ts +93 -0
- package/src/core/packages/package-input-utils.ts +36 -0
- package/src/css/md.css +5 -0
- package/src/plugins/core/__test__/sanitize.test.ts +1 -1
- package/src/plugins/core/sanitize.ts +3 -1
- package/src/plugins/impl/DataTablePlugin.tsx +10 -1
- package/src/plugins/impl/chat/ChatPlugin.tsx +1 -0
- package/src/plugins/impl/chat/chat-ui.tsx +140 -10
- package/src/plugins/impl/data-frames/DataFramePlugin.tsx +1 -0
- package/src/plugins/layout/NavigationMenuPlugin.tsx +14 -3
- package/src/plugins/layout/ProgressPlugin.tsx +8 -5
- package/src/plugins/layout/StatPlugin.tsx +11 -4
- package/src/plugins/layout/__test__/ProgressPlugin.test.ts +37 -21
- package/src/utils/__tests__/urls.test.ts +165 -1
- package/src/utils/urls.ts +120 -0
- package/src/utils/vitals.ts +1 -1
- package/dist/assets/__vite-browser-external-BTNiCQ6O.js +0 -1
|
@@ -8,7 +8,7 @@ import { t as createLucideIcon } from "./createLucideIcon-ixdBmsqu.js";
|
|
|
8
8
|
import { d as cn, r as cva } from "./button-Hye6-2X8.js";
|
|
9
9
|
import { s as Logger } from "./hotkeys-C3KM59Ph.js";
|
|
10
10
|
import { t as require_jsx_runtime } from "./jsx-runtime-Duz3IlLt.js";
|
|
11
|
-
import { b as atom, f as isIslands, l as store } from "./useTheme-
|
|
11
|
+
import { b as atom, f as isIslands, l as store } from "./useTheme-D56Xlrez.js";
|
|
12
12
|
import { n as KnownQueryParams } from "./constants-CN19buVX.js";
|
|
13
13
|
import { i as tableFromIPC } from "./loader-BCInj1Mf.js";
|
|
14
14
|
var CircleQuestionMark = createLucideIcon("circle-question-mark", [
|
|
@@ -424,6 +424,25 @@ var urlRegex = /^(https?:\/\/\S+)$/;
|
|
|
424
424
|
function isUrl(e) {
|
|
425
425
|
return typeof e == "string" && urlRegex.test(e);
|
|
426
426
|
}
|
|
427
|
+
function appendQueryParams({ href: e, queryParams: x, keys: S }) {
|
|
428
|
+
let C = typeof x == "string" ? new URLSearchParams(x) : x;
|
|
429
|
+
if (C.size === 0 || e.startsWith("http://") || e.startsWith("https://")) return e;
|
|
430
|
+
let w = e.startsWith("#"), T = w && e.includes("?");
|
|
431
|
+
if (w && !T) {
|
|
432
|
+
let x2 = S ? [...C.entries()].filter(([e2]) => S.includes(e2)) : [...C.entries()], w2 = new URLSearchParams();
|
|
433
|
+
for (let [e2, S2] of x2) w2.set(e2, S2);
|
|
434
|
+
let T2 = w2.toString();
|
|
435
|
+
return T2 ? `/?${T2}${e}` : e;
|
|
436
|
+
}
|
|
437
|
+
let E = e, D = "", O = new URLSearchParams(), k = w ? 1 : 0, A = e.indexOf("#", k);
|
|
438
|
+
A !== -1 && (D = e.slice(A), E = e.slice(0, A));
|
|
439
|
+
let j = E.indexOf("?");
|
|
440
|
+
j !== -1 && (O = new URLSearchParams(E.slice(j + 1)), E = E.slice(0, j));
|
|
441
|
+
let M = new URLSearchParams(O), N = S ? [...C.entries()].filter(([e2]) => S.includes(e2)) : [...C.entries()];
|
|
442
|
+
for (let [e2, x2] of N) M.set(e2, x2);
|
|
443
|
+
let P = M.toString();
|
|
444
|
+
return P ? `${E}?${P}${D}` : e;
|
|
445
|
+
}
|
|
427
446
|
var createId = (0, (/* @__PURE__ */ __toESM(require_cuid2(), 1)).init)({ length: 6 });
|
|
428
447
|
function generateSessionId() {
|
|
429
448
|
return `s_${createId()}`;
|
|
@@ -682,10 +701,11 @@ function decodeIPC(e, x) {
|
|
|
682
701
|
return tableFromIPC(e, x ?? { useProxy: true });
|
|
683
702
|
}
|
|
684
703
|
export {
|
|
685
|
-
CircleQuestionMark as
|
|
686
|
-
|
|
704
|
+
CircleQuestionMark as C,
|
|
705
|
+
isWasm as S,
|
|
706
|
+
appendQueryParams as _,
|
|
687
707
|
AlertDescription as a,
|
|
688
|
-
|
|
708
|
+
isStaticNotebook as b,
|
|
689
709
|
toDate as c,
|
|
690
710
|
millisecondsInHour as d,
|
|
691
711
|
millisecondsInMinute as f,
|
|
@@ -701,7 +721,7 @@ export {
|
|
|
701
721
|
isValid as s,
|
|
702
722
|
arrow as t,
|
|
703
723
|
millisecondsInDay as u,
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
724
|
+
isUrl as v,
|
|
725
|
+
Deferred as x,
|
|
726
|
+
require_cuid2 as y
|
|
707
727
|
};
|
|
@@ -7,16 +7,16 @@ import { t as require_compiler_runtime } from "./compiler-runtime-DTozApu4.js";
|
|
|
7
7
|
import { n as toast, t as copyToClipboard } from "./copy-BeueJfCy.js";
|
|
8
8
|
import "./createLucideIcon-ixdBmsqu.js";
|
|
9
9
|
import "./check-DvmFwGOM.js";
|
|
10
|
-
import { T as useOnMount, a as SelectItem, c as SelectTrigger, k as logNever, l as SelectValue, n as Select, r as SelectContent, t as Label } from "./label-
|
|
11
|
-
import { S as DropdownMenuSubTrigger, X as capitalize_default, Xt as Pencil, Y as useNonce, Yt as Plus, a as Input, b as DropdownMenuSub, g as DropdownMenuItem, m as DropdownMenuContent, n as ErrorBoundary, p as DropdownMenu, qt as Trash, t as BulkEdit, v as DropdownMenuPortal, x as DropdownMenuSubContent, y as DropdownMenuSeparator } from "./types-
|
|
10
|
+
import { T as useOnMount, a as SelectItem, c as SelectTrigger, k as logNever, l as SelectValue, n as Select, r as SelectContent, t as Label } from "./label-Dsm6T1fr.js";
|
|
11
|
+
import { S as DropdownMenuSubTrigger, X as capitalize_default, Xt as Pencil, Y as useNonce, Yt as Plus, a as Input, b as DropdownMenuSub, g as DropdownMenuItem, m as DropdownMenuContent, n as ErrorBoundary, p as DropdownMenu, qt as Trash, t as BulkEdit, v as DropdownMenuPortal, x as DropdownMenuSubContent, y as DropdownMenuSeparator } from "./types-IRrkdH-H.js";
|
|
12
12
|
import { t as Copy } from "./copy-B9QnP3Mi.js";
|
|
13
13
|
import "./clsx-JH8KOlt9.js";
|
|
14
14
|
import { t as Button, u as Events } from "./button-Hye6-2X8.js";
|
|
15
15
|
import { s as Logger } from "./hotkeys-C3KM59Ph.js";
|
|
16
|
-
import "./Combination-
|
|
16
|
+
import "./Combination-D68fi0fY.js";
|
|
17
17
|
import { t as require_jsx_runtime } from "./jsx-runtime-Duz3IlLt.js";
|
|
18
18
|
import "./react-dom-DBPBYhx0.js";
|
|
19
|
-
import { m as useEvent_default, t as useTheme } from "./useTheme-
|
|
19
|
+
import { m as useEvent_default, t as useTheme } from "./useTheme-D56Xlrez.js";
|
|
20
20
|
import "./isArrayLikeObject-LulrZoeO.js";
|
|
21
21
|
import "./isSymbol-bQx0U8Lk.js";
|
|
22
22
|
import "./toString-MxUAFb1C.js";
|
|
@@ -5,7 +5,7 @@ import { t as createLucideIcon } from "./createLucideIcon-ixdBmsqu.js";
|
|
|
5
5
|
import { t as Check } from "./check-DvmFwGOM.js";
|
|
6
6
|
import { d as cn, l as useComposedRefs, o as createSlot, r as cva, u as Events } from "./button-Hye6-2X8.js";
|
|
7
7
|
import { s as Logger } from "./hotkeys-C3KM59Ph.js";
|
|
8
|
-
import { C as
|
|
8
|
+
import { A as composeEventHandlers, C as useLayoutEffect2, E as Primitive, S as useId, T as useCallbackRef, _ as Arrow, b as createPopperScope, c as withSmartCollisionBoundary, f as VISUALLY_HIDDEN_STYLES, g as Anchor, h as Portal, i as useFocusGuards, k as createContextScope, n as hideOthers, p as useControllableState, r as FocusScope, s as withFullScreenAsRoot, t as Combination_default, u as StyleNamespace, v as Content, w as DismissableLayer, y as Root2$1 } from "./Combination-D68fi0fY.js";
|
|
9
9
|
import { t as require_jsx_runtime } from "./jsx-runtime-Duz3IlLt.js";
|
|
10
10
|
import { t as require_react_dom } from "./react-dom-DBPBYhx0.js";
|
|
11
11
|
import { t as toString_default } from "./toString-MxUAFb1C.js";
|
|
@@ -345,24 +345,24 @@ function createCollection(e) {
|
|
|
345
345
|
});
|
|
346
346
|
});
|
|
347
347
|
m.displayName = f;
|
|
348
|
-
let
|
|
349
|
-
let { scope: a2, children: o2, ...s2 } = e2, u = import_react.useRef(null), d2 = useComposedRefs(i2, u), f2 = c(
|
|
348
|
+
let h = e + "CollectionItemSlot", g = "data-radix-collection-item", _ = createSlot(h), v = import_react.forwardRef((e2, i2) => {
|
|
349
|
+
let { scope: a2, children: o2, ...s2 } = e2, u = import_react.useRef(null), d2 = useComposedRefs(i2, u), f2 = c(h, a2);
|
|
350
350
|
return import_react.useEffect(() => (f2.itemMap.set(u, {
|
|
351
351
|
ref: u,
|
|
352
352
|
...s2
|
|
353
|
-
}), () => void f2.itemMap.delete(u))), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
354
|
-
[
|
|
353
|
+
}), () => void f2.itemMap.delete(u))), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(_, {
|
|
354
|
+
[g]: "",
|
|
355
355
|
ref: d2,
|
|
356
356
|
children: o2
|
|
357
357
|
});
|
|
358
358
|
});
|
|
359
|
-
|
|
360
|
-
function
|
|
359
|
+
v.displayName = h;
|
|
360
|
+
function y(i2) {
|
|
361
361
|
let a2 = c(e + "CollectionConsumer", i2);
|
|
362
362
|
return import_react.useCallback(() => {
|
|
363
363
|
let e2 = a2.collectionRef.current;
|
|
364
364
|
if (!e2) return [];
|
|
365
|
-
let i3 = Array.from(e2.querySelectorAll(`[${
|
|
365
|
+
let i3 = Array.from(e2.querySelectorAll(`[${g}]`));
|
|
366
366
|
return Array.from(a2.itemMap.values()).sort((e3, a3) => i3.indexOf(e3.ref.current) - i3.indexOf(a3.ref.current));
|
|
367
367
|
}, [a2.collectionRef, a2.itemMap]);
|
|
368
368
|
}
|
|
@@ -370,9 +370,9 @@ function createCollection(e) {
|
|
|
370
370
|
{
|
|
371
371
|
Provider: d,
|
|
372
372
|
Slot: m,
|
|
373
|
-
ItemSlot:
|
|
373
|
+
ItemSlot: v
|
|
374
374
|
},
|
|
375
|
-
|
|
375
|
+
y,
|
|
376
376
|
o
|
|
377
377
|
];
|
|
378
378
|
}
|
|
@@ -387,35 +387,35 @@ var import_react_dom = /* @__PURE__ */ __toESM(require_react_dom(), 1), OPEN_KEY
|
|
|
387
387
|
"ArrowUp",
|
|
388
388
|
"ArrowDown"
|
|
389
389
|
], SELECTION_KEYS = [" ", "Enter"], SELECT_NAME = "Select", [Collection, useCollection, createCollectionScope] = createCollection(SELECT_NAME), [createSelectContext, createSelectScope] = createContextScope(SELECT_NAME, [createCollectionScope, createPopperScope]), usePopperScope = createPopperScope(), [SelectProvider, useSelectContext] = createSelectContext(SELECT_NAME), [SelectNativeOptionsProvider, useSelectNativeOptionsContext] = createSelectContext(SELECT_NAME), Select$1 = (e) => {
|
|
390
|
-
let { __scopeSelect: i, children: a, open: o, defaultOpen: s, onOpenChange: c, value: l, defaultValue: u, onValueChange: d, dir: f, name: p, autoComplete: m, disabled: h, required: g, form:
|
|
390
|
+
let { __scopeSelect: i, children: a, open: o, defaultOpen: s, onOpenChange: c, value: l, defaultValue: u, onValueChange: d, dir: f, name: p, autoComplete: m, disabled: h, required: g, form: v } = e, y = usePopperScope(i), [b, x] = import_react.useState(null), [S, C] = import_react.useState(null), [w, T] = import_react.useState(false), E = useDirection(f), [D, k] = useControllableState({
|
|
391
391
|
prop: o,
|
|
392
392
|
defaultProp: s ?? false,
|
|
393
393
|
onChange: c,
|
|
394
394
|
caller: SELECT_NAME
|
|
395
|
-
}), [
|
|
395
|
+
}), [A, j] = useControllableState({
|
|
396
396
|
prop: l,
|
|
397
397
|
defaultProp: u,
|
|
398
398
|
onChange: d,
|
|
399
399
|
caller: SELECT_NAME
|
|
400
|
-
}),
|
|
400
|
+
}), M = import_react.useRef(null), N = b ? v || !!b.closest("form") : true, [P, I] = import_react.useState(/* @__PURE__ */ new Set()), L = Array.from(P).map((e2) => e2.props.value).join(";");
|
|
401
401
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Root2$1, {
|
|
402
|
-
...
|
|
402
|
+
...y,
|
|
403
403
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(SelectProvider, {
|
|
404
404
|
required: g,
|
|
405
405
|
scope: i,
|
|
406
|
-
trigger:
|
|
407
|
-
onTriggerChange:
|
|
406
|
+
trigger: b,
|
|
407
|
+
onTriggerChange: x,
|
|
408
408
|
valueNode: S,
|
|
409
409
|
onValueNodeChange: C,
|
|
410
410
|
valueNodeHasChildren: w,
|
|
411
411
|
onValueNodeHasChildrenChange: T,
|
|
412
412
|
contentId: useId(),
|
|
413
|
-
value:
|
|
414
|
-
onValueChange:
|
|
413
|
+
value: A,
|
|
414
|
+
onValueChange: j,
|
|
415
415
|
open: D,
|
|
416
|
-
onOpenChange:
|
|
416
|
+
onOpenChange: k,
|
|
417
417
|
dir: E,
|
|
418
|
-
triggerPointerDownPosRef:
|
|
418
|
+
triggerPointerDownPosRef: M,
|
|
419
419
|
disabled: h,
|
|
420
420
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Provider, {
|
|
421
421
|
scope: i,
|
|
@@ -438,22 +438,22 @@ var import_react_dom = /* @__PURE__ */ __toESM(require_react_dom(), 1), OPEN_KEY
|
|
|
438
438
|
tabIndex: -1,
|
|
439
439
|
name: p,
|
|
440
440
|
autoComplete: m,
|
|
441
|
-
value:
|
|
442
|
-
onChange: (e2) =>
|
|
441
|
+
value: A,
|
|
442
|
+
onChange: (e2) => j(e2.target.value),
|
|
443
443
|
disabled: h,
|
|
444
|
-
form:
|
|
445
|
-
children: [
|
|
444
|
+
form: v,
|
|
445
|
+
children: [A === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "" }) : null, Array.from(P)]
|
|
446
446
|
}, L) : null]
|
|
447
447
|
})
|
|
448
448
|
});
|
|
449
449
|
};
|
|
450
450
|
Select$1.displayName = SELECT_NAME;
|
|
451
451
|
var TRIGGER_NAME = "SelectTrigger", SelectTrigger$1 = import_react.forwardRef((e, i) => {
|
|
452
|
-
let { __scopeSelect: a, disabled: o = false, ...s } = e, c = usePopperScope(a), u = useSelectContext(TRIGGER_NAME, a), d = u.disabled || o, f = useComposedRefs(i, u.onTriggerChange), p = useCollection(a),
|
|
452
|
+
let { __scopeSelect: a, disabled: o = false, ...s } = e, c = usePopperScope(a), u = useSelectContext(TRIGGER_NAME, a), d = u.disabled || o, f = useComposedRefs(i, u.onTriggerChange), p = useCollection(a), h = import_react.useRef("touch"), [_, v, y] = useTypeaheadSearch((e2) => {
|
|
453
453
|
let i2 = p().filter((e3) => !e3.disabled), a2 = findNextItem(i2, e2, i2.find((e3) => e3.value === u.value));
|
|
454
454
|
a2 !== void 0 && u.onValueChange(a2.value);
|
|
455
|
-
}),
|
|
456
|
-
d || (u.onOpenChange(true),
|
|
455
|
+
}), b = (e2) => {
|
|
456
|
+
d || (u.onOpenChange(true), y()), e2 && (u.triggerPointerDownPosRef.current = {
|
|
457
457
|
x: Math.round(e2.pageX),
|
|
458
458
|
y: Math.round(e2.pageY)
|
|
459
459
|
});
|
|
@@ -476,28 +476,28 @@ var TRIGGER_NAME = "SelectTrigger", SelectTrigger$1 = import_react.forwardRef((e
|
|
|
476
476
|
...s,
|
|
477
477
|
ref: f,
|
|
478
478
|
onClick: composeEventHandlers(s.onClick, (e2) => {
|
|
479
|
-
e2.currentTarget.focus(),
|
|
479
|
+
e2.currentTarget.focus(), h.current !== "mouse" && b(e2);
|
|
480
480
|
}),
|
|
481
481
|
onPointerDown: composeEventHandlers(s.onPointerDown, (e2) => {
|
|
482
|
-
|
|
482
|
+
h.current = e2.pointerType;
|
|
483
483
|
let i2 = e2.target;
|
|
484
|
-
i2.hasPointerCapture(e2.pointerId) && i2.releasePointerCapture(e2.pointerId), e2.button === 0 && e2.ctrlKey === false && e2.pointerType === "mouse" && (
|
|
484
|
+
i2.hasPointerCapture(e2.pointerId) && i2.releasePointerCapture(e2.pointerId), e2.button === 0 && e2.ctrlKey === false && e2.pointerType === "mouse" && (b(e2), e2.preventDefault());
|
|
485
485
|
}),
|
|
486
486
|
onKeyDown: composeEventHandlers(s.onKeyDown, (e2) => {
|
|
487
|
-
let i2 =
|
|
488
|
-
!(e2.ctrlKey || e2.altKey || e2.metaKey) && e2.key.length === 1 &&
|
|
487
|
+
let i2 = _.current !== "";
|
|
488
|
+
!(e2.ctrlKey || e2.altKey || e2.metaKey) && e2.key.length === 1 && v(e2.key), !(i2 && e2.key === " ") && OPEN_KEYS.includes(e2.key) && (b(), e2.preventDefault());
|
|
489
489
|
})
|
|
490
490
|
})
|
|
491
491
|
});
|
|
492
492
|
});
|
|
493
493
|
SelectTrigger$1.displayName = TRIGGER_NAME;
|
|
494
494
|
var VALUE_NAME = "SelectValue", SelectValue$1 = import_react.forwardRef((e, i) => {
|
|
495
|
-
let { __scopeSelect: a, className: o, style: s, children: c, placeholder: u = "", ...d } = e, f = useSelectContext(VALUE_NAME, a), { onValueNodeHasChildrenChange: p } = f, m = c !== void 0,
|
|
495
|
+
let { __scopeSelect: a, className: o, style: s, children: c, placeholder: u = "", ...d } = e, f = useSelectContext(VALUE_NAME, a), { onValueNodeHasChildrenChange: p } = f, m = c !== void 0, _ = useComposedRefs(i, f.onValueNodeChange);
|
|
496
496
|
return useLayoutEffect2(() => {
|
|
497
497
|
p(m);
|
|
498
498
|
}, [p, m]), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.span, {
|
|
499
499
|
...d,
|
|
500
|
-
ref:
|
|
500
|
+
ref: _,
|
|
501
501
|
style: { pointerEvents: "none" },
|
|
502
502
|
children: shouldShowPlaceholder(f.value) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: u }) : c
|
|
503
503
|
});
|
|
@@ -539,24 +539,24 @@ var CONTENT_NAME = "SelectContent", SelectContent$1 = import_react.forwardRef((e
|
|
|
539
539
|
});
|
|
540
540
|
SelectContent$1.displayName = CONTENT_NAME;
|
|
541
541
|
var CONTENT_MARGIN = 10, [SelectContentProvider, useSelectContentContext] = createSelectContext(CONTENT_NAME), CONTENT_IMPL_NAME = "SelectContentImpl", Slot = createSlot("SelectContent.RemoveScroll"), SelectContentImpl = import_react.forwardRef((e, i) => {
|
|
542
|
-
let { __scopeSelect: a, position: o = "item-aligned", onCloseAutoFocus: s, onEscapeKeyDown: c, onPointerDownOutside: u, side: d, sideOffset: f, align: p, alignOffset: h, arrowPadding: g, collisionBoundary: _, collisionPadding: v, sticky: y, hideWhenDetached: b, avoidCollisions: x, ...S } = e, C = useSelectContext(CONTENT_NAME, a), [
|
|
542
|
+
let { __scopeSelect: a, position: o = "item-aligned", onCloseAutoFocus: s, onEscapeKeyDown: c, onPointerDownOutside: u, side: d, sideOffset: f, align: p, alignOffset: h, arrowPadding: g, collisionBoundary: _, collisionPadding: v, sticky: y, hideWhenDetached: b, avoidCollisions: x, ...S } = e, C = useSelectContext(CONTENT_NAME, a), [w, E] = import_react.useState(null), [O, A] = import_react.useState(null), M = useComposedRefs(i, (e2) => E(e2)), [N, F] = import_react.useState(null), [I, L] = import_react.useState(null), R = useCollection(a), [z, B] = import_react.useState(false), V = import_react.useRef(false);
|
|
543
543
|
import_react.useEffect(() => {
|
|
544
|
-
if (
|
|
545
|
-
}, [
|
|
544
|
+
if (w) return hideOthers(w);
|
|
545
|
+
}, [w]), useFocusGuards();
|
|
546
546
|
let H = import_react.useCallback((e2) => {
|
|
547
547
|
let [i2, ...a2] = R().map((e3) => e3.ref.current), [o2] = a2.slice(-1), s2 = document.activeElement;
|
|
548
|
-
for (let a3 of e2) if (a3 === s2 || (a3 == null ? void 0 : a3.scrollIntoView({ block: "nearest" }), a3 === i2 &&
|
|
549
|
-
}, [R,
|
|
548
|
+
for (let a3 of e2) if (a3 === s2 || (a3 == null ? void 0 : a3.scrollIntoView({ block: "nearest" }), a3 === i2 && O && (O.scrollTop = 0), a3 === o2 && O && (O.scrollTop = O.scrollHeight), a3 == null ? void 0 : a3.focus(), document.activeElement !== s2)) return;
|
|
549
|
+
}, [R, O]), U = import_react.useCallback(() => H([N, w]), [
|
|
550
550
|
H,
|
|
551
|
-
|
|
552
|
-
|
|
551
|
+
N,
|
|
552
|
+
w
|
|
553
553
|
]);
|
|
554
554
|
import_react.useEffect(() => {
|
|
555
555
|
z && U();
|
|
556
556
|
}, [z, U]);
|
|
557
557
|
let { onOpenChange: W, triggerPointerDownPosRef: G } = C;
|
|
558
558
|
import_react.useEffect(() => {
|
|
559
|
-
if (
|
|
559
|
+
if (w) {
|
|
560
560
|
let e2 = {
|
|
561
561
|
x: 0,
|
|
562
562
|
y: 0
|
|
@@ -567,7 +567,7 @@ var CONTENT_MARGIN = 10, [SelectContentProvider, useSelectContentContext] = crea
|
|
|
567
567
|
y: Math.abs(Math.round(i3.pageY) - (((_b = G.current) == null ? void 0 : _b.y) ?? 0))
|
|
568
568
|
};
|
|
569
569
|
}, a2 = (a3) => {
|
|
570
|
-
e2.x <= 10 && e2.y <= 10 ? a3.preventDefault() :
|
|
570
|
+
e2.x <= 10 && e2.y <= 10 ? a3.preventDefault() : w.contains(a3.target) || W(false), document.removeEventListener("pointermove", i2), G.current = null;
|
|
571
571
|
};
|
|
572
572
|
return G.current !== null && (document.addEventListener("pointermove", i2), document.addEventListener("pointerup", a2, {
|
|
573
573
|
capture: true,
|
|
@@ -577,7 +577,7 @@ var CONTENT_MARGIN = 10, [SelectContentProvider, useSelectContentContext] = crea
|
|
|
577
577
|
};
|
|
578
578
|
}
|
|
579
579
|
}, [
|
|
580
|
-
|
|
580
|
+
w,
|
|
581
581
|
W,
|
|
582
582
|
G
|
|
583
583
|
]), import_react.useEffect(() => {
|
|
@@ -592,7 +592,7 @@ var CONTENT_MARGIN = 10, [SelectContentProvider, useSelectContentContext] = crea
|
|
|
592
592
|
}), J = import_react.useCallback((e2, i2, a2) => {
|
|
593
593
|
let o2 = !V.current && !a2;
|
|
594
594
|
(C.value !== void 0 && C.value === i2 || o2) && (F(e2), o2 && (V.current = true));
|
|
595
|
-
}, [C.value]), Y = import_react.useCallback(() =>
|
|
595
|
+
}, [C.value]), Y = import_react.useCallback(() => w == null ? void 0 : w.focus(), [w]), Z = import_react.useCallback((e2, i2, a2) => {
|
|
596
596
|
let o2 = !V.current && !a2;
|
|
597
597
|
(C.value !== void 0 && C.value === i2 || o2) && L(e2);
|
|
598
598
|
}, [C.value]), Q = o === "popper" ? SelectPopperPosition : SelectItemAlignedPosition, $ = Q === SelectPopperPosition ? {
|
|
@@ -609,11 +609,11 @@ var CONTENT_MARGIN = 10, [SelectContentProvider, useSelectContentContext] = crea
|
|
|
609
609
|
} : {};
|
|
610
610
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectContentProvider, {
|
|
611
611
|
scope: a,
|
|
612
|
-
content:
|
|
613
|
-
viewport:
|
|
614
|
-
onViewportChange:
|
|
612
|
+
content: w,
|
|
613
|
+
viewport: O,
|
|
614
|
+
onViewportChange: A,
|
|
615
615
|
itemRefCallback: J,
|
|
616
|
-
selectedItem:
|
|
616
|
+
selectedItem: N,
|
|
617
617
|
onItemLeave: Y,
|
|
618
618
|
itemTextRefCallback: Z,
|
|
619
619
|
focusSelectedItem: U,
|
|
@@ -650,7 +650,7 @@ var CONTENT_MARGIN = 10, [SelectContentProvider, useSelectContentContext] = crea
|
|
|
650
650
|
...S,
|
|
651
651
|
...$,
|
|
652
652
|
onPlaced: () => B(true),
|
|
653
|
-
ref:
|
|
653
|
+
ref: M,
|
|
654
654
|
style: {
|
|
655
655
|
display: "flex",
|
|
656
656
|
flexDirection: "column",
|
|
@@ -681,7 +681,7 @@ var CONTENT_MARGIN = 10, [SelectContentProvider, useSelectContentContext] = crea
|
|
|
681
681
|
});
|
|
682
682
|
SelectContentImpl.displayName = CONTENT_IMPL_NAME;
|
|
683
683
|
var ITEM_ALIGNED_POSITION_NAME = "SelectItemAlignedPosition", SelectItemAlignedPosition = import_react.forwardRef((e, i) => {
|
|
684
|
-
let { __scopeSelect: a, onPlaced: o, ...s } = e, c = useSelectContext(CONTENT_NAME, a), u = useSelectContentContext(CONTENT_NAME, a), [d, f] = import_react.useState(null), [p, m] = import_react.useState(null),
|
|
684
|
+
let { __scopeSelect: a, onPlaced: o, ...s } = e, c = useSelectContext(CONTENT_NAME, a), u = useSelectContentContext(CONTENT_NAME, a), [d, f] = import_react.useState(null), [p, m] = import_react.useState(null), _ = useComposedRefs(i, (e2) => m(e2)), v = useCollection(a), y = import_react.useRef(false), b = import_react.useRef(true), { viewport: x, selectedItem: S, selectedItemText: C, focusSelectedItem: w } = u, T = import_react.useCallback(() => {
|
|
685
685
|
if (c.trigger && c.valueNode && d && p && x && S && C) {
|
|
686
686
|
let e2 = c.trigger.getBoundingClientRect(), i2 = p.getBoundingClientRect(), a2 = c.valueNode.getBoundingClientRect(), s2 = C.getBoundingClientRect();
|
|
687
687
|
if (c.dir !== "rtl") {
|
|
@@ -691,16 +691,16 @@ var ITEM_ALIGNED_POSITION_NAME = "SelectItemAlignedPosition", SelectItemAlignedP
|
|
|
691
691
|
let o2 = i2.right - s2.right, c2 = window.innerWidth - a2.right - o2, l2 = window.innerWidth - e2.right - c2, u3 = e2.width + l2, f3 = Math.max(u3, i2.width), p2 = window.innerWidth - CONTENT_MARGIN, m3 = clamp(c2, [CONTENT_MARGIN, Math.max(CONTENT_MARGIN, p2 - f3)]);
|
|
692
692
|
d.style.minWidth = u3 + "px", d.style.right = m3 + "px";
|
|
693
693
|
}
|
|
694
|
-
let l = v(), u2 = window.innerHeight - CONTENT_MARGIN * 2, f2 = x.scrollHeight, m2 = window.getComputedStyle(p),
|
|
694
|
+
let l = v(), u2 = window.innerHeight - CONTENT_MARGIN * 2, f2 = x.scrollHeight, m2 = window.getComputedStyle(p), h = parseInt(m2.borderTopWidth, 10), g = parseInt(m2.paddingTop, 10), _2 = parseInt(m2.borderBottomWidth, 10), b2 = parseInt(m2.paddingBottom, 10), w2 = h + g + f2 + b2 + _2, T2 = Math.min(S.offsetHeight * 5, w2), E2 = window.getComputedStyle(x), D2 = parseInt(E2.paddingTop, 10), O = parseInt(E2.paddingBottom, 10), k = e2.top + e2.height / 2 - CONTENT_MARGIN, A = u2 - k, j = S.offsetHeight / 2, M = S.offsetTop + j, N = h + g + M, P = w2 - N;
|
|
695
695
|
if (N <= k) {
|
|
696
696
|
let e3 = l.length > 0 && S === l[l.length - 1].ref.current;
|
|
697
697
|
d.style.bottom = "0px";
|
|
698
|
-
let i3 = p.clientHeight - x.offsetTop - x.offsetHeight, a3 = N + Math.max(A, j + (e3 ? O : 0) + i3 +
|
|
698
|
+
let i3 = p.clientHeight - x.offsetTop - x.offsetHeight, a3 = N + Math.max(A, j + (e3 ? O : 0) + i3 + _2);
|
|
699
699
|
d.style.height = a3 + "px";
|
|
700
700
|
} else {
|
|
701
701
|
let e3 = l.length > 0 && S === l[0].ref.current;
|
|
702
702
|
d.style.top = "0px";
|
|
703
|
-
let i3 = Math.max(k,
|
|
703
|
+
let i3 = Math.max(k, h + x.offsetTop + (e3 ? D2 : 0) + j) + P;
|
|
704
704
|
d.style.height = i3 + "px", x.scrollTop = N - k + x.offsetTop;
|
|
705
705
|
}
|
|
706
706
|
d.style.margin = `${CONTENT_MARGIN}px 0`, d.style.minHeight = T2 + "px", d.style.maxHeight = u2 + "px", o == null ? void 0 : o(), requestAnimationFrame(() => y.current = true);
|
|
@@ -738,7 +738,7 @@ var ITEM_ALIGNED_POSITION_NAME = "SelectItemAlignedPosition", SelectItemAlignedP
|
|
|
738
738
|
},
|
|
739
739
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.div, {
|
|
740
740
|
...s,
|
|
741
|
-
ref:
|
|
741
|
+
ref: _,
|
|
742
742
|
style: {
|
|
743
743
|
boxSizing: "border-box",
|
|
744
744
|
maxHeight: "100%",
|
|
@@ -829,10 +829,10 @@ var LABEL_NAME = "SelectLabel", SelectLabel$1 = import_react.forwardRef((e, i) =
|
|
|
829
829
|
});
|
|
830
830
|
SelectLabel$1.displayName = LABEL_NAME;
|
|
831
831
|
var ITEM_NAME = "SelectItem", [SelectItemContextProvider, useSelectItemContext] = createSelectContext(ITEM_NAME), SelectItem$1 = import_react.forwardRef((e, i) => {
|
|
832
|
-
let { __scopeSelect: a, value: o, disabled: s = false, textValue: c, ...u } = e, d = useSelectContext(ITEM_NAME, a), f = useSelectContentContext(ITEM_NAME, a), p = d.value === o, [
|
|
832
|
+
let { __scopeSelect: a, value: o, disabled: s = false, textValue: c, ...u } = e, d = useSelectContext(ITEM_NAME, a), f = useSelectContentContext(ITEM_NAME, a), p = d.value === o, [h, v] = import_react.useState(c ?? ""), [y, b] = import_react.useState(false), x = useComposedRefs(i, (e2) => {
|
|
833
833
|
var _a;
|
|
834
834
|
return (_a = f.itemRefCallback) == null ? void 0 : _a.call(f, e2, o, s);
|
|
835
|
-
}),
|
|
835
|
+
}), S = useId(), C = import_react.useRef("touch"), w = () => {
|
|
836
836
|
s || (d.onValueChange(o), d.onOpenChange(false));
|
|
837
837
|
};
|
|
838
838
|
if (o === "") throw Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");
|
|
@@ -840,41 +840,41 @@ var ITEM_NAME = "SelectItem", [SelectItemContextProvider, useSelectItemContext]
|
|
|
840
840
|
scope: a,
|
|
841
841
|
value: o,
|
|
842
842
|
disabled: s,
|
|
843
|
-
textId:
|
|
843
|
+
textId: S,
|
|
844
844
|
isSelected: p,
|
|
845
845
|
onItemTextChange: import_react.useCallback((e2) => {
|
|
846
|
-
|
|
846
|
+
v((i2) => i2 || ((e2 == null ? void 0 : e2.textContent) ?? "").trim());
|
|
847
847
|
}, []),
|
|
848
848
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.ItemSlot, {
|
|
849
849
|
scope: a,
|
|
850
850
|
value: o,
|
|
851
851
|
disabled: s,
|
|
852
|
-
textValue:
|
|
852
|
+
textValue: h,
|
|
853
853
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.div, {
|
|
854
854
|
role: "option",
|
|
855
|
-
"aria-labelledby":
|
|
856
|
-
"data-highlighted":
|
|
857
|
-
"aria-selected": p &&
|
|
855
|
+
"aria-labelledby": S,
|
|
856
|
+
"data-highlighted": y ? "" : void 0,
|
|
857
|
+
"aria-selected": p && y,
|
|
858
858
|
"data-state": p ? "checked" : "unchecked",
|
|
859
859
|
"aria-disabled": s || void 0,
|
|
860
860
|
"data-disabled": s ? "" : void 0,
|
|
861
861
|
tabIndex: s ? void 0 : -1,
|
|
862
862
|
...u,
|
|
863
|
-
ref:
|
|
864
|
-
onFocus: composeEventHandlers(u.onFocus, () =>
|
|
865
|
-
onBlur: composeEventHandlers(u.onBlur, () =>
|
|
863
|
+
ref: x,
|
|
864
|
+
onFocus: composeEventHandlers(u.onFocus, () => b(true)),
|
|
865
|
+
onBlur: composeEventHandlers(u.onBlur, () => b(false)),
|
|
866
866
|
onClick: composeEventHandlers(u.onClick, () => {
|
|
867
|
-
|
|
867
|
+
C.current !== "mouse" && w();
|
|
868
868
|
}),
|
|
869
869
|
onPointerUp: composeEventHandlers(u.onPointerUp, () => {
|
|
870
|
-
|
|
870
|
+
C.current === "mouse" && w();
|
|
871
871
|
}),
|
|
872
872
|
onPointerDown: composeEventHandlers(u.onPointerDown, (e2) => {
|
|
873
|
-
|
|
873
|
+
C.current = e2.pointerType;
|
|
874
874
|
}),
|
|
875
875
|
onPointerMove: composeEventHandlers(u.onPointerMove, (e2) => {
|
|
876
876
|
var _a;
|
|
877
|
-
|
|
877
|
+
C.current = e2.pointerType, s ? (_a = f.onItemLeave) == null ? void 0 : _a.call(f) : C.current === "mouse" && e2.currentTarget.focus({ preventScroll: true });
|
|
878
878
|
}),
|
|
879
879
|
onPointerLeave: composeEventHandlers(u.onPointerLeave, (e2) => {
|
|
880
880
|
var _a;
|
|
@@ -882,7 +882,7 @@ var ITEM_NAME = "SelectItem", [SelectItemContextProvider, useSelectItemContext]
|
|
|
882
882
|
}),
|
|
883
883
|
onKeyDown: composeEventHandlers(u.onKeyDown, (e2) => {
|
|
884
884
|
var _a;
|
|
885
|
-
((_a = f.searchRef) == null ? void 0 : _a.current) !== "" && e2.key === " " || (SELECTION_KEYS.includes(e2.key) &&
|
|
885
|
+
((_a = f.searchRef) == null ? void 0 : _a.current) !== "" && e2.key === " " || (SELECTION_KEYS.includes(e2.key) && w(), e2.key === " " && e2.preventDefault());
|
|
886
886
|
})
|
|
887
887
|
})
|
|
888
888
|
})
|
|
@@ -890,7 +890,7 @@ var ITEM_NAME = "SelectItem", [SelectItemContextProvider, useSelectItemContext]
|
|
|
890
890
|
});
|
|
891
891
|
SelectItem$1.displayName = ITEM_NAME;
|
|
892
892
|
var ITEM_TEXT_NAME = "SelectItemText", SelectItemText = import_react.forwardRef((e, i) => {
|
|
893
|
-
let { __scopeSelect: a, className: o, style: s, ...c } = e, u = useSelectContext(ITEM_TEXT_NAME, a), d = useSelectContentContext(ITEM_TEXT_NAME, a), f = useSelectItemContext(ITEM_TEXT_NAME, a), p = useSelectNativeOptionsContext(ITEM_TEXT_NAME, a), [m,
|
|
893
|
+
let { __scopeSelect: a, className: o, style: s, ...c } = e, u = useSelectContext(ITEM_TEXT_NAME, a), d = useSelectContentContext(ITEM_TEXT_NAME, a), f = useSelectItemContext(ITEM_TEXT_NAME, a), p = useSelectNativeOptionsContext(ITEM_TEXT_NAME, a), [m, _] = import_react.useState(null), v = useComposedRefs(i, (e2) => _(e2), f.onItemTextChange, (e2) => {
|
|
894
894
|
var _a;
|
|
895
895
|
return (_a = d.itemTextRefCallback) == null ? void 0 : _a.call(d, e2, f.value, f.disabled);
|
|
896
896
|
}), y = m == null ? void 0 : m.textContent, b = import_react.useMemo(() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", {
|