@nucleux/md3-agent-avatar 0.0.0-stage → 0.7.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nucleux
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,35 @@
1
- # Temporary Holding Version
1
+ # @nucleux/md3-agent-avatar
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
+ Material 3 Agent Avatar — one non-photographic mark for the agent, with its working state on the mark — Nucleux agentic UI for React.
4
+
5
+ Part of **[Nucleux](https://github.com/intelligaia-open-labs/nucleux)** — agentic UI components for React. Install a single component, or the full kit via [`@nucleux/react`](https://www.npmjs.com/package/@nucleux/react).
6
+
7
+ The Material 3 twin of [`@nucleux/agent-avatar`](https://www.npmjs.com/package/@nucleux/agent-avatar): it shares that package's API — the props types are re-exported from it — so you switch families by changing only the import. Only the look differs: Material 3 colour roles, shape, state layers and motion (with reduced-motion handling).
8
+
9
+ ## Exports
10
+
11
+ - **`Md3AgentAvatar`** — the agent's mark on md-primary-container, named "<name>, AI agent": `name`, `src`, `glyph`, `size` sm/md/lg, `shape` circle/rounded, `working` (an Md3CircularProgress ring on the mark), `status` online/offline/working, `statusLabel`, `descriptor`, `decorative`
12
+ - Types: `Md3AgentAvatarProps`, `Md3AgentAvatarSize`, `Md3AgentAvatarShape`, `Md3AgentAvatarStatus`
13
+
14
+ ## Install
15
+
16
+ ```bash
17
+ pnpm add @nucleux/md3-agent-avatar @nucleux/tokens
18
+ ```
19
+
20
+ `react` / `react-dom` are peer dependencies.
21
+
22
+ ## Usage
23
+
24
+ ```tsx
25
+ import { Md3AgentAvatar } from "@nucleux/md3-agent-avatar";
26
+
27
+ <Md3AgentAvatar name="Aria" working statusLabel="Generating…" />
28
+ ```
29
+
30
+ Requires the theme once in your app: `import "@nucleux/tokens/styles.css";`
31
+ and the Tailwind preset from `@nucleux/tokens/preset`.
32
+
33
+ ## License
34
+
35
+ MIT © Nucleux
package/dist/index.cjs ADDED
@@ -0,0 +1,134 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var React = require('react');
5
+ var utils = require('@nucleux/utils');
6
+ var md3AiIcons = require('@nucleux/md3-ai-icons');
7
+ var md3Color = require('@nucleux/md3-color');
8
+ var md3Progress = require('@nucleux/md3-progress');
9
+ var jsxRuntime = require('react/jsx-runtime');
10
+
11
+ function _interopNamespace(e) {
12
+ if (e && e.__esModule) return e;
13
+ var n = Object.create(null);
14
+ if (e) {
15
+ Object.keys(e).forEach(function (k) {
16
+ if (k !== 'default') {
17
+ var d = Object.getOwnPropertyDescriptor(e, k);
18
+ Object.defineProperty(n, k, d.get ? d : {
19
+ enumerable: true,
20
+ get: function () { return e[k]; }
21
+ });
22
+ }
23
+ });
24
+ }
25
+ n.default = e;
26
+ return Object.freeze(n);
27
+ }
28
+
29
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
30
+
31
+ // src/index.tsx
32
+ var sizeClasses = {
33
+ sm: "size-6 text-[11px] [&_svg]:size-3.5",
34
+ md: "size-8 text-xs [&_svg]:size-4",
35
+ lg: "size-10 text-base [&_svg]:size-5"
36
+ };
37
+ var ringSize = { sm: 32, md: 40, lg: 48 };
38
+ var dotSizes = {
39
+ sm: "size-2 border",
40
+ md: "size-2.5 border-2",
41
+ lg: "size-3 border-2"
42
+ };
43
+ var dotColors = {
44
+ online: "bg-md-tertiary",
45
+ offline: "bg-md-outline",
46
+ working: utils.cn(md3Color.md3AiColorClasses.fill, md3Color.md3AiColorClasses.working)
47
+ };
48
+ var statusWords = {
49
+ online: "Online",
50
+ offline: "Offline",
51
+ working: "Working"
52
+ };
53
+ var Md3AgentAvatar = React__namespace.forwardRef(
54
+ ({
55
+ name,
56
+ src,
57
+ glyph,
58
+ size = "md",
59
+ shape = "circle",
60
+ working = false,
61
+ status,
62
+ statusLabel,
63
+ descriptor = "AI agent",
64
+ decorative = false,
65
+ className,
66
+ ...props
67
+ }, ref) => {
68
+ const Sparkle = md3AiIcons.useAiGlyph("ai-action");
69
+ const isWorking = working || status === "working";
70
+ const words = statusLabel ?? (status ? statusWords[status] : isWorking ? statusWords.working : void 0);
71
+ const radius = shape === "circle" ? "rounded-full" : "rounded-md-md";
72
+ const label = `${name}, ${descriptor}`;
73
+ return /* @__PURE__ */ jsxRuntime.jsxs(
74
+ "span",
75
+ {
76
+ ref,
77
+ "data-shape": shape,
78
+ "data-status": status,
79
+ "aria-hidden": decorative || void 0,
80
+ className: utils.cn("relative inline-flex shrink-0", radius, className),
81
+ ...props,
82
+ children: [
83
+ /* @__PURE__ */ jsxRuntime.jsx(
84
+ "span",
85
+ {
86
+ role: "img",
87
+ "aria-label": label,
88
+ "aria-hidden": decorative || void 0,
89
+ className: utils.cn(
90
+ "flex shrink-0 items-center justify-center overflow-hidden bg-md-primary-container font-medium text-md-on-primary-container",
91
+ radius,
92
+ sizeClasses[size]
93
+ ),
94
+ children: src ? /* @__PURE__ */ jsxRuntime.jsx("img", { src, alt: "", className: "size-full object-cover" }) : glyph ?? /* @__PURE__ */ jsxRuntime.jsx(Sparkle, { className: "text-md-primary" })
95
+ }
96
+ ),
97
+ isWorking && /* @__PURE__ */ jsxRuntime.jsx(
98
+ "span",
99
+ {
100
+ "aria-hidden": "true",
101
+ className: "pointer-events-none absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",
102
+ children: /* @__PURE__ */ jsxRuntime.jsx(
103
+ md3Progress.Md3CircularProgress,
104
+ {
105
+ "aria-hidden": "true",
106
+ size: ringSize[size],
107
+ strokeWidth: 2,
108
+ className: "motion-reduce:animate-none"
109
+ }
110
+ )
111
+ }
112
+ ),
113
+ status && /* @__PURE__ */ jsxRuntime.jsx(
114
+ "span",
115
+ {
116
+ "aria-hidden": "true",
117
+ className: utils.cn(
118
+ "absolute -bottom-0.5 -right-0.5 rounded-full border-md-surface",
119
+ dotSizes[size],
120
+ dotColors[status]
121
+ )
122
+ }
123
+ ),
124
+ !decorative && /* @__PURE__ */ jsxRuntime.jsx("span", { role: "status", className: "sr-only", children: words ?? "" })
125
+ ]
126
+ }
127
+ );
128
+ }
129
+ );
130
+ Md3AgentAvatar.displayName = "Md3AgentAvatar";
131
+
132
+ exports.Md3AgentAvatar = Md3AgentAvatar;
133
+ //# sourceMappingURL=index.cjs.map
134
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.tsx"],"names":["cn","md3AiColorClasses","React","useAiGlyph","jsxs","jsx","Md3CircularProgress"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,IAAM,WAAA,GAA+C;AAAA,EACnD,EAAA,EAAI,qCAAA;AAAA,EACJ,EAAA,EAAI,+BAAA;AAAA,EACJ,EAAA,EAAI;AACN,CAAA;AAEA,IAAM,WAA4C,EA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gBACT,gEAAA;AAAA,gBACA,SAAS,IAAI,CAAA;AAAA,gBACb,UAAU,MAAM;AAAA;AAClB;AAAA,WACF;AAAA,UAED,CAAC,8BACAK,cAAA,CAAC,MAAA,EAAA,EAAK,MAAK,QAAA,EAAS,SAAA,EAAU,SAAA,EAC3B,QAAA,EAAA,KAAA,IAAS,EAAA,EACZ;AAAA;AAAA;AAAA,KAEJ;AAAA,EAEJ;AACF;AACA,cAAA,CAAe,WAAA,GAAc,gBAAA","file":"index.cjs","sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@nucleux/utils\";\nimport type { AgentAvatarProps, AgentAvatarShape, AgentAvatarSize, AgentAvatarStatus } from \"@nucleux/agent-avatar\";\nimport { useAiGlyph } from \"@nucleux/md3-ai-icons\";\nimport { md3AiColorClasses } from \"@nucleux/md3-color\";\nimport { Md3CircularProgress } from \"@nucleux/md3-progress\";\n\nexport type Md3AgentAvatarProps = AgentAvatarProps;\nexport type Md3AgentAvatarSize = AgentAvatarSize;\nexport type Md3AgentAvatarShape = AgentAvatarShape;\nexport type Md3AgentAvatarStatus = AgentAvatarStatus;\n\n// Same three sizes as the twin (24 / 32 / 40): one drawing at every size.\nconst sizeClasses: Record<AgentAvatarSize, string> = {\n sm: \"size-6 text-[11px] [&_svg]:size-3.5\",\n md: \"size-8 text-xs [&_svg]:size-4\",\n lg: \"size-10 text-base [&_svg]:size-5\",\n};\n\nconst ringSize: Record<AgentAvatarSize, number> = { sm: 32, md: 40, lg: 48 };\n\nconst dotSizes: Record<AgentAvatarSize, string> = {\n sm: \"size-2 border\",\n md: \"size-2.5 border-2\",\n lg: \"size-3 border-2\",\n};\n\nconst dotColors: Record<AgentAvatarStatus, string> = {\n online: \"bg-md-tertiary\",\n offline: \"bg-md-outline\",\n working: cn(md3AiColorClasses.fill, md3AiColorClasses.working),\n};\n\nconst statusWords: Record<AgentAvatarStatus, string> = {\n online: \"Online\",\n offline: \"Offline\",\n working: \"Working\",\n};\n\n/**\n * The agent's visual identity in Material 3 — the twin of `AgentAvatar`,\n * with the same API. One stable, non-photographic mark: the reserved AI\n * sparkle in `md-primary` on the agent's `md-primary-container` ground (or\n * an approved image, or a letter), named \"<name>, AI agent\". `working` puts\n * an indeterminate Md3CircularProgress ring on the mark itself, which stops\n * the moment work stops and holds still under reduced motion; `status` adds\n * a dot whose words are announced in a polite live region. Use\n * `shape=\"rounded\"` where people in the same list are circles.\n */\nexport const Md3AgentAvatar = React.forwardRef<HTMLSpanElement, Md3AgentAvatarProps>(\n (\n {\n name,\n src,\n glyph,\n size = \"md\",\n shape = \"circle\",\n working = false,\n status,\n statusLabel,\n descriptor = \"AI agent\",\n decorative = false,\n className,\n ...props\n },\n ref,\n ) => {\n const Sparkle = useAiGlyph(\"ai-action\");\n const isWorking = working || status === \"working\";\n const words = statusLabel ?? (status ? statusWords[status] : isWorking ? statusWords.working : undefined);\n const radius = shape === \"circle\" ? \"rounded-full\" : \"rounded-md-md\";\n const label = `${name}, ${descriptor}`;\n\n return (\n <span\n ref={ref}\n data-shape={shape}\n data-status={status}\n aria-hidden={decorative || undefined}\n className={cn(\"relative inline-flex shrink-0\", radius, className)}\n {...props}\n >\n <span\n role=\"img\"\n aria-label={label}\n aria-hidden={decorative || undefined}\n className={cn(\n \"flex shrink-0 items-center justify-center overflow-hidden bg-md-primary-container font-medium text-md-on-primary-container\",\n radius,\n sizeClasses[size],\n )}\n >\n {src ? (\n <img src={src} alt=\"\" className=\"size-full object-cover\" />\n ) : (\n (glyph ?? <Sparkle className=\"text-md-primary\" />)\n )}\n </span>\n {isWorking && (\n <span\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2\"\n >\n <Md3CircularProgress\n aria-hidden=\"true\"\n size={ringSize[size]}\n strokeWidth={2}\n className=\"motion-reduce:animate-none\"\n />\n </span>\n )}\n {status && (\n <span\n aria-hidden=\"true\"\n className={cn(\n \"absolute -bottom-0.5 -right-0.5 rounded-full border-md-surface\",\n dotSizes[size],\n dotColors[status],\n )}\n />\n )}\n {!decorative && (\n <span role=\"status\" className=\"sr-only\">\n {words ?? \"\"}\n </span>\n )}\n </span>\n );\n },\n);\nMd3AgentAvatar.displayName = \"Md3AgentAvatar\";\n"]}
@@ -0,0 +1,20 @@
1
+ import * as React from 'react';
2
+ import { AgentAvatarProps, AgentAvatarShape, AgentAvatarSize, AgentAvatarStatus } from '@nucleux/agent-avatar';
3
+
4
+ type Md3AgentAvatarProps = AgentAvatarProps;
5
+ type Md3AgentAvatarSize = AgentAvatarSize;
6
+ type Md3AgentAvatarShape = AgentAvatarShape;
7
+ type Md3AgentAvatarStatus = AgentAvatarStatus;
8
+ /**
9
+ * The agent's visual identity in Material 3 — the twin of `AgentAvatar`,
10
+ * with the same API. One stable, non-photographic mark: the reserved AI
11
+ * sparkle in `md-primary` on the agent's `md-primary-container` ground (or
12
+ * an approved image, or a letter), named "<name>, AI agent". `working` puts
13
+ * an indeterminate Md3CircularProgress ring on the mark itself, which stops
14
+ * the moment work stops and holds still under reduced motion; `status` adds
15
+ * a dot whose words are announced in a polite live region. Use
16
+ * `shape="rounded"` where people in the same list are circles.
17
+ */
18
+ declare const Md3AgentAvatar: React.ForwardRefExoticComponent<AgentAvatarProps & React.RefAttributes<HTMLSpanElement>>;
19
+
20
+ export { Md3AgentAvatar, type Md3AgentAvatarProps, type Md3AgentAvatarShape, type Md3AgentAvatarSize, type Md3AgentAvatarStatus };
@@ -0,0 +1,20 @@
1
+ import * as React from 'react';
2
+ import { AgentAvatarProps, AgentAvatarShape, AgentAvatarSize, AgentAvatarStatus } from '@nucleux/agent-avatar';
3
+
4
+ type Md3AgentAvatarProps = AgentAvatarProps;
5
+ type Md3AgentAvatarSize = AgentAvatarSize;
6
+ type Md3AgentAvatarShape = AgentAvatarShape;
7
+ type Md3AgentAvatarStatus = AgentAvatarStatus;
8
+ /**
9
+ * The agent's visual identity in Material 3 — the twin of `AgentAvatar`,
10
+ * with the same API. One stable, non-photographic mark: the reserved AI
11
+ * sparkle in `md-primary` on the agent's `md-primary-container` ground (or
12
+ * an approved image, or a letter), named "<name>, AI agent". `working` puts
13
+ * an indeterminate Md3CircularProgress ring on the mark itself, which stops
14
+ * the moment work stops and holds still under reduced motion; `status` adds
15
+ * a dot whose words are announced in a polite live region. Use
16
+ * `shape="rounded"` where people in the same list are circles.
17
+ */
18
+ declare const Md3AgentAvatar: React.ForwardRefExoticComponent<AgentAvatarProps & React.RefAttributes<HTMLSpanElement>>;
19
+
20
+ export { Md3AgentAvatar, type Md3AgentAvatarProps, type Md3AgentAvatarShape, type Md3AgentAvatarSize, type Md3AgentAvatarStatus };
package/dist/index.js ADDED
@@ -0,0 +1,112 @@
1
+ "use client";
2
+ import * as React from 'react';
3
+ import { cn } from '@nucleux/utils';
4
+ import { useAiGlyph } from '@nucleux/md3-ai-icons';
5
+ import { md3AiColorClasses } from '@nucleux/md3-color';
6
+ import { Md3CircularProgress } from '@nucleux/md3-progress';
7
+ import { jsxs, jsx } from 'react/jsx-runtime';
8
+
9
+ // src/index.tsx
10
+ var sizeClasses = {
11
+ sm: "size-6 text-[11px] [&_svg]:size-3.5",
12
+ md: "size-8 text-xs [&_svg]:size-4",
13
+ lg: "size-10 text-base [&_svg]:size-5"
14
+ };
15
+ var ringSize = { sm: 32, md: 40, lg: 48 };
16
+ var dotSizes = {
17
+ sm: "size-2 border",
18
+ md: "size-2.5 border-2",
19
+ lg: "size-3 border-2"
20
+ };
21
+ var dotColors = {
22
+ online: "bg-md-tertiary",
23
+ offline: "bg-md-outline",
24
+ working: cn(md3AiColorClasses.fill, md3AiColorClasses.working)
25
+ };
26
+ var statusWords = {
27
+ online: "Online",
28
+ offline: "Offline",
29
+ working: "Working"
30
+ };
31
+ var Md3AgentAvatar = React.forwardRef(
32
+ ({
33
+ name,
34
+ src,
35
+ glyph,
36
+ size = "md",
37
+ shape = "circle",
38
+ working = false,
39
+ status,
40
+ statusLabel,
41
+ descriptor = "AI agent",
42
+ decorative = false,
43
+ className,
44
+ ...props
45
+ }, ref) => {
46
+ const Sparkle = useAiGlyph("ai-action");
47
+ const isWorking = working || status === "working";
48
+ const words = statusLabel ?? (status ? statusWords[status] : isWorking ? statusWords.working : void 0);
49
+ const radius = shape === "circle" ? "rounded-full" : "rounded-md-md";
50
+ const label = `${name}, ${descriptor}`;
51
+ return /* @__PURE__ */ jsxs(
52
+ "span",
53
+ {
54
+ ref,
55
+ "data-shape": shape,
56
+ "data-status": status,
57
+ "aria-hidden": decorative || void 0,
58
+ className: cn("relative inline-flex shrink-0", radius, className),
59
+ ...props,
60
+ children: [
61
+ /* @__PURE__ */ jsx(
62
+ "span",
63
+ {
64
+ role: "img",
65
+ "aria-label": label,
66
+ "aria-hidden": decorative || void 0,
67
+ className: cn(
68
+ "flex shrink-0 items-center justify-center overflow-hidden bg-md-primary-container font-medium text-md-on-primary-container",
69
+ radius,
70
+ sizeClasses[size]
71
+ ),
72
+ children: src ? /* @__PURE__ */ jsx("img", { src, alt: "", className: "size-full object-cover" }) : glyph ?? /* @__PURE__ */ jsx(Sparkle, { className: "text-md-primary" })
73
+ }
74
+ ),
75
+ isWorking && /* @__PURE__ */ jsx(
76
+ "span",
77
+ {
78
+ "aria-hidden": "true",
79
+ className: "pointer-events-none absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",
80
+ children: /* @__PURE__ */ jsx(
81
+ Md3CircularProgress,
82
+ {
83
+ "aria-hidden": "true",
84
+ size: ringSize[size],
85
+ strokeWidth: 2,
86
+ className: "motion-reduce:animate-none"
87
+ }
88
+ )
89
+ }
90
+ ),
91
+ status && /* @__PURE__ */ jsx(
92
+ "span",
93
+ {
94
+ "aria-hidden": "true",
95
+ className: cn(
96
+ "absolute -bottom-0.5 -right-0.5 rounded-full border-md-surface",
97
+ dotSizes[size],
98
+ dotColors[status]
99
+ )
100
+ }
101
+ ),
102
+ !decorative && /* @__PURE__ */ jsx("span", { role: "status", className: "sr-only", children: words ?? "" })
103
+ ]
104
+ }
105
+ );
106
+ }
107
+ );
108
+ Md3AgentAvatar.displayName = "Md3AgentAvatar";
109
+
110
+ export { Md3AgentAvatar };
111
+ //# sourceMappingURL=index.js.map
112
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.tsx"],"names":[],"mappings":";;;;;;;;AAaA,IAAM,WAAA,GAA+C;AAAA,EACnD,EAAA,EAAI,qCAAA;AAAA,EACJ,EAAA,EAAI,+BAAA;AAAA,EACJ,EAAA,EAAI;AACN,CAAA;AAEA,IAAM,WAA4C,EAAE,EAAA,EAAI,IAAI,EAAA,EAAI,EAAA,EAAI,IAAI,EAAA,EAAG;AAE3E,IAAM,QAAA,GAA4C;AAAA,EAChD,EAAA,EAAI,eAAA;AAAA,EACJ,EAAA,EAAI,mBAAA;AAAA,EACJ,EAAA,EAAI;AACN,CAAA;AAEA,IAAM,SAAA,GAA+C;AAAA,EACnD,MAAA,EAAQ,gBAAA;AAAA,EACR,OAAA,EAAS,eAAA;AAAA,EACT,OAAA,EAAS,EAAA,CAAG,iBAAA,CAAkB,IAAA,EAAM,kBAAkB,OAAO;AAC/D,CAAA;AAEA,IAAM,WAAA,GAAiD;AAAA,EACrD,MAAA,EAAQ,QAAA;AAAA,EACR,OAAA,EAAS,SAAA;AAAA,EACT,OAAA,EAAS;AACX,CAAA;AAYO,IAAM,cAAA,GAAuB,KAAA,CAAA,UAAA;AAAA,EAClC,CACE;AAAA,IACE,IAAA;AAAA,IACA,GAAA;AAAA,IACA,KAAA;AAAA,IACA,IAAA,GAAO,IAAA;AAAA,IACP,KAAA,GAAQ,QAAA;AAAA,IACR,OAAA,GAAU,KAAA;AAAA,IACV,MAAA;AAAA,IACA,WAAA;AAAA,IACA,UAAA,GAAa,UAAA;AAAA,IACb,UAAA,GAAa,KAAA;AAAA,IACb,SAAA;AAAA,IACA,GAAG;AAAA,KAEL,GAAA,KACG;AACH,IAAA,MAAM,OAAA,GAAU,WAAW,WAAW,CAAA;AACtC,IAAA,MA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A,GAAA;AAAA,gBAAC,mBAAA;AAAA,gBAAA;AAAA,kBACC,aAAA,EAAY,MAAA;AAAA,kBACZ,IAAA,EAAM,SAAS,IAAI,CAAA;AAAA,kBACnB,WAAA,EAAa,CAAA;AAAA,kBACb,SAAA,EAAU;AAAA;AAAA;AACZ;AAAA,WACF;AAAA,UAED,MAAA,oBACC,GAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,aAAA,EAAY,MAAA;AAAA,cACZ,SAAA,EAAW,EAAA;AAAA,gBACT,gEAAA;AAAA,gBACA,SAAS,IAAI,CAAA;AAAA,gBACb,UAAU,MAAM;AAAA;AAClB;AAAA,WACF;AAAA,UAED,CAAC,8BACA,GAAA,CAAC,MAAA,EAAA,EAAK,MAAK,QAAA,EAAS,SAAA,EAAU,SAAA,EAC3B,QAAA,EAAA,KAAA,IAAS,EAAA,EACZ;AAAA;AAAA;AAAA,KAEJ;AAAA,EAEJ;AACF;AACA,cAAA,CAAe,WAAA,GAAc,gBAAA","file":"index.js","sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@nucleux/utils\";\nimport type { AgentAvatarProps, AgentAvatarShape, AgentAvatarSize, AgentAvatarStatus } from \"@nucleux/agent-avatar\";\nimport { useAiGlyph } from \"@nucleux/md3-ai-icons\";\nimport { md3AiColorClasses } from \"@nucleux/md3-color\";\nimport { Md3CircularProgress } from \"@nucleux/md3-progress\";\n\nexport type Md3AgentAvatarProps = AgentAvatarProps;\nexport type Md3AgentAvatarSize = AgentAvatarSize;\nexport type Md3AgentAvatarShape = AgentAvatarShape;\nexport type Md3AgentAvatarStatus = AgentAvatarStatus;\n\n// Same three sizes as the twin (24 / 32 / 40): one drawing at every size.\nconst sizeClasses: Record<AgentAvatarSize, string> = {\n sm: \"size-6 text-[11px] [&_svg]:size-3.5\",\n md: \"size-8 text-xs [&_svg]:size-4\",\n lg: \"size-10 text-base [&_svg]:size-5\",\n};\n\nconst ringSize: Record<AgentAvatarSize, number> = { sm: 32, md: 40, lg: 48 };\n\nconst dotSizes: Record<AgentAvatarSize, string> = {\n sm: \"size-2 border\",\n md: \"size-2.5 border-2\",\n lg: \"size-3 border-2\",\n};\n\nconst dotColors: Record<AgentAvatarStatus, string> = {\n online: \"bg-md-tertiary\",\n offline: \"bg-md-outline\",\n working: cn(md3AiColorClasses.fill, md3AiColorClasses.working),\n};\n\nconst statusWords: Record<AgentAvatarStatus, string> = {\n online: \"Online\",\n offline: \"Offline\",\n working: \"Working\",\n};\n\n/**\n * The agent's visual identity in Material 3 — the twin of `AgentAvatar`,\n * with the same API. One stable, non-photographic mark: the reserved AI\n * sparkle in `md-primary` on the agent's `md-primary-container` ground (or\n * an approved image, or a letter), named \"<name>, AI agent\". `working` puts\n * an indeterminate Md3CircularProgress ring on the mark itself, which stops\n * the moment work stops and holds still under reduced motion; `status` adds\n * a dot whose words are announced in a polite live region. Use\n * `shape=\"rounded\"` where people in the same list are circles.\n */\nexport const Md3AgentAvatar = React.forwardRef<HTMLSpanElement, Md3AgentAvatarProps>(\n (\n {\n name,\n src,\n glyph,\n size = \"md\",\n shape = \"circle\",\n working = false,\n status,\n statusLabel,\n descriptor = \"AI agent\",\n decorative = false,\n className,\n ...props\n },\n ref,\n ) => {\n const Sparkle = useAiGlyph(\"ai-action\");\n const isWorking = working || status === \"working\";\n const words = statusLabel ?? (status ? statusWords[status] : isWorking ? statusWords.working : undefined);\n const radius = shape === \"circle\" ? \"rounded-full\" : \"rounded-md-md\";\n const label = `${name}, ${descriptor}`;\n\n return (\n <span\n ref={ref}\n data-shape={shape}\n data-status={status}\n aria-hidden={decorative || undefined}\n className={cn(\"relative inline-flex shrink-0\", radius, className)}\n {...props}\n >\n <span\n role=\"img\"\n aria-label={label}\n aria-hidden={decorative || undefined}\n className={cn(\n \"flex shrink-0 items-center justify-center overflow-hidden bg-md-primary-container font-medium text-md-on-primary-container\",\n radius,\n sizeClasses[size],\n )}\n >\n {src ? (\n <img src={src} alt=\"\" className=\"size-full object-cover\" />\n ) : (\n (glyph ?? <Sparkle className=\"text-md-primary\" />)\n )}\n </span>\n {isWorking && (\n <span\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2\"\n >\n <Md3CircularProgress\n aria-hidden=\"true\"\n size={ringSize[size]}\n strokeWidth={2}\n className=\"motion-reduce:animate-none\"\n />\n </span>\n )}\n {status && (\n <span\n aria-hidden=\"true\"\n className={cn(\n \"absolute -bottom-0.5 -right-0.5 rounded-full border-md-surface\",\n dotSizes[size],\n dotColors[status],\n )}\n />\n )}\n {!decorative && (\n <span role=\"status\" className=\"sr-only\">\n {words ?? \"\"}\n </span>\n )}\n </span>\n );\n },\n);\nMd3AgentAvatar.displayName = \"Md3AgentAvatar\";\n"]}
package/package.json CHANGED
@@ -1,6 +1,65 @@
1
1
  {
2
2
  "name": "@nucleux/md3-agent-avatar",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.7.0",
4
+ "type": "module",
5
+ "sideEffects": false,
6
+ "description": "Material 3 Agent Avatar — one non-photographic mark for the agent, with its working state on the mark — Nucleux agentic UI for React.",
7
+ "keywords": [
8
+ "nucleux",
9
+ "react",
10
+ "ui",
11
+ "components",
12
+ "agentic",
13
+ "ai",
14
+ "tailwind",
15
+ "md3",
16
+ "material",
17
+ "md3-agent-avatar",
18
+ "agent-avatar",
19
+ "avatar"
20
+ ],
21
+ "main": "./dist/index.cjs",
22
+ "module": "./dist/index.js",
23
+ "types": "./dist/index.d.ts",
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.js",
28
+ "require": "./dist/index.cjs"
29
+ }
30
+ },
31
+ "files": [
32
+ "dist",
33
+ "README.md"
34
+ ],
35
+ "peerDependencies": {
36
+ "react": ">=18",
37
+ "react-dom": ">=18"
38
+ },
39
+ "dependencies": {
40
+ "@nucleux/agent-avatar": "0.7.0",
41
+ "@nucleux/md3-ai-icons": "0.7.0",
42
+ "@nucleux/md3-color": "0.7.0",
43
+ "@nucleux/md3-progress": "0.7.0",
44
+ "@nucleux/utils": "0.7.0"
45
+ },
46
+ "devDependencies": {
47
+ "tsup": "^8.3.5",
48
+ "typescript": "^5.7.2",
49
+ "@types/react": "^18.3.18",
50
+ "react": "^18.3.1"
51
+ },
52
+ "publishConfig": {
53
+ "access": "public"
54
+ },
55
+ "license": "MIT",
56
+ "repository": {
57
+ "type": "git",
58
+ "url": "git+https://github.com/intelligaia-open-labs/nucleux.git",
59
+ "directory": "packages/md3-agent-avatar"
60
+ },
61
+ "homepage": "https://github.com/intelligaia-open-labs/nucleux#readme",
62
+ "scripts": {
63
+ "build": "tsup"
64
+ }
6
65
  }