@gridui/metrics-section 1.0.5 → 1.0.6

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
@@ -24,3 +24,5 @@ replaces metrics with a full-width notice, and ends metric loading. A completed
24
24
  empty item list keeps the title without a continuing loading surface. Applications
25
25
  own requests, calculations, formatting, localized text, and retry actions.
26
26
 
27
+
28
+ [Component reference](docs/reference/README.md) contains focused API pages for each public component.
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ var MetricsSection = (props) => {
36
36
  frame: "internal",
37
37
  columns: {
38
38
  base: 1,
39
- md: 2
39
+ sm: 2
40
40
  },
41
41
  fillLastRow: true,
42
42
  children: [
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 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"],
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"],
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;AAAA,EACA;AACJ,CAAC;;;ACVD,SAAS,cAAsC,MAAM,gBAAgB;AACrE,SAAS,sBAAsB;AAC/B,SAAS,cAAc;AACvB,SAAS,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}
package/docs/catalog.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "name": "@gridui/metrics-section",
4
- "version": "1.0.5",
4
+ "version": "1.0.6",
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.",
8
8
  "documentation": [
9
- "README.md"
9
+ "README.md",
10
+ "docs/reference/README.md",
11
+ "docs/reference/metrics-section.md"
10
12
  ],
11
13
  "exports": [
12
14
  {
@@ -34,6 +36,7 @@
34
36
  "@gridui/metrics-section/styles.css"
35
37
  ],
36
38
  "examples": [
39
+ "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-landing/metrics-section/stories/summary-sections.mdx",
37
40
  "https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-landing/metrics-section/stories/metrics-section.stories.tsx"
38
41
  ]
39
42
  }
@@ -0,0 +1,4 @@
1
+ <!-- Generated by pnpm docs:storybook. -->
2
+ # Component reference
3
+
4
+ - [MetricsSection](metrics-section.md)
@@ -0,0 +1,101 @@
1
+ <!-- Generated from public Props and owned stories. Run pnpm docs:storybook. -->
2
+ # MetricsSection
3
+
4
+ Groups related metrics into a section. Use it to summarize outcomes or measurements with a consistent layout.
5
+
6
+ Import from ``@gridui/metrics-section`` and load Theme before this family's stylesheet.
7
+
8
+ ```tsx
9
+ import { MetricsSection } from "@gridui/metrics-section";
10
+ import "@gridui/theme/styles.css";
11
+ import "@gridui/metrics-section/styles.css";
12
+ ```
13
+
14
+ Read the [package contract](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-landing/metrics-section/README.md) for shared behavior and stylesheet dependencies.
15
+
16
+ The [working composition](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-landing/metrics-section/stories/metrics-section.stories.tsx) demonstrates required context, state, and related components. Use View code in Storybook to inspect the actual implementation.
17
+
18
+ ## API
19
+
20
+ The public Props type is the source of these signatures. Defaults below are explicit implementation defaults; story presets are separate. Native attributes remain available through the exported Props type.
21
+
22
+ ### onFocus
23
+
24
+ ``(event: FocusEvent<HTMLElement, Element>): void`` · Optional
25
+
26
+ Called when the corresponding interaction occurs; inspect the arguments in Actions.
27
+
28
+ ### onBlur
29
+
30
+ ``(event: FocusEvent<HTMLElement, Element>): void`` · Optional
31
+
32
+ Called when the corresponding interaction occurs; inspect the arguments in Actions.
33
+
34
+ ### onChange
35
+
36
+ ``(event: ChangeEvent<HTMLElement, Element>): void`` · Optional
37
+
38
+ Called when the corresponding interaction occurs; inspect the arguments in Actions.
39
+
40
+ ### onSubmit
41
+
42
+ ``(event: SubmitEvent<HTMLElement>): void`` · Optional
43
+
44
+ Called when the corresponding interaction occurs; inspect the arguments in Actions.
45
+
46
+ ### onClick
47
+
48
+ ``(event: MouseEvent<HTMLElement, MouseEvent>): void`` · Optional
49
+
50
+ Called when the corresponding interaction occurs; inspect the arguments in Actions.
51
+
52
+ ### boundary
53
+
54
+ ``FrameBoundaryStyle | undefined`` · Optional
55
+
56
+ ### texture
57
+
58
+ ``FrameTextureStyle | undefined`` · Optional
59
+
60
+ ### decoration
61
+
62
+ ``FrameDecorationStyle | undefined`` · Optional
63
+
64
+ ### tone
65
+
66
+ ``FrameTone | undefined`` · Optional
67
+
68
+ ### edges
69
+
70
+ ``"none" | "frame" | undefined`` · Optional
71
+
72
+ ### paddingInline
73
+
74
+ ``Responsive<Space> | undefined`` · Optional
75
+
76
+ ### paddingBlock
77
+
78
+ ``Responsive<Space> | undefined`` · Optional
79
+
80
+ ### title
81
+
82
+ ``string`` · Required
83
+
84
+ ### items
85
+
86
+ ``readonly MetricsSectionItem[]`` · Required
87
+
88
+ ### loading
89
+
90
+ ``boolean`` · Required
91
+
92
+ ### failed
93
+
94
+ ``boolean | undefined`` · Optional
95
+
96
+ Default: ``false``
97
+
98
+ ### notice
99
+
100
+ ``ReactNode`` · Optional
101
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridui/metrics-section",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "GridUI React metrics section",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -27,11 +27,11 @@
27
27
  "react-dom": "^19.2.0"
28
28
  },
29
29
  "dependencies": {
30
- "@gridui/grid": "^2.3.6",
31
- "@gridui/loading-surface": "^1.1.3",
32
- "@gridui/metric": "^1.0.5",
33
- "@gridui/panel": "^1.0.6",
34
- "@gridui/style-utils": "^3.0.0",
30
+ "@gridui/grid": "^3.0.0",
31
+ "@gridui/loading-surface": "^1.1.5",
32
+ "@gridui/metric": "^1.0.6",
33
+ "@gridui/panel": "^2.0.0",
34
+ "@gridui/style-utils": "^4.0.0",
35
35
  "@gridui/theme": "^2.5.3",
36
36
  "class-variance-authority": "0.7.1"
37
37
  },