@axis-ds/agentic-ui 1.3.0 → 1.5.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.
Files changed (63) hide show
  1. package/README.md +71 -1
  2. package/dist/agent-avatar/index.js +6 -16
  3. package/dist/agent-avatar/index.mjs +75 -4
  4. package/dist/approval-card/index.js +6 -16
  5. package/dist/approval-card/index.mjs +86 -4
  6. package/dist/attachment-card/index.js +5 -17
  7. package/dist/attachment-card/index.mjs +101 -4
  8. package/dist/code-block/index.js +2 -3
  9. package/dist/code-block/index.mjs +76 -3
  10. package/dist/constants/a11y-labels.d.mts +86 -0
  11. package/dist/constants/a11y-labels.d.ts +86 -0
  12. package/dist/constants/a11y-labels.js +105 -0
  13. package/dist/{chunk-SCZ4BQ2G.mjs → constants/a11y-labels.mjs} +21 -17
  14. package/dist/context-panel/index.js +2 -3
  15. package/dist/context-panel/index.mjs +99 -3
  16. package/dist/diff-viewer/index.js +8 -17
  17. package/dist/diff-viewer/index.mjs +155 -4
  18. package/dist/feedback-buttons/index.js +7 -16
  19. package/dist/feedback-buttons/index.mjs +65 -4
  20. package/dist/index.js +36 -1732
  21. package/dist/index.mjs +18 -55
  22. package/dist/message-bubble/index.js +5 -15
  23. package/dist/message-bubble/index.mjs +98 -4
  24. package/dist/plan-card/index.js +6 -28
  25. package/dist/plan-card/index.mjs +143 -4
  26. package/dist/recovery-banner/index.js +1 -3
  27. package/dist/recovery-banner/index.mjs +70 -3
  28. package/dist/run-progress/index.js +5 -19
  29. package/dist/run-progress/index.mjs +128 -4
  30. package/dist/source-panel/index.js +5 -15
  31. package/dist/source-panel/index.mjs +88 -4
  32. package/dist/step-timeline/index.js +3 -17
  33. package/dist/step-timeline/index.mjs +69 -4
  34. package/dist/streaming-text/index.js +2 -3
  35. package/dist/streaming-text/index.mjs +59 -3
  36. package/dist/surface-renderer/index.js +1 -3
  37. package/dist/surface-renderer/index.mjs +79 -3
  38. package/dist/thinking-indicator/index.js +3 -5
  39. package/dist/thinking-indicator/index.mjs +45 -3
  40. package/dist/token-usage-indicator/index.js +1 -3
  41. package/dist/token-usage-indicator/index.mjs +81 -3
  42. package/dist/tool-call-card/index.js +5 -18
  43. package/dist/tool-call-card/index.mjs +108 -4
  44. package/package.json +39 -7
  45. package/tailwind.css +10 -0
  46. package/dist/chunk-42KEAZ2Y.mjs +0 -109
  47. package/dist/chunk-4CMUEGLK.mjs +0 -80
  48. package/dist/chunk-4V4BWBRC.mjs +0 -77
  49. package/dist/chunk-7HTVJ6MK.mjs +0 -94
  50. package/dist/chunk-DPLGRVNQ.mjs +0 -95
  51. package/dist/chunk-FYAMA32G.mjs +0 -50
  52. package/dist/chunk-GQYOOLDL.mjs +0 -63
  53. package/dist/chunk-IOF4OET6.mjs +0 -162
  54. package/dist/chunk-J4FIMXXG.mjs +0 -106
  55. package/dist/chunk-JY7MTMMB.mjs +0 -83
  56. package/dist/chunk-KJVPVBET.mjs +0 -103
  57. package/dist/chunk-OYQX3SL4.mjs +0 -152
  58. package/dist/chunk-QS6GQNSE.mjs +0 -86
  59. package/dist/chunk-R4CMHIRO.mjs +0 -72
  60. package/dist/chunk-SCXUEQLI.mjs +0 -136
  61. package/dist/chunk-UDL4M5RP.mjs +0 -75
  62. package/dist/chunk-WFYQINWD.mjs +0 -115
  63. package/dist/chunk-ZW4Z27AB.mjs +0 -84
@@ -1,7 +1,158 @@
1
- import {
2
- DiffViewer
3
- } from "../chunk-IOF4OET6.mjs";
4
- import "../chunk-SCZ4BQ2G.mjs";
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cn } from "@axis-ds/ui-react";
5
+ import { DIFF_LABELS } from "../constants/a11y-labels.mjs";
6
+ function computeDiff(before, after) {
7
+ const oldLines = before.split("\n");
8
+ const newLines = after.split("\n");
9
+ const m = oldLines.length;
10
+ const n = newLines.length;
11
+ const dp = Array.from({ length: m + 1 }, () => Array(n + 1).fill(0));
12
+ for (let i2 = 1; i2 <= m; i2++) {
13
+ for (let j2 = 1; j2 <= n; j2++) {
14
+ if (oldLines[i2 - 1] === newLines[j2 - 1]) {
15
+ dp[i2][j2] = dp[i2 - 1][j2 - 1] + 1;
16
+ } else {
17
+ dp[i2][j2] = Math.max(dp[i2 - 1][j2], dp[i2][j2 - 1]);
18
+ }
19
+ }
20
+ }
21
+ const result = [];
22
+ let i = m;
23
+ let j = n;
24
+ while (i > 0 || j > 0) {
25
+ if (i > 0 && j > 0 && oldLines[i - 1] === newLines[j - 1]) {
26
+ result.unshift({ type: "unchanged", content: oldLines[i - 1], oldLineNumber: i, newLineNumber: j });
27
+ i--;
28
+ j--;
29
+ } else if (j > 0 && (i === 0 || dp[i][j - 1] >= dp[i - 1][j])) {
30
+ result.unshift({ type: "added", content: newLines[j - 1], newLineNumber: j });
31
+ j--;
32
+ } else if (i > 0) {
33
+ result.unshift({ type: "removed", content: oldLines[i - 1], oldLineNumber: i });
34
+ i--;
35
+ }
36
+ }
37
+ return result;
38
+ }
39
+ const lineTypeStyles = {
40
+ added: "bg-[color:color-mix(in_srgb,var(--axis-diff-added)_10%,transparent)]",
41
+ removed: "bg-[color:color-mix(in_srgb,var(--axis-diff-removed)_10%,transparent)]",
42
+ unchanged: ""
43
+ };
44
+ const lineTypeTextStyles = {
45
+ added: "text-[var(--axis-diff-added-text)]",
46
+ removed: "text-[var(--axis-diff-removed-text)]",
47
+ unchanged: "text-[var(--axis-text-primary)]"
48
+ };
49
+ const lineTypeSymbols = {
50
+ added: "+",
51
+ removed: "-",
52
+ unchanged: " "
53
+ };
54
+ function DiffViewer({
55
+ before,
56
+ after,
57
+ filename,
58
+ viewMode = "unified",
59
+ className
60
+ }) {
61
+ const [mode, setMode] = React.useState(viewMode);
62
+ const diffLines = React.useMemo(() => computeDiff(before, after), [before, after]);
63
+ const addedCount = diffLines.filter((l) => l.type === "added").length;
64
+ const removedCount = diffLines.filter((l) => l.type === "removed").length;
65
+ return /* @__PURE__ */ jsxs(
66
+ "div",
67
+ {
68
+ role: "region",
69
+ "aria-label": filename ? `${filename} \uBCC0\uACBD\uC0AC\uD56D` : "\uCF54\uB4DC \uBCC0\uACBD\uC0AC\uD56D",
70
+ className: cn(
71
+ "rounded-lg border overflow-hidden",
72
+ "bg-[var(--axis-surface-default)] border-[var(--axis-border-default)]",
73
+ className
74
+ ),
75
+ children: [
76
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-3 py-2 border-b border-[var(--axis-border-default)] bg-[var(--axis-surface-secondary)]", children: [
77
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 min-w-0", children: [
78
+ /* @__PURE__ */ jsx("svg", { className: "w-4 h-4 text-[var(--axis-icon-secondary)]", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 6h16M4 12h16M4 18h7" }) }),
79
+ filename && /* @__PURE__ */ jsx("code", { className: "text-xs font-mono text-[var(--axis-text-primary)] truncate", children: filename }),
80
+ /* @__PURE__ */ jsxs("span", { className: "text-xs text-[var(--axis-diff-added)]", "aria-label": `${addedCount}\uC904 ${DIFF_LABELS.added}`, children: [
81
+ "+",
82
+ addedCount
83
+ ] }),
84
+ /* @__PURE__ */ jsxs("span", { className: "text-xs text-[var(--axis-diff-removed)]", "aria-label": `${removedCount}\uC904 ${DIFF_LABELS.removed}`, children: [
85
+ "-",
86
+ removedCount
87
+ ] })
88
+ ] }),
89
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 bg-[var(--axis-surface-tertiary)] rounded-md p-0.5", children: [
90
+ /* @__PURE__ */ jsx(
91
+ "button",
92
+ {
93
+ onClick: () => setMode("unified"),
94
+ "aria-pressed": mode === "unified",
95
+ className: cn(
96
+ "px-2 py-0.5 text-xs rounded transition-colors",
97
+ mode === "unified" ? "bg-[var(--axis-surface-default)] text-[var(--axis-text-primary)] shadow-sm" : "text-[var(--axis-text-tertiary)] hover:text-[var(--axis-text-secondary)]"
98
+ ),
99
+ children: "\uD1B5\uD569"
100
+ }
101
+ ),
102
+ /* @__PURE__ */ jsx(
103
+ "button",
104
+ {
105
+ onClick: () => setMode("split"),
106
+ "aria-pressed": mode === "split",
107
+ className: cn(
108
+ "px-2 py-0.5 text-xs rounded transition-colors",
109
+ mode === "split" ? "bg-[var(--axis-surface-default)] text-[var(--axis-text-primary)] shadow-sm" : "text-[var(--axis-text-tertiary)] hover:text-[var(--axis-text-secondary)]"
110
+ ),
111
+ children: "\uBD84\uD560"
112
+ }
113
+ )
114
+ ] })
115
+ ] }),
116
+ /* @__PURE__ */ jsx("div", { className: "overflow-auto", children: mode === "unified" ? /* @__PURE__ */ jsx(UnifiedView, { lines: diffLines }) : /* @__PURE__ */ jsx(SplitView, { lines: diffLines }) })
117
+ ]
118
+ }
119
+ );
120
+ }
121
+ function UnifiedView({ lines }) {
122
+ return /* @__PURE__ */ jsx("table", { className: "w-full text-xs font-mono border-collapse", role: "presentation", children: /* @__PURE__ */ jsx("tbody", { children: lines.map((line, i) => /* @__PURE__ */ jsxs("tr", { className: lineTypeStyles[line.type], children: [
123
+ /* @__PURE__ */ jsx("td", { className: "select-none text-right px-2 py-0.5 text-[var(--axis-text-tertiary)] w-10 border-r border-[var(--axis-border-default)]", children: line.oldLineNumber ?? "" }),
124
+ /* @__PURE__ */ jsx("td", { className: "select-none text-right px-2 py-0.5 text-[var(--axis-text-tertiary)] w-10 border-r border-[var(--axis-border-default)]", children: line.newLineNumber ?? "" }),
125
+ /* @__PURE__ */ jsx("td", { className: cn("select-none w-4 text-center py-0.5", lineTypeTextStyles[line.type]), children: lineTypeSymbols[line.type] }),
126
+ /* @__PURE__ */ jsx("td", { className: cn("px-2 py-0.5 whitespace-pre", lineTypeTextStyles[line.type]), children: line.content })
127
+ ] }, i)) }) });
128
+ }
129
+ function SplitView({ lines }) {
130
+ const leftLines = [];
131
+ const rightLines = [];
132
+ for (const line of lines) {
133
+ if (line.type === "unchanged") {
134
+ leftLines.push(line);
135
+ rightLines.push(line);
136
+ } else if (line.type === "removed") {
137
+ leftLines.push(line);
138
+ rightLines.push(null);
139
+ } else {
140
+ leftLines.push(null);
141
+ rightLines.push(line);
142
+ }
143
+ }
144
+ return /* @__PURE__ */ jsx("table", { className: "w-full text-xs font-mono border-collapse", role: "presentation", children: /* @__PURE__ */ jsx("tbody", { children: leftLines.map((leftLine, i) => {
145
+ const rightLine = rightLines[i];
146
+ return /* @__PURE__ */ jsxs("tr", { children: [
147
+ /* @__PURE__ */ jsx("td", { className: cn("select-none text-right px-2 py-0.5 text-[var(--axis-text-tertiary)] w-10 border-r border-[var(--axis-border-default)]", leftLine ? lineTypeStyles[leftLine.type] : ""), children: leftLine?.oldLineNumber ?? "" }),
148
+ /* @__PURE__ */ jsx("td", { className: cn("select-none w-4 text-center py-0.5", leftLine ? lineTypeTextStyles[leftLine.type] : ""), children: leftLine ? lineTypeSymbols[leftLine.type] : "" }),
149
+ /* @__PURE__ */ jsx("td", { className: cn("px-2 py-0.5 whitespace-pre w-1/2 border-r border-[var(--axis-border-default)]", leftLine ? cn(lineTypeStyles[leftLine.type], lineTypeTextStyles[leftLine.type]) : ""), children: leftLine?.content ?? "" }),
150
+ /* @__PURE__ */ jsx("td", { className: cn("select-none text-right px-2 py-0.5 text-[var(--axis-text-tertiary)] w-10 border-r border-[var(--axis-border-default)]", rightLine ? lineTypeStyles[rightLine.type] : ""), children: rightLine?.newLineNumber ?? "" }),
151
+ /* @__PURE__ */ jsx("td", { className: cn("select-none w-4 text-center py-0.5", rightLine ? lineTypeTextStyles[rightLine.type] : ""), children: rightLine ? lineTypeSymbols[rightLine.type] : "" }),
152
+ /* @__PURE__ */ jsx("td", { className: cn("px-2 py-0.5 whitespace-pre w-1/2", rightLine ? cn(lineTypeStyles[rightLine.type], lineTypeTextStyles[rightLine.type]) : ""), children: rightLine?.content ?? "" })
153
+ ] }, i);
154
+ }) }) });
155
+ }
5
156
  export {
6
157
  DiffViewer
7
158
  };
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  "use strict";
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
@@ -26,30 +27,20 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
27
  mod
27
28
  ));
28
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/feedback-buttons/index.tsx
31
30
  var feedback_buttons_exports = {};
32
31
  __export(feedback_buttons_exports, {
33
32
  FeedbackButtons: () => FeedbackButtons
34
33
  });
35
34
  module.exports = __toCommonJS(feedback_buttons_exports);
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
36
  var React = __toESM(require("react"));
37
37
  var import_ui_react = require("@axis-ds/ui-react");
38
-
39
- // src/constants/a11y-labels.ts
40
- var FEEDBACK_LABELS = {
41
- like: "\uC88B\uC544\uC694",
42
- dislike: "\uC2EB\uC5B4\uC694",
43
- none: "\uD53C\uB4DC\uBC31 \uC5C6\uC74C"
44
- };
45
-
46
- // src/feedback-buttons/index.tsx
47
- var import_jsx_runtime = require("react/jsx-runtime");
48
- var sizeStyles = {
38
+ var import_a11y_labels = require("../constants/a11y-labels.js");
39
+ const sizeStyles = {
49
40
  sm: "p-1",
50
41
  md: "p-1.5"
51
42
  };
52
- var iconSizes = {
43
+ const iconSizes = {
53
44
  sm: "w-3.5 h-3.5",
54
45
  md: "w-4 h-4"
55
46
  };
@@ -78,7 +69,7 @@ function FeedbackButtons({
78
69
  {
79
70
  onClick: () => handleFeedback("like"),
80
71
  "aria-pressed": feedback === "like",
81
- "aria-label": FEEDBACK_LABELS.like,
72
+ "aria-label": import_a11y_labels.FEEDBACK_LABELS.like,
82
73
  className: (0, import_ui_react.cn)(
83
74
  "rounded-md transition-colors",
84
75
  sizeStyles[size],
@@ -92,7 +83,7 @@ function FeedbackButtons({
92
83
  {
93
84
  onClick: () => handleFeedback("dislike"),
94
85
  "aria-pressed": feedback === "dislike",
95
- "aria-label": FEEDBACK_LABELS.dislike,
86
+ "aria-label": import_a11y_labels.FEEDBACK_LABELS.dislike,
96
87
  className: (0, import_ui_react.cn)(
97
88
  "rounded-md transition-colors",
98
89
  sizeStyles[size],
@@ -1,7 +1,68 @@
1
- import {
2
- FeedbackButtons
3
- } from "../chunk-R4CMHIRO.mjs";
4
- import "../chunk-SCZ4BQ2G.mjs";
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import * as React from "react";
4
+ import { cn } from "@axis-ds/ui-react";
5
+ import { FEEDBACK_LABELS } from "../constants/a11y-labels.mjs";
6
+ const sizeStyles = {
7
+ sm: "p-1",
8
+ md: "p-1.5"
9
+ };
10
+ const iconSizes = {
11
+ sm: "w-3.5 h-3.5",
12
+ md: "w-4 h-4"
13
+ };
14
+ function FeedbackButtons({
15
+ messageId,
16
+ initialFeedback = "none",
17
+ onFeedback,
18
+ size = "sm",
19
+ className
20
+ }) {
21
+ const [feedback, setFeedback] = React.useState(initialFeedback);
22
+ const handleFeedback = (type) => {
23
+ const newFeedback = feedback === type ? "none" : type;
24
+ setFeedback(newFeedback);
25
+ onFeedback?.(messageId, newFeedback);
26
+ };
27
+ return /* @__PURE__ */ jsxs(
28
+ "div",
29
+ {
30
+ role: "group",
31
+ "aria-label": "\uBA54\uC2DC\uC9C0 \uD53C\uB4DC\uBC31",
32
+ className: cn("inline-flex items-center gap-1", className),
33
+ children: [
34
+ /* @__PURE__ */ jsx(
35
+ "button",
36
+ {
37
+ onClick: () => handleFeedback("like"),
38
+ "aria-pressed": feedback === "like",
39
+ "aria-label": FEEDBACK_LABELS.like,
40
+ className: cn(
41
+ "rounded-md transition-colors",
42
+ sizeStyles[size],
43
+ feedback === "like" ? "text-[var(--axis-status-success)] bg-[color:color-mix(in_srgb,var(--axis-status-success)_10%,transparent)]" : "text-[var(--axis-text-tertiary)] hover:text-[var(--axis-text-secondary)] hover:bg-[var(--axis-surface-secondary)]"
44
+ ),
45
+ children: /* @__PURE__ */ jsx("svg", { className: iconSizes[size], fill: feedback === "like" ? "currentColor" : "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M14 9V5a3 3 0 00-3-3l-4 9v11h11.28a2 2 0 002-1.7l1.38-9a2 2 0 00-2-2.3H14zm-9 11H3a2 2 0 01-2-2v-7a2 2 0 012-2h2" }) })
46
+ }
47
+ ),
48
+ /* @__PURE__ */ jsx(
49
+ "button",
50
+ {
51
+ onClick: () => handleFeedback("dislike"),
52
+ "aria-pressed": feedback === "dislike",
53
+ "aria-label": FEEDBACK_LABELS.dislike,
54
+ className: cn(
55
+ "rounded-md transition-colors",
56
+ sizeStyles[size],
57
+ feedback === "dislike" ? "text-[var(--axis-status-error)] bg-[color:color-mix(in_srgb,var(--axis-status-error)_10%,transparent)]" : "text-[var(--axis-text-tertiary)] hover:text-[var(--axis-text-secondary)] hover:bg-[var(--axis-surface-secondary)]"
58
+ ),
59
+ children: /* @__PURE__ */ jsx("svg", { className: iconSizes[size], fill: feedback === "dislike" ? "currentColor" : "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 15V19a3 3 0 003 3l4-9V2H5.72a2 2 0 00-2 1.7l-1.38 9a2 2 0 002 2.3H10zm9-13h2a2 2 0 012 2v7a2 2 0 01-2 2h-2" }) })
60
+ }
61
+ )
62
+ ]
63
+ }
64
+ );
65
+ }
5
66
  export {
6
67
  FeedbackButtons
7
68
  };