@vantageos/mosaic-blocks 0.5.13-alpha → 0.5.18-alpha
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/README.md +7 -3
- package/dist/index.cjs +595 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +491 -2
- package/dist/index.d.ts +491 -2
- package/dist/index.js +578 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/registry.json +62 -1
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
3
3
|
import { Button } from '@base-ui/react/button';
|
|
4
4
|
import { cva } from 'class-variance-authority';
|
|
5
5
|
import * as React28 from 'react';
|
|
6
|
-
import { useState, useEffect, useRef, useId, useLayoutEffect, useCallback } from 'react';
|
|
6
|
+
import { useState, useEffect, useRef, useId, useLayoutEffect, useCallback, useMemo } from 'react';
|
|
7
7
|
import { Accordion } from '@base-ui/react/accordion';
|
|
8
8
|
export { Accordion } from '@base-ui/react/accordion';
|
|
9
9
|
import { Checkbox } from '@base-ui/react/checkbox';
|
|
@@ -27,7 +27,7 @@ import { Menu } from '@base-ui/react/menu';
|
|
|
27
27
|
import { AlertDialog } from '@base-ui/react/alert-dialog';
|
|
28
28
|
|
|
29
29
|
// src/version.ts
|
|
30
|
-
var version = "0.5.
|
|
30
|
+
var version = "0.5.18-alpha";
|
|
31
31
|
function Placeholder({ label = "mosaic-blocks placeholder" }) {
|
|
32
32
|
return /* @__PURE__ */ jsx("div", { "data-mosaic-block": "placeholder", children: label });
|
|
33
33
|
}
|
|
@@ -12837,7 +12837,582 @@ function MosaicAgentChat(props) {
|
|
|
12837
12837
|
] });
|
|
12838
12838
|
}
|
|
12839
12839
|
MosaicAgentChat.displayName = "MosaicAgentChat";
|
|
12840
|
+
var toastCardVariants = cva(
|
|
12841
|
+
["flex w-full items-start gap-3 rounded-lg border p-4 shadow-lg sm:max-w-sm"],
|
|
12842
|
+
{
|
|
12843
|
+
variants: {
|
|
12844
|
+
variant: {
|
|
12845
|
+
success: "border-border bg-card",
|
|
12846
|
+
error: "border-destructive/40 bg-destructive/5",
|
|
12847
|
+
info: "border-border bg-card",
|
|
12848
|
+
warning: "border-amber-500/40 bg-amber-500/5"
|
|
12849
|
+
}
|
|
12850
|
+
},
|
|
12851
|
+
defaultVariants: {
|
|
12852
|
+
variant: "info"
|
|
12853
|
+
}
|
|
12854
|
+
}
|
|
12855
|
+
);
|
|
12856
|
+
var toastTitleVariants = cva(["text-sm font-medium"], {
|
|
12857
|
+
variants: {
|
|
12858
|
+
variant: {
|
|
12859
|
+
success: "text-foreground",
|
|
12860
|
+
error: "text-destructive",
|
|
12861
|
+
info: "text-foreground",
|
|
12862
|
+
warning: "text-amber-600 dark:text-amber-400"
|
|
12863
|
+
}
|
|
12864
|
+
},
|
|
12865
|
+
defaultVariants: {
|
|
12866
|
+
variant: "info"
|
|
12867
|
+
}
|
|
12868
|
+
});
|
|
12869
|
+
var toastDismissButtonVariants = cva([
|
|
12870
|
+
"inline-flex size-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground"
|
|
12871
|
+
]);
|
|
12872
|
+
var toastProviderPositionVariants = cva(
|
|
12873
|
+
["pointer-events-none fixed z-50 flex flex-col gap-2 p-4"],
|
|
12874
|
+
{
|
|
12875
|
+
variants: {
|
|
12876
|
+
position: {
|
|
12877
|
+
"top-right": "top-0 right-0 items-end",
|
|
12878
|
+
"top-center": "top-0 left-1/2 -translate-x-1/2 items-center",
|
|
12879
|
+
"bottom-right": "bottom-0 right-0 items-end",
|
|
12880
|
+
"bottom-center": "bottom-0 left-1/2 -translate-x-1/2 items-center"
|
|
12881
|
+
}
|
|
12882
|
+
},
|
|
12883
|
+
defaultVariants: {
|
|
12884
|
+
position: "top-right"
|
|
12885
|
+
}
|
|
12886
|
+
}
|
|
12887
|
+
);
|
|
12888
|
+
function cn81(...classes) {
|
|
12889
|
+
return classes.filter(Boolean).join(" ");
|
|
12890
|
+
}
|
|
12891
|
+
function MosaicToast({
|
|
12892
|
+
variant,
|
|
12893
|
+
title,
|
|
12894
|
+
description,
|
|
12895
|
+
action,
|
|
12896
|
+
onDismiss,
|
|
12897
|
+
dismissAriaLabel,
|
|
12898
|
+
durationMs,
|
|
12899
|
+
className,
|
|
12900
|
+
ref
|
|
12901
|
+
}) {
|
|
12902
|
+
useEffect(() => {
|
|
12903
|
+
if (durationMs === void 0) return;
|
|
12904
|
+
const timer = setTimeout(onDismiss, durationMs);
|
|
12905
|
+
return () => clearTimeout(timer);
|
|
12906
|
+
}, [durationMs, onDismiss]);
|
|
12907
|
+
const role = variant === "error" ? "alert" : "status";
|
|
12908
|
+
return /* @__PURE__ */ jsxs(
|
|
12909
|
+
"div",
|
|
12910
|
+
{
|
|
12911
|
+
ref,
|
|
12912
|
+
"data-slot": "toast",
|
|
12913
|
+
role,
|
|
12914
|
+
className: cn81(toastCardVariants({ variant }), className),
|
|
12915
|
+
children: [
|
|
12916
|
+
/* @__PURE__ */ jsxs("div", { "data-slot": "toast-body", className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
12917
|
+
/* @__PURE__ */ jsx("p", { "data-slot": "toast-title", className: toastTitleVariants({ variant }), children: title }),
|
|
12918
|
+
description !== void 0 && /* @__PURE__ */ jsx("p", { "data-slot": "toast-description", className: "text-sm text-muted-foreground", children: description }),
|
|
12919
|
+
action !== void 0 && /* @__PURE__ */ jsx("div", { "data-slot": "toast-action", children: action })
|
|
12920
|
+
] }),
|
|
12921
|
+
/* @__PURE__ */ jsx(
|
|
12922
|
+
"button",
|
|
12923
|
+
{
|
|
12924
|
+
type: "button",
|
|
12925
|
+
"data-slot": "toast-dismiss-button",
|
|
12926
|
+
onClick: onDismiss,
|
|
12927
|
+
"aria-label": dismissAriaLabel,
|
|
12928
|
+
className: toastDismissButtonVariants(),
|
|
12929
|
+
children: /* @__PURE__ */ jsxs(
|
|
12930
|
+
"svg",
|
|
12931
|
+
{
|
|
12932
|
+
"aria-hidden": "true",
|
|
12933
|
+
viewBox: "0 0 24 24",
|
|
12934
|
+
width: "16",
|
|
12935
|
+
height: "16",
|
|
12936
|
+
fill: "none",
|
|
12937
|
+
stroke: "currentColor",
|
|
12938
|
+
strokeWidth: "2",
|
|
12939
|
+
strokeLinecap: "round",
|
|
12940
|
+
strokeLinejoin: "round",
|
|
12941
|
+
children: [
|
|
12942
|
+
/* @__PURE__ */ jsx("path", { d: "M18 6 6 18" }),
|
|
12943
|
+
/* @__PURE__ */ jsx("path", { d: "m6 6 12 12" })
|
|
12944
|
+
]
|
|
12945
|
+
}
|
|
12946
|
+
)
|
|
12947
|
+
}
|
|
12948
|
+
)
|
|
12949
|
+
]
|
|
12950
|
+
}
|
|
12951
|
+
);
|
|
12952
|
+
}
|
|
12953
|
+
MosaicToast.displayName = "MosaicToast";
|
|
12954
|
+
function cn82(...classes) {
|
|
12955
|
+
return classes.filter(Boolean).join(" ");
|
|
12956
|
+
}
|
|
12957
|
+
function MosaicToastProvider({
|
|
12958
|
+
children,
|
|
12959
|
+
position = "top-right",
|
|
12960
|
+
className,
|
|
12961
|
+
ref
|
|
12962
|
+
}) {
|
|
12963
|
+
return /* @__PURE__ */ jsx(
|
|
12964
|
+
"div",
|
|
12965
|
+
{
|
|
12966
|
+
ref,
|
|
12967
|
+
"data-slot": "toast-provider",
|
|
12968
|
+
className: cn82(toastProviderPositionVariants({ position }), className),
|
|
12969
|
+
children
|
|
12970
|
+
}
|
|
12971
|
+
);
|
|
12972
|
+
}
|
|
12973
|
+
MosaicToastProvider.displayName = "MosaicToastProvider";
|
|
12974
|
+
var pdfViewerFrameVariants = cva([
|
|
12975
|
+
"relative min-h-64 w-full flex-1 overflow-hidden rounded-lg border border-border bg-card"
|
|
12976
|
+
]);
|
|
12977
|
+
var pdfViewerStatusVariants = cva(
|
|
12978
|
+
["flex h-full w-full flex-col items-center justify-center gap-2 p-4 text-center text-sm"],
|
|
12979
|
+
{
|
|
12980
|
+
variants: {
|
|
12981
|
+
tone: {
|
|
12982
|
+
loading: "text-muted-foreground",
|
|
12983
|
+
error: "text-destructive"
|
|
12984
|
+
}
|
|
12985
|
+
},
|
|
12986
|
+
defaultVariants: {
|
|
12987
|
+
tone: "loading"
|
|
12988
|
+
}
|
|
12989
|
+
}
|
|
12990
|
+
);
|
|
12991
|
+
var pdfViewerToolbarButtonVariants = cva([
|
|
12992
|
+
"inline-flex min-h-8 min-w-8 items-center justify-center rounded-md border border-border text-sm",
|
|
12993
|
+
"transition-colors hover:bg-accent/50 disabled:opacity-50 disabled:hover:bg-transparent"
|
|
12994
|
+
]);
|
|
12995
|
+
function cn83(...classes) {
|
|
12996
|
+
return classes.filter(Boolean).join(" ");
|
|
12997
|
+
}
|
|
12998
|
+
function buildFrameSrc(fileUrl, currentPage, zoom) {
|
|
12999
|
+
const fragmentParts = [];
|
|
13000
|
+
if (currentPage !== void 0) fragmentParts.push(`page=${currentPage}`);
|
|
13001
|
+
if (zoom !== void 0) fragmentParts.push(`zoom=${Math.round(zoom * 100)}`);
|
|
13002
|
+
if (fragmentParts.length === 0) return fileUrl;
|
|
13003
|
+
const separator = fileUrl.includes("#") ? "&" : "#";
|
|
13004
|
+
return `${fileUrl}${separator}${fragmentParts.join("&")}`;
|
|
13005
|
+
}
|
|
13006
|
+
function MosaicPdfViewer({
|
|
13007
|
+
fileUrl,
|
|
13008
|
+
currentPage,
|
|
13009
|
+
onPageChange,
|
|
13010
|
+
totalPages,
|
|
13011
|
+
zoom,
|
|
13012
|
+
onZoomChange,
|
|
13013
|
+
loadingLabel,
|
|
13014
|
+
errorLabel,
|
|
13015
|
+
className,
|
|
13016
|
+
ref
|
|
13017
|
+
}) {
|
|
13018
|
+
const [status, setStatus] = useState("loading");
|
|
13019
|
+
const [trackedFileUrl, setTrackedFileUrl] = useState(fileUrl);
|
|
13020
|
+
const frameRef = useRef(null);
|
|
13021
|
+
if (fileUrl !== trackedFileUrl) {
|
|
13022
|
+
setTrackedFileUrl(fileUrl);
|
|
13023
|
+
setStatus("loading");
|
|
13024
|
+
}
|
|
13025
|
+
useEffect(() => {
|
|
13026
|
+
const node = frameRef.current;
|
|
13027
|
+
if (!node) return;
|
|
13028
|
+
function handleLoad() {
|
|
13029
|
+
setStatus("loaded");
|
|
13030
|
+
}
|
|
13031
|
+
function handleError() {
|
|
13032
|
+
setStatus("error");
|
|
13033
|
+
}
|
|
13034
|
+
node.addEventListener("load", handleLoad);
|
|
13035
|
+
node.addEventListener("error", handleError);
|
|
13036
|
+
return () => {
|
|
13037
|
+
node.removeEventListener("load", handleLoad);
|
|
13038
|
+
node.removeEventListener("error", handleError);
|
|
13039
|
+
};
|
|
13040
|
+
}, []);
|
|
13041
|
+
const showPageControls = currentPage !== void 0;
|
|
13042
|
+
const showZoomControls = zoom !== void 0;
|
|
13043
|
+
function handlePrevPage() {
|
|
13044
|
+
if (currentPage === void 0 || onPageChange === void 0 || currentPage <= 1) return;
|
|
13045
|
+
onPageChange(currentPage - 1);
|
|
13046
|
+
}
|
|
13047
|
+
function handleNextPage() {
|
|
13048
|
+
if (currentPage === void 0 || onPageChange === void 0) return;
|
|
13049
|
+
if (totalPages !== void 0 && currentPage >= totalPages) return;
|
|
13050
|
+
onPageChange(currentPage + 1);
|
|
13051
|
+
}
|
|
13052
|
+
function handleZoomOut() {
|
|
13053
|
+
if (zoom === void 0 || onZoomChange === void 0) return;
|
|
13054
|
+
onZoomChange(Math.round((zoom - 0.1) * 100) / 100);
|
|
13055
|
+
}
|
|
13056
|
+
function handleZoomIn() {
|
|
13057
|
+
if (zoom === void 0 || onZoomChange === void 0) return;
|
|
13058
|
+
onZoomChange(Math.round((zoom + 0.1) * 100) / 100);
|
|
13059
|
+
}
|
|
13060
|
+
return /* @__PURE__ */ jsxs("div", { ref, "data-slot": "pdf-viewer", className: cn83("flex flex-col gap-2", className), children: [
|
|
13061
|
+
(showPageControls || showZoomControls) && /* @__PURE__ */ jsxs(
|
|
13062
|
+
"div",
|
|
13063
|
+
{
|
|
13064
|
+
"data-slot": "pdf-viewer-toolbar",
|
|
13065
|
+
className: "flex items-center justify-between gap-2 text-sm",
|
|
13066
|
+
children: [
|
|
13067
|
+
showPageControls && /* @__PURE__ */ jsxs("div", { "data-slot": "pdf-viewer-page-controls", className: "flex items-center gap-2", children: [
|
|
13068
|
+
/* @__PURE__ */ jsx(
|
|
13069
|
+
"button",
|
|
13070
|
+
{
|
|
13071
|
+
type: "button",
|
|
13072
|
+
"data-slot": "pdf-viewer-prev-page-button",
|
|
13073
|
+
onClick: handlePrevPage,
|
|
13074
|
+
disabled: (currentPage ?? 1) <= 1,
|
|
13075
|
+
className: pdfViewerToolbarButtonVariants(),
|
|
13076
|
+
children: "\u2039"
|
|
13077
|
+
}
|
|
13078
|
+
),
|
|
13079
|
+
/* @__PURE__ */ jsxs("span", { "data-slot": "pdf-viewer-page-indicator", children: [
|
|
13080
|
+
currentPage,
|
|
13081
|
+
totalPages !== void 0 ? ` / ${totalPages}` : ""
|
|
13082
|
+
] }),
|
|
13083
|
+
/* @__PURE__ */ jsx(
|
|
13084
|
+
"button",
|
|
13085
|
+
{
|
|
13086
|
+
type: "button",
|
|
13087
|
+
"data-slot": "pdf-viewer-next-page-button",
|
|
13088
|
+
onClick: handleNextPage,
|
|
13089
|
+
disabled: totalPages !== void 0 && (currentPage ?? 0) >= totalPages,
|
|
13090
|
+
className: pdfViewerToolbarButtonVariants(),
|
|
13091
|
+
children: "\u203A"
|
|
13092
|
+
}
|
|
13093
|
+
)
|
|
13094
|
+
] }),
|
|
13095
|
+
showZoomControls && /* @__PURE__ */ jsxs("div", { "data-slot": "pdf-viewer-zoom-controls", className: "flex items-center gap-2", children: [
|
|
13096
|
+
/* @__PURE__ */ jsx(
|
|
13097
|
+
"button",
|
|
13098
|
+
{
|
|
13099
|
+
type: "button",
|
|
13100
|
+
"data-slot": "pdf-viewer-zoom-out-button",
|
|
13101
|
+
onClick: handleZoomOut,
|
|
13102
|
+
className: pdfViewerToolbarButtonVariants(),
|
|
13103
|
+
children: "\u2212"
|
|
13104
|
+
}
|
|
13105
|
+
),
|
|
13106
|
+
/* @__PURE__ */ jsxs("span", { "data-slot": "pdf-viewer-zoom-indicator", children: [
|
|
13107
|
+
Math.round((zoom ?? 1) * 100),
|
|
13108
|
+
"%"
|
|
13109
|
+
] }),
|
|
13110
|
+
/* @__PURE__ */ jsx(
|
|
13111
|
+
"button",
|
|
13112
|
+
{
|
|
13113
|
+
type: "button",
|
|
13114
|
+
"data-slot": "pdf-viewer-zoom-in-button",
|
|
13115
|
+
onClick: handleZoomIn,
|
|
13116
|
+
className: pdfViewerToolbarButtonVariants(),
|
|
13117
|
+
children: "+"
|
|
13118
|
+
}
|
|
13119
|
+
)
|
|
13120
|
+
] })
|
|
13121
|
+
]
|
|
13122
|
+
}
|
|
13123
|
+
),
|
|
13124
|
+
/* @__PURE__ */ jsxs("div", { "data-slot": "pdf-viewer-frame-container", className: pdfViewerFrameVariants(), children: [
|
|
13125
|
+
status === "loading" && /* @__PURE__ */ jsx(
|
|
13126
|
+
"output",
|
|
13127
|
+
{
|
|
13128
|
+
"data-slot": "pdf-viewer-loading",
|
|
13129
|
+
className: pdfViewerStatusVariants({ tone: "loading" }),
|
|
13130
|
+
children: loadingLabel
|
|
13131
|
+
}
|
|
13132
|
+
),
|
|
13133
|
+
status === "error" && /* @__PURE__ */ jsx(
|
|
13134
|
+
"div",
|
|
13135
|
+
{
|
|
13136
|
+
"data-slot": "pdf-viewer-error",
|
|
13137
|
+
role: "alert",
|
|
13138
|
+
className: pdfViewerStatusVariants({ tone: "error" }),
|
|
13139
|
+
children: errorLabel
|
|
13140
|
+
}
|
|
13141
|
+
),
|
|
13142
|
+
/* @__PURE__ */ jsx(
|
|
13143
|
+
"iframe",
|
|
13144
|
+
{
|
|
13145
|
+
ref: frameRef,
|
|
13146
|
+
"data-slot": "pdf-viewer-frame",
|
|
13147
|
+
src: buildFrameSrc(fileUrl, currentPage, zoom),
|
|
13148
|
+
title: fileUrl,
|
|
13149
|
+
className: cn83(
|
|
13150
|
+
"h-full min-h-64 w-full border-0",
|
|
13151
|
+
status !== "loaded" && "pointer-events-none absolute inset-0 opacity-0"
|
|
13152
|
+
)
|
|
13153
|
+
}
|
|
13154
|
+
)
|
|
13155
|
+
] })
|
|
13156
|
+
] });
|
|
13157
|
+
}
|
|
13158
|
+
MosaicPdfViewer.displayName = "MosaicPdfViewer";
|
|
13159
|
+
var splitPaneRootVariants = cva(["flex h-full w-full min-h-0"]);
|
|
13160
|
+
var splitPaneHandleVariants = cva([
|
|
13161
|
+
"relative w-1 shrink-0 cursor-col-resize touch-none select-none bg-border",
|
|
13162
|
+
"transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
13163
|
+
]);
|
|
13164
|
+
var splitPaneCollapseButtonVariants = cva([
|
|
13165
|
+
"inline-flex h-11 w-6 shrink-0 items-center justify-center self-center rounded-md border border-border text-sm",
|
|
13166
|
+
"transition-colors hover:bg-accent/50"
|
|
13167
|
+
]);
|
|
13168
|
+
function cn84(...classes) {
|
|
13169
|
+
return classes.filter(Boolean).join(" ");
|
|
13170
|
+
}
|
|
13171
|
+
function mergeRefs(externalRef, node) {
|
|
13172
|
+
if (typeof externalRef === "function") {
|
|
13173
|
+
externalRef(node);
|
|
13174
|
+
} else if (externalRef && typeof externalRef === "object") {
|
|
13175
|
+
externalRef.current = node;
|
|
13176
|
+
}
|
|
13177
|
+
}
|
|
13178
|
+
var DEFAULT_SIDE_WIDTH = 30;
|
|
13179
|
+
var MIN_SIDE_WIDTH = 15;
|
|
13180
|
+
var MAX_SIDE_WIDTH = 70;
|
|
13181
|
+
var KEYBOARD_STEP = 5;
|
|
13182
|
+
function clampSideWidth(width) {
|
|
13183
|
+
return Math.min(MAX_SIDE_WIDTH, Math.max(MIN_SIDE_WIDTH, width));
|
|
13184
|
+
}
|
|
13185
|
+
function MosaicResizableSplitPane({
|
|
13186
|
+
main,
|
|
13187
|
+
side,
|
|
13188
|
+
sideWidth = DEFAULT_SIDE_WIDTH,
|
|
13189
|
+
onSideWidthChange,
|
|
13190
|
+
isSideCollapsed = false,
|
|
13191
|
+
onToggleSideCollapsed,
|
|
13192
|
+
collapseButtonAriaLabel,
|
|
13193
|
+
resizeHandleAriaLabel,
|
|
13194
|
+
className,
|
|
13195
|
+
ref
|
|
13196
|
+
}) {
|
|
13197
|
+
const rootRef = useRef(null);
|
|
13198
|
+
const isDraggingRef = useRef(false);
|
|
13199
|
+
useEffect(() => {
|
|
13200
|
+
function handlePointerMove(event) {
|
|
13201
|
+
if (!isDraggingRef.current) return;
|
|
13202
|
+
const rootNode = rootRef.current;
|
|
13203
|
+
if (!rootNode || onSideWidthChange === void 0) return;
|
|
13204
|
+
const rect = rootNode.getBoundingClientRect();
|
|
13205
|
+
if (rect.width === 0) return;
|
|
13206
|
+
const distanceFromRight = rect.right - event.clientX;
|
|
13207
|
+
const rawWidth = distanceFromRight / rect.width * 100;
|
|
13208
|
+
onSideWidthChange(clampSideWidth(rawWidth));
|
|
13209
|
+
}
|
|
13210
|
+
function handlePointerUp() {
|
|
13211
|
+
isDraggingRef.current = false;
|
|
13212
|
+
}
|
|
13213
|
+
window.addEventListener("pointermove", handlePointerMove);
|
|
13214
|
+
window.addEventListener("pointerup", handlePointerUp);
|
|
13215
|
+
return () => {
|
|
13216
|
+
window.removeEventListener("pointermove", handlePointerMove);
|
|
13217
|
+
window.removeEventListener("pointerup", handlePointerUp);
|
|
13218
|
+
};
|
|
13219
|
+
}, [onSideWidthChange]);
|
|
13220
|
+
function handleHandlePointerDown() {
|
|
13221
|
+
isDraggingRef.current = true;
|
|
13222
|
+
}
|
|
13223
|
+
function handleHandleKeyDown(event) {
|
|
13224
|
+
if (onSideWidthChange === void 0) return;
|
|
13225
|
+
if (event.key === "ArrowLeft") {
|
|
13226
|
+
event.preventDefault();
|
|
13227
|
+
onSideWidthChange(clampSideWidth(sideWidth - KEYBOARD_STEP));
|
|
13228
|
+
} else if (event.key === "ArrowRight") {
|
|
13229
|
+
event.preventDefault();
|
|
13230
|
+
onSideWidthChange(clampSideWidth(sideWidth + KEYBOARD_STEP));
|
|
13231
|
+
}
|
|
13232
|
+
}
|
|
13233
|
+
return /* @__PURE__ */ jsxs(
|
|
13234
|
+
"div",
|
|
13235
|
+
{
|
|
13236
|
+
ref: (node) => {
|
|
13237
|
+
rootRef.current = node;
|
|
13238
|
+
mergeRefs(ref, node);
|
|
13239
|
+
},
|
|
13240
|
+
"data-slot": "resizable-split-pane",
|
|
13241
|
+
className: cn84(splitPaneRootVariants(), className),
|
|
13242
|
+
children: [
|
|
13243
|
+
/* @__PURE__ */ jsx("div", { "data-slot": "resizable-split-pane-main", className: "min-h-0 min-w-0 flex-1 overflow-auto", children: main }),
|
|
13244
|
+
!isSideCollapsed && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13245
|
+
/* @__PURE__ */ jsx(
|
|
13246
|
+
"div",
|
|
13247
|
+
{
|
|
13248
|
+
role: "separator",
|
|
13249
|
+
"aria-orientation": "vertical",
|
|
13250
|
+
"aria-valuenow": Math.round(sideWidth),
|
|
13251
|
+
"aria-valuemin": MIN_SIDE_WIDTH,
|
|
13252
|
+
"aria-valuemax": MAX_SIDE_WIDTH,
|
|
13253
|
+
"aria-label": resizeHandleAriaLabel,
|
|
13254
|
+
tabIndex: 0,
|
|
13255
|
+
"data-slot": "resizable-split-pane-handle",
|
|
13256
|
+
onPointerDown: handleHandlePointerDown,
|
|
13257
|
+
onKeyDown: handleHandleKeyDown,
|
|
13258
|
+
className: splitPaneHandleVariants()
|
|
13259
|
+
}
|
|
13260
|
+
),
|
|
13261
|
+
/* @__PURE__ */ jsx(
|
|
13262
|
+
"div",
|
|
13263
|
+
{
|
|
13264
|
+
"data-slot": "resizable-split-pane-side",
|
|
13265
|
+
style: { width: `${sideWidth}%` },
|
|
13266
|
+
className: "min-h-0 shrink-0 overflow-auto",
|
|
13267
|
+
children: side
|
|
13268
|
+
}
|
|
13269
|
+
)
|
|
13270
|
+
] }),
|
|
13271
|
+
/* @__PURE__ */ jsx(
|
|
13272
|
+
"button",
|
|
13273
|
+
{
|
|
13274
|
+
type: "button",
|
|
13275
|
+
"data-slot": "resizable-split-pane-collapse-button",
|
|
13276
|
+
"aria-label": collapseButtonAriaLabel,
|
|
13277
|
+
"aria-expanded": !isSideCollapsed,
|
|
13278
|
+
onClick: onToggleSideCollapsed,
|
|
13279
|
+
className: splitPaneCollapseButtonVariants(),
|
|
13280
|
+
children: isSideCollapsed ? "\u2039" : "\u203A"
|
|
13281
|
+
}
|
|
13282
|
+
)
|
|
13283
|
+
]
|
|
13284
|
+
}
|
|
13285
|
+
);
|
|
13286
|
+
}
|
|
13287
|
+
MosaicResizableSplitPane.displayName = "MosaicResizableSplitPane";
|
|
13288
|
+
var tagInputRootVariants = cva([
|
|
13289
|
+
"flex w-full flex-wrap items-center gap-1.5 rounded-md border border-border",
|
|
13290
|
+
"bg-background px-2 py-1.5 text-sm shadow-xs",
|
|
13291
|
+
"focus-within:ring-ring focus-within:ring-[3px]",
|
|
13292
|
+
"has-[input[aria-disabled='true']]:cursor-not-allowed has-[input[aria-disabled='true']]:opacity-50"
|
|
13293
|
+
]);
|
|
13294
|
+
var tagInputTagVariants = cva([
|
|
13295
|
+
"inline-flex items-center gap-1 rounded-md bg-accent px-2 py-0.5",
|
|
13296
|
+
"text-sm text-accent-foreground"
|
|
13297
|
+
]);
|
|
13298
|
+
var tagInputRemoveButtonVariants = cva([
|
|
13299
|
+
"inline-flex size-4 shrink-0 items-center justify-center rounded-sm",
|
|
13300
|
+
"text-accent-foreground/70 outline-none transition-colors",
|
|
13301
|
+
"hover:bg-accent-foreground/10 hover:text-accent-foreground",
|
|
13302
|
+
"focus-visible:ring-ring focus-visible:ring-[2px]"
|
|
13303
|
+
]);
|
|
13304
|
+
var tagInputFieldVariants = cva([
|
|
13305
|
+
"min-w-[6ch] flex-1 border-none bg-transparent px-1 py-0.5 text-sm text-foreground outline-none",
|
|
13306
|
+
"placeholder:text-muted-foreground"
|
|
13307
|
+
]);
|
|
13308
|
+
function cn85(...classes) {
|
|
13309
|
+
return classes.filter(Boolean).join(" ");
|
|
13310
|
+
}
|
|
13311
|
+
function mergeRefs2(externalRef, node) {
|
|
13312
|
+
if (typeof externalRef === "function") {
|
|
13313
|
+
externalRef(node);
|
|
13314
|
+
} else if (externalRef && typeof externalRef === "object") {
|
|
13315
|
+
externalRef.current = node;
|
|
13316
|
+
}
|
|
13317
|
+
}
|
|
13318
|
+
function MosaicTagInput({
|
|
13319
|
+
tags,
|
|
13320
|
+
onAddTag,
|
|
13321
|
+
onRemoveTag,
|
|
13322
|
+
placeholder,
|
|
13323
|
+
removeTagAriaLabel,
|
|
13324
|
+
suggestions,
|
|
13325
|
+
maxTags,
|
|
13326
|
+
className,
|
|
13327
|
+
ref
|
|
13328
|
+
}) {
|
|
13329
|
+
const [inputValue, setInputValue] = useState("");
|
|
13330
|
+
const inputRef = useRef(null);
|
|
13331
|
+
const filter = Combobox.useFilter({ sensitivity: "base" });
|
|
13332
|
+
const isMaxReached = maxTags !== void 0 && tags.length >= maxTags;
|
|
13333
|
+
const trimmedValue = inputValue.trim();
|
|
13334
|
+
const filteredSuggestions = useMemo(() => {
|
|
13335
|
+
if (!suggestions || trimmedValue.length === 0) return [];
|
|
13336
|
+
return suggestions.filter(
|
|
13337
|
+
(suggestion) => !tags.includes(suggestion) && filter.contains(suggestion, trimmedValue)
|
|
13338
|
+
);
|
|
13339
|
+
}, [suggestions, tags, trimmedValue, filter]);
|
|
13340
|
+
function commitTag(rawValue) {
|
|
13341
|
+
if (isMaxReached) return;
|
|
13342
|
+
const trimmed = rawValue.trim();
|
|
13343
|
+
if (trimmed.length === 0) return;
|
|
13344
|
+
if (tags.includes(trimmed)) return;
|
|
13345
|
+
onAddTag(trimmed);
|
|
13346
|
+
setInputValue("");
|
|
13347
|
+
}
|
|
13348
|
+
function handleKeyDown(event) {
|
|
13349
|
+
if (event.key === "Enter") {
|
|
13350
|
+
event.preventDefault();
|
|
13351
|
+
commitTag(inputValue);
|
|
13352
|
+
return;
|
|
13353
|
+
}
|
|
13354
|
+
if (event.key === "Backspace" && inputValue.length === 0 && tags.length > 0) {
|
|
13355
|
+
const lastTag = tags[tags.length - 1];
|
|
13356
|
+
if (lastTag !== void 0) onRemoveTag(lastTag);
|
|
13357
|
+
}
|
|
13358
|
+
}
|
|
13359
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "tag-input", className: cn85(tagInputRootVariants(), className), children: [
|
|
13360
|
+
tags.map((tag) => /* @__PURE__ */ jsxs("span", { "data-slot": "tag-input-tag", className: tagInputTagVariants(), children: [
|
|
13361
|
+
tag,
|
|
13362
|
+
/* @__PURE__ */ jsx(
|
|
13363
|
+
"button",
|
|
13364
|
+
{
|
|
13365
|
+
type: "button",
|
|
13366
|
+
"aria-label": removeTagAriaLabel(tag),
|
|
13367
|
+
"data-slot": "tag-input-remove-button",
|
|
13368
|
+
className: tagInputRemoveButtonVariants(),
|
|
13369
|
+
onClick: () => onRemoveTag(tag),
|
|
13370
|
+
children: "\xD7"
|
|
13371
|
+
}
|
|
13372
|
+
)
|
|
13373
|
+
] }, tag)),
|
|
13374
|
+
/* @__PURE__ */ jsx(
|
|
13375
|
+
"input",
|
|
13376
|
+
{
|
|
13377
|
+
ref: (node) => {
|
|
13378
|
+
inputRef.current = node;
|
|
13379
|
+
mergeRefs2(ref, node);
|
|
13380
|
+
},
|
|
13381
|
+
type: "text",
|
|
13382
|
+
value: inputValue,
|
|
13383
|
+
placeholder,
|
|
13384
|
+
onChange: (event) => setInputValue(event.target.value),
|
|
13385
|
+
onKeyDown: handleKeyDown,
|
|
13386
|
+
"aria-disabled": isMaxReached ? true : void 0,
|
|
13387
|
+
"data-max-reached": isMaxReached ? true : void 0,
|
|
13388
|
+
"data-slot": "tag-input-field",
|
|
13389
|
+
className: tagInputFieldVariants()
|
|
13390
|
+
}
|
|
13391
|
+
),
|
|
13392
|
+
filteredSuggestions.length > 0 && /* @__PURE__ */ jsx(
|
|
13393
|
+
"ul",
|
|
13394
|
+
{
|
|
13395
|
+
"data-slot": "tag-input-suggestions",
|
|
13396
|
+
className: cn85(
|
|
13397
|
+
"z-50 mt-1 w-full min-w-[8rem] overflow-hidden rounded-md border border-border",
|
|
13398
|
+
"bg-popover p-1 text-sm text-popover-foreground shadow-md"
|
|
13399
|
+
),
|
|
13400
|
+
children: filteredSuggestions.map((suggestion) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
|
|
13401
|
+
"button",
|
|
13402
|
+
{
|
|
13403
|
+
type: "button",
|
|
13404
|
+
"data-slot": "tag-input-suggestion",
|
|
13405
|
+
className: "w-full cursor-pointer select-none rounded-sm px-2 py-1.5 text-left outline-none hover:bg-accent hover:text-accent-foreground focus-visible:ring-ring focus-visible:ring-[2px]",
|
|
13406
|
+
onClick: () => commitTag(suggestion),
|
|
13407
|
+
children: suggestion
|
|
13408
|
+
}
|
|
13409
|
+
) }, suggestion))
|
|
13410
|
+
}
|
|
13411
|
+
)
|
|
13412
|
+
] });
|
|
13413
|
+
}
|
|
13414
|
+
MosaicTagInput.displayName = "MosaicTagInput";
|
|
12840
13415
|
|
|
12841
|
-
export { MosaicAccordion, MosaicAccordionItem, MosaicAccordionPanel, MosaicAccordionTrigger, MosaicActivityFeed, MosaicActivityItem, MosaicAdaptiveGrid, MosaicAdaptiveModal, MosaicAdaptiveNavigation, MosaicAgentCard, MosaicAgentChat, MosaicAgentComposer, MosaicAgentComposerDesktop, MosaicAgentComposerMobile, MosaicAgentList, AgentListDesktop as MosaicAgentListDesktop, AgentListMobile as MosaicAgentListMobile, MosaicAgentTeamPreview, MosaicAnimatedList, MosaicApiKeyPanel, MosaicAppSidebar, MosaicApprovalPrompt, MosaicAvatar, MosaicBadge, MosaicBlurredOrb, MosaicButton, MosaicCard, MosaicCardContent, MosaicCardDescription, MosaicCardFooter, MosaicCardHeader, MosaicCardTitle, MosaicChatComposer, MosaicChatMessage, MosaicChatThread, MosaicCheckbox, MosaicClerkOrgSwitcher, MosaicClerkWebhookHandler, MosaicCollapsible, MosaicCollapsiblePanel, MosaicCollapsibleTrigger, MosaicCombobox, MosaicCounter, MosaicCreateOrgDialog, MosaicDashboardContent, MosaicDashboardHeader, MosaicDashboardLayout, MosaicDataTable, MosaicDeleteConfirmationDialog, MosaicDeviceProvider, MosaicDocumentUpload, MosaicDropdownMenu, MosaicEmptyState, MosaicFallingPattern, MosaicFeature3Col, MosaicFeatureCenteredMedia, MosaicField, MosaicFieldControl, MosaicFieldDescription, MosaicFieldError, MosaicFieldLabel, MosaicFilterBar, MosaicFilterSidebar, MosaicFooterSimple, MosaicHeroSplit, MosaicInput, MosaicInputGroup, MosaicIntegrationsBadge, MosaicInviteMemberDialog, MosaicKanbanBoard, MosaicKanbanColumn, MosaicLogosGrid, MosaicMainNav, MosaicMarkdown, MosaicMarketplaceList, MarketplaceListDesktop as MosaicMarketplaceListDesktop, MarketplaceListMobile as MosaicMarketplaceListMobile, MosaicMemberList, MosaicMemoryCard, MosaicMessageCard, MosaicMessageList, MessageListDesktop as MosaicMessageListDesktop, MessageListMobile as MosaicMessageListMobile, MosaicModuleCard, MosaicModuleForm, MosaicModuleLibrary, MosaicMultiOrgIndicator, MosaicMultiTenantProvider, MosaicNavbar, MosaicOrgPanel, MosaicOrgProfilePage, MosaicOrgRoleBadge, MosaicOrgSwitcher, MosaicPreferencesPanel, MosaicPricingCard, MosaicProfilePanel, MosaicProgress, MosaicQuickActionCard, MosaicQuickActionsMenu, MosaicQuickAgentSelector, MosaicQuickStartPanel, MosaicRadioGroup, MosaicRadioGroupItem, MosaicScrollArea, MosaicSelect, MosaicSelectorModal, MosaicSeparator, MosaicSignInLayout, MosaicSignUpLayout, MosaicSkeleton, MosaicSlider, MosaicStatsGrid, MosaicStepPipeline, MosaicSwitch, MosaicTabs, MosaicTabsList, MosaicTabsPanel, MosaicTabsTrigger, MosaicTemplateCard, MosaicTemplateGallery, MosaicTemplatePreview, MosaicTestimonialsGrid, MosaicTextarea, MosaicThemeProvider, MosaicThemeToggle, MosaicToolToggleList, MosaicTooltip, MosaicTooltipContent, MosaicTooltipProvider, MosaicTooltipRoot, MosaicTooltipTrigger, MosaicUrlScraper, MosaicUserButton, Placeholder, agentChatRootVariants, badgeVariants, buttonVariants, chatMessageBubbleVariants, chatMessageContainerVariants, chatMessageToolStatusVariants, skeletonVariants, toolToggleListRowVariants, toolToggleListSectionVariants, useBreakpoint, useDevice, useMosaicWorkspace as useEffectiveWorkspaceId, useIsDesktop, useIsMobile, useIsTablet, useMediaQuery, useMosaicWorkspace, useOrientation, useViewport, version };
|
|
13416
|
+
export { MosaicAccordion, MosaicAccordionItem, MosaicAccordionPanel, MosaicAccordionTrigger, MosaicActivityFeed, MosaicActivityItem, MosaicAdaptiveGrid, MosaicAdaptiveModal, MosaicAdaptiveNavigation, MosaicAgentCard, MosaicAgentChat, MosaicAgentComposer, MosaicAgentComposerDesktop, MosaicAgentComposerMobile, MosaicAgentList, AgentListDesktop as MosaicAgentListDesktop, AgentListMobile as MosaicAgentListMobile, MosaicAgentTeamPreview, MosaicAnimatedList, MosaicApiKeyPanel, MosaicAppSidebar, MosaicApprovalPrompt, MosaicAvatar, MosaicBadge, MosaicBlurredOrb, MosaicButton, MosaicCard, MosaicCardContent, MosaicCardDescription, MosaicCardFooter, MosaicCardHeader, MosaicCardTitle, MosaicChatComposer, MosaicChatMessage, MosaicChatThread, MosaicCheckbox, MosaicClerkOrgSwitcher, MosaicClerkWebhookHandler, MosaicCollapsible, MosaicCollapsiblePanel, MosaicCollapsibleTrigger, MosaicCombobox, MosaicCounter, MosaicCreateOrgDialog, MosaicDashboardContent, MosaicDashboardHeader, MosaicDashboardLayout, MosaicDataTable, MosaicDeleteConfirmationDialog, MosaicDeviceProvider, MosaicDocumentUpload, MosaicDropdownMenu, MosaicEmptyState, MosaicFallingPattern, MosaicFeature3Col, MosaicFeatureCenteredMedia, MosaicField, MosaicFieldControl, MosaicFieldDescription, MosaicFieldError, MosaicFieldLabel, MosaicFilterBar, MosaicFilterSidebar, MosaicFooterSimple, MosaicHeroSplit, MosaicInput, MosaicInputGroup, MosaicIntegrationsBadge, MosaicInviteMemberDialog, MosaicKanbanBoard, MosaicKanbanColumn, MosaicLogosGrid, MosaicMainNav, MosaicMarkdown, MosaicMarketplaceList, MarketplaceListDesktop as MosaicMarketplaceListDesktop, MarketplaceListMobile as MosaicMarketplaceListMobile, MosaicMemberList, MosaicMemoryCard, MosaicMessageCard, MosaicMessageList, MessageListDesktop as MosaicMessageListDesktop, MessageListMobile as MosaicMessageListMobile, MosaicModuleCard, MosaicModuleForm, MosaicModuleLibrary, MosaicMultiOrgIndicator, MosaicMultiTenantProvider, MosaicNavbar, MosaicOrgPanel, MosaicOrgProfilePage, MosaicOrgRoleBadge, MosaicOrgSwitcher, MosaicPdfViewer, MosaicPreferencesPanel, MosaicPricingCard, MosaicProfilePanel, MosaicProgress, MosaicQuickActionCard, MosaicQuickActionsMenu, MosaicQuickAgentSelector, MosaicQuickStartPanel, MosaicRadioGroup, MosaicRadioGroupItem, MosaicResizableSplitPane, MosaicScrollArea, MosaicSelect, MosaicSelectorModal, MosaicSeparator, MosaicSignInLayout, MosaicSignUpLayout, MosaicSkeleton, MosaicSlider, MosaicStatsGrid, MosaicStepPipeline, MosaicSwitch, MosaicTabs, MosaicTabsList, MosaicTabsPanel, MosaicTabsTrigger, MosaicTagInput, MosaicTemplateCard, MosaicTemplateGallery, MosaicTemplatePreview, MosaicTestimonialsGrid, MosaicTextarea, MosaicThemeProvider, MosaicThemeToggle, MosaicToast, MosaicToastProvider, MosaicToolToggleList, MosaicTooltip, MosaicTooltipContent, MosaicTooltipProvider, MosaicTooltipRoot, MosaicTooltipTrigger, MosaicUrlScraper, MosaicUserButton, Placeholder, agentChatRootVariants, badgeVariants, buttonVariants, chatMessageBubbleVariants, chatMessageContainerVariants, chatMessageToolStatusVariants, pdfViewerFrameVariants, pdfViewerStatusVariants, pdfViewerToolbarButtonVariants, skeletonVariants, splitPaneCollapseButtonVariants, splitPaneHandleVariants, splitPaneRootVariants, tagInputFieldVariants, tagInputRemoveButtonVariants, tagInputRootVariants, tagInputTagVariants, toastCardVariants, toastDismissButtonVariants, toastProviderPositionVariants, toastTitleVariants, toolToggleListRowVariants, toolToggleListSectionVariants, useBreakpoint, useDevice, useMosaicWorkspace as useEffectiveWorkspaceId, useIsDesktop, useIsMobile, useIsTablet, useMediaQuery, useMosaicWorkspace, useOrientation, useViewport, version };
|
|
12842
13417
|
//# sourceMappingURL=index.js.map
|
|
12843
13418
|
//# sourceMappingURL=index.js.map
|