@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
|
@@ -3,10 +3,10 @@ import { styleProps } from "../../styles/stylex/props.mjs";
|
|
|
3
3
|
import Button from "../../Button/Button.mjs";
|
|
4
4
|
import Drawer from "../../Drawer/Drawer.mjs";
|
|
5
5
|
import DraggablePanel from "../../DraggablePanel/DraggablePanel.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { useSurfaceCardStyles } from "../Surface/link.mjs";
|
|
7
7
|
import { useIsCompact, useLocalStorage } from "../hooks.mjs";
|
|
8
8
|
import { FilterSplitProvider } from "./context.mjs";
|
|
9
|
-
import { styles
|
|
9
|
+
import { styles } from "./style.mjs";
|
|
10
10
|
import { clampSidebarWidth, sidebarWidth } from "./width.mjs";
|
|
11
11
|
import { useState } from "react";
|
|
12
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -37,6 +37,7 @@ function usePageSidebar(wide, storageKey) {
|
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
function FilterSidebar({ body, children, flush, head, header, label, storageKey, summary, wide }) {
|
|
40
|
+
const cardStyles = useSurfaceCardStyles();
|
|
40
41
|
const isCompact = useIsCompact();
|
|
41
42
|
const [drawerOpen, setDrawerOpen] = useState(false);
|
|
42
43
|
const sidebar = usePageSidebar(wide, storageKey);
|
|
@@ -44,7 +45,7 @@ function FilterSidebar({ body, children, flush, head, header, label, storageKey,
|
|
|
44
45
|
if (isCompact) return /* @__PURE__ */ jsx(FilterSplitProvider, {
|
|
45
46
|
active: !flush,
|
|
46
47
|
children: /* @__PURE__ */ jsxs("div", {
|
|
47
|
-
...stylex.props(styles
|
|
48
|
+
...stylex.props(styles.layout),
|
|
48
49
|
children: [
|
|
49
50
|
header,
|
|
50
51
|
/* @__PURE__ */ jsx(Button, {
|
|
@@ -60,12 +61,12 @@ function FilterSidebar({ body, children, flush, head, header, label, storageKey,
|
|
|
60
61
|
width: 300,
|
|
61
62
|
onClose: close,
|
|
62
63
|
children: /* @__PURE__ */ jsxs("div", {
|
|
63
|
-
...stylex.props(styles
|
|
64
|
+
...stylex.props(styles.drawerPanel),
|
|
64
65
|
children: [head?.(close), body(close)]
|
|
65
66
|
})
|
|
66
67
|
}),
|
|
67
68
|
/* @__PURE__ */ jsx("div", {
|
|
68
|
-
...styleProps(styles
|
|
69
|
+
...styleProps(styles.content, contentClassName),
|
|
69
70
|
children
|
|
70
71
|
})
|
|
71
72
|
]
|
|
@@ -74,7 +75,7 @@ function FilterSidebar({ body, children, flush, head, header, label, storageKey,
|
|
|
74
75
|
return /* @__PURE__ */ jsx(FilterSplitProvider, {
|
|
75
76
|
active: !flush,
|
|
76
77
|
children: /* @__PURE__ */ jsxs("div", {
|
|
77
|
-
...stylex.props(styles
|
|
78
|
+
...stylex.props(styles.layout, flush ? styles.layoutFlush : [cardStyles, styles.layoutSplit]),
|
|
78
79
|
"data-flush": flush ? true : void 0,
|
|
79
80
|
"data-page-layout": flush ? "flush" : void 0,
|
|
80
81
|
"data-split-card": flush ? void 0 : true,
|
|
@@ -82,7 +83,7 @@ function FilterSidebar({ body, children, flush, head, header, label, storageKey,
|
|
|
82
83
|
expandable: true,
|
|
83
84
|
showHandleWhenCollapsed: true,
|
|
84
85
|
"aria-label": label,
|
|
85
|
-
className: stylex.props(styles
|
|
86
|
+
className: stylex.props(styles.sidebar, flush && styles.sidebarFlush).className,
|
|
86
87
|
collapseThreshold: sidebarWidth.collapse,
|
|
87
88
|
"data-flush": flush ? true : void 0,
|
|
88
89
|
defaultSize: { width: wide ? sidebarWidth.wide : sidebarWidth.narrow },
|
|
@@ -93,20 +94,20 @@ function FilterSidebar({ body, children, flush, head, header, label, storageKey,
|
|
|
93
94
|
placement: "left",
|
|
94
95
|
showBorder: false,
|
|
95
96
|
size: { width: sidebar.width },
|
|
96
|
-
classNames: { content: stylex.props(styles
|
|
97
|
+
classNames: { content: stylex.props(styles.panel, !flush && styles.panelSplit).className },
|
|
97
98
|
onExpandChange: sidebar.onExpandChange,
|
|
98
99
|
onSizeChange: (_delta, size) => sidebar.onSizeChange(size),
|
|
99
100
|
children: [head ? /* @__PURE__ */ jsx("div", {
|
|
100
|
-
...stylex.props(styles
|
|
101
|
+
...stylex.props(styles.head),
|
|
101
102
|
children: head(close)
|
|
102
103
|
}) : null, /* @__PURE__ */ jsx("div", {
|
|
103
104
|
"data-flush": flush ? true : void 0,
|
|
104
|
-
...stylex.props(styles
|
|
105
|
+
...stylex.props(styles.body, flush && styles.bodyFlush),
|
|
105
106
|
children: body(close)
|
|
106
107
|
})]
|
|
107
108
|
}), /* @__PURE__ */ jsxs("div", {
|
|
108
109
|
"data-flush": flush ? true : void 0,
|
|
109
|
-
...styleProps([styles
|
|
110
|
+
...styleProps([styles.content, flush ? styles.contentFlush : styles.contentSplit], contentClassName),
|
|
110
111
|
children: [header, children]
|
|
111
112
|
})]
|
|
112
113
|
})
|
|
@@ -115,12 +116,12 @@ function FilterSidebar({ body, children, flush, head, header, label, storageKey,
|
|
|
115
116
|
FilterSidebar.displayName = "FilterSidebar";
|
|
116
117
|
function FilterRow({ count, name }) {
|
|
117
118
|
return /* @__PURE__ */ jsxs("span", {
|
|
118
|
-
...stylex.props(styles
|
|
119
|
+
...stylex.props(styles.row),
|
|
119
120
|
children: [/* @__PURE__ */ jsx("span", {
|
|
120
|
-
...stylex.props(styles
|
|
121
|
+
...stylex.props(styles.name),
|
|
121
122
|
children: name
|
|
122
123
|
}), count !== void 0 ? /* @__PURE__ */ jsx("span", {
|
|
123
|
-
...stylex.props(styles
|
|
124
|
+
...stylex.props(styles.count),
|
|
124
125
|
children: count
|
|
125
126
|
}) : null]
|
|
126
127
|
});
|
|
@@ -133,15 +134,15 @@ function FilterOption({ count, icon, label, name, onClick, selected, title }) {
|
|
|
133
134
|
title,
|
|
134
135
|
type: "button",
|
|
135
136
|
onClick,
|
|
136
|
-
...stylex.props(styles
|
|
137
|
+
...stylex.props(styles.option),
|
|
137
138
|
children: [
|
|
138
139
|
icon,
|
|
139
140
|
/* @__PURE__ */ jsx("span", {
|
|
140
|
-
...stylex.props(styles
|
|
141
|
+
...stylex.props(styles.name),
|
|
141
142
|
children: name
|
|
142
143
|
}),
|
|
143
144
|
count !== void 0 ? /* @__PURE__ */ jsx("span", {
|
|
144
|
-
...stylex.props(styles
|
|
145
|
+
...stylex.props(styles.count),
|
|
145
146
|
children: count
|
|
146
147
|
}) : null
|
|
147
148
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterSidebar.mjs","names":[
|
|
1
|
+
{"version":3,"file":"FilterSidebar.mjs","names":[],"sources":["../../../src/dashboard/FilterSidebar/FilterSidebar.tsx"],"sourcesContent":["'use client';\n\nimport './style.css';\n\nimport * as stylex from '@stylexjs/stylex';\nimport { Filter } from 'lucide-react';\nimport { useState } from 'react';\n\nimport Button from '@/Button';\nimport { DraggablePanel } from '@/DraggablePanel';\nimport { Drawer } from '@/Drawer';\nimport { styleProps } from '@/styles/stylex/props';\n\nimport { useIsCompact, useLocalStorage } from '../hooks';\nimport { useSurfaceCardStyles } from '../Surface/link';\nimport { FilterSplitProvider } from './context';\nimport { styles } from './style';\nimport type { FilterOptionProps, FilterRowProps, FilterSidebarProps } from './type';\nimport { clampSidebarWidth, sidebarWidth } from './width';\n\nconst contentClassName = 'lobe-filter-sidebar-content';\n\nfunction usePageSidebar(wide: boolean | undefined, storageKey: string | undefined) {\n const fallback = wide ? sidebarWidth.wide : sidebarWidth.narrow;\n const [prefs, setPrefs] = useLocalStorage<{ expand?: boolean; width?: number }>(storageKey, {\n expand: true,\n width: fallback,\n });\n return {\n expand: prefs.expand !== false,\n onExpandChange: (expand: boolean) => setPrefs((current) => ({ ...current, expand })),\n onSizeChange: (size: { width?: number | string }) => {\n const next = typeof size.width === 'number' ? size.width : fallback;\n setPrefs((current) => ({ ...current, width: clampSidebarWidth(next, fallback) }));\n },\n width: clampSidebarWidth(Number(prefs.width), fallback),\n };\n}\n\nfunction FilterSidebar({\n body,\n children,\n flush,\n head,\n header,\n label,\n storageKey,\n summary,\n wide,\n}: FilterSidebarProps) {\n const cardStyles = useSurfaceCardStyles();\n const isCompact = useIsCompact();\n const [drawerOpen, setDrawerOpen] = useState(false);\n const sidebar = usePageSidebar(wide, storageKey);\n const close = () => setDrawerOpen(false);\n\n if (isCompact) {\n return (\n <FilterSplitProvider active={!flush}>\n <div {...stylex.props(styles.layout)}>\n {header}\n <Button block icon={Filter} onClick={() => setDrawerOpen(true)}>\n {summary}\n </Button>\n <Drawer open={drawerOpen} placement=\"left\" title={label} width={300} onClose={close}>\n <div {...stylex.props(styles.drawerPanel)}>\n {head?.(close)}\n {body(close)}\n </div>\n </Drawer>\n <div {...styleProps(styles.content, contentClassName)}>{children}</div>\n </div>\n </FilterSplitProvider>\n );\n }\n\n return (\n <FilterSplitProvider active={!flush}>\n <div\n {...stylex.props(\n styles.layout,\n flush ? styles.layoutFlush : [cardStyles, styles.layoutSplit],\n )}\n data-flush={flush ? true : undefined}\n data-page-layout={flush ? 'flush' : undefined}\n data-split-card={flush ? undefined : true}\n >\n <DraggablePanel\n expandable\n showHandleWhenCollapsed\n aria-label={label}\n className={stylex.props(styles.sidebar, flush && styles.sidebarFlush).className}\n collapseThreshold={sidebarWidth.collapse}\n data-flush={flush ? true : undefined}\n defaultSize={{ width: wide ? sidebarWidth.wide : sidebarWidth.narrow }}\n expand={sidebar.expand}\n maxWidth={sidebarWidth.max}\n minWidth={sidebarWidth.min}\n mode=\"fixed\"\n placement=\"left\"\n showBorder={false}\n size={{ width: sidebar.width }}\n classNames={{\n content: stylex.props(styles.panel, !flush && styles.panelSplit).className,\n }}\n onExpandChange={sidebar.onExpandChange}\n onSizeChange={(_delta, size) => sidebar.onSizeChange(size)}\n >\n {head ? <div {...stylex.props(styles.head)}>{head(close)}</div> : null}\n <div\n data-flush={flush ? true : undefined}\n {...stylex.props(styles.body, flush && styles.bodyFlush)}\n >\n {body(close)}\n </div>\n </DraggablePanel>\n <div\n data-flush={flush ? true : undefined}\n {...styleProps(\n [styles.content, flush ? styles.contentFlush : styles.contentSplit],\n contentClassName,\n )}\n >\n {header}\n {children}\n </div>\n </div>\n </FilterSplitProvider>\n );\n}\n\nFilterSidebar.displayName = 'FilterSidebar';\n\nfunction FilterRow({ count, name }: FilterRowProps) {\n return (\n <span {...stylex.props(styles.row)}>\n <span {...stylex.props(styles.name)}>{name}</span>\n {count !== undefined ? <span {...stylex.props(styles.count)}>{count}</span> : null}\n </span>\n );\n}\n\nFilterRow.displayName = 'FilterRow';\n\nfunction FilterOption({ count, icon, label, name, onClick, selected, title }: FilterOptionProps) {\n return (\n <button\n aria-label={label}\n aria-pressed={selected}\n title={title}\n type=\"button\"\n onClick={onClick}\n {...stylex.props(styles.option)}\n >\n {icon}\n <span {...stylex.props(styles.name)}>{name}</span>\n {count !== undefined ? <span {...stylex.props(styles.count)}>{count}</span> : null}\n </button>\n );\n}\n\nFilterOption.displayName = 'FilterOption';\n\nexport { FilterOption, FilterRow };\nexport default FilterSidebar;\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,MAAM,mBAAmB;AACzB,SAAS,eAAe,MAA2B,YAAgC;CACjF,MAAM,WAAW,OAAO,aAAa,OAAO,aAAa;CACzD,MAAM,CAAC,OAAO,YAAY,gBAGvB,YAAY;EACb,QAAQ;EACR,OAAO;CACT,CAAC;CACD,OAAO;EACL,QAAQ,MAAM,WAAW;EACzB,iBAAiB,WAAoB,UAAS,aAAY;GACxD,GAAG;GACH;EACF,EAAE;EACF,eAAe,SAET;GACJ,MAAM,OAAO,OAAO,KAAK,UAAU,WAAW,KAAK,QAAQ;GAC3D,UAAS,aAAY;IACnB,GAAG;IACH,OAAO,kBAAkB,MAAM,QAAQ;GACzC,EAAE;EACJ;EACA,OAAO,kBAAkB,OAAO,MAAM,KAAK,GAAG,QAAQ;CACxD;AACF;AACA,SAAS,cAAc,EACrB,MACA,UACA,OACA,MACA,QACA,OACA,YACA,SACA,QACqB;CACrB,MAAM,aAAa,qBAAqB;CACxC,MAAM,YAAY,aAAa;CAC/B,MAAM,CAAC,YAAY,iBAAiB,SAAS,KAAK;CAClD,MAAM,UAAU,eAAe,MAAM,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C,QAAD;IAAM,GAAI,OAAO,MAAM,OAAO,KAAK;IAAI,UAAA;GAAY,CAAA,IAAI;EACxE;;AACZ;AACA,aAAa,cAAc"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FilterStripProps } from "./type.mjs";
|
|
2
|
+
//#region src/dashboard/FilterStrip/FilterStrip.d.ts
|
|
3
|
+
export declare const formatInteger: (count: number) => string;
|
|
4
|
+
/** One surface of selectable counts. Peer filters share a seam instead of a row of equal cards. */
|
|
5
|
+
declare const FilterStrip: {
|
|
6
|
+
({ emptyText, formatCount, items, label, onChange, value }: FilterStripProps): import("react").JSX.Element;
|
|
7
|
+
displayName: string;
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { FilterStrip as default };
|
|
11
|
+
//# sourceMappingURL=FilterStrip.d.mts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import Skeleton from "../../Skeleton/index.mjs";
|
|
3
|
+
import { styles } from "../Surface/style.mjs";
|
|
4
|
+
import Surface from "../Surface/Surface.mjs";
|
|
5
|
+
import { styles as styles$1 } from "./style.mjs";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import * as stylex from "@stylexjs/stylex";
|
|
8
|
+
//#region src/dashboard/FilterStrip/FilterStrip.tsx
|
|
9
|
+
const countStyles = {
|
|
10
|
+
danger: styles$1.countDanger,
|
|
11
|
+
warning: styles$1.countWarning
|
|
12
|
+
};
|
|
13
|
+
const integerFormat = new Intl.NumberFormat("en-US", { maximumFractionDigits: 0 });
|
|
14
|
+
const formatInteger = (count) => integerFormat.format(count);
|
|
15
|
+
/** One surface of selectable counts. Peer filters share a seam instead of a row of equal cards. */
|
|
16
|
+
const FilterStrip = ({ emptyText = "--", formatCount = formatInteger, items, label, onChange, value }) => /* @__PURE__ */ jsx(Surface, {
|
|
17
|
+
className: stylex.props(styles.clip).className,
|
|
18
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
19
|
+
"aria-label": label,
|
|
20
|
+
role: "radiogroup",
|
|
21
|
+
...stylex.props(styles$1.frame),
|
|
22
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
23
|
+
...stylex.props(styles$1.grid),
|
|
24
|
+
children: items.map((item) => {
|
|
25
|
+
const active = item.key === value;
|
|
26
|
+
const missing = item.count === void 0 || item.count === null;
|
|
27
|
+
const emphasize = item.tone && typeof item.count === "number" && item.count > 0;
|
|
28
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
29
|
+
"aria-checked": active,
|
|
30
|
+
role: "radio",
|
|
31
|
+
title: item.hint,
|
|
32
|
+
type: "button",
|
|
33
|
+
onClick: () => onChange(item.key),
|
|
34
|
+
...stylex.props(styles$1.cell, active && styles$1.cellActive),
|
|
35
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
36
|
+
...stylex.props(styles$1.label, active && styles$1.labelActive),
|
|
37
|
+
children: item.label
|
|
38
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
39
|
+
...stylex.props(styles$1.count, emphasize && countStyles[item.tone]),
|
|
40
|
+
children: item.loading ? /* @__PURE__ */ jsx(Skeleton, {
|
|
41
|
+
height: 22,
|
|
42
|
+
radius: 6,
|
|
43
|
+
width: 48
|
|
44
|
+
}) : missing ? emptyText : formatCount(item.count)
|
|
45
|
+
})]
|
|
46
|
+
}, item.key);
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
FilterStrip.displayName = "FilterStrip";
|
|
52
|
+
//#endregion
|
|
53
|
+
export { FilterStrip as default, formatInteger };
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=FilterStrip.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterStrip.mjs","names":["styles","surfaceStyles"],"sources":["../../../src/dashboard/FilterStrip/FilterStrip.tsx"],"sourcesContent":["'use client';\n\nimport * as stylex from '@stylexjs/stylex';\n\nimport Skeleton from '@/Skeleton';\n\nimport { styles as surfaceStyles } from '../Surface/style';\nimport Surface from '../Surface/Surface';\nimport { styles } from './style';\nimport type { FilterStripProps } from './type';\n\nconst countStyles = {\n danger: styles.countDanger,\n warning: styles.countWarning,\n} as const;\n\nconst integerFormat = new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 });\n\nexport const formatInteger = (count: number) => integerFormat.format(count);\n\n/** One surface of selectable counts. Peer filters share a seam instead of a row of equal cards. */\nconst FilterStrip = ({\n emptyText = '--',\n formatCount = formatInteger,\n items,\n label,\n onChange,\n value,\n}: FilterStripProps) => (\n <Surface className={stylex.props(surfaceStyles.clip).className}>\n <div aria-label={label} role=\"radiogroup\" {...stylex.props(styles.frame)}>\n <div {...stylex.props(styles.grid)}>\n {items.map((item) => {\n const active = item.key === value;\n const missing = item.count === undefined || item.count === null;\n const emphasize = item.tone && typeof item.count === 'number' && item.count > 0;\n\n return (\n <button\n aria-checked={active}\n key={item.key}\n role=\"radio\"\n title={item.hint}\n type=\"button\"\n onClick={() => onChange(item.key)}\n {...stylex.props(styles.cell, active && styles.cellActive)}\n >\n <span {...stylex.props(styles.label, active && styles.labelActive)}>\n {item.label}\n </span>\n <span {...stylex.props(styles.count, emphasize && countStyles[item.tone!])}>\n {item.loading ? (\n <Skeleton height={22} radius={6} width={48} />\n ) : missing ? (\n emptyText\n ) : (\n formatCount(item.count!)\n )}\n </span>\n </button>\n );\n })}\n </div>\n </div>\n </Surface>\n);\n\nFilterStrip.displayName = 'FilterStrip';\n\nexport default FilterStrip;\n"],"mappings":";;;;;;;;AAQA,MAAM,cAAc;CAClB,QAAQA,SAAO;CACf,SAASA,SAAO;AAClB;AACA,MAAM,gBAAgB,IAAI,KAAK,aAAa,SAAS,EACnD,uBAAuB,EACzB,CAAC;AACD,MAAa,iBAAiB,UAAkB,cAAc,OAAO,KAAK;;AAG1E,MAAM,eAAe,EACnB,YAAY,MACZ,cAAc,eACd,OACA,OACA,UACA,YACsB,oBAAC,SAAD;CAAS,W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b1hr3lfm",
|
|
9
|
+
kGNEyG: "lb1cy8zhl",
|
|
10
|
+
kWkggS: "lbjbqb8w lbql1cz1",
|
|
11
|
+
kGVxlE: "lb11szn1f",
|
|
12
|
+
kMwMTN: "lb1heor9g",
|
|
13
|
+
kkrTdU: "lb1ypdohk",
|
|
14
|
+
k1xSpc: "lb78zum5",
|
|
15
|
+
kXwgrk: "lbdt5ytf",
|
|
16
|
+
k7Eaqz: "lbeuugli",
|
|
17
|
+
kGO01o: "lb1l90r2v",
|
|
18
|
+
kLKAdn: "lbyinxu5",
|
|
19
|
+
kVAEAm: "lb1n2onr6",
|
|
20
|
+
k9WMMc: "lb1yc453h",
|
|
21
|
+
kcktkL: "lbb7ltuz",
|
|
22
|
+
ks3ayO: "lbyhc2n1",
|
|
23
|
+
k4zj60: "lbar2jh8",
|
|
24
|
+
k5JduY: "lb1s928wv",
|
|
25
|
+
k8Iv0R: "lbexwc5z",
|
|
26
|
+
kwXMNM: "lb1j6awrg",
|
|
27
|
+
$$css: true
|
|
28
|
+
},
|
|
29
|
+
cellActive: {
|
|
30
|
+
kWkggS: "lbaljia1",
|
|
31
|
+
ks3ayO: "lb1qvhnq6",
|
|
32
|
+
$$css: true
|
|
33
|
+
},
|
|
34
|
+
count: {
|
|
35
|
+
kMwMTN: "lb66ogz0",
|
|
36
|
+
kGuDYH: "lb1x0ry8x",
|
|
37
|
+
kcqcaj: "lbss6m8b",
|
|
38
|
+
k63SB2: "lb1s688f",
|
|
39
|
+
kLWn49: "lb1uo3zyz",
|
|
40
|
+
$$css: true
|
|
41
|
+
},
|
|
42
|
+
countDanger: {
|
|
43
|
+
kMwMTN: "lb12ap7uz",
|
|
44
|
+
$$css: true
|
|
45
|
+
},
|
|
46
|
+
countWarning: {
|
|
47
|
+
kMwMTN: "lbgyvj36",
|
|
48
|
+
$$css: true
|
|
49
|
+
},
|
|
50
|
+
frame: {
|
|
51
|
+
"--filter-seam": "lb1osd58z",
|
|
52
|
+
kaIpWk: "lb1pjcqnp",
|
|
53
|
+
kVQacm: "lbb3r6kr",
|
|
54
|
+
$$css: true
|
|
55
|
+
},
|
|
56
|
+
grid: {
|
|
57
|
+
k1xSpc: "lbrvj5dj",
|
|
58
|
+
kumcoG: "lbwqfyl0",
|
|
59
|
+
kzqmXN: "lbjl7whj",
|
|
60
|
+
k1K539: "lb1jyxor1",
|
|
61
|
+
$$css: true
|
|
62
|
+
},
|
|
63
|
+
label: {
|
|
64
|
+
kMwMTN: "lbc77et8",
|
|
65
|
+
kGuDYH: "lb4z9k3i",
|
|
66
|
+
k63SB2: "lbk50ysn",
|
|
67
|
+
kLWn49: "lb37zpob",
|
|
68
|
+
$$css: true
|
|
69
|
+
},
|
|
70
|
+
labelActive: {
|
|
71
|
+
kMwMTN: "lb66ogz0",
|
|
72
|
+
$$css: true
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
//#endregion
|
|
76
|
+
export { styles };
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=style.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.mjs","names":[],"sources":["../../../src/dashboard/FilterStrip/style.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\n\nimport { cssVar } from '@/styles/stylex/cssVar.stylex';\n\nexport const styles = stylex.create({\n cell: {\n 'font': 'inherit',\n 'margin': 0,\n 'borderWidth': 0,\n 'gap': 6,\n 'paddingInline': 16,\n 'alignItems': 'flex-start',\n 'backgroundColor': { 'default': 'transparent', ':hover': cssVar.colorFillQuaternary },\n 'boxShadow': 'inset -1px 0 0 var(--filter-seam), inset 0 -1px 0 var(--filter-seam)',\n 'color': 'inherit',\n 'cursor': 'pointer',\n 'display': 'flex',\n 'flexDirection': 'column',\n 'minInlineSize': 0,\n 'paddingBlockEnd': 16,\n 'paddingBlockStart': 14,\n 'position': 'relative',\n 'textAlign': 'start',\n '::after': {\n insetInline: 0,\n backgroundColor: 'transparent',\n blockSize: 3,\n content: '\"\"',\n insetBlockEnd: 1,\n position: 'absolute',\n },\n },\n cellActive: {\n 'backgroundColor': cssVar.colorFillTertiary,\n '::after': {\n backgroundColor: cssVar.colorText,\n },\n },\n count: {\n color: cssVar.colorText,\n fontSize: cssVar.fontSizeHeading4,\n fontVariantNumeric: 'tabular-nums',\n fontWeight: 600,\n lineHeight: 1.15,\n },\n countDanger: {\n color: cssVar.colorError,\n },\n countWarning: {\n color: cssVar.colorWarning,\n },\n frame: {\n '--filter-seam': cssVar.colorFillSecondary,\n 'borderRadius': 'inherit',\n 'overflow': 'hidden',\n },\n grid: {\n display: 'grid',\n gridTemplateColumns: 'repeat(auto-fit, minmax(148px, 1fr))',\n inlineSize: 'calc(100% + 1px)',\n marginBlockEnd: -1,\n },\n label: {\n color: cssVar.colorTextSecondary,\n fontSize: 13,\n fontWeight: 500,\n lineHeight: 1.4,\n },\n labelActive: {\n color: cssVar.colorText,\n },\n});\n"],"mappings":";AAGA,MAAa,SAAS;CACpB,MAAM;EACJ,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,YAAY;EACV,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,OAAO;EACL,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,aAAa;EACX,QAAQ;EACR,OAAO;CACT;CACA,cAAc;EACZ,QAAQ;EACR,OAAO;CACT;CACA,OAAO;EACL,iBAAiB;EACjB,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,MAAM;EACJ,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,OAAO;EACL,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,OAAO;CACT;CACA,aAAa;EACX,QAAQ;EACR,OAAO;CACT;AACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
//#region src/dashboard/FilterStrip/type.d.ts
|
|
3
|
+
export interface FilterStripItem {
|
|
4
|
+
count?: number;
|
|
5
|
+
/** Shown as the control's title. Definitions stay off the number so the row can be scanned. */
|
|
6
|
+
hint?: string;
|
|
7
|
+
key: string;
|
|
8
|
+
label: ReactNode;
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
/** Colors the count only when it is greater than zero; a zero is not an incident. */
|
|
11
|
+
tone?: 'danger' | 'warning';
|
|
12
|
+
}
|
|
13
|
+
export interface FilterStripProps {
|
|
14
|
+
/** Shown when an item has no count. Defaults to `--`. */
|
|
15
|
+
emptyText?: ReactNode;
|
|
16
|
+
/** Formats a count. Defaults to a grouped integer, e.g. `12,345`. */
|
|
17
|
+
formatCount?: (count: number) => ReactNode;
|
|
18
|
+
items: FilterStripItem[];
|
|
19
|
+
/** Accessible name for the radio group. */
|
|
20
|
+
label: string;
|
|
21
|
+
onChange: (key: string) => void;
|
|
22
|
+
value: string;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//# sourceMappingURL=type.d.mts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LabelWithKeyProps } from "./type.mjs";
|
|
2
|
+
//#region src/dashboard/LabelWithKey/LabelWithKey.d.ts
|
|
3
|
+
/** A human label followed by its machine key as a tag. */
|
|
4
|
+
declare const LabelWithKey: {
|
|
5
|
+
({ tag, title, ...rest }: LabelWithKeyProps): import("react").JSX.Element;
|
|
6
|
+
displayName: string;
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { LabelWithKey as default };
|
|
10
|
+
//# sourceMappingURL=LabelWithKey.d.mts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import FlexBasic_default from "../../Flex/FlexBasic.mjs";
|
|
3
|
+
import Tag from "../../Tag/Tag.mjs";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/dashboard/LabelWithKey/LabelWithKey.tsx
|
|
6
|
+
/** A human label followed by its machine key as a tag. */
|
|
7
|
+
const LabelWithKey = ({ tag, title, ...rest }) => /* @__PURE__ */ jsxs(FlexBasic_default, {
|
|
8
|
+
horizontal: true,
|
|
9
|
+
align: "center",
|
|
10
|
+
gap: 8,
|
|
11
|
+
...rest,
|
|
12
|
+
children: [title, /* @__PURE__ */ jsx(Tag, { children: tag })]
|
|
13
|
+
});
|
|
14
|
+
LabelWithKey.displayName = "LabelWithKey";
|
|
15
|
+
//#endregion
|
|
16
|
+
export { LabelWithKey as default };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=LabelWithKey.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LabelWithKey.mjs","names":["Flexbox"],"sources":["../../../src/dashboard/LabelWithKey/LabelWithKey.tsx"],"sourcesContent":["'use client';\n\nimport { Flexbox } from '@/Flex';\nimport Tag from '@/Tag';\n\nimport type { LabelWithKeyProps } from './type';\n\n/** A human label followed by its machine key as a tag. */\nconst LabelWithKey = ({ tag, title, ...rest }: LabelWithKeyProps) => (\n <Flexbox horizontal align={'center'} gap={8} {...rest}>\n {title}\n <Tag>{tag}</Tag>\n </Flexbox>\n);\n\nLabelWithKey.displayName = 'LabelWithKey';\n\nexport default LabelWithKey;\n"],"mappings":";;;;;;AAQA,MAAM,gBAAgB,EAAE,KAAK,OAAO,GAAG,WACrC,qBAACA,mBAAD;CAAS,YAAA;CAAW,OAAO;CAAU,KAAK;CAAG,GAAI;CAAjD,UAAA,CACG,OACD,oBAAC,KAAD,EAAA,UAAM,IAAS,CAAA,CACR;;AAGX,aAAa,cAAc"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FlexboxProps } from "../../Flex/type.mjs";
|
|
2
|
+
import "../../Flex/index.mjs";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
//#region src/dashboard/LabelWithKey/type.d.ts
|
|
5
|
+
export interface LabelWithKeyProps extends Omit<FlexboxProps, 'title'> {
|
|
6
|
+
/** The machine key shown as a tag after the label, e.g. a config or permission id. */
|
|
7
|
+
tag: ReactNode;
|
|
8
|
+
title: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
//# sourceMappingURL=type.d.mts.map
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import Icon from "../../Icon/Icon.mjs";
|
|
3
|
+
import Skeleton from "../../Skeleton/index.mjs";
|
|
4
|
+
import { useSurfaceLink } from "../Surface/link.mjs";
|
|
5
|
+
import { styles } from "./style.mjs";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import * as stylex from "@stylexjs/stylex";
|
|
8
|
+
//#region src/dashboard/MetricStrip/MetricCell.tsx
|
|
9
|
+
const deltaStyles = {
|
|
10
|
+
down: styles.deltaDown,
|
|
11
|
+
flat: styles.deltaFlat,
|
|
12
|
+
up: styles.deltaUp
|
|
13
|
+
};
|
|
14
|
+
const MetricBody = ({ item, loading }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
15
|
+
/* @__PURE__ */ jsxs("div", {
|
|
16
|
+
...stylex.props(styles.head),
|
|
17
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
18
|
+
...stylex.props(styles.headCopy),
|
|
19
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
20
|
+
...stylex.props(styles.label),
|
|
21
|
+
children: item.label
|
|
22
|
+
}), item.action]
|
|
23
|
+
}), item.mark ? /* @__PURE__ */ jsx("span", {
|
|
24
|
+
"aria-hidden": true,
|
|
25
|
+
...stylex.props(styles.mark),
|
|
26
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
27
|
+
icon: item.mark,
|
|
28
|
+
size: 14
|
|
29
|
+
})
|
|
30
|
+
}) : null]
|
|
31
|
+
}),
|
|
32
|
+
loading ? /* @__PURE__ */ jsx(Skeleton, {
|
|
33
|
+
height: 28,
|
|
34
|
+
radius: 6,
|
|
35
|
+
width: 88
|
|
36
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
37
|
+
...stylex.props(styles.value, item.valueTone === "danger" && styles.valueDanger, item.valueTone === "warning" && styles.valueWarning),
|
|
38
|
+
children: item.value
|
|
39
|
+
}),
|
|
40
|
+
!loading && (item.delta || item.hint) ? /* @__PURE__ */ jsxs("div", {
|
|
41
|
+
...stylex.props(styles.foot),
|
|
42
|
+
children: [item.delta ? /* @__PURE__ */ jsx("span", {
|
|
43
|
+
...stylex.props(styles.delta, deltaStyles[item.direction ?? "flat"]),
|
|
44
|
+
children: item.delta
|
|
45
|
+
}) : null, item.hint ? /* @__PURE__ */ jsx("span", {
|
|
46
|
+
...stylex.props(styles.hint),
|
|
47
|
+
children: item.hint
|
|
48
|
+
}) : null]
|
|
49
|
+
}) : null
|
|
50
|
+
] });
|
|
51
|
+
/** One metric: label row, figure, delta and hint. Shared by MetricStrip and StatCard. */
|
|
52
|
+
const MetricCell = ({ item, loading, renderLink, seam = false }) => {
|
|
53
|
+
const link = useSurfaceLink(renderLink);
|
|
54
|
+
const body = /* @__PURE__ */ jsx(MetricBody, {
|
|
55
|
+
item,
|
|
56
|
+
loading: item.loading ?? loading
|
|
57
|
+
});
|
|
58
|
+
const cell = [styles.cell, seam && styles.cellSeam];
|
|
59
|
+
if (item.href) return /* @__PURE__ */ jsx("div", {
|
|
60
|
+
...stylex.props(styles.slot),
|
|
61
|
+
children: link({
|
|
62
|
+
children: body,
|
|
63
|
+
className: stylex.props(cell, styles.link).className,
|
|
64
|
+
href: item.href
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
if (item.onClick) return /* @__PURE__ */ jsx("button", {
|
|
68
|
+
type: "button",
|
|
69
|
+
onClick: item.onClick,
|
|
70
|
+
...stylex.props(cell, styles.press),
|
|
71
|
+
children: body
|
|
72
|
+
});
|
|
73
|
+
return /* @__PURE__ */ jsx("div", {
|
|
74
|
+
...stylex.props(cell),
|
|
75
|
+
children: body
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
//#endregion
|
|
79
|
+
export { MetricCell as default };
|
|
80
|
+
|
|
81
|
+
//# sourceMappingURL=MetricCell.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetricCell.mjs","names":[],"sources":["../../../src/dashboard/MetricStrip/MetricCell.tsx"],"sourcesContent":["'use client';\n\nimport * as stylex from '@stylexjs/stylex';\n\nimport Icon from '@/Icon';\nimport Skeleton from '@/Skeleton';\n\nimport { useSurfaceLink } from '../Surface/link';\nimport type { SurfaceRenderLink } from '../Surface/type';\nimport { styles } from './style';\nimport type { MetricItem } from './type';\n\nconst deltaStyles = {\n down: styles.deltaDown,\n flat: styles.deltaFlat,\n up: styles.deltaUp,\n} as const;\n\nconst MetricBody = ({ item, loading }: { item: MetricItem; loading?: boolean }) => (\n <>\n <div {...stylex.props(styles.head)}>\n <div {...stylex.props(styles.headCopy)}>\n <div {...stylex.props(styles.label)}>{item.label}</div>\n {item.action}\n </div>\n {item.mark ? (\n <span aria-hidden {...stylex.props(styles.mark)}>\n <Icon icon={item.mark} size={14} />\n </span>\n ) : null}\n </div>\n {loading ? (\n <Skeleton height={28} radius={6} width={88} />\n ) : (\n <div\n {...stylex.props(\n styles.value,\n item.valueTone === 'danger' && styles.valueDanger,\n item.valueTone === 'warning' && styles.valueWarning,\n )}\n >\n {item.value}\n </div>\n )}\n {!loading && (item.delta || item.hint) ? (\n <div {...stylex.props(styles.foot)}>\n {item.delta ? (\n <span {...stylex.props(styles.delta, deltaStyles[item.direction ?? 'flat'])}>\n {item.delta}\n </span>\n ) : null}\n {item.hint ? <span {...stylex.props(styles.hint)}>{item.hint}</span> : null}\n </div>\n ) : null}\n </>\n);\n\nexport interface MetricCellProps {\n item: MetricItem;\n loading?: boolean;\n renderLink?: SurfaceRenderLink;\n /** Draw the joined-strip divider on the trailing and bottom edges. */\n seam?: boolean;\n}\n\n/** One metric: label row, figure, delta and hint. Shared by MetricStrip and StatCard. */\nconst MetricCell = ({ item, loading, renderLink, seam = false }: MetricCellProps) => {\n const link = useSurfaceLink(renderLink);\n const body = <MetricBody item={item} loading={item.loading ?? loading} />;\n const cell = [styles.cell, seam && styles.cellSeam];\n\n if (item.href) {\n return (\n <div {...stylex.props(styles.slot)}>\n {link({\n children: body,\n className: stylex.props(cell, styles.link).className,\n href: item.href,\n })}\n </div>\n );\n }\n if (item.onClick) {\n return (\n <button type=\"button\" onClick={item.onClick} {...stylex.props(cell, styles.press)}>\n {body}\n </button>\n );\n }\n return <div {...stylex.props(cell)}>{body}</div>;\n};\n\nexport default MetricCell;\n"],"mappings":";;;;;;;;AASA,MAAM,cAAc;CAClB,MAAM,OAAO;CACb,MAAM,OAAO;CACb,IAAI,OAAO;AACb;AACA,MAAM,cAAc,EAClB,MACA,cAII,qBAAA,UAAA,EAAA,UAAA;CACF,qBAAC,OAAD;EAAK,GAAI,OAAO,MAAM,OAAO,IAAI;EAAjC,UAAA,CACE,qBAAC,OAAD;GAAK,GAAI,OAAO,MAAM,OAAO,QAAQ;GAArC,UAAA,CACE,oBAAC,OAAD;IAAK,GAAI,OAAO,MAAM,OAAO,KAAK;IAAI,UAAA,KAAK;GAAW,CAAA,GACrD,KAAK,MACH;EACJ,CAAA,GAAA,KAAK,OAAO,oBAAC,QAAD;GAAM,eAAA;GAAY,GAAI,OAAO,MAAM,OAAO,IAAI;GACvD,UAAA,oBAAC,MAAD;IAAM,MAAM,KAAK;IAAM,MAAM;GAAK,CAAA;EAC9B,CAAA,IAAI,IACT;;CACJ,UAAU,oBAAC,UAAD;EAAU,QAAQ;EAAI,QAAQ;EAAG,OAAO;CAAK,CA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
|
+
//#region src/dashboard/MetricStrip/MetricStrip.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Peer metrics. `joined` shares one card divided into cells; `split` gives each item its own card,
|
|
5
|
+
* identical to StatCard.
|
|
6
|
+
*/
|
|
7
|
+
declare const MetricStrip: {
|
|
8
|
+
({ items, loading, renderLink, variant }: MetricStripProps): import("react").JSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { MetricStrip as default };
|
|
13
|
+
//# sourceMappingURL=MetricStrip.d.mts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { styles } from "../Surface/style.mjs";
|
|
3
|
+
import { useSurfaceCardStyles } from "../Surface/link.mjs";
|
|
4
|
+
import Surface from "../Surface/Surface.mjs";
|
|
5
|
+
import { styles as styles$1 } from "./style.mjs";
|
|
6
|
+
import MetricCell from "./MetricCell.mjs";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
import * as stylex from "@stylexjs/stylex";
|
|
9
|
+
//#region src/dashboard/MetricStrip/MetricStrip.tsx
|
|
10
|
+
/**
|
|
11
|
+
* Peer metrics. `joined` shares one card divided into cells; `split` gives each item its own card,
|
|
12
|
+
* identical to StatCard.
|
|
13
|
+
*/
|
|
14
|
+
const MetricStrip = ({ items, loading, renderLink, variant = "joined" }) => {
|
|
15
|
+
const cardStyles = useSurfaceCardStyles();
|
|
16
|
+
if (variant === "split") return /* @__PURE__ */ jsx("div", {
|
|
17
|
+
...stylex.props(styles$1.split),
|
|
18
|
+
children: items.map((item, index) => /* @__PURE__ */ jsx("div", {
|
|
19
|
+
...stylex.props(styles$1.card, cardStyles, styles.clip),
|
|
20
|
+
children: /* @__PURE__ */ jsx(MetricCell, {
|
|
21
|
+
item,
|
|
22
|
+
loading,
|
|
23
|
+
renderLink
|
|
24
|
+
})
|
|
25
|
+
}, index))
|
|
26
|
+
});
|
|
27
|
+
return /* @__PURE__ */ jsx(Surface, {
|
|
28
|
+
className: stylex.props(styles.clip).className,
|
|
29
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
30
|
+
...stylex.props(styles$1.frame),
|
|
31
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
32
|
+
...stylex.props(styles$1.grid),
|
|
33
|
+
children: items.map((item, index) => /* @__PURE__ */ jsx(MetricCell, {
|
|
34
|
+
seam: true,
|
|
35
|
+
item,
|
|
36
|
+
loading,
|
|
37
|
+
renderLink
|
|
38
|
+
}, index))
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
MetricStrip.displayName = "MetricStrip";
|
|
44
|
+
//#endregion
|
|
45
|
+
export { MetricStrip as default };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=MetricStrip.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MetricStrip.mjs","names":["styles","surfaceStyles"],"sources":["../../../src/dashboard/MetricStrip/MetricStrip.tsx"],"sourcesContent":["'use client';\n\nimport * as stylex from '@stylexjs/stylex';\n\nimport { useSurfaceCardStyles } from '../Surface/link';\nimport { styles as surfaceStyles } from '../Surface/style';\nimport Surface from '../Surface/Surface';\nimport MetricCell from './MetricCell';\nimport { styles } from './style';\nimport type { MetricStripProps } from './type';\n\n/**\n * Peer metrics. `joined` shares one card divided into cells; `split` gives each item its own card,\n * identical to StatCard.\n */\nconst MetricStrip = ({ items, loading, renderLink, variant = 'joined' }: MetricStripProps) => {\n const cardStyles = useSurfaceCardStyles();\n\n if (variant === 'split') {\n return (\n <div {...stylex.props(styles.split)}>\n {items.map((item, index) => (\n <div key={index} {...stylex.props(styles.card, cardStyles, surfaceStyles.clip)}>\n <MetricCell item={item} loading={loading} renderLink={renderLink} />\n </div>\n ))}\n </div>\n );\n }\n\n return (\n <Surface className={stylex.props(surfaceStyles.clip).className}>\n <div {...stylex.props(styles.frame)}>\n <div {...stylex.props(styles.grid)}>\n {items.map((item, index) => (\n <MetricCell seam item={item} key={index} loading={loading} renderLink={renderLink} />\n ))}\n </div>\n </div>\n </Surface>\n );\n};\n\nMetricStrip.displayName = 'MetricStrip';\n\nexport default MetricStrip;\n"],"mappings":";;;;;;;;;;;;;AAcA,MAAM,eAAe,EACnB,OACA,SACA,YACA,UAAU,eACY;CACtB,MAAM,aAAa,qBAAqB;CACxC,IAAI,YAAY,SACd,OAAO,oBAAC,OAAD;EAAK,GAAI,OAAO,MAAMA,SAAO,KAAK;EACpC,UAAA,MAAM,KAAK,MAAM,UAAU,oBAAC,OAAD;GAAiB,GAAI,OAAO,MAAMA,SAAO,MAAM,YAAYC,OAAc,IAAI;GACrG,UAAA,oBAAC,YAAD;IAAkB;IAAe;IAAqB;GAAa,CAAA;EAChE,GAF+B,KAE/B,CAAC;CACL,CAAA;CAET,OAAO,oBAAC,SAAD;EAAS,WAAW,OAAO,MAAMA,OAAc,IAAI,CAAC,CAAC;EACxD,UAAA,oBAAC,OAAD;GAAK,GAAI,OAAO,MAAMD,SAAO,KAAK;GAChC,UAAA,oBAAC,OAAD;IAAK,GAAI,OAAO,MAAMA,SAAO,IAAI;IAC9B,UAAA,MAAM,KAAK,MAAM,UAAU,oBAAC,YAAD;KAAY,MAAA;KAAW;KAA2B;KAAqB;IAAa,GAAlD,KAAkD,CAAC;GAC9G,CAAA;EACF,CAAA;CACE,CAAA;AACb;AACA,YAAY,cAAc"}
|