@gridui/data-cell 0.0.0-stage → 1.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,8 @@
1
- # Temporary Holding Version
1
+ # @gridui/data-cell
2
2
 
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.
3
+ Core family. Public API: `DataBadge`, `DataBadgeProps`, `DataBar`, `DataBarProps`, `DataValue`, `DataValueProps`.
4
+
5
+ Import components from `@gridui/data-cell` and load `@gridui/data-cell/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/).
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Data Cell
4
+ * @namespace DataBadge
5
+ * @description Data Badge
6
+ */
7
+ import type { ComponentPropsWithRef, FC } from "react";
8
+ export type DataBadgeProps = ComponentPropsWithRef<"span"> & {
9
+ readonly tone?: "neutral" | "accent";
10
+ };
11
+ export declare const DataBadge: FC<DataBadgeProps>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Data Cell
4
+ * @namespace DataBadge
5
+ * @description Style
6
+ */
7
+ export declare const dataBadgeStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Data Cell
4
+ * @namespace DataBar
5
+ * @description Data Bar
6
+ */
7
+ import type { ComponentPropsWithRef, FC } from "react";
8
+ export type DataBarProps = ComponentPropsWithRef<"span"> & {
9
+ readonly value: number;
10
+ readonly maximum: number;
11
+ readonly partial?: boolean;
12
+ };
13
+ export declare const DataBar: FC<DataBarProps>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Data Cell
4
+ * @namespace DataBar
5
+ * @description Style
6
+ */
7
+ export declare const dataBarStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
8
+ export declare const dataBarTrackStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Data Cell
4
+ * @namespace DataValue
5
+ * @description Data Value
6
+ */
7
+ import type { ComponentPropsWithRef, FC, ReactNode } from "react";
8
+ export type DataValueProps = ComponentPropsWithRef<"span"> & {
9
+ readonly detail?: ReactNode;
10
+ readonly mono?: boolean;
11
+ };
12
+ export declare const DataValue: FC<DataValueProps>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Data Cell
4
+ * @namespace DataValue
5
+ * @description Style
6
+ */
7
+ export declare const dataValueStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
8
+ export declare const dataMonoStyles: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @author WMXPY
3
+ * @package Data Cell
4
+ * @namespace Root
5
+ * @description Index
6
+ */
7
+ export type { DataBadgeProps } from "./data-badge/data-badge";
8
+ export { DataBadge } from "./data-badge/data-badge";
9
+ export type { DataBarProps } from "./data-bar/data-bar";
10
+ export { DataBar } from "./data-bar/data-bar";
11
+ export type { DataValueProps } from "./data-value/data-value";
12
+ export { DataValue } from "./data-value/data-value";
package/dist/index.js ADDED
@@ -0,0 +1,125 @@
1
+ // src/data-badge/style.ts
2
+ import { cn } from "@gridui/style-utils";
3
+ import { cva } from "class-variance-authority";
4
+ var dataBadgeStyles = cva(cn(
5
+ "gridui-data-badge",
6
+ "inline-block py-gridui-4 px-gridui-8 text-foreground bg-surface type-caption whitespace-nowrap",
7
+ "data-[tone='accent']:text-foreground data-[tone='accent']:bg-brand-tint"
8
+ ));
9
+
10
+ // src/data-badge/data-badge.tsx
11
+ import { cn as cn2 } from "@gridui/style-utils";
12
+ import { jsx } from "react/jsx-runtime";
13
+ var DataBadge = (props) => {
14
+ const {
15
+ children,
16
+ tone = "neutral",
17
+ className,
18
+ ...restProps
19
+ } = props;
20
+ return /* @__PURE__ */ jsx(
21
+ "span",
22
+ {
23
+ ...restProps,
24
+ className: cn2(dataBadgeStyles(), className),
25
+ "data-tone": tone,
26
+ children
27
+ }
28
+ );
29
+ };
30
+
31
+ // src/data-bar/style.ts
32
+ import { cn as cn3 } from "@gridui/style-utils";
33
+ import { cva as cva2 } from "class-variance-authority";
34
+ var dataBarStyles = cva2(cn3(
35
+ "gridui-data-bar",
36
+ "grid min-w-gridui-64 gap-gridui-8 tabular-nums",
37
+ "[&[data-partial='true']_.gridui-data-bar-track>span]:bg-transparent"
38
+ ));
39
+ var dataBarTrackStyles = cva2(cn3(
40
+ "gridui-data-bar-track",
41
+ "h-(--gridui-space-4) bg-brand-tint",
42
+ "[&_>_span]:block [&_>_span]:h-full [&_>_span]:bg-accent-background"
43
+ ));
44
+
45
+ // src/data-bar/data-bar.tsx
46
+ import { cn as cn4 } from "@gridui/style-utils";
47
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
48
+ var DataBar = (props) => {
49
+ const {
50
+ value,
51
+ maximum,
52
+ partial = false,
53
+ children,
54
+ className,
55
+ ...restProps
56
+ } = props;
57
+ const ratio = Number.isFinite(value) && Number.isFinite(maximum) && maximum > 0 ? Math.max(0, Math.min(1, value / maximum)) : 0;
58
+ return /* @__PURE__ */ jsxs(
59
+ "span",
60
+ {
61
+ ...restProps,
62
+ className: cn4(dataBarStyles(), className),
63
+ "data-partial": partial,
64
+ children: [
65
+ /* @__PURE__ */ jsx2("span", { children }),
66
+ /* @__PURE__ */ jsx2(
67
+ "span",
68
+ {
69
+ className: cn4(dataBarTrackStyles()),
70
+ "aria-hidden": "true",
71
+ children: /* @__PURE__ */ jsx2(
72
+ "span",
73
+ {
74
+ style: { width: `${ratio * 100}%` }
75
+ }
76
+ )
77
+ }
78
+ )
79
+ ]
80
+ }
81
+ );
82
+ };
83
+
84
+ // src/data-value/style.ts
85
+ import { cn as cn5 } from "@gridui/style-utils";
86
+ import { cva as cva3 } from "class-variance-authority";
87
+ var dataValueStyles = cva3(cn5(
88
+ "gridui-data-value",
89
+ "grid gap-gridui-4",
90
+ "[&_small]:text-muted [&_small]:type-supporting"
91
+ ));
92
+ var dataMonoStyles = cva3(cn5(
93
+ "gridui-data-mono",
94
+ "type-code whitespace-nowrap"
95
+ ));
96
+
97
+ // src/data-value/data-value.tsx
98
+ import { cn as cn6 } from "@gridui/style-utils";
99
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
100
+ var DataValue = (props) => {
101
+ const {
102
+ children,
103
+ detail,
104
+ mono = false,
105
+ className,
106
+ ...restProps
107
+ } = props;
108
+ return /* @__PURE__ */ jsxs2(
109
+ "span",
110
+ {
111
+ ...restProps,
112
+ className: cn6(dataValueStyles(), mono && dataMonoStyles(), className),
113
+ children: [
114
+ /* @__PURE__ */ jsx3("span", { children }),
115
+ detail !== void 0 && /* @__PURE__ */ jsx3("small", { children: detail })
116
+ ]
117
+ }
118
+ );
119
+ };
120
+ export {
121
+ DataBadge,
122
+ DataBar,
123
+ DataValue
124
+ };
125
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/data-badge/style.ts", "../src/data-badge/data-badge.tsx", "../src/data-bar/style.ts", "../src/data-bar/data-bar.tsx", "../src/data-value/style.ts", "../src/data-value/data-value.tsx"],
4
+ "sourcesContent": ["/**\n * @author WMXPY\n * @package Data Cell\n * @namespace DataBadge\n * @description Style\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const dataBadgeStyles = cva(cn(\n \"gridui-data-badge\",\n \"inline-block py-gridui-4 px-gridui-8 text-foreground bg-surface type-caption whitespace-nowrap\",\n \"data-[tone='accent']:text-foreground data-[tone='accent']:bg-brand-tint\",\n));\n", "/**\n * @author WMXPY\n * @package Data Cell\n * @namespace DataBadge\n * @description Data Badge\n */\n\nimport { dataBadgeStyles } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type DataBadgeProps = ComponentPropsWithRef<\"span\"> & {\n readonly tone?: \"neutral\" | \"accent\";\n};\n\nexport const DataBadge: FC<DataBadgeProps> = (props: DataBadgeProps) => {\n const {\n children,\n tone = \"neutral\",\n className,\n ...restProps\n } = props;\n return (<span\n {...restProps}\n className={cn(dataBadgeStyles(), className)}\n data-tone={tone}\n >\n {children}\n </span>);\n};\n", "/**\n * @author WMXPY\n * @package Data Cell\n * @namespace DataBar\n * @description Style\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const dataBarStyles = cva(cn(\n \"gridui-data-bar\",\n \"grid min-w-gridui-64 gap-gridui-8 tabular-nums\",\n \"[&[data-partial='true']_.gridui-data-bar-track>span]:bg-transparent\",\n));\n\nexport const dataBarTrackStyles = cva(cn(\n \"gridui-data-bar-track\",\n \"h-(--gridui-space-4) bg-brand-tint\",\n \"[&_>_span]:block [&_>_span]:h-full [&_>_span]:bg-accent-background\",\n));\n", "/**\n * @author WMXPY\n * @package Data Cell\n * @namespace DataBar\n * @description Data Bar\n */\n\nimport { dataBarStyles, dataBarTrackStyles } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type DataBarProps = ComponentPropsWithRef<\"span\"> & {\n readonly value: number;\n readonly maximum: number;\n readonly partial?: boolean;\n};\n\nexport const DataBar: FC<DataBarProps> = (props: DataBarProps) => {\n const {\n value,\n maximum,\n partial = false,\n children,\n className,\n ...restProps\n } = props;\n const ratio = Number.isFinite(value) && Number.isFinite(maximum) && maximum > 0\n ? Math.max(0, Math.min(1, value / maximum))\n : 0;\n return (<span\n {...restProps}\n className={cn(dataBarStyles(), className)}\n data-partial={partial}\n >\n <span>\n {children}\n </span>\n <span\n className={cn(dataBarTrackStyles())}\n aria-hidden=\"true\"\n >\n <span\n style={{ width: `${ratio * 100}%` }}\n />\n </span>\n </span>);\n};\n", "/**\n * @author WMXPY\n * @package Data Cell\n * @namespace DataValue\n * @description Style\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport { cva } from \"class-variance-authority\";\n\nexport const dataValueStyles = cva(cn(\n \"gridui-data-value\",\n \"grid gap-gridui-4\",\n \"[&_small]:text-muted [&_small]:type-supporting\",\n));\n\nexport const dataMonoStyles = cva(cn(\n \"gridui-data-mono\",\n \"type-code whitespace-nowrap\",\n));\n", "/**\n * @author WMXPY\n * @package Data Cell\n * @namespace DataValue\n * @description Data Value\n */\n\nimport { dataMonoStyles, dataValueStyles } from \"./style\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { ComponentPropsWithRef, FC, ReactNode } from \"react\";\n\nexport type DataValueProps = ComponentPropsWithRef<\"span\"> & {\n readonly detail?: ReactNode;\n readonly mono?: boolean;\n};\n\nexport const DataValue: FC<DataValueProps> = (props: DataValueProps) => {\n const {\n children,\n detail,\n mono = false,\n className,\n ...restProps\n } = props;\n return (<span\n {...restProps}\n className={cn(dataValueStyles(), mono && dataMonoStyles(), className)}\n >\n <span>\n {children}\n </span>\n {detail !== undefined && (<small>\n {detail}\n </small>)}\n </span>);\n};\n"],
5
+ "mappings": ";AAOA,SAAS,UAAU;AACnB,SAAS,WAAW;AAEb,IAAM,kBAAkB,IAAI;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AACJ,CAAC;;;ACND,SAAS,MAAAA,WAAU;AAcP;AAPL,IAAM,YAAgC,CAAC,UAA0B;AACpE,QAAM;AAAA,IACF;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA,GAAG;AAAA,EACP,IAAI;AACJ,SAAQ;AAAA,IAAC;AAAA;AAAA,MACJ,GAAG;AAAA,MACJ,WAAWA,IAAG,gBAAgB,GAAG,SAAS;AAAA,MAC1C,aAAW;AAAA,MAEV;AAAA;AAAA,EACL;AACJ;;;ACtBA,SAAS,MAAA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A,IACF;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA,GAAG;AAAA,EACP,IAAI;AACJ,SAAQ,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACJ,GAAG;AAAA,MACJ,WAAWF,IAAG,gBAAgB,GAAG,QAAQ,eAAe,GAAG,SAAS;AAAA,MAEpE;AAAA,wBAAAC,KAAC,UACI,UACL;AAAA,QACC,WAAW,UAAc,gBAAAA,KAAC,WACtB,kBACL;AAAA;AAAA;AAAA,EACJ;AACJ;",
6
+ "names": ["cn", "cn", "cva", "cn", "jsx", "cn", "cva", "cn", "jsx", "jsxs"]
7
+ }
@@ -0,0 +1,114 @@
1
+ /*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
2
+ @layer properties;
3
+ @layer theme, base, components, utilities;
4
+ @layer utilities {
5
+ .grid {
6
+ display: grid;
7
+ }
8
+ .inline-block {
9
+ display: inline-block;
10
+ }
11
+ .h-\(--gridui-space-4\) {
12
+ height: var(--gridui-space-4);
13
+ }
14
+ .min-w-gridui-64 {
15
+ min-width: var(--gridui-space-64);
16
+ }
17
+ .gap-gridui-4 {
18
+ gap: var(--gridui-space-4);
19
+ }
20
+ .gap-gridui-8 {
21
+ gap: var(--gridui-space-8);
22
+ }
23
+ .bg-brand-tint {
24
+ background-color: var(--gridui-brand-tint);
25
+ }
26
+ .bg-surface {
27
+ background-color: var(--gridui-surface);
28
+ }
29
+ .px-gridui-8 {
30
+ padding-inline: var(--gridui-space-8);
31
+ }
32
+ .py-gridui-4 {
33
+ padding-block: var(--gridui-space-4);
34
+ }
35
+ .type-caption {
36
+ font: var(--gridui-type-caption);
37
+ letter-spacing: normal;
38
+ }
39
+ .type-code {
40
+ font: var(--gridui-type-code);
41
+ letter-spacing: normal;
42
+ }
43
+ .whitespace-nowrap {
44
+ white-space: nowrap;
45
+ }
46
+ .text-foreground {
47
+ color: var(--gridui-foreground);
48
+ }
49
+ .tabular-nums {
50
+ --tw-numeric-spacing: tabular-nums;
51
+ font-variant-numeric: var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,);
52
+ }
53
+ .data-\[tone\=\'accent\'\]\:bg-brand-tint[data-tone='accent'] {
54
+ background-color: var(--gridui-brand-tint);
55
+ }
56
+ .data-\[tone\=\'accent\'\]\:text-foreground[data-tone='accent'] {
57
+ color: var(--gridui-foreground);
58
+ }
59
+ .\[\&_\>_span\]\:block > span {
60
+ display: block;
61
+ }
62
+ .\[\&_\>_span\]\:h-full > span {
63
+ height: 100%;
64
+ }
65
+ .\[\&_\>_span\]\:bg-accent-background > span {
66
+ background-color: var(--gridui-accent-background);
67
+ }
68
+ .\[\&_small\]\:type-supporting small {
69
+ font: var(--gridui-type-supporting);
70
+ letter-spacing: normal;
71
+ }
72
+ .\[\&_small\]\:text-muted small {
73
+ color: var(--gridui-muted);
74
+ }
75
+ .\[\&\[data-partial\=\'true\'\]_\.gridui-data-bar-track\>span\]\:bg-transparent[data-partial='true'] .gridui-data-bar-track > span {
76
+ background-color: transparent;
77
+ }
78
+ }
79
+ @layer components {
80
+ .gridui-data-bar[data-partial="true"] .gridui-data-bar-track > span {
81
+ background: repeating-linear-gradient(90deg, var(--gridui-accent-background) 0 4px, transparent 4px 8px);
82
+ }
83
+ }
84
+ @property --tw-ordinal {
85
+ syntax: "*";
86
+ inherits: false;
87
+ }
88
+ @property --tw-slashed-zero {
89
+ syntax: "*";
90
+ inherits: false;
91
+ }
92
+ @property --tw-numeric-figure {
93
+ syntax: "*";
94
+ inherits: false;
95
+ }
96
+ @property --tw-numeric-spacing {
97
+ syntax: "*";
98
+ inherits: false;
99
+ }
100
+ @property --tw-numeric-fraction {
101
+ syntax: "*";
102
+ inherits: false;
103
+ }
104
+ @layer properties {
105
+ @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
106
+ *, ::before, ::after, ::backdrop {
107
+ --tw-ordinal: initial;
108
+ --tw-slashed-zero: initial;
109
+ --tw-numeric-figure: initial;
110
+ --tw-numeric-spacing: initial;
111
+ --tw-numeric-fraction: initial;
112
+ }
113
+ }
114
+ }
package/package.json CHANGED
@@ -1,6 +1,51 @@
1
1
  {
2
2
  "name": "@gridui/data-cell",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.0",
4
+ "description": "GridUI React data cell",
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/style-utils": "^2.1.2",
30
+ "@gridui/theme": "^2.1.2",
31
+ "class-variance-authority": "0.7.1"
32
+ },
33
+ "devDependencies": {
34
+ "@gridui-internal/configuration": "0.0.0",
35
+ "@jest/globals": "30.5.2",
36
+ "@types/jest": "30.0.0",
37
+ "@types/node": "26.6.5",
38
+ "@types/react": "19.3.0",
39
+ "@types/react-dom": "19.3.0",
40
+ "jest": "30.5.2",
41
+ "react": "19.3.1",
42
+ "react-dom": "19.3.1",
43
+ "typescript": "6.0.3"
44
+ },
45
+ "scripts": {
46
+ "build": "node ../../scripts/compilation/package.ts",
47
+ "compile": "tsc --project tsconfig.json",
48
+ "test": "jest",
49
+ "coverage": "jest --coverage"
50
+ }
6
51
  }