@vantageos/mosaic-blocks 0.5.8-alpha → 0.5.10-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.js CHANGED
@@ -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.8-alpha";
30
+ var version = "0.5.10-alpha";
31
31
  function Placeholder({ label = "mosaic-blocks placeholder" }) {
32
32
  return /* @__PURE__ */ jsx("div", { "data-mosaic-block": "placeholder", children: label });
33
33
  }
@@ -12170,7 +12170,329 @@ function MosaicChatMessage({
12170
12170
  );
12171
12171
  }
12172
12172
  MosaicChatMessage.displayName = "MosaicChatMessage";
12173
+ var approvalPromptCardVariants = cva(["flex flex-col gap-3 rounded-lg border p-4"], {
12174
+ variants: {
12175
+ tone: {
12176
+ pending: "border-border bg-card",
12177
+ approved: "border-border bg-card",
12178
+ denied: "border-destructive/40 bg-destructive/5",
12179
+ error: "border-destructive/40 bg-destructive/5"
12180
+ }
12181
+ },
12182
+ defaultVariants: {
12183
+ tone: "pending"
12184
+ }
12185
+ });
12186
+ var approvalPromptMessageVariants = cva(["text-sm"], {
12187
+ variants: {
12188
+ tone: {
12189
+ muted: "text-muted-foreground",
12190
+ approved: "text-foreground",
12191
+ denied: "text-destructive",
12192
+ error: "text-destructive"
12193
+ }
12194
+ },
12195
+ defaultVariants: {
12196
+ tone: "muted"
12197
+ }
12198
+ });
12199
+ var approvalPromptButtonVariants = cva(
12200
+ [
12201
+ "min-h-9 inline-flex items-center justify-center rounded-md border px-4 text-sm font-medium transition-colors disabled:opacity-50"
12202
+ ],
12203
+ {
12204
+ variants: {
12205
+ intent: {
12206
+ approve: "border-border hover:bg-accent/50",
12207
+ deny: "border-destructive/40 text-destructive hover:bg-destructive/5"
12208
+ }
12209
+ }
12210
+ }
12211
+ );
12212
+ function cn77(...classes) {
12213
+ return classes.filter(Boolean).join(" ");
12214
+ }
12215
+ function MosaicApprovalPrompt(props) {
12216
+ const { toolName, toolNameLabel, promptTitle, renderArguments, className, ref } = props;
12217
+ const tone = props.status === "responded" ? props.decision : props.status === "error" ? "error" : "pending";
12218
+ return /* @__PURE__ */ jsxs(
12219
+ "fieldset",
12220
+ {
12221
+ ref,
12222
+ "data-slot": "approval-prompt",
12223
+ "aria-label": promptTitle,
12224
+ className: cn77("border-0 p-0 m-0", approvalPromptCardVariants({ tone }), className),
12225
+ children: [
12226
+ /* @__PURE__ */ jsx("legend", { "data-slot": "approval-prompt-title", className: "text-base font-semibold md:text-lg", children: promptTitle }),
12227
+ /* @__PURE__ */ jsxs("div", { "data-slot": "approval-prompt-tool", className: "flex flex-col gap-1", children: [
12228
+ /* @__PURE__ */ jsx(
12229
+ "span",
12230
+ {
12231
+ "data-slot": "approval-prompt-tool-label",
12232
+ className: approvalPromptMessageVariants({ tone: "muted" }),
12233
+ children: toolNameLabel
12234
+ }
12235
+ ),
12236
+ /* @__PURE__ */ jsx("span", { "data-slot": "approval-prompt-tool-name", className: "text-sm font-medium", children: toolName })
12237
+ ] }),
12238
+ /* @__PURE__ */ jsx("div", { "data-slot": "approval-prompt-arguments", children: renderArguments }),
12239
+ props.status === "pending" && /* @__PURE__ */ jsxs("div", { "data-slot": "approval-prompt-actions", className: "flex gap-2", children: [
12240
+ /* @__PURE__ */ jsx(
12241
+ "button",
12242
+ {
12243
+ type: "button",
12244
+ "data-slot": "approval-prompt-approve-button",
12245
+ onClick: props.onApprove,
12246
+ className: approvalPromptButtonVariants({ intent: "approve" }),
12247
+ children: props.approveButtonLabel
12248
+ }
12249
+ ),
12250
+ /* @__PURE__ */ jsx(
12251
+ "button",
12252
+ {
12253
+ type: "button",
12254
+ "data-slot": "approval-prompt-deny-button",
12255
+ onClick: props.onDeny,
12256
+ className: approvalPromptButtonVariants({ intent: "deny" }),
12257
+ children: props.denyButtonLabel
12258
+ }
12259
+ )
12260
+ ] }),
12261
+ props.status === "responded" && /* @__PURE__ */ jsx(
12262
+ "p",
12263
+ {
12264
+ "data-slot": "approval-prompt-decision",
12265
+ className: approvalPromptMessageVariants({ tone: props.decision }),
12266
+ children: props.decisionMessage
12267
+ }
12268
+ ),
12269
+ props.status === "error" && /* @__PURE__ */ jsx(
12270
+ "p",
12271
+ {
12272
+ "data-slot": "approval-prompt-error",
12273
+ className: approvalPromptMessageVariants({ tone: "error" }),
12274
+ children: props.errorMessage
12275
+ }
12276
+ )
12277
+ ]
12278
+ }
12279
+ );
12280
+ }
12281
+ MosaicApprovalPrompt.displayName = "MosaicApprovalPrompt";
12282
+ var toolToggleListSectionVariants = cva(["flex flex-col gap-2"], {
12283
+ variants: {}
12284
+ });
12285
+ var toolToggleListRowVariants = cva(
12286
+ [
12287
+ "flex flex-col gap-3 rounded-lg border p-3 transition-colors sm:flex-row sm:items-center sm:justify-between"
12288
+ ],
12289
+ {
12290
+ variants: {
12291
+ enabled: {
12292
+ true: "border-border bg-card",
12293
+ false: "border-border bg-card/50 opacity-70"
12294
+ }
12295
+ },
12296
+ defaultVariants: {
12297
+ enabled: true
12298
+ }
12299
+ }
12300
+ );
12301
+ function cn78(...classes) {
12302
+ return classes.filter(Boolean).join(" ");
12303
+ }
12304
+ function MosaicToolToggleList({
12305
+ sections,
12306
+ tools,
12307
+ approvalLevels,
12308
+ onToggleTool,
12309
+ onChangeApproval,
12310
+ toggleAriaLabel,
12311
+ approvalSelectAriaLabel,
12312
+ className,
12313
+ ref
12314
+ }) {
12315
+ const toolsById = new Map(tools.map((tool) => [tool.id, tool]));
12316
+ const approvalLabelById = new Map(approvalLevels.map((level) => [level.id, level.label]));
12317
+ return /* @__PURE__ */ jsx("div", { ref, "data-slot": "tool-toggle-list", className: cn78("flex flex-col gap-6", className), children: sections.map((section) => /* @__PURE__ */ jsxs(
12318
+ "div",
12319
+ {
12320
+ "data-slot": "tool-toggle-list-section",
12321
+ className: toolToggleListSectionVariants(),
12322
+ children: [
12323
+ /* @__PURE__ */ jsx(
12324
+ "h3",
12325
+ {
12326
+ "data-slot": "tool-toggle-list-section-title",
12327
+ className: "text-sm font-semibold text-foreground",
12328
+ children: section.title
12329
+ }
12330
+ ),
12331
+ section.toolIds.map((toolId) => {
12332
+ const tool = toolsById.get(toolId);
12333
+ if (!tool) return null;
12334
+ return /* @__PURE__ */ jsxs(
12335
+ "div",
12336
+ {
12337
+ "data-slot": "tool-toggle-list-row",
12338
+ className: toolToggleListRowVariants({ enabled: tool.enabled }),
12339
+ children: [
12340
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
12341
+ /* @__PURE__ */ jsx(
12342
+ Switch.Root,
12343
+ {
12344
+ checked: tool.enabled,
12345
+ onCheckedChange: (checked) => onToggleTool(tool.id, checked),
12346
+ "aria-label": toggleAriaLabel(tool.name),
12347
+ "data-slot": "tool-toggle-list-switch",
12348
+ className: cn78(
12349
+ "relative inline-flex h-6 w-10 shrink-0 cursor-pointer items-center",
12350
+ "rounded-full border-2 border-transparent outline-none",
12351
+ "bg-muted transition-colors",
12352
+ "data-[checked]:bg-foreground",
12353
+ "focus-visible:ring-ring focus-visible:ring-[3px]"
12354
+ ),
12355
+ children: /* @__PURE__ */ jsx(
12356
+ Switch.Thumb,
12357
+ {
12358
+ "data-slot": "tool-toggle-list-switch-thumb",
12359
+ className: cn78(
12360
+ "pointer-events-none block h-4 w-4 rounded-full",
12361
+ "bg-background shadow-sm",
12362
+ "translate-x-0 transition-transform",
12363
+ "data-[checked]:translate-x-5"
12364
+ )
12365
+ }
12366
+ )
12367
+ }
12368
+ ),
12369
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5", children: [
12370
+ /* @__PURE__ */ jsx(
12371
+ "span",
12372
+ {
12373
+ "data-slot": "tool-toggle-list-name",
12374
+ className: "text-sm font-medium text-foreground",
12375
+ children: tool.name
12376
+ }
12377
+ ),
12378
+ /* @__PURE__ */ jsx(
12379
+ "span",
12380
+ {
12381
+ "data-slot": "tool-toggle-list-description",
12382
+ className: "text-sm text-muted-foreground",
12383
+ children: tool.description
12384
+ }
12385
+ )
12386
+ ] })
12387
+ ] }),
12388
+ /* @__PURE__ */ jsxs(
12389
+ Select.Root,
12390
+ {
12391
+ value: tool.approvalLevelId,
12392
+ onValueChange: (value) => {
12393
+ if (value !== null) onChangeApproval(tool.id, value);
12394
+ },
12395
+ children: [
12396
+ /* @__PURE__ */ jsxs(
12397
+ Select.Trigger,
12398
+ {
12399
+ "aria-label": approvalSelectAriaLabel(tool.name),
12400
+ "data-slot": "tool-toggle-list-approval-trigger",
12401
+ className: cn78(
12402
+ "inline-flex h-9 min-w-[10rem] items-center justify-between gap-2",
12403
+ "rounded-md border border-border bg-background px-3 py-2",
12404
+ "text-sm text-foreground shadow-xs outline-none",
12405
+ "hover:bg-muted",
12406
+ "focus-visible:ring-ring focus-visible:ring-[3px]",
12407
+ "data-[popup-open]:ring-ring data-[popup-open]:ring-[3px]"
12408
+ ),
12409
+ children: [
12410
+ /* @__PURE__ */ jsx(Select.Value, { children: (val) => val != null ? approvalLabelById.get(val) : "" }),
12411
+ /* @__PURE__ */ jsx(Select.Icon, { className: "size-4 shrink-0 text-muted-foreground", children: /* @__PURE__ */ jsx(ChevronDownIcon5, {}) })
12412
+ ]
12413
+ }
12414
+ ),
12415
+ /* @__PURE__ */ jsx(Select.Portal, { children: /* @__PURE__ */ jsx(Select.Positioner, { sideOffset: 4, children: /* @__PURE__ */ jsx(
12416
+ Select.Popup,
12417
+ {
12418
+ "data-slot": "tool-toggle-list-approval-popup",
12419
+ className: cn78(
12420
+ "z-50 min-w-[10rem] overflow-hidden rounded-md border border-border",
12421
+ "bg-popover p-1 text-popover-foreground shadow-md",
12422
+ "origin-[var(--transform-origin)]",
12423
+ "transition-[transform,scale,opacity]",
12424
+ "data-[open]:scale-100 data-[open]:opacity-100",
12425
+ "data-[ending-style]:scale-95 data-[ending-style]:opacity-0",
12426
+ "data-[starting-style]:scale-95 data-[starting-style]:opacity-0"
12427
+ ),
12428
+ children: /* @__PURE__ */ jsx(Select.List, { children: approvalLevels.map((level) => /* @__PURE__ */ jsxs(
12429
+ Select.Item,
12430
+ {
12431
+ value: level.id,
12432
+ className: cn78(
12433
+ "relative flex cursor-pointer select-none items-center rounded-sm px-2 py-1.5",
12434
+ "text-sm text-popover-foreground outline-none",
12435
+ "data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",
12436
+ "data-[selected]:font-medium"
12437
+ ),
12438
+ children: [
12439
+ /* @__PURE__ */ jsx(Select.ItemText, { children: level.label }),
12440
+ /* @__PURE__ */ jsx(Select.ItemIndicator, { className: "ml-auto size-4", children: /* @__PURE__ */ jsx(CheckIcon5, {}) })
12441
+ ]
12442
+ },
12443
+ level.id
12444
+ )) })
12445
+ }
12446
+ ) }) })
12447
+ ]
12448
+ }
12449
+ )
12450
+ ]
12451
+ },
12452
+ tool.id
12453
+ );
12454
+ })
12455
+ ]
12456
+ },
12457
+ section.id
12458
+ )) });
12459
+ }
12460
+ MosaicToolToggleList.displayName = "MosaicToolToggleList";
12461
+ function ChevronDownIcon5() {
12462
+ return /* @__PURE__ */ jsx(
12463
+ "svg",
12464
+ {
12465
+ xmlns: "http://www.w3.org/2000/svg",
12466
+ viewBox: "0 0 24 24",
12467
+ fill: "none",
12468
+ stroke: "currentColor",
12469
+ strokeWidth: "2",
12470
+ strokeLinecap: "round",
12471
+ strokeLinejoin: "round",
12472
+ "aria-hidden": "true",
12473
+ className: "size-4",
12474
+ children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
12475
+ }
12476
+ );
12477
+ }
12478
+ function CheckIcon5() {
12479
+ return /* @__PURE__ */ jsx(
12480
+ "svg",
12481
+ {
12482
+ xmlns: "http://www.w3.org/2000/svg",
12483
+ viewBox: "0 0 24 24",
12484
+ fill: "none",
12485
+ stroke: "currentColor",
12486
+ strokeWidth: "2",
12487
+ strokeLinecap: "round",
12488
+ strokeLinejoin: "round",
12489
+ "aria-hidden": "true",
12490
+ className: "size-4",
12491
+ children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" })
12492
+ }
12493
+ );
12494
+ }
12173
12495
 
12174
- export { MosaicAccordion, MosaicAccordionItem, MosaicAccordionPanel, MosaicAccordionTrigger, MosaicActivityFeed, MosaicActivityItem, MosaicAdaptiveGrid, MosaicAdaptiveModal, MosaicAdaptiveNavigation, MosaicAgentCard, MosaicAgentComposer, MosaicAgentComposerDesktop, MosaicAgentComposerMobile, MosaicAgentList, AgentListDesktop as MosaicAgentListDesktop, AgentListMobile as MosaicAgentListMobile, MosaicAgentTeamPreview, MosaicAnimatedList, MosaicAppSidebar, 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, MosaicTooltip, MosaicTooltipContent, MosaicTooltipProvider, MosaicTooltipRoot, MosaicTooltipTrigger, MosaicUrlScraper, MosaicUserButton, Placeholder, badgeVariants, buttonVariants, chatMessageBubbleVariants, chatMessageContainerVariants, chatMessageToolStatusVariants, skeletonVariants, useBreakpoint, useDevice, useMosaicWorkspace as useEffectiveWorkspaceId, useIsDesktop, useIsMobile, useIsTablet, useMediaQuery, useMosaicWorkspace, useOrientation, useViewport, version };
12496
+ export { MosaicAccordion, MosaicAccordionItem, MosaicAccordionPanel, MosaicAccordionTrigger, MosaicActivityFeed, MosaicActivityItem, MosaicAdaptiveGrid, MosaicAdaptiveModal, MosaicAdaptiveNavigation, MosaicAgentCard, MosaicAgentComposer, MosaicAgentComposerDesktop, MosaicAgentComposerMobile, MosaicAgentList, AgentListDesktop as MosaicAgentListDesktop, AgentListMobile as MosaicAgentListMobile, MosaicAgentTeamPreview, MosaicAnimatedList, 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, badgeVariants, buttonVariants, chatMessageBubbleVariants, chatMessageContainerVariants, chatMessageToolStatusVariants, skeletonVariants, toolToggleListRowVariants, toolToggleListSectionVariants, useBreakpoint, useDevice, useMosaicWorkspace as useEffectiveWorkspaceId, useIsDesktop, useIsMobile, useIsTablet, useMediaQuery, useMosaicWorkspace, useOrientation, useViewport, version };
12175
12497
  //# sourceMappingURL=index.js.map
12176
12498
  //# sourceMappingURL=index.js.map