reifyui 0.7.0 → 0.7.2
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 +64 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +37 -40
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FileCard.jsx +20 -26
- package/src/index.js +1 -1
- package/src/sheet/SheetGrid.jsx +32 -2
- package/styles/file.css +13 -14
- package/styles/sheet.css +2 -2
package/dist/index.cjs
CHANGED
|
@@ -95,6 +95,7 @@ __export(src_exports, {
|
|
|
95
95
|
createResponsesDispatcher: () => createResponsesDispatcher,
|
|
96
96
|
extOf: () => extOf,
|
|
97
97
|
fetchBalance: () => fetchBalance,
|
|
98
|
+
fitRowHeights: () => fitRowHeights,
|
|
98
99
|
getSession: () => getSession,
|
|
99
100
|
getToken: () => getToken,
|
|
100
101
|
googleSignIn: () => googleSignIn,
|
|
@@ -2768,6 +2769,7 @@ function SheetGrid({
|
|
|
2768
2769
|
rows.map((row, ri) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2769
2770
|
"tr",
|
|
2770
2771
|
{
|
|
2772
|
+
"data-row-id": row.id,
|
|
2771
2773
|
style: {
|
|
2772
2774
|
...rowHeight(row) ? { height: rowHeight(row) } : null,
|
|
2773
2775
|
"--shg-clamp": Math.max(1, Math.floor(((rowHeight(row) || 34) - 10) / 18))
|
|
@@ -2809,6 +2811,7 @@ function SheetGrid({
|
|
|
2809
2811
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2810
2812
|
"td",
|
|
2811
2813
|
{
|
|
2814
|
+
"data-col-id": col.id,
|
|
2812
2815
|
className: "shg-cell" + (computed ? " shg-cell-compute" : "") + (c.status && computed ? ` shg-cell-${c.status}` : "") + (peer ? " shg-cell-peer" : ""),
|
|
2813
2816
|
style: peer ? { boxShadow: `inset 0 0 0 2px ${peer.color}` } : void 0,
|
|
2814
2817
|
onClick: (e) => {
|
|
@@ -3069,6 +3072,21 @@ function ColumnMenu({ col, columns, anchor, columnTypes, renderColumnConfig, onA
|
|
|
3069
3072
|
}
|
|
3070
3073
|
);
|
|
3071
3074
|
}
|
|
3075
|
+
function fitRowHeights(container, { rowIds, min = 34, max = 320, padding = 12 } = {}) {
|
|
3076
|
+
if (!container) return {};
|
|
3077
|
+
const out = {};
|
|
3078
|
+
const rows = container.querySelectorAll("tr[data-row-id]");
|
|
3079
|
+
for (const tr of rows) {
|
|
3080
|
+
const id = tr.getAttribute("data-row-id");
|
|
3081
|
+
if (rowIds && !rowIds.includes(id)) continue;
|
|
3082
|
+
let tallest = 0;
|
|
3083
|
+
for (const cell of tr.querySelectorAll("td[data-col-id] .shg-val")) {
|
|
3084
|
+
tallest = Math.max(tallest, cell.scrollHeight);
|
|
3085
|
+
}
|
|
3086
|
+
if (tallest) out[id] = Math.min(max, Math.max(min, Math.round(tallest + padding)));
|
|
3087
|
+
}
|
|
3088
|
+
return out;
|
|
3089
|
+
}
|
|
3072
3090
|
function defaultCellText(cell) {
|
|
3073
3091
|
const v = cell?.value;
|
|
3074
3092
|
if (v == null) return "";
|
|
@@ -3136,7 +3154,6 @@ function FileTypeIcon({ name, size = 36 }) {
|
|
|
3136
3154
|
}
|
|
3137
3155
|
|
|
3138
3156
|
// src/components/FileCard.jsx
|
|
3139
|
-
var import_react17 = require("react");
|
|
3140
3157
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
3141
3158
|
function subtitle(name, origin, bytes) {
|
|
3142
3159
|
const parts = [(extOf(name) || "file").toUpperCase()];
|
|
@@ -3150,15 +3167,7 @@ function bytesLabel2(n) {
|
|
|
3150
3167
|
if (n < 1048576) return `${Math.round(n / 1024)} KB`;
|
|
3151
3168
|
return `${(n / 1048576).toFixed(1)} MB`;
|
|
3152
3169
|
}
|
|
3153
|
-
function FileCard({
|
|
3154
|
-
name,
|
|
3155
|
-
origin,
|
|
3156
|
-
bytes,
|
|
3157
|
-
onPreview,
|
|
3158
|
-
onDownload,
|
|
3159
|
-
compact = false,
|
|
3160
|
-
className = ""
|
|
3161
|
-
}) {
|
|
3170
|
+
function FileCard({ name, origin = "output", bytes, onPreview, onDownload, className = "" }) {
|
|
3162
3171
|
const open = onPreview ? (e) => {
|
|
3163
3172
|
e.stopPropagation();
|
|
3164
3173
|
onPreview();
|
|
@@ -3166,7 +3175,7 @@ function FileCard({
|
|
|
3166
3175
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
3167
3176
|
"div",
|
|
3168
3177
|
{
|
|
3169
|
-
className: "uic-filecard" + (
|
|
3178
|
+
className: "uic-filecard" + (open ? " is-clickable" : "") + (className ? " " + className : ""),
|
|
3170
3179
|
onClick: open,
|
|
3171
3180
|
role: open ? "button" : void 0,
|
|
3172
3181
|
tabIndex: open ? 0 : void 0,
|
|
@@ -3178,45 +3187,33 @@ function FileCard({
|
|
|
3178
3187
|
} : void 0,
|
|
3179
3188
|
title: name,
|
|
3180
3189
|
children: [
|
|
3181
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "uic-filecard-ic", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FileTypeIcon, { name, size:
|
|
3190
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "uic-filecard-ic", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FileTypeIcon, { name, size: 32 }) }),
|
|
3182
3191
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "uic-filecard-meta", children: [
|
|
3183
3192
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "uic-filecard-name", children: name }),
|
|
3184
|
-
|
|
3193
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "uic-filecard-sub", children: subtitle(name, origin, bytes) })
|
|
3185
3194
|
] }),
|
|
3186
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
onPreview && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3202
|
-
"button",
|
|
3203
|
-
{
|
|
3204
|
-
type: "button",
|
|
3205
|
-
className: "uic-filecard-btn",
|
|
3206
|
-
"aria-label": `Preview ${name}`,
|
|
3207
|
-
title: "Preview",
|
|
3208
|
-
onClick: open,
|
|
3209
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(IcEye, {})
|
|
3210
|
-
}
|
|
3211
|
-
)
|
|
3212
|
-
] })
|
|
3195
|
+
onDownload && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3196
|
+
"button",
|
|
3197
|
+
{
|
|
3198
|
+
type: "button",
|
|
3199
|
+
className: "uic-filecard-dl",
|
|
3200
|
+
"aria-label": `Download ${name}`,
|
|
3201
|
+
title: "Download",
|
|
3202
|
+
onClick: (e) => {
|
|
3203
|
+
e.stopPropagation();
|
|
3204
|
+
onDownload();
|
|
3205
|
+
},
|
|
3206
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(IcDownload, { size: 18 })
|
|
3207
|
+
}
|
|
3208
|
+
),
|
|
3209
|
+
onPreview && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("button", { type: "button", className: "uic-filecard-open", "aria-label": `Preview ${name}`, onClick: open, children: "Preview" })
|
|
3213
3210
|
]
|
|
3214
3211
|
}
|
|
3215
3212
|
);
|
|
3216
3213
|
}
|
|
3217
3214
|
|
|
3218
3215
|
// src/components/FilePreview.jsx
|
|
3219
|
-
var
|
|
3216
|
+
var import_react17 = require("react");
|
|
3220
3217
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3221
3218
|
var LANG = {
|
|
3222
3219
|
js: "javascript",
|
|
@@ -3319,9 +3316,9 @@ function FilePreview({
|
|
|
3319
3316
|
title
|
|
3320
3317
|
}) {
|
|
3321
3318
|
const { url, name } = file || {};
|
|
3322
|
-
const [st, setSt] = (0,
|
|
3323
|
-
const [tab, setTab] = (0,
|
|
3324
|
-
(0,
|
|
3319
|
+
const [st, setSt] = (0, import_react17.useState)({ kind: "loading" });
|
|
3320
|
+
const [tab, setTab] = (0, import_react17.useState)(0);
|
|
3321
|
+
(0, import_react17.useEffect)(() => {
|
|
3325
3322
|
if (!url) return void 0;
|
|
3326
3323
|
let alive = true;
|
|
3327
3324
|
let obj;
|
|
@@ -3446,7 +3443,7 @@ function FilePreview({
|
|
|
3446
3443
|
}
|
|
3447
3444
|
|
|
3448
3445
|
// src/components/form.jsx
|
|
3449
|
-
var
|
|
3446
|
+
var import_react18 = require("react");
|
|
3450
3447
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3451
3448
|
function Field({ label, hint, error, htmlFor, required, children, className = "" }) {
|
|
3452
3449
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "uic-field" + (error ? " is-error" : "") + (className ? " " + className : ""), children: [
|
|
@@ -3460,7 +3457,7 @@ function Field({ label, hint, error, htmlFor, required, children, className = ""
|
|
|
3460
3457
|
}
|
|
3461
3458
|
function withField(Control) {
|
|
3462
3459
|
return function Fielded({ label, hint, error, required, id, className, ...rest }) {
|
|
3463
|
-
const auto = (0,
|
|
3460
|
+
const auto = (0, import_react18.useId)();
|
|
3464
3461
|
const inputId = id || auto;
|
|
3465
3462
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Field, { label, hint, error, required, htmlFor: inputId, className, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Control, { id: inputId, invalid: !!error, required, ...rest }) });
|
|
3466
3463
|
};
|
|
@@ -3510,14 +3507,14 @@ function Button({ variant = "default", size = "md", type = "button", className =
|
|
|
3510
3507
|
}
|
|
3511
3508
|
|
|
3512
3509
|
// src/components/Carousel.jsx
|
|
3513
|
-
var
|
|
3510
|
+
var import_react19 = __toESM(require("react"), 1);
|
|
3514
3511
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3515
3512
|
var EDGE = 2;
|
|
3516
3513
|
function Carousel(props) {
|
|
3517
3514
|
const { label, step, children, classNames = {} } = props;
|
|
3518
|
-
const ref = (0,
|
|
3519
|
-
const [edges, setEdges] = (0,
|
|
3520
|
-
const measure = (0,
|
|
3515
|
+
const ref = (0, import_react19.useRef)(null);
|
|
3516
|
+
const [edges, setEdges] = (0, import_react19.useState)({ start: true, end: true, overflow: false });
|
|
3517
|
+
const measure = (0, import_react19.useCallback)(() => {
|
|
3521
3518
|
const el = ref.current;
|
|
3522
3519
|
if (!el) return;
|
|
3523
3520
|
const overflow = el.scrollWidth - el.clientWidth > EDGE;
|
|
@@ -3527,7 +3524,7 @@ function Carousel(props) {
|
|
|
3527
3524
|
end: el.scrollLeft >= el.scrollWidth - el.clientWidth - EDGE
|
|
3528
3525
|
});
|
|
3529
3526
|
}, []);
|
|
3530
|
-
(0,
|
|
3527
|
+
(0, import_react19.useEffect)(() => {
|
|
3531
3528
|
const el = ref.current;
|
|
3532
3529
|
if (!el) return void 0;
|
|
3533
3530
|
measure();
|
|
@@ -3579,7 +3576,7 @@ function Carousel(props) {
|
|
|
3579
3576
|
}
|
|
3580
3577
|
|
|
3581
3578
|
// src/components/Card.jsx
|
|
3582
|
-
var
|
|
3579
|
+
var import_react20 = __toESM(require("react"), 1);
|
|
3583
3580
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3584
3581
|
function Card(props) {
|
|
3585
3582
|
const { art, title, subtitle: subtitle2, onClick, selected = false, overlay, actions, classNames = {} } = props;
|
|
@@ -3601,7 +3598,7 @@ function Card(props) {
|
|
|
3601
3598
|
}
|
|
3602
3599
|
|
|
3603
3600
|
// src/components/SearchField.jsx
|
|
3604
|
-
var
|
|
3601
|
+
var import_react21 = __toESM(require("react"), 1);
|
|
3605
3602
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3606
3603
|
function SearchField(props) {
|
|
3607
3604
|
const { value, onChange, placeholder, clearLabel = "Clear search", className } = props;
|
|
@@ -3622,7 +3619,7 @@ function SearchField(props) {
|
|
|
3622
3619
|
}
|
|
3623
3620
|
|
|
3624
3621
|
// src/components/Popover.jsx
|
|
3625
|
-
var
|
|
3622
|
+
var import_react22 = __toESM(require("react"), 1);
|
|
3626
3623
|
var import_react_dom3 = require("react-dom");
|
|
3627
3624
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3628
3625
|
var GAP = 6;
|
|
@@ -3639,9 +3636,9 @@ function Popover(props) {
|
|
|
3639
3636
|
className,
|
|
3640
3637
|
label
|
|
3641
3638
|
} = props;
|
|
3642
|
-
const popRef = (0,
|
|
3643
|
-
const [pos, setPos] = (0,
|
|
3644
|
-
(0,
|
|
3639
|
+
const popRef = (0, import_react22.useRef)(null);
|
|
3640
|
+
const [pos, setPos] = (0, import_react22.useState)(null);
|
|
3641
|
+
(0, import_react22.useEffect)(() => {
|
|
3645
3642
|
if (!open) {
|
|
3646
3643
|
setPos(null);
|
|
3647
3644
|
return void 0;
|
|
@@ -3668,7 +3665,7 @@ function Popover(props) {
|
|
|
3668
3665
|
window.removeEventListener("scroll", place, true);
|
|
3669
3666
|
};
|
|
3670
3667
|
}, [open, anchorRef, width, minHeight, placement]);
|
|
3671
|
-
(0,
|
|
3668
|
+
(0, import_react22.useEffect)(() => {
|
|
3672
3669
|
if (!open) return void 0;
|
|
3673
3670
|
const onDown = (e) => {
|
|
3674
3671
|
if (popRef.current?.contains(e.target)) return;
|
|
@@ -3678,7 +3675,7 @@ function Popover(props) {
|
|
|
3678
3675
|
document.addEventListener("pointerdown", onDown);
|
|
3679
3676
|
return () => document.removeEventListener("pointerdown", onDown);
|
|
3680
3677
|
}, [open, anchorRef, onClose]);
|
|
3681
|
-
const escape = (0,
|
|
3678
|
+
const escape = (0, import_react22.useCallback)(() => onClose?.(), [onClose]);
|
|
3682
3679
|
useOverlayEscape(open, escape);
|
|
3683
3680
|
if (!open || !pos || typeof document === "undefined") return null;
|
|
3684
3681
|
return (0, import_react_dom3.createPortal)(
|
|
@@ -3698,7 +3695,7 @@ function Popover(props) {
|
|
|
3698
3695
|
}
|
|
3699
3696
|
|
|
3700
3697
|
// src/components/Modal.jsx
|
|
3701
|
-
var
|
|
3698
|
+
var import_react23 = __toESM(require("react"), 1);
|
|
3702
3699
|
var import_react_dom4 = require("react-dom");
|
|
3703
3700
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3704
3701
|
function Modal(props) {
|
|
@@ -3714,10 +3711,10 @@ function Modal(props) {
|
|
|
3714
3711
|
children,
|
|
3715
3712
|
classNames = {}
|
|
3716
3713
|
} = props;
|
|
3717
|
-
const titleId = (0,
|
|
3718
|
-
const escape = (0,
|
|
3714
|
+
const titleId = (0, import_react23.useId)();
|
|
3715
|
+
const escape = (0, import_react23.useCallback)(() => onClose?.(), [onClose]);
|
|
3719
3716
|
useOverlayEscape(open, escape);
|
|
3720
|
-
(0,
|
|
3717
|
+
(0, import_react23.useEffect)(() => {
|
|
3721
3718
|
if (!open || typeof document === "undefined") return void 0;
|
|
3722
3719
|
const prev = document.body.style.overflow;
|
|
3723
3720
|
document.body.style.overflow = "hidden";
|
|
@@ -3763,15 +3760,15 @@ function Modal(props) {
|
|
|
3763
3760
|
}
|
|
3764
3761
|
|
|
3765
3762
|
// src/hooks/useTypewriter.js
|
|
3766
|
-
var
|
|
3763
|
+
var import_react24 = require("react");
|
|
3767
3764
|
var CHAR_MS = 26;
|
|
3768
3765
|
var HOLD_MS = 2600;
|
|
3769
3766
|
function useTypewriter(phrases, { active = true } = {}) {
|
|
3770
3767
|
const list = phrases && phrases.length ? phrases : [""];
|
|
3771
|
-
const [text, setText] = (0,
|
|
3772
|
-
const listRef = (0,
|
|
3768
|
+
const [text, setText] = (0, import_react24.useState)(list[0]);
|
|
3769
|
+
const listRef = (0, import_react24.useRef)(list);
|
|
3773
3770
|
listRef.current = list;
|
|
3774
|
-
(0,
|
|
3771
|
+
(0, import_react24.useEffect)(() => {
|
|
3775
3772
|
if (!active) return void 0;
|
|
3776
3773
|
if (typeof window === "undefined") return void 0;
|
|
3777
3774
|
if (window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches) {
|