@vantageos/mosaic-blocks 0.5.30-alpha → 0.5.31-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
@@ -29,7 +29,7 @@ import { AlertDialog } from '@base-ui/react/alert-dialog';
29
29
  import { Popover } from '@base-ui/react/popover';
30
30
 
31
31
  // src/version.ts
32
- var version = "0.5.30-alpha";
32
+ var version = "0.5.31-alpha";
33
33
  function Placeholder({ label = "mosaic-blocks placeholder" }) {
34
34
  return /* @__PURE__ */ jsx("div", { "data-mosaic-block": "placeholder", children: label });
35
35
  }
@@ -2550,10 +2550,14 @@ function MosaicDeviceProvider({ children }) {
2550
2550
  return /* @__PURE__ */ jsx(DeviceContext.Provider, { value, children });
2551
2551
  }
2552
2552
  MosaicDeviceProvider.displayName = "MosaicDeviceProvider";
2553
+ var DEVICE_PROVIDER_ERRORS = {
2554
+ // allow-hardcoded-word: developer-facing invariant error, never rendered to an end user
2555
+ missingProvider: "useDevice must be used within a MosaicDeviceProvider"
2556
+ };
2553
2557
  function useDevice() {
2554
2558
  const ctx = React30.useContext(DeviceContext);
2555
2559
  if (!ctx) {
2556
- throw new Error("useDevice must be used within a MosaicDeviceProvider");
2560
+ throw new Error(DEVICE_PROVIDER_ERRORS.missingProvider);
2557
2561
  }
2558
2562
  return ctx;
2559
2563
  }
@@ -3084,6 +3088,9 @@ function MosaicAppSidebar({
3084
3088
  recentItems = [],
3085
3089
  logoSlot,
3086
3090
  footerStatus,
3091
+ chevronPosition = "top",
3092
+ bottomNavItems = [],
3093
+ bottomNavAriaLabel,
3087
3094
  sidebarAriaLabel,
3088
3095
  mainNavAriaLabel,
3089
3096
  quickActionsHeading,
@@ -3113,6 +3120,21 @@ function MosaicAppSidebar({
3113
3120
  const handleNavClick = (href) => {
3114
3121
  onNavigate?.(href);
3115
3122
  };
3123
+ const collapseToggleButton = !isMobile && /* @__PURE__ */ jsx(
3124
+ "button",
3125
+ {
3126
+ type: "button",
3127
+ onClick: onToggleCollapse,
3128
+ "aria-label": isCollapsed ? expandSidebarAriaLabel : collapseSidebarAriaLabel,
3129
+ className: cn41(
3130
+ "flex h-9 w-9 items-center justify-center rounded-lg transition-colors",
3131
+ "hover:bg-sidebar-accent text-sidebar-foreground",
3132
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3133
+ isCollapsed && "mx-auto"
3134
+ ),
3135
+ children: isCollapsed ? /* @__PURE__ */ jsx(ChevronRightIcon, {}) : /* @__PURE__ */ jsx(ChevronLeftIcon, {})
3136
+ }
3137
+ );
3116
3138
  return /* @__PURE__ */ jsxs(
3117
3139
  "div",
3118
3140
  {
@@ -3132,21 +3154,7 @@ function MosaicAppSidebar({
3132
3154
  children: [
3133
3155
  /* @__PURE__ */ jsx("div", { className: "shrink-0 border-b border-sidebar-border p-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
3134
3156
  !isCollapsed && logoSlot && /* @__PURE__ */ jsx("div", { className: "mosaic-sidebar-label-in flex items-center gap-2 min-w-0", children: logoSlot }),
3135
- !isMobile && /* @__PURE__ */ jsx(
3136
- "button",
3137
- {
3138
- type: "button",
3139
- onClick: onToggleCollapse,
3140
- "aria-label": isCollapsed ? expandSidebarAriaLabel : collapseSidebarAriaLabel,
3141
- className: cn41(
3142
- "flex h-9 w-9 items-center justify-center rounded-lg transition-colors",
3143
- "hover:bg-sidebar-accent text-sidebar-foreground",
3144
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3145
- isCollapsed && "mx-auto"
3146
- ),
3147
- children: isCollapsed ? /* @__PURE__ */ jsx(ChevronRightIcon, {}) : /* @__PURE__ */ jsx(ChevronLeftIcon, {})
3148
- }
3149
- )
3157
+ chevronPosition === "top" && collapseToggleButton
3150
3158
  ] }) }),
3151
3159
  /* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-y-auto p-2", style: { scrollbarWidth: "thin" }, children: [
3152
3160
  navItems.length > 0 && /* @__PURE__ */ jsx("nav", { "aria-label": mainNavAriaLabel, children: /* @__PURE__ */ jsx("div", { className: "space-y-0.5", children: navItems.map((item) => {
@@ -3259,7 +3267,48 @@ function MosaicAppSidebar({
3259
3267
  /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-sidebar-foreground", children: footerStatus.label }),
3260
3268
  footerStatus.sublabel && /* @__PURE__ */ jsx("p", { className: "text-xs text-sidebar-foreground/60", children: footerStatus.sublabel })
3261
3269
  ] })
3262
- ] }) : /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx("div", { className: "flex h-8 w-8 items-center justify-center rounded-lg bg-sidebar-accent/30 text-green-500", children: footerStatus.icon ?? /* @__PURE__ */ jsx(TrendingUpIcon, {}) }) }) })
3270
+ ] }) : /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx("div", { className: "flex h-8 w-8 items-center justify-center rounded-lg bg-sidebar-accent/30 text-green-500", children: footerStatus.icon ?? /* @__PURE__ */ jsx(TrendingUpIcon, {}) }) }) }),
3271
+ bottomNavItems.length > 0 && /* @__PURE__ */ jsx(
3272
+ "div",
3273
+ {
3274
+ "data-slot": "app-sidebar-bottom-nav",
3275
+ className: cn41("shrink-0 border-t border-sidebar-border p-2", isCollapsed && "px-2"),
3276
+ children: /* @__PURE__ */ jsx("nav", { "aria-label": bottomNavAriaLabel, children: /* @__PURE__ */ jsx("div", { className: "space-y-0.5", children: bottomNavItems.map((item) => {
3277
+ const isActive = activePath === item.href;
3278
+ return /* @__PURE__ */ jsx(
3279
+ "button",
3280
+ {
3281
+ type: "button",
3282
+ onClick: () => handleNavClick(item.href),
3283
+ "aria-current": isActive ? "page" : void 0,
3284
+ className: cn41(
3285
+ "group flex w-full min-h-[44px] items-center rounded-lg p-3 transition-colors",
3286
+ "hover:bg-sidebar-accent",
3287
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3288
+ isActive && "bg-sidebar-accent",
3289
+ isCollapsed ? "justify-center" : "justify-start gap-3"
3290
+ ),
3291
+ children: isCollapsed ? /* @__PURE__ */ jsx("span", { className: "text-sidebar-foreground", title: item.label, children: item.icon ?? /* @__PURE__ */ jsx("span", { className: "text-xs font-bold", children: item.label.charAt(0) }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
3292
+ item.icon && /* @__PURE__ */ jsx("span", { className: "text-sidebar-foreground", children: item.icon }),
3293
+ /* @__PURE__ */ jsx("span", { className: "mosaic-sidebar-label-in text-sm font-medium text-sidebar-foreground", children: item.label })
3294
+ ] })
3295
+ },
3296
+ item.id
3297
+ );
3298
+ }) }) })
3299
+ }
3300
+ ),
3301
+ chevronPosition === "bottom" && collapseToggleButton && /* @__PURE__ */ jsx(
3302
+ "div",
3303
+ {
3304
+ "data-slot": "app-sidebar-toggle-zone",
3305
+ className: cn41(
3306
+ "shrink-0 border-t border-sidebar-border p-2 flex",
3307
+ isCollapsed ? "justify-center" : "justify-end"
3308
+ ),
3309
+ children: collapseToggleButton
3310
+ }
3311
+ )
3263
3312
  ]
3264
3313
  }
3265
3314
  );
@@ -3802,7 +3851,16 @@ function SaveIcon() {
3802
3851
  }
3803
3852
  );
3804
3853
  }
3805
- function ModuleSlot({ label, sublabel, module, onSelect, onRemove }) {
3854
+ function ModuleSlot({
3855
+ label,
3856
+ sublabel,
3857
+ module,
3858
+ onSelect,
3859
+ onRemove,
3860
+ editAriaLabel,
3861
+ removeAriaLabel,
3862
+ selectAriaLabel
3863
+ }) {
3806
3864
  return /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-border bg-card", children: [
3807
3865
  /* @__PURE__ */ jsxs("div", { className: "border-b border-border px-4 pt-4 pb-3", children: [
3808
3866
  /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold text-foreground", children: label }),
@@ -3821,7 +3879,7 @@ function ModuleSlot({ label, sublabel, module, onSelect, onRemove }) {
3821
3879
  {
3822
3880
  type: "button",
3823
3881
  onClick: onSelect,
3824
- "aria-label": `Edit ${label}`,
3882
+ "aria-label": editAriaLabel,
3825
3883
  className: "flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3826
3884
  children: /* @__PURE__ */ jsxs(
3827
3885
  "svg",
@@ -3848,7 +3906,7 @@ function ModuleSlot({ label, sublabel, module, onSelect, onRemove }) {
3848
3906
  {
3849
3907
  type: "button",
3850
3908
  onClick: onRemove,
3851
- "aria-label": `Remove ${label}`,
3909
+ "aria-label": removeAriaLabel,
3852
3910
  className: "flex h-7 w-7 items-center justify-center rounded-md text-destructive hover:bg-destructive/10 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3853
3911
  children: /* @__PURE__ */ jsxs(
3854
3912
  "svg",
@@ -3876,12 +3934,11 @@ function ModuleSlot({ label, sublabel, module, onSelect, onRemove }) {
3876
3934
  {
3877
3935
  type: "button",
3878
3936
  onClick: onSelect,
3879
- "aria-label": `Select ${label}`,
3937
+ "aria-label": selectAriaLabel,
3880
3938
  className: "flex w-full min-h-[72px] items-center justify-center gap-2 rounded-lg border border-dashed border-border text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3881
3939
  children: [
3882
3940
  /* @__PURE__ */ jsx(PlusIcon, {}),
3883
- "Select ",
3884
- label
3941
+ selectAriaLabel
3885
3942
  ]
3886
3943
  }
3887
3944
  ) })
@@ -3918,10 +3975,24 @@ function MosaicAgentComposerDesktop({
3918
3975
  previewConfigLabel,
3919
3976
  customInstructionsPreviewLabel,
3920
3977
  selectAllModulesLabel,
3921
- unnamedAgentLabel
3978
+ unnamedAgentLabel,
3979
+ roleSublabel,
3980
+ personaSublabel,
3981
+ frameworkSublabel,
3982
+ editModuleAriaLabel,
3983
+ removeModuleAriaLabel,
3984
+ selectModuleAriaLabel,
3985
+ changeModuleLabel,
3986
+ previewRequires = ["role", "persona", "framework", "model"]
3922
3987
  }) {
3923
3988
  const L = labels;
3924
- const allModulesSelected = !!selectedRole && !!selectedPersona && !!selectedFramework && !!selectedModel;
3989
+ const moduleBySlot = {
3990
+ role: selectedRole,
3991
+ persona: selectedPersona,
3992
+ framework: selectedFramework,
3993
+ model: selectedModel
3994
+ };
3995
+ const allModulesSelected = previewRequires.every((slot) => !!moduleBySlot[slot]);
3925
3996
  return /* @__PURE__ */ jsxs("div", { "data-slot": "agent-composer-desktop", className: "grid h-full grid-cols-2 gap-6", children: [
3926
3997
  /* @__PURE__ */ jsxs("div", { className: "space-y-5 overflow-y-auto pr-3", children: [
3927
3998
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
@@ -3962,30 +4033,39 @@ function MosaicAgentComposerDesktop({
3962
4033
  ModuleSlot,
3963
4034
  {
3964
4035
  label: L.role,
3965
- sublabel: "Professional expertise and domain knowledge",
4036
+ sublabel: roleSublabel,
3966
4037
  module: selectedRole,
3967
4038
  onSelect: onSelectRole,
3968
- onRemove: onRemoveRole
4039
+ onRemove: onRemoveRole,
4040
+ editAriaLabel: editModuleAriaLabel(L.role),
4041
+ removeAriaLabel: removeModuleAriaLabel(L.role),
4042
+ selectAriaLabel: selectModuleAriaLabel(L.role)
3969
4043
  }
3970
4044
  ),
3971
4045
  /* @__PURE__ */ jsx(
3972
4046
  ModuleSlot,
3973
4047
  {
3974
4048
  label: L.persona,
3975
- sublabel: "Communication style and personality traits",
4049
+ sublabel: personaSublabel,
3976
4050
  module: selectedPersona,
3977
4051
  onSelect: onSelectPersona,
3978
- onRemove: onRemovePersona
4052
+ onRemove: onRemovePersona,
4053
+ editAriaLabel: editModuleAriaLabel(L.persona),
4054
+ removeAriaLabel: removeModuleAriaLabel(L.persona),
4055
+ selectAriaLabel: selectModuleAriaLabel(L.persona)
3979
4056
  }
3980
4057
  ),
3981
4058
  /* @__PURE__ */ jsx(
3982
4059
  ModuleSlot,
3983
4060
  {
3984
4061
  label: L.framework,
3985
- sublabel: "Thinking approach and decision-making process",
4062
+ sublabel: frameworkSublabel,
3986
4063
  module: selectedFramework,
3987
4064
  onSelect: onSelectFramework,
3988
- onRemove: onRemoveFramework
4065
+ onRemove: onRemoveFramework,
4066
+ editAriaLabel: editModuleAriaLabel(L.framework),
4067
+ removeAriaLabel: removeModuleAriaLabel(L.framework),
4068
+ selectAriaLabel: selectModuleAriaLabel(L.framework)
3989
4069
  }
3990
4070
  ),
3991
4071
  /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-border bg-card", children: [
@@ -4006,16 +4086,13 @@ function MosaicAgentComposerDesktop({
4006
4086
  selectedModel.pricingLabel
4007
4087
  ] })
4008
4088
  ] }) }),
4009
- /* @__PURE__ */ jsxs(
4089
+ /* @__PURE__ */ jsx(
4010
4090
  "button",
4011
4091
  {
4012
4092
  type: "button",
4013
4093
  onClick: onSelectModel,
4014
4094
  className: "flex w-full min-h-[44px] items-center justify-center rounded-lg border border-border text-sm text-muted-foreground transition-colors hover:border-primary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
4015
- children: [
4016
- "Change ",
4017
- L.model
4018
- ]
4095
+ children: changeModuleLabel(L.model)
4019
4096
  }
4020
4097
  )
4021
4098
  ] }) : /* @__PURE__ */ jsxs(
@@ -4023,12 +4100,11 @@ function MosaicAgentComposerDesktop({
4023
4100
  {
4024
4101
  type: "button",
4025
4102
  onClick: onSelectModel,
4026
- "aria-label": `Select ${L.model}`,
4103
+ "aria-label": selectModuleAriaLabel(L.model),
4027
4104
  className: "flex w-full min-h-[72px] items-center justify-center gap-2 rounded-lg border border-dashed border-border text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
4028
4105
  children: [
4029
4106
  /* @__PURE__ */ jsx(PlusIcon, {}),
4030
- "Select ",
4031
- L.model
4107
+ selectModuleAriaLabel(L.model)
4032
4108
  ]
4033
4109
  }
4034
4110
  ) })
@@ -4243,7 +4319,10 @@ function MobileModuleSlot({
4243
4319
  onSelect,
4244
4320
  onRemove,
4245
4321
  isLoading,
4246
- requiredLabel
4322
+ requiredLabel,
4323
+ editAriaLabel,
4324
+ removeAriaLabel,
4325
+ selectAriaLabel
4247
4326
  }) {
4248
4327
  return /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-border bg-card", children: [
4249
4328
  /* @__PURE__ */ jsx("div", { className: "border-b border-border px-4 pt-3 pb-2", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
@@ -4267,7 +4346,7 @@ function MobileModuleSlot({
4267
4346
  type: "button",
4268
4347
  onClick: onSelect,
4269
4348
  disabled: isLoading,
4270
- "aria-label": `Edit ${label}`,
4349
+ "aria-label": editAriaLabel,
4271
4350
  className: "flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
4272
4351
  children: /* @__PURE__ */ jsxs(
4273
4352
  "svg",
@@ -4295,7 +4374,7 @@ function MobileModuleSlot({
4295
4374
  type: "button",
4296
4375
  onClick: onRemove,
4297
4376
  disabled: isLoading,
4298
- "aria-label": `Remove ${label}`,
4377
+ "aria-label": removeAriaLabel,
4299
4378
  className: "flex h-8 w-8 items-center justify-center rounded-md text-destructive transition-colors hover:bg-destructive/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
4300
4379
  children: /* @__PURE__ */ jsxs(
4301
4380
  "svg",
@@ -4324,12 +4403,11 @@ function MobileModuleSlot({
4324
4403
  type: "button",
4325
4404
  onClick: onSelect,
4326
4405
  disabled: isLoading,
4327
- "aria-label": `Select ${label}`,
4406
+ "aria-label": selectAriaLabel,
4328
4407
  className: "flex w-full min-h-[64px] items-center justify-center gap-2 rounded-lg border border-dashed border-border text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
4329
4408
  children: [
4330
4409
  /* @__PURE__ */ jsx(PlusIcon2, {}),
4331
- "Select ",
4332
- label
4410
+ selectAriaLabel
4333
4411
  ]
4334
4412
  }
4335
4413
  ) })
@@ -4365,7 +4443,11 @@ function MosaicAgentComposerMobile({
4365
4443
  goBackAriaLabel,
4366
4444
  savingLabel,
4367
4445
  creatingLabel,
4368
- optionalInstructionsHelp
4446
+ optionalInstructionsHelp,
4447
+ editModuleAriaLabel,
4448
+ removeModuleAriaLabel,
4449
+ selectModuleAriaLabel,
4450
+ changeModuleLabel
4369
4451
  }) {
4370
4452
  const L = labels;
4371
4453
  const instructionsId = React30.useId();
@@ -4427,7 +4509,10 @@ function MosaicAgentComposerMobile({
4427
4509
  onSelect: onSelectRole,
4428
4510
  onRemove: onRemoveRole,
4429
4511
  isLoading,
4430
- requiredLabel
4512
+ requiredLabel,
4513
+ editAriaLabel: editModuleAriaLabel(L.role),
4514
+ removeAriaLabel: removeModuleAriaLabel(L.role),
4515
+ selectAriaLabel: selectModuleAriaLabel(L.role)
4431
4516
  }
4432
4517
  ),
4433
4518
  /* @__PURE__ */ jsx(
@@ -4439,7 +4524,10 @@ function MosaicAgentComposerMobile({
4439
4524
  onSelect: onSelectPersona,
4440
4525
  onRemove: onRemovePersona,
4441
4526
  isLoading,
4442
- requiredLabel
4527
+ requiredLabel,
4528
+ editAriaLabel: editModuleAriaLabel(L.persona),
4529
+ removeAriaLabel: removeModuleAriaLabel(L.persona),
4530
+ selectAriaLabel: selectModuleAriaLabel(L.persona)
4443
4531
  }
4444
4532
  ),
4445
4533
  /* @__PURE__ */ jsx(
@@ -4451,7 +4539,10 @@ function MosaicAgentComposerMobile({
4451
4539
  onSelect: onSelectFramework,
4452
4540
  onRemove: onRemoveFramework,
4453
4541
  isLoading,
4454
- requiredLabel
4542
+ requiredLabel,
4543
+ editAriaLabel: editModuleAriaLabel(L.framework),
4544
+ removeAriaLabel: removeModuleAriaLabel(L.framework),
4545
+ selectAriaLabel: selectModuleAriaLabel(L.framework)
4455
4546
  }
4456
4547
  ),
4457
4548
  /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-border bg-card", children: [
@@ -4475,17 +4566,14 @@ function MosaicAgentComposerMobile({
4475
4566
  selectedModel.pricingLabel
4476
4567
  ] })
4477
4568
  ] }) }),
4478
- /* @__PURE__ */ jsxs(
4569
+ /* @__PURE__ */ jsx(
4479
4570
  "button",
4480
4571
  {
4481
4572
  type: "button",
4482
4573
  onClick: onSelectModel,
4483
4574
  disabled: isLoading,
4484
4575
  className: "flex w-full min-h-[44px] items-center justify-center rounded-lg border border-border text-sm text-muted-foreground transition-colors hover:border-primary hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
4485
- children: [
4486
- "Change ",
4487
- L.model
4488
- ]
4576
+ children: changeModuleLabel(L.model)
4489
4577
  }
4490
4578
  )
4491
4579
  ] }) : /* @__PURE__ */ jsxs(
@@ -4494,12 +4582,11 @@ function MosaicAgentComposerMobile({
4494
4582
  type: "button",
4495
4583
  onClick: onSelectModel,
4496
4584
  disabled: isLoading,
4497
- "aria-label": `Select ${L.model}`,
4585
+ "aria-label": selectModuleAriaLabel(L.model),
4498
4586
  className: "flex w-full min-h-[64px] items-center justify-center gap-2 rounded-lg border border-dashed border-border text-sm text-muted-foreground transition-colors hover:border-primary hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
4499
4587
  children: [
4500
4588
  /* @__PURE__ */ jsx(PlusIcon2, {}),
4501
- "Select ",
4502
- L.model
4589
+ selectModuleAriaLabel(L.model)
4503
4590
  ]
4504
4591
  }
4505
4592
  ) })
@@ -6175,6 +6262,7 @@ function MosaicQuickAgentSelector({
6175
6262
  availableAgents = [],
6176
6263
  onAddAgent,
6177
6264
  onRemoveAgent,
6265
+ removeAgentAriaLabel,
6178
6266
  onOpenBuilder,
6179
6267
  maxAgents = 4,
6180
6268
  addLabel,
@@ -6235,7 +6323,7 @@ function MosaicQuickAgentSelector({
6235
6323
  "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
6236
6324
  isMobile ? "opacity-100" : "opacity-0 transition-opacity group-hover:opacity-100"
6237
6325
  ),
6238
- "aria-label": `Remove ${agent.name}`,
6326
+ "aria-label": removeAgentAriaLabel(agent.name),
6239
6327
  children: /* @__PURE__ */ jsx(XIcon, {})
6240
6328
  }
6241
6329
  )
@@ -9064,7 +9152,8 @@ function MosaicTemplatePreview({
9064
9152
  onSelect,
9065
9153
  onClose,
9066
9154
  selectLabel,
9067
- cancelLabel
9155
+ cancelLabel,
9156
+ formatAgentsHeading
9068
9157
  }) {
9069
9158
  return /* @__PURE__ */ jsxs("div", { "data-slot": "template-preview", className: "flex flex-col gap-4 p-4", children: [
9070
9159
  /* @__PURE__ */ jsxs("div", { children: [
@@ -9076,11 +9165,7 @@ function MosaicTemplatePreview({
9076
9165
  template.type && /* @__PURE__ */ jsx("span", { className: "rounded-md border border-border px-2 py-1 text-xs text-muted-foreground", children: template.type })
9077
9166
  ] }),
9078
9167
  template.agents && template.agents.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
9079
- /* @__PURE__ */ jsxs("p", { className: "mb-2 text-sm font-medium", children: [
9080
- "Agents (",
9081
- template.agents.length,
9082
- ")"
9083
- ] }),
9168
+ formatAgentsHeading && /* @__PURE__ */ jsx("p", { className: "mb-2 text-sm font-medium", children: formatAgentsHeading(template.agents.length) }),
9084
9169
  /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: template.agents.map((agent) => /* @__PURE__ */ jsxs(
9085
9170
  "div",
9086
9171
  {
@@ -9522,7 +9607,8 @@ function MosaicModuleForm(props) {
9522
9607
  namePlaceholder,
9523
9608
  descriptionPlaceholder,
9524
9609
  cancelLabel,
9525
- tagListAddPlaceholder
9610
+ tagListAddPlaceholder,
9611
+ removeTagAriaLabel
9526
9612
  } = props;
9527
9613
  const [formData, setFormData] = React30.useState({
9528
9614
  name: item?.name ?? "",
@@ -9694,7 +9780,7 @@ function MosaicModuleForm(props) {
9694
9780
  type: "button",
9695
9781
  onClick: () => removeTag(field.id, tag),
9696
9782
  className: "hover:text-destructive",
9697
- "aria-label": `Remove ${tag}`,
9783
+ "aria-label": removeTagAriaLabel?.(tag),
9698
9784
  children: /* @__PURE__ */ jsx(XIcon2, {})
9699
9785
  }
9700
9786
  )
@@ -9837,7 +9923,8 @@ function LibraryContent({
9837
9923
  deleteItemLabel,
9838
9924
  closeEditorAriaLabel,
9839
9925
  editModalTitle,
9840
- tagListAddPlaceholder
9926
+ tagListAddPlaceholder,
9927
+ removeTagAriaLabel
9841
9928
  }) {
9842
9929
  const [query, setQuery] = React30.useState("");
9843
9930
  const [activeTab, setActiveTab] = React30.useState(tabs?.[0]?.id ?? "all");
@@ -9951,6 +10038,7 @@ function LibraryContent({
9951
10038
  descriptionPlaceholder,
9952
10039
  cancelLabel,
9953
10040
  tagListAddPlaceholder,
10041
+ removeTagAriaLabel,
9954
10042
  ...editorMode === "edit" ? { mode: "edit", saveChangesLabel } : { mode: "create", createItemLabel }
9955
10043
  }
9956
10044
  )
@@ -9965,36 +10053,29 @@ MosaicModuleLibrary.displayName = "MosaicModuleLibrary";
9965
10053
  function cn69(...classes) {
9966
10054
  return classes.filter(Boolean).join(" ");
9967
10055
  }
9968
- var roleConfig = {
9969
- owner: {
9970
- label: "Owner",
9971
- className: "bg-primary text-primary-foreground",
9972
- description: "Full access including billing and organization deletion"
9973
- },
9974
- admin: {
9975
- label: "Admin",
9976
- className: "bg-secondary text-secondary-foreground",
9977
- description: "Full access to organization settings and member management"
9978
- },
9979
- member: {
9980
- label: "Member",
9981
- className: "bg-muted text-muted-foreground",
9982
- description: "Standard access to workspaces and content"
9983
- }
10056
+ var roleClassName = {
10057
+ owner: "bg-primary text-primary-foreground",
10058
+ admin: "bg-secondary text-secondary-foreground",
10059
+ member: "bg-muted text-muted-foreground"
9984
10060
  };
9985
- function MosaicOrgRoleBadge({ role, className }) {
9986
- const config = roleConfig[role] ?? roleConfig.member;
10061
+ function MosaicOrgRoleBadge({
10062
+ role,
10063
+ label,
10064
+ description,
10065
+ className
10066
+ }) {
10067
+ const config = roleClassName[role] ?? roleClassName.member;
9987
10068
  return /* @__PURE__ */ jsx(
9988
10069
  "span",
9989
10070
  {
9990
10071
  "data-slot": "org-role-badge",
9991
- title: config.description,
10072
+ title: description,
9992
10073
  className: cn69(
9993
10074
  "inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium",
9994
- config.className,
10075
+ config,
9995
10076
  className
9996
10077
  ),
9997
- children: config.label
10078
+ children: label
9998
10079
  }
9999
10080
  );
10000
10081
  }
@@ -10064,7 +10145,10 @@ function MosaicCreateOrgDialog({
10064
10145
  descriptionPlaceholder,
10065
10146
  cancelLabel,
10066
10147
  creatingLabel,
10067
- createLabel
10148
+ createLabel,
10149
+ nameRequiredMessage,
10150
+ slugRequiredMessage,
10151
+ slugFormatMessage
10068
10152
  }) {
10069
10153
  const [name, setName] = React30.useState("");
10070
10154
  const [slug, setSlug] = React30.useState("");
@@ -10072,10 +10156,9 @@ function MosaicCreateOrgDialog({
10072
10156
  const [errors, setErrors] = React30.useState({});
10073
10157
  const validate = () => {
10074
10158
  const errs = {};
10075
- if (!name.trim()) errs.name = "Name is required";
10076
- if (!slug.trim()) errs.slug = "Slug is required";
10077
- else if (!/^[a-z0-9-]+$/.test(slug))
10078
- errs.slug = "Slug: lowercase letters, numbers, hyphens only";
10159
+ if (!name.trim()) errs.name = true;
10160
+ if (!slug.trim()) errs.slug = "required";
10161
+ else if (!/^[a-z0-9-]+$/.test(slug)) errs.slug = "format";
10079
10162
  setErrors(errs);
10080
10163
  return Object.keys(errs).length === 0;
10081
10164
  };
@@ -10134,7 +10217,7 @@ function MosaicCreateOrgDialog({
10134
10217
  )
10135
10218
  }
10136
10219
  ),
10137
- errors.name && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: errors.name })
10220
+ errors.name && nameRequiredMessage && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: nameRequiredMessage })
10138
10221
  ] }),
10139
10222
  /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
10140
10223
  /* @__PURE__ */ jsx("label", { htmlFor: "org-slug", className: "text-sm font-medium", children: slugFieldLabel }),
@@ -10154,7 +10237,8 @@ function MosaicCreateOrgDialog({
10154
10237
  )
10155
10238
  }
10156
10239
  ),
10157
- errors.slug && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: errors.slug })
10240
+ errors.slug === "required" && slugRequiredMessage && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: slugRequiredMessage }),
10241
+ errors.slug === "format" && slugFormatMessage && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: slugFormatMessage })
10158
10242
  ] }),
10159
10243
  /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
10160
10244
  /* @__PURE__ */ jsx("label", { htmlFor: "org-desc", className: "text-sm font-medium", children: descriptionFieldLabel }),
@@ -10197,16 +10281,12 @@ function MosaicCreateOrgDialog({
10197
10281
  );
10198
10282
  }
10199
10283
  MosaicCreateOrgDialog.displayName = "MosaicCreateOrgDialog";
10200
- var DEFAULT_ROLES = [
10201
- { value: "admin", label: "Admin" },
10202
- { value: "member", label: "Member" }
10203
- ];
10204
10284
  function MosaicInviteMemberDialog({
10205
10285
  open,
10206
10286
  onOpenChange,
10207
10287
  onInvite,
10208
10288
  isLoading = false,
10209
- roles = DEFAULT_ROLES,
10289
+ roles,
10210
10290
  title,
10211
10291
  closeAriaLabel,
10212
10292
  emailFieldLabel,
@@ -10214,15 +10294,17 @@ function MosaicInviteMemberDialog({
10214
10294
  roleFieldLabel,
10215
10295
  cancelLabel,
10216
10296
  sendingLabel,
10217
- sendInvitationLabel
10297
+ sendInvitationLabel,
10298
+ emailRequiredMessage,
10299
+ emailInvalidMessage
10218
10300
  }) {
10219
10301
  const [email, setEmail] = React30.useState("");
10220
10302
  const [role, setRole] = React30.useState("member");
10221
10303
  const [errors, setErrors] = React30.useState({});
10222
10304
  const validate = () => {
10223
10305
  const errs = {};
10224
- if (!email.trim()) errs.email = "Email is required";
10225
- else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) errs.email = "Invalid email";
10306
+ if (!email.trim()) errs.email = "required";
10307
+ else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) errs.email = "invalid";
10226
10308
  setErrors(errs);
10227
10309
  return Object.keys(errs).length === 0;
10228
10310
  };
@@ -10267,7 +10349,8 @@ function MosaicInviteMemberDialog({
10267
10349
  )
10268
10350
  }
10269
10351
  ),
10270
- errors.email && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: errors.email })
10352
+ errors.email === "required" && emailRequiredMessage && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: emailRequiredMessage }),
10353
+ errors.email === "invalid" && emailInvalidMessage && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: emailInvalidMessage })
10271
10354
  ] }),
10272
10355
  /* @__PURE__ */ jsxs("div", { className: "space-y-1.5", children: [
10273
10356
  /* @__PURE__ */ jsx("label", { htmlFor: "invite-role", className: "text-sm font-medium", children: roleFieldLabel }),
@@ -10317,7 +10400,11 @@ function MemberRow({
10317
10400
  roles,
10318
10401
  youLabel,
10319
10402
  memberActionsAriaLabel,
10320
- removeMemberLabel
10403
+ removeMemberLabel,
10404
+ roleDescriptions,
10405
+ roleLabels,
10406
+ joinedLabel,
10407
+ makeRoleLabel
10321
10408
  }) {
10322
10409
  const [menuOpen, setMenuOpen] = React30.useState(false);
10323
10410
  const menuRef = React30.useRef(null);
@@ -10347,12 +10434,16 @@ function MemberRow({
10347
10434
  isSelf && /* @__PURE__ */ jsx("span", { className: "shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground", children: youLabel })
10348
10435
  ] }),
10349
10436
  /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground truncate", children: member.email }),
10350
- joinedDate && /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
10351
- "Joined ",
10352
- joinedDate
10353
- ] })
10437
+ joinedDate && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: joinedLabel(joinedDate) })
10354
10438
  ] }),
10355
- /* @__PURE__ */ jsx(MosaicOrgRoleBadge, { role: member.role }),
10439
+ /* @__PURE__ */ jsx(
10440
+ MosaicOrgRoleBadge,
10441
+ {
10442
+ role: member.role,
10443
+ label: roleLabels[member.role],
10444
+ description: roleDescriptions[member.role]
10445
+ }
10446
+ ),
10356
10447
  !isSelf && (onChangeRole || onRemoveMember) && /* @__PURE__ */ jsxs("div", { ref: menuRef, className: "relative shrink-0", children: [
10357
10448
  /* @__PURE__ */ jsx(
10358
10449
  "button",
@@ -10390,7 +10481,7 @@ function MemberRow({
10390
10481
  className: "absolute right-0 top-full z-50 mt-1 min-w-[160px] rounded-md border border-border bg-popover py-1 shadow-md",
10391
10482
  children: [
10392
10483
  onChangeRole && roles?.map(
10393
- (r) => r.value !== member.role && /* @__PURE__ */ jsxs(
10484
+ (r) => r.value !== member.role && /* @__PURE__ */ jsx(
10394
10485
  "button",
10395
10486
  {
10396
10487
  type: "button",
@@ -10400,10 +10491,7 @@ function MemberRow({
10400
10491
  setMenuOpen(false);
10401
10492
  },
10402
10493
  className: "flex w-full items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-accent hover:text-accent-foreground",
10403
- children: [
10404
- "Make ",
10405
- r.label
10406
- ]
10494
+ children: makeRoleLabel(r.label)
10407
10495
  },
10408
10496
  r.value
10409
10497
  )
@@ -10433,7 +10521,7 @@ function MosaicMemberList({
10433
10521
  onChangeRole,
10434
10522
  onRemoveMember,
10435
10523
  onInvite,
10436
- roles = DEFAULT_ROLES,
10524
+ roles,
10437
10525
  isLoading,
10438
10526
  searchPlaceholder,
10439
10527
  youLabel,
@@ -10441,6 +10529,10 @@ function MosaicMemberList({
10441
10529
  removeMemberLabel,
10442
10530
  emptyMessage,
10443
10531
  inviteLabel,
10532
+ roleDescriptions,
10533
+ roleLabels,
10534
+ joinedLabel,
10535
+ makeRoleLabel,
10444
10536
  className
10445
10537
  }) {
10446
10538
  const [query, setQuery] = React30.useState("");
@@ -10513,7 +10605,7 @@ function MosaicMemberList({
10513
10605
  }
10514
10606
  )
10515
10607
  ] }),
10516
- isLoading ? /* @__PURE__ */ jsx("div", { className: "space-y-3", children: [0, 1, 2].map((i) => /* @__PURE__ */ jsx("div", { className: "h-14 animate-pulse rounded-lg bg-muted" }, i)) }) : /* @__PURE__ */ jsxs("div", { className: "divide-y divide-border", children: [
10608
+ isLoading ? /* @__PURE__ */ jsx("div", { className: "space-y-3", children: ["skeleton-1", "skeleton-2", "skeleton-3"].map((skeletonId) => /* @__PURE__ */ jsx("div", { className: "h-14 animate-pulse rounded-lg bg-muted" }, skeletonId)) }) : /* @__PURE__ */ jsxs("div", { className: "divide-y divide-border", children: [
10517
10609
  filtered.map((member) => /* @__PURE__ */ jsx(
10518
10610
  MemberRow,
10519
10611
  {
@@ -10524,7 +10616,11 @@ function MosaicMemberList({
10524
10616
  roles,
10525
10617
  youLabel,
10526
10618
  memberActionsAriaLabel,
10527
- removeMemberLabel
10619
+ removeMemberLabel,
10620
+ roleDescriptions,
10621
+ roleLabels,
10622
+ joinedLabel,
10623
+ makeRoleLabel
10528
10624
  },
10529
10625
  member.id
10530
10626
  )),
@@ -10723,6 +10819,7 @@ function MosaicDashboardHeader({
10723
10819
  subtitle,
10724
10820
  notificationCount = 0,
10725
10821
  onNotificationsClick,
10822
+ notificationsAriaLabel,
10726
10823
  onSearchChange,
10727
10824
  actions,
10728
10825
  logoSlot,
@@ -10791,7 +10888,7 @@ function MosaicDashboardHeader({
10791
10888
  type: "button",
10792
10889
  onClick: onNotificationsClick,
10793
10890
  className: "relative inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
10794
- "aria-label": `Notifications${notificationCount > 0 ? ` (${notificationCount})` : ""}`,
10891
+ "aria-label": notificationsAriaLabel?.(notificationCount),
10795
10892
  children: [
10796
10893
  /* @__PURE__ */ jsx(BellIcon, {}),
10797
10894
  notificationCount > 0 && /* @__PURE__ */ jsx("span", { className: "absolute -right-1 -top-1 flex h-4 w-4 items-center justify-center rounded-full bg-primary text-[10px] font-bold text-primary-foreground", children: notificationCount > 9 ? "9+" : notificationCount })
@@ -12448,9 +12545,11 @@ function MosaicChatThread({
12448
12545
  children,
12449
12546
  scrollToBottomLabel,
12450
12547
  className,
12451
- ref
12548
+ ref,
12549
+ onVisibleRangeChange
12452
12550
  }) {
12453
12551
  const containerRef = useRef(null);
12552
+ const contentRef = useRef(null);
12454
12553
  const isAtBottomRef = useRef(true);
12455
12554
  const [isAtBottom, setIsAtBottom] = useState(true);
12456
12555
  function setRefs(node) {
@@ -12506,6 +12605,37 @@ function MosaicChatThread({
12506
12605
  document.removeEventListener("selectionchange", handleSelectionChange);
12507
12606
  };
12508
12607
  }, []);
12608
+ useEffect(() => {
12609
+ if (!onVisibleRangeChange) {
12610
+ return;
12611
+ }
12612
+ const content = contentRef.current;
12613
+ if (!content) {
12614
+ return;
12615
+ }
12616
+ const visibility = /* @__PURE__ */ new Map();
12617
+ const observer = new IntersectionObserver((entries) => {
12618
+ for (const entry of entries) {
12619
+ visibility.set(entry.target, entry.isIntersecting);
12620
+ }
12621
+ const visibleMessageIds = [];
12622
+ for (const child of Array.from(content.children)) {
12623
+ if (child.id && visibility.get(child)) {
12624
+ visibleMessageIds.push(child.id);
12625
+ }
12626
+ }
12627
+ onVisibleRangeChange({
12628
+ visibleMessageIds,
12629
+ currentAnchorId: visibleMessageIds[0] ?? null
12630
+ });
12631
+ });
12632
+ for (const child of Array.from(content.children)) {
12633
+ observer.observe(child);
12634
+ }
12635
+ return () => {
12636
+ observer.disconnect();
12637
+ };
12638
+ }, [children, onVisibleRangeChange]);
12509
12639
  useLayoutEffect(() => {
12510
12640
  const element = containerRef.current;
12511
12641
  if (element && isAtBottomRef.current) {
@@ -12522,7 +12652,7 @@ function MosaicChatThread({
12522
12652
  onKeyDown: handleKeyDown,
12523
12653
  className: cn80(chatThreadRootVariants(), className),
12524
12654
  children: [
12525
- /* @__PURE__ */ jsx("div", { "data-slot": "chat-thread-content", className: chatThreadContentVariants(), children }),
12655
+ /* @__PURE__ */ jsx("div", { ref: contentRef, "data-slot": "chat-thread-content", className: chatThreadContentVariants(), children }),
12526
12656
  !isAtBottom && /* @__PURE__ */ jsx(
12527
12657
  "button",
12528
12658
  {