@vantageos/mosaic-blocks 0.4.9-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 +4 -3
- package/dist/index.cjs +206 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +209 -2
- package/dist/index.d.ts +209 -2
- package/dist/index.js +206 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
|
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
|
-
|
|
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,8 @@ This package follows [Semantic Versioning](https://semver.org/). While in alpha
|
|
|
470
470
|
|
|
471
471
|
| Version | Status | Notes |
|
|
472
472
|
|---|---|---|
|
|
473
|
-
| `0.
|
|
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
|
+
| `0.4.8-alpha` | Historical | 125 shipped `Mosaic*` components — superseded by the Current row above |
|
|
474
475
|
| `0.4.7-alpha` | Historical | 124 shipped `Mosaic*` components — superseded by the Current row above |
|
|
475
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) |
|
|
476
477
|
| `0.1.0-alpha.1` | Historical | Initial alpha publish |
|
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.
|
|
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
|
}
|
|
@@ -11479,6 +11479,209 @@ function MosaicUrlScraper(props) {
|
|
|
11479
11479
|
] });
|
|
11480
11480
|
}
|
|
11481
11481
|
MosaicUrlScraper.displayName = "MosaicUrlScraper";
|
|
11482
|
+
var chatThreadRootVariants = classVarianceAuthority.cva([
|
|
11483
|
+
"relative flex min-h-0 flex-1 flex-col overflow-y-auto"
|
|
11484
|
+
]);
|
|
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"
|
|
11487
|
+
]);
|
|
11488
|
+
var chatThreadScrollButtonVariants = classVarianceAuthority.cva([
|
|
11489
|
+
"absolute bottom-4 left-1/2 -translate-x-1/2 inline-flex size-9",
|
|
11490
|
+
"items-center justify-center rounded-full border border-border bg-card text-foreground shadow-sm",
|
|
11491
|
+
"transition-colors hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
11492
|
+
]);
|
|
11493
|
+
function cn73(...classes) {
|
|
11494
|
+
return classes.filter(Boolean).join(" ");
|
|
11495
|
+
}
|
|
11496
|
+
var BOTTOM_THRESHOLD_PX = 24;
|
|
11497
|
+
function isNearBottom(element) {
|
|
11498
|
+
return element.scrollHeight - element.scrollTop - element.clientHeight <= BOTTOM_THRESHOLD_PX;
|
|
11499
|
+
}
|
|
11500
|
+
function MosaicChatThread({
|
|
11501
|
+
children,
|
|
11502
|
+
scrollToBottomLabel,
|
|
11503
|
+
className,
|
|
11504
|
+
ref
|
|
11505
|
+
}) {
|
|
11506
|
+
const containerRef = React28.useRef(null);
|
|
11507
|
+
const isAtBottomRef = React28.useRef(true);
|
|
11508
|
+
const [isAtBottom, setIsAtBottom] = React28.useState(true);
|
|
11509
|
+
function setRefs(node) {
|
|
11510
|
+
containerRef.current = node;
|
|
11511
|
+
if (typeof ref === "function") {
|
|
11512
|
+
ref(node);
|
|
11513
|
+
} else if (ref) {
|
|
11514
|
+
ref.current = node;
|
|
11515
|
+
}
|
|
11516
|
+
}
|
|
11517
|
+
function handleScroll(event) {
|
|
11518
|
+
const atBottom = isNearBottom(event.currentTarget);
|
|
11519
|
+
isAtBottomRef.current = atBottom;
|
|
11520
|
+
setIsAtBottom(atBottom);
|
|
11521
|
+
}
|
|
11522
|
+
function handleScrollToBottomClick() {
|
|
11523
|
+
const element = containerRef.current;
|
|
11524
|
+
if (!element) {
|
|
11525
|
+
return;
|
|
11526
|
+
}
|
|
11527
|
+
element.scrollTop = element.scrollHeight;
|
|
11528
|
+
isAtBottomRef.current = true;
|
|
11529
|
+
setIsAtBottom(true);
|
|
11530
|
+
}
|
|
11531
|
+
React28.useLayoutEffect(() => {
|
|
11532
|
+
const element = containerRef.current;
|
|
11533
|
+
if (element && isAtBottomRef.current) {
|
|
11534
|
+
element.scrollTop = element.scrollHeight;
|
|
11535
|
+
}
|
|
11536
|
+
}, [children]);
|
|
11537
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11538
|
+
"div",
|
|
11539
|
+
{
|
|
11540
|
+
ref: setRefs,
|
|
11541
|
+
"data-slot": "chat-thread",
|
|
11542
|
+
role: "log",
|
|
11543
|
+
onScroll: handleScroll,
|
|
11544
|
+
className: cn73(chatThreadRootVariants(), className),
|
|
11545
|
+
children: [
|
|
11546
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "chat-thread-content", className: chatThreadContentVariants(), children }),
|
|
11547
|
+
!isAtBottom && /* @__PURE__ */ jsxRuntime.jsx(
|
|
11548
|
+
"button",
|
|
11549
|
+
{
|
|
11550
|
+
type: "button",
|
|
11551
|
+
"data-slot": "chat-thread-scroll-button",
|
|
11552
|
+
"aria-label": scrollToBottomLabel,
|
|
11553
|
+
onClick: handleScrollToBottomClick,
|
|
11554
|
+
className: chatThreadScrollButtonVariants(),
|
|
11555
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: "\u2193" })
|
|
11556
|
+
}
|
|
11557
|
+
)
|
|
11558
|
+
]
|
|
11559
|
+
}
|
|
11560
|
+
);
|
|
11561
|
+
}
|
|
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";
|
|
11482
11685
|
|
|
11483
11686
|
Object.defineProperty(exports, "Accordion", {
|
|
11484
11687
|
enumerable: true,
|
|
@@ -11517,6 +11720,8 @@ exports.MosaicCardDescription = MosaicCardDescription;
|
|
|
11517
11720
|
exports.MosaicCardFooter = MosaicCardFooter;
|
|
11518
11721
|
exports.MosaicCardHeader = MosaicCardHeader;
|
|
11519
11722
|
exports.MosaicCardTitle = MosaicCardTitle;
|
|
11723
|
+
exports.MosaicChatComposer = MosaicChatComposer;
|
|
11724
|
+
exports.MosaicChatThread = MosaicChatThread;
|
|
11520
11725
|
exports.MosaicCheckbox = MosaicCheckbox;
|
|
11521
11726
|
exports.MosaicClerkOrgSwitcher = MosaicClerkOrgSwitcher;
|
|
11522
11727
|
exports.MosaicClerkWebhookHandler = MosaicClerkWebhookHandler;
|