@ramme-io/ui 5.3.1 → 5.4.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 +1 -1
- package/dist/components/data-display/DataTable.d.ts +5 -0
- package/dist/components/data-display/DataTable.js +31 -29
- package/dist/components/data-display/_DataTableCards.js +31 -31
- package/dist/components/forms/SegmentedControl.js +14 -9
- package/dist/components/layout/AppShell.js +32 -32
- package/dist/components/layout/AppShell.print.test.d.ts +1 -0
- package/dist/components/ui/Avatar.d.ts +35 -6
- package/dist/components/ui/Avatar.js +54 -20
- package/dist/components/ui/Badge.d.ts +1 -1
- package/dist/components/ui/Icon.js +21 -11
- package/dist/contexts/ThemeContext.d.ts +6 -0
- package/dist/contexts/ThemeContext.js +90 -73
- package/dist/index.css +1 -1
- package/dist/index.js +83 -82
- package/dist/lib/hooks/useChartTheme.d.ts +21 -0
- package/dist/lib/hooks/useChartTheme.js +39 -22
- package/dist/lib/theme/themeUtils.d.ts +7 -1
- package/dist/lib/theme/themeUtils.js +50 -27
- package/dist/print-palette.test.d.ts +1 -0
- package/dist/wizardManifest.js +39 -7
- package/package.json +2 -2
- package/src/wizardManifest.ts +39 -7
- package/tailwind.preset.js +1 -0
package/README.md
CHANGED
|
@@ -183,7 +183,7 @@ Props, variants and live examples are in Storybook (`pnpm run storybook`) and at
|
|
|
183
183
|
| `AIChatThread` | `@molecule/ai/aichat-thread` | A complete chat surface — message history, streaming indicator, error banner, provider/model attribution, and the composer. |
|
|
184
184
|
| `Alert` | `@molecule/feedback/alert` | Displays static, in-page messages to convey important information like success, warnings, or errors. |
|
|
185
185
|
| `AreaChart` | `@atom/charts/area-chart` | A theme-aware area chart component powered by Recharts, ideal for showing trends and volume over time. |
|
|
186
|
-
| `Avatar` | `@atom/primitive/avatar` | Displays a
|
|
186
|
+
| `Avatar` | `@atom/primitive/avatar` | Displays a person's picture or a company's logo, with letters as the fallback. |
|
|
187
187
|
| `Badge` | `@atom/primitive/badge` | A small component to display a status, count, or label. |
|
|
188
188
|
| `BarChart` | `@atom/charts/bar-chart` | A theme-aware bar chart component powered by Recharts, for comparing categorical data. |
|
|
189
189
|
| `BrandLogo` | `@atom/primitive/brand-logo` | The application's brand mark, theme-aware and sized by a single prop. |
|
|
@@ -20,6 +20,11 @@ export interface ColumnSchema {
|
|
|
20
20
|
type?: DataFormat;
|
|
21
21
|
width?: number;
|
|
22
22
|
hide?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Long text, such as a headline: the grid wraps it and grows the row, and a
|
|
25
|
+
* phone card gives it a full-width row instead of cutting it to one line.
|
|
26
|
+
*/
|
|
27
|
+
wrap?: boolean;
|
|
23
28
|
}
|
|
24
29
|
export interface TableAction {
|
|
25
30
|
id: string;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as d } from "react";
|
|
3
|
-
import { AgGridReact as
|
|
3
|
+
import { AgGridReact as N } from "ag-grid-react";
|
|
4
4
|
import { formatValue as x } from "../../lib/formatters.js";
|
|
5
5
|
import { Button as R } from "../ui/Button.js";
|
|
6
|
-
import { Icon as
|
|
7
|
-
import { useIsMobile as
|
|
6
|
+
import { Icon as T } from "../ui/Icon.js";
|
|
7
|
+
import { useIsMobile as z } from "../../lib/hooks/useMediaQuery.js";
|
|
8
8
|
import { DataTableCards as k } from "./_DataTableCards.js";
|
|
9
9
|
const O = ({
|
|
10
|
-
height:
|
|
10
|
+
height: h = "500px",
|
|
11
11
|
defaultColDef: p,
|
|
12
12
|
schema: m,
|
|
13
13
|
actions: n,
|
|
14
|
-
columnDefs:
|
|
14
|
+
columnDefs: u,
|
|
15
15
|
emptyState: s,
|
|
16
16
|
rowData: i,
|
|
17
17
|
loading: o = !1,
|
|
18
|
-
mobileCards:
|
|
19
|
-
...
|
|
18
|
+
mobileCards: f = !0,
|
|
19
|
+
...r
|
|
20
20
|
}) => {
|
|
21
|
-
const b =
|
|
21
|
+
const b = z(), v = d(() => ({
|
|
22
22
|
flex: 1,
|
|
23
23
|
minWidth: 120,
|
|
24
24
|
resizable: !0,
|
|
@@ -27,22 +27,24 @@ const O = ({
|
|
|
27
27
|
menuTabs: ["filterMenuTab"],
|
|
28
28
|
...p
|
|
29
29
|
}), [p]), g = d(() => {
|
|
30
|
-
if (
|
|
30
|
+
if (u) return u;
|
|
31
31
|
if (!m) return [];
|
|
32
|
-
const
|
|
32
|
+
const l = m.map((e) => {
|
|
33
33
|
const a = e.type === "number" || e.type === "currency" || e.type === "percent" || e.type === "delta";
|
|
34
34
|
return {
|
|
35
35
|
field: e.key,
|
|
36
36
|
headerName: e.label,
|
|
37
37
|
hide: e.hide,
|
|
38
38
|
width: e.width,
|
|
39
|
+
wrapText: e.wrap,
|
|
40
|
+
autoHeight: e.wrap,
|
|
39
41
|
cellClass: a ? "text-right tabular-nums" : void 0,
|
|
40
42
|
headerClass: a ? "ag-right-aligned-header" : void 0,
|
|
41
|
-
cellRenderer: (
|
|
43
|
+
cellRenderer: (c) => x(c.value, e.type),
|
|
42
44
|
filter: e.type === "date" ? "agDateColumnFilter" : a ? "agNumberColumnFilter" : "agTextColumnFilter"
|
|
43
45
|
};
|
|
44
46
|
});
|
|
45
|
-
return n && n.length > 0 &&
|
|
47
|
+
return n && n.length > 0 && l.push({
|
|
46
48
|
headerName: "",
|
|
47
49
|
field: "actions",
|
|
48
50
|
pinned: "right",
|
|
@@ -50,36 +52,36 @@ const O = ({
|
|
|
50
52
|
sortable: !1,
|
|
51
53
|
filter: !1,
|
|
52
54
|
resizable: !1,
|
|
53
|
-
cellRenderer: (e) => /* @__PURE__ */
|
|
55
|
+
cellRenderer: (e) => /* @__PURE__ */ t("div", { className: "flex items-center justify-end gap-1 h-full", children: n.map((a) => /* @__PURE__ */ t(
|
|
54
56
|
R,
|
|
55
57
|
{
|
|
56
58
|
variant: a.variant || "ghost",
|
|
57
59
|
size: "icon",
|
|
58
60
|
className: "h-7 w-7",
|
|
59
61
|
title: a.label,
|
|
60
|
-
onClick: (
|
|
61
|
-
|
|
62
|
+
onClick: (c) => {
|
|
63
|
+
c.stopPropagation(), a.onClick(e.data);
|
|
62
64
|
},
|
|
63
|
-
children: /* @__PURE__ */
|
|
65
|
+
children: /* @__PURE__ */ t(T, { name: a.icon, className: "h-4 w-4" })
|
|
64
66
|
},
|
|
65
67
|
a.id
|
|
66
68
|
)) })
|
|
67
|
-
}),
|
|
68
|
-
}, [m,
|
|
69
|
+
}), l;
|
|
70
|
+
}, [m, u, n]), y = "ag-theme-quartz ag-theme-ramme", w = d(() => ({
|
|
69
71
|
overlayLoadingTemplate: '<span class="ag-overlay-loading-center">Loading data...</span>',
|
|
70
72
|
overlayNoRowsTemplate: '<span class="ag-overlay-no-rows-center">No data available</span>'
|
|
71
|
-
}), []),
|
|
72
|
-
return
|
|
73
|
+
}), []), C = (!i || i.length === 0) && !o;
|
|
74
|
+
return f && b ? /* @__PURE__ */ t("div", { className: "w-full", children: C && s ? /* @__PURE__ */ t("div", { className: "flex items-center justify-center py-fluid-lg", children: s }) : /* @__PURE__ */ t(
|
|
73
75
|
k,
|
|
74
76
|
{
|
|
75
77
|
rowData: i,
|
|
76
78
|
columnDefs: g,
|
|
77
79
|
loading: o,
|
|
78
|
-
pageSize:
|
|
79
|
-
onRowClick:
|
|
80
|
+
pageSize: r.pagination === !1 ? !1 : r.paginationPageSize ?? 20,
|
|
81
|
+
onRowClick: r.onRowClicked ? (l) => r.onRowClicked({ data: l }) : void 0
|
|
80
82
|
}
|
|
81
|
-
) }) : /* @__PURE__ */
|
|
82
|
-
|
|
83
|
+
) }) : /* @__PURE__ */ t("div", { className: `relative ${y}`, style: { height: h, width: "100%" }, children: (!i || i.length === 0) && s && !o ? /* @__PURE__ */ t("div", { className: "absolute inset-0 z-10 bg-background/50 flex items-center justify-center", children: s }) : /* @__PURE__ */ t(
|
|
84
|
+
N,
|
|
83
85
|
{
|
|
84
86
|
rowData: o ? [] : i,
|
|
85
87
|
columnDefs: g,
|
|
@@ -90,12 +92,12 @@ const O = ({
|
|
|
90
92
|
paginationPageSize: 20,
|
|
91
93
|
enableCellTextSelection: !0,
|
|
92
94
|
suppressCellFocus: !0,
|
|
93
|
-
gridOptions:
|
|
94
|
-
onGridReady: (
|
|
95
|
+
gridOptions: w,
|
|
96
|
+
onGridReady: (l) => {
|
|
95
97
|
var e;
|
|
96
|
-
o &&
|
|
98
|
+
o && l.api.showLoadingOverlay(), (e = r.onGridReady) == null || e.call(r, l);
|
|
97
99
|
},
|
|
98
|
-
...
|
|
100
|
+
...r
|
|
99
101
|
}
|
|
100
102
|
) });
|
|
101
103
|
};
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { jsx as o, jsxs as g } from "react/jsx-runtime";
|
|
2
2
|
import f from "react";
|
|
3
|
-
import { Card as N, CardHeader as
|
|
4
|
-
import { Pagination as
|
|
5
|
-
import { Skeleton as
|
|
6
|
-
function
|
|
3
|
+
import { Card as N, CardHeader as S, CardContent as E, CardFooter as F } from "../layout/Card.js";
|
|
4
|
+
import { Pagination as I } from "../navigation/Pagination.js";
|
|
5
|
+
import { Skeleton as v } from "../feedback/Skeleton.js";
|
|
6
|
+
function x(n, r) {
|
|
7
7
|
if (!(!n || !r))
|
|
8
8
|
return r.includes(".") ? r.split(".").reduce((t, e) => t == null ? t : t[e], n) : n[r];
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function M(n) {
|
|
11
11
|
return (n.colId ?? n.field ?? "").toLowerCase() === "actions";
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function P(n) {
|
|
14
14
|
const r = n.filter((e) => !e.hide), t = { heading: [], body: [], footer: [] };
|
|
15
15
|
for (const e of r)
|
|
16
|
-
e.pinned === "left" || e.pinned === !0 ? t.heading.push(e) : e.pinned === "right" ||
|
|
16
|
+
e.pinned === "left" || e.pinned === !0 ? t.heading.push(e) : e.pinned === "right" || M(e) ? t.footer.push(e) : t.body.push(e);
|
|
17
17
|
return t.heading.length === 0 && t.body.length > 0 && t.heading.push(t.body.shift()), t;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function j(n, r) {
|
|
20
20
|
const t = r.filter((s) => s.sort === "asc" || s.sort === "desc").sort((s, l) => (s.sortIndex ?? Number.MAX_SAFE_INTEGER) - (l.sortIndex ?? Number.MAX_SAFE_INTEGER));
|
|
21
21
|
if (t.length === 0) return n;
|
|
22
22
|
const e = [...n];
|
|
23
23
|
return e.sort((s, l) => {
|
|
24
24
|
for (const d of t) {
|
|
25
|
-
const c =
|
|
25
|
+
const c = x(s, d.field), u = x(l, d.field);
|
|
26
26
|
let i;
|
|
27
27
|
if (typeof d.comparator == "function")
|
|
28
28
|
i = d.comparator(c, u, null, null, !1) ?? 0;
|
|
@@ -38,7 +38,7 @@ function k(n, r) {
|
|
|
38
38
|
}), e;
|
|
39
39
|
}
|
|
40
40
|
function C(n, r) {
|
|
41
|
-
const t =
|
|
41
|
+
const t = x(r, n.field);
|
|
42
42
|
let e = null;
|
|
43
43
|
try {
|
|
44
44
|
e = n.valueFormatter ? n.valueFormatter({ value: t, data: r, colDef: n, node: null }) : null;
|
|
@@ -63,7 +63,7 @@ function b(n, r) {
|
|
|
63
63
|
}
|
|
64
64
|
return e;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function k(n, r) {
|
|
67
67
|
const t = n.cellClass;
|
|
68
68
|
let e;
|
|
69
69
|
if (typeof t == "function")
|
|
@@ -77,9 +77,9 @@ function _(n, r) {
|
|
|
77
77
|
const s = (Array.isArray(e) ? e : e ? [e] : []).flatMap((d) => String(d).split(/\s+/)), l = /* @__PURE__ */ new Set(["text-right", "ag-right-aligned-cell"]);
|
|
78
78
|
return s.filter((d) => d && !l.has(d)).join(" ");
|
|
79
79
|
}
|
|
80
|
-
const
|
|
81
|
-
/* @__PURE__ */ o(
|
|
82
|
-
/* @__PURE__ */ o("div", { className: "mt-3 grid grid-cols-2 gap-2", children: Array.from({ length: 4 }, (e, s) => /* @__PURE__ */ o(
|
|
80
|
+
const _ = ({ count: n }) => /* @__PURE__ */ o("div", { className: "flex flex-col gap-3", children: Array.from({ length: n }, (r, t) => /* @__PURE__ */ g(N, { className: "p-4", children: [
|
|
81
|
+
/* @__PURE__ */ o(v, { className: "h-4 w-24" }),
|
|
82
|
+
/* @__PURE__ */ o("div", { className: "mt-3 grid grid-cols-2 gap-2", children: Array.from({ length: 4 }, (e, s) => /* @__PURE__ */ o(v, { className: "h-3 w-full" }, s)) })
|
|
83
83
|
] }, t)) }), D = ({
|
|
84
84
|
rowData: n,
|
|
85
85
|
columnDefs: r,
|
|
@@ -87,39 +87,39 @@ const R = ({ count: n }) => /* @__PURE__ */ o("div", { className: "flex flex-col
|
|
|
87
87
|
pageSize: e = !1,
|
|
88
88
|
onRowClick: s
|
|
89
89
|
}) => {
|
|
90
|
-
const [l, d] = f.useState(1), c = f.useMemo(() =>
|
|
91
|
-
() =>
|
|
90
|
+
const [l, d] = f.useState(1), c = f.useMemo(() => P(r), [r]), u = f.useMemo(
|
|
91
|
+
() => j(n ?? [], r),
|
|
92
92
|
[n, r]
|
|
93
93
|
), i = typeof e == "number" && e > 0 ? e : 0, m = i ? Math.max(1, Math.ceil(u.length / i)) : 1;
|
|
94
94
|
f.useEffect(() => {
|
|
95
95
|
l > m && d(m);
|
|
96
96
|
}, [l, m]);
|
|
97
97
|
const A = i ? u.slice((l - 1) * i, l * i) : u;
|
|
98
|
-
return t ? /* @__PURE__ */ o(
|
|
99
|
-
A.map((p,
|
|
100
|
-
const
|
|
98
|
+
return t ? /* @__PURE__ */ o(_, { count: Math.min(i || 3, 5) }) : /* @__PURE__ */ g("div", { className: "flex flex-col gap-3", children: [
|
|
99
|
+
A.map((p, w) => {
|
|
100
|
+
const y = !!s;
|
|
101
101
|
return /* @__PURE__ */ g(
|
|
102
102
|
N,
|
|
103
103
|
{
|
|
104
104
|
className: [
|
|
105
105
|
"overflow-hidden",
|
|
106
|
-
|
|
106
|
+
y ? "cursor-pointer active:bg-surface-muted" : ""
|
|
107
107
|
].filter(Boolean).join(" "),
|
|
108
|
-
onClick:
|
|
108
|
+
onClick: y ? () => s(p) : void 0,
|
|
109
109
|
children: [
|
|
110
|
-
c.heading.length > 0 && /* @__PURE__ */ o(
|
|
111
|
-
c.body.length > 0 && /* @__PURE__ */ o(
|
|
110
|
+
c.heading.length > 0 && /* @__PURE__ */ o(S, { className: "flex-row items-center gap-3 p-4 pb-0", children: c.heading.map((a, h) => /* @__PURE__ */ o("div", { className: "min-w-0 flex-1 truncate", children: b(a, p) }, a.colId ?? a.field ?? h)) }),
|
|
111
|
+
c.body.length > 0 && /* @__PURE__ */ o(E, { className: "p-4 pt-3", children: /* @__PURE__ */ o("dl", { className: "grid grid-cols-2 gap-x-4 gap-y-2", children: c.body.map((a, h) => /* @__PURE__ */ g(
|
|
112
112
|
"div",
|
|
113
113
|
{
|
|
114
|
-
className: "flex min-w-0 items-baseline justify-between gap-2",
|
|
114
|
+
className: a.wrapText ? "col-span-2 flex min-w-0 flex-col gap-0.5" : "flex min-w-0 items-baseline justify-between gap-2",
|
|
115
115
|
children: [
|
|
116
116
|
/* @__PURE__ */ o("dt", { className: "shrink-0 text-xs uppercase tracking-wider text-muted-foreground", children: a.headerName ?? a.field }),
|
|
117
117
|
/* @__PURE__ */ o(
|
|
118
118
|
"dd",
|
|
119
119
|
{
|
|
120
120
|
className: [
|
|
121
|
-
"min-w-0 truncate text-sm tabular-nums",
|
|
122
|
-
|
|
121
|
+
a.wrapText ? "min-w-0 break-words text-sm" : "min-w-0 truncate text-sm tabular-nums",
|
|
122
|
+
k(a, p)
|
|
123
123
|
].filter(Boolean).join(" "),
|
|
124
124
|
children: b(a, p)
|
|
125
125
|
}
|
|
@@ -131,7 +131,7 @@ const R = ({ count: n }) => /* @__PURE__ */ o("div", { className: "flex flex-col
|
|
|
131
131
|
c.footer.length > 0 && // min-h-11 is the 44px AAA tap target from AGENTS.md: the footer
|
|
132
132
|
// is where the controls live and a phone is what taps them.
|
|
133
133
|
/* @__PURE__ */ o(
|
|
134
|
-
|
|
134
|
+
F,
|
|
135
135
|
{
|
|
136
136
|
className: "flex-row items-center justify-end gap-1 border-t border-border p-2 min-h-11",
|
|
137
137
|
onClick: (a) => a.stopPropagation(),
|
|
@@ -140,14 +140,14 @@ const R = ({ count: n }) => /* @__PURE__ */ o("div", { className: "flex flex-col
|
|
|
140
140
|
)
|
|
141
141
|
]
|
|
142
142
|
},
|
|
143
|
-
|
|
143
|
+
w
|
|
144
144
|
);
|
|
145
145
|
}),
|
|
146
|
-
m > 1 && /* @__PURE__ */ o(
|
|
146
|
+
m > 1 && /* @__PURE__ */ o(I, { currentPage: l, totalPages: m, onPageChange: d })
|
|
147
147
|
] });
|
|
148
148
|
};
|
|
149
149
|
export {
|
|
150
150
|
D as DataTableCards,
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
j as applyDeclaredSort,
|
|
152
|
+
P as splitColumns
|
|
153
153
|
};
|
|
@@ -1,25 +1,30 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { cn as
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { cn as d } from "../../utils/cn.js";
|
|
3
3
|
const m = ({
|
|
4
4
|
options: n,
|
|
5
5
|
value: o,
|
|
6
|
-
onChange:
|
|
6
|
+
onChange: i,
|
|
7
7
|
size: r = "md",
|
|
8
|
-
className:
|
|
9
|
-
}) => /* @__PURE__ */
|
|
8
|
+
className: l
|
|
9
|
+
}) => /* @__PURE__ */ t("div", { className: d(
|
|
10
10
|
// Container: Use 'muted' background for the track (works in all themes)
|
|
11
11
|
"inline-flex bg-muted border border-border",
|
|
12
12
|
r === "xs" ? "rounded-md p-0.5" : "rounded-lg p-1",
|
|
13
|
-
|
|
13
|
+
l
|
|
14
14
|
), children: n.map((e) => {
|
|
15
15
|
const s = e.value === o;
|
|
16
|
-
return /* @__PURE__ */
|
|
16
|
+
return /* @__PURE__ */ t(
|
|
17
17
|
"button",
|
|
18
18
|
{
|
|
19
|
-
onClick: () => !e.disabled &&
|
|
19
|
+
onClick: () => !e.disabled && i(e.value),
|
|
20
20
|
disabled: e.disabled,
|
|
21
|
-
className:
|
|
21
|
+
className: d(
|
|
22
22
|
"relative rounded-md font-medium transition-all duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-primary",
|
|
23
|
+
// A label never wraps. Squeezed onto a phone, a two-word label
|
|
24
|
+
// broke onto three lines and every sibling stretched to match,
|
|
25
|
+
// an 84px-tall row of tabs. A control wider than its space
|
|
26
|
+
// belongs in a scrolling container, which keeps it one line.
|
|
27
|
+
"whitespace-nowrap",
|
|
23
28
|
// Size Variants
|
|
24
29
|
//
|
|
25
30
|
// `xs` carries a stated 24px floor rather than a padding value
|
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import D, { useRef as
|
|
1
|
+
import { jsxs as h, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import D, { useRef as b, useEffect as R } from "react";
|
|
3
3
|
import { cn as x } from "../../utils/cn.js";
|
|
4
4
|
import { DetailDrawer as j } from "./DetailDrawer.js";
|
|
5
5
|
import { useIsMobile as A } from "../../lib/hooks/useMediaQuery.js";
|
|
6
6
|
const M = D.forwardRef(({
|
|
7
7
|
className: p,
|
|
8
|
-
layoutPreset:
|
|
9
|
-
sidebarSlot:
|
|
10
|
-
headerSlot:
|
|
11
|
-
toolbarSlot:
|
|
12
|
-
statusbarSlot:
|
|
13
|
-
inspectorSlot:
|
|
14
|
-
onLogoTrigger:
|
|
15
|
-
isInspectorOpen:
|
|
16
|
-
setInspectorOpen:
|
|
17
|
-
inspectorWidth:
|
|
8
|
+
layoutPreset: o = "dashboard",
|
|
9
|
+
sidebarSlot: d,
|
|
10
|
+
headerSlot: n,
|
|
11
|
+
toolbarSlot: s,
|
|
12
|
+
statusbarSlot: a,
|
|
13
|
+
inspectorSlot: v,
|
|
14
|
+
onLogoTrigger: t,
|
|
15
|
+
isInspectorOpen: w = !1,
|
|
16
|
+
setInspectorOpen: i,
|
|
17
|
+
inspectorWidth: k = 420,
|
|
18
18
|
setInspectorWidth: g,
|
|
19
19
|
children: N,
|
|
20
20
|
...z
|
|
21
21
|
}, C) => {
|
|
22
|
-
const r =
|
|
22
|
+
const r = b(0), c = b(0);
|
|
23
23
|
R(() => {
|
|
24
|
-
if (!
|
|
25
|
-
const
|
|
24
|
+
if (!t) return;
|
|
25
|
+
const u = (y) => {
|
|
26
26
|
if (y.target.closest('[data-ramme-logo="true"]')) {
|
|
27
|
-
const
|
|
28
|
-
|
|
27
|
+
const m = Date.now();
|
|
28
|
+
m - c.current > 1500 ? r.current = 1 : r.current += 1, c.current = m, r.current >= 5 && (r.current = 0, t());
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
return document.addEventListener("click",
|
|
32
|
-
}, [
|
|
33
|
-
const E =
|
|
34
|
-
return /* @__PURE__ */
|
|
31
|
+
return document.addEventListener("click", u, !0), () => document.removeEventListener("click", u, !0);
|
|
32
|
+
}, [t]);
|
|
33
|
+
const E = o === "explorer", l = o === "focus", f = A();
|
|
34
|
+
return /* @__PURE__ */ h(
|
|
35
35
|
"div",
|
|
36
36
|
{
|
|
37
37
|
ref: C,
|
|
38
38
|
className: x(
|
|
39
|
-
"flex h-dvh w-full overflow-hidden bg-background text-foreground text-sm font-sans transition-colors duration-300",
|
|
39
|
+
"flex h-dvh w-full overflow-hidden print:h-auto print:overflow-visible bg-background text-foreground text-sm font-sans transition-colors duration-300",
|
|
40
40
|
p
|
|
41
41
|
),
|
|
42
42
|
...z,
|
|
43
43
|
children: [
|
|
44
|
-
!l &&
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
!l &&
|
|
47
|
-
!l &&
|
|
44
|
+
!l && d && /* @__PURE__ */ e("aside", { className: "w-sidebar print:hidden flex-shrink-0 flex flex-col border-r border-border bg-card shadow-sm z-20", children: d }),
|
|
45
|
+
/* @__PURE__ */ h("div", { className: "flex flex-col flex-1 min-w-0 h-full print:h-auto relative z-10", children: [
|
|
46
|
+
!l && n && /* @__PURE__ */ e("header", { className: "h-header print:hidden flex-shrink-0 w-full border-b border-border bg-background/80 backdrop-blur-md sticky top-0 z-30 flex items-center px-4", children: n }),
|
|
47
|
+
!l && s && /* @__PURE__ */ e("div", { className: "h-toolbar print:hidden flex-shrink-0 w-full border-b border-border bg-muted/30 flex items-center px-4 shadow-sm z-20", children: s }),
|
|
48
48
|
/* @__PURE__ */ e("main", { className: x(
|
|
49
|
-
"flex-1 overflow-y-auto custom-scrollbar relative @container",
|
|
49
|
+
"flex-1 overflow-y-auto custom-scrollbar print:overflow-visible relative @container",
|
|
50
50
|
E ? "p-0" : "p-fluid-md @md:p-fluid-lg"
|
|
51
51
|
// Explorer goes edge-to-edge
|
|
52
52
|
), children: N }),
|
|
53
|
-
!l &&
|
|
53
|
+
!l && a && /* @__PURE__ */ e("footer", { className: "h-statusbar print:hidden flex-shrink-0 w-full border-t border-border bg-card flex items-center px-3 text-xs text-muted-foreground z-20", children: a })
|
|
54
54
|
] }),
|
|
55
55
|
/* @__PURE__ */ e(
|
|
56
56
|
j,
|
|
57
57
|
{
|
|
58
|
-
isOpen:
|
|
59
|
-
onClose: () =>
|
|
58
|
+
isOpen: w,
|
|
59
|
+
onClose: () => i == null ? void 0 : i(!1),
|
|
60
60
|
variant: f ? "overlay" : "push",
|
|
61
61
|
resizable: !f,
|
|
62
|
-
width:
|
|
62
|
+
width: k,
|
|
63
63
|
onWidthChange: g,
|
|
64
|
-
children:
|
|
64
|
+
children: v
|
|
65
65
|
}
|
|
66
66
|
)
|
|
67
67
|
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,27 +4,56 @@ interface AvatarProps {
|
|
|
4
4
|
src?: string;
|
|
5
5
|
/** The name of the user, used for generating initials as a fallback. */
|
|
6
6
|
name: string;
|
|
7
|
+
/** Letters to show instead of ones taken from `name`, such as a ticker. */
|
|
8
|
+
initials?: string;
|
|
7
9
|
/** The size of the avatar. */
|
|
8
|
-
size?: 'sm' | 'md' | 'lg';
|
|
10
|
+
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
11
|
+
/** A circle for a person; a square for a company or a product. */
|
|
12
|
+
shape?: 'circle' | 'square';
|
|
13
|
+
/** `cover` fills the tile (a photo); `contain` keeps the whole image (a logo). */
|
|
14
|
+
fit?: 'cover' | 'contain';
|
|
15
|
+
/** Draw a loaded image on the light `logo-plate`, for logos made for a white page. */
|
|
16
|
+
plate?: boolean;
|
|
17
|
+
/** Hide it from screen readers when the name is already written beside it. */
|
|
18
|
+
decorative?: boolean;
|
|
9
19
|
/** Optional additional CSS classes. */
|
|
10
20
|
className?: string;
|
|
11
21
|
}
|
|
12
22
|
/**
|
|
13
23
|
* @wizard
|
|
14
24
|
* @name Avatar
|
|
15
|
-
* @description Displays a
|
|
16
|
-
* @tags ui, profile, user
|
|
25
|
+
* @description Displays a person's picture or a company's logo, with letters as the fallback. The letters paint first and the image fades in over them once loaded, so a slow, missing or broken image never moves or empties the tile. Use shape="square" fit="contain" plate for a company logo.
|
|
26
|
+
* @tags ui, profile, user, logo, company, initials
|
|
17
27
|
* @props
|
|
18
28
|
* - name: name
|
|
19
29
|
* type: string
|
|
20
|
-
* description: The name
|
|
30
|
+
* description: The name, used for the image's alt text and for initials if none are given.
|
|
21
31
|
* - name: src
|
|
22
32
|
* type: string
|
|
23
|
-
* description: The
|
|
33
|
+
* description: The image to show. If absent or it fails to load, the letters stay.
|
|
34
|
+
* - name: initials
|
|
35
|
+
* type: string
|
|
36
|
+
* description: Letters to show instead of ones taken from the name, such as a ticker.
|
|
24
37
|
* - name: size
|
|
25
|
-
* type: 'sm' | 'md' | 'lg'
|
|
38
|
+
* type: 'xs' | 'sm' | 'md' | 'lg'
|
|
26
39
|
* description: Controls the dimensions and font size of the avatar.
|
|
27
40
|
* default: 'md'
|
|
41
|
+
* - name: shape
|
|
42
|
+
* type: 'circle' | 'square'
|
|
43
|
+
* description: A circle for a person, a square for a company or a product.
|
|
44
|
+
* default: 'circle'
|
|
45
|
+
* - name: fit
|
|
46
|
+
* type: 'cover' | 'contain'
|
|
47
|
+
* description: cover fills the tile (a photo); contain keeps the whole image (a logo).
|
|
48
|
+
* default: 'cover'
|
|
49
|
+
* - name: plate
|
|
50
|
+
* type: boolean
|
|
51
|
+
* description: Draws a loaded image on the light logo-plate token, so logos made for a white page stay legible on dark themes.
|
|
52
|
+
* default: false
|
|
53
|
+
* - name: decorative
|
|
54
|
+
* type: boolean
|
|
55
|
+
* description: Hides the avatar from screen readers when the name is already written beside it.
|
|
56
|
+
* default: false
|
|
28
57
|
* - name: className
|
|
29
58
|
* type: string
|
|
30
59
|
* description: Optional additional CSS classes for custom styling.
|
|
@@ -1,38 +1,72 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { jsxs as S, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import s from "react";
|
|
3
|
+
import { cn as d } from "../../utils/cn.js";
|
|
4
|
+
const N = ({
|
|
5
|
+
src: t,
|
|
6
|
+
name: a,
|
|
7
|
+
initials: u,
|
|
8
|
+
size: f = "md",
|
|
9
|
+
shape: m = "circle",
|
|
10
|
+
fit: g = "cover",
|
|
11
|
+
plate: p = !1,
|
|
12
|
+
decorative: r = !1,
|
|
13
|
+
className: h
|
|
14
|
+
}) => {
|
|
15
|
+
const [x, o] = s.useState(!1), [y, i] = s.useState(!1), [b, w] = s.useState(t);
|
|
16
|
+
t !== b && (w(t), o(!1), i(!1));
|
|
17
|
+
const l = s.useRef(null);
|
|
18
|
+
s.useLayoutEffect(() => {
|
|
19
|
+
const e = l.current;
|
|
20
|
+
e != null && e.complete && e.naturalWidth > 0 && o(!0);
|
|
21
|
+
}, [t]);
|
|
22
|
+
const v = (e) => {
|
|
23
|
+
const n = e.trim().split(/\s+/);
|
|
24
|
+
return n.length > 1 ? `${n[0][0]}${n[n.length - 1][0]}`.toUpperCase() : e.substring(0, 2).toUpperCase();
|
|
7
25
|
};
|
|
8
|
-
return /* @__PURE__ */
|
|
26
|
+
return /* @__PURE__ */ S(
|
|
9
27
|
"div",
|
|
10
28
|
{
|
|
11
|
-
|
|
29
|
+
"aria-hidden": r ? "true" : void 0,
|
|
30
|
+
className: d(
|
|
12
31
|
// Base styles: Flex centering, shape, and "Zero Jank" protection (shrink-0)
|
|
13
|
-
"relative inline-flex shrink-0 items-center justify-center
|
|
32
|
+
"relative inline-flex shrink-0 items-center justify-center overflow-hidden",
|
|
33
|
+
m === "square" ? "rounded-md" : "rounded-full",
|
|
14
34
|
// Theme styles: Use semantic tokens, not hardcoded colors
|
|
15
35
|
"bg-secondary text-secondary-foreground",
|
|
16
36
|
// Size and custom overrides
|
|
17
37
|
{
|
|
38
|
+
xs: "h-6 w-6 text-2xs",
|
|
18
39
|
sm: "h-8 w-8 text-xs",
|
|
19
40
|
md: "h-12 w-12 text-sm",
|
|
20
41
|
// Adjusted font size for better balance
|
|
21
42
|
lg: "h-16 w-16 text-xl"
|
|
22
|
-
}[
|
|
23
|
-
|
|
43
|
+
}[f],
|
|
44
|
+
h
|
|
24
45
|
),
|
|
25
|
-
children:
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ c("span", { className: "font-semibold leading-none", children: u ?? v(a) }),
|
|
48
|
+
t && !y && /* @__PURE__ */ c(
|
|
49
|
+
"img",
|
|
50
|
+
{
|
|
51
|
+
ref: l,
|
|
52
|
+
src: t,
|
|
53
|
+
alt: r ? "" : a,
|
|
54
|
+
loading: "lazy",
|
|
55
|
+
decoding: "async",
|
|
56
|
+
onLoad: () => o(!0),
|
|
57
|
+
onError: () => i(!0),
|
|
58
|
+
className: d(
|
|
59
|
+
"absolute inset-0 h-full w-full transition-opacity duration-200",
|
|
60
|
+
g === "contain" ? "object-contain" : "object-cover",
|
|
61
|
+
p && "bg-logo-plate p-1 ring-1 ring-inset ring-border/60",
|
|
62
|
+
x ? "opacity-100" : "opacity-0"
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
]
|
|
33
67
|
}
|
|
34
68
|
);
|
|
35
69
|
};
|
|
36
70
|
export {
|
|
37
|
-
|
|
71
|
+
N as Avatar
|
|
38
72
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type VariantProps } from 'class-variance-authority';
|
|
3
3
|
declare const badgeVariants: (props?: ({
|
|
4
|
-
variant?: "
|
|
4
|
+
variant?: "warning" | "success" | "primary" | "secondary" | "danger" | "outline" | "gain" | "loss" | null | undefined;
|
|
5
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
6
|
export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
7
7
|
}
|