reifyui 0.6.2 → 0.7.1
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 +525 -89
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +513 -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 +10 -2
- package/src/sheet/SheetGrid.jsx +33 -4
- package/styles/file.css +129 -0
- package/styles/form.css +65 -0
- package/styles/sheet.css +6 -2
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 ",
|
|
@@ -2532,6 +2541,7 @@ function SheetGrid({
|
|
|
2532
2541
|
rows.map((row, ri) => /* @__PURE__ */ jsxs12(
|
|
2533
2542
|
"tr",
|
|
2534
2543
|
{
|
|
2544
|
+
"data-row-id": row.id,
|
|
2535
2545
|
style: {
|
|
2536
2546
|
...rowHeight(row) ? { height: rowHeight(row) } : null,
|
|
2537
2547
|
"--shg-clamp": Math.max(1, Math.floor(((rowHeight(row) || 34) - 10) / 18))
|
|
@@ -2573,6 +2583,7 @@ function SheetGrid({
|
|
|
2573
2583
|
return /* @__PURE__ */ jsxs12(
|
|
2574
2584
|
"td",
|
|
2575
2585
|
{
|
|
2586
|
+
"data-col-id": col.id,
|
|
2576
2587
|
className: "shg-cell" + (computed ? " shg-cell-compute" : "") + (c.status && computed ? ` shg-cell-${c.status}` : "") + (peer ? " shg-cell-peer" : ""),
|
|
2577
2588
|
style: peer ? { boxShadow: `inset 0 0 0 2px ${peer.color}` } : void 0,
|
|
2578
2589
|
onClick: (e) => {
|
|
@@ -2609,29 +2620,22 @@ function SheetGrid({
|
|
|
2609
2620
|
)
|
|
2610
2621
|
] }),
|
|
2611
2622
|
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
|
-
)
|
|
2623
|
+
isEditing ? renderEditor(col) : /* @__PURE__ */ jsx13("div", { className: "shg-val", children: custom !== void 0 ? custom : /* @__PURE__ */ jsxs12(Fragment8, { children: [
|
|
2624
|
+
computed && /* @__PURE__ */ jsx13(StatusDot, { status: c.status }),
|
|
2625
|
+
/* @__PURE__ */ jsx13(CellValue, { cell: c, col, fetchBlobUrl, onOpenResource }),
|
|
2626
|
+
computed && !readOnly && onRunCell && /* @__PURE__ */ jsx13(
|
|
2627
|
+
"button",
|
|
2628
|
+
{
|
|
2629
|
+
className: "shg-runcell",
|
|
2630
|
+
title: "Run this cell",
|
|
2631
|
+
onClick: (e) => {
|
|
2632
|
+
e.stopPropagation();
|
|
2633
|
+
onRunCell(row.id, col.id);
|
|
2634
|
+
},
|
|
2635
|
+
children: "\u25B6"
|
|
2636
|
+
}
|
|
2637
|
+
)
|
|
2638
|
+
] }) })
|
|
2635
2639
|
]
|
|
2636
2640
|
},
|
|
2637
2641
|
col.id
|
|
@@ -2840,6 +2844,21 @@ function ColumnMenu({ col, columns, anchor, columnTypes, renderColumnConfig, onA
|
|
|
2840
2844
|
}
|
|
2841
2845
|
);
|
|
2842
2846
|
}
|
|
2847
|
+
function fitRowHeights(container, { rowIds, min = 34, max = 320, padding = 12 } = {}) {
|
|
2848
|
+
if (!container) return {};
|
|
2849
|
+
const out = {};
|
|
2850
|
+
const rows = container.querySelectorAll("tr[data-row-id]");
|
|
2851
|
+
for (const tr of rows) {
|
|
2852
|
+
const id = tr.getAttribute("data-row-id");
|
|
2853
|
+
if (rowIds && !rowIds.includes(id)) continue;
|
|
2854
|
+
let tallest = 0;
|
|
2855
|
+
for (const cell of tr.querySelectorAll("td[data-col-id] .shg-val")) {
|
|
2856
|
+
tallest = Math.max(tallest, cell.scrollHeight);
|
|
2857
|
+
}
|
|
2858
|
+
if (tallest) out[id] = Math.min(max, Math.max(min, Math.round(tallest + padding)));
|
|
2859
|
+
}
|
|
2860
|
+
return out;
|
|
2861
|
+
}
|
|
2843
2862
|
function defaultCellText(cell) {
|
|
2844
2863
|
const v = cell?.value;
|
|
2845
2864
|
if (v == null) return "";
|
|
@@ -2876,14 +2895,418 @@ function sheetToAoA(sheet, { cellText = defaultCellValue } = {}) {
|
|
|
2876
2895
|
];
|
|
2877
2896
|
}
|
|
2878
2897
|
|
|
2898
|
+
// src/components/FileTypeIcon.jsx
|
|
2899
|
+
import { useEffect as useEffect9, useState as useState9 } from "react";
|
|
2900
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
2901
|
+
function extOf(name) {
|
|
2902
|
+
const m = String(name || "").toLowerCase().match(/\.([a-z0-9]+)$/);
|
|
2903
|
+
return m ? m[1] : "";
|
|
2904
|
+
}
|
|
2905
|
+
var mod = null;
|
|
2906
|
+
var tried = false;
|
|
2907
|
+
function FileTypeIcon({ name, size = 36 }) {
|
|
2908
|
+
const [, force] = useState9(0);
|
|
2909
|
+
const ext = extOf(name);
|
|
2910
|
+
useEffect9(() => {
|
|
2911
|
+
if (tried || mod) return;
|
|
2912
|
+
tried = true;
|
|
2913
|
+
import("react-file-icon").then((m) => {
|
|
2914
|
+
mod = m;
|
|
2915
|
+
force((n) => n + 1);
|
|
2916
|
+
}).catch(() => {
|
|
2917
|
+
});
|
|
2918
|
+
}, []);
|
|
2919
|
+
const box = { width: size, height: Math.round(size * 1.16), display: "inline-block", flex: "0 0 auto" };
|
|
2920
|
+
if (!mod) {
|
|
2921
|
+
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) }) });
|
|
2922
|
+
}
|
|
2923
|
+
const { FileIcon, defaultStyles } = mod;
|
|
2924
|
+
const style = defaultStyles?.[ext] || {};
|
|
2925
|
+
return /* @__PURE__ */ jsx14("span", { style: box, children: /* @__PURE__ */ jsx14(FileIcon, { extension: ext || void 0, ...style }) });
|
|
2926
|
+
}
|
|
2927
|
+
|
|
2928
|
+
// src/components/FileCard.jsx
|
|
2929
|
+
import { Fragment as Fragment9 } from "react";
|
|
2930
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2931
|
+
function subtitle(name, origin, bytes) {
|
|
2932
|
+
const parts = [(extOf(name) || "file").toUpperCase()];
|
|
2933
|
+
if (origin) parts.push(origin);
|
|
2934
|
+
if (bytes != null) parts.push(bytesLabel2(bytes));
|
|
2935
|
+
return parts.join(" \xB7 ");
|
|
2936
|
+
}
|
|
2937
|
+
function bytesLabel2(n) {
|
|
2938
|
+
if (n == null) return "";
|
|
2939
|
+
if (n < 1024) return `${n} B`;
|
|
2940
|
+
if (n < 1048576) return `${Math.round(n / 1024)} KB`;
|
|
2941
|
+
return `${(n / 1048576).toFixed(1)} MB`;
|
|
2942
|
+
}
|
|
2943
|
+
function FileCard({
|
|
2944
|
+
name,
|
|
2945
|
+
origin,
|
|
2946
|
+
bytes,
|
|
2947
|
+
onPreview,
|
|
2948
|
+
onDownload,
|
|
2949
|
+
compact = false,
|
|
2950
|
+
className = ""
|
|
2951
|
+
}) {
|
|
2952
|
+
const open = onPreview ? (e) => {
|
|
2953
|
+
e.stopPropagation();
|
|
2954
|
+
onPreview();
|
|
2955
|
+
} : void 0;
|
|
2956
|
+
return /* @__PURE__ */ jsxs13(
|
|
2957
|
+
"div",
|
|
2958
|
+
{
|
|
2959
|
+
className: "uic-filecard" + (compact ? " is-compact" : "") + (open ? " is-clickable" : "") + (className ? " " + className : ""),
|
|
2960
|
+
onClick: open,
|
|
2961
|
+
role: open ? "button" : void 0,
|
|
2962
|
+
tabIndex: open ? 0 : void 0,
|
|
2963
|
+
onKeyDown: open ? (e) => {
|
|
2964
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
2965
|
+
e.preventDefault();
|
|
2966
|
+
open(e);
|
|
2967
|
+
}
|
|
2968
|
+
} : void 0,
|
|
2969
|
+
title: name,
|
|
2970
|
+
children: [
|
|
2971
|
+
/* @__PURE__ */ jsx15("span", { className: "uic-filecard-ic", children: /* @__PURE__ */ jsx15(FileTypeIcon, { name, size: compact ? 20 : 30 }) }),
|
|
2972
|
+
/* @__PURE__ */ jsxs13("span", { className: "uic-filecard-meta", children: [
|
|
2973
|
+
/* @__PURE__ */ jsx15("span", { className: "uic-filecard-name", children: name }),
|
|
2974
|
+
!compact && /* @__PURE__ */ jsx15("span", { className: "uic-filecard-sub", children: subtitle(name, origin, bytes) })
|
|
2975
|
+
] }),
|
|
2976
|
+
/* @__PURE__ */ jsxs13(Fragment9, { children: [
|
|
2977
|
+
onDownload && /* @__PURE__ */ jsx15(
|
|
2978
|
+
"button",
|
|
2979
|
+
{
|
|
2980
|
+
type: "button",
|
|
2981
|
+
className: "uic-filecard-btn",
|
|
2982
|
+
"aria-label": `Download ${name}`,
|
|
2983
|
+
title: "Download",
|
|
2984
|
+
onClick: (e) => {
|
|
2985
|
+
e.stopPropagation();
|
|
2986
|
+
onDownload();
|
|
2987
|
+
},
|
|
2988
|
+
children: /* @__PURE__ */ jsx15(IcDownload, {})
|
|
2989
|
+
}
|
|
2990
|
+
),
|
|
2991
|
+
onPreview && /* @__PURE__ */ jsx15(
|
|
2992
|
+
"button",
|
|
2993
|
+
{
|
|
2994
|
+
type: "button",
|
|
2995
|
+
className: "uic-filecard-btn",
|
|
2996
|
+
"aria-label": `Preview ${name}`,
|
|
2997
|
+
title: "Preview",
|
|
2998
|
+
onClick: open,
|
|
2999
|
+
children: /* @__PURE__ */ jsx15(IcEye, {})
|
|
3000
|
+
}
|
|
3001
|
+
)
|
|
3002
|
+
] })
|
|
3003
|
+
]
|
|
3004
|
+
}
|
|
3005
|
+
);
|
|
3006
|
+
}
|
|
3007
|
+
|
|
3008
|
+
// src/components/FilePreview.jsx
|
|
3009
|
+
import { useEffect as useEffect10, useState as useState10 } from "react";
|
|
3010
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3011
|
+
var LANG = {
|
|
3012
|
+
js: "javascript",
|
|
3013
|
+
mjs: "javascript",
|
|
3014
|
+
cjs: "javascript",
|
|
3015
|
+
jsx: "javascript",
|
|
3016
|
+
ts: "typescript",
|
|
3017
|
+
tsx: "typescript",
|
|
3018
|
+
py: "python",
|
|
3019
|
+
rb: "ruby",
|
|
3020
|
+
go: "go",
|
|
3021
|
+
rs: "rust",
|
|
3022
|
+
java: "java",
|
|
3023
|
+
c: "c",
|
|
3024
|
+
h: "c",
|
|
3025
|
+
cpp: "cpp",
|
|
3026
|
+
hpp: "cpp",
|
|
3027
|
+
cs: "csharp",
|
|
3028
|
+
php: "php",
|
|
3029
|
+
swift: "swift",
|
|
3030
|
+
kt: "kotlin",
|
|
3031
|
+
scala: "scala",
|
|
3032
|
+
sh: "bash",
|
|
3033
|
+
bash: "bash",
|
|
3034
|
+
zsh: "bash",
|
|
3035
|
+
sql: "sql",
|
|
3036
|
+
css: "css",
|
|
3037
|
+
scss: "scss",
|
|
3038
|
+
less: "less",
|
|
3039
|
+
html: "xml",
|
|
3040
|
+
htm: "xml",
|
|
3041
|
+
xml: "xml",
|
|
3042
|
+
svg: "xml",
|
|
3043
|
+
json: "json",
|
|
3044
|
+
yaml: "yaml",
|
|
3045
|
+
yml: "yaml",
|
|
3046
|
+
toml: "ini",
|
|
3047
|
+
ini: "ini",
|
|
3048
|
+
r: "r",
|
|
3049
|
+
lua: "lua",
|
|
3050
|
+
pl: "perl",
|
|
3051
|
+
dockerfile: "dockerfile",
|
|
3052
|
+
diff: "diff"
|
|
3053
|
+
};
|
|
3054
|
+
var OFFICE = /* @__PURE__ */ new Set(["pptx", "ppt", "pptm", "odp", "doc", "docx", "odt", "rtf"]);
|
|
3055
|
+
var SHEET = /* @__PURE__ */ new Set(["xls", "xlsx", "xlsm", "xlsb", "ods"]);
|
|
3056
|
+
function kindOf(name, mime = "") {
|
|
3057
|
+
const e = extOf(name);
|
|
3058
|
+
if (mime.startsWith("image/") || /^(png|jpe?g|gif|webp|svg|bmp|ico|avif)$/.test(e)) return "image";
|
|
3059
|
+
if (mime === "application/pdf" || e === "pdf") return "pdf";
|
|
3060
|
+
if (mime.startsWith("video/") || ["mp4", "webm", "mov", "m4v"].includes(e)) return "video";
|
|
3061
|
+
if (mime.startsWith("audio/") || ["mp3", "wav", "ogg", "m4a", "flac"].includes(e)) return "audio";
|
|
3062
|
+
if (e === "csv" || e === "tsv") return "csv";
|
|
3063
|
+
if (e === "md" || e === "markdown") return "markdown";
|
|
3064
|
+
if (SHEET.has(e)) return "sheet";
|
|
3065
|
+
if (OFFICE.has(e)) return "office";
|
|
3066
|
+
if (mime.startsWith("text/") || LANG[e] || /^(txt|log|env|conf|cfg|gitignore)$/.test(e)) return "code";
|
|
3067
|
+
return "binary";
|
|
3068
|
+
}
|
|
3069
|
+
function delimitedToRows(text, sep) {
|
|
3070
|
+
return text.split(/\r?\n/).filter((l) => l.length).slice(0, 1e3).map((line) => {
|
|
3071
|
+
const out = [];
|
|
3072
|
+
let cur = "";
|
|
3073
|
+
let q = false;
|
|
3074
|
+
for (const ch of line) {
|
|
3075
|
+
if (ch === '"') q = !q;
|
|
3076
|
+
else if (ch === sep && !q) {
|
|
3077
|
+
out.push(cur);
|
|
3078
|
+
cur = "";
|
|
3079
|
+
} else cur += ch;
|
|
3080
|
+
}
|
|
3081
|
+
out.push(cur);
|
|
3082
|
+
return out.map((c) => c.replace(/^"|"$/g, ""));
|
|
3083
|
+
});
|
|
3084
|
+
}
|
|
3085
|
+
function Grid({ rows }) {
|
|
3086
|
+
if (!rows?.length) return /* @__PURE__ */ jsx16("div", { className: "uic-fp-empty", children: "This file is empty." });
|
|
3087
|
+
const [head, ...body] = rows;
|
|
3088
|
+
return /* @__PURE__ */ jsx16("div", { className: "uic-fp-sheet", children: /* @__PURE__ */ jsxs14("table", { children: [
|
|
3089
|
+
/* @__PURE__ */ jsx16("thead", { children: /* @__PURE__ */ jsx16("tr", { children: head.map((c, i) => /* @__PURE__ */ jsx16("th", { children: c }, i)) }) }),
|
|
3090
|
+
/* @__PURE__ */ jsx16("tbody", { children: body.map((r, i) => /* @__PURE__ */ jsx16("tr", { children: r.map((c, j) => /* @__PURE__ */ jsx16("td", { children: c }, j)) }, i)) })
|
|
3091
|
+
] }) });
|
|
3092
|
+
}
|
|
3093
|
+
var defaultDownload = (url, name) => {
|
|
3094
|
+
const a = document.createElement("a");
|
|
3095
|
+
a.href = url;
|
|
3096
|
+
a.download = name;
|
|
3097
|
+
a.rel = "noreferrer";
|
|
3098
|
+
document.body.appendChild(a);
|
|
3099
|
+
a.click();
|
|
3100
|
+
a.remove();
|
|
3101
|
+
};
|
|
3102
|
+
function FilePreview({
|
|
3103
|
+
file,
|
|
3104
|
+
onClose,
|
|
3105
|
+
fetchFile,
|
|
3106
|
+
officePdfUrl,
|
|
3107
|
+
renderMarkdown,
|
|
3108
|
+
onDownload,
|
|
3109
|
+
title
|
|
3110
|
+
}) {
|
|
3111
|
+
const { url, name } = file || {};
|
|
3112
|
+
const [st, setSt] = useState10({ kind: "loading" });
|
|
3113
|
+
const [tab, setTab] = useState10(0);
|
|
3114
|
+
useEffect10(() => {
|
|
3115
|
+
if (!url) return void 0;
|
|
3116
|
+
let alive = true;
|
|
3117
|
+
let obj;
|
|
3118
|
+
setSt({ kind: "loading" });
|
|
3119
|
+
setTab(0);
|
|
3120
|
+
const get = fetchFile || ((u) => fetch(u, { cache: "no-store" }));
|
|
3121
|
+
(async () => {
|
|
3122
|
+
const res = await get(url);
|
|
3123
|
+
if (!res.ok) throw new Error(`${res.status}`);
|
|
3124
|
+
const mime = (res.headers.get("content-type") || "").toLowerCase();
|
|
3125
|
+
const kind = kindOf(name, mime);
|
|
3126
|
+
if (kind === "office") {
|
|
3127
|
+
if (!officePdfUrl) {
|
|
3128
|
+
setSt({ kind: "binary", error: "This format has no inline preview here \u2014 download it to open it." });
|
|
3129
|
+
return;
|
|
3130
|
+
}
|
|
3131
|
+
const r = await get(officePdfUrl(url));
|
|
3132
|
+
if (!r.ok) throw new Error(`${r.status}`);
|
|
3133
|
+
obj = URL.createObjectURL(await r.blob());
|
|
3134
|
+
if (alive) setSt({ kind: "pdf", objUrl: obj });
|
|
3135
|
+
return;
|
|
3136
|
+
}
|
|
3137
|
+
if (kind === "sheet") {
|
|
3138
|
+
try {
|
|
3139
|
+
const buf = await res.arrayBuffer();
|
|
3140
|
+
const XLSX = await import("xlsx");
|
|
3141
|
+
const wb = XLSX.read(buf, { type: "array" });
|
|
3142
|
+
const sheets = wb.SheetNames.map((n) => {
|
|
3143
|
+
const ws = wb.Sheets[n] || {};
|
|
3144
|
+
const filled = Boolean(ws["!ref"]);
|
|
3145
|
+
return { name: n, filled, rows: filled ? XLSX.utils.sheet_to_json(ws, { header: 1, raw: false }) : [] };
|
|
3146
|
+
});
|
|
3147
|
+
const first = sheets.findIndex((s) => s.filled);
|
|
3148
|
+
if (alive) {
|
|
3149
|
+
setTab(first < 0 ? 0 : first);
|
|
3150
|
+
setSt({ kind: "sheet", sheets });
|
|
3151
|
+
}
|
|
3152
|
+
} catch (e) {
|
|
3153
|
+
if (alive) setSt({ kind: "binary", error: `This spreadsheet couldn\u2019t be read (${String(e?.message || "parse failed").slice(0, 80)}).` });
|
|
3154
|
+
}
|
|
3155
|
+
return;
|
|
3156
|
+
}
|
|
3157
|
+
if (kind === "csv" || kind === "markdown" || kind === "code") {
|
|
3158
|
+
const text = await res.text();
|
|
3159
|
+
if (!alive) return;
|
|
3160
|
+
if (kind === "csv") setSt({ kind: "csv", rows: delimitedToRows(text, extOf(name) === "tsv" ? " " : ",") });
|
|
3161
|
+
else setSt({ kind, text: text.slice(0, 4e5) });
|
|
3162
|
+
return;
|
|
3163
|
+
}
|
|
3164
|
+
if (kind === "binary") {
|
|
3165
|
+
if (alive) setSt({ kind: "binary" });
|
|
3166
|
+
return;
|
|
3167
|
+
}
|
|
3168
|
+
obj = URL.createObjectURL(await res.blob());
|
|
3169
|
+
if (alive) setSt({ kind, objUrl: obj });
|
|
3170
|
+
})().catch(() => {
|
|
3171
|
+
if (alive) setSt({ kind: "binary", error: "Could not load this file." });
|
|
3172
|
+
});
|
|
3173
|
+
return () => {
|
|
3174
|
+
alive = false;
|
|
3175
|
+
if (obj) URL.revokeObjectURL(obj);
|
|
3176
|
+
};
|
|
3177
|
+
}, [url, name, fetchFile, officePdfUrl]);
|
|
3178
|
+
const download = () => onDownload ? onDownload(url, name) : defaultDownload(url, name);
|
|
3179
|
+
return /* @__PURE__ */ jsxs14("aside", { className: "uic-fp", "aria-label": title || `Preview of ${name}`, children: [
|
|
3180
|
+
/* @__PURE__ */ jsxs14("header", { className: "uic-fp-head", children: [
|
|
3181
|
+
/* @__PURE__ */ jsx16("span", { className: "uic-fp-ic", children: /* @__PURE__ */ jsx16(FileTypeIcon, { name, size: 20 }) }),
|
|
3182
|
+
/* @__PURE__ */ jsx16("span", { className: "uic-fp-name", title: name, children: name }),
|
|
3183
|
+
/* @__PURE__ */ jsx16(
|
|
3184
|
+
"button",
|
|
3185
|
+
{
|
|
3186
|
+
type: "button",
|
|
3187
|
+
className: "uic-fp-btn",
|
|
3188
|
+
"aria-label": `Download ${name}`,
|
|
3189
|
+
title: "Download",
|
|
3190
|
+
onClick: download,
|
|
3191
|
+
children: /* @__PURE__ */ jsx16(IcDownload, {})
|
|
3192
|
+
}
|
|
3193
|
+
),
|
|
3194
|
+
onClose && /* @__PURE__ */ jsx16(
|
|
3195
|
+
"button",
|
|
3196
|
+
{
|
|
3197
|
+
type: "button",
|
|
3198
|
+
className: "uic-fp-btn",
|
|
3199
|
+
"aria-label": "Close preview",
|
|
3200
|
+
title: "Close",
|
|
3201
|
+
onClick: onClose,
|
|
3202
|
+
children: /* @__PURE__ */ jsx16(IcX, { size: 18 })
|
|
3203
|
+
}
|
|
3204
|
+
)
|
|
3205
|
+
] }),
|
|
3206
|
+
/* @__PURE__ */ jsxs14("div", { className: "uic-fp-body", children: [
|
|
3207
|
+
st.kind === "loading" && /* @__PURE__ */ jsx16("div", { className: "uic-fp-pad", children: /* @__PURE__ */ jsx16("span", { className: "uic-skel uic-fp-skel" }) }),
|
|
3208
|
+
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 }) }),
|
|
3209
|
+
st.kind === "pdf" && st.objUrl && /* @__PURE__ */ jsx16("iframe", { className: "uic-fp-frame", src: st.objUrl, title: name }),
|
|
3210
|
+
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 }) }),
|
|
3211
|
+
st.kind === "audio" && st.objUrl && /* @__PURE__ */ jsx16("div", { className: "uic-fp-center", children: /* @__PURE__ */ jsx16("audio", { src: st.objUrl, controls: true }) }),
|
|
3212
|
+
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 }) }),
|
|
3213
|
+
st.kind === "code" && /* @__PURE__ */ jsx16(CodeBlock, { code: st.text || "", lang: LANG[extOf(name)] || "plaintext" }),
|
|
3214
|
+
st.kind === "csv" && /* @__PURE__ */ jsx16(Grid, { rows: st.rows }),
|
|
3215
|
+
st.kind === "sheet" && st.sheets && /* @__PURE__ */ jsxs14("div", { className: "uic-fp-xlsx", children: [
|
|
3216
|
+
st.sheets[tab]?.filled ? /* @__PURE__ */ jsx16(Grid, { rows: st.sheets[tab].rows }) : /* @__PURE__ */ jsx16("div", { className: "uic-fp-empty", children: "This sheet is empty." }),
|
|
3217
|
+
/* @__PURE__ */ jsx16("div", { className: "uic-fp-tabs", children: st.sheets.map((s, i) => /* @__PURE__ */ jsx16(
|
|
3218
|
+
"button",
|
|
3219
|
+
{
|
|
3220
|
+
type: "button",
|
|
3221
|
+
className: "uic-fp-tab" + (i === tab ? " is-on" : "") + (s.filled ? "" : " is-empty"),
|
|
3222
|
+
onClick: () => setTab(i),
|
|
3223
|
+
title: s.filled ? s.name : `${s.name} (empty)`,
|
|
3224
|
+
children: s.name
|
|
3225
|
+
},
|
|
3226
|
+
s.name + i
|
|
3227
|
+
)) })
|
|
3228
|
+
] }),
|
|
3229
|
+
st.kind === "binary" && /* @__PURE__ */ jsx16("div", { className: "uic-fp-center", children: /* @__PURE__ */ jsxs14("div", { className: "uic-fp-fallback", children: [
|
|
3230
|
+
/* @__PURE__ */ jsx16(FileTypeIcon, { name, size: 56 }),
|
|
3231
|
+
/* @__PURE__ */ jsx16("p", { children: st.error || "No inline preview for this file type." }),
|
|
3232
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: "uic-fp-dl", onClick: download, children: "Download" })
|
|
3233
|
+
] }) })
|
|
3234
|
+
] })
|
|
3235
|
+
] });
|
|
3236
|
+
}
|
|
3237
|
+
|
|
3238
|
+
// src/components/form.jsx
|
|
3239
|
+
import { useId as useId2 } from "react";
|
|
3240
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3241
|
+
function Field({ label, hint, error, htmlFor, required, children, className = "" }) {
|
|
3242
|
+
return /* @__PURE__ */ jsxs15("div", { className: "uic-field" + (error ? " is-error" : "") + (className ? " " + className : ""), children: [
|
|
3243
|
+
label && /* @__PURE__ */ jsxs15("label", { className: "uic-field-label", htmlFor, children: [
|
|
3244
|
+
label,
|
|
3245
|
+
required && /* @__PURE__ */ jsx17("span", { className: "uic-field-req", "aria-hidden": "true", children: "*" })
|
|
3246
|
+
] }),
|
|
3247
|
+
children,
|
|
3248
|
+
error ? /* @__PURE__ */ jsx17("p", { className: "uic-field-err", children: error }) : hint ? /* @__PURE__ */ jsx17("p", { className: "uic-field-hint", children: hint }) : null
|
|
3249
|
+
] });
|
|
3250
|
+
}
|
|
3251
|
+
function withField(Control) {
|
|
3252
|
+
return function Fielded({ label, hint, error, required, id, className, ...rest }) {
|
|
3253
|
+
const auto = useId2();
|
|
3254
|
+
const inputId = id || auto;
|
|
3255
|
+
return /* @__PURE__ */ jsx17(Field, { label, hint, error, required, htmlFor: inputId, className, children: /* @__PURE__ */ jsx17(Control, { id: inputId, invalid: !!error, required, ...rest }) });
|
|
3256
|
+
};
|
|
3257
|
+
}
|
|
3258
|
+
function BareInput({ invalid, ...rest }) {
|
|
3259
|
+
return /* @__PURE__ */ jsx17("input", { className: "uic-input" + (invalid ? " is-error" : ""), "aria-invalid": invalid || void 0, ...rest });
|
|
3260
|
+
}
|
|
3261
|
+
function BareTextarea({ invalid, rows = 4, ...rest }) {
|
|
3262
|
+
return /* @__PURE__ */ jsx17(
|
|
3263
|
+
"textarea",
|
|
3264
|
+
{
|
|
3265
|
+
className: "uic-input uic-textarea" + (invalid ? " is-error" : ""),
|
|
3266
|
+
rows,
|
|
3267
|
+
"aria-invalid": invalid || void 0,
|
|
3268
|
+
...rest
|
|
3269
|
+
}
|
|
3270
|
+
);
|
|
3271
|
+
}
|
|
3272
|
+
function BareSelect({ invalid, options = [], placeholder, ...rest }) {
|
|
3273
|
+
return /* @__PURE__ */ jsxs15("span", { className: "uic-select-wrap", children: [
|
|
3274
|
+
/* @__PURE__ */ jsxs15(
|
|
3275
|
+
"select",
|
|
3276
|
+
{
|
|
3277
|
+
className: "uic-input uic-select" + (invalid ? " is-error" : ""),
|
|
3278
|
+
"aria-invalid": invalid || void 0,
|
|
3279
|
+
...rest,
|
|
3280
|
+
children: [
|
|
3281
|
+
placeholder && /* @__PURE__ */ jsx17("option", { value: "", children: placeholder }),
|
|
3282
|
+
options.map((o) => {
|
|
3283
|
+
const opt = typeof o === "string" ? { value: o, label: o } : o;
|
|
3284
|
+
return /* @__PURE__ */ jsx17("option", { value: opt.value, disabled: opt.disabled, children: opt.label }, opt.value);
|
|
3285
|
+
})
|
|
3286
|
+
]
|
|
3287
|
+
}
|
|
3288
|
+
),
|
|
3289
|
+
/* @__PURE__ */ jsx17("span", { className: "uic-select-chev", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(Chevron, { dir: "down", size: 14 }) })
|
|
3290
|
+
] });
|
|
3291
|
+
}
|
|
3292
|
+
var Input = withField(BareInput);
|
|
3293
|
+
var Textarea = withField(BareTextarea);
|
|
3294
|
+
var Select = withField(BareSelect);
|
|
3295
|
+
function FormActions({ children, align = "end", className = "" }) {
|
|
3296
|
+
return /* @__PURE__ */ jsx17("div", { className: `uic-form-actions is-${align}${className ? " " + className : ""}`, children });
|
|
3297
|
+
}
|
|
3298
|
+
function Button({ variant = "default", size = "md", type = "button", className = "", ...rest }) {
|
|
3299
|
+
return /* @__PURE__ */ jsx17("button", { type, className: `uic-btn is-${variant} is-${size}${className ? " " + className : ""}`, ...rest });
|
|
3300
|
+
}
|
|
3301
|
+
|
|
2879
3302
|
// src/components/Carousel.jsx
|
|
2880
|
-
import React9, { useCallback as useCallback5, useEffect as
|
|
2881
|
-
import { jsx as
|
|
3303
|
+
import React9, { useCallback as useCallback5, useEffect as useEffect11, useRef as useRef8, useState as useState11 } from "react";
|
|
3304
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2882
3305
|
var EDGE = 2;
|
|
2883
3306
|
function Carousel(props) {
|
|
2884
3307
|
const { label, step, children, classNames = {} } = props;
|
|
2885
3308
|
const ref = useRef8(null);
|
|
2886
|
-
const [edges, setEdges] =
|
|
3309
|
+
const [edges, setEdges] = useState11({ start: true, end: true, overflow: false });
|
|
2887
3310
|
const measure = useCallback5(() => {
|
|
2888
3311
|
const el = ref.current;
|
|
2889
3312
|
if (!el) return;
|
|
@@ -2894,7 +3317,7 @@ function Carousel(props) {
|
|
|
2894
3317
|
end: el.scrollLeft >= el.scrollWidth - el.clientWidth - EDGE
|
|
2895
3318
|
});
|
|
2896
3319
|
}, []);
|
|
2897
|
-
|
|
3320
|
+
useEffect11(() => {
|
|
2898
3321
|
const el = ref.current;
|
|
2899
3322
|
if (!el) return void 0;
|
|
2900
3323
|
measure();
|
|
@@ -2908,8 +3331,8 @@ function Carousel(props) {
|
|
|
2908
3331
|
if (!el) return;
|
|
2909
3332
|
el.scrollBy({ left: dir * (step || Math.round(el.clientWidth * 0.9)), behavior: "smooth" });
|
|
2910
3333
|
};
|
|
2911
|
-
return /* @__PURE__ */
|
|
2912
|
-
edges.overflow ? /* @__PURE__ */
|
|
3334
|
+
return /* @__PURE__ */ jsxs16("div", { className: ["uic-carousel-wrap", classNames.root || ""].filter(Boolean).join(" "), children: [
|
|
3335
|
+
edges.overflow ? /* @__PURE__ */ jsx18(
|
|
2913
3336
|
"button",
|
|
2914
3337
|
{
|
|
2915
3338
|
type: "button",
|
|
@@ -2917,10 +3340,10 @@ function Carousel(props) {
|
|
|
2917
3340
|
onClick: () => scroll(-1),
|
|
2918
3341
|
disabled: edges.start,
|
|
2919
3342
|
"aria-label": `Scroll ${label} left`,
|
|
2920
|
-
children: /* @__PURE__ */
|
|
3343
|
+
children: /* @__PURE__ */ jsx18(Chevron, { dir: "left" })
|
|
2921
3344
|
}
|
|
2922
3345
|
) : null,
|
|
2923
|
-
/* @__PURE__ */
|
|
3346
|
+
/* @__PURE__ */ jsx18(
|
|
2924
3347
|
"div",
|
|
2925
3348
|
{
|
|
2926
3349
|
className: ["uic-carousel", classNames.viewport || ""].filter(Boolean).join(" "),
|
|
@@ -2931,7 +3354,7 @@ function Carousel(props) {
|
|
|
2931
3354
|
children
|
|
2932
3355
|
}
|
|
2933
3356
|
),
|
|
2934
|
-
edges.overflow ? /* @__PURE__ */
|
|
3357
|
+
edges.overflow ? /* @__PURE__ */ jsx18(
|
|
2935
3358
|
"button",
|
|
2936
3359
|
{
|
|
2937
3360
|
type: "button",
|
|
@@ -2939,7 +3362,7 @@ function Carousel(props) {
|
|
|
2939
3362
|
onClick: () => scroll(1),
|
|
2940
3363
|
disabled: edges.end,
|
|
2941
3364
|
"aria-label": `Scroll ${label} right`,
|
|
2942
|
-
children: /* @__PURE__ */
|
|
3365
|
+
children: /* @__PURE__ */ jsx18(Chevron, { dir: "right" })
|
|
2943
3366
|
}
|
|
2944
3367
|
) : null
|
|
2945
3368
|
] });
|
|
@@ -2947,34 +3370,34 @@ function Carousel(props) {
|
|
|
2947
3370
|
|
|
2948
3371
|
// src/components/Card.jsx
|
|
2949
3372
|
import React10 from "react";
|
|
2950
|
-
import { jsx as
|
|
3373
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2951
3374
|
function Card(props) {
|
|
2952
|
-
const { art, title, subtitle, onClick, selected = false, overlay, actions, classNames = {} } = props;
|
|
2953
|
-
const foot = /* @__PURE__ */
|
|
2954
|
-
/* @__PURE__ */
|
|
2955
|
-
|
|
3375
|
+
const { art, title, subtitle: subtitle2, onClick, selected = false, overlay, actions, classNames = {} } = props;
|
|
3376
|
+
const foot = /* @__PURE__ */ jsxs17("span", { className: "uic-card-foot", children: [
|
|
3377
|
+
/* @__PURE__ */ jsx19("span", { className: "uic-card-name", children: title }),
|
|
3378
|
+
subtitle2 ? /* @__PURE__ */ jsx19("span", { className: "uic-card-sub", children: subtitle2 }) : null
|
|
2956
3379
|
] });
|
|
2957
|
-
return /* @__PURE__ */
|
|
2958
|
-
onClick ? /* @__PURE__ */
|
|
2959
|
-
/* @__PURE__ */
|
|
3380
|
+
return /* @__PURE__ */ jsxs17("div", { className: ["uic-card", selected ? "is-selected" : "", classNames.root || ""].filter(Boolean).join(" "), children: [
|
|
3381
|
+
onClick ? /* @__PURE__ */ jsxs17("button", { type: "button", className: "uic-card-main", onClick, "aria-pressed": selected || void 0, children: [
|
|
3382
|
+
/* @__PURE__ */ jsx19("span", { className: "uic-card-art", children: art }),
|
|
2960
3383
|
foot
|
|
2961
|
-
] }) : /* @__PURE__ */
|
|
2962
|
-
/* @__PURE__ */
|
|
3384
|
+
] }) : /* @__PURE__ */ jsxs17("div", { className: "uic-card-main", children: [
|
|
3385
|
+
/* @__PURE__ */ jsx19("span", { className: "uic-card-art", children: art }),
|
|
2963
3386
|
foot
|
|
2964
3387
|
] }),
|
|
2965
|
-
overlay ? /* @__PURE__ */
|
|
2966
|
-
actions ? /* @__PURE__ */
|
|
3388
|
+
overlay ? /* @__PURE__ */ jsx19("div", { className: "uic-card-overlay", children: overlay }) : null,
|
|
3389
|
+
actions ? /* @__PURE__ */ jsx19("div", { className: "uic-card-actions", children: actions }) : null
|
|
2967
3390
|
] });
|
|
2968
3391
|
}
|
|
2969
3392
|
|
|
2970
3393
|
// src/components/SearchField.jsx
|
|
2971
3394
|
import React11 from "react";
|
|
2972
|
-
import { jsx as
|
|
3395
|
+
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2973
3396
|
function SearchField(props) {
|
|
2974
3397
|
const { value, onChange, placeholder, clearLabel = "Clear search", className } = props;
|
|
2975
|
-
return /* @__PURE__ */
|
|
2976
|
-
/* @__PURE__ */
|
|
2977
|
-
/* @__PURE__ */
|
|
3398
|
+
return /* @__PURE__ */ jsxs18("label", { className: ["uic-search", className || ""].filter(Boolean).join(" "), children: [
|
|
3399
|
+
/* @__PURE__ */ jsx20("span", { className: "uic-search-ic", "aria-hidden": "true", children: /* @__PURE__ */ jsx20(IcSearch, {}) }),
|
|
3400
|
+
/* @__PURE__ */ jsx20(
|
|
2978
3401
|
"input",
|
|
2979
3402
|
{
|
|
2980
3403
|
type: "search",
|
|
@@ -2984,14 +3407,14 @@ function SearchField(props) {
|
|
|
2984
3407
|
onChange: (e) => onChange(e.target.value)
|
|
2985
3408
|
}
|
|
2986
3409
|
),
|
|
2987
|
-
value ? /* @__PURE__ */
|
|
3410
|
+
value ? /* @__PURE__ */ jsx20("button", { type: "button", className: "uic-search-x", "aria-label": clearLabel, onClick: () => onChange(""), children: /* @__PURE__ */ jsx20(IcX, { size: 12 }) }) : null
|
|
2988
3411
|
] });
|
|
2989
3412
|
}
|
|
2990
3413
|
|
|
2991
3414
|
// src/components/Popover.jsx
|
|
2992
|
-
import React12, { useCallback as useCallback6, useEffect as
|
|
3415
|
+
import React12, { useCallback as useCallback6, useEffect as useEffect12, useRef as useRef9, useState as useState12 } from "react";
|
|
2993
3416
|
import { createPortal as createPortal3 } from "react-dom";
|
|
2994
|
-
import { jsx as
|
|
3417
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
2995
3418
|
var GAP = 6;
|
|
2996
3419
|
var MARGIN = 8;
|
|
2997
3420
|
function Popover(props) {
|
|
@@ -3007,8 +3430,8 @@ function Popover(props) {
|
|
|
3007
3430
|
label
|
|
3008
3431
|
} = props;
|
|
3009
3432
|
const popRef = useRef9(null);
|
|
3010
|
-
const [pos, setPos] =
|
|
3011
|
-
|
|
3433
|
+
const [pos, setPos] = useState12(null);
|
|
3434
|
+
useEffect12(() => {
|
|
3012
3435
|
if (!open) {
|
|
3013
3436
|
setPos(null);
|
|
3014
3437
|
return void 0;
|
|
@@ -3035,7 +3458,7 @@ function Popover(props) {
|
|
|
3035
3458
|
window.removeEventListener("scroll", place, true);
|
|
3036
3459
|
};
|
|
3037
3460
|
}, [open, anchorRef, width, minHeight, placement]);
|
|
3038
|
-
|
|
3461
|
+
useEffect12(() => {
|
|
3039
3462
|
if (!open) return void 0;
|
|
3040
3463
|
const onDown = (e) => {
|
|
3041
3464
|
if (popRef.current?.contains(e.target)) return;
|
|
@@ -3049,7 +3472,7 @@ function Popover(props) {
|
|
|
3049
3472
|
useOverlayEscape(open, escape);
|
|
3050
3473
|
if (!open || !pos || typeof document === "undefined") return null;
|
|
3051
3474
|
return createPortal3(
|
|
3052
|
-
/* @__PURE__ */
|
|
3475
|
+
/* @__PURE__ */ jsx21(
|
|
3053
3476
|
"div",
|
|
3054
3477
|
{
|
|
3055
3478
|
ref: popRef,
|
|
@@ -3065,9 +3488,9 @@ function Popover(props) {
|
|
|
3065
3488
|
}
|
|
3066
3489
|
|
|
3067
3490
|
// src/components/Modal.jsx
|
|
3068
|
-
import React13, { useCallback as useCallback7, useEffect as
|
|
3491
|
+
import React13, { useCallback as useCallback7, useEffect as useEffect13, useId as useId3 } from "react";
|
|
3069
3492
|
import { createPortal as createPortal4 } from "react-dom";
|
|
3070
|
-
import { jsx as
|
|
3493
|
+
import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3071
3494
|
function Modal(props) {
|
|
3072
3495
|
const {
|
|
3073
3496
|
open,
|
|
@@ -3081,10 +3504,10 @@ function Modal(props) {
|
|
|
3081
3504
|
children,
|
|
3082
3505
|
classNames = {}
|
|
3083
3506
|
} = props;
|
|
3084
|
-
const titleId =
|
|
3507
|
+
const titleId = useId3();
|
|
3085
3508
|
const escape = useCallback7(() => onClose?.(), [onClose]);
|
|
3086
3509
|
useOverlayEscape(open, escape);
|
|
3087
|
-
|
|
3510
|
+
useEffect13(() => {
|
|
3088
3511
|
if (!open || typeof document === "undefined") return void 0;
|
|
3089
3512
|
const prev = document.body.style.overflow;
|
|
3090
3513
|
document.body.style.overflow = "hidden";
|
|
@@ -3097,12 +3520,12 @@ function Modal(props) {
|
|
|
3097
3520
|
if (e.target === e.currentTarget) onClose?.();
|
|
3098
3521
|
};
|
|
3099
3522
|
return createPortal4(
|
|
3100
|
-
/* @__PURE__ */
|
|
3523
|
+
/* @__PURE__ */ jsx22(
|
|
3101
3524
|
"div",
|
|
3102
3525
|
{
|
|
3103
3526
|
className: ["uic-modal-backdrop", classNames.backdrop || ""].filter(Boolean).join(" "),
|
|
3104
3527
|
onMouseDown: onBackdrop,
|
|
3105
|
-
children: /* @__PURE__ */
|
|
3528
|
+
children: /* @__PURE__ */ jsxs19(
|
|
3106
3529
|
"div",
|
|
3107
3530
|
{
|
|
3108
3531
|
className: ["uic-modal", `is-${size}`, classNames.root || ""].filter(Boolean).join(" "),
|
|
@@ -3111,15 +3534,15 @@ function Modal(props) {
|
|
|
3111
3534
|
"aria-modal": "true",
|
|
3112
3535
|
"aria-labelledby": labelledBy || (title ? titleId : void 0),
|
|
3113
3536
|
children: [
|
|
3114
|
-
title || actions ? /* @__PURE__ */
|
|
3115
|
-
/* @__PURE__ */
|
|
3116
|
-
title ? /* @__PURE__ */
|
|
3117
|
-
description ? /* @__PURE__ */
|
|
3537
|
+
title || actions ? /* @__PURE__ */ jsxs19("div", { className: "uic-modal-h", children: [
|
|
3538
|
+
/* @__PURE__ */ jsxs19("div", { className: "uic-modal-title", children: [
|
|
3539
|
+
title ? /* @__PURE__ */ jsx22("h3", { id: titleId, children: title }) : null,
|
|
3540
|
+
description ? /* @__PURE__ */ jsx22("p", { children: description }) : null
|
|
3118
3541
|
] }),
|
|
3119
3542
|
actions,
|
|
3120
|
-
/* @__PURE__ */
|
|
3543
|
+
/* @__PURE__ */ jsx22("button", { type: "button", className: "uic-modal-x", "aria-label": "Close", onClick: onClose, children: /* @__PURE__ */ jsx22(IcX, { size: 18 }) })
|
|
3121
3544
|
] }) : null,
|
|
3122
|
-
/* @__PURE__ */
|
|
3545
|
+
/* @__PURE__ */ jsx22("div", { className: ["uic-modal-b", classNames.body || ""].filter(Boolean).join(" "), children })
|
|
3123
3546
|
]
|
|
3124
3547
|
}
|
|
3125
3548
|
)
|
|
@@ -3130,15 +3553,15 @@ function Modal(props) {
|
|
|
3130
3553
|
}
|
|
3131
3554
|
|
|
3132
3555
|
// src/hooks/useTypewriter.js
|
|
3133
|
-
import { useEffect as
|
|
3556
|
+
import { useEffect as useEffect14, useRef as useRef10, useState as useState13 } from "react";
|
|
3134
3557
|
var CHAR_MS = 26;
|
|
3135
3558
|
var HOLD_MS = 2600;
|
|
3136
3559
|
function useTypewriter(phrases, { active = true } = {}) {
|
|
3137
3560
|
const list = phrases && phrases.length ? phrases : [""];
|
|
3138
|
-
const [text, setText] =
|
|
3561
|
+
const [text, setText] = useState13(list[0]);
|
|
3139
3562
|
const listRef = useRef10(list);
|
|
3140
3563
|
listRef.current = list;
|
|
3141
|
-
|
|
3564
|
+
useEffect14(() => {
|
|
3142
3565
|
if (!active) return void 0;
|
|
3143
3566
|
if (typeof window === "undefined") return void 0;
|
|
3144
3567
|
if (window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches) {
|
|
@@ -3170,6 +3593,7 @@ function useTypewriter(phrases, { active = true } = {}) {
|
|
|
3170
3593
|
export {
|
|
3171
3594
|
AssistantTurn,
|
|
3172
3595
|
AuthForm,
|
|
3596
|
+
Button,
|
|
3173
3597
|
Card,
|
|
3174
3598
|
Carousel,
|
|
3175
3599
|
ChatMessages,
|
|
@@ -3181,10 +3605,17 @@ export {
|
|
|
3181
3605
|
Composer,
|
|
3182
3606
|
DEFAULT_STATUS_LABELS,
|
|
3183
3607
|
DialogHost,
|
|
3608
|
+
Field,
|
|
3609
|
+
FileCard,
|
|
3610
|
+
FilePreview,
|
|
3611
|
+
FileTypeIcon,
|
|
3612
|
+
FormActions,
|
|
3184
3613
|
GOOGLE_ENABLED,
|
|
3185
3614
|
GoogleButton,
|
|
3186
3615
|
IcCheck,
|
|
3187
3616
|
IcDoc,
|
|
3617
|
+
IcDownload,
|
|
3618
|
+
IcEye,
|
|
3188
3619
|
IcGlobe,
|
|
3189
3620
|
IcList,
|
|
3190
3621
|
IcMic,
|
|
@@ -3200,14 +3631,17 @@ export {
|
|
|
3200
3631
|
IcThink,
|
|
3201
3632
|
IcTool,
|
|
3202
3633
|
IcX,
|
|
3634
|
+
Input,
|
|
3203
3635
|
Modal,
|
|
3204
3636
|
PaneResizer,
|
|
3205
3637
|
Popover,
|
|
3206
3638
|
SESSION_EVENT,
|
|
3207
3639
|
SearchField,
|
|
3640
|
+
Select,
|
|
3208
3641
|
SheetGrid,
|
|
3209
3642
|
Svg,
|
|
3210
3643
|
TaskList,
|
|
3644
|
+
Textarea,
|
|
3211
3645
|
ToolGroup,
|
|
3212
3646
|
ToolRow,
|
|
3213
3647
|
UserTurn,
|
|
@@ -3221,7 +3655,9 @@ export {
|
|
|
3221
3655
|
createConversationStore,
|
|
3222
3656
|
createDictation,
|
|
3223
3657
|
createResponsesDispatcher,
|
|
3658
|
+
extOf,
|
|
3224
3659
|
fetchBalance,
|
|
3660
|
+
fitRowHeights,
|
|
3225
3661
|
getSession,
|
|
3226
3662
|
getToken,
|
|
3227
3663
|
googleSignIn,
|