@stackone/malachite 2.85.0 → 2.87.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/COMPONENTS.md +6 -5
- package/dist/components/Accordion.js +130 -103
- package/dist/components/Accordion.js.map +1 -1
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Card.js +128 -75
- package/dist/components/Card.js.map +1 -1
- package/dist/components/FilterSearch.js +228 -224
- package/dist/components/FilterSearch.js.map +1 -1
- package/dist/components/FrameHeader.js +36 -0
- package/dist/components/FrameHeader.js.map +1 -0
- package/dist/components/LoadingBar.js +5 -5
- package/dist/components/LoadingBar.js.map +1 -1
- package/dist/components/MultiSelect.js +431 -382
- package/dist/components/MultiSelect.js.map +1 -1
- package/dist/components/SplitButton.js.map +1 -1
- package/dist/components/Surface.js +211 -159
- package/dist/components/Surface.js.map +1 -1
- package/dist/components/Table/Table.js +630 -606
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/TimeBarChart/TimeBarChart.js +241 -0
- package/dist/components/TimeBarChart/TimeBarChart.js.map +1 -0
- package/dist/components/TimeBarChart/TimeBarChartAxes.js +49 -0
- package/dist/components/TimeBarChart/TimeBarChartAxes.js.map +1 -0
- package/dist/components/TimeBarChart/TimeBarChartBars.js +58 -0
- package/dist/components/TimeBarChart/TimeBarChartBars.js.map +1 -0
- package/dist/components/TimeBarChart/TimeBarChartLegend.js +29 -0
- package/dist/components/TimeBarChart/TimeBarChartLegend.js.map +1 -0
- package/dist/components/TimeBarChart/TimeBarChartTable.js +33 -0
- package/dist/components/TimeBarChart/TimeBarChartTable.js.map +1 -0
- package/dist/components/TimeBarChart/TimeBarChartTooltip.js +77 -0
- package/dist/components/TimeBarChart/TimeBarChartTooltip.js.map +1 -0
- package/dist/components/TimeBarChart/stackLayout.js +25 -0
- package/dist/components/TimeBarChart/stackLayout.js.map +1 -0
- package/dist/components/TimeBarChart/timeBuckets.js +133 -0
- package/dist/components/TimeBarChart/timeBuckets.js.map +1 -0
- package/dist/components/TimeBarChart/tones.js +10 -0
- package/dist/components/TimeBarChart/tones.js.map +1 -0
- package/dist/components/buttonStyles.js +2 -0
- package/dist/components/buttonStyles.js.map +1 -1
- package/dist/components/dateMath.js +1 -0
- package/dist/components/dateMath.js.map +1 -1
- package/dist/components/filterSearchModel.js +53 -45
- package/dist/components/filterSearchModel.js.map +1 -1
- package/dist/components/focusRing.js +8 -7
- package/dist/components/focusRing.js.map +1 -1
- package/dist/components/frameStyles.js +14 -0
- package/dist/components/frameStyles.js.map +1 -0
- package/dist/components/headerContent.js +10 -0
- package/dist/components/headerContent.js.map +1 -0
- package/dist/index.d.ts +149 -18
- package/dist/index.js +24 -22
- package/dist/index.js.map +1 -1
- package/dist/tailwind.css.js +1 -1
- package/dist/theme.js +340 -340
- package/dist/theme.js.map +1 -1
- package/package.json +1 -1
package/dist/components/Card.js
CHANGED
|
@@ -1,118 +1,171 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { jsxs as _, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as h, useState as j, useEffect as G } from "react";
|
|
3
|
+
import P, { HeaderRow as k } from "./FrameHeader.js";
|
|
4
|
+
import { FRAME_CLASS as F, FRAME_SECTION_STYLE as M } from "./frameStyles.js";
|
|
5
|
+
import { GLASS_SURFACE_STYLE as U } from "./glassSurface.js";
|
|
6
|
+
import { hasHeaderContent as A } from "./headerContent.js";
|
|
7
|
+
import { FOREGROUND_RESET as W } from "./selectedRow.js";
|
|
8
|
+
const Y = /^\d*\.?\d+(px|rem|em)$/, V = (m) => {
|
|
9
|
+
const t = m.trim().split(/\s+/);
|
|
10
|
+
if (t.length > 4 || !t.every((d) => Y.test(d)))
|
|
7
11
|
return;
|
|
8
|
-
const [
|
|
9
|
-
return parseFloat(
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
const [l, s = l, , i = s] = t;
|
|
13
|
+
return parseFloat(i) > 0 && parseFloat(s) > 0 ? { paddingLeft: i, paddingRight: s } : void 0;
|
|
14
|
+
}, te = ({
|
|
15
|
+
variant: m = "default",
|
|
16
|
+
title: t,
|
|
17
|
+
subtitle: l,
|
|
18
|
+
extra: s,
|
|
19
|
+
children: i,
|
|
20
|
+
padding: d = "20px",
|
|
21
|
+
size: v = "default",
|
|
22
|
+
width: u,
|
|
23
|
+
minWidth: y,
|
|
24
|
+
dimmed: B = !1,
|
|
25
|
+
direction: c,
|
|
26
|
+
align: R,
|
|
27
|
+
fullHeight: f = !1,
|
|
28
|
+
border: x = "base",
|
|
22
29
|
alignSelf: S,
|
|
23
|
-
height:
|
|
24
|
-
footer:
|
|
25
|
-
glassFooter:
|
|
26
|
-
className:
|
|
27
|
-
style:
|
|
28
|
-
headerConfig:
|
|
30
|
+
height: o,
|
|
31
|
+
footer: e,
|
|
32
|
+
glassFooter: r = !1,
|
|
33
|
+
className: E = "",
|
|
34
|
+
style: N = {},
|
|
35
|
+
headerConfig: a = {}
|
|
29
36
|
}) => {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
if (
|
|
33
|
-
const
|
|
34
|
-
for (const
|
|
35
|
-
|
|
37
|
+
const p = h(null), [w, L] = j(0);
|
|
38
|
+
G(() => {
|
|
39
|
+
if (r && e && p.current) {
|
|
40
|
+
const I = new ResizeObserver((O) => {
|
|
41
|
+
for (const $ of O)
|
|
42
|
+
L($.contentRect.height);
|
|
36
43
|
});
|
|
37
|
-
return
|
|
44
|
+
return I.observe(p.current), L(p.current.offsetHeight), () => I.disconnect();
|
|
38
45
|
}
|
|
39
|
-
}, [
|
|
40
|
-
const
|
|
46
|
+
}, [r, e]);
|
|
47
|
+
const H = [
|
|
41
48
|
"card-base",
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
].filter(Boolean).join(" "),
|
|
49
|
-
padding:
|
|
49
|
+
B ? "card-dimmed" : "",
|
|
50
|
+
x === "rounded" ? "card-rounded" : "",
|
|
51
|
+
f ? "h-full" : "",
|
|
52
|
+
o ? "flex flex-col" : "",
|
|
53
|
+
v === "small" ? "text-sm" : "",
|
|
54
|
+
E
|
|
55
|
+
].filter(Boolean).join(" "), b = a != null && a.padding ? void 0 : V(d), T = parseInt(d) || 20, z = {
|
|
56
|
+
padding: d,
|
|
50
57
|
// The card clips overflow, so a long token in flowing text breaks rather than vanishing.
|
|
51
58
|
// Flex and grid items keep their min-content width; those need their own wrapping.
|
|
52
59
|
overflowWrap: "break-word",
|
|
53
|
-
display:
|
|
54
|
-
flexDirection:
|
|
55
|
-
alignItems:
|
|
56
|
-
...
|
|
57
|
-
...
|
|
58
|
-
paddingBottom: `${
|
|
60
|
+
display: c ? "flex" : void 0,
|
|
61
|
+
flexDirection: c,
|
|
62
|
+
alignItems: R,
|
|
63
|
+
...o && { overflow: "auto", height: "100%" },
|
|
64
|
+
...r && e && w > 0 && {
|
|
65
|
+
paddingBottom: `${T + w + 10}px`
|
|
59
66
|
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
67
|
+
};
|
|
68
|
+
if (m === "framed")
|
|
69
|
+
return /* @__PURE__ */ _(
|
|
70
|
+
"div",
|
|
71
|
+
{
|
|
72
|
+
className: `${F} flex flex-col ${E}`,
|
|
73
|
+
style: {
|
|
74
|
+
// The frame drops `card-base`, which carried the text colour.
|
|
75
|
+
...W,
|
|
76
|
+
width: u,
|
|
77
|
+
minWidth: y,
|
|
78
|
+
alignSelf: S,
|
|
79
|
+
...f && { height: "100%" },
|
|
80
|
+
...o && { height: o },
|
|
81
|
+
...N
|
|
82
|
+
},
|
|
83
|
+
children: [
|
|
84
|
+
A({ title: t, subtitle: l, extra: s }) && /* @__PURE__ */ n(P, { title: t, subtitle: l, extra: s }),
|
|
85
|
+
/* @__PURE__ */ n(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
className: "min-h-0 flex-1",
|
|
89
|
+
style: {
|
|
90
|
+
...M,
|
|
91
|
+
padding: d,
|
|
92
|
+
overflowWrap: "break-word",
|
|
93
|
+
display: c ? "flex" : void 0,
|
|
94
|
+
flexDirection: c,
|
|
95
|
+
alignItems: R,
|
|
96
|
+
...o && { overflow: "auto" }
|
|
97
|
+
},
|
|
98
|
+
children: i
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
e && /* @__PURE__ */ n("div", { className: "px-4 py-3", children: e })
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
const D = {
|
|
106
|
+
width: u,
|
|
107
|
+
minWidth: y,
|
|
63
108
|
alignSelf: S,
|
|
64
|
-
...
|
|
65
|
-
...
|
|
66
|
-
...
|
|
109
|
+
...f && { height: "100%" },
|
|
110
|
+
...o && { height: o, display: "flex", flexDirection: "column" },
|
|
111
|
+
...r && e && { position: "relative" },
|
|
67
112
|
overflow: "hidden",
|
|
68
|
-
...
|
|
113
|
+
...N
|
|
69
114
|
};
|
|
70
|
-
return /* @__PURE__ */
|
|
71
|
-
|
|
115
|
+
return /* @__PURE__ */ _("div", { className: H, style: D, children: [
|
|
116
|
+
A({ title: t, subtitle: l, extra: s }) && /* @__PURE__ */ n(
|
|
72
117
|
"div",
|
|
73
118
|
{
|
|
74
|
-
className:
|
|
119
|
+
className: b ? "card-header py-2" : "card-header px-3 py-2",
|
|
75
120
|
style: {
|
|
76
121
|
marginBottom: "1px",
|
|
77
|
-
fontSize:
|
|
122
|
+
fontSize: v === "small" ? "12px" : "13px",
|
|
78
123
|
fontWeight: "normal",
|
|
79
|
-
...
|
|
124
|
+
...a != null && a.padding ? { padding: a.padding } : b
|
|
80
125
|
},
|
|
81
|
-
children: /* @__PURE__ */
|
|
126
|
+
children: /* @__PURE__ */ n(
|
|
127
|
+
k,
|
|
128
|
+
{
|
|
129
|
+
title: t,
|
|
130
|
+
subtitle: l,
|
|
131
|
+
extra: s,
|
|
132
|
+
titleClassName: "font-normal overflow-visible"
|
|
133
|
+
}
|
|
134
|
+
)
|
|
82
135
|
}
|
|
83
136
|
),
|
|
84
|
-
/* @__PURE__ */
|
|
137
|
+
/* @__PURE__ */ n(
|
|
85
138
|
"div",
|
|
86
139
|
{
|
|
87
140
|
className: "flex-1",
|
|
88
141
|
style: {
|
|
89
|
-
...
|
|
90
|
-
...
|
|
142
|
+
...z,
|
|
143
|
+
...r && e && { position: "relative" }
|
|
91
144
|
},
|
|
92
|
-
children:
|
|
145
|
+
children: i
|
|
93
146
|
}
|
|
94
147
|
),
|
|
95
|
-
|
|
148
|
+
e && /* @__PURE__ */ n(
|
|
96
149
|
"div",
|
|
97
150
|
{
|
|
98
|
-
ref:
|
|
151
|
+
ref: r ? p : void 0,
|
|
99
152
|
className: "card-footer px-4 py-3",
|
|
100
|
-
style:
|
|
101
|
-
...
|
|
153
|
+
style: r ? {
|
|
154
|
+
...U,
|
|
102
155
|
position: "absolute",
|
|
103
156
|
bottom: 0,
|
|
104
157
|
left: 0,
|
|
105
158
|
right: 0,
|
|
106
|
-
borderBottomLeftRadius:
|
|
107
|
-
borderBottomRightRadius:
|
|
159
|
+
borderBottomLeftRadius: x === "rounded" ? "20px" : "12px",
|
|
160
|
+
borderBottomRightRadius: x === "rounded" ? "20px" : "12px"
|
|
108
161
|
} : void 0,
|
|
109
|
-
children:
|
|
162
|
+
children: e
|
|
110
163
|
}
|
|
111
164
|
)
|
|
112
165
|
] });
|
|
113
166
|
};
|
|
114
167
|
export {
|
|
115
|
-
|
|
116
|
-
|
|
168
|
+
te as Card,
|
|
169
|
+
te as default
|
|
117
170
|
};
|
|
118
171
|
//# sourceMappingURL=Card.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","sources":["../../src/components/Card.tsx"],"sourcesContent":["import React, { useRef, useEffect, useState } from 'react';\nimport { GLASS_SURFACE_STYLE } from './glassSurface';\n\ninterface CardProps {\n title?: string | React.ReactNode;\n padding?: string;\n children?: React.ReactNode;\n size?: 'default' | 'small';\n width?: string;\n minWidth?: string;\n direction?: 'row' | 'column';\n align?: 'center';\n dimmed?: boolean;\n fullHeight?: boolean;\n border?: 'base' | 'rounded';\n alignSelf?: 'center';\n height?: string;\n footer?: React.ReactNode;\n glassFooter?: boolean;\n className?: string;\n style?: React.CSSProperties;\n headerConfig?: {\n padding?: string;\n };\n}\n\nconst PLAIN_LENGTH = /^\\d*\\.?\\d+(px|rem|em)$/;\n\n// Only plain positive lengths are copied: calc() and var() can't be split from a shorthand, and a\n// zero inset would put the title against the border, so those keep the header's own 12px.\nconst horizontalInset = (padding: string): React.CSSProperties | undefined => {\n const parts = padding.trim().split(/\\s+/);\n if (parts.length > 4 || !parts.every((part) => PLAIN_LENGTH.test(part))) {\n return undefined;\n }\n const [top, right = top, , left = right] = parts;\n return parseFloat(left) > 0 && parseFloat(right) > 0\n ? { paddingLeft: left, paddingRight: right }\n : undefined;\n};\n\nconst Card: React.FC<CardProps> = ({\n title,\n children,\n padding = '20px',\n size = 'default',\n width,\n minWidth,\n dimmed = false,\n direction,\n align,\n fullHeight = false,\n border = 'base',\n alignSelf,\n height,\n footer,\n glassFooter = false,\n className = '',\n style = {},\n headerConfig = {},\n}) => {\n const footerRef = useRef<HTMLDivElement>(null);\n const [footerHeight, setFooterHeight] = useState(0);\n\n useEffect(() => {\n if (glassFooter && footer && footerRef.current) {\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries) {\n setFooterHeight(entry.contentRect.height);\n }\n });\n\n observer.observe(footerRef.current);\n setFooterHeight(footerRef.current.offsetHeight);\n\n return () => observer.disconnect();\n }\n }, [glassFooter, footer]);\n\n // Size-specific padding\n const sizeClasses = size === 'small' ? 'text-sm' : '';\n\n // Dynamic classes based on props\n const cardClasses = [\n 'card-base',\n dimmed ? 'card-dimmed' : '',\n border === 'rounded' ? 'card-rounded' : '',\n fullHeight ? 'h-full' : '',\n height ? 'flex flex-col' : '',\n sizeClasses,\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n const headerInset = headerConfig?.padding ? undefined : horizontalInset(padding);\n\n // Content styles\n const paddingValue = parseInt(padding) || 20;\n const extraPadding = 10;\n const contentStyles: React.CSSProperties = {\n padding,\n // The card clips overflow, so a long token in flowing text breaks rather than vanishing.\n // Flex and grid items keep their min-content width; those need their own wrapping.\n overflowWrap: 'break-word',\n display: direction ? 'flex' : undefined,\n flexDirection: direction,\n alignItems: align,\n ...(height && { overflow: 'auto', height: '100%' }),\n ...(glassFooter &&\n footer &&\n footerHeight > 0 && {\n paddingBottom: `${paddingValue + footerHeight + extraPadding}px`,\n }),\n };\n\n // Card container styles\n const cardContainerStyles: React.CSSProperties = {\n width,\n minWidth,\n alignSelf,\n ...(fullHeight && { height: '100%' }),\n ...(height && { height, display: 'flex', flexDirection: 'column' }),\n ...(glassFooter && footer && { position: 'relative' }),\n overflow: 'hidden',\n ...style,\n };\n\n return (\n <div className={cardClasses} style={cardContainerStyles}>\n {/* Header */}\n {title && (\n <div\n className={headerInset ? 'card-header py-2' : 'card-header px-3 py-2'}\n style={{\n marginBottom: '1px',\n fontSize: size === 'small' ? '12px' : '13px',\n fontWeight: 'normal',\n ...(headerConfig?.padding\n ? { padding: headerConfig.padding }\n : headerInset),\n }}\n >\n <div className=\"font-normal overflow-visible\">{title}</div>\n </div>\n )}\n\n {/* Body */}\n <div\n className=\"flex-1\"\n style={{\n ...contentStyles,\n ...(glassFooter && footer && { position: 'relative' }),\n }}\n >\n {children}\n </div>\n\n {/* Footer */}\n {footer && (\n <div\n ref={glassFooter ? footerRef : undefined}\n className=\"card-footer px-4 py-3\"\n style={\n glassFooter\n ? {\n ...GLASS_SURFACE_STYLE,\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n borderBottomLeftRadius: border === 'rounded' ? '20px' : '12px',\n borderBottomRightRadius: border === 'rounded' ? '20px' : '12px',\n }\n : undefined\n }\n >\n {footer}\n </div>\n )}\n </div>\n );\n};\n\nexport default Card;\nexport { Card };\n"],"names":["PLAIN_LENGTH","horizontalInset","padding","parts","part","top","right","left","Card","title","children","size","width","minWidth","dimmed","direction","align","fullHeight","border","alignSelf","height","footer","glassFooter","className","style","headerConfig","footerRef","useRef","footerHeight","setFooterHeight","useState","useEffect","observer","entries","entry","cardClasses","headerInset","paddingValue","contentStyles","cardContainerStyles","jsxs","jsx","GLASS_SURFACE_STYLE"],"mappings":";;;AA0BA,MAAMA,IAAe,0BAIfC,IAAkB,CAACC,MAAqD;AAC1E,QAAMC,IAAQD,EAAQ,KAAA,EAAO,MAAM,KAAK;AACxC,MAAIC,EAAM,SAAS,KAAK,CAACA,EAAM,MAAM,CAACC,MAASJ,EAAa,KAAKI,CAAI,CAAC;AAClE;AAEJ,QAAM,CAACC,GAAKC,IAAQD,KAAOE,IAAOD,CAAK,IAAIH;AAC3C,SAAO,WAAWI,CAAI,IAAI,KAAK,WAAWD,CAAK,IAAI,IAC7C,EAAE,aAAaC,GAAM,cAAcD,MACnC;AACV,GAEME,IAA4B,CAAC;AAAA,EAC/B,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAR,IAAU;AAAA,EACV,MAAAS,IAAO;AAAA,EACP,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,QAAAC,IAAS;AAAA,EACT,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,WAAAC,IAAY;AAAA,EACZ,OAAAC,IAAQ,CAAA;AAAA,EACR,cAAAC,IAAe,CAAA;AACnB,MAAM;AACF,QAAMC,IAAYC,EAAuB,IAAI,GACvC,CAACC,GAAcC,CAAe,IAAIC,EAAS,CAAC;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zC,UAAU;AAAA,IACV,GAAGG;AAAA,EAAA;AAGP,SACI,gBAAAgB,EAAC,OAAA,EAAI,WAAWL,GAAa,OAAOI,GAE/B,UAAA;AAAA,IAAA9B,KACG,gBAAAgC;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,WAAWL,IAAc,qBAAqB;AAAA,QAC9C,OAAO;AAAA,UACH,cAAc;AAAA,UACd,UAAUzB,MAAS,UAAU,SAAS;AAAA,UACtC,YAAY;AAAA,UACZ,GAAIc,KAAA,QAAAA,EAAc,UACZ,EAAE,SAASA,EAAa,YACxBW;AAAA,QAAA;AAAA,QAGV,UAAA,gBAAAK,EAAC,OAAA,EAAI,WAAU,gCAAgC,UAAAhC,EAAA,CAAM;AAAA,MAAA;AAAA,IAAA;AAAA,IAK7D,gBAAAgC;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,WAAU;AAAA,QACV,OAAO;AAAA,UACH,GAAGH;AAAA,UACH,GAAIhB,KAAeD,KAAU,EAAE,UAAU,WAAA;AAAA,QAAW;AAAA,QAGvD,UAAAX;AAAA,MAAA;AAAA,IAAA;AAAA,IAIJW,KACG,gBAAAoB;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,KAAKnB,IAAcI,IAAY;AAAA,QAC/B,WAAU;AAAA,QACV,OACIJ,IACM;AAAA,UACI,GAAGoB;AAAA,UACH,UAAU;AAAA,UACV,QAAQ;AAAA,UACR,MAAM;AAAA,UACN,OAAO;AAAA,UACP,wBAAwBxB,MAAW,YAAY,SAAS;AAAA,UACxD,yBAAyBA,MAAW,YAAY,SAAS;AAAA,QAAA,IAE7D;AAAA,QAGT,UAAAG;AAAA,MAAA;AAAA,IAAA;AAAA,EACL,GAER;AAER;"}
|
|
1
|
+
{"version":3,"file":"Card.js","sources":["../../src/components/Card.tsx"],"sourcesContent":["import React, { useRef, useEffect, useState } from 'react';\nimport FrameHeader, { HeaderRow } from './FrameHeader';\nimport { FRAME_CLASS, FRAME_SECTION_STYLE } from './frameStyles';\nimport { GLASS_SURFACE_STYLE } from './glassSurface';\nimport { hasHeaderContent } from './headerContent';\nimport { FOREGROUND_RESET } from './selectedRow';\n\nexport type CardVariant = 'default' | 'framed';\n\ninterface CardProps {\n /**\n * `framed` draws the detached Table's frame: the title row sits on a grey frame and the\n * children in a bordered section inside it, so a card above a table reads as part of the\n * same set. `dimmed`, `border`, `size`, `glassFooter` and `headerConfig` do not apply to it.\n */\n variant?: CardVariant;\n title?: string | React.ReactNode;\n /** Dimmed text beside the title, such as a count or a unit. */\n subtitle?: React.ReactNode;\n /** Actions at the right of the title row. */\n extra?: React.ReactNode;\n padding?: string;\n children?: React.ReactNode;\n size?: 'default' | 'small';\n width?: string;\n minWidth?: string;\n direction?: 'row' | 'column';\n align?: 'center';\n dimmed?: boolean;\n fullHeight?: boolean;\n border?: 'base' | 'rounded';\n alignSelf?: 'center';\n height?: string;\n footer?: React.ReactNode;\n glassFooter?: boolean;\n className?: string;\n style?: React.CSSProperties;\n headerConfig?: {\n padding?: string;\n };\n}\n\nconst PLAIN_LENGTH = /^\\d*\\.?\\d+(px|rem|em)$/;\n\n// Only plain positive lengths are copied: calc() and var() can't be split from a shorthand, and a\n// zero inset would put the title against the border, so those keep the header's own 12px.\nconst horizontalInset = (padding: string): React.CSSProperties | undefined => {\n const parts = padding.trim().split(/\\s+/);\n if (parts.length > 4 || !parts.every((part) => PLAIN_LENGTH.test(part))) {\n return undefined;\n }\n const [top, right = top, , left = right] = parts;\n return parseFloat(left) > 0 && parseFloat(right) > 0\n ? { paddingLeft: left, paddingRight: right }\n : undefined;\n};\n\nconst Card: React.FC<CardProps> = ({\n variant = 'default',\n title,\n subtitle,\n extra,\n children,\n padding = '20px',\n size = 'default',\n width,\n minWidth,\n dimmed = false,\n direction,\n align,\n fullHeight = false,\n border = 'base',\n alignSelf,\n height,\n footer,\n glassFooter = false,\n className = '',\n style = {},\n headerConfig = {},\n}) => {\n const footerRef = useRef<HTMLDivElement>(null);\n const [footerHeight, setFooterHeight] = useState(0);\n\n useEffect(() => {\n if (glassFooter && footer && footerRef.current) {\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries) {\n setFooterHeight(entry.contentRect.height);\n }\n });\n\n observer.observe(footerRef.current);\n setFooterHeight(footerRef.current.offsetHeight);\n\n return () => observer.disconnect();\n }\n }, [glassFooter, footer]);\n\n // Size-specific padding\n const sizeClasses = size === 'small' ? 'text-sm' : '';\n\n // Dynamic classes based on props\n const cardClasses = [\n 'card-base',\n dimmed ? 'card-dimmed' : '',\n border === 'rounded' ? 'card-rounded' : '',\n fullHeight ? 'h-full' : '',\n height ? 'flex flex-col' : '',\n sizeClasses,\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n const headerInset = headerConfig?.padding ? undefined : horizontalInset(padding);\n\n // Content styles\n const paddingValue = parseInt(padding) || 20;\n const extraPadding = 10;\n const contentStyles: React.CSSProperties = {\n padding,\n // The card clips overflow, so a long token in flowing text breaks rather than vanishing.\n // Flex and grid items keep their min-content width; those need their own wrapping.\n overflowWrap: 'break-word',\n display: direction ? 'flex' : undefined,\n flexDirection: direction,\n alignItems: align,\n ...(height && { overflow: 'auto', height: '100%' }),\n ...(glassFooter &&\n footer &&\n footerHeight > 0 && {\n paddingBottom: `${paddingValue + footerHeight + extraPadding}px`,\n }),\n };\n\n if (variant === 'framed') {\n return (\n <div\n className={`${FRAME_CLASS} flex flex-col ${className}`}\n style={{\n // The frame drops `card-base`, which carried the text colour.\n ...FOREGROUND_RESET,\n width,\n minWidth,\n alignSelf,\n ...(fullHeight && { height: '100%' }),\n ...(height && { height }),\n ...style,\n }}\n >\n {hasHeaderContent({ title, subtitle, extra }) && (\n <FrameHeader title={title} subtitle={subtitle} extra={extra} />\n )}\n <div\n className=\"min-h-0 flex-1\"\n style={{\n ...FRAME_SECTION_STYLE,\n padding,\n overflowWrap: 'break-word',\n display: direction ? 'flex' : undefined,\n flexDirection: direction,\n alignItems: align,\n ...(height && { overflow: 'auto' }),\n }}\n >\n {children}\n </div>\n {footer && <div className=\"px-4 py-3\">{footer}</div>}\n </div>\n );\n }\n\n // Card container styles\n const cardContainerStyles: React.CSSProperties = {\n width,\n minWidth,\n alignSelf,\n ...(fullHeight && { height: '100%' }),\n ...(height && { height, display: 'flex', flexDirection: 'column' }),\n ...(glassFooter && footer && { position: 'relative' }),\n overflow: 'hidden',\n ...style,\n };\n\n return (\n <div className={cardClasses} style={cardContainerStyles}>\n {/* Header */}\n {hasHeaderContent({ title, subtitle, extra }) && (\n <div\n className={headerInset ? 'card-header py-2' : 'card-header px-3 py-2'}\n style={{\n marginBottom: '1px',\n fontSize: size === 'small' ? '12px' : '13px',\n fontWeight: 'normal',\n ...(headerConfig?.padding\n ? { padding: headerConfig.padding }\n : headerInset),\n }}\n >\n <HeaderRow\n title={title}\n subtitle={subtitle}\n extra={extra}\n titleClassName=\"font-normal overflow-visible\"\n />\n </div>\n )}\n\n {/* Body */}\n <div\n className=\"flex-1\"\n style={{\n ...contentStyles,\n ...(glassFooter && footer && { position: 'relative' }),\n }}\n >\n {children}\n </div>\n\n {/* Footer */}\n {footer && (\n <div\n ref={glassFooter ? footerRef : undefined}\n className=\"card-footer px-4 py-3\"\n style={\n glassFooter\n ? {\n ...GLASS_SURFACE_STYLE,\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n borderBottomLeftRadius: border === 'rounded' ? '20px' : '12px',\n borderBottomRightRadius: border === 'rounded' ? '20px' : '12px',\n }\n : undefined\n }\n >\n {footer}\n </div>\n )}\n </div>\n );\n};\n\nexport default Card;\nexport { Card };\n"],"names":["PLAIN_LENGTH","horizontalInset","padding","parts","part","top","right","left","Card","variant","title","subtitle","extra","children","size","width","minWidth","dimmed","direction","align","fullHeight","border","alignSelf","height","footer","glassFooter","className","style","headerConfig","footerRef","useRef","footerHeight","setFooterHeight","useState","useEffect","observer","entries","entry","cardClasses","headerInset","paddingValue","contentStyles","jsxs","FRAME_CLASS","FOREGROUND_RESET","hasHeaderContent","jsx","FrameHeader","FRAME_SECTION_STY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