@dataimago/ui 0.1.0-alpha.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 ADDED
@@ -0,0 +1,31 @@
1
+ # @dataimago/ui
2
+
3
+ React components for the dataimago ethical AI design system.
4
+
5
+ > **Registry:** published to **public npm** (`registry.npmjs.org`) under the `@dataimago` scope alongside `@dataimago/tokens` and `@dataimago/css`. No scoped `.npmrc` or `GITHUB_PACKAGES_TOKEN` is required — a plain `pnpm install @dataimago/ui` works.
6
+
7
+ ## Peer dependencies
8
+
9
+ - `react` ≥ 18
10
+ - `react-dom` ≥ 18
11
+ - `@dataimago/tokens` ≥ 0.1.0-alpha.0
12
+ - `@dataimago/css` ≥ 0.1.0-alpha.0 (visual styling is delegated to `.btn-*` classes emitted by this package)
13
+
14
+ ## Alpha scope
15
+
16
+ Just one smoke component for now:
17
+
18
+ ```tsx
19
+ import { Button } from '@dataimago/ui';
20
+
21
+ <Button variant="primary">Generate</Button>
22
+ <Button variant="secondary" size="sm">Cancel</Button>
23
+ ```
24
+
25
+ Additional components get harvested from consumer prototypes (`dataimago-ai`, `dissertation.ai`, etc.) via the prototype-in-consumer workflow.
26
+
27
+ ## Building
28
+
29
+ ```bash
30
+ pnpm --filter @dataimago/ui build
31
+ ```
package/dist/index.cjs ADDED
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ Button: () => Button
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+
37
+ // src/Button.tsx
38
+ var React = __toESM(require("react"), 1);
39
+ var import_jsx_runtime = require("react/jsx-runtime");
40
+ var variantClasses = {
41
+ primary: "btn-primary",
42
+ secondary: "btn-secondary",
43
+ ghost: "btn-ghost"
44
+ };
45
+ var sizeClasses = {
46
+ sm: "btn-sm",
47
+ md: "btn-md",
48
+ lg: "btn-lg"
49
+ };
50
+ var Button = React.forwardRef(
51
+ function Button2({ variant = "primary", size = "md", className = "", type, children, ...rest }, ref) {
52
+ const classes = [
53
+ "btn",
54
+ variantClasses[variant],
55
+ sizeClasses[size],
56
+ className
57
+ ].filter(Boolean).join(" ");
58
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
59
+ "button",
60
+ {
61
+ ref,
62
+ type: type ?? "button",
63
+ className: classes,
64
+ ...rest,
65
+ children
66
+ }
67
+ );
68
+ }
69
+ );
70
+ // Annotate the CommonJS export names for ESM import in node:
71
+ 0 && (module.exports = {
72
+ Button
73
+ });
74
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/Button.tsx"],"sourcesContent":["export { Button } from './Button.js';\nexport type { ButtonProps, ButtonVariant, ButtonSize } from './Button.js';\n","import * as React from 'react';\n\nexport type ButtonVariant = 'primary' | 'secondary' | 'ghost';\nexport type ButtonSize = 'sm' | 'md' | 'lg';\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: ButtonVariant;\n size?: ButtonSize;\n}\n\nconst variantClasses: Record<ButtonVariant, string> = {\n primary: 'btn-primary',\n secondary: 'btn-secondary',\n ghost: 'btn-ghost',\n};\n\nconst sizeClasses: Record<ButtonSize, string> = {\n sm: 'btn-sm',\n md: 'btn-md',\n lg: 'btn-lg',\n};\n\n/**\n * Smoke-level `<Button>` for the alpha release of @dataimago/ui.\n *\n * Styling is delegated to the CSS classes `.btn`, `.btn-<variant>`, `.btn-<size>`\n * published by @dataimago/css so that the component stays small and theme-aware.\n * Consumers that want to override visuals can pass their own className.\n */\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n function Button(\n { variant = 'primary', size = 'md', className = '', type, children, ...rest },\n ref,\n ) {\n const classes = [\n 'btn',\n variantClasses[variant],\n sizeClasses[size],\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <button\n ref={ref}\n type={type ?? 'button'}\n className={classes}\n {...rest}\n >\n {children}\n </button>\n );\n },\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AA6CjB;AAlCN,IAAM,iBAAgD;AAAA,EACpD,SAAW;AAAA,EACX,WAAW;AAAA,EACX,OAAW;AACb;AAEA,IAAM,cAA0C;AAAA,EAC9C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AASO,IAAM,SAAe;AAAA,EAC1B,SAASA,QACP,EAAE,UAAU,WAAW,OAAO,MAAM,YAAY,IAAI,MAAM,UAAU,GAAG,KAAK,GAC5E,KACA;AACA,UAAM,UAAU;AAAA,MACd;AAAA,MACA,eAAe,OAAO;AAAA,MACtB,YAAY,IAAI;AAAA,MAChB;AAAA,IACF,EACG,OAAO,OAAO,EACd,KAAK,GAAG;AAEX,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,MAAM,QAAQ;AAAA,QACd,WAAW;AAAA,QACV,GAAG;AAAA,QAEH;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;","names":["Button"]}
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+
3
+ type ButtonVariant = 'primary' | 'secondary' | 'ghost';
4
+ type ButtonSize = 'sm' | 'md' | 'lg';
5
+ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
6
+ variant?: ButtonVariant;
7
+ size?: ButtonSize;
8
+ }
9
+ /**
10
+ * Smoke-level `<Button>` for the alpha release of @dataimago/ui.
11
+ *
12
+ * Styling is delegated to the CSS classes `.btn`, `.btn-<variant>`, `.btn-<size>`
13
+ * published by @dataimago/css so that the component stays small and theme-aware.
14
+ * Consumers that want to override visuals can pass their own className.
15
+ */
16
+ declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
17
+
18
+ export { Button, type ButtonProps, type ButtonSize, type ButtonVariant };
@@ -0,0 +1,18 @@
1
+ import * as React from 'react';
2
+
3
+ type ButtonVariant = 'primary' | 'secondary' | 'ghost';
4
+ type ButtonSize = 'sm' | 'md' | 'lg';
5
+ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
6
+ variant?: ButtonVariant;
7
+ size?: ButtonSize;
8
+ }
9
+ /**
10
+ * Smoke-level `<Button>` for the alpha release of @dataimago/ui.
11
+ *
12
+ * Styling is delegated to the CSS classes `.btn`, `.btn-<variant>`, `.btn-<size>`
13
+ * published by @dataimago/css so that the component stays small and theme-aware.
14
+ * Consumers that want to override visuals can pass their own className.
15
+ */
16
+ declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
17
+
18
+ export { Button, type ButtonProps, type ButtonSize, type ButtonVariant };
package/dist/index.js ADDED
@@ -0,0 +1,37 @@
1
+ // src/Button.tsx
2
+ import * as React from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ var variantClasses = {
5
+ primary: "btn-primary",
6
+ secondary: "btn-secondary",
7
+ ghost: "btn-ghost"
8
+ };
9
+ var sizeClasses = {
10
+ sm: "btn-sm",
11
+ md: "btn-md",
12
+ lg: "btn-lg"
13
+ };
14
+ var Button = React.forwardRef(
15
+ function Button2({ variant = "primary", size = "md", className = "", type, children, ...rest }, ref) {
16
+ const classes = [
17
+ "btn",
18
+ variantClasses[variant],
19
+ sizeClasses[size],
20
+ className
21
+ ].filter(Boolean).join(" ");
22
+ return /* @__PURE__ */ jsx(
23
+ "button",
24
+ {
25
+ ref,
26
+ type: type ?? "button",
27
+ className: classes,
28
+ ...rest,
29
+ children
30
+ }
31
+ );
32
+ }
33
+ );
34
+ export {
35
+ Button
36
+ };
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/Button.tsx"],"sourcesContent":["import * as React from 'react';\n\nexport type ButtonVariant = 'primary' | 'secondary' | 'ghost';\nexport type ButtonSize = 'sm' | 'md' | 'lg';\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: ButtonVariant;\n size?: ButtonSize;\n}\n\nconst variantClasses: Record<ButtonVariant, string> = {\n primary: 'btn-primary',\n secondary: 'btn-secondary',\n ghost: 'btn-ghost',\n};\n\nconst sizeClasses: Record<ButtonSize, string> = {\n sm: 'btn-sm',\n md: 'btn-md',\n lg: 'btn-lg',\n};\n\n/**\n * Smoke-level `<Button>` for the alpha release of @dataimago/ui.\n *\n * Styling is delegated to the CSS classes `.btn`, `.btn-<variant>`, `.btn-<size>`\n * published by @dataimago/css so that the component stays small and theme-aware.\n * Consumers that want to override visuals can pass their own className.\n */\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n function Button(\n { variant = 'primary', size = 'md', className = '', type, children, ...rest },\n ref,\n ) {\n const classes = [\n 'btn',\n variantClasses[variant],\n sizeClasses[size],\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n return (\n <button\n ref={ref}\n type={type ?? 'button'}\n className={classes}\n {...rest}\n >\n {children}\n </button>\n );\n },\n);\n"],"mappings":";AAAA,YAAY,WAAW;AA6CjB;AAlCN,IAAM,iBAAgD;AAAA,EACpD,SAAW;AAAA,EACX,WAAW;AAAA,EACX,OAAW;AACb;AAEA,IAAM,cAA0C;AAAA,EAC9C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;AASO,IAAM,SAAe;AAAA,EAC1B,SAASA,QACP,EAAE,UAAU,WAAW,OAAO,MAAM,YAAY,IAAI,MAAM,UAAU,GAAG,KAAK,GAC5E,KACA;AACA,UAAM,UAAU;AAAA,MACd;AAAA,MACA,eAAe,OAAO;AAAA,MACtB,YAAY,IAAI;AAAA,MAChB;AAAA,IACF,EACG,OAAO,OAAO,EACd,KAAK,GAAG;AAEX,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,MAAM,QAAQ;AAAA,QACd,WAAW;AAAA,QACV,GAAG;AAAA,QAEH;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;","names":["Button"]}
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@dataimago/ui",
3
+ "version": "0.1.0-alpha.1",
4
+ "description": "React components for the dataimago ethical AI design system",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/dataimago/dataimago-design.git",
9
+ "directory": "packages/ui"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public",
13
+ "registry": "https://registry.npmjs.org/"
14
+ },
15
+ "type": "module",
16
+ "main": "./dist/index.cjs",
17
+ "module": "./dist/index.js",
18
+ "types": "./dist/index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "import": "./dist/index.js",
23
+ "require": "./dist/index.cjs"
24
+ },
25
+ "./package.json": "./package.json"
26
+ },
27
+ "files": [
28
+ "dist",
29
+ "README.md"
30
+ ],
31
+ "peerDependencies": {
32
+ "react": ">=18",
33
+ "react-dom": ">=18",
34
+ "@dataimago/tokens": "^0.1.0-alpha.0",
35
+ "@dataimago/css": "^0.1.0-alpha.0"
36
+ },
37
+ "devDependencies": {
38
+ "@types/react": "^18.3.0",
39
+ "@types/react-dom": "^18.3.0",
40
+ "react": "^18.3.1",
41
+ "react-dom": "^18.3.1",
42
+ "tsup": "^8.3.0",
43
+ "typescript": "^5.6.0",
44
+ "@dataimago/tokens": "^0.1.0-alpha.1",
45
+ "@dataimago/css": "^0.1.0-alpha.1"
46
+ },
47
+ "keywords": [
48
+ "react",
49
+ "components",
50
+ "design-system",
51
+ "dataimago"
52
+ ],
53
+ "scripts": {
54
+ "build": "tsup",
55
+ "dev": "tsup --watch"
56
+ }
57
+ }