@vantageos/mosaic-blocks 0.4.7-alpha → 0.4.9-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.4.7-alpha";
30
+ var version = "0.4.9-alpha";
31
31
  function Placeholder({ label = "mosaic-blocks placeholder" }) {
32
32
  return /* @__PURE__ */ jsx("div", { "data-mosaic-block": "placeholder", children: label });
33
33
  }
@@ -6028,25 +6028,24 @@ var SOURCE_ICONS = {
6028
6028
  document: FileIcon,
6029
6029
  url: LinkIcon
6030
6030
  };
6031
- function MosaicMemoryCard({
6032
- memory,
6033
- variant = "detailed",
6034
- onEdit,
6035
- onDelete,
6036
- editLabel,
6037
- deleteLabel,
6038
- moreActionsLabel,
6039
- formatScope,
6040
- formatTimeAgo,
6041
- formatUsageCount,
6042
- formatMoreTags,
6043
- className,
6044
- ref
6045
- }) {
6031
+ function MosaicMemoryCard(props) {
6032
+ const {
6033
+ memory,
6034
+ onEdit,
6035
+ onDelete,
6036
+ editLabel,
6037
+ deleteLabel,
6038
+ moreActionsLabel,
6039
+ formatScope,
6040
+ formatTimeAgo,
6041
+ formatUsageCount,
6042
+ className,
6043
+ ref
6044
+ } = props;
6045
+ const variant = props.variant ?? "detailed";
6046
6046
  const [menuOpen, setMenuOpen] = React28.useState(false);
6047
6047
  const menuRef = React28.useRef(null);
6048
6048
  const SourceIcon = SOURCE_ICONS[memory.source];
6049
- const isDetailed = variant === "detailed";
6050
6049
  React28.useEffect(() => {
6051
6050
  if (!menuOpen) return;
6052
6051
  const handler = (event) => {
@@ -6118,7 +6117,7 @@ function MosaicMemoryCard({
6118
6117
  "data-slot": "memory-card",
6119
6118
  "data-variant": variant,
6120
6119
  className: cn53(memoryCardVariants({ variant }), className),
6121
- children: isDetailed ? /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
6120
+ children: props.variant !== "compact" ? /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
6122
6121
  /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-3", children: [
6123
6122
  /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-start gap-3", children: [
6124
6123
  /* @__PURE__ */ jsx("div", { className: "rounded-lg bg-muted p-2 text-muted-foreground", children: /* @__PURE__ */ jsx(SourceIcon, {}) }),
@@ -6141,7 +6140,7 @@ function MosaicMemoryCard({
6141
6140
  /* @__PURE__ */ jsx("p", { className: "line-clamp-3 text-sm text-muted-foreground", children: memory.content }),
6142
6141
  /* @__PURE__ */ jsxs("div", { "data-slot": "memory-tags", className: "flex flex-wrap gap-1", children: [
6143
6142
  visibleTags.map((tag) => /* @__PURE__ */ jsx("span", { className: cn53(memoryTagBadgeVariants()), children: tag }, tag)),
6144
- hiddenTagCount > 0 && /* @__PURE__ */ jsx("span", { className: cn53(memoryTagBadgeVariants()), children: formatMoreTags(hiddenTagCount) })
6143
+ hiddenTagCount > 0 && /* @__PURE__ */ jsx("span", { className: cn53(memoryTagBadgeVariants()), children: props.formatMoreTags(hiddenTagCount) })
6145
6144
  ] }),
6146
6145
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-t pt-2 text-xs text-muted-foreground", children: [
6147
6146
  /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1", children: [
@@ -8549,21 +8548,20 @@ function XIcon2() {
8549
8548
  }
8550
8549
  );
8551
8550
  }
8552
- function MosaicModuleForm({
8553
- item,
8554
- mode,
8555
- formFields = [],
8556
- onSave,
8557
- onCancel,
8558
- nameFieldLabel,
8559
- descriptionFieldLabel,
8560
- namePlaceholder,
8561
- descriptionPlaceholder,
8562
- cancelLabel,
8563
- saveChangesLabel,
8564
- createItemLabel,
8565
- tagListAddPlaceholder
8566
- }) {
8551
+ function MosaicModuleForm(props) {
8552
+ const {
8553
+ item,
8554
+ mode,
8555
+ formFields = [],
8556
+ onSave,
8557
+ onCancel,
8558
+ nameFieldLabel,
8559
+ descriptionFieldLabel,
8560
+ namePlaceholder,
8561
+ descriptionPlaceholder,
8562
+ cancelLabel,
8563
+ tagListAddPlaceholder
8564
+ } = props;
8567
8565
  const [formData, setFormData] = React28.useState({
8568
8566
  name: item?.name ?? "",
8569
8567
  description: item?.description ?? "",
@@ -8761,7 +8759,7 @@ function MosaicModuleForm({
8761
8759
  onClick: handleSave,
8762
8760
  disabled: !formData.name,
8763
8761
  className: "inline-flex min-h-[44px] items-center justify-center rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 disabled:pointer-events-none",
8764
- children: mode === "edit" ? saveChangesLabel : createItemLabel
8762
+ children: props.mode === "edit" ? props.saveChangesLabel : props.createItemLabel
8765
8763
  }
8766
8764
  )
8767
8765
  ] })
@@ -8982,7 +8980,6 @@ function LibraryContent({
8982
8980
  MosaicModuleForm,
8983
8981
  {
8984
8982
  item: editingItem,
8985
- mode: editorMode,
8986
8983
  formFields,
8987
8984
  onSave: handleSave,
8988
8985
  onCancel: () => setEditorOpen(false),
@@ -8991,9 +8988,8 @@ function LibraryContent({
8991
8988
  namePlaceholder,
8992
8989
  descriptionPlaceholder,
8993
8990
  cancelLabel,
8994
- saveChangesLabel,
8995
- createItemLabel,
8996
- tagListAddPlaceholder
8991
+ tagListAddPlaceholder,
8992
+ ...editorMode === "edit" ? { mode: "edit", saveChangesLabel } : { mode: "create", createItemLabel }
8997
8993
  }
8998
8994
  )
8999
8995
  }
@@ -11262,7 +11258,209 @@ function MosaicDocumentUpload({
11262
11258
  ] });
11263
11259
  }
11264
11260
  MosaicDocumentUpload.displayName = "MosaicDocumentUpload";
11261
+ var urlScraperInputVariants = cva(
11262
+ [
11263
+ "min-h-9 flex-1 rounded-md border bg-transparent px-3 text-sm outline-none",
11264
+ "transition-colors focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50"
11265
+ ],
11266
+ {
11267
+ variants: {
11268
+ invalid: {
11269
+ true: "border-destructive",
11270
+ false: "border-border"
11271
+ }
11272
+ },
11273
+ defaultVariants: {
11274
+ invalid: false
11275
+ }
11276
+ }
11277
+ );
11278
+ var urlScraperMessageVariants = cva(["text-sm"], {
11279
+ variants: {
11280
+ tone: {
11281
+ error: "text-destructive",
11282
+ muted: "text-muted-foreground"
11283
+ }
11284
+ },
11285
+ defaultVariants: {
11286
+ tone: "muted"
11287
+ }
11288
+ });
11289
+ var urlScraperCardVariants = cva(["flex flex-col gap-2 rounded-lg border p-4"], {
11290
+ variants: {
11291
+ tone: {
11292
+ neutral: "border-border bg-card",
11293
+ error: "border-destructive/40 bg-destructive/5"
11294
+ }
11295
+ },
11296
+ defaultVariants: {
11297
+ tone: "neutral"
11298
+ }
11299
+ });
11300
+ function cn72(...classes) {
11301
+ return classes.filter(Boolean).join(" ");
11302
+ }
11303
+ function isSyntacticallyValidUrl(candidate) {
11304
+ try {
11305
+ new URL(candidate);
11306
+ return true;
11307
+ } catch {
11308
+ return false;
11309
+ }
11310
+ }
11311
+ function MosaicUrlScraper(props) {
11312
+ const {
11313
+ url,
11314
+ onUrlChange,
11315
+ onScrape,
11316
+ inputAriaLabel,
11317
+ inputPlaceholder,
11318
+ scrapeButtonLabel,
11319
+ invalidUrlMessage,
11320
+ className,
11321
+ ref
11322
+ } = props;
11323
+ const [isLocallyInvalid, setIsLocallyInvalid] = useState(false);
11324
+ const isBusy = props.status === "loading" || props.status === "success";
11325
+ function handleSubmit(event) {
11326
+ event.preventDefault();
11327
+ const trimmed = url.trim();
11328
+ if (!isSyntacticallyValidUrl(trimmed)) {
11329
+ setIsLocallyInvalid(true);
11330
+ return;
11331
+ }
11332
+ setIsLocallyInvalid(false);
11333
+ onScrape(trimmed);
11334
+ }
11335
+ function handleUrlChange(event) {
11336
+ setIsLocallyInvalid(false);
11337
+ onUrlChange(event.target.value);
11338
+ }
11339
+ return /* @__PURE__ */ jsxs("div", { ref, "data-slot": "url-scraper", className: cn72("flex flex-col gap-4", className), children: [
11340
+ /* @__PURE__ */ jsxs(
11341
+ "form",
11342
+ {
11343
+ "data-slot": "url-scraper-form",
11344
+ onSubmit: handleSubmit,
11345
+ className: "flex flex-col gap-2 md:flex-row",
11346
+ children: [
11347
+ /* @__PURE__ */ jsx(
11348
+ "input",
11349
+ {
11350
+ type: "url",
11351
+ "data-slot": "url-scraper-input",
11352
+ "aria-label": inputAriaLabel,
11353
+ placeholder: inputPlaceholder,
11354
+ value: url,
11355
+ onChange: handleUrlChange,
11356
+ disabled: isBusy,
11357
+ className: urlScraperInputVariants({ invalid: isLocallyInvalid })
11358
+ }
11359
+ ),
11360
+ /* @__PURE__ */ jsx(
11361
+ "button",
11362
+ {
11363
+ type: "submit",
11364
+ "data-slot": "url-scraper-submit-button",
11365
+ disabled: isBusy,
11366
+ className: "min-h-9 inline-flex items-center justify-center rounded-md border border-border px-4 text-sm font-medium transition-colors hover:bg-accent/50 disabled:opacity-50",
11367
+ children: props.status === "loading" ? props.scrapingLabel : scrapeButtonLabel
11368
+ }
11369
+ )
11370
+ ]
11371
+ }
11372
+ ),
11373
+ isLocallyInvalid && /* @__PURE__ */ jsx(
11374
+ "p",
11375
+ {
11376
+ "data-slot": "url-scraper-invalid-message",
11377
+ className: urlScraperMessageVariants({ tone: "error" }),
11378
+ children: invalidUrlMessage
11379
+ }
11380
+ ),
11381
+ props.status === "loading" && /* @__PURE__ */ jsx(
11382
+ "output",
11383
+ {
11384
+ "data-slot": "url-scraper-loading",
11385
+ className: urlScraperCardVariants({ tone: "neutral" }),
11386
+ children: /* @__PURE__ */ jsx("p", { className: urlScraperMessageVariants({ tone: "muted" }), children: props.loadingMessage })
11387
+ }
11388
+ ),
11389
+ props.status === "error" && /* @__PURE__ */ jsxs("div", { "data-slot": "url-scraper-error", className: urlScraperCardVariants({ tone: "error" }), children: [
11390
+ /* @__PURE__ */ jsx(
11391
+ "p",
11392
+ {
11393
+ "data-slot": "url-scraper-error-message",
11394
+ className: urlScraperMessageVariants({ tone: "error" }),
11395
+ children: props.errorMessage
11396
+ }
11397
+ ),
11398
+ /* @__PURE__ */ jsx(
11399
+ "button",
11400
+ {
11401
+ type: "button",
11402
+ "data-slot": "url-scraper-reset-button",
11403
+ onClick: props.onReset,
11404
+ className: "min-h-9 inline-flex w-fit items-center justify-center rounded-md border border-border px-3 text-sm font-medium transition-colors hover:bg-accent/50",
11405
+ children: props.resetButtonLabel
11406
+ }
11407
+ )
11408
+ ] }),
11409
+ props.status === "success" && /* @__PURE__ */ jsxs(
11410
+ "div",
11411
+ {
11412
+ "data-slot": "url-scraper-content",
11413
+ className: urlScraperCardVariants({ tone: "neutral" }),
11414
+ children: [
11415
+ props.content.image !== void 0 && /* @__PURE__ */ jsx(
11416
+ "img",
11417
+ {
11418
+ "data-slot": "url-scraper-image",
11419
+ src: props.content.image,
11420
+ alt: props.imageAlt(props.content.title),
11421
+ className: "h-32 w-full rounded-md object-cover md:h-48"
11422
+ }
11423
+ ),
11424
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-2", children: [
11425
+ /* @__PURE__ */ jsx("h3", { "data-slot": "url-scraper-title", className: "text-base font-semibold md:text-lg", children: props.content.title }),
11426
+ /* @__PURE__ */ jsx(
11427
+ "a",
11428
+ {
11429
+ "data-slot": "url-scraper-link",
11430
+ href: props.content.url,
11431
+ target: "_blank",
11432
+ rel: "noopener noreferrer",
11433
+ "aria-label": props.openLinkAriaLabel(props.content.url),
11434
+ className: "shrink-0 text-sm text-muted-foreground transition-colors hover:text-foreground",
11435
+ children: "\u2197"
11436
+ }
11437
+ )
11438
+ ] }),
11439
+ /* @__PURE__ */ jsx(
11440
+ "p",
11441
+ {
11442
+ "data-slot": "url-scraper-description",
11443
+ className: urlScraperMessageVariants({ tone: "muted" }),
11444
+ children: props.content.description
11445
+ }
11446
+ ),
11447
+ /* @__PURE__ */ jsx(
11448
+ "button",
11449
+ {
11450
+ type: "button",
11451
+ "data-slot": "url-scraper-reset-button",
11452
+ onClick: props.onReset,
11453
+ className: "min-h-9 inline-flex w-fit items-center justify-center rounded-md border border-border px-3 text-sm font-medium transition-colors hover:bg-accent/50",
11454
+ children: props.resetButtonLabel
11455
+ }
11456
+ )
11457
+ ]
11458
+ }
11459
+ )
11460
+ ] });
11461
+ }
11462
+ MosaicUrlScraper.displayName = "MosaicUrlScraper";
11265
11463
 
11266
- 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, 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, 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, MosaicUserButton, Placeholder, badgeVariants, buttonVariants, skeletonVariants, useBreakpoint, useDevice, useMosaicWorkspace as useEffectiveWorkspaceId, useIsDesktop, useIsMobile, useIsTablet, useMediaQuery, useMosaicWorkspace, useOrientation, useViewport, version };
11464
+ 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, 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, 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, skeletonVariants, useBreakpoint, useDevice, useMosaicWorkspace as useEffectiveWorkspaceId, useIsDesktop, useIsMobile, useIsTablet, useMediaQuery, useMosaicWorkspace, useOrientation, useViewport, version };
11267
11465
  //# sourceMappingURL=index.js.map
11268
11466
  //# sourceMappingURL=index.js.map