@vertebr/react 0.20.0 → 0.21.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/components/dialog/Dialog.d.ts +43 -0
- package/dist/components/dialog/Dialog.d.ts.map +1 -0
- package/dist/components/dialog/Dialog.js +41 -0
- package/dist/components/resources/ResourceCell.d.ts.map +1 -1
- package/dist/components/resources/ResourceCell.js +10 -0
- package/dist/components/resources/ResourceTable.d.ts.map +1 -1
- package/dist/components/resources/ResourceTable.js +20 -3
- package/dist/components/resources/ResourceViewModal.d.ts.map +1 -1
- package/dist/components/resources/ResourceViewModal.js +78 -16
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/styles/cells.css +13 -0
- package/dist/styles/modal.css +172 -7
- package/package.json +1 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
/** Same caps as MUI Dialog `maxWidth`. */
|
|
3
|
+
export type DialogMaxWidth = "xs" | "sm" | "md" | "lg" | "xl" | false;
|
|
4
|
+
export type DialogProps = {
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Largest width the paper will grow to.
|
|
9
|
+
* `false` leaves width to the content.
|
|
10
|
+
* @default "sm"
|
|
11
|
+
*/
|
|
12
|
+
maxWidth?: DialogMaxWidth;
|
|
13
|
+
/** Stretch the paper to {@link maxWidth} instead of hugging content. */
|
|
14
|
+
fullWidth?: boolean;
|
|
15
|
+
className?: string;
|
|
16
|
+
"aria-label"?: string;
|
|
17
|
+
"aria-labelledby"?: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Modal shell. Backdrop, scroll lock, and Escape live here.
|
|
21
|
+
* Compose with {@link DialogTitle}, {@link DialogContent}, and {@link DialogActions}.
|
|
22
|
+
*/
|
|
23
|
+
export declare function Dialog({ onClose, children, maxWidth, fullWidth, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, }: DialogProps): import("react").JSX.Element;
|
|
24
|
+
export type DialogTitleProps = {
|
|
25
|
+
id?: string;
|
|
26
|
+
eyebrow?: ReactNode;
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
/** Header actions, typically Close. */
|
|
29
|
+
actions?: ReactNode;
|
|
30
|
+
};
|
|
31
|
+
export declare function DialogTitle({ id, eyebrow, children, actions, }: DialogTitleProps): import("react").JSX.Element;
|
|
32
|
+
export type DialogContentProps = {
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
className?: string;
|
|
35
|
+
/** Hairline rules above and below the body, like MUI `dividers`. */
|
|
36
|
+
dividers?: boolean;
|
|
37
|
+
};
|
|
38
|
+
export declare function DialogContent({ children, className, dividers, }: DialogContentProps): import("react").JSX.Element;
|
|
39
|
+
export type DialogActionsProps = {
|
|
40
|
+
children: ReactNode;
|
|
41
|
+
};
|
|
42
|
+
export declare function DialogActions({ children }: DialogActionsProps): import("react").JSX.Element;
|
|
43
|
+
//# sourceMappingURL=Dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzD,0CAA0C;AAC1C,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;AAEtE,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,wEAAwE;IACxE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,MAAM,CAAC,EACrB,OAAO,EACP,QAAQ,EACR,QAAe,EACf,SAAiB,EACjB,SAAS,EACT,YAAY,EAAE,SAAS,EACvB,iBAAiB,EAAE,cAAc,GAClC,EAAE,WAAW,+BAoCb;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;IACpB,uCAAuC;IACvC,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAC1B,EAAE,EACF,OAAO,EACP,QAAQ,EACR,OAAO,GACR,EAAE,gBAAgB,+BAWlB;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,SAAS,EACT,QAAgB,GACjB,EAAE,kBAAkB,+BAepB;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,kBAAkB,+BAM7D"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useId } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Modal shell. Backdrop, scroll lock, and Escape live here.
|
|
5
|
+
* Compose with {@link DialogTitle}, {@link DialogContent}, and {@link DialogActions}.
|
|
6
|
+
*/
|
|
7
|
+
export function Dialog({ onClose, children, maxWidth = "sm", fullWidth = false, className, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, }) {
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const onKeyDown = (event) => {
|
|
10
|
+
if (event.key === "Escape")
|
|
11
|
+
onClose();
|
|
12
|
+
};
|
|
13
|
+
window.addEventListener("keydown", onKeyDown);
|
|
14
|
+
const previous = document.body.style.overflow;
|
|
15
|
+
document.body.style.overflow = "hidden";
|
|
16
|
+
return () => {
|
|
17
|
+
window.removeEventListener("keydown", onKeyDown);
|
|
18
|
+
document.body.style.overflow = previous;
|
|
19
|
+
};
|
|
20
|
+
}, [onClose]);
|
|
21
|
+
return (_jsx("div", { className: "vertebr-modal-backdrop vertebr-dialog-backdrop", role: "presentation", onClick: onClose, children: _jsx("div", { className: ["vertebr-modal", "vertebr-dialog", className]
|
|
22
|
+
.filter(Boolean)
|
|
23
|
+
.join(" "), role: "dialog", "aria-modal": "true", "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "data-max-width": maxWidth === false ? undefined : maxWidth, "data-full-width": fullWidth ? "true" : undefined, onClick: (event) => event.stopPropagation(), children: children }) }));
|
|
24
|
+
}
|
|
25
|
+
export function DialogTitle({ id, eyebrow, children, actions, }) {
|
|
26
|
+
const autoId = useId();
|
|
27
|
+
return (_jsxs("header", { className: "vertebr-modal-head vertebr-dialog-title", children: [_jsxs("div", { className: "vertebr-modal-heading", children: [eyebrow ? _jsx("p", { className: "vertebr-modal-eyebrow", children: eyebrow }) : null, _jsx("h2", { id: id ?? autoId, children: children })] }), actions ? _jsx("div", { className: "vertebr-modal-actions", children: actions }) : null] }));
|
|
28
|
+
}
|
|
29
|
+
export function DialogContent({ children, className, dividers = false, }) {
|
|
30
|
+
return (_jsx("div", { className: [
|
|
31
|
+
"vertebr-modal-body",
|
|
32
|
+
"vertebr-dialog-content",
|
|
33
|
+
dividers ? "vertebr-dialog-content-dividers" : "",
|
|
34
|
+
className,
|
|
35
|
+
]
|
|
36
|
+
.filter(Boolean)
|
|
37
|
+
.join(" "), children: children }));
|
|
38
|
+
}
|
|
39
|
+
export function DialogActions({ children }) {
|
|
40
|
+
return (_jsx("footer", { className: "vertebr-modal-foot vertebr-dialog-actions", children: children }));
|
|
41
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceCell.d.ts","sourceRoot":"","sources":["../../../src/components/resources/ResourceCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"ResourceCell.d.ts","sourceRoot":"","sources":["../../../src/components/resources/ResourceCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AA+CnD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;IACf,+CAA+C;IAC/C,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC9B,CAAC;AAEF,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,KAAK,EACL,KAAK,EACL,OAAiB,GAClB,EAAE,iBAAiB,+BAkInB"}
|
|
@@ -6,6 +6,7 @@ const IMAGE_EXT = /\.(png|jpe?g|gif|webp|svg|avif)(\?|#|$)/i;
|
|
|
6
6
|
function looksLikeUrl(value) {
|
|
7
7
|
return /^https?:\/\//i.test(value) || value.startsWith("//");
|
|
8
8
|
}
|
|
9
|
+
const ISO_DATE = /^\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}|$)/;
|
|
9
10
|
function looksLikeImageUrl(value) {
|
|
10
11
|
if (!looksLikeUrl(value))
|
|
11
12
|
return false;
|
|
@@ -77,6 +78,15 @@ export function ResourceCell({ fieldKey, field, value, variant = "table", }) {
|
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
80
|
if (typeof value === "string") {
|
|
81
|
+
if (ISO_DATE.test(value)) {
|
|
82
|
+
const formatted = formatDate(value);
|
|
83
|
+
if (formatted) {
|
|
84
|
+
return _jsx("span", { className: "vertebr-cell-datetime", children: formatted });
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (detail && value.length > 28 && !/\s/.test(value)) {
|
|
88
|
+
return _jsx("code", { className: "vertebr-cell-token", children: value });
|
|
89
|
+
}
|
|
80
90
|
if (URL_KEY.test(fieldKey) || looksLikeUrl(value)) {
|
|
81
91
|
return (_jsx("a", { className: "vertebr-cell-link", href: value.startsWith("//") ? `https:${value}` : value, target: "_blank", rel: "noreferrer", title: value, onClick: (event) => event.stopPropagation(), children: detail ? value : value.replace(/^https?:\/\//i, "") }));
|
|
82
92
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceTable.d.ts","sourceRoot":"","sources":["../../../src/components/resources/ResourceTable.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAwBzB,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAExB,KAAK,kBAAkB,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IACjC,WAAW,CAAC,EAAE;QACZ,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAC7C,uDAAuD;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAC7C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CAAC;IACpD,aAAa,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,QAAQ,GAAG,UAAU,CAAC,CAAC;IAChE,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAC7C,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAC5D,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACpD,CAAC;AAsJF,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,KAAK,EACL,WAAW,EACX,OAAY,EACZ,KAAK,EACL,OAAO,EACP,SAA0C,EAC1C,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,iBAAsB,EACtB,kBAAkB,EAClB,WAAgB,EAChB,YAAY,EACZ,SAAS,EACT,KAAK,EACL,OAAe,EACf,WAAgB,EAChB,cAAc,EACd,IAAI,EAAE,QAAe,EACrB,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,iBAAiB,GAClB,EAAE,kBAAkB,+BAuiCpB;AAED,uCAAuC;AACvC,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;CAClC,+BAEA"}
|
|
@@ -44,10 +44,27 @@ function humanizeKey(key) {
|
|
|
44
44
|
.trim();
|
|
45
45
|
}
|
|
46
46
|
function rowTitle(row, keys) {
|
|
47
|
-
|
|
47
|
+
const preferred = [
|
|
48
|
+
"confirmationNumber",
|
|
49
|
+
"name",
|
|
50
|
+
"title",
|
|
51
|
+
"label",
|
|
52
|
+
"shippingName",
|
|
53
|
+
"customerName",
|
|
54
|
+
"email",
|
|
55
|
+
"customerEmail",
|
|
56
|
+
...keys,
|
|
57
|
+
];
|
|
58
|
+
for (const key of preferred) {
|
|
48
59
|
const value = row[key];
|
|
49
|
-
if (typeof value
|
|
50
|
-
|
|
60
|
+
if (typeof value !== "string")
|
|
61
|
+
continue;
|
|
62
|
+
const trimmed = value.trim();
|
|
63
|
+
if (!trimmed)
|
|
64
|
+
continue;
|
|
65
|
+
if (trimmed.length > 28 && !/\s/.test(trimmed))
|
|
66
|
+
continue;
|
|
67
|
+
return trimmed;
|
|
51
68
|
}
|
|
52
69
|
return "Record";
|
|
53
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceViewModal.d.ts","sourceRoot":"","sources":["../../../src/components/resources/ResourceViewModal.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"ResourceViewModal.d.ts","sourceRoot":"","sources":["../../../src/components/resources/ResourceViewModal.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAInD,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACpC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AA+GF,wBAAgB,iBAAiB,CAAC,EAChC,MAAM,EACN,GAAG,EACH,KAAK,EACL,OAAO,EACP,OAAO,EACP,MAAM,GACP,EAAE,sBAAsB,+BAgFxB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from "react";
|
|
3
|
+
import { Dialog, DialogContent, DialogTitle } from "../dialog/Dialog";
|
|
3
4
|
import { ResourceCell } from "./ResourceCell";
|
|
4
5
|
function humanizeKey(key) {
|
|
5
6
|
return key
|
|
@@ -8,6 +9,77 @@ function humanizeKey(key) {
|
|
|
8
9
|
.replace(/\bcents\b/i, "")
|
|
9
10
|
.trim();
|
|
10
11
|
}
|
|
12
|
+
const HEADING_KEYS = [
|
|
13
|
+
"confirmationNumber",
|
|
14
|
+
"name",
|
|
15
|
+
"title",
|
|
16
|
+
"label",
|
|
17
|
+
"shippingName",
|
|
18
|
+
"customerName",
|
|
19
|
+
"email",
|
|
20
|
+
"customerEmail",
|
|
21
|
+
];
|
|
22
|
+
function isToken(value) {
|
|
23
|
+
const trimmed = value.trim();
|
|
24
|
+
return trimmed.length > 28 && !/\s/.test(trimmed);
|
|
25
|
+
}
|
|
26
|
+
function readableHeading(value) {
|
|
27
|
+
if (typeof value !== "string")
|
|
28
|
+
return null;
|
|
29
|
+
const trimmed = value.trim();
|
|
30
|
+
if (!trimmed || trimmed.length > 80 || isToken(trimmed))
|
|
31
|
+
return null;
|
|
32
|
+
return trimmed;
|
|
33
|
+
}
|
|
34
|
+
function recordHeading(row, fallback) {
|
|
35
|
+
for (const key of HEADING_KEYS) {
|
|
36
|
+
const heading = readableHeading(row[key]);
|
|
37
|
+
if (heading)
|
|
38
|
+
return heading;
|
|
39
|
+
}
|
|
40
|
+
return readableHeading(fallback) ?? "Record";
|
|
41
|
+
}
|
|
42
|
+
/** Long or structured values get the full row so they wrap instead of colliding. */
|
|
43
|
+
function spansRow(value) {
|
|
44
|
+
if (typeof value === "string") {
|
|
45
|
+
return value.length > 36 || value.includes("\n");
|
|
46
|
+
}
|
|
47
|
+
if (Array.isArray(value)) {
|
|
48
|
+
return value.some((entry) => typeof entry === "string" && entry.length > 36);
|
|
49
|
+
}
|
|
50
|
+
if (value instanceof Date)
|
|
51
|
+
return false;
|
|
52
|
+
if (value &&
|
|
53
|
+
typeof value === "object" &&
|
|
54
|
+
"toDate" in value &&
|
|
55
|
+
typeof value.toDate === "function") {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
return value != null && typeof value === "object";
|
|
59
|
+
}
|
|
60
|
+
/** Keep short fields in pairs. A leftover short field fills the row before a wide one. */
|
|
61
|
+
function layoutFields(entries) {
|
|
62
|
+
const laid = [];
|
|
63
|
+
let compact = [];
|
|
64
|
+
const flush = () => {
|
|
65
|
+
compact.forEach(([key, value], index) => {
|
|
66
|
+
const fillRow = compact.length % 2 === 1 && index === compact.length - 1;
|
|
67
|
+
laid.push({ key, value, span: fillRow });
|
|
68
|
+
});
|
|
69
|
+
compact = [];
|
|
70
|
+
};
|
|
71
|
+
for (const entry of entries) {
|
|
72
|
+
if (spansRow(entry[1])) {
|
|
73
|
+
flush();
|
|
74
|
+
laid.push({ key: entry[0], value: entry[1], span: true });
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
compact.push(entry);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
flush();
|
|
81
|
+
return laid;
|
|
82
|
+
}
|
|
11
83
|
function findHeroImage(schema, row) {
|
|
12
84
|
for (const [key, value] of Object.entries(row)) {
|
|
13
85
|
if (typeof value !== "string" || !/^https?:\/\//i.test(value))
|
|
@@ -27,18 +99,8 @@ export function ResourceViewModal({ schema, row, title, canEdit, onClose, onEdit
|
|
|
27
99
|
? fields.map((key) => [key, row[key]])
|
|
28
100
|
: Object.entries(row);
|
|
29
101
|
const hero = findHeroImage(schema, row);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
window.addEventListener("keydown", onKeyDown);
|
|
36
|
-
const previous = document.body.style.overflow;
|
|
37
|
-
document.body.style.overflow = "hidden";
|
|
38
|
-
return () => {
|
|
39
|
-
window.removeEventListener("keydown", onKeyDown);
|
|
40
|
-
document.body.style.overflow = previous;
|
|
41
|
-
};
|
|
42
|
-
}, [onClose]);
|
|
43
|
-
return (_jsx("div", { className: "vertebr-modal-backdrop", role: "presentation", onClick: onClose, children: _jsxs("div", { className: "vertebr-modal", role: "dialog", "aria-modal": "true", "aria-label": title, onClick: (event) => event.stopPropagation(), children: [_jsxs("header", { className: "vertebr-modal-head", children: [_jsxs("div", { className: "vertebr-modal-heading", children: [_jsx("p", { className: "vertebr-modal-eyebrow", children: "Record" }), _jsx("h2", { children: title })] }), _jsxs("div", { className: "vertebr-modal-actions", children: [canEdit && onEdit ? (_jsx("button", { type: "button", className: "vertebr-btn vertebr-btn-primary", onClick: onEdit, children: "Edit" })) : null, _jsx("button", { type: "button", className: "vertebr-btn", onClick: onClose, "aria-label": "Close", children: "Close" })] })] }), _jsxs("div", { className: "vertebr-modal-body", children: [hero ? (_jsx("div", { className: "vertebr-modal-hero", children: _jsx("img", { src: hero, alt: "" }) })) : null, _jsx("dl", { className: "vertebr-modal-fields", children: entries.map(([key, value]) => (_jsxs("div", { className: "vertebr-modal-field", children: [_jsx("dt", { children: schema[key]?.label ?? humanizeKey(key) }), _jsx("dd", { children: _jsx(ResourceCell, { fieldKey: key, field: schema[key], value: value, variant: "detail" }) })] }, key))) })] })] }) }));
|
|
102
|
+
const heading = recordHeading(row, title);
|
|
103
|
+
const fieldsToShow = layoutFields(entries);
|
|
104
|
+
const titleId = useId();
|
|
105
|
+
return (_jsxs(Dialog, { onClose: onClose, maxWidth: "sm", fullWidth: true, className: "vertebr-record-modal", "aria-labelledby": titleId, children: [_jsxs(DialogTitle, { id: titleId, eyebrow: "Record", actions: _jsxs(_Fragment, { children: [canEdit && onEdit ? (_jsx("button", { type: "button", className: "vertebr-btn vertebr-btn-primary", onClick: onEdit, children: "Edit" })) : null, _jsx("button", { type: "button", className: "vertebr-btn", onClick: onClose, "aria-label": "Close", children: "Close" })] }), children: [heading, heading === "Record" && isToken(title) ? (_jsx("span", { className: "vertebr-modal-id", title: title, children: title })) : null] }), _jsxs(DialogContent, { children: [hero ? (_jsx("div", { className: "vertebr-modal-hero", children: _jsx("img", { src: hero, alt: "" }) })) : null, _jsx("dl", { className: "vertebr-modal-fields", children: fieldsToShow.map(({ key, value, span }) => (_jsxs("div", { className: "vertebr-modal-field", "data-span": span ? "full" : undefined, children: [_jsx("dt", { children: schema[key]?.label ?? humanizeKey(key) }), _jsx("dd", { children: _jsx(ResourceCell, { fieldKey: key, field: schema[key], value: value, variant: "detail" }) })] }, key))) })] })] }));
|
|
44
106
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export type { EmailsActivityPanelProps } from "./components/emails/EmailsActivit
|
|
|
13
13
|
export { ResourcePanel, ResourceTable } from "./components/resources/ResourceTable";
|
|
14
14
|
export { SortableHeader } from "./components/resources/SortableHeader";
|
|
15
15
|
export { SelectionTableDialog } from "./components/dialog/SelectionTableDialog";
|
|
16
|
+
export { Dialog, DialogActions, DialogContent, DialogTitle, } from "./components/dialog/Dialog";
|
|
17
|
+
export type { DialogActionsProps, DialogContentProps, DialogMaxWidth, DialogProps, DialogTitleProps, } from "./components/dialog/Dialog";
|
|
16
18
|
export type { SelectionTableDialogProps, SelectionTableDialogOverrides, SelectionTableRow, SelectionTableColumnLabels, } from "./components/dialog/SelectionTableDialog";
|
|
17
19
|
export { compareFieldValues, nextTableSort, sortRows, type SortOrder, type TableSortState, } from "./lib/sort";
|
|
18
20
|
export { ThemeToggle } from "./components/theme/ThemeToggle";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,YAAY,EAAE,iBAAiB,EAAE,MAAM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M,iBAAiB,CAAC;AACzB,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,qBAAqB,EACrB,WAAW,EACX,SAAS,EACT,WAAW,EACX,WAAW,EACX,eAAe,EACf,WAAW,EACX,cAAc,EACd,GAAG,EACH,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export { EmailsBoard } from "./components/emails/EmailsBoard";
|
|
|
7
7
|
export { ResourcePanel, ResourceTable } from "./components/resources/ResourceTable";
|
|
8
8
|
export { SortableHeader } from "./components/resources/SortableHeader";
|
|
9
9
|
export { SelectionTableDialog } from "./components/dialog/SelectionTableDialog";
|
|
10
|
+
export { Dialog, DialogActions, DialogContent, DialogTitle, } from "./components/dialog/Dialog";
|
|
10
11
|
export { compareFieldValues, nextTableSort, sortRows, } from "./lib/sort";
|
|
11
12
|
export { ThemeToggle } from "./components/theme/ThemeToggle";
|
|
12
13
|
export { ConfigForm } from "./components/config/ConfigForm";
|
package/dist/styles/cells.css
CHANGED
|
@@ -94,6 +94,19 @@
|
|
|
94
94
|
font-family: var(--vb-mono);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
.vertebr-cell-token {
|
|
98
|
+
display: block;
|
|
99
|
+
max-width: 100%;
|
|
100
|
+
margin: 0;
|
|
101
|
+
font-family: var(--vb-mono);
|
|
102
|
+
font-size: 0.78rem;
|
|
103
|
+
line-height: 1.45;
|
|
104
|
+
color: var(--vb-text);
|
|
105
|
+
white-space: normal;
|
|
106
|
+
overflow-wrap: anywhere;
|
|
107
|
+
word-break: break-word;
|
|
108
|
+
}
|
|
109
|
+
|
|
97
110
|
.vertebr-cell-json {
|
|
98
111
|
display: inline-block;
|
|
99
112
|
max-width: 14rem;
|
package/dist/styles/modal.css
CHANGED
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
inset: 0;
|
|
6
6
|
/* Above shell chrome, toasts (100), and command palette (90). */
|
|
7
7
|
z-index: 200;
|
|
8
|
-
display:
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
padding: 2rem;
|
|
12
|
+
overflow: auto;
|
|
11
13
|
background: color-mix(in srgb, var(--vb-bg) 55%, rgba(0, 0, 0, 0.45));
|
|
12
14
|
backdrop-filter: blur(6px);
|
|
13
15
|
animation: vb-fade-in var(--vb-duration-normal) var(--vb-ease);
|
|
@@ -15,7 +17,10 @@
|
|
|
15
17
|
|
|
16
18
|
.vertebr-modal {
|
|
17
19
|
width: min(100%, 720px);
|
|
18
|
-
|
|
20
|
+
min-width: 0;
|
|
21
|
+
min-height: 0;
|
|
22
|
+
max-width: min(100%, calc(100vw - 4rem));
|
|
23
|
+
max-height: calc(100dvh - 4rem);
|
|
19
24
|
display: flex;
|
|
20
25
|
flex-direction: column;
|
|
21
26
|
overflow: hidden;
|
|
@@ -28,6 +33,64 @@
|
|
|
28
33
|
animation: vb-pop-in var(--vb-duration-normal) var(--vb-ease);
|
|
29
34
|
}
|
|
30
35
|
|
|
36
|
+
/* MUI-style paper: hug content up to maxWidth, scroll the body. */
|
|
37
|
+
.vertebr-dialog {
|
|
38
|
+
width: fit-content;
|
|
39
|
+
max-height: calc(100dvh - 4rem);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.vertebr-dialog[data-max-width="xs"] {
|
|
43
|
+
max-width: min(27.75rem, 100%);
|
|
44
|
+
}
|
|
45
|
+
.vertebr-dialog[data-max-width="sm"] {
|
|
46
|
+
max-width: min(37.5rem, 100%);
|
|
47
|
+
}
|
|
48
|
+
.vertebr-dialog[data-max-width="md"] {
|
|
49
|
+
max-width: min(56.25rem, 100%);
|
|
50
|
+
}
|
|
51
|
+
.vertebr-dialog[data-max-width="lg"] {
|
|
52
|
+
max-width: min(75rem, 100%);
|
|
53
|
+
}
|
|
54
|
+
.vertebr-dialog[data-max-width="xl"] {
|
|
55
|
+
max-width: min(96rem, 100%);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.vertebr-dialog[data-full-width="true"] {
|
|
59
|
+
width: 100%;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.vertebr-dialog-content {
|
|
63
|
+
flex: 1 1 auto;
|
|
64
|
+
min-width: 0;
|
|
65
|
+
min-height: 0;
|
|
66
|
+
overflow-x: auto;
|
|
67
|
+
overflow-y: auto;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.vertebr-dialog-content-dividers {
|
|
71
|
+
border-top: 1px solid var(--vb-border);
|
|
72
|
+
border-bottom: 1px solid var(--vb-border);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.vertebr-dialog-actions {
|
|
76
|
+
display: flex;
|
|
77
|
+
flex: none;
|
|
78
|
+
justify-content: flex-end;
|
|
79
|
+
gap: 0.45rem;
|
|
80
|
+
padding: 0.85rem 1.25rem 1.05rem;
|
|
81
|
+
border-top: 1px solid var(--vb-border);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.vertebr-dialog-title h2 {
|
|
85
|
+
display: flex;
|
|
86
|
+
flex-direction: column;
|
|
87
|
+
gap: 0.35rem;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.vertebr-record-modal {
|
|
91
|
+
container-type: inline-size;
|
|
92
|
+
}
|
|
93
|
+
|
|
31
94
|
.vertebr-modal-form {
|
|
32
95
|
width: min(100%, 960px);
|
|
33
96
|
max-height: min(92vh, 920px);
|
|
@@ -51,15 +114,34 @@
|
|
|
51
114
|
align-items: flex-start;
|
|
52
115
|
justify-content: space-between;
|
|
53
116
|
gap: 1rem;
|
|
117
|
+
flex: none;
|
|
54
118
|
padding: 1.15rem 1.25rem;
|
|
55
119
|
border-bottom: 1px solid var(--vb-border);
|
|
56
120
|
background: var(--vb-surface-tint);
|
|
57
121
|
}
|
|
58
122
|
|
|
123
|
+
.vertebr-modal-heading {
|
|
124
|
+
flex: 1 1 auto;
|
|
125
|
+
min-width: 0;
|
|
126
|
+
}
|
|
127
|
+
|
|
59
128
|
.vertebr-modal-heading h2 {
|
|
60
129
|
margin: 0.15rem 0 0;
|
|
61
130
|
font-size: 1.25rem;
|
|
62
131
|
letter-spacing: -0.02em;
|
|
132
|
+
overflow-wrap: anywhere;
|
|
133
|
+
line-height: 1.3;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.vertebr-modal-id {
|
|
137
|
+
margin: 0.35rem 0 0;
|
|
138
|
+
overflow: hidden;
|
|
139
|
+
font-family: var(--vb-mono);
|
|
140
|
+
font-size: 0.75rem;
|
|
141
|
+
line-height: 1.4;
|
|
142
|
+
color: var(--vb-text-subtle);
|
|
143
|
+
text-overflow: ellipsis;
|
|
144
|
+
white-space: nowrap;
|
|
63
145
|
}
|
|
64
146
|
|
|
65
147
|
.vertebr-modal-eyebrow {
|
|
@@ -73,12 +155,17 @@
|
|
|
73
155
|
|
|
74
156
|
.vertebr-modal-actions {
|
|
75
157
|
display: flex;
|
|
158
|
+
flex: none;
|
|
76
159
|
flex-wrap: wrap;
|
|
77
160
|
gap: 0.45rem;
|
|
78
161
|
}
|
|
79
162
|
|
|
80
163
|
.vertebr-modal-body {
|
|
81
|
-
|
|
164
|
+
flex: 1 1 auto;
|
|
165
|
+
min-width: 0;
|
|
166
|
+
min-height: 0;
|
|
167
|
+
overflow-x: auto;
|
|
168
|
+
overflow-y: auto;
|
|
82
169
|
padding: 1.25rem;
|
|
83
170
|
display: flex;
|
|
84
171
|
flex-direction: column;
|
|
@@ -102,20 +189,70 @@
|
|
|
102
189
|
.vertebr-modal-fields {
|
|
103
190
|
margin: 0;
|
|
104
191
|
display: grid;
|
|
105
|
-
grid-template-columns: repeat(
|
|
192
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
106
193
|
gap: 0.9rem 1rem;
|
|
194
|
+
width: 100%;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
@container (max-width: 36rem) {
|
|
198
|
+
.vertebr-modal-fields {
|
|
199
|
+
grid-template-columns: 1fr;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@media (max-width: 640px) {
|
|
204
|
+
.vertebr-modal-fields {
|
|
205
|
+
grid-template-columns: 1fr;
|
|
206
|
+
}
|
|
107
207
|
}
|
|
108
208
|
|
|
109
209
|
.vertebr-modal-field {
|
|
110
210
|
display: grid;
|
|
111
211
|
gap: 0.35rem;
|
|
112
|
-
padding: 0.85rem 0.95rem;
|
|
212
|
+
padding: 0.85rem 0.95rem 1.25rem;
|
|
113
213
|
border: 1px solid var(--vb-border);
|
|
114
214
|
border-radius: var(--vb-radius);
|
|
115
215
|
background: var(--vb-surface-tint);
|
|
116
216
|
min-width: 0;
|
|
117
217
|
}
|
|
118
218
|
|
|
219
|
+
.vertebr-modal-field[data-span="full"] {
|
|
220
|
+
grid-column: 1 / -1;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.vertebr-record-modal .vertebr-modal-fields {
|
|
224
|
+
gap: 1px;
|
|
225
|
+
flex: none;
|
|
226
|
+
border: 1px solid var(--vb-border);
|
|
227
|
+
border-radius: 12px;
|
|
228
|
+
background: var(--vb-border);
|
|
229
|
+
/* Square cells paint over the rounded border unless they are clipped to it.
|
|
230
|
+
The sheet is as tall as its rows, so this only trims the corners. */
|
|
231
|
+
overflow: clip;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.vertebr-record-modal .vertebr-modal-field {
|
|
235
|
+
gap: 0.35rem;
|
|
236
|
+
padding: 0.8rem 1rem 1.15rem;
|
|
237
|
+
border: 0;
|
|
238
|
+
border-radius: 0;
|
|
239
|
+
background: var(--vb-bg-elevated);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/* Last row sits above the sheet's bottom radius, so it needs extra room
|
|
243
|
+
or the values look cut off. */
|
|
244
|
+
.vertebr-record-modal .vertebr-modal-field:last-child,
|
|
245
|
+
.vertebr-record-modal .vertebr-modal-fields > .vertebr-modal-field:nth-last-child(2):not([data-span="full"]) {
|
|
246
|
+
padding-bottom: 1.85rem;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/* The On pill is inline-flex. Margin under it does not grow the line box,
|
|
250
|
+
and overflow:hidden on the cell used to clip it, so the divider stayed put. */
|
|
251
|
+
.vertebr-record-modal .vertebr-modal-field dd {
|
|
252
|
+
display: block;
|
|
253
|
+
padding-bottom: 0;
|
|
254
|
+
}
|
|
255
|
+
|
|
119
256
|
.vertebr-modal-field dt {
|
|
120
257
|
margin: 0;
|
|
121
258
|
font-family: var(--vb-mono);
|
|
@@ -128,6 +265,34 @@
|
|
|
128
265
|
.vertebr-modal-field dd {
|
|
129
266
|
margin: 0;
|
|
130
267
|
min-width: 0;
|
|
268
|
+
max-width: 100%;
|
|
269
|
+
overflow-wrap: anywhere;
|
|
270
|
+
word-break: break-word;
|
|
271
|
+
line-height: 1.4;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.vertebr-modal-field dd > * {
|
|
275
|
+
max-width: 100%;
|
|
276
|
+
min-width: 0;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.vertebr-modal-field .vertebr-cell-text,
|
|
280
|
+
.vertebr-modal-field .vertebr-cell-link,
|
|
281
|
+
.vertebr-modal-field .vertebr-cell-json,
|
|
282
|
+
.vertebr-modal-field .vertebr-cell-prose,
|
|
283
|
+
.vertebr-modal-field .vertebr-cell-datetime,
|
|
284
|
+
.vertebr-modal-field .vertebr-cell-number,
|
|
285
|
+
.vertebr-modal-field .vertebr-cell-money {
|
|
286
|
+
display: block;
|
|
287
|
+
max-width: 100%;
|
|
288
|
+
overflow: visible;
|
|
289
|
+
text-overflow: unset;
|
|
290
|
+
white-space: normal;
|
|
291
|
+
overflow-wrap: anywhere;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.vertebr-modal-field .vertebr-chip-row {
|
|
295
|
+
max-width: none;
|
|
131
296
|
}
|
|
132
297
|
|
|
133
298
|
.vertebr-picker-body {
|