@vantageos/mosaic-blocks 0.5.1-alpha → 0.5.6-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  ## 1. Hero & Positioning
12
12
 
13
- `@vantageos/mosaic-blocks` is the **React composed-block layer** of the VantageOS Mosaic design system. It provides 126 opinionated, fully-typed UI components that integrate natively with:
13
+ `@vantageos/mosaic-blocks` is the **React composed-block layer** of the VantageOS Mosaic design system. It provides 127 opinionated, fully-typed UI components that integrate natively with:
14
14
 
15
15
  - **Clerk** — auth sign-in/up flows, org switcher, RBAC, webhook sync
16
16
  - **Convex** — real-time data binding ready
@@ -169,7 +169,7 @@ For OKLCH design tokens, pair with `@vantageos/mosaic-tokens` — see [Section 1
169
169
 
170
170
  ## 6. Component Catalogue Summary
171
171
 
172
- 126 exported `Mosaic*` components across 9 sections (143 total named exports including hooks, variant helpers, and unprefixed aliases such as `Tooltip`/`Accordion`). This count is enforced by `src/__tests__/readme-matches-exports.test.ts` — it fails CI if this README drifts from `src/index.ts` again. Full reference: [docs/components-catalog.md](docs/components-catalog.md).
172
+ 127 exported `Mosaic*` components across 9 sections (144 total named exports including hooks, variant helpers, and unprefixed aliases such as `Tooltip`/`Accordion`). This count is enforced by `src/__tests__/readme-matches-exports.test.ts` — it fails CI if this README drifts from `src/index.ts` again. Full reference: [docs/components-catalog.md](docs/components-catalog.md).
173
173
 
174
174
  > There is **no "Debate" section**. No `Mosaic*` debate component (room/timer/participant) is exported by this package — despite the "absorbed from anydebate" origin story below, the debate UI was never ported. If you need debate-room UI, it does not exist here yet.
175
175
 
@@ -470,7 +470,7 @@ This package follows [Semantic Versioning](https://semver.org/). While in alpha
470
470
 
471
471
  | Version | Status | Notes |
472
472
  |---|---|---|
473
- | `0.5.1-alpha` | Current | 126 exported `Mosaic*` components, adds `MosaicChatThread` (presentational auto-scrolling chat thread), Clerk auth, mobile-first, Storybook 10, 30 stories |
473
+ | `0.5.6-alpha` | Current | 127 exported `Mosaic*` components, adds `MosaicChatThread` (presentational auto-scrolling chat thread) and `MosaicChatComposer` (chat input + send/stop button), Clerk auth, mobile-first, Storybook 10, 30 stories |
474
474
  | `0.4.8-alpha` | Historical | 125 shipped `Mosaic*` components — superseded by the Current row above |
475
475
  | `0.4.7-alpha` | Historical | 124 shipped `Mosaic*` components — superseded by the Current row above |
476
476
  | `0.2.0-alpha` | Historical | anydebate absorb (partial) — counts quoted for this release are historical and superseded by the Current row above; see [CHANGELOG.md](CHANGELOG.md) |
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.1-alpha";
49
+ var version = "0.5.6-alpha";
50
50
  function Placeholder({ label = "mosaic-blocks placeholder" }) {
51
51
  return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-mosaic-block": "placeholder", children: label });
52
52
  }
@@ -11560,6 +11560,128 @@ function MosaicChatThread({
11560
11560
  );
11561
11561
  }
11562
11562
  MosaicChatThread.displayName = "MosaicChatThread";
11563
+ var chatComposerRootVariants = classVarianceAuthority.cva([
11564
+ "min-w-0 rounded-[14px] border border-border bg-card shadow-sm transition-colors",
11565
+ "focus-within:ring-[1px] focus-within:ring-ring"
11566
+ ]);
11567
+ var chatComposerTextareaVariants = classVarianceAuthority.cva([
11568
+ "max-h-40 min-h-12 w-full resize-none bg-transparent px-3 pt-3 pb-1 text-sm outline-none",
11569
+ "placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-60"
11570
+ ]);
11571
+ var chatComposerActionButtonVariants = classVarianceAuthority.cva(
11572
+ ["inline-flex size-7 shrink-0 items-center justify-center rounded-md transition-colors"],
11573
+ {
11574
+ variants: {
11575
+ tone: {
11576
+ send: "bg-foreground text-background hover:bg-foreground/90 disabled:cursor-not-allowed disabled:opacity-30",
11577
+ stop: "cursor-pointer bg-foreground/15 text-foreground hover:bg-foreground/25"
11578
+ }
11579
+ },
11580
+ defaultVariants: {
11581
+ tone: "send"
11582
+ }
11583
+ }
11584
+ );
11585
+ function cn74(...classes) {
11586
+ return classes.filter(Boolean).join(" ");
11587
+ }
11588
+ function MosaicChatComposer(props) {
11589
+ const {
11590
+ value,
11591
+ onValueChange,
11592
+ textareaAriaLabel,
11593
+ placeholder,
11594
+ disabled = false,
11595
+ className,
11596
+ ref
11597
+ } = props;
11598
+ const textareaRef = React28.useRef(null);
11599
+ const trimmedValue = value.trim();
11600
+ React28.useEffect(() => {
11601
+ const textarea = textareaRef.current;
11602
+ if (!textarea) {
11603
+ return;
11604
+ }
11605
+ textarea.style.height = "auto";
11606
+ textarea.style.height = `${textarea.scrollHeight}px`;
11607
+ }, [value]);
11608
+ const submitValue = React28.useCallback(() => {
11609
+ if (props.status !== "idle") {
11610
+ return;
11611
+ }
11612
+ const text = value.trim();
11613
+ if (!text || disabled) {
11614
+ return;
11615
+ }
11616
+ props.onSubmit(text);
11617
+ }, [disabled, props, value]);
11618
+ const handleSubmit = React28.useCallback(
11619
+ (event) => {
11620
+ event.preventDefault();
11621
+ submitValue();
11622
+ },
11623
+ [submitValue]
11624
+ );
11625
+ const handleKeyDown = React28.useCallback(
11626
+ (event) => {
11627
+ if (event.key === "Enter" && !event.shiftKey) {
11628
+ event.preventDefault();
11629
+ submitValue();
11630
+ }
11631
+ },
11632
+ [submitValue]
11633
+ );
11634
+ const currentActionLabel = props.status === "responding" ? props.stopButtonAriaLabel : props.sendButtonAriaLabel;
11635
+ return /* @__PURE__ */ jsxRuntime.jsxs(
11636
+ "form",
11637
+ {
11638
+ ref,
11639
+ "data-slot": "chat-composer",
11640
+ className: cn74(chatComposerRootVariants(), className),
11641
+ onSubmit: handleSubmit,
11642
+ children: [
11643
+ /* @__PURE__ */ jsxRuntime.jsx(
11644
+ "textarea",
11645
+ {
11646
+ "data-slot": "chat-composer-input",
11647
+ "aria-label": textareaAriaLabel,
11648
+ className: chatComposerTextareaVariants(),
11649
+ disabled,
11650
+ onChange: (event) => onValueChange(event.target.value),
11651
+ onKeyDown: handleKeyDown,
11652
+ placeholder,
11653
+ ref: textareaRef,
11654
+ rows: 1,
11655
+ value
11656
+ }
11657
+ ),
11658
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-h-9 items-center justify-end gap-2 px-3 pt-1 pb-2", children: props.status === "responding" ? /* @__PURE__ */ jsxRuntime.jsx(
11659
+ "button",
11660
+ {
11661
+ "aria-label": props.stopButtonAriaLabel,
11662
+ className: chatComposerActionButtonVariants({ tone: "stop" }),
11663
+ "data-slot": "chat-composer-stop-button",
11664
+ onClick: props.onStop,
11665
+ type: "button",
11666
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: "\u25A0" })
11667
+ }
11668
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
11669
+ "button",
11670
+ {
11671
+ "aria-label": props.sendButtonAriaLabel,
11672
+ className: chatComposerActionButtonVariants({ tone: "send" }),
11673
+ "data-slot": "chat-composer-send-button",
11674
+ disabled: disabled || trimmedValue.length === 0,
11675
+ type: "submit",
11676
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: "\u2191" })
11677
+ }
11678
+ ) }),
11679
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-live": "polite", className: "sr-only", "data-slot": "chat-composer-status-announcer", children: currentActionLabel })
11680
+ ]
11681
+ }
11682
+ );
11683
+ }
11684
+ MosaicChatComposer.displayName = "MosaicChatComposer";
11563
11685
 
11564
11686
  Object.defineProperty(exports, "Accordion", {
11565
11687
  enumerable: true,
@@ -11598,6 +11720,7 @@ exports.MosaicCardDescription = MosaicCardDescription;
11598
11720
  exports.MosaicCardFooter = MosaicCardFooter;
11599
11721
  exports.MosaicCardHeader = MosaicCardHeader;
11600
11722
  exports.MosaicCardTitle = MosaicCardTitle;
11723
+ exports.MosaicChatComposer = MosaicChatComposer;
11601
11724
  exports.MosaicChatThread = MosaicChatThread;
11602
11725
  exports.MosaicCheckbox = MosaicCheckbox;
11603
11726
  exports.MosaicClerkOrgSwitcher = MosaicClerkOrgSwitcher;