@vantageos/mosaic-blocks 0.5.14-alpha → 0.5.19-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/dist/index.cjs CHANGED
@@ -46,7 +46,7 @@ function _interopNamespace(e) {
46
46
  var React28__namespace = /*#__PURE__*/_interopNamespace(React28);
47
47
 
48
48
  // src/version.ts
49
- var version = "0.5.14-alpha";
49
+ var version = "0.5.19-alpha";
50
50
  function Placeholder({ label = "mosaic-blocks placeholder" }) {
51
51
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-mosaic-block": "placeholder", children: label });
52
52
  }
@@ -11483,7 +11483,8 @@ var chatThreadRootVariants = classVarianceAuthority.cva([
11483
11483
  "relative flex min-h-0 flex-1 flex-col overflow-y-auto"
11484
11484
  ]);
11485
11485
  var chatThreadContentVariants = classVarianceAuthority.cva([
11486
- "mx-auto flex w-full max-w-2xl flex-col gap-4 px-4 py-6 sm:px-6"
11486
+ "mx-auto flex w-full max-w-2xl flex-col gap-4 px-4 py-6 sm:px-6",
11487
+ "[&>*]:[content-visibility:auto] [&>*]:[contain-intrinsic-size:auto_4rem]"
11487
11488
  ]);
11488
11489
  var chatThreadScrollButtonVariants = classVarianceAuthority.cva([
11489
11490
  "absolute bottom-4 left-1/2 -translate-x-1/2 inline-flex size-9",
@@ -11497,6 +11498,7 @@ var BOTTOM_THRESHOLD_PX = 24;
11497
11498
  function isNearBottom(element) {
11498
11499
  return element.scrollHeight - element.scrollTop - element.clientHeight <= BOTTOM_THRESHOLD_PX;
11499
11500
  }
11501
+ var NAVIGATION_KEYS = /* @__PURE__ */ new Set(["ArrowUp", "ArrowDown", "PageUp", "PageDown", "Home", "End"]);
11500
11502
  function MosaicChatThread({
11501
11503
  children,
11502
11504
  scrollToBottomLabel,
@@ -11528,6 +11530,37 @@ function MosaicChatThread({
11528
11530
  isAtBottomRef.current = true;
11529
11531
  setIsAtBottom(true);
11530
11532
  }
11533
+ function disengageBottomAnchor() {
11534
+ isAtBottomRef.current = false;
11535
+ setIsAtBottom(false);
11536
+ }
11537
+ function handleKeyDown(event) {
11538
+ if (NAVIGATION_KEYS.has(event.key)) {
11539
+ disengageBottomAnchor();
11540
+ }
11541
+ }
11542
+ React28.useEffect(() => {
11543
+ function handleSelectionChange() {
11544
+ const container = containerRef.current;
11545
+ if (!container) {
11546
+ return;
11547
+ }
11548
+ const selection = document.getSelection();
11549
+ if (!selection || selection.isCollapsed || selection.rangeCount === 0) {
11550
+ return;
11551
+ }
11552
+ const { anchorNode, focusNode } = selection;
11553
+ const touchesThread = anchorNode !== null && container.contains(anchorNode) || focusNode !== null && container.contains(focusNode);
11554
+ if (touchesThread) {
11555
+ isAtBottomRef.current = false;
11556
+ setIsAtBottom(false);
11557
+ }
11558
+ }
11559
+ document.addEventListener("selectionchange", handleSelectionChange);
11560
+ return () => {
11561
+ document.removeEventListener("selectionchange", handleSelectionChange);
11562
+ };
11563
+ }, []);
11531
11564
  React28.useLayoutEffect(() => {
11532
11565
  const element = containerRef.current;
11533
11566
  if (element && isAtBottomRef.current) {
@@ -11541,6 +11574,7 @@ function MosaicChatThread({
11541
11574
  "data-slot": "chat-thread",
11542
11575
  role: "log",
11543
11576
  onScroll: handleScroll,
11577
+ onKeyDown: handleKeyDown,
11544
11578
  className: cn73(chatThreadRootVariants(), className),
11545
11579
  children: [
11546
11580
  /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "chat-thread-content", className: chatThreadContentVariants(), children }),
@@ -12856,6 +12890,581 @@ function MosaicAgentChat(props) {
12856
12890
  ] });
12857
12891
  }
12858
12892
  MosaicAgentChat.displayName = "MosaicAgentChat";
12893
+ var toastCardVariants = classVarianceAuthority.cva(
12894
+ ["flex w-full items-start gap-3 rounded-lg border p-4 shadow-lg sm:max-w-sm"],
12895
+ {
12896
+ variants: {
12897
+ variant: {
12898
+ success: "border-border bg-card",
12899
+ error: "border-destructive/40 bg-destructive/5",
12900
+ info: "border-border bg-card",
12901
+ warning: "border-amber-500/40 bg-amber-500/5"
12902
+ }
12903
+ },
12904
+ defaultVariants: {
12905
+ variant: "info"
12906
+ }
12907
+ }
12908
+ );
12909
+ var toastTitleVariants = classVarianceAuthority.cva(["text-sm font-medium"], {
12910
+ variants: {
12911
+ variant: {
12912
+ success: "text-foreground",
12913
+ error: "text-destructive",
12914
+ info: "text-foreground",
12915
+ warning: "text-amber-600 dark:text-amber-400"
12916
+ }
12917
+ },
12918
+ defaultVariants: {
12919
+ variant: "info"
12920
+ }
12921
+ });
12922
+ var toastDismissButtonVariants = classVarianceAuthority.cva([
12923
+ "inline-flex size-6 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground"
12924
+ ]);
12925
+ var toastProviderPositionVariants = classVarianceAuthority.cva(
12926
+ ["pointer-events-none fixed z-50 flex flex-col gap-2 p-4"],
12927
+ {
12928
+ variants: {
12929
+ position: {
12930
+ "top-right": "top-0 right-0 items-end",
12931
+ "top-center": "top-0 left-1/2 -translate-x-1/2 items-center",
12932
+ "bottom-right": "bottom-0 right-0 items-end",
12933
+ "bottom-center": "bottom-0 left-1/2 -translate-x-1/2 items-center"
12934
+ }
12935
+ },
12936
+ defaultVariants: {
12937
+ position: "top-right"
12938
+ }
12939
+ }
12940
+ );
12941
+ function cn81(...classes) {
12942
+ return classes.filter(Boolean).join(" ");
12943
+ }
12944
+ function MosaicToast({
12945
+ variant,
12946
+ title,
12947
+ description,
12948
+ action,
12949
+ onDismiss,
12950
+ dismissAriaLabel,
12951
+ durationMs,
12952
+ className,
12953
+ ref
12954
+ }) {
12955
+ React28.useEffect(() => {
12956
+ if (durationMs === void 0) return;
12957
+ const timer = setTimeout(onDismiss, durationMs);
12958
+ return () => clearTimeout(timer);
12959
+ }, [durationMs, onDismiss]);
12960
+ const role = variant === "error" ? "alert" : "status";
12961
+ return /* @__PURE__ */ jsxRuntime.jsxs(
12962
+ "div",
12963
+ {
12964
+ ref,
12965
+ "data-slot": "toast",
12966
+ role,
12967
+ className: cn81(toastCardVariants({ variant }), className),
12968
+ children: [
12969
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "toast-body", className: "flex min-w-0 flex-1 flex-col gap-1", children: [
12970
+ /* @__PURE__ */ jsxRuntime.jsx("p", { "data-slot": "toast-title", className: toastTitleVariants({ variant }), children: title }),
12971
+ description !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { "data-slot": "toast-description", className: "text-sm text-muted-foreground", children: description }),
12972
+ action !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "toast-action", children: action })
12973
+ ] }),
12974
+ /* @__PURE__ */ jsxRuntime.jsx(
12975
+ "button",
12976
+ {
12977
+ type: "button",
12978
+ "data-slot": "toast-dismiss-button",
12979
+ onClick: onDismiss,
12980
+ "aria-label": dismissAriaLabel,
12981
+ className: toastDismissButtonVariants(),
12982
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
12983
+ "svg",
12984
+ {
12985
+ "aria-hidden": "true",
12986
+ viewBox: "0 0 24 24",
12987
+ width: "16",
12988
+ height: "16",
12989
+ fill: "none",
12990
+ stroke: "currentColor",
12991
+ strokeWidth: "2",
12992
+ strokeLinecap: "round",
12993
+ strokeLinejoin: "round",
12994
+ children: [
12995
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 6 6 18" }),
12996
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m6 6 12 12" })
12997
+ ]
12998
+ }
12999
+ )
13000
+ }
13001
+ )
13002
+ ]
13003
+ }
13004
+ );
13005
+ }
13006
+ MosaicToast.displayName = "MosaicToast";
13007
+ function cn82(...classes) {
13008
+ return classes.filter(Boolean).join(" ");
13009
+ }
13010
+ function MosaicToastProvider({
13011
+ children,
13012
+ position = "top-right",
13013
+ className,
13014
+ ref
13015
+ }) {
13016
+ return /* @__PURE__ */ jsxRuntime.jsx(
13017
+ "div",
13018
+ {
13019
+ ref,
13020
+ "data-slot": "toast-provider",
13021
+ className: cn82(toastProviderPositionVariants({ position }), className),
13022
+ children
13023
+ }
13024
+ );
13025
+ }
13026
+ MosaicToastProvider.displayName = "MosaicToastProvider";
13027
+ var pdfViewerFrameVariants = classVarianceAuthority.cva([
13028
+ "relative min-h-64 w-full flex-1 overflow-hidden rounded-lg border border-border bg-card"
13029
+ ]);
13030
+ var pdfViewerStatusVariants = classVarianceAuthority.cva(
13031
+ ["flex h-full w-full flex-col items-center justify-center gap-2 p-4 text-center text-sm"],
13032
+ {
13033
+ variants: {
13034
+ tone: {
13035
+ loading: "text-muted-foreground",
13036
+ error: "text-destructive"
13037
+ }
13038
+ },
13039
+ defaultVariants: {
13040
+ tone: "loading"
13041
+ }
13042
+ }
13043
+ );
13044
+ var pdfViewerToolbarButtonVariants = classVarianceAuthority.cva([
13045
+ "inline-flex min-h-8 min-w-8 items-center justify-center rounded-md border border-border text-sm",
13046
+ "transition-colors hover:bg-accent/50 disabled:opacity-50 disabled:hover:bg-transparent"
13047
+ ]);
13048
+ function cn83(...classes) {
13049
+ return classes.filter(Boolean).join(" ");
13050
+ }
13051
+ function buildFrameSrc(fileUrl, currentPage, zoom) {
13052
+ const fragmentParts = [];
13053
+ if (currentPage !== void 0) fragmentParts.push(`page=${currentPage}`);
13054
+ if (zoom !== void 0) fragmentParts.push(`zoom=${Math.round(zoom * 100)}`);
13055
+ if (fragmentParts.length === 0) return fileUrl;
13056
+ const separator = fileUrl.includes("#") ? "&" : "#";
13057
+ return `${fileUrl}${separator}${fragmentParts.join("&")}`;
13058
+ }
13059
+ function MosaicPdfViewer({
13060
+ fileUrl,
13061
+ currentPage,
13062
+ onPageChange,
13063
+ totalPages,
13064
+ zoom,
13065
+ onZoomChange,
13066
+ loadingLabel,
13067
+ errorLabel,
13068
+ className,
13069
+ ref
13070
+ }) {
13071
+ const [status, setStatus] = React28.useState("loading");
13072
+ const [trackedFileUrl, setTrackedFileUrl] = React28.useState(fileUrl);
13073
+ const frameRef = React28.useRef(null);
13074
+ if (fileUrl !== trackedFileUrl) {
13075
+ setTrackedFileUrl(fileUrl);
13076
+ setStatus("loading");
13077
+ }
13078
+ React28.useEffect(() => {
13079
+ const node = frameRef.current;
13080
+ if (!node) return;
13081
+ function handleLoad() {
13082
+ setStatus("loaded");
13083
+ }
13084
+ function handleError() {
13085
+ setStatus("error");
13086
+ }
13087
+ node.addEventListener("load", handleLoad);
13088
+ node.addEventListener("error", handleError);
13089
+ return () => {
13090
+ node.removeEventListener("load", handleLoad);
13091
+ node.removeEventListener("error", handleError);
13092
+ };
13093
+ }, []);
13094
+ const showPageControls = currentPage !== void 0;
13095
+ const showZoomControls = zoom !== void 0;
13096
+ function handlePrevPage() {
13097
+ if (currentPage === void 0 || onPageChange === void 0 || currentPage <= 1) return;
13098
+ onPageChange(currentPage - 1);
13099
+ }
13100
+ function handleNextPage() {
13101
+ if (currentPage === void 0 || onPageChange === void 0) return;
13102
+ if (totalPages !== void 0 && currentPage >= totalPages) return;
13103
+ onPageChange(currentPage + 1);
13104
+ }
13105
+ function handleZoomOut() {
13106
+ if (zoom === void 0 || onZoomChange === void 0) return;
13107
+ onZoomChange(Math.round((zoom - 0.1) * 100) / 100);
13108
+ }
13109
+ function handleZoomIn() {
13110
+ if (zoom === void 0 || onZoomChange === void 0) return;
13111
+ onZoomChange(Math.round((zoom + 0.1) * 100) / 100);
13112
+ }
13113
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, "data-slot": "pdf-viewer", className: cn83("flex flex-col gap-2", className), children: [
13114
+ (showPageControls || showZoomControls) && /* @__PURE__ */ jsxRuntime.jsxs(
13115
+ "div",
13116
+ {
13117
+ "data-slot": "pdf-viewer-toolbar",
13118
+ className: "flex items-center justify-between gap-2 text-sm",
13119
+ children: [
13120
+ showPageControls && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "pdf-viewer-page-controls", className: "flex items-center gap-2", children: [
13121
+ /* @__PURE__ */ jsxRuntime.jsx(
13122
+ "button",
13123
+ {
13124
+ type: "button",
13125
+ "data-slot": "pdf-viewer-prev-page-button",
13126
+ onClick: handlePrevPage,
13127
+ disabled: (currentPage ?? 1) <= 1,
13128
+ className: pdfViewerToolbarButtonVariants(),
13129
+ children: "\u2039"
13130
+ }
13131
+ ),
13132
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-slot": "pdf-viewer-page-indicator", children: [
13133
+ currentPage,
13134
+ totalPages !== void 0 ? ` / ${totalPages}` : ""
13135
+ ] }),
13136
+ /* @__PURE__ */ jsxRuntime.jsx(
13137
+ "button",
13138
+ {
13139
+ type: "button",
13140
+ "data-slot": "pdf-viewer-next-page-button",
13141
+ onClick: handleNextPage,
13142
+ disabled: totalPages !== void 0 && (currentPage ?? 0) >= totalPages,
13143
+ className: pdfViewerToolbarButtonVariants(),
13144
+ children: "\u203A"
13145
+ }
13146
+ )
13147
+ ] }),
13148
+ showZoomControls && /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "pdf-viewer-zoom-controls", className: "flex items-center gap-2", children: [
13149
+ /* @__PURE__ */ jsxRuntime.jsx(
13150
+ "button",
13151
+ {
13152
+ type: "button",
13153
+ "data-slot": "pdf-viewer-zoom-out-button",
13154
+ onClick: handleZoomOut,
13155
+ className: pdfViewerToolbarButtonVariants(),
13156
+ children: "\u2212"
13157
+ }
13158
+ ),
13159
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-slot": "pdf-viewer-zoom-indicator", children: [
13160
+ Math.round((zoom ?? 1) * 100),
13161
+ "%"
13162
+ ] }),
13163
+ /* @__PURE__ */ jsxRuntime.jsx(
13164
+ "button",
13165
+ {
13166
+ type: "button",
13167
+ "data-slot": "pdf-viewer-zoom-in-button",
13168
+ onClick: handleZoomIn,
13169
+ className: pdfViewerToolbarButtonVariants(),
13170
+ children: "+"
13171
+ }
13172
+ )
13173
+ ] })
13174
+ ]
13175
+ }
13176
+ ),
13177
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "pdf-viewer-frame-container", className: pdfViewerFrameVariants(), children: [
13178
+ status === "loading" && /* @__PURE__ */ jsxRuntime.jsx(
13179
+ "output",
13180
+ {
13181
+ "data-slot": "pdf-viewer-loading",
13182
+ className: pdfViewerStatusVariants({ tone: "loading" }),
13183
+ children: loadingLabel
13184
+ }
13185
+ ),
13186
+ status === "error" && /* @__PURE__ */ jsxRuntime.jsx(
13187
+ "div",
13188
+ {
13189
+ "data-slot": "pdf-viewer-error",
13190
+ role: "alert",
13191
+ className: pdfViewerStatusVariants({ tone: "error" }),
13192
+ children: errorLabel
13193
+ }
13194
+ ),
13195
+ /* @__PURE__ */ jsxRuntime.jsx(
13196
+ "iframe",
13197
+ {
13198
+ ref: frameRef,
13199
+ "data-slot": "pdf-viewer-frame",
13200
+ src: buildFrameSrc(fileUrl, currentPage, zoom),
13201
+ title: fileUrl,
13202
+ className: cn83(
13203
+ "h-full min-h-64 w-full border-0",
13204
+ status !== "loaded" && "pointer-events-none absolute inset-0 opacity-0"
13205
+ )
13206
+ }
13207
+ )
13208
+ ] })
13209
+ ] });
13210
+ }
13211
+ MosaicPdfViewer.displayName = "MosaicPdfViewer";
13212
+ var splitPaneRootVariants = classVarianceAuthority.cva(["flex h-full w-full min-h-0"]);
13213
+ var splitPaneHandleVariants = classVarianceAuthority.cva([
13214
+ "relative w-1 shrink-0 cursor-col-resize touch-none select-none bg-border",
13215
+ "transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
13216
+ ]);
13217
+ var splitPaneCollapseButtonVariants = classVarianceAuthority.cva([
13218
+ "inline-flex h-11 w-6 shrink-0 items-center justify-center self-center rounded-md border border-border text-sm",
13219
+ "transition-colors hover:bg-accent/50"
13220
+ ]);
13221
+ function cn84(...classes) {
13222
+ return classes.filter(Boolean).join(" ");
13223
+ }
13224
+ function mergeRefs(externalRef, node) {
13225
+ if (typeof externalRef === "function") {
13226
+ externalRef(node);
13227
+ } else if (externalRef && typeof externalRef === "object") {
13228
+ externalRef.current = node;
13229
+ }
13230
+ }
13231
+ var DEFAULT_SIDE_WIDTH = 30;
13232
+ var MIN_SIDE_WIDTH = 15;
13233
+ var MAX_SIDE_WIDTH = 70;
13234
+ var KEYBOARD_STEP = 5;
13235
+ function clampSideWidth(width) {
13236
+ return Math.min(MAX_SIDE_WIDTH, Math.max(MIN_SIDE_WIDTH, width));
13237
+ }
13238
+ function MosaicResizableSplitPane({
13239
+ main,
13240
+ side,
13241
+ sideWidth = DEFAULT_SIDE_WIDTH,
13242
+ onSideWidthChange,
13243
+ isSideCollapsed = false,
13244
+ onToggleSideCollapsed,
13245
+ collapseButtonAriaLabel,
13246
+ resizeHandleAriaLabel,
13247
+ className,
13248
+ ref
13249
+ }) {
13250
+ const rootRef = React28.useRef(null);
13251
+ const isDraggingRef = React28.useRef(false);
13252
+ React28.useEffect(() => {
13253
+ function handlePointerMove(event) {
13254
+ if (!isDraggingRef.current) return;
13255
+ const rootNode = rootRef.current;
13256
+ if (!rootNode || onSideWidthChange === void 0) return;
13257
+ const rect = rootNode.getBoundingClientRect();
13258
+ if (rect.width === 0) return;
13259
+ const distanceFromRight = rect.right - event.clientX;
13260
+ const rawWidth = distanceFromRight / rect.width * 100;
13261
+ onSideWidthChange(clampSideWidth(rawWidth));
13262
+ }
13263
+ function handlePointerUp() {
13264
+ isDraggingRef.current = false;
13265
+ }
13266
+ window.addEventListener("pointermove", handlePointerMove);
13267
+ window.addEventListener("pointerup", handlePointerUp);
13268
+ return () => {
13269
+ window.removeEventListener("pointermove", handlePointerMove);
13270
+ window.removeEventListener("pointerup", handlePointerUp);
13271
+ };
13272
+ }, [onSideWidthChange]);
13273
+ function handleHandlePointerDown() {
13274
+ isDraggingRef.current = true;
13275
+ }
13276
+ function handleHandleKeyDown(event) {
13277
+ if (onSideWidthChange === void 0) return;
13278
+ if (event.key === "ArrowLeft") {
13279
+ event.preventDefault();
13280
+ onSideWidthChange(clampSideWidth(sideWidth - KEYBOARD_STEP));
13281
+ } else if (event.key === "ArrowRight") {
13282
+ event.preventDefault();
13283
+ onSideWidthChange(clampSideWidth(sideWidth + KEYBOARD_STEP));
13284
+ }
13285
+ }
13286
+ return /* @__PURE__ */ jsxRuntime.jsxs(
13287
+ "div",
13288
+ {
13289
+ ref: (node) => {
13290
+ rootRef.current = node;
13291
+ mergeRefs(ref, node);
13292
+ },
13293
+ "data-slot": "resizable-split-pane",
13294
+ className: cn84(splitPaneRootVariants(), className),
13295
+ children: [
13296
+ /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "resizable-split-pane-main", className: "min-h-0 min-w-0 flex-1 overflow-auto", children: main }),
13297
+ !isSideCollapsed && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13298
+ /* @__PURE__ */ jsxRuntime.jsx(
13299
+ "div",
13300
+ {
13301
+ role: "separator",
13302
+ "aria-orientation": "vertical",
13303
+ "aria-valuenow": Math.round(sideWidth),
13304
+ "aria-valuemin": MIN_SIDE_WIDTH,
13305
+ "aria-valuemax": MAX_SIDE_WIDTH,
13306
+ "aria-label": resizeHandleAriaLabel,
13307
+ tabIndex: 0,
13308
+ "data-slot": "resizable-split-pane-handle",
13309
+ onPointerDown: handleHandlePointerDown,
13310
+ onKeyDown: handleHandleKeyDown,
13311
+ className: splitPaneHandleVariants()
13312
+ }
13313
+ ),
13314
+ /* @__PURE__ */ jsxRuntime.jsx(
13315
+ "div",
13316
+ {
13317
+ "data-slot": "resizable-split-pane-side",
13318
+ style: { width: `${sideWidth}%` },
13319
+ className: "min-h-0 shrink-0 overflow-auto",
13320
+ children: side
13321
+ }
13322
+ )
13323
+ ] }),
13324
+ /* @__PURE__ */ jsxRuntime.jsx(
13325
+ "button",
13326
+ {
13327
+ type: "button",
13328
+ "data-slot": "resizable-split-pane-collapse-button",
13329
+ "aria-label": collapseButtonAriaLabel,
13330
+ "aria-expanded": !isSideCollapsed,
13331
+ onClick: onToggleSideCollapsed,
13332
+ className: splitPaneCollapseButtonVariants(),
13333
+ children: isSideCollapsed ? "\u2039" : "\u203A"
13334
+ }
13335
+ )
13336
+ ]
13337
+ }
13338
+ );
13339
+ }
13340
+ MosaicResizableSplitPane.displayName = "MosaicResizableSplitPane";
13341
+ var tagInputRootVariants = classVarianceAuthority.cva([
13342
+ "flex w-full flex-wrap items-center gap-1.5 rounded-md border border-border",
13343
+ "bg-background px-2 py-1.5 text-sm shadow-xs",
13344
+ "focus-within:ring-ring focus-within:ring-[3px]",
13345
+ "has-[input[aria-disabled='true']]:cursor-not-allowed has-[input[aria-disabled='true']]:opacity-50"
13346
+ ]);
13347
+ var tagInputTagVariants = classVarianceAuthority.cva([
13348
+ "inline-flex items-center gap-1 rounded-md bg-accent px-2 py-0.5",
13349
+ "text-sm text-accent-foreground"
13350
+ ]);
13351
+ var tagInputRemoveButtonVariants = classVarianceAuthority.cva([
13352
+ "inline-flex size-4 shrink-0 items-center justify-center rounded-sm",
13353
+ "text-accent-foreground/70 outline-none transition-colors",
13354
+ "hover:bg-accent-foreground/10 hover:text-accent-foreground",
13355
+ "focus-visible:ring-ring focus-visible:ring-[2px]"
13356
+ ]);
13357
+ var tagInputFieldVariants = classVarianceAuthority.cva([
13358
+ "min-w-[6ch] flex-1 border-none bg-transparent px-1 py-0.5 text-sm text-foreground outline-none",
13359
+ "placeholder:text-muted-foreground"
13360
+ ]);
13361
+ function cn85(...classes) {
13362
+ return classes.filter(Boolean).join(" ");
13363
+ }
13364
+ function mergeRefs2(externalRef, node) {
13365
+ if (typeof externalRef === "function") {
13366
+ externalRef(node);
13367
+ } else if (externalRef && typeof externalRef === "object") {
13368
+ externalRef.current = node;
13369
+ }
13370
+ }
13371
+ function MosaicTagInput({
13372
+ tags,
13373
+ onAddTag,
13374
+ onRemoveTag,
13375
+ placeholder,
13376
+ removeTagAriaLabel,
13377
+ suggestions,
13378
+ maxTags,
13379
+ className,
13380
+ ref
13381
+ }) {
13382
+ const [inputValue, setInputValue] = React28.useState("");
13383
+ const inputRef = React28.useRef(null);
13384
+ const filter = combobox.Combobox.useFilter({ sensitivity: "base" });
13385
+ const isMaxReached = maxTags !== void 0 && tags.length >= maxTags;
13386
+ const trimmedValue = inputValue.trim();
13387
+ const filteredSuggestions = React28.useMemo(() => {
13388
+ if (!suggestions || trimmedValue.length === 0) return [];
13389
+ return suggestions.filter(
13390
+ (suggestion) => !tags.includes(suggestion) && filter.contains(suggestion, trimmedValue)
13391
+ );
13392
+ }, [suggestions, tags, trimmedValue, filter]);
13393
+ function commitTag(rawValue) {
13394
+ if (isMaxReached) return;
13395
+ const trimmed = rawValue.trim();
13396
+ if (trimmed.length === 0) return;
13397
+ if (tags.includes(trimmed)) return;
13398
+ onAddTag(trimmed);
13399
+ setInputValue("");
13400
+ }
13401
+ function handleKeyDown(event) {
13402
+ if (event.key === "Enter") {
13403
+ event.preventDefault();
13404
+ commitTag(inputValue);
13405
+ return;
13406
+ }
13407
+ if (event.key === "Backspace" && inputValue.length === 0 && tags.length > 0) {
13408
+ const lastTag = tags[tags.length - 1];
13409
+ if (lastTag !== void 0) onRemoveTag(lastTag);
13410
+ }
13411
+ }
13412
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "tag-input", className: cn85(tagInputRootVariants(), className), children: [
13413
+ tags.map((tag) => /* @__PURE__ */ jsxRuntime.jsxs("span", { "data-slot": "tag-input-tag", className: tagInputTagVariants(), children: [
13414
+ tag,
13415
+ /* @__PURE__ */ jsxRuntime.jsx(
13416
+ "button",
13417
+ {
13418
+ type: "button",
13419
+ "aria-label": removeTagAriaLabel(tag),
13420
+ "data-slot": "tag-input-remove-button",
13421
+ className: tagInputRemoveButtonVariants(),
13422
+ onClick: () => onRemoveTag(tag),
13423
+ children: "\xD7"
13424
+ }
13425
+ )
13426
+ ] }, tag)),
13427
+ /* @__PURE__ */ jsxRuntime.jsx(
13428
+ "input",
13429
+ {
13430
+ ref: (node) => {
13431
+ inputRef.current = node;
13432
+ mergeRefs2(ref, node);
13433
+ },
13434
+ type: "text",
13435
+ value: inputValue,
13436
+ placeholder,
13437
+ onChange: (event) => setInputValue(event.target.value),
13438
+ onKeyDown: handleKeyDown,
13439
+ "aria-disabled": isMaxReached ? true : void 0,
13440
+ "data-max-reached": isMaxReached ? true : void 0,
13441
+ "data-slot": "tag-input-field",
13442
+ className: tagInputFieldVariants()
13443
+ }
13444
+ ),
13445
+ filteredSuggestions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
13446
+ "ul",
13447
+ {
13448
+ "data-slot": "tag-input-suggestions",
13449
+ className: cn85(
13450
+ "z-50 mt-1 w-full min-w-[8rem] overflow-hidden rounded-md border border-border",
13451
+ "bg-popover p-1 text-sm text-popover-foreground shadow-md"
13452
+ ),
13453
+ children: filteredSuggestions.map((suggestion) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
13454
+ "button",
13455
+ {
13456
+ type: "button",
13457
+ "data-slot": "tag-input-suggestion",
13458
+ 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]",
13459
+ onClick: () => commitTag(suggestion),
13460
+ children: suggestion
13461
+ }
13462
+ ) }, suggestion))
13463
+ }
13464
+ )
13465
+ ] });
13466
+ }
13467
+ MosaicTagInput.displayName = "MosaicTagInput";
12859
13468
 
12860
13469
  Object.defineProperty(exports, "Accordion", {
12861
13470
  enumerable: true,
@@ -12958,6 +13567,7 @@ exports.MosaicOrgPanel = MosaicOrgPanel;
12958
13567
  exports.MosaicOrgProfilePage = MosaicOrgProfilePage;
12959
13568
  exports.MosaicOrgRoleBadge = MosaicOrgRoleBadge;
12960
13569
  exports.MosaicOrgSwitcher = MosaicOrgSwitcher;
13570
+ exports.MosaicPdfViewer = MosaicPdfViewer;
12961
13571
  exports.MosaicPreferencesPanel = MosaicPreferencesPanel;
12962
13572
  exports.MosaicPricingCard = MosaicPricingCard;
12963
13573
  exports.MosaicProfilePanel = MosaicProfilePanel;
@@ -12968,6 +13578,7 @@ exports.MosaicQuickAgentSelector = MosaicQuickAgentSelector;
12968
13578
  exports.MosaicQuickStartPanel = MosaicQuickStartPanel;
12969
13579
  exports.MosaicRadioGroup = MosaicRadioGroup;
12970
13580
  exports.MosaicRadioGroupItem = MosaicRadioGroupItem;
13581
+ exports.MosaicResizableSplitPane = MosaicResizableSplitPane;
12971
13582
  exports.MosaicScrollArea = MosaicScrollArea;
12972
13583
  exports.MosaicSelect = MosaicSelect;
12973
13584
  exports.MosaicSelectorModal = MosaicSelectorModal;
@@ -12983,6 +13594,7 @@ exports.MosaicTabs = MosaicTabs;
12983
13594
  exports.MosaicTabsList = MosaicTabsList;
12984
13595
  exports.MosaicTabsPanel = MosaicTabsPanel;
12985
13596
  exports.MosaicTabsTrigger = MosaicTabsTrigger;
13597
+ exports.MosaicTagInput = MosaicTagInput;
12986
13598
  exports.MosaicTemplateCard = MosaicTemplateCard;
12987
13599
  exports.MosaicTemplateGallery = MosaicTemplateGallery;
12988
13600
  exports.MosaicTemplatePreview = MosaicTemplatePreview;
@@ -12990,6 +13602,8 @@ exports.MosaicTestimonialsGrid = MosaicTestimonialsGrid;
12990
13602
  exports.MosaicTextarea = MosaicTextarea;
12991
13603
  exports.MosaicThemeProvider = MosaicThemeProvider;
12992
13604
  exports.MosaicThemeToggle = MosaicThemeToggle;
13605
+ exports.MosaicToast = MosaicToast;
13606
+ exports.MosaicToastProvider = MosaicToastProvider;
12993
13607
  exports.MosaicToolToggleList = MosaicToolToggleList;
12994
13608
  exports.MosaicTooltip = MosaicTooltip;
12995
13609
  exports.MosaicTooltipContent = MosaicTooltipContent;
@@ -13005,7 +13619,21 @@ exports.buttonVariants = buttonVariants;
13005
13619
  exports.chatMessageBubbleVariants = chatMessageBubbleVariants;
13006
13620
  exports.chatMessageContainerVariants = chatMessageContainerVariants;
13007
13621
  exports.chatMessageToolStatusVariants = chatMessageToolStatusVariants;
13622
+ exports.pdfViewerFrameVariants = pdfViewerFrameVariants;
13623
+ exports.pdfViewerStatusVariants = pdfViewerStatusVariants;
13624
+ exports.pdfViewerToolbarButtonVariants = pdfViewerToolbarButtonVariants;
13008
13625
  exports.skeletonVariants = skeletonVariants;
13626
+ exports.splitPaneCollapseButtonVariants = splitPaneCollapseButtonVariants;
13627
+ exports.splitPaneHandleVariants = splitPaneHandleVariants;
13628
+ exports.splitPaneRootVariants = splitPaneRootVariants;
13629
+ exports.tagInputFieldVariants = tagInputFieldVariants;
13630
+ exports.tagInputRemoveButtonVariants = tagInputRemoveButtonVariants;
13631
+ exports.tagInputRootVariants = tagInputRootVariants;
13632
+ exports.tagInputTagVariants = tagInputTagVariants;
13633
+ exports.toastCardVariants = toastCardVariants;
13634
+ exports.toastDismissButtonVariants = toastDismissButtonVariants;
13635
+ exports.toastProviderPositionVariants = toastProviderPositionVariants;
13636
+ exports.toastTitleVariants = toastTitleVariants;
13009
13637
  exports.toolToggleListRowVariants = toolToggleListRowVariants;
13010
13638
  exports.toolToggleListSectionVariants = toolToggleListSectionVariants;
13011
13639
  exports.useBreakpoint = useBreakpoint;