@gridui/metrics-section 0.0.0-stage → 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,26 @@
1
- # Temporary Holding Version
1
+ # @gridui/metrics-section
2
+
3
+ Landing family. Public API: `MetricsSection`, `MetricsSectionItem`, `MetricsSectionProps`.
4
+
5
+ Import components from `@gridui/metrics-section` and load `@gridui/metrics-section/styles.css` after Theme.
6
+ Load styles for any composed dependency used by this family. Applications own routes, labels, state persistence, and branding.
7
+
8
+ See [component ownership](../../docs/component-ownership.md) and [release history](.changeset/history/).
9
+
10
+ ## Metric sections
11
+
12
+ `MetricsSection` from `@gridui/metrics-section` composes a full-width summary heading and Metric
13
+ cells inside one `Grid frame="internal"`. Grid draws the heading seam and
14
+ cell separators; FrameSection owns the outer frame. Layout owns 16px block
15
+ and 24px inline title padding, 24px metric padding, one column below 40rem,
16
+ and two columns above it. An incomplete final row fills the available tracks.
17
+ No application-specific border styles or divider flags are needed.
18
+
19
+ Pass `title`, keyed `items`, `loading`, optional `failed`, and `notice`.
20
+ Each item supplies Metric's label, value, optional value ID, and description.
21
+ The title and metric cells remain mounted while loading; values are hidden by
22
+ LoadingSurface with independent phases. Failure retains the title and frame,
23
+ replaces metrics with a full-width notice, and ends metric loading. A completed
24
+ empty item list keeps the title without a continuing loading surface. Applications
25
+ own requests, calculations, formatting, localized text, and retry actions.
2
26
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Metrics Section
4
+ * @namespace Root
5
+ * @description Index
6
+ */
7
+ export type { MetricsSectionItem } from "./metrics-section/metrics-section";
8
+ export type { MetricsSectionProps } from "./metrics-section/metrics-section";
9
+ export { MetricsSection } from "./metrics-section/metrics-section";
package/dist/index.js ADDED
@@ -0,0 +1,108 @@
1
+ // src/metrics-section/style.ts
2
+ import { cn } from "@gridui/style-utils";
3
+ import { cva } from "class-variance-authority";
4
+ var metricsTitleStyles = cva(cn(
5
+ "gridui-metrics-title type-supporting",
6
+ "text-muted"
7
+ ));
8
+ var metricsSurfaceStyles = cva(cn(
9
+ "gridui-metrics-surface",
10
+ "h-full"
11
+ ));
12
+
13
+ // src/metrics-section/metrics-section.tsx
14
+ import { FrameSection, Grid, GridItem } from "@gridui/grid";
15
+ import { LoadingSurface } from "@gridui/loading-surface";
16
+ import { Metric } from "@gridui/metric";
17
+ import { ContentPanel } from "@gridui/panel";
18
+ import { cn as cn2 } from "@gridui/style-utils";
19
+ import { jsx, jsxs } from "react/jsx-runtime";
20
+ var MetricsSection = (props) => {
21
+ const {
22
+ title,
23
+ items,
24
+ loading,
25
+ failed = false,
26
+ notice,
27
+ ...restProps
28
+ } = props;
29
+ return /* @__PURE__ */ jsx(
30
+ FrameSection,
31
+ {
32
+ ...restProps,
33
+ children: /* @__PURE__ */ jsxs(
34
+ Grid,
35
+ {
36
+ frame: "internal",
37
+ columns: {
38
+ base: 1,
39
+ md: 2
40
+ },
41
+ fillLastRow: true,
42
+ children: [
43
+ /* @__PURE__ */ jsx(
44
+ GridItem,
45
+ {
46
+ span: "full",
47
+ children: /* @__PURE__ */ jsx(
48
+ ContentPanel,
49
+ {
50
+ paddingInline: 24,
51
+ paddingBlock: 16,
52
+ children: /* @__PURE__ */ jsx(
53
+ "h2",
54
+ {
55
+ className: cn2(metricsTitleStyles()),
56
+ children: title
57
+ }
58
+ )
59
+ }
60
+ )
61
+ }
62
+ ),
63
+ failed ? /* @__PURE__ */ jsx(
64
+ GridItem,
65
+ {
66
+ span: "full",
67
+ padding: 24,
68
+ children: notice
69
+ }
70
+ ) : items.map(({ id, ...metric }, index) => {
71
+ return /* @__PURE__ */ jsx(
72
+ GridItem,
73
+ {
74
+ children: /* @__PURE__ */ jsx(
75
+ LoadingSurface,
76
+ {
77
+ loading,
78
+ phase: index,
79
+ asChild: true,
80
+ hideContent: true,
81
+ children: /* @__PURE__ */ jsx(
82
+ ContentPanel,
83
+ {
84
+ className: cn2(metricsSurfaceStyles()),
85
+ children: /* @__PURE__ */ jsx(
86
+ Metric,
87
+ {
88
+ ...metric
89
+ }
90
+ )
91
+ }
92
+ )
93
+ }
94
+ )
95
+ },
96
+ id
97
+ );
98
+ })
99
+ ]
100
+ }
101
+ )
102
+ }
103
+ );
104
+ };
105
+ export {
106
+ MetricsSection
107
+ };
108
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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 type-supporting\",\n \"text-muted\",\n));\n\nexport const metricsSurfaceStyles = cva(cn(\n \"gridui-metrics-surface\",\n \"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 md: 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
+ "mappings": ";AAOA,SAAS,UAAU;AACnB,SAAS,WAAW;AAEb,IAAM,qBAAqB,IAAI;AAAA,EAClC;AAAA,EACA;AACJ,CAAC;AAEM,IAAM,uBAAuB,IAAI;AAAA,EACpC;AAAA,EACA;AACJ,CAAC;;;ACVD,SAAS,cAAsC,MAAM,gBAAgB;AACrE,SAAS,sBAAsB;AAC/B,SAAS,cAAc;AACvB,SAAS,oBAAoB;AAC7B,SAAS,MAAAA,WAAU;AA2BX,SAeY,KAfZ;AAZD,IAAM,iBAA0C,CAAC,UAA+B;AACnF,QAAM;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA,GAAG;AAAA,EACP,IAAI;AACJ,SAAQ;AAAA,IAAC;AAAA;AAAA,MACJ,GAAG;AAAA,MAEJ;AAAA,QAAC;AAAA;AAAA,UACG,OAAM;AAAA,UACN,SAAS;AAAA,YACL,MAAM;AAAA,YACN,IAAI;AAAA,UACR;AAAA,UACA,aAAW;AAAA,UAEX;AAAA;AAAA,cAAC;AAAA;AAAA,gBACG,MAAK;AAAA,gBAEL;AAAA,kBAAC;AAAA;AAAA,oBACG,eAAe;AAAA,oBACf,cAAc;AAAA,oBAEd;AAAA,sBAAC;AAAA;AAAA,wBACG,WAAWA,IAAG,mBAAmB,CAAC;AAAA,wBAEjC;AAAA;AAAA,oBACL;AAAA;AAAA,gBACJ;AAAA;AAAA,YACJ;AAAA,YACC,SAAU;AAAA,cAAC;AAAA;AAAA,gBACR,MAAK;AAAA,gBACL,SAAS;AAAA,gBAER;AAAA;AAAA,YACL,IAAe,MAAM,IAAI,CAAC,EAAE,IAAI,GAAG,OAAO,GAAG,UAAU;AACnD,qBAAQ;AAAA,gBAAC;AAAA;AAAA,kBAGL;AAAA,oBAAC;AAAA;AAAA,sBACG;AAAA,sBACA,OAAO;AAAA,sBACP,SAAO;AAAA,sBACP,aAAW;AAAA,sBAEX;AAAA,wBAAC;AAAA;AAAA,0BACG,WAAWA,IAAG,qBAAqB,CAAC;AAAA,0BAEpC;AAAA,4BAAC;AAAA;AAAA,8BACI,GAAG;AAAA;AAAA,0BACR;AAAA;AAAA,sBACJ;AAAA;AAAA,kBACJ;AAAA;AAAA,gBAfK;AAAA,cAgBT;AAAA,YACJ,CAAC;AAAA;AAAA;AAAA,MACL;AAAA;AAAA,EACJ;AACJ;",
6
+ "names": ["cn"]
7
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Metrics Section
4
+ * @namespace MetricsSection
5
+ * @description Metrics Section
6
+ */
7
+ import { type FrameSectionProps } from "@gridui/grid";
8
+ import { Metric } from "@gridui/metric";
9
+ import type { ComponentProps, FC, ReactNode } from "react";
10
+ export type MetricsSectionItem = Pick<ComponentProps<typeof Metric>, "label" | "value" | "valueId" | "description"> & {
11
+ readonly id: string;
12
+ };
13
+ export type MetricsSectionProps = Omit<FrameSectionProps, "children" | "title"> & {
14
+ readonly title: string;
15
+ readonly items: readonly MetricsSectionItem[];
16
+ readonly loading: boolean;
17
+ readonly failed?: boolean;
18
+ readonly notice?: ReactNode;
19
+ };
20
+ export declare const MetricsSection: FC<MetricsSectionProps>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Metrics Section
4
+ * @namespace MetricsSection
5
+ * @description Style
6
+ */
7
+ export declare const metricsTitleStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
8
+ export declare const metricsSurfaceStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
@@ -0,0 +1,14 @@
1
+ /*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
2
+ @layer theme, base, components, utilities;
3
+ @layer utilities {
4
+ .h-full {
5
+ height: 100%;
6
+ }
7
+ .type-supporting {
8
+ font: var(--gridui-type-supporting);
9
+ letter-spacing: normal;
10
+ }
11
+ .text-muted {
12
+ color: var(--gridui-muted);
13
+ }
14
+ }
package/package.json CHANGED
@@ -1,6 +1,55 @@
1
1
  {
2
2
  "name": "@gridui/metrics-section",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.0.0",
4
+ "description": "GridUI React metrics section",
5
+ "license": "UNLICENSED",
6
+ "type": "module",
7
+ "files": [
8
+ "dist",
9
+ "README.md"
10
+ ],
11
+ "sideEffects": [
12
+ "**/*.css"
13
+ ],
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js"
18
+ },
19
+ "./styles.css": "./dist/styles.css"
20
+ },
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "peerDependencies": {
25
+ "react": "^19.2.0",
26
+ "react-dom": "^19.2.0"
27
+ },
28
+ "dependencies": {
29
+ "@gridui/grid": "^2.1.4",
30
+ "@gridui/loading-surface": "^0.0.0",
31
+ "@gridui/metric": "^0.0.0",
32
+ "@gridui/panel": "^0.0.0",
33
+ "@gridui/style-utils": "^2.1.2",
34
+ "@gridui/theme": "^2.1.2",
35
+ "class-variance-authority": "0.7.1"
36
+ },
37
+ "devDependencies": {
38
+ "@gridui-internal/configuration": "0.0.0",
39
+ "@jest/globals": "30.5.2",
40
+ "@types/jest": "30.0.0",
41
+ "@types/node": "26.6.5",
42
+ "@types/react": "19.3.0",
43
+ "@types/react-dom": "19.3.0",
44
+ "jest": "30.5.2",
45
+ "react": "19.3.1",
46
+ "react-dom": "19.3.1",
47
+ "typescript": "6.0.3"
48
+ },
49
+ "scripts": {
50
+ "build": "node ../../scripts/compilation/package.ts",
51
+ "compile": "tsc --project tsconfig.json",
52
+ "test": "jest",
53
+ "coverage": "jest --coverage"
54
+ }
6
55
  }