@lobehub/ui 6.0.0-beta.5 → 6.0.0-beta.7
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/es/ActionIcon/style.mjs +1 -1
- package/es/ActionIcon/style.mjs.map +1 -1
- package/es/ColorSwatches/ColorSwatches.mjs +17 -22
- package/es/ColorSwatches/ColorSwatches.mjs.map +1 -1
- package/es/ColorSwatches/CustomPicker.mjs +101 -0
- package/es/ColorSwatches/CustomPicker.mjs.map +1 -0
- package/es/ColorSwatches/index.d.mts +2 -2
- package/es/ColorSwatches/marker.stylex.mjs +9 -0
- package/es/ColorSwatches/marker.stylex.mjs.map +1 -0
- package/es/ColorSwatches/style.mjs +36 -0
- package/es/ColorSwatches/style.mjs.map +1 -1
- package/es/ColorSwatches/type.d.mts +11 -2
- package/es/EditableText/EditableText.mjs +1 -1
- package/es/Grid/style.mjs +1 -1
- package/es/Grid/style.mjs.map +1 -1
- package/es/Image/type.d.mts +1 -0
- package/es/Image/viewer/ImageViewer.mjs +1 -0
- package/es/Image/viewer/ImageViewer.mjs.map +1 -1
- package/es/Image/viewer/Toolbar.mjs +19 -6
- package/es/Image/viewer/Toolbar.mjs.map +1 -1
- package/es/Image/viewer/ViewerChrome.mjs.map +1 -1
- package/es/Input/style.mjs +3 -3
- package/es/Input/style.mjs.map +1 -1
- package/es/Text/style.d.mts +3 -3
- package/es/awesome/Grainient/Grainient.d.mts +11 -0
- package/es/awesome/Grainient/Grainient.mjs +314 -0
- package/es/awesome/Grainient/Grainient.mjs.map +1 -0
- package/es/awesome/Grainient/index.d.mts +3 -0
- package/es/awesome/Grainient/style.mjs +23 -0
- package/es/awesome/Grainient/style.mjs.map +1 -0
- package/es/awesome/Grainient/type.d.mts +121 -0
- package/es/awesome/index.d.mts +4 -1
- package/es/awesome/index.mjs +2 -1
- package/es/dashboard/AuthLayout/Aside.d.mts +10 -0
- package/es/dashboard/AuthLayout/Aside.mjs +31 -0
- package/es/dashboard/AuthLayout/Aside.mjs.map +1 -0
- package/es/dashboard/AuthLayout/AuthLayout.d.mts +3 -1
- package/es/dashboard/AuthLayout/AuthLayout.mjs +93 -37
- package/es/dashboard/AuthLayout/AuthLayout.mjs.map +1 -1
- package/es/dashboard/AuthLayout/index.d.mts +3 -2
- package/es/dashboard/AuthLayout/style.mjs +98 -1
- package/es/dashboard/AuthLayout/style.mjs.map +1 -1
- package/es/dashboard/AuthLayout/type.d.mts +38 -2
- package/es/dashboard/AuthTools/AuthLocaleSwitch.d.mts +10 -0
- package/es/dashboard/AuthTools/AuthLocaleSwitch.mjs +33 -0
- package/es/dashboard/AuthTools/AuthLocaleSwitch.mjs.map +1 -0
- package/es/dashboard/AuthTools/AuthThemeSwitch.d.mts +10 -0
- package/es/dashboard/AuthTools/AuthThemeSwitch.mjs +59 -0
- package/es/dashboard/AuthTools/AuthThemeSwitch.mjs.map +1 -0
- package/es/dashboard/AuthTools/index.d.mts +4 -0
- package/es/dashboard/AuthTools/style.mjs +27 -0
- package/es/dashboard/AuthTools/style.mjs.map +1 -0
- package/es/dashboard/AuthTools/type.d.mts +29 -0
- package/es/dashboard/ChartGrid/ChartGrid.d.mts +10 -0
- package/es/dashboard/ChartGrid/ChartGrid.mjs +19 -0
- package/es/dashboard/ChartGrid/ChartGrid.mjs.map +1 -0
- package/es/dashboard/ChartGrid/index.d.mts +3 -0
- package/es/dashboard/ChartGrid/style.mjs +18 -0
- package/es/dashboard/ChartGrid/style.mjs.map +1 -0
- package/es/dashboard/ChartGrid/type.d.mts +8 -0
- package/es/dashboard/ConsoleNav/Skeleton.d.mts +15 -0
- package/es/dashboard/ConsoleNav/Skeleton.mjs +82 -0
- package/es/dashboard/ConsoleNav/Skeleton.mjs.map +1 -0
- package/es/dashboard/ConsoleNav/index.d.mts +3 -2
- package/es/dashboard/ConsoleNav/style.mjs +18 -0
- package/es/dashboard/ConsoleNav/style.mjs.map +1 -1
- package/es/dashboard/ConsoleNav/type.d.mts +13 -0
- package/es/dashboard/ConsoleShell/ConsoleShell.d.mts +1 -1
- package/es/dashboard/ConsoleShell/ConsoleShell.mjs +26 -6
- package/es/dashboard/ConsoleShell/ConsoleShell.mjs.map +1 -1
- package/es/dashboard/ConsoleShell/style.mjs +10 -0
- package/es/dashboard/ConsoleShell/style.mjs.map +1 -1
- package/es/dashboard/ConsoleShell/type.d.mts +11 -0
- package/es/dashboard/FilterSidebar/FilterSidebar.mjs +18 -17
- package/es/dashboard/FilterSidebar/FilterSidebar.mjs.map +1 -1
- package/es/dashboard/FilterStrip/FilterStrip.d.mts +11 -0
- package/es/dashboard/FilterStrip/FilterStrip.mjs +55 -0
- package/es/dashboard/FilterStrip/FilterStrip.mjs.map +1 -0
- package/es/dashboard/FilterStrip/index.d.mts +3 -0
- package/es/dashboard/FilterStrip/style.mjs +78 -0
- package/es/dashboard/FilterStrip/style.mjs.map +1 -0
- package/es/dashboard/FilterStrip/type.d.mts +25 -0
- package/es/dashboard/LabelWithKey/LabelWithKey.d.mts +10 -0
- package/es/dashboard/LabelWithKey/LabelWithKey.mjs +18 -0
- package/es/dashboard/LabelWithKey/LabelWithKey.mjs.map +1 -0
- package/es/dashboard/LabelWithKey/index.d.mts +3 -0
- package/es/dashboard/LabelWithKey/type.d.mts +11 -0
- package/es/dashboard/MetricStrip/MetricCell.mjs +81 -0
- package/es/dashboard/MetricStrip/MetricCell.mjs.map +1 -0
- package/es/dashboard/MetricStrip/MetricStrip.d.mts +13 -0
- package/es/dashboard/MetricStrip/MetricStrip.mjs +47 -0
- package/es/dashboard/MetricStrip/MetricStrip.mjs.map +1 -0
- package/es/dashboard/MetricStrip/index.d.mts +3 -0
- package/es/dashboard/MetricStrip/style.mjs +156 -0
- package/es/dashboard/MetricStrip/style.mjs.map +1 -0
- package/es/dashboard/MetricStrip/type.d.mts +36 -0
- package/es/dashboard/PageSkeleton/PageSkeleton.mjs +20 -18
- package/es/dashboard/PageSkeleton/PageSkeleton.mjs.map +1 -1
- package/es/dashboard/PageSkeleton/style.mjs +1 -1
- package/es/dashboard/PageSkeleton/style.mjs.map +1 -1
- package/es/dashboard/PageToolbar/PageToolbar.d.mts +10 -0
- package/es/dashboard/PageToolbar/PageToolbar.mjs +22 -0
- package/es/dashboard/PageToolbar/PageToolbar.mjs.map +1 -0
- package/es/dashboard/PageToolbar/index.d.mts +3 -0
- package/es/dashboard/PageToolbar/style.mjs +36 -0
- package/es/dashboard/PageToolbar/style.mjs.map +1 -0
- package/es/dashboard/PageToolbar/type.d.mts +11 -0
- package/es/dashboard/PanelSurface/PanelSurface.d.mts +10 -0
- package/es/dashboard/PanelSurface/PanelSurface.mjs +40 -0
- package/es/dashboard/PanelSurface/PanelSurface.mjs.map +1 -0
- package/es/dashboard/PanelSurface/index.d.mts +3 -0
- package/es/dashboard/PanelSurface/style.mjs +25 -0
- package/es/dashboard/PanelSurface/style.mjs.map +1 -0
- package/es/dashboard/PanelSurface/type.d.mts +17 -0
- package/es/dashboard/Section/Section.d.mts +10 -0
- package/es/dashboard/Section/Section.mjs +81 -0
- package/es/dashboard/Section/Section.mjs.map +1 -0
- package/es/dashboard/Section/index.d.mts +3 -0
- package/es/dashboard/Section/style.mjs +31 -0
- package/es/dashboard/Section/style.mjs.map +1 -0
- package/es/dashboard/Section/type.d.mts +23 -0
- package/es/dashboard/StatCard/StatCard.d.mts +2 -1
- package/es/dashboard/StatCard/StatCard.mjs +28 -91
- package/es/dashboard/StatCard/StatCard.mjs.map +1 -1
- package/es/dashboard/StatCard/type.d.mts +16 -5
- package/es/dashboard/Surface/Surface.d.mts +4 -3
- package/es/dashboard/Surface/Surface.mjs +91 -8
- package/es/dashboard/Surface/Surface.mjs.map +1 -1
- package/es/dashboard/Surface/index.d.mts +3 -2
- package/es/dashboard/Surface/link.d.mts +16 -0
- package/es/dashboard/Surface/link.mjs +40 -0
- package/es/dashboard/Surface/link.mjs.map +1 -0
- package/es/dashboard/Surface/marker.stylex.mjs +9 -0
- package/es/dashboard/Surface/marker.stylex.mjs.map +1 -0
- package/es/dashboard/Surface/style.d.mts +2 -0
- package/es/dashboard/Surface/style.mjs +155 -14
- package/es/dashboard/Surface/style.mjs.map +1 -1
- package/es/dashboard/Surface/type.d.mts +29 -1
- package/es/dashboard/TableIconActions/TableIconActions.d.mts +17 -0
- package/es/dashboard/TableIconActions/TableIconActions.mjs +39 -0
- package/es/dashboard/TableIconActions/TableIconActions.mjs.map +1 -0
- package/es/dashboard/TableIconActions/index.d.mts +3 -0
- package/es/dashboard/TableIconActions/type.d.mts +17 -0
- package/es/dashboard/TitleWithTips/TitleWithTips.d.mts +10 -0
- package/es/dashboard/TitleWithTips/TitleWithTips.mjs +28 -0
- package/es/dashboard/TitleWithTips/TitleWithTips.mjs.map +1 -0
- package/es/dashboard/TitleWithTips/index.d.mts +3 -0
- package/es/dashboard/TitleWithTips/type.d.mts +10 -0
- package/es/dashboard/index.d.mts +38 -4
- package/es/dashboard/index.mjs +17 -3
- package/es/index.d.mts +3 -2
- package/es/index.mjs +5 -4
- package/es/style.css +339 -32
- package/es/styles/createGlobalStyle.mjs +1 -1
- package/es/styles/index.d.mts +3 -2
- package/es/styles/index.mjs +5 -4
- package/es/styles/theme/createLobeToken.d.mts +3 -2
- package/es/styles/theme/createLobeToken.mjs.map +1 -1
- package/es/styles/theme/customPrimary.d.mts +7 -0
- package/es/styles/theme/customPrimary.mjs +66 -0
- package/es/styles/theme/customPrimary.mjs.map +1 -0
- package/es/styles/theme/scope.d.mts +4 -3
- package/es/styles/theme/scope.mjs +30 -8
- package/es/styles/theme/scope.mjs.map +1 -1
- package/es/styles/theme/themeCss.d.mts +2 -0
- package/es/styles/theme/themeCss.mjs +9 -2
- package/es/styles/theme/themeCss.mjs.map +1 -1
- package/es/styles/theme/token/primary.mjs +6 -2
- package/es/styles/theme/token/primary.mjs.map +1 -1
- package/package.json +1 -1
- package/es/dashboard/StatCard/style.mjs +0 -105
- package/es/dashboard/StatCard/style.mjs.map +0 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { styleProps } from "../../styles/stylex/props.mjs";
|
|
3
|
+
import Icon from "../../Icon/Icon.mjs";
|
|
4
|
+
import FlexBasic_default from "../../Flex/FlexBasic.mjs";
|
|
5
|
+
import { useSurfaceLink } from "../Surface/link.mjs";
|
|
6
|
+
import Surface from "../Surface/Surface.mjs";
|
|
7
|
+
import { styles } from "./style.mjs";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import * as stylex from "@stylexjs/stylex";
|
|
10
|
+
import { ChevronRight } from "lucide-react";
|
|
11
|
+
//#region src/dashboard/Section/Section.tsx
|
|
12
|
+
/** A titled page section with description, extra and a "more" link, flat or as a card. */
|
|
13
|
+
const Section = ({ className, variant = "default", fontSize, title, more, moreLink, icon, children, desc, extra, gap, padded, renderLink, ...rest }) => {
|
|
14
|
+
const link = useSurfaceLink(renderLink);
|
|
15
|
+
const moreNode = moreLink ? link({
|
|
16
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", { children: more }), /* @__PURE__ */ jsx(Icon, { icon: ChevronRight })] }),
|
|
17
|
+
className: stylex.props(styles.more).className,
|
|
18
|
+
href: moreLink,
|
|
19
|
+
rel: moreLink.startsWith("http") ? "noreferrer" : void 0,
|
|
20
|
+
target: moreLink.startsWith("http") ? "_blank" : void 0
|
|
21
|
+
}) : null;
|
|
22
|
+
const actions = extra || moreNode ? /* @__PURE__ */ jsxs(FlexBasic_default, {
|
|
23
|
+
horizontal: true,
|
|
24
|
+
align: "center",
|
|
25
|
+
gap: 8,
|
|
26
|
+
children: [extra, moreNode]
|
|
27
|
+
}) : void 0;
|
|
28
|
+
if (variant === "card") return /* @__PURE__ */ jsx(Surface, {
|
|
29
|
+
description: desc,
|
|
30
|
+
extra: actions,
|
|
31
|
+
padded: padded ?? true,
|
|
32
|
+
title: title ? /* @__PURE__ */ jsxs("span", {
|
|
33
|
+
...styleProps(styles.title, void 0, fontSize ? { fontSize } : void 0),
|
|
34
|
+
children: [icon, title]
|
|
35
|
+
}) : void 0,
|
|
36
|
+
children: /* @__PURE__ */ jsx(FlexBasic_default, {
|
|
37
|
+
className,
|
|
38
|
+
gap: gap ?? 12,
|
|
39
|
+
...rest,
|
|
40
|
+
children
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
if (!title) return /* @__PURE__ */ jsx(FlexBasic_default, {
|
|
44
|
+
className,
|
|
45
|
+
gap,
|
|
46
|
+
...rest,
|
|
47
|
+
children
|
|
48
|
+
});
|
|
49
|
+
return /* @__PURE__ */ jsxs(FlexBasic_default, {
|
|
50
|
+
className,
|
|
51
|
+
gap: gap ?? 16,
|
|
52
|
+
width: "100%",
|
|
53
|
+
...rest,
|
|
54
|
+
children: [/* @__PURE__ */ jsxs(FlexBasic_default, {
|
|
55
|
+
horizontal: true,
|
|
56
|
+
align: "center",
|
|
57
|
+
gap: 12,
|
|
58
|
+
justify: "space-between",
|
|
59
|
+
width: "100%",
|
|
60
|
+
children: [/* @__PURE__ */ jsxs(FlexBasic_default, {
|
|
61
|
+
gap: 4,
|
|
62
|
+
children: [
|
|
63
|
+
icon,
|
|
64
|
+
/* @__PURE__ */ jsx("h2", {
|
|
65
|
+
...styleProps(styles.title, void 0, fontSize ? { fontSize } : void 0),
|
|
66
|
+
children: title
|
|
67
|
+
}),
|
|
68
|
+
desc ? /* @__PURE__ */ jsx("div", {
|
|
69
|
+
...stylex.props(styles.desc),
|
|
70
|
+
children: desc
|
|
71
|
+
}) : null
|
|
72
|
+
]
|
|
73
|
+
}), actions ?? null]
|
|
74
|
+
}), children]
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
Section.displayName = "Section";
|
|
78
|
+
//#endregion
|
|
79
|
+
export { Section as default };
|
|
80
|
+
|
|
81
|
+
//# sourceMappingURL=Section.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Section.mjs","names":["Flexbox"],"sources":["../../../src/dashboard/Section/Section.tsx"],"sourcesContent":["'use client';\n\nimport * as stylex from '@stylexjs/stylex';\nimport { ChevronRight } from 'lucide-react';\n\nimport { Flexbox } from '@/Flex';\nimport Icon from '@/Icon';\nimport { styleProps } from '@/styles/stylex/props';\n\nimport { useSurfaceLink } from '../Surface/link';\nimport Surface from '../Surface/Surface';\nimport { styles } from './style';\nimport type { SectionProps } from './type';\n\n/** A titled page section with description, extra and a \"more\" link, flat or as a card. */\nconst Section = ({\n className,\n variant = 'default',\n fontSize,\n title,\n more,\n moreLink,\n icon,\n children,\n desc,\n extra,\n gap,\n padded,\n renderLink,\n ...rest\n}: SectionProps) => {\n const link = useSurfaceLink(renderLink);\n const moreNode = moreLink\n ? link({\n children: (\n <>\n <span>{more}</span>\n <Icon icon={ChevronRight} />\n </>\n ),\n className: stylex.props(styles.more).className,\n href: moreLink,\n rel: moreLink.startsWith('http') ? 'noreferrer' : undefined,\n target: moreLink.startsWith('http') ? '_blank' : undefined,\n })\n : null;\n const actions =\n extra || moreNode ? (\n <Flexbox horizontal align=\"center\" gap={8}>\n {extra}\n {moreNode}\n </Flexbox>\n ) : undefined;\n\n if (variant === 'card') {\n return (\n <Surface\n description={desc}\n extra={actions}\n padded={padded ?? true}\n title={\n title ? (\n <span {...styleProps(styles.title, undefined, fontSize ? { fontSize } : undefined)}>\n {icon}\n {title}\n </span>\n ) : undefined\n }\n >\n <Flexbox className={className} gap={gap ?? 12} {...rest}>\n {children}\n </Flexbox>\n </Surface>\n );\n }\n\n if (!title) {\n return (\n <Flexbox className={className} gap={gap} {...rest}>\n {children}\n </Flexbox>\n );\n }\n\n return (\n <Flexbox className={className} gap={gap ?? 16} width=\"100%\" {...rest}>\n <Flexbox horizontal align=\"center\" gap={12} justify=\"space-between\" width=\"100%\">\n <Flexbox gap={4}>\n {icon}\n <h2 {...styleProps(styles.title, undefined, fontSize ? { fontSize } : undefined)}>\n {title}\n </h2>\n {desc ? <div {...stylex.props(styles.desc)}>{desc}</div> : null}\n </Flexbox>\n {actions ?? null}\n </Flexbox>\n {children}\n </Flexbox>\n );\n};\n\nSection.displayName = 'Section';\n\nexport default Section;\n"],"mappings":";;;;;;;;;;;;AAaA,MAAM,WAAW,EACf,WACA,UAAU,WACV,UACA,OACA,MACA,UACA,MACA,UACA,MACA,OACA,KACA,QACA,YACA,GAAG,WACe;CAClB,MAAM,OAAO,eAAe,UAAU;CACtC,MAAM,WAAW,WAAW,KAAK;EAC/B,UAAU,qBAAA,UAAA,EAAA,UAAA,CACF,oBAAC,QAAD,EAAA,UAAO,KAAW,CAAA,GAClB,oBAAC,MAAD,EAAM,MAAM,aAAe,CAAA,CAC3B,EAAA,CAAA;EACR,WAAW,OAAO,MAAM,OAAO,IAAI,CAAC,CAAC;EACrC,MAAM;EACN,KAAK,SAAS,WAAW,MAAM,IAAI,eAAe,KAAA;EAClD,QAAQ,SAAS,WAAW,MAAM,IAAI,WAAW,KAAA;CACnD,CAAC,IAAI;CACL,MAAM,UAAU,SAAS,WAAW,qBAACA,mBAAD;EAAS,YAAA;EAAW,OAAM;EAAS,KAAK;EAAxC,UAAA,CAC7B,OACA,QACM;CAAI,CAAA,IAAA,KAAA;CACjB,IAAI,YAAY,QACd,OAAO,oBAAC,SAAD;EAAS,aAAa;EAAM,OAAO;EAAS,QAAQ,UAAU;EAAM,OAAO,QAAQ,qBAAC,QAAD;GAAM,GAAI,WAAW,OAAO,OAAO,KAAA,GAAW,WAAW,EACjJ,SACF,IAAI,KAAA,CAAS;GAF6E,UAAA,CAG/E,MACA,KACG;EAAI,CAAA,IAAA,KAAA;EACd,UAAA,oBAACA,mBAAD;GAAoB;GAAW,KAAK,OAAO;GAAI,GAAI;GAChD;EACM,CAAA;CACF,CAAA;CAEb,IAAI,CAAC,OACH,OAAO,oBAACA,mBAAD;EAAoB;EAAgB;EAAK,GAAI;EAC/C;CACM,CAAA;CAEb,OAAO,qBAACA,mBAAD;EAAoB;EAAW,KAAK,OAAO;EAAI,OAAM;EAAO,GAAI;EAAhE,UAAA,CACH,qBAACA,mBAAD;GAAS,YAAA;GAAW,OAAM;GAAS,KAAK;GAAI,SAAQ;GAAgB,OAAM;GAA1E,UAAA,CACE,qBAACA,mBAAD;IAAS,KAAK;IAAd,UAAA;KACG;KACD,oBAAC,MAAD;MAAI,GAAI,WAAW,OAAO,OAAO,KAAA,GAAW,WAAW,EACvD,SACF,IAAI,KAAA,CAAS;MACR,UAAA;KACC,CAAA;KACH,OAAO,oBAAC,OAAD;MAAK,GAAI,OAAO,MAAM,OAAO,IAAI;MAAI,UAAA;KAAU,CAAA,IAAI;IACpD;GACR,CAAA,GAAA,WAAW,IACL;EACR,CAAA,GAAA,QACM;;AACb;AACA,QAAQ,cAAc"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/dashboard/Section/style.ts
|
|
2
|
+
const styles = {
|
|
3
|
+
desc: {
|
|
4
|
+
kMwMTN: "lbc77et8",
|
|
5
|
+
kGuDYH: "lb4z9k3i",
|
|
6
|
+
k63SB2: "lbo1l8bm",
|
|
7
|
+
kLWn49: "lbfrs9s4",
|
|
8
|
+
$$css: true
|
|
9
|
+
},
|
|
10
|
+
more: {
|
|
11
|
+
kOIVth: "lb195vfkc",
|
|
12
|
+
kybGjl: "lb1hl2dhg",
|
|
13
|
+
kGNEyG: "lb6s0dn4",
|
|
14
|
+
kMwMTN: "lbc77et8 lb1bxu9lh",
|
|
15
|
+
k1xSpc: "lb3nfvp2",
|
|
16
|
+
kGuDYH: "lb4z9k3i",
|
|
17
|
+
$$css: true
|
|
18
|
+
},
|
|
19
|
+
title: {
|
|
20
|
+
kogj98: "lb1ghz6dp",
|
|
21
|
+
kMwMTN: "lb66ogz0",
|
|
22
|
+
kGuDYH: "lb1jvydc1",
|
|
23
|
+
k63SB2: "lb1s688f",
|
|
24
|
+
kLWn49: "lb37zpob",
|
|
25
|
+
$$css: true
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
29
|
+
export { styles };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=style.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.mjs","names":[],"sources":["../../../src/dashboard/Section/style.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\n\nimport { cssVar } from '@/styles/stylex/cssVar.stylex';\n\nexport const styles = stylex.create({\n desc: {\n color: cssVar.colorTextSecondary,\n fontSize: 13,\n fontWeight: 400,\n lineHeight: 1.45,\n },\n more: {\n gap: 2,\n textDecoration: 'none',\n alignItems: 'center',\n color: { 'default': cssVar.colorTextSecondary, ':hover': cssVar.colorText },\n display: 'inline-flex',\n fontSize: 13,\n },\n title: {\n margin: 0,\n color: cssVar.colorText,\n fontSize: 15,\n fontWeight: 600,\n lineHeight: 1.4,\n },\n});\n"],"mappings":";AAGA,MAAa,SAAS;CACpB,MAAM;EACJ,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,MAAM;EACJ,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,OAAO;EACL,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;AACF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FlexboxProps } from "../../Flex/type.mjs";
|
|
2
|
+
import "../../Flex/index.mjs";
|
|
3
|
+
import { SurfaceRenderLink } from "../Surface/type.mjs";
|
|
4
|
+
import { ReactNode } from "react";
|
|
5
|
+
//#region src/dashboard/Section/type.d.ts
|
|
6
|
+
export interface SectionProps extends Omit<FlexboxProps, 'title'> {
|
|
7
|
+
desc?: ReactNode;
|
|
8
|
+
extra?: ReactNode;
|
|
9
|
+
fontSize?: number;
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
/** Text of the "more" link. */
|
|
12
|
+
more?: ReactNode;
|
|
13
|
+
/** Target of the "more" link. An `http` URL opens in a new tab. */
|
|
14
|
+
moreLink?: string;
|
|
15
|
+
/** Card body padding (`variant="card"`). Turn off when the children already sit on the card edge. */
|
|
16
|
+
padded?: boolean;
|
|
17
|
+
renderLink?: SurfaceRenderLink;
|
|
18
|
+
title?: ReactNode;
|
|
19
|
+
/** `default` is a titled page section; `card` wraps it in a Surface. */
|
|
20
|
+
variant?: 'default' | 'card';
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//# sourceMappingURL=type.d.mts.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { StatCardProps } from "./type.mjs";
|
|
2
2
|
//#region src/dashboard/StatCard/StatCard.d.ts
|
|
3
|
-
|
|
3
|
+
/** One metric in its own card: the same item as a `split` MetricStrip. */
|
|
4
|
+
declare function StatCard({ action, className, delta, direction, hint, href, label, loading, mark, onClick, renderLink, value, valueTone }: StatCardProps): import("react").JSX.Element;
|
|
4
5
|
declare namespace StatCard {
|
|
5
6
|
var displayName: string;
|
|
6
7
|
}
|
|
@@ -1,98 +1,35 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import Icon from "../../Icon/Icon.mjs";
|
|
4
|
-
import FlexBasic_default from "../../Flex/FlexBasic.mjs";
|
|
5
|
-
import Text from "../../Text/Text.mjs";
|
|
2
|
+
import { styleProps } from "../../styles/stylex/props.mjs";
|
|
6
3
|
import { styles } from "../Surface/style.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
4
|
+
import { useSurfaceCardStyles } from "../Surface/link.mjs";
|
|
5
|
+
import { styles as styles$1 } from "../MetricStrip/style.mjs";
|
|
6
|
+
import MetricCell from "../MetricStrip/MetricCell.mjs";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
11
8
|
//#region src/dashboard/StatCard/StatCard.tsx
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
up: TrendingUp
|
|
16
|
-
};
|
|
17
|
-
const deltaStyles = {
|
|
18
|
-
down: styles$1.deltaDown,
|
|
19
|
-
flat: styles$1.deltaFlat,
|
|
20
|
-
up: styles$1.deltaUp
|
|
21
|
-
};
|
|
22
|
-
const textStyles = {
|
|
23
|
-
hint: {
|
|
24
|
-
color: cssVar.colorTextTertiary,
|
|
25
|
-
fontSize: cssVar.fontSizeSM
|
|
26
|
-
},
|
|
27
|
-
label: {
|
|
28
|
-
color: cssVar.colorTextSecondary,
|
|
29
|
-
fontSize: cssVar.fontSizeSM
|
|
30
|
-
},
|
|
31
|
-
metricHint: {
|
|
32
|
-
color: cssVar.colorText,
|
|
33
|
-
fontSize: cssVar.fontSize
|
|
34
|
-
},
|
|
35
|
-
metricLabel: {
|
|
36
|
-
color: cssVar.colorText,
|
|
37
|
-
fontSize: cssVar.fontSize,
|
|
38
|
-
fontWeight: 500
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
function StatCard({ action, delta, direction = "flat", hint, label, mark, prominent = false, value, wash }) {
|
|
9
|
+
/** One metric in its own card: the same item as a `split` MetricStrip. */
|
|
10
|
+
function StatCard({ action, className, delta, direction = "flat", hint, href, label, loading, mark, onClick, renderLink, value, valueTone }) {
|
|
11
|
+
const cardStyles = useSurfaceCardStyles();
|
|
42
12
|
return /* @__PURE__ */ jsx("div", {
|
|
43
|
-
...
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}), action]
|
|
64
|
-
}), mark ? /* @__PURE__ */ jsx("span", {
|
|
65
|
-
"aria-hidden": true,
|
|
66
|
-
...stylex.props(styles$1.badge),
|
|
67
|
-
children: /* @__PURE__ */ jsx(Icon, {
|
|
68
|
-
icon: mark,
|
|
69
|
-
size: 14
|
|
70
|
-
})
|
|
71
|
-
}) : null]
|
|
72
|
-
}),
|
|
73
|
-
/* @__PURE__ */ jsx("div", {
|
|
74
|
-
...stylex.props(prominent ? styles$1.metricValue : styles$1.value),
|
|
75
|
-
children: value
|
|
76
|
-
}),
|
|
77
|
-
delta || hint ? /* @__PURE__ */ jsxs(FlexBasic_default, {
|
|
78
|
-
horizontal: true,
|
|
79
|
-
align: "center",
|
|
80
|
-
gap: 8,
|
|
81
|
-
wrap: "wrap",
|
|
82
|
-
...stylex.props(prominent && styles$1.metricFoot),
|
|
83
|
-
children: [delta ? /* @__PURE__ */ jsxs("span", {
|
|
84
|
-
...stylex.props(styles$1.delta, deltaStyles[direction]),
|
|
85
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
86
|
-
icon: deltaIcon[direction],
|
|
87
|
-
size: 14
|
|
88
|
-
}), delta]
|
|
89
|
-
}) : null, hint ? /* @__PURE__ */ jsx(Text, {
|
|
90
|
-
style: prominent ? textStyles.metricHint : textStyles.hint,
|
|
91
|
-
children: hint
|
|
92
|
-
}) : null]
|
|
93
|
-
}) : null
|
|
94
|
-
]
|
|
95
|
-
})
|
|
13
|
+
...styleProps([
|
|
14
|
+
styles$1.card,
|
|
15
|
+
cardStyles,
|
|
16
|
+
styles.clip
|
|
17
|
+
], className),
|
|
18
|
+
children: /* @__PURE__ */ jsx(MetricCell, {
|
|
19
|
+
renderLink,
|
|
20
|
+
item: {
|
|
21
|
+
action,
|
|
22
|
+
delta,
|
|
23
|
+
direction,
|
|
24
|
+
hint,
|
|
25
|
+
href,
|
|
26
|
+
label,
|
|
27
|
+
loading,
|
|
28
|
+
mark,
|
|
29
|
+
onClick,
|
|
30
|
+
value,
|
|
31
|
+
valueTone
|
|
32
|
+
}
|
|
96
33
|
})
|
|
97
34
|
});
|
|
98
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatCard.mjs","names":["
|
|
1
|
+
{"version":3,"file":"StatCard.mjs","names":["metricStyles","surfaceStyles"],"sources":["../../../src/dashboard/StatCard/StatCard.tsx"],"sourcesContent":["'use client';\n\nimport { styleProps } from '@/styles/stylex/props';\n\nimport MetricCell from '../MetricStrip/MetricCell';\nimport { styles as metricStyles } from '../MetricStrip/style';\nimport { useSurfaceCardStyles } from '../Surface/link';\nimport { styles as surfaceStyles } from '../Surface/style';\nimport type { StatCardProps } from './type';\n\n/** One metric in its own card: the same item as a `split` MetricStrip. */\nfunction StatCard({\n action,\n className,\n delta,\n direction = 'flat',\n hint,\n href,\n label,\n loading,\n mark,\n onClick,\n renderLink,\n value,\n valueTone,\n}: StatCardProps) {\n const cardStyles = useSurfaceCardStyles();\n\n return (\n <div {...styleProps([metricStyles.card, cardStyles, surfaceStyles.clip], className)}>\n <MetricCell\n renderLink={renderLink}\n item={{\n action,\n delta,\n direction,\n hint,\n href,\n label,\n loading,\n mark,\n onClick,\n value,\n valueTone,\n }}\n />\n </div>\n );\n}\n\nStatCard.displayName = 'StatCard';\n\nexport default StatCard;\n"],"mappings":";;;;;;;;;AAWA,SAAS,SAAS,EAChB,QACA,WACA,OACA,YAAY,QACZ,MACA,MACA,OACA,SACA,MACA,SACA,YACA,OACA,aACgB;CAChB,MAAM,aAAa,qBAAqB;CAExC,OACE,oBAAC,OAAD;EAAK,GAAI,WAAW;GAACA,SAAa;GAAM;GAAYC,OAAc;EAAI,GAAG,SAAS;EAChF,UAAA,oBAAC,YAAD;GACc;GACZ,MAAM;IACJ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;GACF;EACD,CAAA;CACE,CAAA;AAET;AAEA,SAAS,cAAc"}
|
|
@@ -1,24 +1,35 @@
|
|
|
1
1
|
import { IconProps } from "../../Icon/type.mjs";
|
|
2
2
|
import "../../Icon/index.mjs";
|
|
3
|
+
import { SurfaceRenderLink } from "../Surface/type.mjs";
|
|
3
4
|
import { ReactNode } from "react";
|
|
4
5
|
//#region src/dashboard/StatCard/type.d.ts
|
|
5
6
|
export type StatDirection = 'up' | 'down' | 'flat';
|
|
6
|
-
/**
|
|
7
|
+
/** @deprecated StatCard renders as a MetricStrip item and no longer draws a wash. */
|
|
7
8
|
export type StatWash = 'gray';
|
|
8
9
|
export interface StatCardProps {
|
|
9
10
|
/** Control rendered on the label row, such as a menu. */
|
|
10
11
|
action?: ReactNode;
|
|
12
|
+
className?: string;
|
|
11
13
|
/** Change amount, colored by `direction`. */
|
|
12
|
-
delta?:
|
|
14
|
+
delta?: ReactNode;
|
|
13
15
|
direction?: StatDirection;
|
|
14
|
-
/** Line
|
|
15
|
-
hint?:
|
|
16
|
+
/** Line after the delta. */
|
|
17
|
+
hint?: ReactNode;
|
|
18
|
+
/** Makes the card a link (through `renderLink` / `SurfaceLinkProvider`). */
|
|
19
|
+
href?: string;
|
|
16
20
|
label: ReactNode;
|
|
21
|
+
/** Value placeholder while loading; the label stays. */
|
|
22
|
+
loading?: boolean;
|
|
17
23
|
/** Corner glyph. Hidden from assistive tech so it does not repeat the label. */
|
|
18
24
|
mark?: IconProps['icon'];
|
|
19
|
-
|
|
25
|
+
onClick?: () => void;
|
|
26
|
+
/** @deprecated Ignored. StatCard always uses the MetricStrip item scale. */
|
|
20
27
|
prominent?: boolean;
|
|
28
|
+
renderLink?: SurfaceRenderLink;
|
|
21
29
|
value: ReactNode;
|
|
30
|
+
/** Color the figure when the number itself is the thing to act on. */
|
|
31
|
+
valueTone?: 'danger' | 'warning';
|
|
32
|
+
/** @deprecated Ignored. StatCard renders as a MetricStrip item without a wash. */
|
|
22
33
|
wash?: StatWash;
|
|
23
34
|
}
|
|
24
35
|
//#endregion
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { SurfaceProps } from "./type.mjs";
|
|
2
2
|
//#region src/dashboard/Surface/Surface.d.ts
|
|
3
3
|
/**
|
|
4
|
-
* Elevated card on a workspace canvas.
|
|
5
|
-
*
|
|
4
|
+
* Elevated card on a workspace canvas. Bare, it is a plain frame. With `title`,
|
|
5
|
+
* `description` or `extra` it gets a header and a padded body that lets a
|
|
6
|
+
* trailing table meet the card edges.
|
|
6
7
|
*/
|
|
7
|
-
declare function Surface({ className, style, ...rest }: SurfaceProps): import("react").JSX.Element;
|
|
8
|
+
declare function Surface({ bleed, chart, children, className, description, extra, href, loading, padded, renderLink, style, title, ...rest }: SurfaceProps): import("react").JSX.Element;
|
|
8
9
|
declare namespace Surface {
|
|
9
10
|
var displayName: string;
|
|
10
11
|
}
|
|
@@ -1,16 +1,99 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { styleProps } from "../../styles/stylex/props.mjs";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import Spin from "../../Spin/Spin.mjs";
|
|
4
|
+
import Skeleton from "../../Skeleton/index.mjs";
|
|
5
|
+
import { surfaceMarker } from "./marker.stylex.mjs";
|
|
6
|
+
import { styles, surfaceClassNames } from "./style.mjs";
|
|
7
|
+
import { SurfaceDepthContext, useSurfaceCardStyles, useSurfaceDepth, useSurfaceLink } from "./link.mjs";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import clsx from "clsx";
|
|
10
|
+
import * as stylex from "@stylexjs/stylex";
|
|
11
|
+
import { ArrowUpRight } from "lucide-react";
|
|
5
12
|
//#region src/dashboard/Surface/Surface.tsx
|
|
13
|
+
const defined = (node) => node !== null && node !== void 0 && node !== false;
|
|
6
14
|
/**
|
|
7
|
-
* Elevated card on a workspace canvas.
|
|
8
|
-
*
|
|
15
|
+
* Elevated card on a workspace canvas. Bare, it is a plain frame. With `title`,
|
|
16
|
+
* `description` or `extra` it gets a header and a padded body that lets a
|
|
17
|
+
* trailing table meet the card edges.
|
|
9
18
|
*/
|
|
10
|
-
function Surface({ className, style, ...rest }) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
19
|
+
function Surface({ bleed = false, chart, children, className, description, extra, href, loading, padded, renderLink, style, title, ...rest }) {
|
|
20
|
+
const depth = useSurfaceDepth();
|
|
21
|
+
const link = useSurfaceLink(renderLink);
|
|
22
|
+
const cardStyles = useSurfaceCardStyles();
|
|
23
|
+
const refreshing = Boolean(loading) && defined(children);
|
|
24
|
+
const placeholder = Boolean(loading) && !defined(children);
|
|
25
|
+
const hasHeader = defined(title) || defined(description) || defined(extra) || refreshing;
|
|
26
|
+
const pad = bleed ? false : padded ?? (hasHeader || placeholder);
|
|
27
|
+
const clip = hasHeader || bleed || pad || defined(chart);
|
|
28
|
+
const heading = /* @__PURE__ */ jsxs("div", {
|
|
29
|
+
...stylex.props(styles.heading),
|
|
30
|
+
children: [defined(title) ? /* @__PURE__ */ jsx("div", {
|
|
31
|
+
...stylex.props(styles.title),
|
|
32
|
+
children: title
|
|
33
|
+
}) : null, defined(description) ? /* @__PURE__ */ jsx("div", {
|
|
34
|
+
...stylex.props(styles.desc),
|
|
35
|
+
children: description
|
|
36
|
+
}) : null]
|
|
37
|
+
});
|
|
38
|
+
const body = placeholder ? /* @__PURE__ */ jsx("div", {
|
|
39
|
+
"aria-busy": "true",
|
|
40
|
+
...stylex.props(styles.loading),
|
|
41
|
+
children: /* @__PURE__ */ jsx(Skeleton, {
|
|
42
|
+
height: 220,
|
|
43
|
+
radius: 8
|
|
44
|
+
})
|
|
45
|
+
}) : children;
|
|
46
|
+
const trailing = refreshing || defined(extra);
|
|
47
|
+
const arrow = /* @__PURE__ */ jsx(ArrowUpRight, {
|
|
48
|
+
"aria-hidden": true,
|
|
49
|
+
size: 16,
|
|
50
|
+
...stylex.props(styles.arrow, trailing && styles.arrowInLink)
|
|
51
|
+
});
|
|
52
|
+
return /* @__PURE__ */ jsx(SurfaceDepthContext, {
|
|
53
|
+
value: depth + 1,
|
|
54
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
55
|
+
...styleProps([
|
|
56
|
+
cardStyles,
|
|
57
|
+
styles.content,
|
|
58
|
+
clip && styles.clip,
|
|
59
|
+
Boolean(href) && [styles.cardLinked, surfaceMarker]
|
|
60
|
+
], clsx(surfaceClassNames.root, bleed && surfaceClassNames.bleed, className), style),
|
|
61
|
+
...rest,
|
|
62
|
+
children: [
|
|
63
|
+
hasHeader ? /* @__PURE__ */ jsxs("div", {
|
|
64
|
+
...stylex.props(styles.header),
|
|
65
|
+
children: [href ? link({
|
|
66
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [heading, trailing ? null : arrow] }),
|
|
67
|
+
className: stylex.props(styles.headingLink).className,
|
|
68
|
+
href
|
|
69
|
+
}) : heading, trailing ? /* @__PURE__ */ jsxs("div", {
|
|
70
|
+
...stylex.props(styles.extra),
|
|
71
|
+
children: [
|
|
72
|
+
refreshing ? /* @__PURE__ */ jsx(Spin, {
|
|
73
|
+
size: "small",
|
|
74
|
+
variant: "network"
|
|
75
|
+
}) : null,
|
|
76
|
+
extra,
|
|
77
|
+
href ? link({
|
|
78
|
+
"aria-hidden": true,
|
|
79
|
+
"children": arrow,
|
|
80
|
+
"className": stylex.props(styles.arrowLink).className,
|
|
81
|
+
href,
|
|
82
|
+
"tabIndex": -1
|
|
83
|
+
}) : null
|
|
84
|
+
]
|
|
85
|
+
}) : null]
|
|
86
|
+
}) : null,
|
|
87
|
+
pad ? /* @__PURE__ */ jsx("div", {
|
|
88
|
+
...styleProps(styles.body, surfaceClassNames.tableBleed),
|
|
89
|
+
children: body
|
|
90
|
+
}) : body,
|
|
91
|
+
defined(chart) ? /* @__PURE__ */ jsx("div", {
|
|
92
|
+
...stylex.props(styles.chart),
|
|
93
|
+
children: chart
|
|
94
|
+
}) : null
|
|
95
|
+
]
|
|
96
|
+
})
|
|
14
97
|
});
|
|
15
98
|
}
|
|
16
99
|
Surface.displayName = "Surface";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Surface.mjs","names":[],"sources":["../../../src/dashboard/Surface/Surface.tsx"],"sourcesContent":["'use client';\n\nimport { styleProps } from '@/styles/stylex/props';\n\nimport { styles } from './style';\nimport type { SurfaceProps } from './type';\n\n/**\n * Elevated card on a workspace canvas.
|
|
1
|
+
{"version":3,"file":"Surface.mjs","names":[],"sources":["../../../src/dashboard/Surface/Surface.tsx"],"sourcesContent":["'use client';\n\nimport './style.css';\n\nimport * as stylex from '@stylexjs/stylex';\nimport clsx from 'clsx';\nimport { ArrowUpRight } from 'lucide-react';\nimport type { ReactNode } from 'react';\n\nimport Skeleton from '@/Skeleton';\nimport Spin from '@/Spin';\nimport { styleProps } from '@/styles/stylex/props';\n\nimport { SurfaceDepthContext, useSurfaceCardStyles, useSurfaceDepth, useSurfaceLink } from './link';\nimport { surfaceMarker } from './marker.stylex';\nimport { styles, surfaceClassNames } from './style';\nimport type { SurfaceProps } from './type';\n\nconst defined = (node: ReactNode) => node !== null && node !== undefined && node !== false;\n\n/**\n * Elevated card on a workspace canvas. Bare, it is a plain frame. With `title`,\n * `description` or `extra` it gets a header and a padded body that lets a\n * trailing table meet the card edges.\n */\nfunction Surface({\n bleed = false,\n chart,\n children,\n className,\n description,\n extra,\n href,\n loading,\n padded,\n renderLink,\n style,\n title,\n ...rest\n}: SurfaceProps) {\n const depth = useSurfaceDepth();\n const link = useSurfaceLink(renderLink);\n const cardStyles = useSurfaceCardStyles();\n const refreshing = Boolean(loading) && defined(children);\n const placeholder = Boolean(loading) && !defined(children);\n const hasHeader = defined(title) || defined(description) || defined(extra) || refreshing;\n const pad = bleed ? false : (padded ?? (hasHeader || placeholder));\n const clip = hasHeader || bleed || pad || defined(chart);\n\n const heading = (\n <div {...stylex.props(styles.heading)}>\n {defined(title) ? <div {...stylex.props(styles.title)}>{title}</div> : null}\n {defined(description) ? <div {...stylex.props(styles.desc)}>{description}</div> : null}\n </div>\n );\n\n const body = placeholder ? (\n <div aria-busy=\"true\" {...stylex.props(styles.loading)}>\n <Skeleton height={220} radius={8} />\n </div>\n ) : (\n children\n );\n\n // With header actions, the arrow sits after them as the rightmost item.\n const trailing = refreshing || defined(extra);\n const arrow = (\n <ArrowUpRight\n aria-hidden\n size={16}\n {...stylex.props(styles.arrow, trailing && styles.arrowInLink)}\n />\n );\n\n return (\n <SurfaceDepthContext value={depth + 1}>\n <div\n {...styleProps(\n [\n cardStyles,\n styles.content,\n clip && styles.clip,\n Boolean(href) && [styles.cardLinked, surfaceMarker],\n ],\n clsx(surfaceClassNames.root, bleed && surfaceClassNames.bleed, className),\n style,\n )}\n {...rest}\n >\n {hasHeader ? (\n <div {...stylex.props(styles.header)}>\n {href\n ? link({\n children: (\n <>\n {heading}\n {trailing ? null : arrow}\n </>\n ),\n className: stylex.props(styles.headingLink).className,\n href,\n })\n : heading}\n {trailing ? (\n <div {...stylex.props(styles.extra)}>\n {refreshing ? <Spin size=\"small\" variant=\"network\" /> : null}\n {extra}\n {href\n ? link({\n 'aria-hidden': true,\n 'children': arrow,\n 'className': stylex.props(styles.arrowLink).className,\n href,\n 'tabIndex': -1,\n } as any)\n : null}\n </div>\n ) : null}\n </div>\n ) : null}\n {pad ? <div {...styleProps(styles.body, surfaceClassNames.tableBleed)}>{body}</div> : body}\n {defined(chart) ? <div {...stylex.props(styles.chart)}>{chart}</div> : null}\n </div>\n </SurfaceDepthContext>\n );\n}\n\nSurface.displayName = 'Surface';\n\nexport default Surface;\n"],"mappings":";;;;;;;;;;;;AAcA,MAAM,WAAW,SAAoB,SAAS,QAAQ,SAAS,KAAA,KAAa,SAAS;;;;;;AAOrF,SAAS,QAAQ,EACf,QAAQ,OACR,OACA,UACA,WACA,aACA,OACA,MACA,SACA,QACA,YACA,OACA,OACA,GAAG,QACY;CACf,MAAM,QAAQ,gBAAgB;CAC9B,MAAM,OAAO,eAAe,UAAU;CACtC,MAAM,aAAa,qBAAqB;CACxC,MAAM,aAAa,QAAQ,OAAO,KAAK,QAAQ,QAAQ;CACvD,MAAM,cAAc,QAAQ,OAAO,KAAK,CAAC,QAAQ,QAAQ;CACzD,MAAM,YAAY,QAAQ,KAAK,KAAK,QAAQ,WAAW,KAAK,QAAQ,KAAK,KAAK;CAC9E,MAAM,MAAM,QAAQ,QAAQ,WAAW,aAAa;CACpD,MAAM,OAAO,aAAa,SAAS,OAAO,QAAQ,KAAK;CACvD,MAAM,UAAU,qBAAC,OAAD;EAAK,GAAI,OAAO,MAAM,OAAO,OAAO;EAApC,UAAA,CACX,QAAQ,KAAK,IAAI,oBAAC,OAAD;GAAK,GAAI,OAAO,MAAM,OAAO,KAAK;GAAI,UAAA;EAAW,CAAA,IAAI,MACtE,QAAQ,WAAW,IAAI,oBAAC,OAAD;GAAK,GAAI,OAAO,MAAM,OAAO,IAAI;GAAI,UAAA;EAAiB,CAAA,IAAI,IAC/E;;CACP,MAAM,OAAO,cAAc,oBAAC,OAAD;EAAK,aAAU;EAAO,GAAI,OAAO,MAAM,OAAO,OAAO;EAC5E,UAAA,oBAAC,UAAD;GAAU,QAAQ;GAAK,QAAQ;EAAI,CAAA;CAChC,CAAA,IAAI;CAGX,MAAM,WAAW,cAAc,QAAQ,KAAK;CAC5C,MAAM,QAAQ,oBAAC,cAAD;EAAc,eAAA;EAAY,MAAM;EAAI,GAAI,OAAO,MAAM,OAAO,OAAO,YAAY,OAAO,WAAW;CAAI,CAAA;CACnH,OAAO,oBAAC,qBAAD;EAAqB,OAAO,QAAQ;EACvC,UAAA,qBAAC,OAAD;GAAK,GAAI,WAAW;IAAC;IAAY,OAAO;IAAS,QAAQ,OAAO;IAAM,QAAQ,IAAI,KAAK,CAAC,OAAO,YAAY,aAAa;GAAC,GAAG,KAAK,kBAAkB,MAAM,SAAS,kBAAkB,OAAO,SAAS,GAAG,KAAK;GAAG,GAAI;GAAnN,UAAA;IACG,YAAY,qBAAC,OAAD;KAAK,GAAI,OAAO,MAAM,OAAO,MAAM;KAAnC,UAAA,CACR,OAAO,KAAK;MACf,UAAU,qBAAA,UAAA,EAAA,UAAA,CACG,SACA,WAAW,OAAO,KACnB,EAAA,CAAA;MACZ,WAAW,OAAO,MAAM,OAAO,WAAW,CAAC,CAAC;MAC5C;KACF,CAAC,IAAI,SACA,WAAW,qBAAC,OAAD;MAAK,GAAI,OAAO,MAAM,OAAO,KAAK;MAAlC,UAAA;OACP,aAAa,oBAAC,MAAD;QAAM,MAAK;QAAQ,SAAQ;OAAW,CAAA,IAAI;OACvD;OACA,OAAO,KAAK;QACjB,eAAe;QACf,YAAY;QACZ,aAAa,OAAO,MAAM,OAAO,SAAS,CAAC,CAAC;QAC5C;QACA,YAAY;OACd,CAAQ,IAAI;MACH;KAAI,CAAA,IAAA,IACR;IAAI,CAAA,IAAA;IACV,MAAM,oBAAC,OAAD;KAAK,GAAI,WAAW,OAAO,MAAM,kBAAkB,UAAU;KAAI,UAAA;IAAU,CAAA,IAAI;IACrF,QAAQ,KAAK,IAAI,oBAAC,OAAD;KAAK,GAAI,OAAO,MAAM,OAAO,KAAK;KAAI,UAAA;IAAW,CAAA,IAAI;GACpE;;CACc,CAAA;AACzB;AACA,QAAQ,cAAc"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { SurfaceLinkProps, SurfaceProps, SurfaceRenderLink } from "./type.mjs";
|
|
2
|
+
import { SurfaceLinkProvider, useSurfaceCardClassName, useSurfaceDepth, useSurfaceLink } from "./link.mjs";
|
|
1
3
|
import { surfaceStyles } from "./style.mjs";
|
|
2
|
-
import { SurfaceProps } from "./type.mjs";
|
|
3
4
|
import Surface from "./Surface.mjs";
|
|
4
|
-
export { type SurfaceProps, Surface as default, surfaceStyles };
|
|
5
|
+
export { type SurfaceLinkProps, SurfaceLinkProvider, type SurfaceProps, type SurfaceRenderLink, Surface as default, surfaceStyles, useSurfaceCardClassName, useSurfaceDepth, useSurfaceLink };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SurfaceRenderLink } from "./type.mjs";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import "@stylexjs/stylex";
|
|
4
|
+
//#region src/dashboard/Surface/link.d.ts
|
|
5
|
+
/** Plugs the app router into every dashboard card link (Surface, MetricStrip, Section). */
|
|
6
|
+
export declare const SurfaceLinkProvider: ({ children, renderLink }: {
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
renderLink: SurfaceRenderLink;
|
|
9
|
+
}) => import("react").JSX.Element;
|
|
10
|
+
export declare const useSurfaceLink: (override?: SurfaceRenderLink) => SurfaceRenderLink;
|
|
11
|
+
/** How many Surface cards wrap this node. A table can skip its own card when already inside one. */
|
|
12
|
+
export declare const useSurfaceDepth: () => number;
|
|
13
|
+
/** Class name form of `useSurfaceCardStyles`, for markup that is not styled with StyleX. */
|
|
14
|
+
export declare const useSurfaceCardClassName: () => string;
|
|
15
|
+
//#endregion
|
|
16
|
+
//# sourceMappingURL=link.d.mts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useThemeMode } from "../../styles/theme/scope.mjs";
|
|
3
|
+
import { styles } from "./style.mjs";
|
|
4
|
+
import { createContext, use } from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import * as stylex from "@stylexjs/stylex";
|
|
7
|
+
//#region src/dashboard/Surface/link.tsx
|
|
8
|
+
const defaultRenderLink = ({ children, ...rest }) => /* @__PURE__ */ jsx("a", {
|
|
9
|
+
...rest,
|
|
10
|
+
children
|
|
11
|
+
});
|
|
12
|
+
const SurfaceLinkContext = createContext(defaultRenderLink);
|
|
13
|
+
const SurfaceDepthContext = createContext(0);
|
|
14
|
+
/** Plugs the app router into every dashboard card link (Surface, MetricStrip, Section). */
|
|
15
|
+
const SurfaceLinkProvider = ({ children, renderLink }) => /* @__PURE__ */ jsx(SurfaceLinkContext, {
|
|
16
|
+
value: renderLink,
|
|
17
|
+
children
|
|
18
|
+
});
|
|
19
|
+
const useSurfaceLink = (override) => override ?? use(SurfaceLinkContext);
|
|
20
|
+
/** How many Surface cards wrap this node. A table can skip its own card when already inside one. */
|
|
21
|
+
const useSurfaceDepth = () => use(SurfaceDepthContext);
|
|
22
|
+
/**
|
|
23
|
+
* StyleX styles for a dashboard card: `colorBgContainer` in light, translucent
|
|
24
|
+
* `colorFillTertiary` in dark, and no fill of its own when nested in another Surface.
|
|
25
|
+
*/
|
|
26
|
+
const useSurfaceCardStyles = () => {
|
|
27
|
+
const { isDarkMode } = useThemeMode();
|
|
28
|
+
const depth = useSurfaceDepth();
|
|
29
|
+
return [
|
|
30
|
+
styles.card,
|
|
31
|
+
isDarkMode && styles.cardDark,
|
|
32
|
+
depth > 0 && styles.cardNested
|
|
33
|
+
];
|
|
34
|
+
};
|
|
35
|
+
/** Class name form of `useSurfaceCardStyles`, for markup that is not styled with StyleX. */
|
|
36
|
+
const useSurfaceCardClassName = () => stylex.props(useSurfaceCardStyles()).className ?? "";
|
|
37
|
+
//#endregion
|
|
38
|
+
export { SurfaceDepthContext, SurfaceLinkProvider, useSurfaceCardClassName, useSurfaceCardStyles, useSurfaceDepth, useSurfaceLink };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=link.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.mjs","names":[],"sources":["../../../src/dashboard/Surface/link.tsx"],"sourcesContent":["'use client';\n\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, type ReactNode, use } from 'react';\n\nimport { useThemeMode } from '@/styles/theme/scope';\n\nimport { styles } from './style';\nimport type { SurfaceLinkProps, SurfaceRenderLink } from './type';\n\nconst defaultRenderLink: SurfaceRenderLink = ({ children, ...rest }: SurfaceLinkProps) => (\n <a {...rest}>{children}</a>\n);\n\nconst SurfaceLinkContext = createContext<SurfaceRenderLink>(defaultRenderLink);\n\nconst SurfaceDepthContext = createContext(0);\n\n/** Plugs the app router into every dashboard card link (Surface, MetricStrip, Section). */\nexport const SurfaceLinkProvider = ({\n children,\n renderLink,\n}: {\n children?: ReactNode;\n renderLink: SurfaceRenderLink;\n}) => <SurfaceLinkContext value={renderLink}>{children}</SurfaceLinkContext>;\n\nexport const useSurfaceLink = (override?: SurfaceRenderLink) => override ?? use(SurfaceLinkContext);\n\n/** How many Surface cards wrap this node. A table can skip its own card when already inside one. */\nexport const useSurfaceDepth = () => use(SurfaceDepthContext);\n\nexport { SurfaceDepthContext };\n\n/**\n * StyleX styles for a dashboard card: `colorBgContainer` in light, translucent\n * `colorFillTertiary` in dark, and no fill of its own when nested in another Surface.\n */\nexport const useSurfaceCardStyles = () => {\n const { isDarkMode } = useThemeMode();\n const depth = useSurfaceDepth();\n return [styles.card, isDarkMode && styles.cardDark, depth > 0 && styles.cardNested] as const;\n};\n\n/** Class name form of `useSurfaceCardStyles`, for markup that is not styled with StyleX. */\nexport const useSurfaceCardClassName = () => stylex.props(useSurfaceCardStyles()).className ?? '';\n"],"mappings":";;;;;;;AAOA,MAAM,qBAAwC,EAC5C,UACA,GAAG,WACmB,oBAAC,KAAD;CAAG,GAAI;CAAO;AAAY,CAAA;AAClD,MAAM,qBAAqB,cAAiC,iBAAiB;AAC7E,MAAM,sBAAsB,cAAc,CAAC;;AAG3C,MAAa,uBAAuB,EAClC,UACA,iBAII,oBAAC,oBAAD;CAAoB,OAAO;CAAa;AAA6B,CAAA;AAC3E,MAAa,kBAAkB,aAAiC,YAAY,IAAI,kBAAkB;;AAGlG,MAAa,wBAAwB,IAAI,mBAAmB;;;;;AAO5D,MAAa,6BAA6B;CACxC,MAAM,EACJ,eACE,aAAa;CACjB,MAAM,QAAQ,gBAAgB;CAC9B,OAAO;EAAC,OAAO;EAAM,cAAc,OAAO;EAAU,QAAQ,KAAK,OAAO;CAAU;AACpF;;AAGA,MAAa,gCAAgC,OAAO,MAAM,qBAAqB,CAAC,CAAC,CAAC,aAAa"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marker.stylex.mjs","names":[],"sources":["../../../src/dashboard/Surface/marker.stylex.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\n\nexport const surfaceMarker = stylex.defineMarker();\n"],"mappings":";AACA,MAAa,gBAAgB;CAC3B,UAAU;CACV,OAAO;AACT"}
|