reifyui 0.6.2 → 0.7.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/index.cjs +507 -89
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +495 -77
- package/dist/index.js.map +1 -1
- package/package.json +6 -2
- package/src/components/FileCard.jsx +64 -0
- package/src/components/FilePreview.jsx +207 -0
- package/src/components/FileTypeIcon.jsx +48 -0
- package/src/components/form.jsx +82 -0
- package/src/components/icons.jsx +2 -0
- package/src/index.js +9 -1
- package/src/sheet/SheetGrid.jsx +1 -2
- package/styles/file.css +129 -0
- package/styles/form.css +65 -0
- package/styles/sheet.css +5 -1
package/dist/index.js
CHANGED
|
@@ -182,6 +182,15 @@ var IcPanelRight = ({ size = 17 }) => /* @__PURE__ */ jsxs(Svg, { s: size, child
|
|
|
182
182
|
/* @__PURE__ */ jsx("rect", { x: "3", y: "4", width: "18", height: "16", rx: "2" }),
|
|
183
183
|
/* @__PURE__ */ jsx("path", { d: "M15 4v16" })
|
|
184
184
|
] });
|
|
185
|
+
var IcDownload = ({ size = 16 }) => /* @__PURE__ */ jsxs(Svg, { s: size, children: [
|
|
186
|
+
/* @__PURE__ */ jsx("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
187
|
+
/* @__PURE__ */ jsx("path", { d: "M7 10l5 5 5-5" }),
|
|
188
|
+
/* @__PURE__ */ jsx("path", { d: "M12 15V3" })
|
|
189
|
+
] });
|
|
190
|
+
var IcEye = ({ size = 15 }) => /* @__PURE__ */ jsxs(Svg, { s: size, children: [
|
|
191
|
+
/* @__PURE__ */ jsx("path", { d: "M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7-10-7-10-7z" }),
|
|
192
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "3" })
|
|
193
|
+
] });
|
|
185
194
|
|
|
186
195
|
// src/components/toolMeta.js
|
|
187
196
|
function humanize(s) {
|
|
@@ -1118,8 +1127,8 @@ function canonicalLang(tag) {
|
|
|
1118
1127
|
var _ready = /* @__PURE__ */ new Map();
|
|
1119
1128
|
function ensureLanguage(name) {
|
|
1120
1129
|
if (!_ready.has(name)) {
|
|
1121
|
-
const p = Promise.all([loadHljs(), GRAMMARS[name]()]).then(([hljs,
|
|
1122
|
-
if (!hljs.getLanguage(name)) hljs.registerLanguage(name,
|
|
1130
|
+
const p = Promise.all([loadHljs(), GRAMMARS[name]()]).then(([hljs, mod2]) => {
|
|
1131
|
+
if (!hljs.getLanguage(name)) hljs.registerLanguage(name, mod2.default || mod2);
|
|
1123
1132
|
return hljs;
|
|
1124
1133
|
}).catch(() => null);
|
|
1125
1134
|
_ready.set(name, p);
|
|
@@ -1573,7 +1582,7 @@ function PromptBody({ spec, onClose, t, titleId }) {
|
|
|
1573
1582
|
const [value, setValue] = useState5(spec.defaultValue ?? "");
|
|
1574
1583
|
const [err, setErr] = useState5(null);
|
|
1575
1584
|
const inputId = useId();
|
|
1576
|
-
const
|
|
1585
|
+
const Field2 = spec.multiline ? "textarea" : "input";
|
|
1577
1586
|
const submit = () => {
|
|
1578
1587
|
const invalid = spec.validate?.(value);
|
|
1579
1588
|
if (invalid) {
|
|
@@ -1592,7 +1601,7 @@ function PromptBody({ spec, onClose, t, titleId }) {
|
|
|
1592
1601
|
spec.message ? /* @__PURE__ */ jsx10("div", { className: "rui-dlg-msg", children: spec.message }) : null,
|
|
1593
1602
|
spec.label ? /* @__PURE__ */ jsx10("label", { className: "rui-dlg-label", htmlFor: inputId, children: spec.label }) : null,
|
|
1594
1603
|
/* @__PURE__ */ jsx10(
|
|
1595
|
-
|
|
1604
|
+
Field2,
|
|
1596
1605
|
{
|
|
1597
1606
|
id: inputId,
|
|
1598
1607
|
className: `rui-dlg-input${err ? " is-err" : ""}`,
|
|
@@ -1904,7 +1913,7 @@ var GOOGLE_ENABLED = !!CLIENT_ID;
|
|
|
1904
1913
|
|
|
1905
1914
|
// src/auth/AuthForm.jsx
|
|
1906
1915
|
import { Fragment as Fragment7, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1907
|
-
function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
1916
|
+
function AuthForm({ onDone, subtitle: subtitle2, brand = null, productName = "" }) {
|
|
1908
1917
|
const [mode, setMode] = useState7("signin");
|
|
1909
1918
|
const [email, setEmail] = useState7("");
|
|
1910
1919
|
const [password, setPassword] = useState7("");
|
|
@@ -1980,7 +1989,7 @@ function AuthForm({ onDone, subtitle, brand = null, productName = "" }) {
|
|
|
1980
1989
|
return /* @__PURE__ */ jsxs11("form", { onSubmit: submit, children: [
|
|
1981
1990
|
/* @__PURE__ */ jsx12("div", { className: "logo", children: brand }),
|
|
1982
1991
|
/* @__PURE__ */ jsx12("h1", { children: mode === "register" ? "Create your account" : mode === "forgot" ? "Reset password" : "Sign in" }),
|
|
1983
|
-
/* @__PURE__ */ jsx12("p", { className: "sub", children: mode === "register" ? "Get started in seconds." : mode === "forgot" ? "We will email you a reset link." :
|
|
1992
|
+
/* @__PURE__ */ jsx12("p", { className: "sub", children: mode === "register" ? "Get started in seconds." : mode === "forgot" ? "We will email you a reset link." : subtitle2 || "Welcome back." }),
|
|
1984
1993
|
mode === "forgot" ? resetSent ? /* @__PURE__ */ jsxs11(Fragment7, { children: [
|
|
1985
1994
|
/* @__PURE__ */ jsxs11("div", { className: "auth-note", children: [
|
|
1986
1995
|
"If an account exists for ",
|
|
@@ -2609,29 +2618,22 @@ function SheetGrid({
|
|
|
2609
2618
|
)
|
|
2610
2619
|
] }),
|
|
2611
2620
|
peer && /* @__PURE__ */ jsx13("span", { className: "shg-peer-flag", style: { background: peer.color }, children: peer.name }),
|
|
2612
|
-
isEditing ? renderEditor(col) : /* @__PURE__ */ jsx13(
|
|
2613
|
-
|
|
2614
|
-
{
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
},
|
|
2629
|
-
children: "\u25B6"
|
|
2630
|
-
}
|
|
2631
|
-
)
|
|
2632
|
-
] })
|
|
2633
|
-
}
|
|
2634
|
-
)
|
|
2621
|
+
isEditing ? renderEditor(col) : /* @__PURE__ */ jsx13("div", { className: "shg-val", children: custom !== void 0 ? custom : /* @__PURE__ */ jsxs12(Fragment8, { children: [
|
|
2622
|
+
computed && /* @__PURE__ */ jsx13(StatusDot, { status: c.status }),
|
|
2623
|
+
/* @__PURE__ */ jsx13(CellValue, { cell: c, col, fetchBlobUrl, onOpenResource }),
|
|
2624
|
+
computed && !readOnly && onRunCell && /* @__PURE__ */ jsx13(
|
|
2625
|
+
"button",
|
|
2626
|
+
{
|
|
2627
|
+
className: "shg-runcell",
|
|
2628
|
+
title: "Run this cell",
|
|
2629
|
+
onClick: (e) => {
|
|
2630
|
+
e.stopPropagation();
|
|
2631
|
+
onRunCell(row.id, col.id);
|
|
2632
|
+
},
|
|
2633
|
+
children: "\u25B6"
|
|
2634
|
+
}
|
|
2635
|
+
)
|
|
2636
|
+
] }) })
|
|
2635
2637
|
]
|
|
2636
2638
|
},
|
|
2637
2639
|
col.id
|
|
@@ -2876,14 +2878,418 @@ function sheetToAoA(sheet, { cellText = defaultCellValue } = {}) {
|
|
|
2876
2878
|
];
|
|
2877
2879
|
}
|
|
2878
2880
|
|
|
2881
|
+
// src/components/FileTypeIcon.jsx
|
|
2882
|
+
import { useEffect as useEffect9, useState as useState9 } from "react";
|
|
2883
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
2884
|
+
function extOf(name) {
|
|
2885
|
+
const m = String(name || "").toLowerCase().match(/\.([a-z0-9]+)$/);
|
|
2886
|
+
return m ? m[1] : "";
|
|
2887
|
+
}
|
|
2888
|
+
var mod = null;
|
|
2889
|
+
var tried = false;
|
|
2890
|
+
function FileTypeIcon({ name, size = 36 }) {
|
|
2891
|
+
const [, force] = useState9(0);
|
|
2892
|
+
const ext = extOf(name);
|
|
2893
|
+
useEffect9(() => {
|
|
2894
|
+
if (tried || mod) return;
|
|
2895
|
+
tried = true;
|
|
2896
|
+
import("react-file-icon").then((m) => {
|
|
2897
|
+
mod = m;
|
|
2898
|
+
force((n) => n + 1);
|
|
2899
|
+
}).catch(() => {
|
|
2900
|
+
});
|
|
2901
|
+
}, []);
|
|
2902
|
+
const box = { width: size, height: Math.round(size * 1.16), display: "inline-block", flex: "0 0 auto" };
|
|
2903
|
+
if (!mod) {
|
|
2904
|
+
return /* @__PURE__ */ jsx14("span", { className: "uic-fileglyph", style: box, "aria-hidden": "true", children: /* @__PURE__ */ jsx14("span", { className: "uic-fileglyph-ext", children: (ext || "file").slice(0, 4) }) });
|
|
2905
|
+
}
|
|
2906
|
+
const { FileIcon, defaultStyles } = mod;
|
|
2907
|
+
const style = defaultStyles?.[ext] || {};
|
|
2908
|
+
return /* @__PURE__ */ jsx14("span", { style: box, children: /* @__PURE__ */ jsx14(FileIcon, { extension: ext || void 0, ...style }) });
|
|
2909
|
+
}
|
|
2910
|
+
|
|
2911
|
+
// src/components/FileCard.jsx
|
|
2912
|
+
import { Fragment as Fragment9 } from "react";
|
|
2913
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2914
|
+
function subtitle(name, origin, bytes) {
|
|
2915
|
+
const parts = [(extOf(name) || "file").toUpperCase()];
|
|
2916
|
+
if (origin) parts.push(origin);
|
|
2917
|
+
if (bytes != null) parts.push(bytesLabel2(bytes));
|
|
2918
|
+
return parts.join(" \xB7 ");
|
|
2919
|
+
}
|
|
2920
|
+
function bytesLabel2(n) {
|
|
2921
|
+
if (n == null) return "";
|
|
2922
|
+
if (n < 1024) return `${n} B`;
|
|
2923
|
+
if (n < 1048576) return `${Math.round(n / 1024)} KB`;
|
|
2924
|
+
return `${(n / 1048576).toFixed(1)} MB`;
|
|
2925
|
+
}
|
|
2926
|
+
function FileCard({
|
|
2927
|
+
name,
|
|
2928
|
+
origin,
|
|
2929
|
+
bytes,
|
|
2930
|
+
onPreview,
|
|
2931
|
+
onDownload,
|
|
2932
|
+
compact = false,
|
|
2933
|
+
className = ""
|
|
2934
|
+
}) {
|
|
2935
|
+
const open = onPreview ? (e) => {
|
|
2936
|
+
e.stopPropagation();
|
|
2937
|
+
onPreview();
|
|
2938
|
+
} : void 0;
|
|
2939
|
+
return /* @__PURE__ */ jsxs13(
|
|
2940
|
+
"div",
|
|
2941
|
+
{
|
|
2942
|
+
className: "uic-filecard" + (compact ? " is-compact" : "") + (open ? " is-clickable" : "") + (className ? " " + className : ""),
|
|
2943
|
+
onClick: open,
|
|
2944
|
+
role: open ? "button" : void 0,
|
|
2945
|
+
tabIndex: open ? 0 : void 0,
|
|
2946
|
+
onKeyDown: open ? (e) => {
|
|
2947
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
2948
|
+
e.preventDefault();
|
|
2949
|
+
open(e);
|
|
2950
|
+
}
|
|
2951
|
+
} : void 0,
|
|
2952
|
+
title: name,
|
|
2953
|
+
children: [
|
|
2954
|
+
/* @__PURE__ */ jsx15("span", { className: "uic-filecard-ic", children: /* @__PURE__ */ jsx15(FileTypeIcon, { name, size: compact ? 20 : 30 }) }),
|
|
2955
|
+
/* @__PURE__ */ jsxs13("span", { className: "uic-filecard-meta", children: [
|
|
2956
|
+
/* @__PURE__ */ jsx15("span", { className: "uic-filecard-name", children: name }),
|
|
2957
|
+
!compact && /* @__PURE__ */ jsx15("span", { className: "uic-filecard-sub", children: subtitle(name, origin, bytes) })
|
|
2958
|
+
] }),
|
|
2959
|
+
/* @__PURE__ */ jsxs13(Fragment9, { children: [
|
|
2960
|
+
onDownload && /* @__PURE__ */ jsx15(
|
|
2961
|
+
"button",
|
|
2962
|
+
{
|
|
2963
|
+
type: "button",
|
|
2964
|
+
className: "uic-filecard-btn",
|
|
2965
|
+
"aria-label": `Download ${name}`,
|
|
2966
|
+
title: "Download",
|
|
2967
|
+
onClick: (e) => {
|
|
2968
|
+
e.stopPropagation();
|
|
2969
|
+
onDownload();
|
|
2970
|
+
},
|
|
2971
|
+
children: /* @__PURE__ */ jsx15(IcDownload, {})
|
|
2972
|
+
}
|
|
2973
|
+
),
|
|
2974
|
+
onPreview && /* @__PURE__ */ jsx15(
|
|
2975
|
+
"button",
|
|
2976
|
+
{
|
|
2977
|
+
type: "button",
|
|
2978
|
+
className: "uic-filecard-btn",
|
|
2979
|
+
"aria-label": `Preview ${name}`,
|
|
2980
|
+
title: "Preview",
|
|
2981
|
+
onClick: open,
|
|
2982
|
+
children: /* @__PURE__ */ jsx15(IcEye, {})
|
|
2983
|
+
}
|
|
2984
|
+
)
|
|
2985
|
+
] })
|
|
2986
|
+
]
|
|
2987
|
+
}
|
|
2988
|
+
);
|
|
2989
|
+
}
|
|
2990
|
+
|
|
2991
|
+
// src/components/FilePreview.jsx
|
|
2992
|
+
import { useEffect as useEffect10, useState as useState10 } from "react";
|
|
2993
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2994
|
+
var LANG = {
|
|
2995
|
+
js: "javascript",
|
|
2996
|
+
mjs: "javascript",
|
|
2997
|
+
cjs: "javascript",
|
|
2998
|
+
jsx: "javascript",
|
|
2999
|
+
ts: "typescript",
|
|
3000
|
+
tsx: "typescript",
|
|
3001
|
+
py: "python",
|
|
3002
|
+
rb: "ruby",
|
|
3003
|
+
go: "go",
|
|
3004
|
+
rs: "rust",
|
|
3005
|
+
java: "java",
|
|
3006
|
+
c: "c",
|
|
3007
|
+
h: "c",
|
|
3008
|
+
cpp: "cpp",
|
|
3009
|
+
hpp: "cpp",
|
|
3010
|
+
cs: "csharp",
|
|
3011
|
+
php: "php",
|
|
3012
|
+
swift: "swift",
|
|
3013
|
+
kt: "kotlin",
|
|
3014
|
+
scala: "scala",
|
|
3015
|
+
sh: "bash",
|
|
3016
|
+
bash: "bash",
|
|
3017
|
+
zsh: "bash",
|
|
3018
|
+
sql: "sql",
|
|
3019
|
+
css: "css",
|
|
3020
|
+
scss: "scss",
|
|
3021
|
+
less: "less",
|
|
3022
|
+
html: "xml",
|
|
3023
|
+
htm: "xml",
|
|
3024
|
+
xml: "xml",
|
|
3025
|
+
svg: "xml",
|
|
3026
|
+
json: "json",
|
|
3027
|
+
yaml: "yaml",
|
|
3028
|
+
yml: "yaml",
|
|
3029
|
+
toml: "ini",
|
|
3030
|
+
ini: "ini",
|
|
3031
|
+
r: "r",
|
|
3032
|
+
lua: "lua",
|
|
3033
|
+
pl: "perl",
|
|
3034
|
+
dockerfile: "dockerfile",
|
|
3035
|
+
diff: "diff"
|
|
3036
|
+
};
|
|
3037
|
+
var OFFICE = /* @__PURE__ */ new Set(["pptx", "ppt", "pptm", "odp", "doc", "docx", "odt", "rtf"]);
|
|
3038
|
+
var SHEET = /* @__PURE__ */ new Set(["xls", "xlsx", "xlsm", "xlsb", "ods"]);
|
|
3039
|
+
function kindOf(name, mime = "") {
|
|
3040
|
+
const e = extOf(name);
|
|
3041
|
+
if (mime.startsWith("image/") || /^(png|jpe?g|gif|webp|svg|bmp|ico|avif)$/.test(e)) return "image";
|
|
3042
|
+
if (mime === "application/pdf" || e === "pdf") return "pdf";
|
|
3043
|
+
if (mime.startsWith("video/") || ["mp4", "webm", "mov", "m4v"].includes(e)) return "video";
|
|
3044
|
+
if (mime.startsWith("audio/") || ["mp3", "wav", "ogg", "m4a", "flac"].includes(e)) return "audio";
|
|
3045
|
+
if (e === "csv" || e === "tsv") return "csv";
|
|
3046
|
+
if (e === "md" || e === "markdown") return "markdown";
|
|
3047
|
+
if (SHEET.has(e)) return "sheet";
|
|
3048
|
+
if (OFFICE.has(e)) return "office";
|
|
3049
|
+
if (mime.startsWith("text/") || LANG[e] || /^(txt|log|env|conf|cfg|gitignore)$/.test(e)) return "code";
|
|
3050
|
+
return "binary";
|
|
3051
|
+
}
|
|
3052
|
+
function delimitedToRows(text, sep) {
|
|
3053
|
+
return text.split(/\r?\n/).filter((l) => l.length).slice(0, 1e3).map((line) => {
|
|
3054
|
+
const out = [];
|
|
3055
|
+
let cur = "";
|
|
3056
|
+
let q = false;
|
|
3057
|
+
for (const ch of line) {
|
|
3058
|
+
if (ch === '"') q = !q;
|
|
3059
|
+
else if (ch === sep && !q) {
|
|
3060
|
+
out.push(cur);
|
|
3061
|
+
cur = "";
|
|
3062
|
+
} else cur += ch;
|
|
3063
|
+
}
|
|
3064
|
+
out.push(cur);
|
|
3065
|
+
return out.map((c) => c.replace(/^"|"$/g, ""));
|
|
3066
|
+
});
|
|
3067
|
+
}
|
|
3068
|
+
function Grid({ rows }) {
|
|
3069
|
+
if (!rows?.length) return /* @__PURE__ */ jsx16("div", { className: "uic-fp-empty", children: "This file is empty." });
|
|
3070
|
+
const [head, ...body] = rows;
|
|
3071
|
+
return /* @__PURE__ */ jsx16("div", { className: "uic-fp-sheet", children: /* @__PURE__ */ jsxs14("table", { children: [
|
|
3072
|
+
/* @__PURE__ */ jsx16("thead", { children: /* @__PURE__ */ jsx16("tr", { children: head.map((c, i) => /* @__PURE__ */ jsx16("th", { children: c }, i)) }) }),
|
|
3073
|
+
/* @__PURE__ */ jsx16("tbody", { children: body.map((r, i) => /* @__PURE__ */ jsx16("tr", { children: r.map((c, j) => /* @__PURE__ */ jsx16("td", { children: c }, j)) }, i)) })
|
|
3074
|
+
] }) });
|
|
3075
|
+
}
|
|
3076
|
+
var defaultDownload = (url, name) => {
|
|
3077
|
+
const a = document.createElement("a");
|
|
3078
|
+
a.href = url;
|
|
3079
|
+
a.download = name;
|
|
3080
|
+
a.rel = "noreferrer";
|
|
3081
|
+
document.body.appendChild(a);
|
|
3082
|
+
a.click();
|
|
3083
|
+
a.remove();
|
|
3084
|
+
};
|
|
3085
|
+
function FilePreview({
|
|
3086
|
+
file,
|
|
3087
|
+
onClose,
|
|
3088
|
+
fetchFile,
|
|
3089
|
+
officePdfUrl,
|
|
3090
|
+
renderMarkdown,
|
|
3091
|
+
onDownload,
|
|
3092
|
+
title
|
|
3093
|
+
}) {
|
|
3094
|
+
const { url, name } = file || {};
|
|
3095
|
+
const [st, setSt] = useState10({ kind: "loading" });
|
|
3096
|
+
const [tab, setTab] = useState10(0);
|
|
3097
|
+
useEffect10(() => {
|
|
3098
|
+
if (!url) return void 0;
|
|
3099
|
+
let alive = true;
|
|
3100
|
+
let obj;
|
|
3101
|
+
setSt({ kind: "loading" });
|
|
3102
|
+
setTab(0);
|
|
3103
|
+
const get = fetchFile || ((u) => fetch(u, { cache: "no-store" }));
|
|
3104
|
+
(async () => {
|
|
3105
|
+
const res = await get(url);
|
|
3106
|
+
if (!res.ok) throw new Error(`${res.status}`);
|
|
3107
|
+
const mime = (res.headers.get("content-type") || "").toLowerCase();
|
|
3108
|
+
const kind = kindOf(name, mime);
|
|
3109
|
+
if (kind === "office") {
|
|
3110
|
+
if (!officePdfUrl) {
|
|
3111
|
+
setSt({ kind: "binary", error: "This format has no inline preview here \u2014 download it to open it." });
|
|
3112
|
+
return;
|
|
3113
|
+
}
|
|
3114
|
+
const r = await get(officePdfUrl(url));
|
|
3115
|
+
if (!r.ok) throw new Error(`${r.status}`);
|
|
3116
|
+
obj = URL.createObjectURL(await r.blob());
|
|
3117
|
+
if (alive) setSt({ kind: "pdf", objUrl: obj });
|
|
3118
|
+
return;
|
|
3119
|
+
}
|
|
3120
|
+
if (kind === "sheet") {
|
|
3121
|
+
try {
|
|
3122
|
+
const buf = await res.arrayBuffer();
|
|
3123
|
+
const XLSX = await import("xlsx");
|
|
3124
|
+
const wb = XLSX.read(buf, { type: "array" });
|
|
3125
|
+
const sheets = wb.SheetNames.map((n) => {
|
|
3126
|
+
const ws = wb.Sheets[n] || {};
|
|
3127
|
+
const filled = Boolean(ws["!ref"]);
|
|
3128
|
+
return { name: n, filled, rows: filled ? XLSX.utils.sheet_to_json(ws, { header: 1, raw: false }) : [] };
|
|
3129
|
+
});
|
|
3130
|
+
const first = sheets.findIndex((s) => s.filled);
|
|
3131
|
+
if (alive) {
|
|
3132
|
+
setTab(first < 0 ? 0 : first);
|
|
3133
|
+
setSt({ kind: "sheet", sheets });
|
|
3134
|
+
}
|
|
3135
|
+
} catch (e) {
|
|
3136
|
+
if (alive) setSt({ kind: "binary", error: `This spreadsheet couldn\u2019t be read (${String(e?.message || "parse failed").slice(0, 80)}).` });
|
|
3137
|
+
}
|
|
3138
|
+
return;
|
|
3139
|
+
}
|
|
3140
|
+
if (kind === "csv" || kind === "markdown" || kind === "code") {
|
|
3141
|
+
const text = await res.text();
|
|
3142
|
+
if (!alive) return;
|
|
3143
|
+
if (kind === "csv") setSt({ kind: "csv", rows: delimitedToRows(text, extOf(name) === "tsv" ? " " : ",") });
|
|
3144
|
+
else setSt({ kind, text: text.slice(0, 4e5) });
|
|
3145
|
+
return;
|
|
3146
|
+
}
|
|
3147
|
+
if (kind === "binary") {
|
|
3148
|
+
if (alive) setSt({ kind: "binary" });
|
|
3149
|
+
return;
|
|
3150
|
+
}
|
|
3151
|
+
obj = URL.createObjectURL(await res.blob());
|
|
3152
|
+
if (alive) setSt({ kind, objUrl: obj });
|
|
3153
|
+
})().catch(() => {
|
|
3154
|
+
if (alive) setSt({ kind: "binary", error: "Could not load this file." });
|
|
3155
|
+
});
|
|
3156
|
+
return () => {
|
|
3157
|
+
alive = false;
|
|
3158
|
+
if (obj) URL.revokeObjectURL(obj);
|
|
3159
|
+
};
|
|
3160
|
+
}, [url, name, fetchFile, officePdfUrl]);
|
|
3161
|
+
const download = () => onDownload ? onDownload(url, name) : defaultDownload(url, name);
|
|
3162
|
+
return /* @__PURE__ */ jsxs14("aside", { className: "uic-fp", "aria-label": title || `Preview of ${name}`, children: [
|
|
3163
|
+
/* @__PURE__ */ jsxs14("header", { className: "uic-fp-head", children: [
|
|
3164
|
+
/* @__PURE__ */ jsx16("span", { className: "uic-fp-ic", children: /* @__PURE__ */ jsx16(FileTypeIcon, { name, size: 20 }) }),
|
|
3165
|
+
/* @__PURE__ */ jsx16("span", { className: "uic-fp-name", title: name, children: name }),
|
|
3166
|
+
/* @__PURE__ */ jsx16(
|
|
3167
|
+
"button",
|
|
3168
|
+
{
|
|
3169
|
+
type: "button",
|
|
3170
|
+
className: "uic-fp-btn",
|
|
3171
|
+
"aria-label": `Download ${name}`,
|
|
3172
|
+
title: "Download",
|
|
3173
|
+
onClick: download,
|
|
3174
|
+
children: /* @__PURE__ */ jsx16(IcDownload, {})
|
|
3175
|
+
}
|
|
3176
|
+
),
|
|
3177
|
+
onClose && /* @__PURE__ */ jsx16(
|
|
3178
|
+
"button",
|
|
3179
|
+
{
|
|
3180
|
+
type: "button",
|
|
3181
|
+
className: "uic-fp-btn",
|
|
3182
|
+
"aria-label": "Close preview",
|
|
3183
|
+
title: "Close",
|
|
3184
|
+
onClick: onClose,
|
|
3185
|
+
children: /* @__PURE__ */ jsx16(IcX, { size: 18 })
|
|
3186
|
+
}
|
|
3187
|
+
)
|
|
3188
|
+
] }),
|
|
3189
|
+
/* @__PURE__ */ jsxs14("div", { className: "uic-fp-body", children: [
|
|
3190
|
+
st.kind === "loading" && /* @__PURE__ */ jsx16("div", { className: "uic-fp-pad", children: /* @__PURE__ */ jsx16("span", { className: "uic-skel uic-fp-skel" }) }),
|
|
3191
|
+
st.kind === "image" && st.objUrl && /* @__PURE__ */ jsx16("div", { className: "uic-fp-center", children: /* @__PURE__ */ jsx16("img", { className: "uic-fp-img", src: st.objUrl, alt: name }) }),
|
|
3192
|
+
st.kind === "pdf" && st.objUrl && /* @__PURE__ */ jsx16("iframe", { className: "uic-fp-frame", src: st.objUrl, title: name }),
|
|
3193
|
+
st.kind === "video" && st.objUrl && /* @__PURE__ */ jsx16("div", { className: "uic-fp-center", children: /* @__PURE__ */ jsx16("video", { className: "uic-fp-media", src: st.objUrl, controls: true }) }),
|
|
3194
|
+
st.kind === "audio" && st.objUrl && /* @__PURE__ */ jsx16("div", { className: "uic-fp-center", children: /* @__PURE__ */ jsx16("audio", { src: st.objUrl, controls: true }) }),
|
|
3195
|
+
st.kind === "markdown" && /* @__PURE__ */ jsx16("div", { className: "uic-fp-doc", children: renderMarkdown ? renderMarkdown(st.text || "") : /* @__PURE__ */ jsx16("pre", { className: "uic-fp-pre", children: st.text }) }),
|
|
3196
|
+
st.kind === "code" && /* @__PURE__ */ jsx16(CodeBlock, { code: st.text || "", lang: LANG[extOf(name)] || "plaintext" }),
|
|
3197
|
+
st.kind === "csv" && /* @__PURE__ */ jsx16(Grid, { rows: st.rows }),
|
|
3198
|
+
st.kind === "sheet" && st.sheets && /* @__PURE__ */ jsxs14("div", { className: "uic-fp-xlsx", children: [
|
|
3199
|
+
st.sheets[tab]?.filled ? /* @__PURE__ */ jsx16(Grid, { rows: st.sheets[tab].rows }) : /* @__PURE__ */ jsx16("div", { className: "uic-fp-empty", children: "This sheet is empty." }),
|
|
3200
|
+
/* @__PURE__ */ jsx16("div", { className: "uic-fp-tabs", children: st.sheets.map((s, i) => /* @__PURE__ */ jsx16(
|
|
3201
|
+
"button",
|
|
3202
|
+
{
|
|
3203
|
+
type: "button",
|
|
3204
|
+
className: "uic-fp-tab" + (i === tab ? " is-on" : "") + (s.filled ? "" : " is-empty"),
|
|
3205
|
+
onClick: () => setTab(i),
|
|
3206
|
+
title: s.filled ? s.name : `${s.name} (empty)`,
|
|
3207
|
+
children: s.name
|
|
3208
|
+
},
|
|
3209
|
+
s.name + i
|
|
3210
|
+
)) })
|
|
3211
|
+
] }),
|
|
3212
|
+
st.kind === "binary" && /* @__PURE__ */ jsx16("div", { className: "uic-fp-center", children: /* @__PURE__ */ jsxs14("div", { className: "uic-fp-fallback", children: [
|
|
3213
|
+
/* @__PURE__ */ jsx16(FileTypeIcon, { name, size: 56 }),
|
|
3214
|
+
/* @__PURE__ */ jsx16("p", { children: st.error || "No inline preview for this file type." }),
|
|
3215
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: "uic-fp-dl", onClick: download, children: "Download" })
|
|
3216
|
+
] }) })
|
|
3217
|
+
] })
|
|
3218
|
+
] });
|
|
3219
|
+
}
|
|
3220
|
+
|
|
3221
|
+
// src/components/form.jsx
|
|
3222
|
+
import { useId as useId2 } from "react";
|
|
3223
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3224
|
+
function Field({ label, hint, error, htmlFor, required, children, className = "" }) {
|
|
3225
|
+
return /* @__PURE__ */ jsxs15("div", { className: "uic-field" + (error ? " is-error" : "") + (className ? " " + className : ""), children: [
|
|
3226
|
+
label && /* @__PURE__ */ jsxs15("label", { className: "uic-field-label", htmlFor, children: [
|
|
3227
|
+
label,
|
|
3228
|
+
required && /* @__PURE__ */ jsx17("span", { className: "uic-field-req", "aria-hidden": "true", children: "*" })
|
|
3229
|
+
] }),
|
|
3230
|
+
children,
|
|
3231
|
+
error ? /* @__PURE__ */ jsx17("p", { className: "uic-field-err", children: error }) : hint ? /* @__PURE__ */ jsx17("p", { className: "uic-field-hint", children: hint }) : null
|
|
3232
|
+
] });
|
|
3233
|
+
}
|
|
3234
|
+
function withField(Control) {
|
|
3235
|
+
return function Fielded({ label, hint, error, required, id, className, ...rest }) {
|
|
3236
|
+
const auto = useId2();
|
|
3237
|
+
const inputId = id || auto;
|
|
3238
|
+
return /* @__PURE__ */ jsx17(Field, { label, hint, error, required, htmlFor: inputId, className, children: /* @__PURE__ */ jsx17(Control, { id: inputId, invalid: !!error, required, ...rest }) });
|
|
3239
|
+
};
|
|
3240
|
+
}
|
|
3241
|
+
function BareInput({ invalid, ...rest }) {
|
|
3242
|
+
return /* @__PURE__ */ jsx17("input", { className: "uic-input" + (invalid ? " is-error" : ""), "aria-invalid": invalid || void 0, ...rest });
|
|
3243
|
+
}
|
|
3244
|
+
function BareTextarea({ invalid, rows = 4, ...rest }) {
|
|
3245
|
+
return /* @__PURE__ */ jsx17(
|
|
3246
|
+
"textarea",
|
|
3247
|
+
{
|
|
3248
|
+
className: "uic-input uic-textarea" + (invalid ? " is-error" : ""),
|
|
3249
|
+
rows,
|
|
3250
|
+
"aria-invalid": invalid || void 0,
|
|
3251
|
+
...rest
|
|
3252
|
+
}
|
|
3253
|
+
);
|
|
3254
|
+
}
|
|
3255
|
+
function BareSelect({ invalid, options = [], placeholder, ...rest }) {
|
|
3256
|
+
return /* @__PURE__ */ jsxs15("span", { className: "uic-select-wrap", children: [
|
|
3257
|
+
/* @__PURE__ */ jsxs15(
|
|
3258
|
+
"select",
|
|
3259
|
+
{
|
|
3260
|
+
className: "uic-input uic-select" + (invalid ? " is-error" : ""),
|
|
3261
|
+
"aria-invalid": invalid || void 0,
|
|
3262
|
+
...rest,
|
|
3263
|
+
children: [
|
|
3264
|
+
placeholder && /* @__PURE__ */ jsx17("option", { value: "", children: placeholder }),
|
|
3265
|
+
options.map((o) => {
|
|
3266
|
+
const opt = typeof o === "string" ? { value: o, label: o } : o;
|
|
3267
|
+
return /* @__PURE__ */ jsx17("option", { value: opt.value, disabled: opt.disabled, children: opt.label }, opt.value);
|
|
3268
|
+
})
|
|
3269
|
+
]
|
|
3270
|
+
}
|
|
3271
|
+
),
|
|
3272
|
+
/* @__PURE__ */ jsx17("span", { className: "uic-select-chev", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(Chevron, { dir: "down", size: 14 }) })
|
|
3273
|
+
] });
|
|
3274
|
+
}
|
|
3275
|
+
var Input = withField(BareInput);
|
|
3276
|
+
var Textarea = withField(BareTextarea);
|
|
3277
|
+
var Select = withField(BareSelect);
|
|
3278
|
+
function FormActions({ children, align = "end", className = "" }) {
|
|
3279
|
+
return /* @__PURE__ */ jsx17("div", { className: `uic-form-actions is-${align}${className ? " " + className : ""}`, children });
|
|
3280
|
+
}
|
|
3281
|
+
function Button({ variant = "default", size = "md", type = "button", className = "", ...rest }) {
|
|
3282
|
+
return /* @__PURE__ */ jsx17("button", { type, className: `uic-btn is-${variant} is-${size}${className ? " " + className : ""}`, ...rest });
|
|
3283
|
+
}
|
|
3284
|
+
|
|
2879
3285
|
// src/components/Carousel.jsx
|
|
2880
|
-
import React9, { useCallback as useCallback5, useEffect as
|
|
2881
|
-
import { jsx as
|
|
3286
|
+
import React9, { useCallback as useCallback5, useEffect as useEffect11, useRef as useRef8, useState as useState11 } from "react";
|
|
3287
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2882
3288
|
var EDGE = 2;
|
|
2883
3289
|
function Carousel(props) {
|
|
2884
3290
|
const { label, step, children, classNames = {} } = props;
|
|
2885
3291
|
const ref = useRef8(null);
|
|
2886
|
-
const [edges, setEdges] =
|
|
3292
|
+
const [edges, setEdges] = useState11({ start: true, end: true, overflow: false });
|
|
2887
3293
|
const measure = useCallback5(() => {
|
|
2888
3294
|
const el = ref.current;
|
|
2889
3295
|
if (!el) return;
|
|
@@ -2894,7 +3300,7 @@ function Carousel(props) {
|
|
|
2894
3300
|
end: el.scrollLeft >= el.scrollWidth - el.clientWidth - EDGE
|
|
2895
3301
|
});
|
|
2896
3302
|
}, []);
|
|
2897
|
-
|
|
3303
|
+
useEffect11(() => {
|
|
2898
3304
|
const el = ref.current;
|
|
2899
3305
|
if (!el) return void 0;
|
|
2900
3306
|
measure();
|
|
@@ -2908,8 +3314,8 @@ function Carousel(props) {
|
|
|
2908
3314
|
if (!el) return;
|
|
2909
3315
|
el.scrollBy({ left: dir * (step || Math.round(el.clientWidth * 0.9)), behavior: "smooth" });
|
|
2910
3316
|
};
|
|
2911
|
-
return /* @__PURE__ */
|
|
2912
|
-
edges.overflow ? /* @__PURE__ */
|
|
3317
|
+
return /* @__PURE__ */ jsxs16("div", { className: ["uic-carousel-wrap", classNames.root || ""].filter(Boolean).join(" "), children: [
|
|
3318
|
+
edges.overflow ? /* @__PURE__ */ jsx18(
|
|
2913
3319
|
"button",
|
|
2914
3320
|
{
|
|
2915
3321
|
type: "button",
|
|
@@ -2917,10 +3323,10 @@ function Carousel(props) {
|
|
|
2917
3323
|
onClick: () => scroll(-1),
|
|
2918
3324
|
disabled: edges.start,
|
|
2919
3325
|
"aria-label": `Scroll ${label} left`,
|
|
2920
|
-
children: /* @__PURE__ */
|
|
3326
|
+
children: /* @__PURE__ */ jsx18(Chevron, { dir: "left" })
|
|
2921
3327
|
}
|
|
2922
3328
|
) : null,
|
|
2923
|
-
/* @__PURE__ */
|
|
3329
|
+
/* @__PURE__ */ jsx18(
|
|
2924
3330
|
"div",
|
|
2925
3331
|
{
|
|
2926
3332
|
className: ["uic-carousel", classNames.viewport || ""].filter(Boolean).join(" "),
|
|
@@ -2931,7 +3337,7 @@ function Carousel(props) {
|
|
|
2931
3337
|
children
|
|
2932
3338
|
}
|
|
2933
3339
|
),
|
|
2934
|
-
edges.overflow ? /* @__PURE__ */
|
|
3340
|
+
edges.overflow ? /* @__PURE__ */ jsx18(
|
|
2935
3341
|
"button",
|
|
2936
3342
|
{
|
|
2937
3343
|
type: "button",
|
|
@@ -2939,7 +3345,7 @@ function Carousel(props) {
|
|
|
2939
3345
|
onClick: () => scroll(1),
|
|
2940
3346
|
disabled: edges.end,
|
|
2941
3347
|
"aria-label": `Scroll ${label} right`,
|
|
2942
|
-
children: /* @__PURE__ */
|
|
3348
|
+
children: /* @__PURE__ */ jsx18(Chevron, { dir: "right" })
|
|
2943
3349
|
}
|
|
2944
3350
|
) : null
|
|
2945
3351
|
] });
|
|
@@ -2947,34 +3353,34 @@ function Carousel(props) {
|
|
|
2947
3353
|
|
|
2948
3354
|
// src/components/Card.jsx
|
|
2949
3355
|
import React10 from "react";
|
|
2950
|
-
import { jsx as
|
|
3356
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2951
3357
|
function Card(props) {
|
|
2952
|
-
const { art, title, subtitle, onClick, selected = false, overlay, actions, classNames = {} } = props;
|
|
2953
|
-
const foot = /* @__PURE__ */
|
|
2954
|
-
/* @__PURE__ */
|
|
2955
|
-
|
|
3358
|
+
const { art, title, subtitle: subtitle2, onClick, selected = false, overlay, actions, classNames = {} } = props;
|
|
3359
|
+
const foot = /* @__PURE__ */ jsxs17("span", { className: "uic-card-foot", children: [
|
|
3360
|
+
/* @__PURE__ */ jsx19("span", { className: "uic-card-name", children: title }),
|
|
3361
|
+
subtitle2 ? /* @__PURE__ */ jsx19("span", { className: "uic-card-sub", children: subtitle2 }) : null
|
|
2956
3362
|
] });
|
|
2957
|
-
return /* @__PURE__ */
|
|
2958
|
-
onClick ? /* @__PURE__ */
|
|
2959
|
-
/* @__PURE__ */
|
|
3363
|
+
return /* @__PURE__ */ jsxs17("div", { className: ["uic-card", selected ? "is-selected" : "", classNames.root || ""].filter(Boolean).join(" "), children: [
|
|
3364
|
+
onClick ? /* @__PURE__ */ jsxs17("button", { type: "button", className: "uic-card-main", onClick, "aria-pressed": selected || void 0, children: [
|
|
3365
|
+
/* @__PURE__ */ jsx19("span", { className: "uic-card-art", children: art }),
|
|
2960
3366
|
foot
|
|
2961
|
-
] }) : /* @__PURE__ */
|
|
2962
|
-
/* @__PURE__ */
|
|
3367
|
+
] }) : /* @__PURE__ */ jsxs17("div", { className: "uic-card-main", children: [
|
|
3368
|
+
/* @__PURE__ */ jsx19("span", { className: "uic-card-art", children: art }),
|
|
2963
3369
|
foot
|
|
2964
3370
|
] }),
|
|
2965
|
-
overlay ? /* @__PURE__ */
|
|
2966
|
-
actions ? /* @__PURE__ */
|
|
3371
|
+
overlay ? /* @__PURE__ */ jsx19("div", { className: "uic-card-overlay", children: overlay }) : null,
|
|
3372
|
+
actions ? /* @__PURE__ */ jsx19("div", { className: "uic-card-actions", children: actions }) : null
|
|
2967
3373
|
] });
|
|
2968
3374
|
}
|
|
2969
3375
|
|
|
2970
3376
|
// src/components/SearchField.jsx
|
|
2971
3377
|
import React11 from "react";
|
|
2972
|
-
import { jsx as
|
|
3378
|
+
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2973
3379
|
function SearchField(props) {
|
|
2974
3380
|
const { value, onChange, placeholder, clearLabel = "Clear search", className } = props;
|
|
2975
|
-
return /* @__PURE__ */
|
|
2976
|
-
/* @__PURE__ */
|
|
2977
|
-
/* @__PURE__ */
|
|
3381
|
+
return /* @__PURE__ */ jsxs18("label", { className: ["uic-search", className || ""].filter(Boolean).join(" "), children: [
|
|
3382
|
+
/* @__PURE__ */ jsx20("span", { className: "uic-search-ic", "aria-hidden": "true", children: /* @__PURE__ */ jsx20(IcSearch, {}) }),
|
|
3383
|
+
/* @__PURE__ */ jsx20(
|
|
2978
3384
|
"input",
|
|
2979
3385
|
{
|
|
2980
3386
|
type: "search",
|
|
@@ -2984,14 +3390,14 @@ function SearchField(props) {
|
|
|
2984
3390
|
onChange: (e) => onChange(e.target.value)
|
|
2985
3391
|
}
|
|
2986
3392
|
),
|
|
2987
|
-
value ? /* @__PURE__ */
|
|
3393
|
+
value ? /* @__PURE__ */ jsx20("button", { type: "button", className: "uic-search-x", "aria-label": clearLabel, onClick: () => onChange(""), children: /* @__PURE__ */ jsx20(IcX, { size: 12 }) }) : null
|
|
2988
3394
|
] });
|
|
2989
3395
|
}
|
|
2990
3396
|
|
|
2991
3397
|
// src/components/Popover.jsx
|
|
2992
|
-
import React12, { useCallback as useCallback6, useEffect as
|
|
3398
|
+
import React12, { useCallback as useCallback6, useEffect as useEffect12, useRef as useRef9, useState as useState12 } from "react";
|
|
2993
3399
|
import { createPortal as createPortal3 } from "react-dom";
|
|
2994
|
-
import { jsx as
|
|
3400
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
2995
3401
|
var GAP = 6;
|
|
2996
3402
|
var MARGIN = 8;
|
|
2997
3403
|
function Popover(props) {
|
|
@@ -3007,8 +3413,8 @@ function Popover(props) {
|
|
|
3007
3413
|
label
|
|
3008
3414
|
} = props;
|
|
3009
3415
|
const popRef = useRef9(null);
|
|
3010
|
-
const [pos, setPos] =
|
|
3011
|
-
|
|
3416
|
+
const [pos, setPos] = useState12(null);
|
|
3417
|
+
useEffect12(() => {
|
|
3012
3418
|
if (!open) {
|
|
3013
3419
|
setPos(null);
|
|
3014
3420
|
return void 0;
|
|
@@ -3035,7 +3441,7 @@ function Popover(props) {
|
|
|
3035
3441
|
window.removeEventListener("scroll", place, true);
|
|
3036
3442
|
};
|
|
3037
3443
|
}, [open, anchorRef, width, minHeight, placement]);
|
|
3038
|
-
|
|
3444
|
+
useEffect12(() => {
|
|
3039
3445
|
if (!open) return void 0;
|
|
3040
3446
|
const onDown = (e) => {
|
|
3041
3447
|
if (popRef.current?.contains(e.target)) return;
|
|
@@ -3049,7 +3455,7 @@ function Popover(props) {
|
|
|
3049
3455
|
useOverlayEscape(open, escape);
|
|
3050
3456
|
if (!open || !pos || typeof document === "undefined") return null;
|
|
3051
3457
|
return createPortal3(
|
|
3052
|
-
/* @__PURE__ */
|
|
3458
|
+
/* @__PURE__ */ jsx21(
|
|
3053
3459
|
"div",
|
|
3054
3460
|
{
|
|
3055
3461
|
ref: popRef,
|
|
@@ -3065,9 +3471,9 @@ function Popover(props) {
|
|
|
3065
3471
|
}
|
|
3066
3472
|
|
|
3067
3473
|
// src/components/Modal.jsx
|
|
3068
|
-
import React13, { useCallback as useCallback7, useEffect as
|
|
3474
|
+
import React13, { useCallback as useCallback7, useEffect as useEffect13, useId as useId3 } from "react";
|
|
3069
3475
|
import { createPortal as createPortal4 } from "react-dom";
|
|
3070
|
-
import { jsx as
|
|
3476
|
+
import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3071
3477
|
function Modal(props) {
|
|
3072
3478
|
const {
|
|
3073
3479
|
open,
|
|
@@ -3081,10 +3487,10 @@ function Modal(props) {
|
|
|
3081
3487
|
children,
|
|
3082
3488
|
classNames = {}
|
|
3083
3489
|
} = props;
|
|
3084
|
-
const titleId =
|
|
3490
|
+
const titleId = useId3();
|
|
3085
3491
|
const escape = useCallback7(() => onClose?.(), [onClose]);
|
|
3086
3492
|
useOverlayEscape(open, escape);
|
|
3087
|
-
|
|
3493
|
+
useEffect13(() => {
|
|
3088
3494
|
if (!open || typeof document === "undefined") return void 0;
|
|
3089
3495
|
const prev = document.body.style.overflow;
|
|
3090
3496
|
document.body.style.overflow = "hidden";
|
|
@@ -3097,12 +3503,12 @@ function Modal(props) {
|
|
|
3097
3503
|
if (e.target === e.currentTarget) onClose?.();
|
|
3098
3504
|
};
|
|
3099
3505
|
return createPortal4(
|
|
3100
|
-
/* @__PURE__ */
|
|
3506
|
+
/* @__PURE__ */ jsx22(
|
|
3101
3507
|
"div",
|
|
3102
3508
|
{
|
|
3103
3509
|
className: ["uic-modal-backdrop", classNames.backdrop || ""].filter(Boolean).join(" "),
|
|
3104
3510
|
onMouseDown: onBackdrop,
|
|
3105
|
-
children: /* @__PURE__ */
|
|
3511
|
+
children: /* @__PURE__ */ jsxs19(
|
|
3106
3512
|
"div",
|
|
3107
3513
|
{
|
|
3108
3514
|
className: ["uic-modal", `is-${size}`, classNames.root || ""].filter(Boolean).join(" "),
|
|
@@ -3111,15 +3517,15 @@ function Modal(props) {
|
|
|
3111
3517
|
"aria-modal": "true",
|
|
3112
3518
|
"aria-labelledby": labelledBy || (title ? titleId : void 0),
|
|
3113
3519
|
children: [
|
|
3114
|
-
title || actions ? /* @__PURE__ */
|
|
3115
|
-
/* @__PURE__ */
|
|
3116
|
-
title ? /* @__PURE__ */
|
|
3117
|
-
description ? /* @__PURE__ */
|
|
3520
|
+
title || actions ? /* @__PURE__ */ jsxs19("div", { className: "uic-modal-h", children: [
|
|
3521
|
+
/* @__PURE__ */ jsxs19("div", { className: "uic-modal-title", children: [
|
|
3522
|
+
title ? /* @__PURE__ */ jsx22("h3", { id: titleId, children: title }) : null,
|
|
3523
|
+
description ? /* @__PURE__ */ jsx22("p", { children: description }) : null
|
|
3118
3524
|
] }),
|
|
3119
3525
|
actions,
|
|
3120
|
-
/* @__PURE__ */
|
|
3526
|
+
/* @__PURE__ */ jsx22("button", { type: "button", className: "uic-modal-x", "aria-label": "Close", onClick: onClose, children: /* @__PURE__ */ jsx22(IcX, { size: 18 }) })
|
|
3121
3527
|
] }) : null,
|
|
3122
|
-
/* @__PURE__ */
|
|
3528
|
+
/* @__PURE__ */ jsx22("div", { className: ["uic-modal-b", classNames.body || ""].filter(Boolean).join(" "), children })
|
|
3123
3529
|
]
|
|
3124
3530
|
}
|
|
3125
3531
|
)
|
|
@@ -3130,15 +3536,15 @@ function Modal(props) {
|
|
|
3130
3536
|
}
|
|
3131
3537
|
|
|
3132
3538
|
// src/hooks/useTypewriter.js
|
|
3133
|
-
import { useEffect as
|
|
3539
|
+
import { useEffect as useEffect14, useRef as useRef10, useState as useState13 } from "react";
|
|
3134
3540
|
var CHAR_MS = 26;
|
|
3135
3541
|
var HOLD_MS = 2600;
|
|
3136
3542
|
function useTypewriter(phrases, { active = true } = {}) {
|
|
3137
3543
|
const list = phrases && phrases.length ? phrases : [""];
|
|
3138
|
-
const [text, setText] =
|
|
3544
|
+
const [text, setText] = useState13(list[0]);
|
|
3139
3545
|
const listRef = useRef10(list);
|
|
3140
3546
|
listRef.current = list;
|
|
3141
|
-
|
|
3547
|
+
useEffect14(() => {
|
|
3142
3548
|
if (!active) return void 0;
|
|
3143
3549
|
if (typeof window === "undefined") return void 0;
|
|
3144
3550
|
if (window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches) {
|
|
@@ -3170,6 +3576,7 @@ function useTypewriter(phrases, { active = true } = {}) {
|
|
|
3170
3576
|
export {
|
|
3171
3577
|
AssistantTurn,
|
|
3172
3578
|
AuthForm,
|
|
3579
|
+
Button,
|
|
3173
3580
|
Card,
|
|
3174
3581
|
Carousel,
|
|
3175
3582
|
ChatMessages,
|
|
@@ -3181,10 +3588,17 @@ export {
|
|
|
3181
3588
|
Composer,
|
|
3182
3589
|
DEFAULT_STATUS_LABELS,
|
|
3183
3590
|
DialogHost,
|
|
3591
|
+
Field,
|
|
3592
|
+
FileCard,
|
|
3593
|
+
FilePreview,
|
|
3594
|
+
FileTypeIcon,
|
|
3595
|
+
FormActions,
|
|
3184
3596
|
GOOGLE_ENABLED,
|
|
3185
3597
|
GoogleButton,
|
|
3186
3598
|
IcCheck,
|
|
3187
3599
|
IcDoc,
|
|
3600
|
+
IcDownload,
|
|
3601
|
+
IcEye,
|
|
3188
3602
|
IcGlobe,
|
|
3189
3603
|
IcList,
|
|
3190
3604
|
IcMic,
|
|
@@ -3200,14 +3614,17 @@ export {
|
|
|
3200
3614
|
IcThink,
|
|
3201
3615
|
IcTool,
|
|
3202
3616
|
IcX,
|
|
3617
|
+
Input,
|
|
3203
3618
|
Modal,
|
|
3204
3619
|
PaneResizer,
|
|
3205
3620
|
Popover,
|
|
3206
3621
|
SESSION_EVENT,
|
|
3207
3622
|
SearchField,
|
|
3623
|
+
Select,
|
|
3208
3624
|
SheetGrid,
|
|
3209
3625
|
Svg,
|
|
3210
3626
|
TaskList,
|
|
3627
|
+
Textarea,
|
|
3211
3628
|
ToolGroup,
|
|
3212
3629
|
ToolRow,
|
|
3213
3630
|
UserTurn,
|
|
@@ -3221,6 +3638,7 @@ export {
|
|
|
3221
3638
|
createConversationStore,
|
|
3222
3639
|
createDictation,
|
|
3223
3640
|
createResponsesDispatcher,
|
|
3641
|
+
extOf,
|
|
3224
3642
|
fetchBalance,
|
|
3225
3643
|
getSession,
|
|
3226
3644
|
getToken,
|