@gridui/metrics-section 1.0.6 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/index.js.map +1 -1
- package/dist/metrics-section/metrics-section.d.ts +1 -1
- package/dist/styles.css +1 -0
- package/docs/catalog.json +2 -1
- package/package.json +8 -9
package/README.md
CHANGED
|
@@ -26,3 +26,6 @@ own requests, calculations, formatting, localized text, and retry actions.
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
[Component reference](docs/reference/README.md) contains focused API pages for each public component.
|
|
29
|
+
|
|
30
|
+
Each Metric item may also provide direction, align, valueSize and supplementary.
|
|
31
|
+
The section retains ownership of its Grid layout and loading/error boundaries.
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/metrics-section/style.ts", "../src/metrics-section/metrics-section.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * @author WMXPY\n * @package Metrics Section\n * @namespace MetricsSection\n * @description Style\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const metricsTitleStyles = cva(cn(\n \"gridui-metrics-title gridui-u-metrics-section--type-supporting\",\n \"gridui-u-metrics-section--text-muted\",\n));\n\nexport const metricsSurfaceStyles = cva(cn(\n \"gridui-metrics-surface\",\n \"gridui-u-metrics-section--h-full\",\n));\n", "/**\n * @author WMXPY\n * @package Metrics Section\n * @namespace MetricsSection\n * @description Metrics Section\n */\n\nimport { metricsSurfaceStyles, metricsTitleStyles } from \"./style\";\nimport { FrameSection, type FrameSectionProps, Grid, GridItem } from \"@gridui/grid\";\nimport { LoadingSurface } from \"@gridui/loading-surface\";\nimport { Metric } from \"@gridui/metric\";\nimport { ContentPanel } from \"@gridui/panel\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { ComponentProps, FC, ReactNode } from \"react\";\n\nexport type MetricsSectionItem = Pick<ComponentProps<typeof Metric>, \"label\" | \"value\" | \"valueId\" | \"description\"> & {\n readonly id: string;\n};\n\nexport type MetricsSectionProps = Omit<FrameSectionProps, \"children\" | \"title\"> & {\n readonly title: string;\n readonly items: readonly MetricsSectionItem[];\n readonly loading: boolean;\n readonly failed?: boolean;\n readonly notice?: ReactNode;\n};\n\nexport const MetricsSection: FC<MetricsSectionProps> = (props: MetricsSectionProps) => {\n const {\n title,\n items,\n loading,\n failed = false,\n notice,\n ...restProps\n } = props;\n return (<FrameSection\n {...restProps}\n >\n <Grid\n frame=\"internal\"\n columns={{\n base: 1,\n sm: 2,\n }}\n fillLastRow\n >\n <GridItem\n span=\"full\"\n >\n <ContentPanel\n paddingInline={24}\n paddingBlock={16}\n >\n <h2\n className={cn(metricsTitleStyles())}\n >\n {title}\n </h2>\n </ContentPanel>\n </GridItem>\n {failed ? (<GridItem\n span=\"full\"\n padding={24}\n >\n {notice}\n </GridItem>) : items.map(({ id, ...metric }, index) => {\n return (<GridItem\n key={id}\n >\n <LoadingSurface\n loading={loading}\n phase={index}\n asChild\n hideContent\n >\n <ContentPanel\n className={cn(metricsSurfaceStyles())}\n >\n <Metric\n {...metric}\n />\n </ContentPanel>\n </LoadingSurface>\n </GridItem>);\n })}\n </Grid>\n </FrameSection>);\n};\n"],
|
|
4
|
+
"sourcesContent": ["/**\n * @author WMXPY\n * @package Metrics Section\n * @namespace MetricsSection\n * @description Style\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const metricsTitleStyles = cva(cn(\n \"gridui-metrics-title gridui-u-metrics-section--type-supporting\",\n \"gridui-u-metrics-section--text-muted\",\n));\n\nexport const metricsSurfaceStyles = cva(cn(\n \"gridui-metrics-surface\",\n \"gridui-u-metrics-section--h-full\",\n));\n", "/**\n * @author WMXPY\n * @package Metrics Section\n * @namespace MetricsSection\n * @description Metrics Section\n */\n\nimport { metricsSurfaceStyles, metricsTitleStyles } from \"./style\";\nimport { FrameSection, type FrameSectionProps, Grid, GridItem } from \"@gridui/grid\";\nimport { LoadingSurface } from \"@gridui/loading-surface\";\nimport { Metric } from \"@gridui/metric\";\nimport { ContentPanel } from \"@gridui/panel\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { ComponentProps, FC, ReactNode } from \"react\";\n\nexport type MetricsSectionItem = Pick<ComponentProps<typeof Metric>, \"label\" | \"value\" | \"valueId\" | \"description\" | \"supplementary\" | \"direction\" | \"align\" | \"valueSize\"> & {\n readonly id: string;\n};\n\nexport type MetricsSectionProps = Omit<FrameSectionProps, \"children\" | \"title\"> & {\n readonly title: string;\n readonly items: readonly MetricsSectionItem[];\n readonly loading: boolean;\n readonly failed?: boolean;\n readonly notice?: ReactNode;\n};\n\nexport const MetricsSection: FC<MetricsSectionProps> = (props: MetricsSectionProps) => {\n const {\n title,\n items,\n loading,\n failed = false,\n notice,\n ...restProps\n } = props;\n return (<FrameSection\n {...restProps}\n >\n <Grid\n frame=\"internal\"\n columns={{\n base: 1,\n sm: 2,\n }}\n fillLastRow\n >\n <GridItem\n span=\"full\"\n >\n <ContentPanel\n paddingInline={24}\n paddingBlock={16}\n >\n <h2\n className={cn(metricsTitleStyles())}\n >\n {title}\n </h2>\n </ContentPanel>\n </GridItem>\n {failed ? (<GridItem\n span=\"full\"\n padding={24}\n >\n {notice}\n </GridItem>) : items.map(({ id, ...metric }, index) => {\n return (<GridItem\n key={id}\n >\n <LoadingSurface\n loading={loading}\n phase={index}\n asChild\n hideContent\n >\n <ContentPanel\n className={cn(metricsSurfaceStyles())}\n >\n <Metric\n {...metric}\n />\n </ContentPanel>\n </LoadingSurface>\n </GridItem>);\n })}\n </Grid>\n </FrameSection>);\n};\n"],
|
|
5
5
|
"mappings": ";AAOA,SAAS,UAAU;AACnB,SAAS,WAAW;AAEb,IAAM,qBAAqB,IAAI;AAAA,EAClC;AAAA,EACA;AACJ,CAAC;AAEM,IAAM,uBAAuB,IAAI;AAAA,EACpC;AA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fK;AAAA,cAgBT;AAAA,YACJ,CAAC;AAAA;AAAA;AAAA,MACL;AAAA;AAAA,EACJ;AACJ;",
|
|
6
6
|
"names": ["cn"]
|
|
7
7
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { type FrameSectionProps } from "@gridui/grid";
|
|
8
8
|
import { Metric } from "@gridui/metric";
|
|
9
9
|
import type { ComponentProps, FC, ReactNode } from "react";
|
|
10
|
-
export type MetricsSectionItem = Pick<ComponentProps<typeof Metric>, "label" | "value" | "valueId" | "description"> & {
|
|
10
|
+
export type MetricsSectionItem = Pick<ComponentProps<typeof Metric>, "label" | "value" | "valueId" | "description" | "supplementary" | "direction" | "align" | "valueSize"> & {
|
|
11
11
|
readonly id: string;
|
|
12
12
|
};
|
|
13
13
|
export type MetricsSectionProps = Omit<FrameSectionProps, "children" | "title"> & {
|
package/dist/styles.css
CHANGED
package/docs/catalog.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"name": "@gridui/metrics-section",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.1.1",
|
|
5
5
|
"category": "landing",
|
|
6
6
|
"description": "GridUI React metrics section",
|
|
7
7
|
"usage": "`MetricsSection` from `@gridui/metrics-section` composes a full-width summary heading and Metric cells inside one `Grid frame=\"internal\"`. Grid draws the heading seam and cell separators; FrameSection owns the outer frame. MetricsSection sets 16px block and 24px inline title padding, 24px metric padding, one column below 40rem, and two columns above it. An incomplete final row fills the available tracks. No application-specific border styles or divider flags are needed.",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"@gridui/metrics-section/styles.css"
|
|
37
37
|
],
|
|
38
38
|
"examples": [
|
|
39
|
+
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-landing/metrics-section/stories/getting-started.mdx",
|
|
39
40
|
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-landing/metrics-section/stories/summary-sections.mdx",
|
|
40
41
|
"https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-landing/metrics-section/stories/metrics-section.stories.tsx"
|
|
41
42
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/metrics-section",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "GridUI React metrics section",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -27,18 +27,18 @@
|
|
|
27
27
|
"react-dom": "^19.2.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@gridui/grid": "^3.
|
|
31
|
-
"@gridui/loading-surface": "^1.
|
|
32
|
-
"@gridui/metric": "^1.
|
|
33
|
-
"@gridui/panel": "^2.0.
|
|
30
|
+
"@gridui/grid": "^3.1.0",
|
|
31
|
+
"@gridui/loading-surface": "^1.2.0",
|
|
32
|
+
"@gridui/metric": "^1.1.1",
|
|
33
|
+
"@gridui/panel": "^2.0.1",
|
|
34
34
|
"@gridui/style-utils": "^4.0.0",
|
|
35
|
-
"@gridui/theme": "^
|
|
35
|
+
"@gridui/theme": "^3.0.0",
|
|
36
36
|
"class-variance-authority": "0.7.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@gridui-internal/configuration": "0.0.0-internal",
|
|
40
40
|
"@jest/globals": "30.5.2",
|
|
41
|
-
"@storybook/react-vite": "10.6.
|
|
41
|
+
"@storybook/react-vite": "10.6.7",
|
|
42
42
|
"@types/jest": "30.0.0",
|
|
43
43
|
"@types/node": "26.6.6",
|
|
44
44
|
"@types/react": "19.3.0",
|
|
@@ -51,7 +51,6 @@
|
|
|
51
51
|
"scripts": {
|
|
52
52
|
"build": "node ../../scripts/compilation/package.ts",
|
|
53
53
|
"compile": "tsc --project tsconfig.json",
|
|
54
|
-
"test": "jest"
|
|
55
|
-
"coverage": "jest --coverage"
|
|
54
|
+
"test": "jest"
|
|
56
55
|
}
|
|
57
56
|
}
|