@crisp-ui-kit/crisp 0.2.0 → 0.5.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/README.md +6 -0
- package/dist/base.css +25 -0
- package/dist/button.css +1 -1
- package/dist/command.css +1 -1
- package/dist/contextmenu.css +1 -1
- package/dist/datatable.css +60 -0
- package/dist/datatable.d.ts +7 -0
- package/dist/datepicker.css +1 -1
- package/dist/dialog.css +1 -1
- package/dist/esm/components/accordion/accordion.js +32 -0
- package/dist/esm/components/accordion/accordion.recipe.js +23 -0
- package/dist/esm/components/accordion/index.js +2 -0
- package/dist/esm/components/avatar/avatar.js +8 -0
- package/dist/esm/components/avatar/avatar.recipe.js +39 -0
- package/dist/esm/components/avatar/index.js +2 -0
- package/dist/esm/components/avatargroup/avatargroup.js +16 -0
- package/dist/esm/components/avatargroup/avatargroup.recipe.js +15 -0
- package/dist/esm/components/avatargroup/index.js +2 -0
- package/dist/esm/components/badge/badge.js +8 -0
- package/dist/esm/components/badge/badge.recipe.js +65 -0
- package/dist/esm/components/badge/index.js +2 -0
- package/dist/esm/components/barchart/barchart.js +29 -0
- package/dist/esm/components/barchart/barchart.recipe.js +26 -0
- package/dist/esm/components/barchart/index.js +2 -0
- package/dist/esm/components/breadcrumb/breadcrumb.js +17 -0
- package/dist/esm/components/breadcrumb/breadcrumb.recipe.js +18 -0
- package/dist/esm/components/breadcrumb/index.js +2 -0
- package/dist/esm/components/bulkbar/bulkbar.js +16 -0
- package/dist/esm/components/bulkbar/bulkbar.recipe.js +28 -0
- package/dist/esm/components/bulkbar/index.js +2 -0
- package/dist/esm/components/button/button.js +15 -0
- package/dist/esm/components/button/button.recipe.js +39 -0
- package/dist/esm/components/button/index.js +2 -0
- package/dist/esm/components/callout/callout.js +22 -0
- package/dist/esm/components/callout/callout.recipe.js +26 -0
- package/dist/esm/components/callout/index.js +2 -0
- package/dist/esm/components/card/card.js +15 -0
- package/dist/esm/components/card/card.recipe.js +28 -0
- package/dist/esm/components/card/index.js +2 -0
- package/dist/esm/components/checkbox/checkbox.js +20 -0
- package/dist/esm/components/checkbox/checkbox.recipe.js +23 -0
- package/dist/esm/components/checkbox/index.js +2 -0
- package/dist/esm/components/contextmenu/contextmenu.js +42 -0
- package/dist/esm/components/contextmenu/contextmenu.recipe.js +21 -0
- package/dist/esm/components/contextmenu/index.js +2 -0
- package/dist/esm/components/datatable/datatable.js +245 -0
- package/dist/esm/components/datatable/datatable.recipe.js +72 -0
- package/dist/esm/components/datatable/index.js +2 -0
- package/dist/esm/components/datepicker/datepicker.js +57 -0
- package/dist/esm/components/datepicker/datepicker.recipe.js +32 -0
- package/dist/esm/components/datepicker/index.js +2 -0
- package/dist/esm/components/dialog/dialog.js +48 -0
- package/dist/esm/components/dialog/dialog.recipe.js +32 -0
- package/dist/esm/components/dialog/index.js +2 -0
- package/dist/esm/components/divider/divider.js +7 -0
- package/dist/esm/components/divider/divider.recipe.js +14 -0
- package/dist/esm/components/divider/index.js +2 -0
- package/dist/esm/components/donutchart/donutchart.js +38 -0
- package/dist/esm/components/donutchart/donutchart.recipe.js +27 -0
- package/dist/esm/components/donutchart/index.js +2 -0
- package/dist/esm/components/drawer/drawer.js +42 -0
- package/dist/esm/components/drawer/drawer.recipe.js +27 -0
- package/dist/esm/components/drawer/index.js +2 -0
- package/dist/esm/components/emptystate/emptystate.js +7 -0
- package/dist/esm/components/emptystate/emptystate.recipe.js +31 -0
- package/dist/esm/components/emptystate/index.js +2 -0
- package/dist/esm/components/formfield/formfield.js +14 -0
- package/dist/esm/components/formfield/formfield.recipe.js +19 -0
- package/dist/esm/components/formfield/index.js +2 -0
- package/dist/esm/components/input/index.js +2 -0
- package/dist/esm/components/input/input.js +8 -0
- package/dist/esm/components/input/input.recipe.js +23 -0
- package/dist/esm/components/kbd/index.js +2 -0
- package/dist/esm/components/kbd/kbd.js +8 -0
- package/dist/esm/components/kbd/kbd.recipe.js +20 -0
- package/dist/esm/components/linechart/index.js +2 -0
- package/dist/esm/components/linechart/linechart.js +41 -0
- package/dist/esm/components/linechart/linechart.recipe.js +27 -0
- package/dist/esm/components/menu/index.js +2 -0
- package/dist/esm/components/menu/menu.js +137 -0
- package/dist/esm/components/menu/menu.recipe.js +51 -0
- package/dist/esm/components/multiselect/index.js +2 -0
- package/dist/esm/components/multiselect/multiselect.js +118 -0
- package/dist/esm/components/multiselect/multiselect.recipe.js +68 -0
- package/dist/esm/components/popover/index.js +2 -0
- package/dist/esm/components/popover/popover.js +70 -0
- package/dist/esm/components/popover/popover.recipe.js +18 -0
- package/dist/esm/components/progress/index.js +2 -0
- package/dist/esm/components/progress/progress.js +23 -0
- package/dist/esm/components/progress/progress.recipe.js +17 -0
- package/dist/esm/components/radiogroup/index.js +2 -0
- package/dist/esm/components/radiogroup/radiogroup.js +46 -0
- package/dist/esm/components/radiogroup/radiogroup.recipe.js +37 -0
- package/dist/esm/components/segmented/index.js +2 -0
- package/dist/esm/components/segmented/segmented.js +59 -0
- package/dist/esm/components/segmented/segmented.recipe.js +20 -0
- package/dist/esm/components/select/index.js +2 -0
- package/dist/esm/components/select/select.js +144 -0
- package/dist/esm/components/select/select.recipe.js +76 -0
- package/dist/esm/components/skeleton/index.js +2 -0
- package/dist/esm/components/skeleton/skeleton.js +7 -0
- package/dist/esm/components/skeleton/skeleton.recipe.js +14 -0
- package/dist/esm/components/spinner/index.js +2 -0
- package/dist/esm/components/spinner/spinner.js +11 -0
- package/dist/esm/components/spinner/spinner.recipe.js +13 -0
- package/dist/esm/components/stagebar/index.js +2 -0
- package/dist/esm/components/stagebar/stagebar.js +23 -0
- package/dist/esm/components/stagebar/stagebar.recipe.js +14 -0
- package/dist/esm/components/statcard/index.js +2 -0
- package/dist/esm/components/statcard/statcard.js +12 -0
- package/dist/esm/components/statcard/statcard.recipe.js +34 -0
- package/dist/esm/components/switch/index.js +2 -0
- package/dist/esm/components/switch/switch.js +22 -0
- package/dist/esm/components/switch/switch.recipe.js +26 -0
- package/dist/esm/components/table/index.js +2 -0
- package/dist/esm/components/table/table.js +30 -0
- package/dist/esm/components/table/table.recipe.js +40 -0
- package/dist/esm/components/tabletoolbar/index.js +2 -0
- package/dist/esm/components/tabletoolbar/tabletoolbar.chrome.js +79 -0
- package/dist/esm/components/tabletoolbar/tabletoolbar.js +191 -0
- package/dist/esm/components/tabletoolbar/tabletoolbar.recipe.js +23 -0
- package/dist/esm/components/tabs/index.js +2 -0
- package/dist/esm/components/tabs/tabs.js +70 -0
- package/dist/esm/components/tabs/tabs.recipe.js +33 -0
- package/dist/esm/components/textarea/index.js +2 -0
- package/dist/esm/components/textarea/textarea.js +20 -0
- package/dist/esm/components/textarea/textarea.recipe.js +31 -0
- package/dist/esm/components/toast/index.js +2 -0
- package/dist/esm/components/toast/toast.js +58 -0
- package/dist/esm/components/toast/toast.recipe.js +28 -0
- package/dist/esm/components/tooltip/index.js +2 -0
- package/dist/esm/components/tooltip/tooltip.js +45 -0
- package/dist/esm/components/tooltip/tooltip.recipe.js +13 -0
- package/dist/esm/core/cx.js +1 -0
- package/dist/esm/core/define.js +3 -0
- package/dist/esm/core/index.js +4 -0
- package/dist/esm/core/primitive.js +13 -0
- package/dist/esm/core/resolve.js +41 -0
- package/dist/esm/core/types.js +1 -0
- package/dist/esm/index.js +71 -0
- package/dist/esm/product/appshell/appshell.js +44 -0
- package/dist/esm/product/appshell/appshell.recipe.js +27 -0
- package/dist/esm/product/appshell/index.js +2 -0
- package/dist/esm/product/board/board.js +42 -0
- package/dist/esm/product/board/board.recipe.js +28 -0
- package/dist/esm/product/board/index.js +2 -0
- package/dist/esm/product/command/command.js +188 -0
- package/dist/esm/product/command/command.recipe.js +19 -0
- package/dist/esm/product/command/index.js +2 -0
- package/dist/esm/product/entitycard/entitycard.js +11 -0
- package/dist/esm/product/entitycard/entitycard.recipe.js +29 -0
- package/dist/esm/product/entitycard/index.js +2 -0
- package/dist/esm/product/flowcanvas/flowcanvas.js +85 -0
- package/dist/esm/product/flowcanvas/flowcanvas.recipe.js +25 -0
- package/dist/esm/product/flowcanvas/index.js +2 -0
- package/dist/esm/product/inbox/inbox.js +13 -0
- package/dist/esm/product/inbox/inbox.recipe.js +43 -0
- package/dist/esm/product/inbox/index.js +2 -0
- package/dist/esm/product/listpage/index.js +2 -0
- package/dist/esm/product/listpage/listpage.js +21 -0
- package/dist/esm/product/listpage/listpage.recipe.js +43 -0
- package/dist/esm/product/navitem/index.js +1 -0
- package/dist/esm/product/navitem/navitem.js +8 -0
- package/dist/esm/product/navitem/navitem.recipe.js +21 -0
- package/dist/esm/product/onboarding/index.js +2 -0
- package/dist/esm/product/onboarding/onboarding.js +14 -0
- package/dist/esm/product/onboarding/onboarding.recipe.js +41 -0
- package/dist/esm/product/recordpage/index.js +2 -0
- package/dist/esm/product/recordpage/recordpage.js +286 -0
- package/dist/esm/product/recordpage/recordpage.recipe.js +157 -0
- package/dist/esm/product/recordpanel/index.js +2 -0
- package/dist/esm/product/recordpanel/recordpanel.js +47 -0
- package/dist/esm/product/recordpanel/recordpanel.recipe.js +52 -0
- package/dist/esm/product/recordstable/company-logos.js +26 -0
- package/dist/esm/product/recordstable/index.js +2 -0
- package/dist/esm/product/recordstable/recordstable.js +963 -0
- package/dist/esm/product/recordstable/recordstable.recipe.js +149 -0
- package/dist/esm/product/richtext/index.js +2 -0
- package/dist/esm/product/richtext/richtext.js +111 -0
- package/dist/esm/product/richtext/richtext.recipe.js +40 -0
- package/dist/esm/product/settingssection/index.js +2 -0
- package/dist/esm/product/settingssection/settingssection.js +11 -0
- package/dist/esm/product/settingssection/settingssection.recipe.js +20 -0
- package/dist/esm/product/settingsshell/index.js +2 -0
- package/dist/esm/product/settingsshell/settingsshell.js +23 -0
- package/dist/esm/product/settingsshell/settingsshell.recipe.js +38 -0
- package/dist/esm/product/sidebar/index.js +2 -0
- package/dist/esm/product/sidebar/sidebar.js +112 -0
- package/dist/esm/product/sidebar/sidebar.recipe.js +18 -0
- package/dist/esm/product/tasklist/index.js +2 -0
- package/dist/esm/product/tasklist/tasklist.js +16 -0
- package/dist/esm/product/tasklist/tasklist.recipe.js +35 -0
- package/dist/esm/product/trialbanner/index.js +2 -0
- package/dist/esm/product/trialbanner/trialbanner.js +10 -0
- package/dist/esm/product/trialbanner/trialbanner.recipe.js +29 -0
- package/dist/esm/product/viewtoggle/index.js +2 -0
- package/dist/esm/product/viewtoggle/viewtoggle.js +11 -0
- package/dist/esm/product/viewtoggle/viewtoggle.recipe.js +24 -0
- package/dist/esm/tokens/contract.js +18 -0
- package/dist/esm/tokens/index.js +4 -0
- package/dist/esm/tokens/palette.js +30 -0
- package/dist/esm/tokens/scale.js +60 -0
- package/dist/esm/tokens/semantic.js +30 -0
- package/dist/menu.css +2 -2
- package/dist/multiselect.css +3 -3
- package/dist/popover.css +1 -1
- package/dist/recordpage.css +5 -5
- package/dist/recordstable.css +4 -4
- package/dist/select.css +10 -4
- package/dist/select.d.ts +2 -1
- package/dist/sidebar.css +1 -1
- package/dist/statcard.css +6 -0
- package/dist/statcard.d.ts +2 -2
- package/dist/styles.css +222 -27
- package/dist/table.css +26 -0
- package/dist/table.d.ts +8 -0
- package/dist/tabletoolbar.css +70 -0
- package/dist/tabletoolbar.d.ts +7 -0
- package/dist/tokens.css +24 -0
- package/dist/types/components/datatable/datatable.d.ts +98 -0
- package/dist/types/components/datatable/datatable.recipe.d.ts +3 -0
- package/dist/types/components/datatable/index.d.ts +2 -0
- package/dist/types/components/select/select.d.ts +3 -1
- package/dist/types/components/select/select.recipe.d.ts +12 -0
- package/dist/types/components/statcard/statcard.d.ts +6 -1
- package/dist/types/components/statcard/statcard.recipe.d.ts +12 -2
- package/dist/types/components/table/index.d.ts +2 -0
- package/dist/types/components/table/table.d.ts +53 -0
- package/dist/types/components/table/table.recipe.d.ts +21 -0
- package/dist/types/components/tabletoolbar/index.d.ts +2 -0
- package/dist/types/components/tabletoolbar/tabletoolbar.chrome.d.ts +2 -0
- package/dist/types/components/tabletoolbar/tabletoolbar.d.ts +63 -0
- package/dist/types/components/tabletoolbar/tabletoolbar.recipe.d.ts +3 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/product/recordstable/company-logos.d.ts +1 -0
- package/dist/types/product/recordstable/recordstable.d.ts +42 -1
- package/dist/types/product/sidebar/index.d.ts +1 -1
- package/dist/types/product/sidebar/sidebar.d.ts +85 -0
- package/dist/types/tokens/contract.d.ts +12 -0
- package/dist/types/tokens/palette.d.ts +48 -0
- package/dist/types/tokens/semantic.d.ts +12 -0
- package/dist/viewtoggle.css +2 -2
- package/package.json +259 -9
- package/dist/index.js +0 -9690
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Activity as ActivityIcon, CalendarClock, ChevronDown, CircleDollarSign, Copy, DollarSign, FileText, Folder, Inbox, Landmark, LayoutGrid, Mail, Maximize2, Minimize2, MoreHorizontal, Pencil, Phone, Plus, Search, Share2, Sparkles, SquareCheck, Star, Trash2, Users, UsersRound, X, Zap, } from "lucide-react";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Avatar } from "../../components/avatar/index.js";
|
|
5
|
+
import { Checkbox } from "../../components/checkbox/index.js";
|
|
6
|
+
import { Menu, MenuItem, MenuSeparator } from "../../components/menu/index.js";
|
|
7
|
+
import { Tabs } from "../../components/tabs/index.js";
|
|
8
|
+
import { tagTone, } from "../recordstable/index.js";
|
|
9
|
+
import { recordpageRecipe } from "./recordpage.recipe.js";
|
|
10
|
+
function valueEmpty(v) {
|
|
11
|
+
return v == null || v === "" || (Array.isArray(v) && v.length === 0);
|
|
12
|
+
}
|
|
13
|
+
// Tags value — the first chip inline with a clickable muted "+N" that expands
|
|
14
|
+
// to show every chip (Attio's per-field click-to-expand, independent of the
|
|
15
|
+
// section-level "View all values" that reveals hidden fields).
|
|
16
|
+
function TagsValue({ values }) {
|
|
17
|
+
const [expanded, setExpanded] = React.useState(false);
|
|
18
|
+
const overflow = values.length - 1;
|
|
19
|
+
const shown = expanded ? values : values.slice(0, 1);
|
|
20
|
+
return (_jsxs(_Fragment, { children: [shown.map((t) => (_jsx("span", { className: "recordstable-tag", "data-tone": tagTone(t), children: t }, t))), !expanded && overflow > 0 && (_jsxs("button", { type: "button", className: "recordpage-morevalues", onClick: () => setExpanded(true), children: ["+", overflow] }))] }));
|
|
21
|
+
}
|
|
22
|
+
function FieldValue({ col, row }) {
|
|
23
|
+
const v = row[col.key];
|
|
24
|
+
if (valueEmpty(v))
|
|
25
|
+
return _jsx("span", { className: "recordpage-empty", children: "Set a value\u2026" });
|
|
26
|
+
switch (col.type) {
|
|
27
|
+
case "tags":
|
|
28
|
+
return _jsx(TagsValue, { values: v });
|
|
29
|
+
case "number":
|
|
30
|
+
return _jsx(_Fragment, { children: typeof v === "number" ? v.toLocaleString() : v });
|
|
31
|
+
case "url":
|
|
32
|
+
return (_jsx("a", { className: "recordpage-link", href: `https://${v}`, target: "_blank", rel: "noreferrer", children: String(v) }));
|
|
33
|
+
default:
|
|
34
|
+
return _jsx(_Fragment, { children: String(v) });
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function SectionHead({ title, count, action, }) {
|
|
38
|
+
return (_jsxs("div", { className: "recordpage-section-head", children: [_jsx("span", { className: "recordpage-section-title", children: title }), count != null && (_jsx("span", { className: "recordpage-section-count", children: count })), _jsx("span", { className: "recordpage-section-spacer" }), action] }));
|
|
39
|
+
}
|
|
40
|
+
// A note/task composer: a textarea (or input) with Cancel / submit actions.
|
|
41
|
+
function Composer({ placeholder, submitLabel, multiline, onSubmit, onCancel, }) {
|
|
42
|
+
const [text, setText] = React.useState("");
|
|
43
|
+
const commit = () => {
|
|
44
|
+
const t = text.trim();
|
|
45
|
+
if (t)
|
|
46
|
+
onSubmit(t);
|
|
47
|
+
};
|
|
48
|
+
return (_jsxs("div", { className: "recordpage-composer", children: [_jsx("textarea", {
|
|
49
|
+
// biome-ignore lint/a11y/noAutofocus: focusing the just-opened composer is expected
|
|
50
|
+
autoFocus: true, placeholder: placeholder, value: text, rows: multiline ? 3 : 1, onChange: (e) => setText(e.target.value), onKeyDown: (e) => {
|
|
51
|
+
if (e.key === "Enter" && (!multiline || e.metaKey)) {
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
commit();
|
|
54
|
+
}
|
|
55
|
+
if (e.key === "Escape")
|
|
56
|
+
onCancel();
|
|
57
|
+
} }), _jsxs("div", { className: "recordpage-composer-actions", children: [_jsx("button", { type: "button", className: "recordpage-btn", onClick: onCancel, children: "Cancel" }), _jsx("button", { type: "button", className: "recordpage-btn recordpage-btn--primary", disabled: !text.trim(), onClick: commit, children: submitLabel })] })] }));
|
|
58
|
+
}
|
|
59
|
+
function NotesSection({ notes, onAdd, }) {
|
|
60
|
+
const [open, setOpen] = React.useState(false);
|
|
61
|
+
return (_jsxs("section", { children: [_jsx(SectionHead, { title: "Notes", count: notes.length, action: _jsxs("button", { type: "button", className: "recordpage-addbtn", onClick: () => setOpen(true), children: [_jsx(Plus, { size: 14, strokeWidth: 2 }), "New note"] }) }), open && (_jsx(Composer, { multiline: true, placeholder: "Write a note\u2026 (\u2318\u21B5 to save)", submitLabel: "Save note", onCancel: () => setOpen(false), onSubmit: (t) => {
|
|
62
|
+
onAdd(t);
|
|
63
|
+
setOpen(false);
|
|
64
|
+
} })), notes.length === 0 && !open ? (_jsx("div", { className: "recordpage-emptystate", children: "No notes yet." })) : (notes.map((n) => (_jsxs("div", { className: "recordpage-note", children: [_jsx(Avatar, { size: "sm", shape: "circle", tone: "neutral", children: "Y" }), _jsxs("div", { className: "recordpage-note-body", children: [_jsxs("div", { className: "recordpage-note-head", children: [_jsx("span", { className: "recordpage-note-author", children: "You" }), _jsx("span", { className: "recordpage-note-time", children: n.time })] }), _jsx("div", { className: "recordpage-note-text", children: n.text })] })] }, n.id))))] }));
|
|
65
|
+
}
|
|
66
|
+
function TasksSection({ tasks, onAdd, onToggle, }) {
|
|
67
|
+
const [open, setOpen] = React.useState(false);
|
|
68
|
+
return (_jsxs("section", { children: [_jsx(SectionHead, { title: "Tasks", count: tasks.length, action: _jsxs("button", { type: "button", className: "recordpage-addbtn", onClick: () => setOpen(true), children: [_jsx(Plus, { size: 14, strokeWidth: 2 }), "New task"] }) }), open && (_jsx(Composer, { placeholder: "Task name\u2026 (\u21B5 to add)", submitLabel: "Add task", onCancel: () => setOpen(false), onSubmit: (t) => {
|
|
69
|
+
onAdd(t);
|
|
70
|
+
setOpen(false);
|
|
71
|
+
} })), tasks.length === 0 && !open ? (_jsx("div", { className: "recordpage-emptystate", children: "No tasks yet." })) : (tasks.map((t) => (_jsxs("div", { className: "recordpage-task", "data-done": t.done ? "" : undefined, children: [_jsx(Checkbox, { checked: t.done, onChange: () => onToggle(t.id), "aria-label": t.text }), _jsx("span", { className: "recordpage-task-text", children: t.text })] }, t.id))))] }));
|
|
72
|
+
}
|
|
73
|
+
function EmptyCard({ icon, children, }) {
|
|
74
|
+
return (_jsxs("div", { className: "recordpage-emptycard", children: [icon, children] }));
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* The full-page company record view — the page Attio opens when you click into a
|
|
78
|
+
* record (as opposed to the peek [RecordPanel]). A top breadcrumb bar with
|
|
79
|
+
* favourite/edit/compose/… actions, a 320px left attribute column, and a tabbed
|
|
80
|
+
* main area: Overview stacks Highlights, an Activity feed, and Notes / Tasks /
|
|
81
|
+
* Emails sections (Notes & Tasks are live — add and check things off). Drop it
|
|
82
|
+
* into the app's main content area.
|
|
83
|
+
*/
|
|
84
|
+
export function RecordPage({ record, columns, collection = "Records", onBack, onToggleFull, full, className, }) {
|
|
85
|
+
const [favorite, setFavorite] = React.useState(false);
|
|
86
|
+
const [notes, setNotes] = React.useState([]);
|
|
87
|
+
const [tasks, setTasks] = React.useState([]);
|
|
88
|
+
const [showAllActivity, setShowAllActivity] = React.useState(false);
|
|
89
|
+
// Collapsible + searchable Record Details, like Attio.
|
|
90
|
+
const [detailsOpen, setDetailsOpen] = React.useState(true);
|
|
91
|
+
const [searchOpen, setSearchOpen] = React.useState(false);
|
|
92
|
+
const [fieldQuery, setFieldQuery] = React.useState("");
|
|
93
|
+
const [showAllValues, setShowAllValues] = React.useState(false);
|
|
94
|
+
// Drag-resizable left details column, like Attio.
|
|
95
|
+
const [detailsW, setDetailsW] = React.useState(320);
|
|
96
|
+
const [resizing, setResizing] = React.useState(false);
|
|
97
|
+
const dragRef = React.useRef(null);
|
|
98
|
+
const onResizeDown = (e) => {
|
|
99
|
+
dragRef.current = { x: e.clientX, w: detailsW };
|
|
100
|
+
setResizing(true);
|
|
101
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
102
|
+
};
|
|
103
|
+
const onResizeMove = (e) => {
|
|
104
|
+
if (!dragRef.current)
|
|
105
|
+
return;
|
|
106
|
+
const next = dragRef.current.w + (e.clientX - dragRef.current.x);
|
|
107
|
+
setDetailsW(Math.max(300, Math.min(560, next)));
|
|
108
|
+
};
|
|
109
|
+
const onResizeUp = (e) => {
|
|
110
|
+
dragRef.current = null;
|
|
111
|
+
setResizing(false);
|
|
112
|
+
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
113
|
+
};
|
|
114
|
+
const idRef = React.useRef(0);
|
|
115
|
+
const nextId = () => {
|
|
116
|
+
idRef.current += 1;
|
|
117
|
+
return `n${idRef.current}`;
|
|
118
|
+
};
|
|
119
|
+
const entityCol = columns.find((col) => col.type === "entity");
|
|
120
|
+
const entity = entityCol
|
|
121
|
+
? record[entityCol.key]
|
|
122
|
+
: undefined;
|
|
123
|
+
const name = entity?.name ?? "Record";
|
|
124
|
+
const fields = columns.filter((col) => col.type !== "entity");
|
|
125
|
+
const q = fieldQuery.trim().toLowerCase();
|
|
126
|
+
const matchedFields = q
|
|
127
|
+
? fields.filter((col) => col.label.toLowerCase().includes(q))
|
|
128
|
+
: fields;
|
|
129
|
+
// Attio shows the first 5 fields; "View all values" reveals the rest.
|
|
130
|
+
const FIELD_LIMIT = 5;
|
|
131
|
+
const canRevealFields = !q && matchedFields.length > FIELD_LIMIT;
|
|
132
|
+
const shownFields = canRevealFields && !showAllValues
|
|
133
|
+
? matchedFields.slice(0, FIELD_LIMIT)
|
|
134
|
+
: matchedFields;
|
|
135
|
+
const byKey = React.useMemo(() => new Map(columns.map((col) => [col.key, col])), [columns]);
|
|
136
|
+
// Attio's Overview "Highlights" — a fixed set of enrichment stats (measured
|
|
137
|
+
// from the live app), a couple derived from the record, the rest empty.
|
|
138
|
+
const arrVal = record.arr;
|
|
139
|
+
const empVal = record.employees;
|
|
140
|
+
const compactUsd = (n) => n >= 1e9
|
|
141
|
+
? `$${Math.round(n / 1e9)}B`
|
|
142
|
+
: n >= 1e6
|
|
143
|
+
? `$${Math.round(n / 1e6)}M`
|
|
144
|
+
: `$${n.toLocaleString()}`;
|
|
145
|
+
const empRange = (n) => n >= 100000
|
|
146
|
+
? "100K+"
|
|
147
|
+
: n >= 10000
|
|
148
|
+
? "10K–100K"
|
|
149
|
+
: n >= 1000
|
|
150
|
+
? "1K–10K"
|
|
151
|
+
: "<1K";
|
|
152
|
+
const highlights = [
|
|
153
|
+
{
|
|
154
|
+
label: "Connection strength",
|
|
155
|
+
icon: Zap,
|
|
156
|
+
value: null,
|
|
157
|
+
empty: "No connection",
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
label: "Next calendar interaction",
|
|
161
|
+
icon: CalendarClock,
|
|
162
|
+
value: null,
|
|
163
|
+
empty: "No interaction",
|
|
164
|
+
},
|
|
165
|
+
{ label: "Team", icon: Users, value: null, empty: "No team" },
|
|
166
|
+
{
|
|
167
|
+
label: "Estimated ARR",
|
|
168
|
+
icon: DollarSign,
|
|
169
|
+
value: typeof arrVal === "number" ? compactUsd(arrVal) : null,
|
|
170
|
+
empty: "No ARR",
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
label: "Funding raised",
|
|
174
|
+
icon: Landmark,
|
|
175
|
+
value: null,
|
|
176
|
+
empty: "No funding raised",
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
label: "Employee range",
|
|
180
|
+
icon: UsersRound,
|
|
181
|
+
value: typeof empVal === "number" ? empRange(empVal) : null,
|
|
182
|
+
empty: "No range",
|
|
183
|
+
},
|
|
184
|
+
];
|
|
185
|
+
const ti = { size: 15, strokeWidth: 1.75 };
|
|
186
|
+
const tabs = [
|
|
187
|
+
{ value: "overview", label: "Overview", icon: _jsx(LayoutGrid, { ...ti }) },
|
|
188
|
+
{ value: "activity", label: "Activity", icon: _jsx(ActivityIcon, { ...ti }) },
|
|
189
|
+
{ value: "emails", label: "Emails", icon: _jsx(Mail, { ...ti }), badge: 0 },
|
|
190
|
+
{ value: "calls", label: "Calls", icon: _jsx(Phone, { ...ti }), badge: 0 },
|
|
191
|
+
{ value: "team", label: "Team", icon: _jsx(Users, { ...ti }), badge: 0 },
|
|
192
|
+
{
|
|
193
|
+
value: "notes",
|
|
194
|
+
label: "Notes",
|
|
195
|
+
icon: _jsx(FileText, { ...ti }),
|
|
196
|
+
badge: notes.length,
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
value: "tasks",
|
|
200
|
+
label: "Tasks",
|
|
201
|
+
icon: _jsx(SquareCheck, { ...ti }),
|
|
202
|
+
badge: tasks.length,
|
|
203
|
+
},
|
|
204
|
+
{ value: "files", label: "Files", icon: _jsx(Folder, { ...ti }) },
|
|
205
|
+
{
|
|
206
|
+
value: "deals",
|
|
207
|
+
label: "Associated deals",
|
|
208
|
+
icon: _jsx(CircleDollarSign, { ...ti }),
|
|
209
|
+
badge: 0,
|
|
210
|
+
},
|
|
211
|
+
];
|
|
212
|
+
const addNote = (text) => setNotes((n) => [{ id: nextId(), text, time: "Just now" }, ...n]);
|
|
213
|
+
const addTask = (text) => setTasks((t) => [{ id: nextId(), text, done: false }, ...t]);
|
|
214
|
+
const toggleTask = (id) => setTasks((t) => t.map((x) => (x.id === id ? { ...x, done: !x.done } : x)));
|
|
215
|
+
// A small, plausible activity feed derived from the record's own fields.
|
|
216
|
+
const domain = byKey.get("domain");
|
|
217
|
+
const cats = byKey.get("categories");
|
|
218
|
+
const activity = [
|
|
219
|
+
domain && !valueEmpty(record[domain.key])
|
|
220
|
+
? {
|
|
221
|
+
id: "domain",
|
|
222
|
+
text: (_jsxs(_Fragment, { children: ["Domain set to ", _jsx("b", { children: String(record[domain.key]) })] })),
|
|
223
|
+
time: "2 hours ago",
|
|
224
|
+
}
|
|
225
|
+
: null,
|
|
226
|
+
cats && !valueEmpty(record[cats.key])
|
|
227
|
+
? {
|
|
228
|
+
id: "cats",
|
|
229
|
+
text: (_jsxs(_Fragment, { children: ["Tagged ", _jsx("b", { children: record[cats.key].length }), " categories"] })),
|
|
230
|
+
time: "1 day ago",
|
|
231
|
+
}
|
|
232
|
+
: null,
|
|
233
|
+
{
|
|
234
|
+
id: "created",
|
|
235
|
+
text: (_jsxs(_Fragment, { children: [_jsx("b", { children: name }), " record was created"] })),
|
|
236
|
+
time: "1 day ago",
|
|
237
|
+
},
|
|
238
|
+
].filter(Boolean);
|
|
239
|
+
const shownActivity = showAllActivity ? activity : activity.slice(0, 2);
|
|
240
|
+
const activityFeed = (_jsxs("section", { children: [_jsx(SectionHead, { title: "Activity", action: activity.length > 2 ? (_jsx("button", { type: "button", className: "recordpage-viewall recordpage-viewall--inline", onClick: () => setShowAllActivity((s) => !s), children: showAllActivity ? "Show less" : "View all" })) : undefined }), _jsx("div", { className: "recordpage-feed", children: shownActivity.map((a) => (_jsxs("div", { className: "recordpage-feed-item", children: [_jsx("span", { className: "recordpage-feed-dot", children: _jsx(ActivityIcon, { size: 13, strokeWidth: 2 }) }), _jsxs("div", { className: "recordpage-feed-body", children: [a.text, _jsx("div", { className: "recordpage-feed-time", children: a.time })] })] }, a.id))) })] }));
|
|
241
|
+
const emailsEmpty = (_jsxs(EmptyCard, { icon: _jsx(Inbox, { size: 22, strokeWidth: 1.5 }), children: ["No emails logged with ", name, " yet."] }));
|
|
242
|
+
const panel = (active) => {
|
|
243
|
+
switch (active) {
|
|
244
|
+
case "overview":
|
|
245
|
+
return (_jsxs("div", { className: "recordpage-panel", children: [_jsxs("section", { children: [_jsx("div", { className: "recordpage-section-title", children: "Highlights" }), _jsx("div", { className: "recordpage-hl-card", children: _jsx("div", { className: "recordpage-hl-grid", children: highlights.map((h) => (_jsxs("div", { className: "recordpage-hl-cell", children: [_jsx(h.icon, { className: "recordpage-hl-icon", size: 15, strokeWidth: 1.75 }), _jsx("div", { className: "recordpage-hl-label", children: h.label }), _jsx("div", { className: "recordpage-hl-value", children: h.value ?? (_jsx("span", { className: "recordpage-hl-value--empty", children: h.empty })) })] }, h.label))) }) })] }), activityFeed, _jsxs("section", { children: [_jsx(SectionHead, { title: "Emails", count: 0 }), emailsEmpty] }), _jsx(NotesSection, { notes: notes, onAdd: addNote }), _jsx(TasksSection, { tasks: tasks, onAdd: addTask, onToggle: toggleTask })] }));
|
|
246
|
+
case "activity":
|
|
247
|
+
return _jsx("div", { className: "recordpage-panel", children: activityFeed });
|
|
248
|
+
case "notes":
|
|
249
|
+
return (_jsx("div", { className: "recordpage-panel", children: _jsx(NotesSection, { notes: notes, onAdd: addNote }) }));
|
|
250
|
+
case "tasks":
|
|
251
|
+
return (_jsx("div", { className: "recordpage-panel", children: _jsx(TasksSection, { tasks: tasks, onAdd: addTask, onToggle: toggleTask }) }));
|
|
252
|
+
case "emails":
|
|
253
|
+
return _jsx("div", { className: "recordpage-panel", children: emailsEmpty });
|
|
254
|
+
default:
|
|
255
|
+
return (_jsx("div", { className: "recordpage-panel", children: _jsx(EmptyCard, { icon: _jsx(Folder, { size: 22, strokeWidth: 1.5 }), children: "Nothing here yet." }) }));
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
return (_jsxs("div", { className: recordpageRecipe({ className }), children: [_jsxs("div", { className: "recordpage-topbar", children: [_jsxs("nav", { className: "recordpage-crumbs", "aria-label": "Breadcrumb", children: [_jsx("button", { type: "button", className: "recordpage-crumb", onClick: onBack, "aria-label": `Back to ${collection}`, children: collection }), _jsx("span", { className: "recordpage-crumb-sep", children: "/" }), _jsx("span", { className: "recordpage-crumb-name", children: name })] }), _jsxs("div", { className: "recordpage-actions", children: [_jsxs("button", { type: "button", className: "recordpage-action recordpage-action--ghost", children: [_jsx(Sparkles, { size: 14, strokeWidth: 1.75, color: "var(--bg-brand-solid)" }), "Ask Attio"] }), onToggleFull && (_jsx("button", { type: "button", className: "recordpage-action recordpage-action--icon", onClick: onToggleFull, "aria-label": full ? "Exit full screen" : "Full screen", children: full ? (_jsx(Minimize2, { size: 15, strokeWidth: 1.75 })) : (_jsx(Maximize2, { size: 15, strokeWidth: 1.75 })) })), _jsxs(Menu, { align: "end", "aria-label": "Record actions", trigger: _jsx("button", { type: "button", className: "recordpage-action recordpage-action--icon", "aria-label": "Record actions", children: _jsx(MoreHorizontal, { size: 16, strokeWidth: 1.75 }) }), children: [_jsx(MenuItem, { icon: _jsx(Copy, { size: 15, strokeWidth: 1.75 }), shortcut: "\u2318C", children: "Copy record link" }), _jsx(MenuItem, { icon: _jsx(Plus, { size: 15, strokeWidth: 1.75 }), children: "Add to list" }), _jsx(MenuItem, { icon: _jsx(Star, { size: 15, strokeWidth: 1.75 }), onSelect: () => setFavorite((f) => !f), children: favorite ? "Remove from favourites" : "Add to favourites" }), _jsx(MenuSeparator, {}), _jsx(MenuItem, { icon: _jsx(Trash2, { size: 15, strokeWidth: 1.75 }), danger: true, shortcut: "\u232B", children: "Delete record" })] })] })] }), _jsxs("div", { className: "recordpage-body", children: [_jsxs("aside", { className: "recordpage-details", style: { width: detailsW }, children: [_jsxs("div", { className: "recordpage-entity", children: [entity?.avatar ? (_jsx("img", { className: "recordpage-entity-logo", src: entity.avatar, alt: "" })) : (_jsx(Avatar, { size: "lg", shape: "rounded", tone: "brand", children: name.charAt(0) })), _jsx("span", { className: "recordpage-entity-name", children: name }), _jsx("button", { type: "button", className: "recordpage-entity-iconbtn", "aria-label": "Edit record", children: _jsx(Pencil, { size: 15, strokeWidth: 1.75 }) }), _jsx("button", { type: "button", className: "recordpage-entity-iconbtn", "data-active": favorite ? "" : undefined, "aria-pressed": favorite, onClick: () => setFavorite((f) => !f), "aria-label": favorite ? "Remove from favourites" : "Add to favourites", children: _jsx(Star, { size: 15, strokeWidth: 1.75 }) })] }), _jsxs("div", { className: "recordpage-quickactions", children: [_jsxs("button", { type: "button", className: "recordpage-compose", children: [_jsx(Mail, { size: 16, strokeWidth: 1.75 }), "Compose email"] }), _jsx("button", { type: "button", className: "recordpage-quickbtn", "aria-label": "Copy record link", children: _jsx(Copy, { size: 15, strokeWidth: 1.75 }) }), _jsx("button", { type: "button", className: "recordpage-quickbtn", "aria-label": "Log a note", children: _jsx(FileText, { size: 15, strokeWidth: 1.75 }) }), _jsx("button", { type: "button", className: "recordpage-quickbtn", "aria-label": "Link records", children: _jsx(Share2, { size: 15, strokeWidth: 1.75 }) }), _jsx("button", { type: "button", className: "recordpage-quickbtn", "aria-label": "Create a task", children: _jsx(SquareCheck, { size: 15, strokeWidth: 1.75 }) })] }), _jsxs("div", { className: "recordpage-section", children: [_jsxs("div", { className: "recordpage-detailhead", children: [searchOpen ? (_jsx("input", {
|
|
259
|
+
// biome-ignore lint/a11y/noAutofocus: focusing the just-opened field search is expected
|
|
260
|
+
autoFocus: true, type: "text", className: "recordpage-fieldsearch", placeholder: "Search\u2026", "aria-label": "Search fields", value: fieldQuery, onChange: (e) => setFieldQuery(e.target.value), onKeyDown: (e) => {
|
|
261
|
+
if (e.key === "Escape") {
|
|
262
|
+
setSearchOpen(false);
|
|
263
|
+
setFieldQuery("");
|
|
264
|
+
}
|
|
265
|
+
} })) : (_jsxs("button", { type: "button", className: "recordpage-collapse", "data-collapsed": detailsOpen ? undefined : "", "aria-expanded": detailsOpen, onClick: () => setDetailsOpen((o) => !o), children: ["Record Details", _jsx(ChevronDown, { className: "recordpage-chev", size: 12, strokeWidth: 2.5 })] })), _jsx("button", { type: "button", className: "recordpage-detailsearch", "data-active": searchOpen ? "" : undefined, "aria-label": searchOpen ? "Close search" : "Search fields", "aria-pressed": searchOpen, onClick: () => {
|
|
266
|
+
setSearchOpen((s) => !s);
|
|
267
|
+
setFieldQuery("");
|
|
268
|
+
if (!searchOpen)
|
|
269
|
+
setDetailsOpen(true);
|
|
270
|
+
}, children: searchOpen ? (_jsx(X, { size: 14, strokeWidth: 1.75 })) : (_jsx(Search, { size: 14, strokeWidth: 1.75 })) })] }), detailsOpen &&
|
|
271
|
+
(shownFields.length > 0 ? (_jsxs(_Fragment, { children: [shownFields.map((col) => (_jsxs("div", { className: "recordpage-field", children: [_jsxs("span", { className: "recordpage-field-label", children: [col.icon ? (_jsx(col.icon, { size: 15, strokeWidth: 1.75 })) : null, _jsx("span", { className: "recordpage-field-label-text", children: col.label })] }), _jsx("span", { className: "recordpage-field-value", children: _jsx(FieldValue, { col: col, row: record }) })] }, col.key))), canRevealFields && (_jsx("button", { type: "button", className: "recordpage-viewall recordpage-viewall--section", onClick: () => {
|
|
272
|
+
// Attio: revealing all fields also opens the (focused)
|
|
273
|
+
// field search; collapsing closes it.
|
|
274
|
+
const next = !showAllValues;
|
|
275
|
+
setShowAllValues(next);
|
|
276
|
+
setSearchOpen(next);
|
|
277
|
+
if (!next)
|
|
278
|
+
setFieldQuery("");
|
|
279
|
+
}, children: showAllValues ? "View less" : "View all values" }))] })) : (_jsxs("div", { className: "recordpage-noresults", children: ["No fields match \u201C", fieldQuery, "\u201D."] })))] }), _jsxs("div", { className: "recordpage-section", children: [_jsx(SectionHead, { title: "Lists", action: _jsxs("button", { type: "button", className: "recordpage-addbtn", children: [_jsx(Plus, { size: 14, strokeWidth: 2 }), "Add to list"] }) }), _jsx("div", { className: "recordpage-emptystate", children: "This record has not been added to any lists." })] })] }), _jsx("div", { className: "recordpage-resizer", "data-active": resizing ? "" : undefined, role: "separator", "aria-orientation": "vertical", "aria-label": "Resize details column", "aria-valuenow": Math.round(detailsW), "aria-valuemin": 300, "aria-valuemax": 560, tabIndex: 0, onPointerDown: onResizeDown, onPointerMove: onResizeMove, onPointerUp: onResizeUp, onKeyDown: (e) => {
|
|
280
|
+
if (e.key === "ArrowLeft")
|
|
281
|
+
setDetailsW((w) => Math.max(300, w - 16));
|
|
282
|
+
else if (e.key === "ArrowRight")
|
|
283
|
+
setDetailsW((w) => Math.min(560, w + 16));
|
|
284
|
+
} }), _jsx("main", { className: "recordpage-main", children: _jsx(Tabs, { tabs: tabs, defaultValue: "overview", "aria-label": `${name} record`, children: panel }) })] })] }));
|
|
285
|
+
}
|
|
286
|
+
RecordPage.displayName = "RecordPage";
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
import { contract as c } from "../../tokens/index.js";
|
|
3
|
+
// The full-page company record view Attio opens when you click into a record —
|
|
4
|
+
// measured from the live app. A slim top bar (breadcrumb · logo · name 16/600 ·
|
|
5
|
+
// actions), then a two-column body: a 320px left "Record Details" attribute
|
|
6
|
+
// column (transparent, border-right) and a flexible main area whose tab bar
|
|
7
|
+
// (14/500 labels over a sliding ink underline) switches content — Overview shows
|
|
8
|
+
// a bordered Highlights stat-grid and an Activity feed.
|
|
9
|
+
const config = defineRecipe({
|
|
10
|
+
name: "recordpage",
|
|
11
|
+
base: `
|
|
12
|
+
display: flex; flex-direction: column; height: 100%; min-height: 0; background: ${c.bgSurface};
|
|
13
|
+
font-family: ${c.font.sans}; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
|
|
14
|
+
color: ${c.fgPrimary};
|
|
15
|
+
& * { box-sizing: border-box; }
|
|
16
|
+
|
|
17
|
+
& .recordpage-topbar { display: flex; align-items: center; gap: ${c.space["2"]}; height: 44px; flex-shrink: 0; padding: 0 ${c.space["3"]}; border-bottom: 1px solid ${c.borderSubtle}; }
|
|
18
|
+
& .recordpage-crumbs { display: inline-flex; align-items: center; gap: ${c.space["1.5"]}; min-width: 0; }
|
|
19
|
+
& .recordpage-crumb { display: inline-flex; align-items: center; height: 26px; padding: 0 ${c.space["1.5"]}; margin: 0 calc(-1 * ${c.space["1.5"]}) 0 0; border: none; border-radius: ${c.radius.md}; background: none; font-family: inherit; font-size: ${c.text.lg}; font-weight: ${c.weight.medium}; color: ${c.fgMuted}; cursor: pointer; }
|
|
20
|
+
& .recordpage-crumb:hover { background: ${c.bgRaised}; color: ${c.fgPrimary}; }
|
|
21
|
+
& .recordpage-crumb-sep { color: ${c.fgMuted}; font-size: ${c.text.lg}; }
|
|
22
|
+
& .recordpage-crumb-name { font-size: ${c.text.lg}; font-weight: ${c.weight.medium}; color: ${c.fgPrimary}; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
23
|
+
& .recordpage-actions { margin-left: auto; display: flex; align-items: center; gap: ${c.space["1"]}; }
|
|
24
|
+
& .recordpage-action { display: inline-flex; align-items: center; gap: ${c.space["1.5"]}; height: 28px; padding: 0 ${c.space["2"]} 0 ${c.space["1.5"]}; margin: 0; border: none; border-radius: ${c.radius.md}; background: ${c.bgSurface}; box-shadow: inset 0 0 0 1px ${c.ringNeutral}, 0 0 2px rgba(28,40,64,0.18), 0 1px 3px rgba(0,0,0,0.04); font-family: inherit; font-size: ${c.text.lg}; font-weight: ${c.weight.medium}; color: ${c.fgPrimary}; cursor: pointer; white-space: nowrap; }
|
|
25
|
+
& .recordpage-action:hover { background: ${c.bgRaised}; }
|
|
26
|
+
& .recordpage-action--ghost { box-shadow: none; color: ${c.fgMuted}; }
|
|
27
|
+
& .recordpage-action--icon { width: 28px; padding: 0; justify-content: center; box-shadow: none; color: ${c.fgMuted}; }
|
|
28
|
+
& .recordpage-action svg { flex-shrink: 0; }
|
|
29
|
+
|
|
30
|
+
& .recordpage-body { flex: 1; min-height: 0; display: flex; }
|
|
31
|
+
|
|
32
|
+
& .recordpage-details { width: 320px; flex-shrink: 0; overflow-y: auto; border-right: 1px solid ${c.borderSubtle}; padding: ${c.space["3"]}; }
|
|
33
|
+
& .recordpage-resizer { position: relative; flex: 0 0 auto; width: 0; align-self: stretch; cursor: col-resize; z-index: 5; touch-action: none; }
|
|
34
|
+
& .recordpage-resizer::before { content: ""; position: absolute; top: 0; bottom: 0; left: -4px; width: 9px; }
|
|
35
|
+
& .recordpage-resizer::after { content: ""; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: transparent; transition: background-color .12s ease; }
|
|
36
|
+
& .recordpage-resizer:hover::after, & .recordpage-resizer[data-active]::after { background: color-mix(in srgb, ${c.bgBrandSolid} 55%, transparent); }
|
|
37
|
+
& .recordpage-entity { display: flex; align-items: center; gap: ${c.space["2"]}; padding: ${c.space["1"]} ${c.space["1"]} ${c.space["2"]}; }
|
|
38
|
+
& .recordpage-entity-logo { width: 32px; height: 32px; border-radius: 30%; flex-shrink: 0; object-fit: cover; background: ${c.bgRaised}; }
|
|
39
|
+
& .recordpage-entity-name { flex: 0 1 auto; min-width: 0; font-size: ${c.text.xl}; font-weight: ${c.weight.semibold}; letter-spacing: -0.3px; color: ${c.fgPrimary}; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
40
|
+
& .recordpage-entity-iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex-shrink: 0; padding: 0; margin: 0; border: none; border-radius: ${c.radius.sm}; background: none; color: ${c.fgMuted}; cursor: pointer; transition: background-color .12s, color .12s; }
|
|
41
|
+
& .recordpage-entity-iconbtn:first-of-type { margin-left: calc(-1 * ${c.space["1"]}); }
|
|
42
|
+
& .recordpage-entity-iconbtn:hover { background: ${c.bgRaised}; color: ${c.fgPrimary}; }
|
|
43
|
+
& .recordpage-entity-iconbtn[data-active] svg { color: #f5b83d; fill: #f5b83d; }
|
|
44
|
+
& .recordpage-quickactions { display: flex; align-items: center; gap: ${c.space["2"]}; padding: 0 ${c.space["1"]} ${c.space["3"]}; }
|
|
45
|
+
& .recordpage-compose { display: inline-flex; align-items: center; gap: ${c.space["1.5"]}; height: 28px; padding: 0 ${c.space["4"]} 0 ${c.space["3"]}; margin: 0; border: none; border-radius: ${c.radius.md}; background: ${c.bgSurface}; box-shadow: inset 0 0 0 1px ${c.ringNeutral}, 0 0 2px rgba(28,40,64,0.18), 0 1px 3px rgba(0,0,0,0.04); font-family: inherit; font-size: ${c.text.lg}; font-weight: ${c.weight.medium}; color: ${c.fgPrimary}; white-space: nowrap; cursor: pointer; transition: background-color .12s; }
|
|
46
|
+
& .recordpage-compose:hover { background: ${c.bgRaised}; }
|
|
47
|
+
& .recordpage-compose svg { flex-shrink: 0; color: ${c.fgMuted}; }
|
|
48
|
+
& .recordpage-quickbtn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex-shrink: 0; padding: 0; margin: 0; border: none; border-radius: ${c.radius.md}; background: ${c.bgSurface}; box-shadow: inset 0 0 0 1px ${c.ringNeutral}, 0 0 2px rgba(28,40,64,0.18), 0 1px 3px rgba(0,0,0,0.04); color: ${c.fgMuted}; cursor: pointer; transition: background-color .12s, color .12s; }
|
|
49
|
+
& .recordpage-quickbtn:hover { background: ${c.bgRaised}; color: ${c.fgPrimary}; }
|
|
50
|
+
& .recordpage-section { padding-top: ${c.space["2"]}; }
|
|
51
|
+
& .recordpage-section-title { font-size: ${c.text.sm}; font-weight: ${c.weight.medium}; letter-spacing: -0.12px; color: color-mix(in srgb, ${c.fgPrimary} 63%, transparent); padding: ${c.space["1"]}; }
|
|
52
|
+
/* main-area section headers (Highlights / Activity / Emails / Notes / Tasks)
|
|
53
|
+
are 14px in Attio; the left column's (Record Details / Lists) stay 12px. */
|
|
54
|
+
& .recordpage-main .recordpage-section-title { font-size: ${c.text.lg}; }
|
|
55
|
+
& .recordpage-detailhead { display: flex; align-items: center; gap: ${c.space["0.5"]}; margin-bottom: ${c.space["3"]}; padding-right: ${c.space["0.5"]}; }
|
|
56
|
+
& .recordpage-collapse { display: inline-flex; align-items: center; gap: 2px; flex: 1; min-width: 0; margin: 0; border: none; background: none; padding: ${c.space["1"]}; border-radius: ${c.radius.md}; font-family: inherit; font-size: ${c.text.sm}; font-weight: ${c.weight.medium}; letter-spacing: -0.12px; color: ${c.fgMuted}; cursor: pointer; text-align: left; }
|
|
57
|
+
& .recordpage-collapse:hover { color: ${c.fgPrimary}; }
|
|
58
|
+
& .recordpage-collapse .recordpage-chev { flex-shrink: 0; transition: transform .15s ease; }
|
|
59
|
+
& .recordpage-collapse[data-collapsed] .recordpage-chev { transform: rotate(-90deg); }
|
|
60
|
+
& .recordpage-fieldsearch { flex: 1; min-width: 0; border: none; outline: none; background: none; padding: ${c.space["1"]}; font-family: inherit; font-size: ${c.text.sm}; font-weight: ${c.weight.medium}; letter-spacing: -0.12px; color: ${c.fgPrimary}; }
|
|
61
|
+
& .recordpage-fieldsearch::placeholder { color: ${c.fgMuted}; font-weight: ${c.weight.regular}; }
|
|
62
|
+
& .recordpage-detailsearch { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; flex-shrink: 0; padding: 0; margin: 0; border: none; border-radius: ${c.radius.sm}; background: none; color: ${c.fgMuted}; cursor: pointer; transition: background-color .12s, color .12s; }
|
|
63
|
+
& .recordpage-detailsearch:hover, & .recordpage-detailsearch[data-active] { background: ${c.bgRaised}; color: ${c.fgPrimary}; }
|
|
64
|
+
& .recordpage-noresults { padding: ${c.space["1.5"]} ${c.space["1"]}; font-size: ${c.text.md}; color: ${c.fgMuted}; }
|
|
65
|
+
& .recordpage-morevalues { display: inline-flex; align-items: center; padding: 0; margin: 0; border: none; background: none; font-family: inherit; font-size: ${c.text.lg}; color: ${c.fgMuted}; cursor: pointer; }
|
|
66
|
+
& .recordpage-morevalues:hover { color: ${c.fgPrimary}; }
|
|
67
|
+
& .recordpage-viewall { flex-basis: 100%; margin-top: ${c.space["0.5"]}; border: none; background: none; padding: 0; color: color-mix(in srgb, ${c.fgPrimary} 55%, transparent); font-family: inherit; font-size: ${c.text.sm}; font-weight: ${c.weight.regular}; cursor: pointer; text-align: left; }
|
|
68
|
+
& .recordpage-viewall:hover { color: ${c.fgPrimary}; }
|
|
69
|
+
& .recordpage-viewall--inline { flex-basis: auto; margin-top: 0; }
|
|
70
|
+
& .recordpage-viewall--section { display: block; flex-basis: auto; margin-top: 0; padding: ${c.space["1"]} ${c.space["1"]}; }
|
|
71
|
+
& .recordpage-field { display: grid; grid-template-columns: 30% 1fr; align-items: start; column-gap: ${c.space["2"]}; min-height: 32px; padding: ${c.space["0.5"]} ${c.space["1"]}; border-radius: ${c.radius.md}; }
|
|
72
|
+
& .recordpage-field + .recordpage-field { margin-top: ${c.space["0.5"]}; }
|
|
73
|
+
& .recordpage-field:hover { background: color-mix(in srgb, ${c.fgPrimary} 3%, transparent); }
|
|
74
|
+
& .recordpage-field-label { display: flex; align-items: center; gap: ${c.space["1.5"]}; min-width: 0; overflow: hidden; padding-top: 2px; line-height: 20px; color: color-mix(in srgb, ${c.fgPrimary} 63%, transparent); font-size: ${c.text.sm}; font-weight: ${c.weight.medium}; }
|
|
75
|
+
& .recordpage-field-label svg { flex-shrink: 0; color: ${c.fgMuted}; }
|
|
76
|
+
& .recordpage-field-label-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
77
|
+
& .recordpage-field-value { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: ${c.space["1"]}; padding-top: 2px; line-height: 20px; font-size: ${c.text.lg}; font-weight: ${c.weight.medium}; color: ${c.fgPrimary}; }
|
|
78
|
+
& .recordpage-empty { color: ${c.fgMuted}; }
|
|
79
|
+
& .recordpage-link { color: ${c.fgPrimary}; text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
|
|
80
|
+
& .recordpage-link:hover { text-decoration: underline; }
|
|
81
|
+
& .recordpage-emptystate { padding: ${c.space["2"]} ${c.space["1"]}; font-size: ${c.text.md}; color: ${c.fgMuted}; }
|
|
82
|
+
|
|
83
|
+
& .recordpage-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding: ${c.space["3"]} ${c.space["5"]}; }
|
|
84
|
+
|
|
85
|
+
& .recordpage-panel { padding-top: ${c.space["4"]}; display: flex; flex-direction: column; gap: ${c.space["4"]}; }
|
|
86
|
+
& .recordpage-card { border: 1px solid ${c.borderSubtle}; border-radius: ${c.radius["2xl"]}; background: ${c.bgSurface}; overflow: hidden; }
|
|
87
|
+
& .recordpage-card-title { font-size: ${c.text.lg}; font-weight: ${c.weight.semibold}; letter-spacing: -0.14px; color: ${c.fgPrimary}; padding: ${c.space["3"]} ${c.space["3"]} ${c.space["2"]}; }
|
|
88
|
+
& .recordpage-hl-card { border: 1px solid ${c.borderSubtle}; border-radius: ${c.radius["2xl"]}; overflow: hidden; }
|
|
89
|
+
/* gap-as-gridlines: a 1px gap over the border colour draws dividers at any
|
|
90
|
+
column count, so the grid stays responsive (auto-fit) without per-cell
|
|
91
|
+
nth-child border hacks that break when the column count changes. */
|
|
92
|
+
& .recordpage-hl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1px; background: ${c.borderSubtle}; }
|
|
93
|
+
& .recordpage-hl-cell { position: relative; min-height: 84px; padding: ${c.space["2.5"]} ${c.space["3"]}; background: ${c.bgSurface}; }
|
|
94
|
+
& .recordpage-hl-icon { position: absolute; top: ${c.space["2.5"]}; right: ${c.space["3"]}; color: ${c.fgMuted}; }
|
|
95
|
+
& .recordpage-hl-label { font-size: ${c.text.sm}; font-weight: ${c.weight.medium}; color: color-mix(in srgb, ${c.fgPrimary} 63%, transparent); margin-bottom: ${c.space["2.5"]}; padding-right: ${c.space["4"]}; }
|
|
96
|
+
& .recordpage-hl-value { display: flex; flex-wrap: wrap; align-items: center; gap: ${c.space["1"]}; font-size: ${c.text.lg}; font-weight: ${c.weight.medium}; color: ${c.fgPrimary}; }
|
|
97
|
+
& .recordpage-hl-value--empty { color: ${c.fgMuted}; font-weight: ${c.weight.regular}; }
|
|
98
|
+
|
|
99
|
+
& .recordpage-feed { display: flex; flex-direction: column; }
|
|
100
|
+
& .recordpage-feed-item { display: flex; align-items: flex-start; gap: ${c.space["2.5"]}; padding: ${c.space["2"]} 0; }
|
|
101
|
+
& .recordpage-feed-dot { position: relative; display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex-shrink: 0; border-radius: ${c.radius.full}; background: ${c.bgRaised}; color: ${c.fgMuted}; }
|
|
102
|
+
& .recordpage-feed-body { flex: 1; min-width: 0; font-size: ${c.text.md}; color: ${c.fgPrimary}; }
|
|
103
|
+
& .recordpage-feed-body b { font-weight: ${c.weight.medium}; }
|
|
104
|
+
& .recordpage-feed-time { font-size: ${c.text.sm}; color: ${c.fgMuted}; margin-top: 2px; }
|
|
105
|
+
& .recordpage-feed-more { align-self: flex-start; margin-top: ${c.space["1"]}; border: none; background: none; padding: ${c.space["1"]} 0; color: ${c.bgBrandSolid}; font-family: inherit; font-size: ${c.text.md}; font-weight: ${c.weight.medium}; cursor: pointer; }
|
|
106
|
+
& .recordpage-feed-more:hover { text-decoration: underline; }
|
|
107
|
+
|
|
108
|
+
& .recordpage-section-head { display: flex; align-items: center; gap: ${c.space["1.5"]}; padding: ${c.space["1"]}; }
|
|
109
|
+
& .recordpage-section-head .recordpage-section-title { padding: 0; }
|
|
110
|
+
& .recordpage-section-count { display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; padding: 0 ${c.space["1"]}; border-radius: ${c.radius.sm}; background: color-mix(in srgb, ${c.fgPrimary} 6%, transparent); font-size: ${c.text.xs}; font-weight: ${c.weight.medium}; color: ${c.fgMuted}; }
|
|
111
|
+
& .recordpage-section-spacer { flex: 1; }
|
|
112
|
+
& .recordpage-addbtn { display: inline-flex; align-items: center; gap: ${c.space["1"]}; height: 26px; padding: 0 ${c.space["1.5"]}; margin: 0; border: none; border-radius: ${c.radius.md}; background: ${c.bgSurface}; box-shadow: inset 0 0 0 1px ${c.ringNeutral}, 0 0 2px rgba(28,40,64,0.18), 0 1px 3px rgba(0,0,0,0.04); color: ${c.fgPrimary}; font-family: inherit; font-size: ${c.text.md}; font-weight: ${c.weight.medium}; cursor: pointer; }
|
|
113
|
+
& .recordpage-addbtn:hover { background: ${c.bgRaised}; }
|
|
114
|
+
& .recordpage-addbtn svg { flex-shrink: 0; }
|
|
115
|
+
|
|
116
|
+
& .recordpage-composer { display: flex; flex-direction: column; gap: ${c.space["2"]}; padding: ${c.space["2"]}; border: 1px solid ${c.borderDefault}; border-radius: ${c.radius.xl}; background: ${c.bgSurface}; margin-bottom: ${c.space["2"]}; }
|
|
117
|
+
& .recordpage-composer textarea { width: 100%; min-height: 56px; resize: vertical; border: none; outline: none; background: none; font-family: inherit; font-size: ${c.text.lg}; color: ${c.fgPrimary}; }
|
|
118
|
+
& .recordpage-composer textarea::placeholder { color: ${c.fgMuted}; }
|
|
119
|
+
& .recordpage-composer-actions { display: flex; justify-content: flex-end; align-items: center; gap: ${c.space["1.5"]}; }
|
|
120
|
+
& .recordpage-btn { display: inline-flex; align-items: center; height: 28px; padding: 0 ${c.space["2.5"]}; margin: 0; border: none; border-radius: ${c.radius.md}; font-family: inherit; font-size: ${c.text.md}; font-weight: ${c.weight.medium}; cursor: pointer; box-shadow: inset 0 0 0 1px ${c.ringNeutral}, 0 0 2px rgba(28,40,64,0.18), 0 1px 3px rgba(0,0,0,0.04); background: ${c.bgSurface}; color: ${c.fgPrimary}; }
|
|
121
|
+
& .recordpage-btn:hover { background: ${c.bgRaised}; }
|
|
122
|
+
& .recordpage-btn--primary { box-shadow: none; background: ${c.bgBrandSolid}; color: ${c.fgOnBrand}; }
|
|
123
|
+
& .recordpage-btn--primary:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
124
|
+
|
|
125
|
+
& .recordpage-note { display: flex; gap: ${c.space["2.5"]}; padding: ${c.space["2.5"]} 0; border-top: 1px solid ${c.borderSubtle}; }
|
|
126
|
+
& .recordpage-note-body { flex: 1; min-width: 0; }
|
|
127
|
+
& .recordpage-note-head { display: flex; align-items: center; gap: ${c.space["1.5"]}; margin-bottom: ${c.space["0.5"]}; }
|
|
128
|
+
& .recordpage-note-author { font-size: ${c.text.md}; font-weight: ${c.weight.medium}; color: ${c.fgPrimary}; }
|
|
129
|
+
& .recordpage-note-time { font-size: ${c.text.sm}; color: ${c.fgMuted}; }
|
|
130
|
+
& .recordpage-note-text { font-size: ${c.text.lg}; color: ${c.fgPrimary}; white-space: pre-wrap; word-break: break-word; }
|
|
131
|
+
|
|
132
|
+
& .recordpage-task { display: flex; align-items: flex-start; gap: ${c.space["2"]}; padding: ${c.space["1.5"]} 0; border-top: 1px solid ${c.borderSubtle}; }
|
|
133
|
+
& .recordpage-task-text { flex: 1; min-width: 0; font-size: ${c.text.lg}; color: ${c.fgPrimary}; padding-top: 1px; }
|
|
134
|
+
& .recordpage-task[data-done] .recordpage-task-text { text-decoration: line-through; color: ${c.fgMuted}; }
|
|
135
|
+
|
|
136
|
+
& .recordpage-emptycard { display: flex; flex-direction: column; align-items: center; gap: ${c.space["1.5"]}; padding: ${c.space["6"]} ${c.space["3"]}; border: 1px dashed ${c.borderDefault}; border-radius: ${c.radius.xl}; color: ${c.fgMuted}; font-size: ${c.text.md}; text-align: center; }
|
|
137
|
+
& .recordpage-emptycard svg { color: ${c.fgMuted}; opacity: 0.7; }
|
|
138
|
+
|
|
139
|
+
& .recordpage-action[data-active] svg { color: #f5b83d; fill: #f5b83d; }
|
|
140
|
+
|
|
141
|
+
& .recordstable-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 ${c.space["1"]}; border-radius: 7px; font-size: ${c.text.lg}; line-height: 20px; font-weight: ${c.weight.medium}; white-space: nowrap; background: color-mix(in srgb, ${c.fgPrimary} 6%, transparent); color: color-mix(in srgb, ${c.fgPrimary} 82%, transparent); }
|
|
142
|
+
& .recordstable-tag[data-tone="brand"] { background: color-mix(in srgb, ${c.bgBrandSolid} 14%, transparent); color: color-mix(in srgb, ${c.bgBrandSolid} 82%, ${c.fgPrimary}); }
|
|
143
|
+
& .recordstable-tag[data-tone="success"] { background: color-mix(in srgb, ${c.bgSuccess} 16%, transparent); color: color-mix(in srgb, ${c.bgSuccess} 78%, ${c.fgPrimary}); }
|
|
144
|
+
& .recordstable-tag[data-tone="warning"] { background: color-mix(in srgb, ${c.bgWarning} 18%, transparent); color: color-mix(in srgb, ${c.bgWarning} 82%, ${c.fgPrimary}); }
|
|
145
|
+
& .recordstable-tag[data-tone="danger"] { background: color-mix(in srgb, ${c.bgDanger} 15%, transparent); color: color-mix(in srgb, ${c.bgDanger} 80%, ${c.fgPrimary}); }
|
|
146
|
+
& .recordstable-tag[data-tone="purple"] { background: color-mix(in srgb, ${c.bgPurple} 16%, transparent); color: color-mix(in srgb, ${c.bgPurple} 80%, ${c.fgPrimary}); }
|
|
147
|
+
& .recordstable-tag[data-tone="cyan"] { background: color-mix(in srgb, ${c.bgCyan} 18%, transparent); color: color-mix(in srgb, ${c.bgCyan} 82%, ${c.fgPrimary}); }
|
|
148
|
+
& .recordstable-tag[data-tone="orange"] { background: color-mix(in srgb, ${c.bgOrange} 16%, transparent); color: color-mix(in srgb, ${c.bgOrange} 82%, ${c.fgPrimary}); }
|
|
149
|
+
`,
|
|
150
|
+
variants: {},
|
|
151
|
+
defaultVariants: {},
|
|
152
|
+
compoundVariants: [],
|
|
153
|
+
});
|
|
154
|
+
export const recordpageRecipe = Object.assign(resolveRecipe(config), {
|
|
155
|
+
config,
|
|
156
|
+
});
|
|
157
|
+
export default config;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { X } from "lucide-react";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Avatar } from "../../components/avatar/index.js";
|
|
5
|
+
import { tagTone, } from "../recordstable/index.js";
|
|
6
|
+
import { recordpanelRecipe } from "./recordpanel.recipe.js";
|
|
7
|
+
function FieldValue({ col, row }) {
|
|
8
|
+
const v = row[col.key];
|
|
9
|
+
if (v == null || v === "" || (Array.isArray(v) && !v.length)) {
|
|
10
|
+
return _jsx("span", { className: "recordpanel-empty", children: "Empty" });
|
|
11
|
+
}
|
|
12
|
+
switch (col.type) {
|
|
13
|
+
case "tags":
|
|
14
|
+
return (_jsx(_Fragment, { children: v.map((t) => (_jsx("span", { className: "recordstable-tag", "data-tone": tagTone(t), children: t }, t))) }));
|
|
15
|
+
case "number":
|
|
16
|
+
return _jsx(_Fragment, { children: typeof v === "number" ? v.toLocaleString() : v });
|
|
17
|
+
case "url":
|
|
18
|
+
return (_jsx("a", { className: "recordpanel-link", href: `https://${v}`, target: "_blank", rel: "noreferrer", children: v }));
|
|
19
|
+
default:
|
|
20
|
+
return _jsx(_Fragment, { children: String(v) });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Right-side record peek panel — shows one record's fields, opened from a
|
|
25
|
+
* RecordsTable row (via `onOpenRecord`). Render it inside a `position:
|
|
26
|
+
* relative` container (e.g. the app main area); it slides in from the right and
|
|
27
|
+
* overlays the content.
|
|
28
|
+
*/
|
|
29
|
+
export function RecordPanel({ record, columns, onClose, className, }) {
|
|
30
|
+
// close on Escape while open
|
|
31
|
+
React.useEffect(() => {
|
|
32
|
+
if (!record)
|
|
33
|
+
return;
|
|
34
|
+
const onKey = (e) => e.key === "Escape" && onClose();
|
|
35
|
+
document.addEventListener("keydown", onKey);
|
|
36
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
37
|
+
}, [record, onClose]);
|
|
38
|
+
if (!record)
|
|
39
|
+
return null;
|
|
40
|
+
const entityCol = columns.find((c) => c.type === "entity");
|
|
41
|
+
const entity = entityCol
|
|
42
|
+
? record[entityCol.key]
|
|
43
|
+
: undefined;
|
|
44
|
+
const fields = columns.filter((c) => c.type !== "entity");
|
|
45
|
+
return (_jsxs("div", { className: recordpanelRecipe({ className }), role: "dialog", "aria-label": entity?.name ?? "Record", children: [_jsxs("div", { className: "recordpanel-header", children: [entity?.avatar ? (_jsx("img", { className: "recordpanel-fav", src: entity.avatar, alt: "" })) : entity ? (_jsx(Avatar, { size: "md", shape: "rounded", tone: "brand", children: entity.name.charAt(0) })) : null, _jsx("span", { className: "recordpanel-title", children: entity?.name ?? "Record" }), _jsx("button", { type: "button", className: "recordpanel-iconbtn", "aria-label": "Close panel", onClick: onClose, children: _jsx(X, { size: 18, strokeWidth: 1.75 }) })] }), _jsxs("div", { className: "recordpanel-body", children: [_jsx("div", { className: "recordpanel-sectionlabel", children: "Details" }), fields.map((col) => (_jsxs("div", { className: "recordpanel-field", children: [_jsxs("span", { className: "recordpanel-field-label", children: [col.icon ? _jsx(col.icon, { size: 15, strokeWidth: 1.75 }) : null, col.label] }), _jsx("span", { className: "recordpanel-field-value", children: _jsx(FieldValue, { col: col, row: record }) })] }, col.key)))] })] }));
|
|
46
|
+
}
|
|
47
|
+
RecordPanel.displayName = "RecordPanel";
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { defineRecipe, resolveRecipe } from "../../core/index.js";
|
|
2
|
+
import { contract as c } from "../../tokens/index.js";
|
|
3
|
+
// A right-side record peek panel — slides in over the main content to show one
|
|
4
|
+
// record's fields, the way Attio opens a row. Positioned absolutely inside a
|
|
5
|
+
// relative container (the app main area); slides in via @starting-style.
|
|
6
|
+
const config = defineRecipe({
|
|
7
|
+
name: "recordpanel",
|
|
8
|
+
base: `
|
|
9
|
+
position: absolute; top: 0; right: 0; z-index: 20; display: flex; flex-direction: column;
|
|
10
|
+
width: 420px; max-width: 92%; height: 100%;
|
|
11
|
+
background: ${c.bgSurface}; border-left: 1px solid ${c.borderSubtle};
|
|
12
|
+
box-shadow: -12px 0 32px -16px rgba(28,40,64,0.22); font-family: ${c.font.sans};
|
|
13
|
+
-webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
|
|
14
|
+
transform: translateX(0); transition: transform .2s ease;
|
|
15
|
+
@starting-style { transform: translateX(100%); }
|
|
16
|
+
& * { box-sizing: border-box; }
|
|
17
|
+
|
|
18
|
+
& .recordpanel-header { display: flex; align-items: center; gap: ${c.space["2"]}; height: 52px; flex-shrink: 0; padding: 0 ${c.space["3"]}; border-bottom: 1px solid ${c.borderSubtle}; }
|
|
19
|
+
& .recordpanel-fav { width: 22px; height: 22px; border-radius: ${c.radius.sm}; flex-shrink: 0; object-fit: cover; background: ${c.bgRaised}; }
|
|
20
|
+
& .recordpanel-title { flex: 1; min-width: 0; font-size: ${c.text.xl}; font-weight: ${c.weight.semibold}; letter-spacing: -0.2px; color: ${c.fgPrimary}; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
21
|
+
& .recordpanel-iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex-shrink: 0; padding: 0; border: none; border-radius: ${c.radius.md}; background: transparent; color: ${c.fgMuted}; cursor: pointer; transition: background-color .12s; }
|
|
22
|
+
& .recordpanel-iconbtn:hover { background: ${c.bgRaised}; color: ${c.fgPrimary}; }
|
|
23
|
+
|
|
24
|
+
& .recordpanel-body { flex: 1; min-height: 0; overflow-y: auto; padding: ${c.space["2"]} ${c.space["3"]}; }
|
|
25
|
+
& .recordpanel-sectionlabel { font-size: ${c.text.sm}; font-weight: ${c.weight.medium}; color: ${c.fgMuted}; padding: ${c.space["2"]} ${c.space["1"]} ${c.space["1"]}; }
|
|
26
|
+
& .recordpanel-field { display: flex; align-items: flex-start; gap: ${c.space["2"]}; min-height: 32px; padding: ${c.space["1"]} ${c.space["1"]}; border-radius: ${c.radius.md}; }
|
|
27
|
+
& .recordpanel-field:hover { background: color-mix(in srgb, ${c.fgPrimary} 3%, transparent); }
|
|
28
|
+
& .recordpanel-field-label { display: flex; align-items: center; gap: ${c.space["1.5"]}; width: 132px; flex-shrink: 0; padding-top: 3px; color: ${c.fgMuted}; font-size: ${c.text.md}; }
|
|
29
|
+
& .recordpanel-field-label svg { flex-shrink: 0; }
|
|
30
|
+
& .recordpanel-field-value { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: ${c.space["1"]}; padding-top: 3px; font-size: ${c.text.lg}; color: ${c.fgPrimary}; }
|
|
31
|
+
& .recordpanel-empty { color: ${c.fgMuted}; }
|
|
32
|
+
|
|
33
|
+
& .recordstable-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 ${c.space["1"]}; border-radius: 7px; font-size: ${c.text.lg}; line-height: 20px; font-weight: ${c.weight.medium}; white-space: nowrap; background: color-mix(in srgb, ${c.fgPrimary} 6%, transparent); color: color-mix(in srgb, ${c.fgPrimary} 82%, transparent); }
|
|
34
|
+
& .recordstable-tag[data-tone="brand"] { background: color-mix(in srgb, ${c.bgBrandSolid} 14%, transparent); color: color-mix(in srgb, ${c.bgBrandSolid} 82%, ${c.fgPrimary}); }
|
|
35
|
+
& .recordstable-tag[data-tone="success"] { background: color-mix(in srgb, ${c.bgSuccess} 16%, transparent); color: color-mix(in srgb, ${c.bgSuccess} 78%, ${c.fgPrimary}); }
|
|
36
|
+
& .recordstable-tag[data-tone="warning"] { background: color-mix(in srgb, ${c.bgWarning} 18%, transparent); color: color-mix(in srgb, ${c.bgWarning} 82%, ${c.fgPrimary}); }
|
|
37
|
+
& .recordstable-tag[data-tone="danger"] { background: color-mix(in srgb, ${c.bgDanger} 15%, transparent); color: color-mix(in srgb, ${c.bgDanger} 80%, ${c.fgPrimary}); }
|
|
38
|
+
& .recordstable-tag[data-tone="purple"] { background: color-mix(in srgb, ${c.bgPurple} 16%, transparent); color: color-mix(in srgb, ${c.bgPurple} 80%, ${c.fgPrimary}); }
|
|
39
|
+
& .recordstable-tag[data-tone="cyan"] { background: color-mix(in srgb, ${c.bgCyan} 18%, transparent); color: color-mix(in srgb, ${c.bgCyan} 82%, ${c.fgPrimary}); }
|
|
40
|
+
& .recordstable-tag[data-tone="orange"] { background: color-mix(in srgb, ${c.bgOrange} 16%, transparent); color: color-mix(in srgb, ${c.bgOrange} 82%, ${c.fgPrimary}); }
|
|
41
|
+
& .recordpanel-link { color: ${c.bgBrandSolid}; text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
|
|
42
|
+
& .recordpanel-link:hover { text-decoration: underline; }
|
|
43
|
+
`,
|
|
44
|
+
variants: {},
|
|
45
|
+
defaultVariants: {},
|
|
46
|
+
compoundVariants: [],
|
|
47
|
+
});
|
|
48
|
+
export const recordpanelRecipe = Object.assign(resolveRecipe(config), {
|
|
49
|
+
config,
|
|
50
|
+
meta: { panel: { width: "420px" } },
|
|
51
|
+
});
|
|
52
|
+
export default config;
|