reifyui 0.7.1 → 0.7.3
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 +47 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +20 -41
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/FileCard.jsx +20 -26
- package/src/sheet/SheetGrid.jsx +3 -2
- package/styles/file.css +13 -14
- package/styles/sheet.css +11 -6
package/dist/index.cjs
CHANGED
|
@@ -2564,7 +2564,7 @@ function SheetGrid({
|
|
|
2564
2564
|
}
|
|
2565
2565
|
return cls;
|
|
2566
2566
|
};
|
|
2567
|
-
const numW = Math.max(
|
|
2567
|
+
const numW = Math.max(48, 30 + String(rows.length || 1).length * 9);
|
|
2568
2568
|
const numStyle = { width: numW, minWidth: numW, maxWidth: numW };
|
|
2569
2569
|
const rowHeight = (row) => sizeDraft.row && sizeDraft.row[row.id] || row.height || void 0;
|
|
2570
2570
|
(0, import_react15.useEffect)(() => {
|
|
@@ -3154,7 +3154,6 @@ function FileTypeIcon({ name, size = 36 }) {
|
|
|
3154
3154
|
}
|
|
3155
3155
|
|
|
3156
3156
|
// src/components/FileCard.jsx
|
|
3157
|
-
var import_react17 = require("react");
|
|
3158
3157
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
3159
3158
|
function subtitle(name, origin, bytes) {
|
|
3160
3159
|
const parts = [(extOf(name) || "file").toUpperCase()];
|
|
@@ -3168,15 +3167,7 @@ function bytesLabel2(n) {
|
|
|
3168
3167
|
if (n < 1048576) return `${Math.round(n / 1024)} KB`;
|
|
3169
3168
|
return `${(n / 1048576).toFixed(1)} MB`;
|
|
3170
3169
|
}
|
|
3171
|
-
function FileCard({
|
|
3172
|
-
name,
|
|
3173
|
-
origin,
|
|
3174
|
-
bytes,
|
|
3175
|
-
onPreview,
|
|
3176
|
-
onDownload,
|
|
3177
|
-
compact = false,
|
|
3178
|
-
className = ""
|
|
3179
|
-
}) {
|
|
3170
|
+
function FileCard({ name, origin = "output", bytes, onPreview, onDownload, className = "" }) {
|
|
3180
3171
|
const open = onPreview ? (e) => {
|
|
3181
3172
|
e.stopPropagation();
|
|
3182
3173
|
onPreview();
|
|
@@ -3184,7 +3175,7 @@ function FileCard({
|
|
|
3184
3175
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
3185
3176
|
"div",
|
|
3186
3177
|
{
|
|
3187
|
-
className: "uic-filecard" + (
|
|
3178
|
+
className: "uic-filecard" + (open ? " is-clickable" : "") + (className ? " " + className : ""),
|
|
3188
3179
|
onClick: open,
|
|
3189
3180
|
role: open ? "button" : void 0,
|
|
3190
3181
|
tabIndex: open ? 0 : void 0,
|
|
@@ -3196,45 +3187,33 @@ function FileCard({
|
|
|
3196
3187
|
} : void 0,
|
|
3197
3188
|
title: name,
|
|
3198
3189
|
children: [
|
|
3199
|
-
/* @__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 }) }),
|
|
3200
3191
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "uic-filecard-meta", children: [
|
|
3201
3192
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "uic-filecard-name", children: name }),
|
|
3202
|
-
|
|
3193
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "uic-filecard-sub", children: subtitle(name, origin, bytes) })
|
|
3203
3194
|
] }),
|
|
3204
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
onPreview && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3220
|
-
"button",
|
|
3221
|
-
{
|
|
3222
|
-
type: "button",
|
|
3223
|
-
className: "uic-filecard-btn",
|
|
3224
|
-
"aria-label": `Preview ${name}`,
|
|
3225
|
-
title: "Preview",
|
|
3226
|
-
onClick: open,
|
|
3227
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(IcEye, {})
|
|
3228
|
-
}
|
|
3229
|
-
)
|
|
3230
|
-
] })
|
|
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" })
|
|
3231
3210
|
]
|
|
3232
3211
|
}
|
|
3233
3212
|
);
|
|
3234
3213
|
}
|
|
3235
3214
|
|
|
3236
3215
|
// src/components/FilePreview.jsx
|
|
3237
|
-
var
|
|
3216
|
+
var import_react17 = require("react");
|
|
3238
3217
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3239
3218
|
var LANG = {
|
|
3240
3219
|
js: "javascript",
|
|
@@ -3337,9 +3316,9 @@ function FilePreview({
|
|
|
3337
3316
|
title
|
|
3338
3317
|
}) {
|
|
3339
3318
|
const { url, name } = file || {};
|
|
3340
|
-
const [st, setSt] = (0,
|
|
3341
|
-
const [tab, setTab] = (0,
|
|
3342
|
-
(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)(() => {
|
|
3343
3322
|
if (!url) return void 0;
|
|
3344
3323
|
let alive = true;
|
|
3345
3324
|
let obj;
|
|
@@ -3464,7 +3443,7 @@ function FilePreview({
|
|
|
3464
3443
|
}
|
|
3465
3444
|
|
|
3466
3445
|
// src/components/form.jsx
|
|
3467
|
-
var
|
|
3446
|
+
var import_react18 = require("react");
|
|
3468
3447
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3469
3448
|
function Field({ label, hint, error, htmlFor, required, children, className = "" }) {
|
|
3470
3449
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "uic-field" + (error ? " is-error" : "") + (className ? " " + className : ""), children: [
|
|
@@ -3478,7 +3457,7 @@ function Field({ label, hint, error, htmlFor, required, children, className = ""
|
|
|
3478
3457
|
}
|
|
3479
3458
|
function withField(Control) {
|
|
3480
3459
|
return function Fielded({ label, hint, error, required, id, className, ...rest }) {
|
|
3481
|
-
const auto = (0,
|
|
3460
|
+
const auto = (0, import_react18.useId)();
|
|
3482
3461
|
const inputId = id || auto;
|
|
3483
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 }) });
|
|
3484
3463
|
};
|
|
@@ -3528,14 +3507,14 @@ function Button({ variant = "default", size = "md", type = "button", className =
|
|
|
3528
3507
|
}
|
|
3529
3508
|
|
|
3530
3509
|
// src/components/Carousel.jsx
|
|
3531
|
-
var
|
|
3510
|
+
var import_react19 = __toESM(require("react"), 1);
|
|
3532
3511
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3533
3512
|
var EDGE = 2;
|
|
3534
3513
|
function Carousel(props) {
|
|
3535
3514
|
const { label, step, children, classNames = {} } = props;
|
|
3536
|
-
const ref = (0,
|
|
3537
|
-
const [edges, setEdges] = (0,
|
|
3538
|
-
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)(() => {
|
|
3539
3518
|
const el = ref.current;
|
|
3540
3519
|
if (!el) return;
|
|
3541
3520
|
const overflow = el.scrollWidth - el.clientWidth > EDGE;
|
|
@@ -3545,7 +3524,7 @@ function Carousel(props) {
|
|
|
3545
3524
|
end: el.scrollLeft >= el.scrollWidth - el.clientWidth - EDGE
|
|
3546
3525
|
});
|
|
3547
3526
|
}, []);
|
|
3548
|
-
(0,
|
|
3527
|
+
(0, import_react19.useEffect)(() => {
|
|
3549
3528
|
const el = ref.current;
|
|
3550
3529
|
if (!el) return void 0;
|
|
3551
3530
|
measure();
|
|
@@ -3597,7 +3576,7 @@ function Carousel(props) {
|
|
|
3597
3576
|
}
|
|
3598
3577
|
|
|
3599
3578
|
// src/components/Card.jsx
|
|
3600
|
-
var
|
|
3579
|
+
var import_react20 = __toESM(require("react"), 1);
|
|
3601
3580
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3602
3581
|
function Card(props) {
|
|
3603
3582
|
const { art, title, subtitle: subtitle2, onClick, selected = false, overlay, actions, classNames = {} } = props;
|
|
@@ -3619,7 +3598,7 @@ function Card(props) {
|
|
|
3619
3598
|
}
|
|
3620
3599
|
|
|
3621
3600
|
// src/components/SearchField.jsx
|
|
3622
|
-
var
|
|
3601
|
+
var import_react21 = __toESM(require("react"), 1);
|
|
3623
3602
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3624
3603
|
function SearchField(props) {
|
|
3625
3604
|
const { value, onChange, placeholder, clearLabel = "Clear search", className } = props;
|
|
@@ -3640,7 +3619,7 @@ function SearchField(props) {
|
|
|
3640
3619
|
}
|
|
3641
3620
|
|
|
3642
3621
|
// src/components/Popover.jsx
|
|
3643
|
-
var
|
|
3622
|
+
var import_react22 = __toESM(require("react"), 1);
|
|
3644
3623
|
var import_react_dom3 = require("react-dom");
|
|
3645
3624
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3646
3625
|
var GAP = 6;
|
|
@@ -3657,9 +3636,9 @@ function Popover(props) {
|
|
|
3657
3636
|
className,
|
|
3658
3637
|
label
|
|
3659
3638
|
} = props;
|
|
3660
|
-
const popRef = (0,
|
|
3661
|
-
const [pos, setPos] = (0,
|
|
3662
|
-
(0,
|
|
3639
|
+
const popRef = (0, import_react22.useRef)(null);
|
|
3640
|
+
const [pos, setPos] = (0, import_react22.useState)(null);
|
|
3641
|
+
(0, import_react22.useEffect)(() => {
|
|
3663
3642
|
if (!open) {
|
|
3664
3643
|
setPos(null);
|
|
3665
3644
|
return void 0;
|
|
@@ -3686,7 +3665,7 @@ function Popover(props) {
|
|
|
3686
3665
|
window.removeEventListener("scroll", place, true);
|
|
3687
3666
|
};
|
|
3688
3667
|
}, [open, anchorRef, width, minHeight, placement]);
|
|
3689
|
-
(0,
|
|
3668
|
+
(0, import_react22.useEffect)(() => {
|
|
3690
3669
|
if (!open) return void 0;
|
|
3691
3670
|
const onDown = (e) => {
|
|
3692
3671
|
if (popRef.current?.contains(e.target)) return;
|
|
@@ -3696,7 +3675,7 @@ function Popover(props) {
|
|
|
3696
3675
|
document.addEventListener("pointerdown", onDown);
|
|
3697
3676
|
return () => document.removeEventListener("pointerdown", onDown);
|
|
3698
3677
|
}, [open, anchorRef, onClose]);
|
|
3699
|
-
const escape = (0,
|
|
3678
|
+
const escape = (0, import_react22.useCallback)(() => onClose?.(), [onClose]);
|
|
3700
3679
|
useOverlayEscape(open, escape);
|
|
3701
3680
|
if (!open || !pos || typeof document === "undefined") return null;
|
|
3702
3681
|
return (0, import_react_dom3.createPortal)(
|
|
@@ -3716,7 +3695,7 @@ function Popover(props) {
|
|
|
3716
3695
|
}
|
|
3717
3696
|
|
|
3718
3697
|
// src/components/Modal.jsx
|
|
3719
|
-
var
|
|
3698
|
+
var import_react23 = __toESM(require("react"), 1);
|
|
3720
3699
|
var import_react_dom4 = require("react-dom");
|
|
3721
3700
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3722
3701
|
function Modal(props) {
|
|
@@ -3732,10 +3711,10 @@ function Modal(props) {
|
|
|
3732
3711
|
children,
|
|
3733
3712
|
classNames = {}
|
|
3734
3713
|
} = props;
|
|
3735
|
-
const titleId = (0,
|
|
3736
|
-
const escape = (0,
|
|
3714
|
+
const titleId = (0, import_react23.useId)();
|
|
3715
|
+
const escape = (0, import_react23.useCallback)(() => onClose?.(), [onClose]);
|
|
3737
3716
|
useOverlayEscape(open, escape);
|
|
3738
|
-
(0,
|
|
3717
|
+
(0, import_react23.useEffect)(() => {
|
|
3739
3718
|
if (!open || typeof document === "undefined") return void 0;
|
|
3740
3719
|
const prev = document.body.style.overflow;
|
|
3741
3720
|
document.body.style.overflow = "hidden";
|
|
@@ -3781,15 +3760,15 @@ function Modal(props) {
|
|
|
3781
3760
|
}
|
|
3782
3761
|
|
|
3783
3762
|
// src/hooks/useTypewriter.js
|
|
3784
|
-
var
|
|
3763
|
+
var import_react24 = require("react");
|
|
3785
3764
|
var CHAR_MS = 26;
|
|
3786
3765
|
var HOLD_MS = 2600;
|
|
3787
3766
|
function useTypewriter(phrases, { active = true } = {}) {
|
|
3788
3767
|
const list = phrases && phrases.length ? phrases : [""];
|
|
3789
|
-
const [text, setText] = (0,
|
|
3790
|
-
const listRef = (0,
|
|
3768
|
+
const [text, setText] = (0, import_react24.useState)(list[0]);
|
|
3769
|
+
const listRef = (0, import_react24.useRef)(list);
|
|
3791
3770
|
listRef.current = list;
|
|
3792
|
-
(0,
|
|
3771
|
+
(0, import_react24.useEffect)(() => {
|
|
3793
3772
|
if (!active) return void 0;
|
|
3794
3773
|
if (typeof window === "undefined") return void 0;
|
|
3795
3774
|
if (window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches) {
|