reifyui 0.15.1 → 0.16.0
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/agent-chat.cjs +607 -5
- package/dist/agent-chat.cjs.map +1 -1
- package/dist/agent-chat.d.ts +34 -0
- package/dist/agent-chat.js +93 -2
- package/dist/agent-chat.js.map +1 -1
- package/dist/{chunk-S46J7CLH.js → chunk-4SVQGVJH.js} +415 -4
- package/dist/chunk-4SVQGVJH.js.map +1 -0
- package/dist/{chunk-WAND7AYD.js → chunk-QCISEB67.js} +103 -2
- package/dist/chunk-QCISEB67.js.map +1 -0
- package/dist/chunk-SPLQ7T6F.js +76 -0
- package/dist/chunk-SPLQ7T6F.js.map +1 -0
- package/dist/graph.js +4 -3
- package/dist/graph.js.map +1 -1
- package/dist/index.cjs +144 -79
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +176 -512
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/agent-chat/artifacts.jsx +55 -0
- package/src/agent-chat/components.jsx +6 -1
- package/src/agent-chat/index.d.ts +34 -0
- package/src/agent-chat/index.js +5 -0
- package/src/components/FileCard.jsx +17 -2
- package/src/components/FilePreview.jsx +15 -1
- package/styles/agent-chat.css +18 -0
- package/styles/file.css +2 -0
- package/dist/chunk-AGSX5YKH.js +0 -177
- package/dist/chunk-AGSX5YKH.js.map +0 -1
- package/dist/chunk-S46J7CLH.js.map +0 -1
- package/dist/chunk-WAND7AYD.js.map +0 -1
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IcX
|
|
3
|
+
} from "./chunk-QCISEB67.js";
|
|
4
|
+
import {
|
|
5
|
+
useOverlayEscape
|
|
6
|
+
} from "./chunk-J633KV57.js";
|
|
7
|
+
|
|
8
|
+
// src/components/Modal.jsx
|
|
9
|
+
import React, { useCallback, useEffect, useId } from "react";
|
|
10
|
+
import { createPortal } from "react-dom";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
function Modal(props) {
|
|
13
|
+
const {
|
|
14
|
+
open,
|
|
15
|
+
onClose,
|
|
16
|
+
title,
|
|
17
|
+
description,
|
|
18
|
+
actions,
|
|
19
|
+
size = "md",
|
|
20
|
+
width,
|
|
21
|
+
labelledBy,
|
|
22
|
+
children,
|
|
23
|
+
classNames = {}
|
|
24
|
+
} = props;
|
|
25
|
+
const titleId = useId();
|
|
26
|
+
const escape = useCallback(() => onClose?.(), [onClose]);
|
|
27
|
+
useOverlayEscape(open, escape);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!open || typeof document === "undefined") return void 0;
|
|
30
|
+
const prev = document.body.style.overflow;
|
|
31
|
+
document.body.style.overflow = "hidden";
|
|
32
|
+
return () => {
|
|
33
|
+
document.body.style.overflow = prev;
|
|
34
|
+
};
|
|
35
|
+
}, [open]);
|
|
36
|
+
if (!open || typeof document === "undefined") return null;
|
|
37
|
+
const onBackdrop = (e) => {
|
|
38
|
+
if (e.target === e.currentTarget) onClose?.();
|
|
39
|
+
};
|
|
40
|
+
return createPortal(
|
|
41
|
+
/* @__PURE__ */ jsx(
|
|
42
|
+
"div",
|
|
43
|
+
{
|
|
44
|
+
className: ["uic-modal-backdrop", classNames.backdrop || ""].filter(Boolean).join(" "),
|
|
45
|
+
onMouseDown: onBackdrop,
|
|
46
|
+
children: /* @__PURE__ */ jsxs(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
className: ["uic-modal", `is-${size}`, classNames.root || ""].filter(Boolean).join(" "),
|
|
50
|
+
style: width ? { width } : void 0,
|
|
51
|
+
role: "dialog",
|
|
52
|
+
"aria-modal": "true",
|
|
53
|
+
"aria-labelledby": labelledBy || (title ? titleId : void 0),
|
|
54
|
+
children: [
|
|
55
|
+
title || actions ? /* @__PURE__ */ jsxs("div", { className: "uic-modal-h", children: [
|
|
56
|
+
/* @__PURE__ */ jsxs("div", { className: "uic-modal-title", children: [
|
|
57
|
+
title ? /* @__PURE__ */ jsx("h3", { id: titleId, children: title }) : null,
|
|
58
|
+
description ? /* @__PURE__ */ jsx("p", { children: description }) : null
|
|
59
|
+
] }),
|
|
60
|
+
actions,
|
|
61
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "uic-modal-x", "aria-label": "Close", onClick: onClose, children: /* @__PURE__ */ jsx(IcX, { size: 18 }) })
|
|
62
|
+
] }) : null,
|
|
63
|
+
/* @__PURE__ */ jsx("div", { className: ["uic-modal-b", classNames.body || ""].filter(Boolean).join(" "), children })
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
),
|
|
69
|
+
document.body
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export {
|
|
74
|
+
Modal
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=chunk-SPLQ7T6F.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Modal.jsx"],"sourcesContent":["// Modal — a dialog whose body is yours: a preview, a big form, a comparison.\n//\n// useDialog() answers a QUESTION and resolves to a value (confirm/prompt/alert). This is the\n// other half: a surface with arbitrary content that the caller opens and closes itself. Products\n// were re-implementing it per feature, each with its own backdrop mousedown handler and its own\n// document keydown listener.\n//\n// It shares the dialog host's Escape ordering through the package's overlay stack (components/\n// overlay.js), so a Modal opened on top of a confirm takes the key and the confirm does not, and\n// both sit at the same z-index layer (--uic-z-overlay). It does NOT render inside DialogHost's\n// portal: that root is created from the host's private state and only exists while a dialog is\n// open, so there is nothing to render into and no API to reach it with. One stack, two roots, is\n// the honest arrangement — and it means Modal works in an app that never mounted DialogHost.\nimport React, { useCallback, useEffect, useId } from 'react';\nimport { createPortal } from 'react-dom';\nimport { IcX } from './icons.jsx';\nimport { useOverlayEscape } from './overlay.js';\n\n/**\n * open render it\n * onClose Escape, the ✕, or a click on the backdrop itself\n * title the heading (string or node); also names the dialog for assistive tech\n * description one quiet line under the title\n * actions buttons in the header, before the ✕ (e.g. \"Use this template\")\n * size 'sm' | 'md' | 'lg' | 'full' — or pass `width` for an exact px/any CSS width\n * labelledBy id of your own heading, when `title` is not where the name lives\n */\nexport function Modal(props) {\n const { open, onClose, title, description, actions, size = 'md', width,\n labelledBy, children, classNames = {} } = props;\n const titleId = useId();\n\n const escape = useCallback(() => onClose?.(), [onClose]);\n useOverlayEscape(open, escape);\n\n // A modal that leaves the page scrolling behind it drifts under the reader's fingers on a\n // touch device and loses their place in the list they opened it from.\n useEffect(() => {\n if (!open || typeof document === 'undefined') return undefined;\n const prev = document.body.style.overflow;\n document.body.style.overflow = 'hidden';\n return () => { document.body.style.overflow = prev; };\n }, [open]);\n\n if (!open || typeof document === 'undefined') return null;\n // mousedown, not click: a press that STARTED inside the card and ended on the backdrop (a drag\n // that overshot, a text selection) would otherwise close it out from under the person.\n const onBackdrop = (e) => { if (e.target === e.currentTarget) onClose?.(); };\n return createPortal(\n <div className={['uic-modal-backdrop', classNames.backdrop || ''].filter(Boolean).join(' ')}\n onMouseDown={onBackdrop}>\n <div className={['uic-modal', `is-${size}`, classNames.root || ''].filter(Boolean).join(' ')}\n style={width ? { width } : undefined}\n role=\"dialog\" aria-modal=\"true\"\n aria-labelledby={labelledBy || (title ? titleId : undefined)}>\n {(title || actions) ? (\n <div className=\"uic-modal-h\">\n <div className=\"uic-modal-title\">\n {title ? <h3 id={titleId}>{title}</h3> : null}\n {description ? <p>{description}</p> : null}\n </div>\n {actions}\n <button type=\"button\" className=\"uic-modal-x\" aria-label=\"Close\" onClick={onClose}>\n <IcX size={18} />\n </button>\n </div>\n ) : null}\n <div className={['uic-modal-b', classNames.body || ''].filter(Boolean).join(' ')}>\n {children}\n </div>\n </div>\n </div>,\n document.body,\n );\n}\n"],"mappings":";;;;;;;;AAaA,OAAO,SAAS,aAAa,WAAW,aAAa;AACrD,SAAS,oBAAoB;AA2CjB,SACW,KADX;AA9BL,SAAS,MAAM,OAAO;AAC3B,QAAM;AAAA,IAAE;AA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