@nucleux/action-plan 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/action-plan
2
+
3
+ ActionPlan — a proposed agent plan the user can accept, edit, or reject — 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/action-plan @nucleux/tokens
11
+ ```
12
+
13
+ `react` / `react-dom` are peer dependencies.
14
+
15
+ ## Usage
16
+
17
+ ```tsx
18
+ import { ActionPlan } from "@nucleux/action-plan";
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,111 @@
1
+ "use client";
2
+ 'use strict';
3
+
4
+ var React = require('react');
5
+ var utils = require('@nucleux/utils');
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+
8
+ function _interopNamespace(e) {
9
+ if (e && e.__esModule) return e;
10
+ var n = Object.create(null);
11
+ if (e) {
12
+ Object.keys(e).forEach(function (k) {
13
+ if (k !== 'default') {
14
+ var d = Object.getOwnPropertyDescriptor(e, k);
15
+ Object.defineProperty(n, k, d.get ? d : {
16
+ enumerable: true,
17
+ get: function () { return e[k]; }
18
+ });
19
+ }
20
+ });
21
+ }
22
+ n.default = e;
23
+ return Object.freeze(n);
24
+ }
25
+
26
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
27
+
28
+ // src/index.tsx
29
+ var ActionPlanStep = React__namespace.forwardRef(
30
+ ({ title, description, className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
31
+ "li",
32
+ {
33
+ ref,
34
+ className: utils.cn(
35
+ "flex gap-3 [counter-increment:nx-step]",
36
+ "before:mt-0.5 before:inline-flex before:size-6 before:shrink-0 before:items-center before:justify-center before:rounded-full before:bg-muted before:text-xs before:font-semibold before:text-muted-foreground before:[content:counter(nx-step)]",
37
+ className
38
+ ),
39
+ ...props,
40
+ children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
41
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-foreground", children: title }),
42
+ description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: description })
43
+ ] })
44
+ }
45
+ )
46
+ );
47
+ ActionPlanStep.displayName = "ActionPlanStep";
48
+ var ActionPlan = React__namespace.forwardRef(
49
+ ({
50
+ heading = "Proposed plan",
51
+ description,
52
+ onAccept,
53
+ onEdit,
54
+ onReject,
55
+ acceptLabel = "Accept plan",
56
+ editLabel = "Edit plan",
57
+ rejectLabel = "Reject",
58
+ className,
59
+ children,
60
+ ...props
61
+ }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
62
+ "div",
63
+ {
64
+ ref,
65
+ className: utils.cn("flex flex-col gap-4 rounded-xl border border-border bg-background p-5", className),
66
+ ...props,
67
+ children: [
68
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
69
+ heading && /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-semibold text-foreground", children: heading }),
70
+ description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: description })
71
+ ] }),
72
+ /* @__PURE__ */ jsxRuntime.jsx("ol", { className: "flex flex-col gap-3 [counter-reset:nx-step]", children }),
73
+ (onAccept || onEdit || onReject) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
74
+ onAccept && /* @__PURE__ */ jsxRuntime.jsx(
75
+ "button",
76
+ {
77
+ type: "button",
78
+ onClick: onAccept,
79
+ className: "inline-flex items-center rounded-lg bg-info px-3 py-2 text-sm font-medium text-info-foreground transition-colors hover:bg-info/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
80
+ children: acceptLabel
81
+ }
82
+ ),
83
+ onEdit && /* @__PURE__ */ jsxRuntime.jsx(
84
+ "button",
85
+ {
86
+ type: "button",
87
+ onClick: onEdit,
88
+ className: "inline-flex items-center rounded-lg border border-border bg-background px-3 py-2 text-sm font-medium text-foreground transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
89
+ children: editLabel
90
+ }
91
+ ),
92
+ onReject && /* @__PURE__ */ jsxRuntime.jsx(
93
+ "button",
94
+ {
95
+ type: "button",
96
+ onClick: onReject,
97
+ className: "ml-auto inline-flex items-center rounded-lg px-3 py-2 text-sm font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
98
+ children: rejectLabel
99
+ }
100
+ )
101
+ ] })
102
+ ]
103
+ }
104
+ )
105
+ );
106
+ ActionPlan.displayName = "ActionPlan";
107
+
108
+ exports.ActionPlan = ActionPlan;
109
+ exports.ActionPlanStep = ActionPlanStep;
110
+ //# sourceMappingURL=index.cjs.map
111
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.tsx"],"names":["React","jsx","cn","jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAYO,IAAM,cAAA,GAAuBA,gBAAA,CAAA,UAAA;AAAA,EAClC,CAAC,EAAE,KAAA,EAAO,WAAA,EAAa,WAAW,GAAG,KAAA,IAAS,GAAA,qBAC5CC,cAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,SAAA,EAAWC,QAAA;AAAA,QACT,wCAAA;AAAA,QACA,iPAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEJ,QAAA,kBAAAC,eAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,sCAAA,EACd,QAAA,EAAA;AAAA,wBAAAF,cAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,qCAAA,EAAuC,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,QAC5D,WAAA,oBAAeA,cAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,iCAAiC,QAAA,EAAA,WAAA,EAAY;AAAA,OAAA,EAC/E;AAAA;AAAA;AAGN;AACA,cAAA,CAAe,WAAA,GAAc,gBAAA;AAuBtB,IAAM,UAAA,GAAmBD,gBAAA,CAAA,UAAA;AAAA,EAC9B,CACE;AAAA,IACE,OAAA,GAAU,eAAA;AAAA,IACV,WAAA;AAAA,IACA,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AET,QAAA,EAAA;AAAA;AAAA,WACH;AAAA,UAED,QAAA,oBACCA,cAAA;AAAA,YAAC,QAAA;AAAA,YAAA;AAAA,cACC,IAAA,EAAK,QAAA;AAAA,cACL,OAAA,EAAS,QAAA;AAAA,cACT,SAAA,EAAU,iOAAA;AAAA,cAET,QAAA,EAAA;AAAA;AAAA;AACH,SAAA,EAEJ;AAAA;AAAA;AAAA;AAIR;AACA,UAAA,CAAW,WAAA,GAAc,YAAA","file":"index.cjs","sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@nucleux/utils\";\n\nexport interface ActionPlanStepProps\n extends Omit<React.LiHTMLAttributes<HTMLLIElement>, \"title\"> {\n /** Step title. */\n title: React.ReactNode;\n /** Supporting detail under the title. */\n description?: React.ReactNode;\n}\n\n/** A single step in an {@link ActionPlan}. Numbered automatically by its order. */\nexport const ActionPlanStep = React.forwardRef<HTMLLIElement, ActionPlanStepProps>(\n ({ title, description, className, ...props }, ref) => (\n <li\n ref={ref}\n className={cn(\n \"flex gap-3 [counter-increment:nx-step]\",\n \"before:mt-0.5 before:inline-flex before:size-6 before:shrink-0 before:items-center before:justify-center before:rounded-full before:bg-muted before:text-xs before:font-semibold before:text-muted-foreground before:[content:counter(nx-step)]\",\n className,\n )}\n {...props}\n >\n <span className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <span className=\"text-sm font-medium text-foreground\">{title}</span>\n {description && <span className=\"text-xs text-muted-foreground\">{description}</span>}\n </span>\n </li>\n ),\n);\nActionPlanStep.displayName = \"ActionPlanStep\";\n\nexport interface ActionPlanProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Heading, e.g. `\"Proposed plan\"`. */\n heading?: React.ReactNode;\n /** Short description of what the agent intends to do. */\n description?: React.ReactNode;\n /** Called when the plan is accepted. Renders the accept button when set. */\n onAccept?: () => void;\n /** Called when the user asks to edit the plan. Renders the edit button when set. */\n onEdit?: () => void;\n /** Called when the plan is rejected. Renders the reject button when set. */\n onReject?: () => void;\n acceptLabel?: React.ReactNode;\n editLabel?: React.ReactNode;\n rejectLabel?: React.ReactNode;\n}\n\n/**\n * A multi-step plan an agent proposes before executing — the user can accept,\n * edit, or reject it. Human-in-the-loop approval for autonomous work.\n * Source: Figma \"During Interaction / Action Plan\".\n */\nexport const ActionPlan = React.forwardRef<HTMLDivElement, ActionPlanProps>(\n (\n {\n heading = \"Proposed plan\",\n description,\n onAccept,\n onEdit,\n onReject,\n acceptLabel = \"Accept plan\",\n editLabel = \"Edit plan\",\n rejectLabel = \"Reject\",\n className,\n children,\n ...props\n },\n ref,\n ) => (\n <div\n ref={ref}\n className={cn(\"flex flex-col gap-4 rounded-xl border border-border bg-background p-5\", className)}\n {...props}\n >\n <div className=\"flex flex-col gap-1\">\n {heading && <h3 className=\"text-sm font-semibold text-foreground\">{heading}</h3>}\n {description && <p className=\"text-sm text-muted-foreground\">{description}</p>}\n </div>\n <ol className=\"flex flex-col gap-3 [counter-reset:nx-step]\">{children}</ol>\n {(onAccept || onEdit || onReject) && (\n <div className=\"flex flex-wrap items-center gap-2\">\n {onAccept && (\n <button\n type=\"button\"\n onClick={onAccept}\n className=\"inline-flex items-center rounded-lg bg-info px-3 py-2 text-sm font-medium text-info-foreground transition-colors hover:bg-info/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {acceptLabel}\n </button>\n )}\n {onEdit && (\n <button\n type=\"button\"\n onClick={onEdit}\n className=\"inline-flex items-center rounded-lg border border-border bg-background px-3 py-2 text-sm font-medium text-foreground transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {editLabel}\n </button>\n )}\n {onReject && (\n <button\n type=\"button\"\n onClick={onReject}\n className=\"ml-auto inline-flex items-center rounded-lg px-3 py-2 text-sm font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {rejectLabel}\n </button>\n )}\n </div>\n )}\n </div>\n ),\n);\nActionPlan.displayName = \"ActionPlan\";\n"]}
@@ -0,0 +1,33 @@
1
+ import * as React from 'react';
2
+
3
+ interface ActionPlanStepProps extends Omit<React.LiHTMLAttributes<HTMLLIElement>, "title"> {
4
+ /** Step title. */
5
+ title: React.ReactNode;
6
+ /** Supporting detail under the title. */
7
+ description?: React.ReactNode;
8
+ }
9
+ /** A single step in an {@link ActionPlan}. Numbered automatically by its order. */
10
+ declare const ActionPlanStep: React.ForwardRefExoticComponent<ActionPlanStepProps & React.RefAttributes<HTMLLIElement>>;
11
+ interface ActionPlanProps extends React.HTMLAttributes<HTMLDivElement> {
12
+ /** Heading, e.g. `"Proposed plan"`. */
13
+ heading?: React.ReactNode;
14
+ /** Short description of what the agent intends to do. */
15
+ description?: React.ReactNode;
16
+ /** Called when the plan is accepted. Renders the accept button when set. */
17
+ onAccept?: () => void;
18
+ /** Called when the user asks to edit the plan. Renders the edit button when set. */
19
+ onEdit?: () => void;
20
+ /** Called when the plan is rejected. Renders the reject button when set. */
21
+ onReject?: () => void;
22
+ acceptLabel?: React.ReactNode;
23
+ editLabel?: React.ReactNode;
24
+ rejectLabel?: React.ReactNode;
25
+ }
26
+ /**
27
+ * A multi-step plan an agent proposes before executing — the user can accept,
28
+ * edit, or reject it. Human-in-the-loop approval for autonomous work.
29
+ * Source: Figma "During Interaction / Action Plan".
30
+ */
31
+ declare const ActionPlan: React.ForwardRefExoticComponent<ActionPlanProps & React.RefAttributes<HTMLDivElement>>;
32
+
33
+ export { ActionPlan, type ActionPlanProps, ActionPlanStep, type ActionPlanStepProps };
@@ -0,0 +1,33 @@
1
+ import * as React from 'react';
2
+
3
+ interface ActionPlanStepProps extends Omit<React.LiHTMLAttributes<HTMLLIElement>, "title"> {
4
+ /** Step title. */
5
+ title: React.ReactNode;
6
+ /** Supporting detail under the title. */
7
+ description?: React.ReactNode;
8
+ }
9
+ /** A single step in an {@link ActionPlan}. Numbered automatically by its order. */
10
+ declare const ActionPlanStep: React.ForwardRefExoticComponent<ActionPlanStepProps & React.RefAttributes<HTMLLIElement>>;
11
+ interface ActionPlanProps extends React.HTMLAttributes<HTMLDivElement> {
12
+ /** Heading, e.g. `"Proposed plan"`. */
13
+ heading?: React.ReactNode;
14
+ /** Short description of what the agent intends to do. */
15
+ description?: React.ReactNode;
16
+ /** Called when the plan is accepted. Renders the accept button when set. */
17
+ onAccept?: () => void;
18
+ /** Called when the user asks to edit the plan. Renders the edit button when set. */
19
+ onEdit?: () => void;
20
+ /** Called when the plan is rejected. Renders the reject button when set. */
21
+ onReject?: () => void;
22
+ acceptLabel?: React.ReactNode;
23
+ editLabel?: React.ReactNode;
24
+ rejectLabel?: React.ReactNode;
25
+ }
26
+ /**
27
+ * A multi-step plan an agent proposes before executing — the user can accept,
28
+ * edit, or reject it. Human-in-the-loop approval for autonomous work.
29
+ * Source: Figma "During Interaction / Action Plan".
30
+ */
31
+ declare const ActionPlan: React.ForwardRefExoticComponent<ActionPlanProps & React.RefAttributes<HTMLDivElement>>;
32
+
33
+ export { ActionPlan, type ActionPlanProps, ActionPlanStep, type ActionPlanStepProps };
package/dist/index.js ADDED
@@ -0,0 +1,88 @@
1
+ "use client";
2
+ import * as React from 'react';
3
+ import { cn } from '@nucleux/utils';
4
+ import { jsx, jsxs } from 'react/jsx-runtime';
5
+
6
+ // src/index.tsx
7
+ var ActionPlanStep = React.forwardRef(
8
+ ({ title, description, className, ...props }, ref) => /* @__PURE__ */ jsx(
9
+ "li",
10
+ {
11
+ ref,
12
+ className: cn(
13
+ "flex gap-3 [counter-increment:nx-step]",
14
+ "before:mt-0.5 before:inline-flex before:size-6 before:shrink-0 before:items-center before:justify-center before:rounded-full before:bg-muted before:text-xs before:font-semibold before:text-muted-foreground before:[content:counter(nx-step)]",
15
+ className
16
+ ),
17
+ ...props,
18
+ children: /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
19
+ /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-foreground", children: title }),
20
+ description && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: description })
21
+ ] })
22
+ }
23
+ )
24
+ );
25
+ ActionPlanStep.displayName = "ActionPlanStep";
26
+ var ActionPlan = React.forwardRef(
27
+ ({
28
+ heading = "Proposed plan",
29
+ description,
30
+ onAccept,
31
+ onEdit,
32
+ onReject,
33
+ acceptLabel = "Accept plan",
34
+ editLabel = "Edit plan",
35
+ rejectLabel = "Reject",
36
+ className,
37
+ children,
38
+ ...props
39
+ }, ref) => /* @__PURE__ */ jsxs(
40
+ "div",
41
+ {
42
+ ref,
43
+ className: cn("flex flex-col gap-4 rounded-xl border border-border bg-background p-5", className),
44
+ ...props,
45
+ children: [
46
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
47
+ heading && /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold text-foreground", children: heading }),
48
+ description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: description })
49
+ ] }),
50
+ /* @__PURE__ */ jsx("ol", { className: "flex flex-col gap-3 [counter-reset:nx-step]", children }),
51
+ (onAccept || onEdit || onReject) && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
52
+ onAccept && /* @__PURE__ */ jsx(
53
+ "button",
54
+ {
55
+ type: "button",
56
+ onClick: onAccept,
57
+ className: "inline-flex items-center rounded-lg bg-info px-3 py-2 text-sm font-medium text-info-foreground transition-colors hover:bg-info/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
58
+ children: acceptLabel
59
+ }
60
+ ),
61
+ onEdit && /* @__PURE__ */ jsx(
62
+ "button",
63
+ {
64
+ type: "button",
65
+ onClick: onEdit,
66
+ className: "inline-flex items-center rounded-lg border border-border bg-background px-3 py-2 text-sm font-medium text-foreground transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
67
+ children: editLabel
68
+ }
69
+ ),
70
+ onReject && /* @__PURE__ */ jsx(
71
+ "button",
72
+ {
73
+ type: "button",
74
+ onClick: onReject,
75
+ className: "ml-auto inline-flex items-center rounded-lg px-3 py-2 text-sm font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
76
+ children: rejectLabel
77
+ }
78
+ )
79
+ ] })
80
+ ]
81
+ }
82
+ )
83
+ );
84
+ ActionPlan.displayName = "ActionPlan";
85
+
86
+ export { ActionPlan, ActionPlanStep };
87
+ //# sourceMappingURL=index.js.map
88
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.tsx"],"names":[],"mappings":";;;;;AAYO,IAAM,cAAA,GAAuB,KAAA,CAAA,UAAA;AAAA,EAClC,CAAC,EAAE,KAAA,EAAO,WAAA,EAAa,WAAW,GAAG,KAAA,IAAS,GAAA,qBAC5C,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,GAAA;AAAA,MACA,SAAA,EAAW,EAAA;AAAA,QACT,wCAAA;AAAA,QACA,iPAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG,KAAA;AAAA,MAEJ,QAAA,kBAAA,IAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,sCAAA,EACd,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,qCAAA,EAAuC,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,QAC5D,WAAA,oBAAe,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,iCAAiC,QAAA,EAAA,WAAA,EAAY;AAAA,OAAA,EAC/E;AAAA;AAAA;AAGN;AACA,cAAA,CAAe,WAAA,GAAc,gBAAA;AAuBtB,IAAM,UAAA,GAAmB,KAAA,CAAA,UAAA;AAAA,EAC9B,CACE;AAAA,IACE,OAAA,GAAU,eAAA;AAAA,IACV,WAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA;AAAA,IACA,QAAA;AAAA,IACA,WA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AA,YAAC,QAAA;AAAA,YAAA;AAAA,cACC,IAAA,EAAK,QAAA;AAAA,cACL,OAAA,EAAS,QAAA;AAAA,cACT,SAAA,EAAU,iOAAA;AAAA,cAET,QAAA,EAAA;AAAA;AAAA;AACH,SAAA,EAEJ;AAAA;AAAA;AAAA;AAIR;AACA,UAAA,CAAW,WAAA,GAAc,YAAA","file":"index.js","sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@nucleux/utils\";\n\nexport interface ActionPlanStepProps\n extends Omit<React.LiHTMLAttributes<HTMLLIElement>, \"title\"> {\n /** Step title. */\n title: React.ReactNode;\n /** Supporting detail under the title. */\n description?: React.ReactNode;\n}\n\n/** A single step in an {@link ActionPlan}. Numbered automatically by its order. */\nexport const ActionPlanStep = React.forwardRef<HTMLLIElement, ActionPlanStepProps>(\n ({ title, description, className, ...props }, ref) => (\n <li\n ref={ref}\n className={cn(\n \"flex gap-3 [counter-increment:nx-step]\",\n \"before:mt-0.5 before:inline-flex before:size-6 before:shrink-0 before:items-center before:justify-center before:rounded-full before:bg-muted before:text-xs before:font-semibold before:text-muted-foreground before:[content:counter(nx-step)]\",\n className,\n )}\n {...props}\n >\n <span className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <span className=\"text-sm font-medium text-foreground\">{title}</span>\n {description && <span className=\"text-xs text-muted-foreground\">{description}</span>}\n </span>\n </li>\n ),\n);\nActionPlanStep.displayName = \"ActionPlanStep\";\n\nexport interface ActionPlanProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Heading, e.g. `\"Proposed plan\"`. */\n heading?: React.ReactNode;\n /** Short description of what the agent intends to do. */\n description?: React.ReactNode;\n /** Called when the plan is accepted. Renders the accept button when set. */\n onAccept?: () => void;\n /** Called when the user asks to edit the plan. Renders the edit button when set. */\n onEdit?: () => void;\n /** Called when the plan is rejected. Renders the reject button when set. */\n onReject?: () => void;\n acceptLabel?: React.ReactNode;\n editLabel?: React.ReactNode;\n rejectLabel?: React.ReactNode;\n}\n\n/**\n * A multi-step plan an agent proposes before executing — the user can accept,\n * edit, or reject it. Human-in-the-loop approval for autonomous work.\n * Source: Figma \"During Interaction / Action Plan\".\n */\nexport const ActionPlan = React.forwardRef<HTMLDivElement, ActionPlanProps>(\n (\n {\n heading = \"Proposed plan\",\n description,\n onAccept,\n onEdit,\n onReject,\n acceptLabel = \"Accept plan\",\n editLabel = \"Edit plan\",\n rejectLabel = \"Reject\",\n className,\n children,\n ...props\n },\n ref,\n ) => (\n <div\n ref={ref}\n className={cn(\"flex flex-col gap-4 rounded-xl border border-border bg-background p-5\", className)}\n {...props}\n >\n <div className=\"flex flex-col gap-1\">\n {heading && <h3 className=\"text-sm font-semibold text-foreground\">{heading}</h3>}\n {description && <p className=\"text-sm text-muted-foreground\">{description}</p>}\n </div>\n <ol className=\"flex flex-col gap-3 [counter-reset:nx-step]\">{children}</ol>\n {(onAccept || onEdit || onReject) && (\n <div className=\"flex flex-wrap items-center gap-2\">\n {onAccept && (\n <button\n type=\"button\"\n onClick={onAccept}\n className=\"inline-flex items-center rounded-lg bg-info px-3 py-2 text-sm font-medium text-info-foreground transition-colors hover:bg-info/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {acceptLabel}\n </button>\n )}\n {onEdit && (\n <button\n type=\"button\"\n onClick={onEdit}\n className=\"inline-flex items-center rounded-lg border border-border bg-background px-3 py-2 text-sm font-medium text-foreground transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {editLabel}\n </button>\n )}\n {onReject && (\n <button\n type=\"button\"\n onClick={onReject}\n className=\"ml-auto inline-flex items-center rounded-lg px-3 py-2 text-sm font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {rejectLabel}\n </button>\n )}\n </div>\n )}\n </div>\n ),\n);\nActionPlan.displayName = \"ActionPlan\";\n"]}
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@nucleux/action-plan",
3
+ "version": "0.1.1",
4
+ "type": "module",
5
+ "sideEffects": false,
6
+ "description": "ActionPlan — a proposed agent plan the user can accept, edit, or reject — Nucleux agentic UI for React.",
7
+ "keywords": [
8
+ "nucleux",
9
+ "react",
10
+ "ui",
11
+ "components",
12
+ "agentic",
13
+ "ai",
14
+ "tailwind",
15
+ "action-plan"
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/action-plan"
53
+ },
54
+ "homepage": "https://github.com/intelligaia-open-labs/nucleux#readme",
55
+ "scripts": {
56
+ "build": "tsup"
57
+ }
58
+ }