@nucleux/ai-disclosure 0.1.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/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 ADDED
@@ -0,0 +1,26 @@
1
+ # @nucleux/ai-disclosure
2
+
3
+ AiDisclosure — provenance and fallibility markers for AI-generated content — 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
+ ## Install
8
+
9
+ ```bash
10
+ pnpm add @nucleux/ai-disclosure @nucleux/tokens
11
+ ```
12
+
13
+ `react` / `react-dom` are peer dependencies.
14
+
15
+ ## Usage
16
+
17
+ ```tsx
18
+ import { AiDisclosure } from "@nucleux/ai-disclosure";
19
+ ```
20
+
21
+ Requires the theme once in your app: `import "@nucleux/tokens/styles.css";`
22
+ and the Tailwind preset from `@nucleux/tokens/preset`.
23
+
24
+ ## License
25
+
26
+ MIT © Nucleux
package/dist/index.cjs ADDED
@@ -0,0 +1,97 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var React = require('react');
5
+ var utils = require('@nucleux/utils');
6
+ var lucideReact = require('lucide-react');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n.default = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
28
+
29
+ // src/index.tsx
30
+ var defaults = {
31
+ pill: "AI-assisted",
32
+ badge: "Made with AI",
33
+ banner: "This content was generated by AI. Review it before relying on it."
34
+ };
35
+ var AiDisclosure = React__namespace.forwardRef(
36
+ ({ variant = "pill", icon, label, className, children, ...props }, ref) => {
37
+ const content = children ?? label ?? defaults[variant];
38
+ const glyph = icon ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sparkles, { "aria-hidden": "true" });
39
+ if (variant === "banner") {
40
+ return /* @__PURE__ */ jsxRuntime.jsxs(
41
+ "div",
42
+ {
43
+ ref,
44
+ className: utils.cn(
45
+ "flex items-center gap-2 rounded-lg border border-brand/20 bg-brand-muted/40 px-3 py-2 text-sm text-foreground [&_svg]:size-4 [&_svg]:text-brand",
46
+ className
47
+ ),
48
+ ...props,
49
+ children: [
50
+ glyph,
51
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: content })
52
+ ]
53
+ }
54
+ );
55
+ }
56
+ return /* @__PURE__ */ jsxRuntime.jsxs(
57
+ "div",
58
+ {
59
+ ref,
60
+ className: utils.cn(
61
+ "inline-flex w-fit items-center gap-1 rounded-full font-medium text-brand [&_svg]:size-3.5",
62
+ variant === "badge" ? "bg-background/90 px-2 py-1 text-xs shadow-sm backdrop-blur" : "bg-brand-muted/60 px-2.5 py-1 text-xs",
63
+ className
64
+ ),
65
+ ...props,
66
+ children: [
67
+ glyph,
68
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: content })
69
+ ]
70
+ }
71
+ );
72
+ }
73
+ );
74
+ AiDisclosure.displayName = "AiDisclosure";
75
+ var AiCaveat = React__namespace.forwardRef(
76
+ ({ icon, className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
77
+ "p",
78
+ {
79
+ ref,
80
+ className: utils.cn(
81
+ "inline-flex items-center gap-1.5 text-xs text-muted-foreground [&_svg]:size-3.5",
82
+ className
83
+ ),
84
+ ...props,
85
+ children: [
86
+ icon === void 0 ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Info, { "aria-hidden": "true" }) : icon,
87
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: children ?? "AI can make mistakes. Verify important information." })
88
+ ]
89
+ }
90
+ )
91
+ );
92
+ AiCaveat.displayName = "AiCaveat";
93
+
94
+ exports.AiCaveat = AiCaveat;
95
+ exports.AiDisclosure = AiDisclosure;
96
+ //# sourceMappingURL=index.cjs.map
97
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.tsx"],"names":["React","jsx","Sparkles","jsxs","cn","Info"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,IAAM,QAAA,GAAgD;AAAA,EACpD,IAAA,EAAM,aAAA;AAAA,EACN,KAAA,EAAO,cAAA;AAAA,EACP,MAAA,EAAQ;AACV,CAAA;AAOO,IAAM,YAAA,GAAqBA,gBAAA,CAAA,UAAA;AAAA,EAChC,CAAC,EAAE,OAAA,GAAU,MAAA,EAAQ,IAAA,EAAM,KAAA,EAAO,SAAA,EAAW,QAAA,EAAU,GAAG,KAAA,EAAM,EAAG,GAAA,KAAQ;AACzE,IAAA,MAAM,OAAA,GAAU,QAAA,IAAY,KAAA,IAAS,QAAA,CAAS,OAAO,CAAA;AACrD,IAAA,MAAM,KAAA,GAAQ,IAAA,oBAAQC,cAAA,CAACC,oBAAA,EAAA,EAAS,eAAY,MAAA,EAAO,CAAA;AACnD,IAAA,IAAI,YAAY,QAAA,EAAU;AACxB,MAAA,uBACEC,eAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,GAAA;AAAA,UACA,SAAA,EAAWC,QAAA;AAAA,YACT,iJAAA;AAAA,YACA;AAAA,WACF;AAAA,UACC,GAAG,KAAA;AAAA,UAEH,QAAA,EAAA;AAAA,YAAA,KAAA;AAAA,4BACDH,cAAA,CAAC,UAAM,QAAA,EAAA,OAAA,EAAQ;AAAA;AAAA;AAAA,OACjB;AAAA,IAEJ;AACA,IAAA,uBACEE,eAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACA,SAAA,EAAWC,QAAA;AAAA,UACT,2FAAA;AAAA,UACA,OAAA,KAAY,UACR,4DAAA,GACA,uCAAA;AAAA,UACJ;AAAA,SACF;AAAA,QACC,GAAG,KAAA;AAAA,QAEH,QAAA,EAAA;AAAA,UAAA,KAAA;AAAA,0BACDH,cAAA,CAAC,UAAM,QAAA,EAAA,OAAA,EAAQ;AAAA;AAAA;AAAA,KACjB;AAAA,EAEJ;AACF;AACA,YAAA,CAAa,WAAA,GAAc,cAAA;AAYpB,IAAM,QAAA,GAAiBD,gBAAA,CAAA,UAAA;AAAA,EAC5B,CAAC,EAAE,IAAA,EAAM,SAAA,EAAW,UAAU,GAAG,KAAA,IAAS,GAAA,qBACxCG,eAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,SAAA,EAAWC,QAAA;AAAA,QACT,iFAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEH,QAAA,EAAA;AAAA,QAAA,IAAA,KAAS,MAAA,mBAAYH,cAAA,CAACI,gBAAA,EAAA,EAAK,aAAA,EAAY,QAAO,CAAA,GAAK,IAAA;AAAA,wBACpDJ,cAAA,CAAC,MAAA,EAAA,EAAM,QAAA,EAAA,QAAA,IAAY,qDAAA,EAAsD;AAAA;AAAA;AAAA;AAG/E;AACA,QAAA,CAAS,WAAA,GAAc,UAAA","file":"index.cjs","sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@nucleux/utils\";\nimport { Sparkles, Info } from \"lucide-react\";\n\nexport type AiDisclosureVariant = \"pill\" | \"badge\" | \"banner\";\n\nexport interface AiDisclosureProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Presentation: inline `pill`, corner `badge`, or full-width `banner`. */\n variant?: AiDisclosureVariant;\n /** Leading icon. Defaults to a sparkle. */\n icon?: React.ReactNode;\n /** Label / message. Ignored if `children` is provided. Has a per-variant default. */\n label?: React.ReactNode;\n}\n\nconst defaults: Record<AiDisclosureVariant, string> = {\n pill: \"AI-assisted\",\n badge: \"Made with AI\",\n banner: \"This content was generated by AI. Review it before relying on it.\",\n};\n\n/**\n * A provenance marker that content was authored or assisted by AI — an\n * anti-deception trust signal, as an inline pill, corner badge, or banner.\n * Source: Figma \"Trust & Disclosure / AI disclosure\".\n */\nexport const AiDisclosure = React.forwardRef<HTMLDivElement, AiDisclosureProps>(\n ({ variant = \"pill\", icon, label, className, children, ...props }, ref) => {\n const content = children ?? label ?? defaults[variant];\n const glyph = icon ?? <Sparkles aria-hidden=\"true\" />;\n if (variant === \"banner\") {\n return (\n <div\n ref={ref}\n className={cn(\n \"flex items-center gap-2 rounded-lg border border-brand/20 bg-brand-muted/40 px-3 py-2 text-sm text-foreground [&_svg]:size-4 [&_svg]:text-brand\",\n className,\n )}\n {...props}\n >\n {glyph}\n <span>{content}</span>\n </div>\n );\n }\n return (\n <div\n ref={ref}\n className={cn(\n \"inline-flex w-fit items-center gap-1 rounded-full font-medium text-brand [&_svg]:size-3.5\",\n variant === \"badge\"\n ? \"bg-background/90 px-2 py-1 text-xs shadow-sm backdrop-blur\"\n : \"bg-brand-muted/60 px-2.5 py-1 text-xs\",\n className,\n )}\n {...props}\n >\n {glyph}\n <span>{content}</span>\n </div>\n );\n },\n);\nAiDisclosure.displayName = \"AiDisclosure\";\n\nexport interface AiCaveatProps extends React.HTMLAttributes<HTMLParagraphElement> {\n /** Leading icon. Defaults to an info glyph. Pass `null` to omit. */\n icon?: React.ReactNode;\n}\n\n/**\n * A short fallibility disclaimer shown near AI output — the standard\n * \"verify before you trust\" caption.\n * Source: Figma \"Onboarding / Caveat\".\n */\nexport const AiCaveat = React.forwardRef<HTMLParagraphElement, AiCaveatProps>(\n ({ icon, className, children, ...props }, ref) => (\n <p\n ref={ref}\n className={cn(\n \"inline-flex items-center gap-1.5 text-xs text-muted-foreground [&_svg]:size-3.5\",\n className,\n )}\n {...props}\n >\n {icon === undefined ? <Info aria-hidden=\"true\" /> : icon}\n <span>{children ?? \"AI can make mistakes. Verify important information.\"}</span>\n </p>\n ),\n);\nAiCaveat.displayName = \"AiCaveat\";\n"]}
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+
3
+ type AiDisclosureVariant = "pill" | "badge" | "banner";
4
+ interface AiDisclosureProps extends React.HTMLAttributes<HTMLDivElement> {
5
+ /** Presentation: inline `pill`, corner `badge`, or full-width `banner`. */
6
+ variant?: AiDisclosureVariant;
7
+ /** Leading icon. Defaults to a sparkle. */
8
+ icon?: React.ReactNode;
9
+ /** Label / message. Ignored if `children` is provided. Has a per-variant default. */
10
+ label?: React.ReactNode;
11
+ }
12
+ /**
13
+ * A provenance marker that content was authored or assisted by AI — an
14
+ * anti-deception trust signal, as an inline pill, corner badge, or banner.
15
+ * Source: Figma "Trust & Disclosure / AI disclosure".
16
+ */
17
+ declare const AiDisclosure: React.ForwardRefExoticComponent<AiDisclosureProps & React.RefAttributes<HTMLDivElement>>;
18
+ interface AiCaveatProps extends React.HTMLAttributes<HTMLParagraphElement> {
19
+ /** Leading icon. Defaults to an info glyph. Pass `null` to omit. */
20
+ icon?: React.ReactNode;
21
+ }
22
+ /**
23
+ * A short fallibility disclaimer shown near AI output — the standard
24
+ * "verify before you trust" caption.
25
+ * Source: Figma "Onboarding / Caveat".
26
+ */
27
+ declare const AiCaveat: React.ForwardRefExoticComponent<AiCaveatProps & React.RefAttributes<HTMLParagraphElement>>;
28
+
29
+ export { AiCaveat, type AiCaveatProps, AiDisclosure, type AiDisclosureProps, type AiDisclosureVariant };
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+
3
+ type AiDisclosureVariant = "pill" | "badge" | "banner";
4
+ interface AiDisclosureProps extends React.HTMLAttributes<HTMLDivElement> {
5
+ /** Presentation: inline `pill`, corner `badge`, or full-width `banner`. */
6
+ variant?: AiDisclosureVariant;
7
+ /** Leading icon. Defaults to a sparkle. */
8
+ icon?: React.ReactNode;
9
+ /** Label / message. Ignored if `children` is provided. Has a per-variant default. */
10
+ label?: React.ReactNode;
11
+ }
12
+ /**
13
+ * A provenance marker that content was authored or assisted by AI — an
14
+ * anti-deception trust signal, as an inline pill, corner badge, or banner.
15
+ * Source: Figma "Trust & Disclosure / AI disclosure".
16
+ */
17
+ declare const AiDisclosure: React.ForwardRefExoticComponent<AiDisclosureProps & React.RefAttributes<HTMLDivElement>>;
18
+ interface AiCaveatProps extends React.HTMLAttributes<HTMLParagraphElement> {
19
+ /** Leading icon. Defaults to an info glyph. Pass `null` to omit. */
20
+ icon?: React.ReactNode;
21
+ }
22
+ /**
23
+ * A short fallibility disclaimer shown near AI output — the standard
24
+ * "verify before you trust" caption.
25
+ * Source: Figma "Onboarding / Caveat".
26
+ */
27
+ declare const AiCaveat: React.ForwardRefExoticComponent<AiCaveatProps & React.RefAttributes<HTMLParagraphElement>>;
28
+
29
+ export { AiCaveat, type AiCaveatProps, AiDisclosure, type AiDisclosureProps, type AiDisclosureVariant };
package/dist/index.js ADDED
@@ -0,0 +1,74 @@
1
+ "use client";
2
+ import * as React from 'react';
3
+ import { cn } from '@nucleux/utils';
4
+ import { Info, Sparkles } from 'lucide-react';
5
+ import { jsxs, jsx } from 'react/jsx-runtime';
6
+
7
+ // src/index.tsx
8
+ var defaults = {
9
+ pill: "AI-assisted",
10
+ badge: "Made with AI",
11
+ banner: "This content was generated by AI. Review it before relying on it."
12
+ };
13
+ var AiDisclosure = React.forwardRef(
14
+ ({ variant = "pill", icon, label, className, children, ...props }, ref) => {
15
+ const content = children ?? label ?? defaults[variant];
16
+ const glyph = icon ?? /* @__PURE__ */ jsx(Sparkles, { "aria-hidden": "true" });
17
+ if (variant === "banner") {
18
+ return /* @__PURE__ */ jsxs(
19
+ "div",
20
+ {
21
+ ref,
22
+ className: cn(
23
+ "flex items-center gap-2 rounded-lg border border-brand/20 bg-brand-muted/40 px-3 py-2 text-sm text-foreground [&_svg]:size-4 [&_svg]:text-brand",
24
+ className
25
+ ),
26
+ ...props,
27
+ children: [
28
+ glyph,
29
+ /* @__PURE__ */ jsx("span", { children: content })
30
+ ]
31
+ }
32
+ );
33
+ }
34
+ return /* @__PURE__ */ jsxs(
35
+ "div",
36
+ {
37
+ ref,
38
+ className: cn(
39
+ "inline-flex w-fit items-center gap-1 rounded-full font-medium text-brand [&_svg]:size-3.5",
40
+ variant === "badge" ? "bg-background/90 px-2 py-1 text-xs shadow-sm backdrop-blur" : "bg-brand-muted/60 px-2.5 py-1 text-xs",
41
+ className
42
+ ),
43
+ ...props,
44
+ children: [
45
+ glyph,
46
+ /* @__PURE__ */ jsx("span", { children: content })
47
+ ]
48
+ }
49
+ );
50
+ }
51
+ );
52
+ AiDisclosure.displayName = "AiDisclosure";
53
+ var AiCaveat = React.forwardRef(
54
+ ({ icon, className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
55
+ "p",
56
+ {
57
+ ref,
58
+ className: cn(
59
+ "inline-flex items-center gap-1.5 text-xs text-muted-foreground [&_svg]:size-3.5",
60
+ className
61
+ ),
62
+ ...props,
63
+ children: [
64
+ icon === void 0 ? /* @__PURE__ */ jsx(Info, { "aria-hidden": "true" }) : icon,
65
+ /* @__PURE__ */ jsx("span", { children: children ?? "AI can make mistakes. Verify important information." })
66
+ ]
67
+ }
68
+ )
69
+ );
70
+ AiCaveat.displayName = "AiCaveat";
71
+
72
+ export { AiCaveat, AiDisclosure };
73
+ //# sourceMappingURL=index.js.map
74
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.tsx"],"names":[],"mappings":";;;;;;AAeA,IAAM,QAAA,GAAgD;AAAA,EACpD,IAAA,EAAM,aAAA;AAAA,EACN,KAAA,EAAO,cAAA;AAAA,EACP,MAAA,EAAQ;AACV,CAAA;AAOO,IAAM,YAAA,GAAqB,KAAA,CAAA,UAAA;AAAA,EAChC,CAAC,EAAE,OAAA,GAAU,MAAA,EAAQ,IAAA,EAAM,KAAA,EAAO,SAAA,EAAW,QAAA,EAAU,GAAG,KAAA,EAAM,EAAG,GAAA,KAAQ;AACzE,IAAA,MAAM,OAAA,GAAU,QAAA,IAAY,KAAA,IAAS,QAAA,CAAS,OAAO,CAAA;AACrD,IAAA,MAAM,KAAA,GAAQ,IAAA,oBAAQ,GAAA,CAAC,QAAA,EAAA,EAAS,eAAY,MAAA,EAAO,CAAA;AACnD,IAAA,IAAI,YAAY,QAAA,EAAU;AACxB,MAAA,uBACE,IAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,GAAA;AAAA,UACA,SAAA,EAAW,EAAA;AAAA,YACT,iJAAA;AAAA,YACA;AAAA,WACF;AAAA,UACC,GAAG,KAAA;AAAA,UAEH,QAAA,EAAA;AAAA,YAAA,KAAA;AAAA,4BACD,GAAA,CAAC,UAAM,QAAA,EAAA,OAAA,EAAQ;AAAA;AAAA;AAAA,OACjB;AAAA,IAEJ;AACA,IAAA,uBACE,IAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACA,SAAA,EAAW,EAAA;AAAA,UACT,2FAAA;AAAA,UACA,OAAA,KAAY,UACR,4DAAA,GACA,uCAAA;AAAA,UACJ;AAAA,SACF;AAAA,QACC,GAAG,KAAA;AAAA,QAEH,QAAA,EAAA;AAAA,UAAA,KAAA;AAAA,0BACD,GAAA,CAAC,UAAM,QAAA,EAAA,OAAA,EAAQ;AAAA;AAAA;AAAA,KACjB;AAAA,EAEJ;AACF;AACA,YAAA,CAAa,WAAA,GAAc,cAAA;AAYpB,IAAM,QAAA,GAAiB,KAAA,CAAA,UAAA;AAAA,EAC5B,CAAC,EAAE,IAAA,EAAM,SAAA,EAAW,UAAU,GAAG,KAAA,IAAS,GAAA,qBACxC,IAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,SAAA,EAAW,EAAA;AAAA,QACT,iFAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEH,QAAA,EAAA;AAAA,QAAA,IAAA,KAAS,MAAA,mBAAY,GAAA,CAAC,IAAA,EAAA,EAAK,aAAA,EAAY,QAAO,CAAA,GAAK,IAAA;AAAA,wBACpD,GAAA,CAAC,MAAA,EAAA,EAAM,QAAA,EAAA,QAAA,IAAY,qDAAA,EAAsD;AAAA;AAAA;AAAA;AAG/E;AACA,QAAA,CAAS,WAAA,GAAc,UAAA","file":"index.js","sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@nucleux/utils\";\nimport { Sparkles, Info } from \"lucide-react\";\n\nexport type AiDisclosureVariant = \"pill\" | \"badge\" | \"banner\";\n\nexport interface AiDisclosureProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Presentation: inline `pill`, corner `badge`, or full-width `banner`. */\n variant?: AiDisclosureVariant;\n /** Leading icon. Defaults to a sparkle. */\n icon?: React.ReactNode;\n /** Label / message. Ignored if `children` is provided. Has a per-variant default. */\n label?: React.ReactNode;\n}\n\nconst defaults: Record<AiDisclosureVariant, string> = {\n pill: \"AI-assisted\",\n badge: \"Made with AI\",\n banner: \"This content was generated by AI. Review it before relying on it.\",\n};\n\n/**\n * A provenance marker that content was authored or assisted by AI — an\n * anti-deception trust signal, as an inline pill, corner badge, or banner.\n * Source: Figma \"Trust & Disclosure / AI disclosure\".\n */\nexport const AiDisclosure = React.forwardRef<HTMLDivElement, AiDisclosureProps>(\n ({ variant = \"pill\", icon, label, className, children, ...props }, ref) => {\n const content = children ?? label ?? defaults[variant];\n const glyph = icon ?? <Sparkles aria-hidden=\"true\" />;\n if (variant === \"banner\") {\n return (\n <div\n ref={ref}\n className={cn(\n \"flex items-center gap-2 rounded-lg border border-brand/20 bg-brand-muted/40 px-3 py-2 text-sm text-foreground [&_svg]:size-4 [&_svg]:text-brand\",\n className,\n )}\n {...props}\n >\n {glyph}\n <span>{content}</span>\n </div>\n );\n }\n return (\n <div\n ref={ref}\n className={cn(\n \"inline-flex w-fit items-center gap-1 rounded-full font-medium text-brand [&_svg]:size-3.5\",\n variant === \"badge\"\n ? \"bg-background/90 px-2 py-1 text-xs shadow-sm backdrop-blur\"\n : \"bg-brand-muted/60 px-2.5 py-1 text-xs\",\n className,\n )}\n {...props}\n >\n {glyph}\n <span>{content}</span>\n </div>\n );\n },\n);\nAiDisclosure.displayName = \"AiDisclosure\";\n\nexport interface AiCaveatProps extends React.HTMLAttributes<HTMLParagraphElement> {\n /** Leading icon. Defaults to an info glyph. Pass `null` to omit. */\n icon?: React.ReactNode;\n}\n\n/**\n * A short fallibility disclaimer shown near AI output — the standard\n * \"verify before you trust\" caption.\n * Source: Figma \"Onboarding / Caveat\".\n */\nexport const AiCaveat = React.forwardRef<HTMLParagraphElement, AiCaveatProps>(\n ({ icon, className, children, ...props }, ref) => (\n <p\n ref={ref}\n className={cn(\n \"inline-flex items-center gap-1.5 text-xs text-muted-foreground [&_svg]:size-3.5\",\n className,\n )}\n {...props}\n >\n {icon === undefined ? <Info aria-hidden=\"true\" /> : icon}\n <span>{children ?? \"AI can make mistakes. Verify important information.\"}</span>\n </p>\n ),\n);\nAiCaveat.displayName = \"AiCaveat\";\n"]}
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@nucleux/ai-disclosure",
3
+ "version": "0.1.1",
4
+ "type": "module",
5
+ "sideEffects": false,
6
+ "description": "AiDisclosure — provenance and fallibility markers for AI-generated content — Nucleux agentic UI for React.",
7
+ "keywords": [
8
+ "nucleux",
9
+ "react",
10
+ "ui",
11
+ "components",
12
+ "agentic",
13
+ "ai",
14
+ "tailwind",
15
+ "ai-disclosure"
16
+ ],
17
+ "main": "./dist/index.cjs",
18
+ "module": "./dist/index.js",
19
+ "types": "./dist/index.d.ts",
20
+ "exports": {
21
+ ".": {
22
+ "types": "./dist/index.d.ts",
23
+ "import": "./dist/index.js",
24
+ "require": "./dist/index.cjs"
25
+ }
26
+ },
27
+ "files": [
28
+ "dist",
29
+ "README.md"
30
+ ],
31
+ "peerDependencies": {
32
+ "react": ">=18",
33
+ "react-dom": ">=18"
34
+ },
35
+ "dependencies": {
36
+ "lucide-react": "^0.469.0",
37
+ "@nucleux/utils": "0.1.1"
38
+ },
39
+ "devDependencies": {
40
+ "tsup": "^8.3.5",
41
+ "typescript": "^5.7.2",
42
+ "@types/react": "^18.3.18",
43
+ "react": "^18.3.1"
44
+ },
45
+ "publishConfig": {
46
+ "access": "public"
47
+ },
48
+ "license": "MIT",
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "git+https://github.com/intelligaia-open-labs/nucleux.git",
52
+ "directory": "packages/ai-disclosure"
53
+ },
54
+ "homepage": "https://github.com/intelligaia-open-labs/nucleux#readme",
55
+ "scripts": {
56
+ "build": "tsup"
57
+ }
58
+ }