@axis-ds/agentic-ui 1.4.0 → 1.5.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.
Files changed (62) hide show
  1. package/README.md +43 -2
  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 +30 -29
  35. package/dist/streaming-text/index.mjs +61 -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 +94 -6
  45. package/dist/chunk-42KEAZ2Y.mjs +0 -109
  46. package/dist/chunk-4CMUEGLK.mjs +0 -80
  47. package/dist/chunk-4V4BWBRC.mjs +0 -77
  48. package/dist/chunk-7HTVJ6MK.mjs +0 -94
  49. package/dist/chunk-DPLGRVNQ.mjs +0 -95
  50. package/dist/chunk-FYAMA32G.mjs +0 -50
  51. package/dist/chunk-GQYOOLDL.mjs +0 -63
  52. package/dist/chunk-IOF4OET6.mjs +0 -162
  53. package/dist/chunk-J4FIMXXG.mjs +0 -106
  54. package/dist/chunk-JY7MTMMB.mjs +0 -83
  55. package/dist/chunk-KJVPVBET.mjs +0 -103
  56. package/dist/chunk-OYQX3SL4.mjs +0 -152
  57. package/dist/chunk-QS6GQNSE.mjs +0 -86
  58. package/dist/chunk-R4CMHIRO.mjs +0 -72
  59. package/dist/chunk-SCXUEQLI.mjs +0 -136
  60. package/dist/chunk-UDL4M5RP.mjs +0 -75
  61. package/dist/chunk-WFYQINWD.mjs +0 -115
  62. package/dist/chunk-ZW4Z27AB.mjs +0 -84
@@ -1,83 +0,0 @@
1
- import {
2
- AGENT_STATUS_LABELS
3
- } from "./chunk-SCZ4BQ2G.mjs";
4
-
5
- // src/agent-avatar/index.tsx
6
- import { cn } from "@axis-ds/ui-react";
7
- import { jsx, jsxs } from "react/jsx-runtime";
8
- var sizeStyles = {
9
- sm: "w-6 h-6 text-xs",
10
- md: "w-8 h-8 text-sm",
11
- lg: "w-10 h-10 text-base",
12
- xl: "w-12 h-12 text-lg"
13
- };
14
- var statusStyles = {
15
- online: "bg-[var(--axis-status-success)]",
16
- busy: "bg-[var(--axis-status-warning)]",
17
- offline: "bg-[var(--axis-status-neutral)]"
18
- };
19
- var typeColors = {
20
- assistant: "bg-[var(--axis-agent-avatar-assistant)]",
21
- tool: "bg-[var(--axis-agent-avatar-tool)]",
22
- system: "bg-[var(--axis-agent-avatar-system)]"
23
- };
24
- function AgentAvatar({
25
- name,
26
- src,
27
- size = "md",
28
- status,
29
- type = "assistant",
30
- className
31
- }) {
32
- const initials = name.split(" ").map((n) => n[0]).join("").slice(0, 2).toUpperCase();
33
- const statusLabel = status ? AGENT_STATUS_LABELS[status] : "";
34
- const ariaLabel = `${name}${statusLabel ? `, ${statusLabel}` : ""}`;
35
- return /* @__PURE__ */ jsxs(
36
- "div",
37
- {
38
- role: "img",
39
- "aria-label": ariaLabel,
40
- className: cn("relative inline-flex", className),
41
- children: [
42
- src ? /* @__PURE__ */ jsx(
43
- "img",
44
- {
45
- src,
46
- alt: "",
47
- "aria-hidden": "true",
48
- className: cn(
49
- "rounded-full object-cover",
50
- sizeStyles[size]
51
- )
52
- }
53
- ) : /* @__PURE__ */ jsx(
54
- "div",
55
- {
56
- "aria-hidden": "true",
57
- className: cn(
58
- "rounded-full flex items-center justify-center font-medium text-[var(--axis-agent-avatar-text)]",
59
- sizeStyles[size],
60
- typeColors[type]
61
- ),
62
- children: initials
63
- }
64
- ),
65
- status && /* @__PURE__ */ jsx(
66
- "span",
67
- {
68
- "aria-hidden": "true",
69
- className: cn(
70
- "absolute bottom-0 right-0 rounded-full border-2 border-[var(--axis-surface-default)]",
71
- size === "sm" ? "w-2 h-2" : "w-3 h-3",
72
- statusStyles[status]
73
- )
74
- }
75
- )
76
- ]
77
- }
78
- );
79
- }
80
-
81
- export {
82
- AgentAvatar
83
- };
@@ -1,103 +0,0 @@
1
- // src/context-panel/index.tsx
2
- import * as React from "react";
3
- import { cn } from "@axis-ds/ui-react";
4
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
- function ContextPanel({
6
- modelInfo,
7
- systemPrompt,
8
- attachedFiles,
9
- settings,
10
- collapsible = true,
11
- defaultExpanded = false,
12
- className
13
- }) {
14
- const [isExpanded, setIsExpanded] = React.useState(defaultExpanded);
15
- const contentId = React.useId();
16
- const hasContent = modelInfo || systemPrompt || attachedFiles && attachedFiles.length > 0 || settings && Object.keys(settings).length > 0;
17
- if (!hasContent) return null;
18
- const header = /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
19
- /* @__PURE__ */ jsxs("svg", { className: "w-4 h-4 text-[var(--axis-icon-secondary)]", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", "aria-hidden": "true", children: [
20
- /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" }),
21
- /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 12a3 3 0 11-6 0 3 3 0 016 0z" })
22
- ] }),
23
- /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-[var(--axis-text-secondary)]", children: "\uCEE8\uD14D\uC2A4\uD2B8" })
24
- ] });
25
- const content = /* @__PURE__ */ jsxs("div", { id: contentId, className: "space-y-3 mt-2", children: [
26
- modelInfo && /* @__PURE__ */ jsxs("div", { children: [
27
- /* @__PURE__ */ jsx("h5", { className: "text-xs font-medium text-[var(--axis-text-secondary)] mb-1", children: "\uBAA8\uB378" }),
28
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
29
- /* @__PURE__ */ jsx("code", { className: "text-sm font-mono text-[var(--axis-text-primary)]", children: modelInfo.name }),
30
- modelInfo.provider && /* @__PURE__ */ jsx("span", { className: "text-xs text-[var(--axis-text-tertiary)]", children: modelInfo.provider }),
31
- modelInfo.version && /* @__PURE__ */ jsx("span", { className: "text-xs px-1.5 py-0.5 rounded bg-[var(--axis-surface-tertiary)] text-[var(--axis-text-tertiary)]", children: modelInfo.version })
32
- ] })
33
- ] }),
34
- systemPrompt && /* @__PURE__ */ jsxs("div", { children: [
35
- /* @__PURE__ */ jsx("h5", { className: "text-xs font-medium text-[var(--axis-text-secondary)] mb-1", children: "\uC2DC\uC2A4\uD15C \uD504\uB86C\uD504\uD2B8" }),
36
- /* @__PURE__ */ jsx("p", { className: "text-xs text-[var(--axis-text-primary)] p-2 rounded bg-[var(--axis-surface-secondary)] line-clamp-3 whitespace-pre-wrap", children: systemPrompt })
37
- ] }),
38
- attachedFiles && attachedFiles.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
39
- /* @__PURE__ */ jsxs("h5", { className: "text-xs font-medium text-[var(--axis-text-secondary)] mb-1", children: [
40
- "\uCCA8\uBD80 \uD30C\uC77C (",
41
- attachedFiles.length,
42
- ")"
43
- ] }),
44
- /* @__PURE__ */ jsx("div", { className: "space-y-1", children: attachedFiles.map((file, i) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 text-xs text-[var(--axis-text-primary)]", children: [
45
- /* @__PURE__ */ jsx("svg", { className: "w-3 h-3 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: "M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13" }) }),
46
- /* @__PURE__ */ jsx("span", { className: "truncate", children: file })
47
- ] }, i)) })
48
- ] }),
49
- settings && Object.keys(settings).length > 0 && /* @__PURE__ */ jsxs("div", { children: [
50
- /* @__PURE__ */ jsx("h5", { className: "text-xs font-medium text-[var(--axis-text-secondary)] mb-1", children: "\uC124\uC815" }),
51
- /* @__PURE__ */ jsx("div", { className: "space-y-1", children: Object.entries(settings).map(([key, value]) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-xs", children: [
52
- /* @__PURE__ */ jsx("span", { className: "text-[var(--axis-text-secondary)]", children: key }),
53
- /* @__PURE__ */ jsx("code", { className: "font-mono text-[var(--axis-text-primary)]", children: value })
54
- ] }, key)) })
55
- ] })
56
- ] });
57
- return /* @__PURE__ */ jsx(
58
- "div",
59
- {
60
- className: cn(
61
- "rounded-lg border p-3",
62
- "bg-[var(--axis-surface-secondary)] border-[var(--axis-border-default)]",
63
- className
64
- ),
65
- children: collapsible ? /* @__PURE__ */ jsxs(Fragment, { children: [
66
- /* @__PURE__ */ jsxs(
67
- "button",
68
- {
69
- onClick: () => setIsExpanded(!isExpanded),
70
- "aria-expanded": isExpanded,
71
- "aria-controls": contentId,
72
- className: "w-full flex items-center justify-between hover:opacity-80 transition-opacity",
73
- children: [
74
- header,
75
- /* @__PURE__ */ jsx(
76
- "svg",
77
- {
78
- className: cn(
79
- "w-4 h-4 text-[var(--axis-text-secondary)] transition-transform",
80
- isExpanded && "rotate-180"
81
- ),
82
- fill: "none",
83
- stroke: "currentColor",
84
- viewBox: "0 0 24 24",
85
- "aria-hidden": "true",
86
- children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })
87
- }
88
- )
89
- ]
90
- }
91
- ),
92
- isExpanded && content
93
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
94
- header,
95
- content
96
- ] })
97
- }
98
- );
99
- }
100
-
101
- export {
102
- ContextPanel
103
- };
@@ -1,152 +0,0 @@
1
- import {
2
- PLAN_STATUS_LABELS,
3
- STATUS_LABELS
4
- } from "./chunk-SCZ4BQ2G.mjs";
5
-
6
- // src/plan-card/index.tsx
7
- import * as React from "react";
8
- import { cn } from "@axis-ds/ui-react";
9
- import { jsx, jsxs } from "react/jsx-runtime";
10
- var planStatusStyles = {
11
- draft: {
12
- border: "border-l-[var(--axis-status-neutral)]",
13
- badge: "bg-[var(--axis-status-neutral-bg)] text-[var(--axis-status-neutral-strong)]"
14
- },
15
- pending: {
16
- border: "border-l-[var(--axis-status-warning)]",
17
- badge: "bg-[var(--axis-badge-warning-bg)] text-[var(--axis-badge-warning-text)]"
18
- },
19
- approved: {
20
- border: "border-l-[var(--axis-status-success)]",
21
- badge: "bg-[var(--axis-badge-success-bg)] text-[var(--axis-badge-success-text)]"
22
- },
23
- rejected: {
24
- border: "border-l-[var(--axis-status-error)]",
25
- badge: "bg-[var(--axis-badge-error-bg)] text-[var(--axis-badge-error-text)]"
26
- },
27
- executing: {
28
- border: "border-l-[var(--axis-status-running)]",
29
- badge: "bg-[var(--axis-badge-info-bg)] text-[var(--axis-badge-info-text)]"
30
- },
31
- completed: {
32
- border: "border-l-[var(--axis-status-success)]",
33
- badge: "bg-[var(--axis-badge-success-bg)] text-[var(--axis-badge-success-text)]"
34
- }
35
- };
36
- var stepStatusIcons = {
37
- pending: /* @__PURE__ */ jsx("svg", { className: "w-4 h-4 text-[var(--axis-status-neutral)]", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10", strokeWidth: 2 }) }),
38
- running: /* @__PURE__ */ jsxs("svg", { className: "w-4 h-4 text-[var(--axis-status-running)] animate-spin", viewBox: "0 0 24 24", fill: "none", children: [
39
- /* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
40
- /* @__PURE__ */ jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" })
41
- ] }),
42
- complete: /* @__PURE__ */ jsx("svg", { className: "w-4 h-4 text-[var(--axis-status-success)]", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }),
43
- error: /* @__PURE__ */ jsx("svg", { className: "w-4 h-4 text-[var(--axis-status-error)]", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) }),
44
- skipped: /* @__PURE__ */ jsx("svg", { className: "w-4 h-4 text-[var(--axis-status-neutral)]", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 5l7 7-7 7M5 5l7 7-7 7" }) })
45
- };
46
- function PlanCard({
47
- title,
48
- steps,
49
- status = "pending",
50
- onApprove,
51
- onEdit,
52
- onReject,
53
- className
54
- }) {
55
- const styles = planStatusStyles[status];
56
- const titleId = React.useId();
57
- const statusLabel = PLAN_STATUS_LABELS[status];
58
- const completedCount = steps.filter((s) => s.status === "complete").length;
59
- return /* @__PURE__ */ jsxs(
60
- "div",
61
- {
62
- role: "region",
63
- "aria-labelledby": titleId,
64
- className: cn(
65
- "rounded-lg border border-l-[length:var(--axis-plan-card-accent-width)] overflow-hidden",
66
- "bg-[var(--axis-surface-default)] border-[var(--axis-border-default)]",
67
- styles.border,
68
- className
69
- ),
70
- children: [
71
- /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
72
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-2", children: [
73
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
74
- /* @__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: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2" }) }),
75
- /* @__PURE__ */ jsx("h4", { id: titleId, className: "text-sm font-semibold text-[var(--axis-text-primary)]", children: title })
76
- ] }),
77
- /* @__PURE__ */ jsx("span", { className: cn("text-xs px-2 py-0.5 rounded-full font-medium", styles.badge), children: statusLabel })
78
- ] }),
79
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-xs text-[var(--axis-text-tertiary)]", children: [
80
- /* @__PURE__ */ jsxs("span", { children: [
81
- completedCount,
82
- "/",
83
- steps.length,
84
- " \uB2E8\uACC4"
85
- ] }),
86
- steps.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex-1 h-1 rounded-full bg-[var(--axis-surface-secondary)] overflow-hidden", children: /* @__PURE__ */ jsx(
87
- "div",
88
- {
89
- className: "h-full rounded-full bg-[var(--axis-status-success)] transition-all",
90
- style: { width: `${completedCount / steps.length * 100}%` },
91
- "aria-hidden": "true"
92
- }
93
- ) })
94
- ] })
95
- ] }),
96
- /* @__PURE__ */ jsx("div", { role: "list", "aria-label": "\uC2E4\uD589 \uB2E8\uACC4", className: "border-t border-[var(--axis-border-default)] divide-y divide-[var(--axis-border-default)]", children: steps.map((step) => {
97
- const stepStatusLabel = STATUS_LABELS[step.status] || step.status;
98
- return /* @__PURE__ */ jsxs(
99
- "div",
100
- {
101
- role: "listitem",
102
- "aria-current": step.status === "running" ? "step" : void 0,
103
- className: "flex items-start gap-3 px-4 py-2.5",
104
- children: [
105
- /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "mt-0.5 flex-shrink-0", children: stepStatusIcons[step.status] }),
106
- /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
107
- /* @__PURE__ */ jsxs("span", { className: "sr-only", children: [
108
- stepStatusLabel,
109
- ":"
110
- ] }),
111
- /* @__PURE__ */ jsx("p", { className: "text-sm text-[var(--axis-text-primary)]", children: step.label }),
112
- step.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-[var(--axis-text-secondary)] mt-0.5", children: step.description })
113
- ] })
114
- ]
115
- },
116
- step.id
117
- );
118
- }) }),
119
- (status === "pending" || status === "draft") && (onApprove || onEdit || onReject) && /* @__PURE__ */ jsxs("div", { className: "flex gap-2 p-3 border-t border-[var(--axis-border-default)] bg-[var(--axis-surface-secondary)]", children: [
120
- onApprove && /* @__PURE__ */ jsx(
121
- "button",
122
- {
123
- onClick: onApprove,
124
- className: "px-3 py-1.5 text-xs font-medium rounded-md bg-[var(--axis-status-success)] text-[var(--axis-status-success-contrast)] hover:bg-[var(--axis-status-success-strong)] transition-colors",
125
- children: "\uC2B9\uC778"
126
- }
127
- ),
128
- onEdit && /* @__PURE__ */ jsx(
129
- "button",
130
- {
131
- onClick: onEdit,
132
- className: "px-3 py-1.5 text-xs font-medium rounded-md bg-[var(--axis-button-secondary-bg-default)] text-[var(--axis-text-primary)] hover:bg-[var(--axis-button-secondary-bg-hover)] transition-colors",
133
- children: "\uC218\uC815"
134
- }
135
- ),
136
- onReject && /* @__PURE__ */ jsx(
137
- "button",
138
- {
139
- onClick: onReject,
140
- className: "px-3 py-1.5 text-xs font-medium rounded-md text-[var(--axis-status-error)] hover:text-[var(--axis-plan-card-reject-hover-text)] hover:bg-[color:color-mix(in_srgb,var(--axis-status-error)_10%,transparent)] transition-colors",
141
- children: "\uAC70\uC808"
142
- }
143
- )
144
- ] })
145
- ]
146
- }
147
- );
148
- }
149
-
150
- export {
151
- PlanCard
152
- };
@@ -1,86 +0,0 @@
1
- // src/token-usage-indicator/index.tsx
2
- import { cn } from "@axis-ds/ui-react";
3
- import { jsx, jsxs } from "react/jsx-runtime";
4
- function TokenUsageIndicator({
5
- current,
6
- max,
7
- cost,
8
- warningThreshold = 0.8,
9
- compact = false,
10
- className
11
- }) {
12
- const ratio = max > 0 ? current / max : 0;
13
- const percentage = Math.min(Math.round(ratio * 100), 100);
14
- const getColor = () => {
15
- if (ratio >= 1) return "bg-[var(--axis-status-error)]";
16
- if (ratio >= warningThreshold) return "bg-[var(--axis-status-warning)]";
17
- return "bg-[var(--axis-status-success)]";
18
- };
19
- const getTextColor = () => {
20
- if (ratio >= 1) return "text-[var(--axis-status-error)]";
21
- if (ratio >= warningThreshold) return "text-[var(--axis-status-warning)]";
22
- return "text-[var(--axis-text-secondary)]";
23
- };
24
- const formatNumber = (n) => n >= 1e3 ? `${(n / 1e3).toFixed(1)}k` : String(n);
25
- if (compact) {
26
- return /* @__PURE__ */ jsxs(
27
- "span",
28
- {
29
- role: "meter",
30
- "aria-valuenow": current,
31
- "aria-valuemin": 0,
32
- "aria-valuemax": max,
33
- "aria-label": `\uD1A0\uD070 \uC0AC\uC6A9\uB7C9: ${current} / ${max}`,
34
- className: cn("inline-flex items-center gap-1 text-xs", getTextColor(), className),
35
- children: [
36
- /* @__PURE__ */ jsx("svg", { className: "w-3 h-3", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }),
37
- formatNumber(current),
38
- "/",
39
- formatNumber(max),
40
- cost !== void 0 && /* @__PURE__ */ jsxs("span", { className: "text-[var(--axis-text-tertiary)]", children: [
41
- "($",
42
- cost.toFixed(4),
43
- ")"
44
- ] })
45
- ]
46
- }
47
- );
48
- }
49
- return /* @__PURE__ */ jsxs(
50
- "div",
51
- {
52
- role: "meter",
53
- "aria-valuenow": current,
54
- "aria-valuemin": 0,
55
- "aria-valuemax": max,
56
- "aria-label": `\uD1A0\uD070 \uC0AC\uC6A9\uB7C9: ${current} / ${max} (${percentage}%)`,
57
- className: cn("space-y-1", className),
58
- children: [
59
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-xs", children: [
60
- /* @__PURE__ */ jsx("span", { className: "text-[var(--axis-text-secondary)]", children: "\uD1A0\uD070 \uC0AC\uC6A9\uB7C9" }),
61
- /* @__PURE__ */ jsxs("span", { className: getTextColor(), children: [
62
- formatNumber(current),
63
- " / ",
64
- formatNumber(max)
65
- ] })
66
- ] }),
67
- /* @__PURE__ */ jsx("div", { className: "h-1.5 rounded-full bg-[var(--axis-surface-secondary)] overflow-hidden", children: /* @__PURE__ */ jsx(
68
- "div",
69
- {
70
- className: cn("h-full rounded-full transition-all", getColor()),
71
- style: { width: `${percentage}%` },
72
- "aria-hidden": "true"
73
- }
74
- ) }),
75
- cost !== void 0 && /* @__PURE__ */ jsxs("div", { className: "text-xs text-[var(--axis-text-tertiary)] text-right", children: [
76
- "$",
77
- cost.toFixed(4)
78
- ] })
79
- ]
80
- }
81
- );
82
- }
83
-
84
- export {
85
- TokenUsageIndicator
86
- };
@@ -1,72 +0,0 @@
1
- import {
2
- FEEDBACK_LABELS
3
- } from "./chunk-SCZ4BQ2G.mjs";
4
-
5
- // src/feedback-buttons/index.tsx
6
- import * as React from "react";
7
- import { cn } from "@axis-ds/ui-react";
8
- import { jsx, jsxs } from "react/jsx-runtime";
9
- var sizeStyles = {
10
- sm: "p-1",
11
- md: "p-1.5"
12
- };
13
- var iconSizes = {
14
- sm: "w-3.5 h-3.5",
15
- md: "w-4 h-4"
16
- };
17
- function FeedbackButtons({
18
- messageId,
19
- initialFeedback = "none",
20
- onFeedback,
21
- size = "sm",
22
- className
23
- }) {
24
- const [feedback, setFeedback] = React.useState(initialFeedback);
25
- const handleFeedback = (type) => {
26
- const newFeedback = feedback === type ? "none" : type;
27
- setFeedback(newFeedback);
28
- onFeedback?.(messageId, newFeedback);
29
- };
30
- return /* @__PURE__ */ jsxs(
31
- "div",
32
- {
33
- role: "group",
34
- "aria-label": "\uBA54\uC2DC\uC9C0 \uD53C\uB4DC\uBC31",
35
- className: cn("inline-flex items-center gap-1", className),
36
- children: [
37
- /* @__PURE__ */ jsx(
38
- "button",
39
- {
40
- onClick: () => handleFeedback("like"),
41
- "aria-pressed": feedback === "like",
42
- "aria-label": FEEDBACK_LABELS.like,
43
- className: cn(
44
- "rounded-md transition-colors",
45
- sizeStyles[size],
46
- 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)]"
47
- ),
48
- 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" }) })
49
- }
50
- ),
51
- /* @__PURE__ */ jsx(
52
- "button",
53
- {
54
- onClick: () => handleFeedback("dislike"),
55
- "aria-pressed": feedback === "dislike",
56
- "aria-label": FEEDBACK_LABELS.dislike,
57
- className: cn(
58
- "rounded-md transition-colors",
59
- sizeStyles[size],
60
- 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)]"
61
- ),
62
- 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" }) })
63
- }
64
- )
65
- ]
66
- }
67
- );
68
- }
69
-
70
- export {
71
- FeedbackButtons
72
- };
@@ -1,136 +0,0 @@
1
- import {
2
- STATUS_LABELS
3
- } from "./chunk-SCZ4BQ2G.mjs";
4
-
5
- // src/run-progress/index.tsx
6
- import * as React from "react";
7
- import { cn } from "@axis-ds/ui-react";
8
- import { jsx, jsxs } from "react/jsx-runtime";
9
- var statusColors = {
10
- pending: "bg-[var(--axis-status-neutral-muted)] text-[var(--axis-status-neutral-muted-contrast)]",
11
- running: "bg-[var(--axis-status-running)] text-[var(--axis-status-running-contrast)] animate-pulse",
12
- complete: "bg-[var(--axis-status-success)] text-[var(--axis-status-success-contrast)]",
13
- error: "bg-[var(--axis-status-error)] text-[var(--axis-status-error-contrast)]"
14
- };
15
- var statusIcons = {
16
- pending: null,
17
- running: /* @__PURE__ */ jsxs("svg", { className: "w-3 h-3 animate-spin", viewBox: "0 0 24 24", fill: "none", children: [
18
- /* @__PURE__ */ jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
19
- /* @__PURE__ */ jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" })
20
- ] }),
21
- complete: /* @__PURE__ */ jsx("svg", { className: "w-3 h-3", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }),
22
- error: /* @__PURE__ */ jsx("svg", { className: "w-3 h-3", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
23
- };
24
- function RunProgress({
25
- status,
26
- steps,
27
- currentStep,
28
- onCancel,
29
- onRetry,
30
- className
31
- }) {
32
- const progressPercent = React.useMemo(() => {
33
- const completed = steps.filter((s) => s.status === "complete").length;
34
- return Math.round(completed / steps.length * 100);
35
- }, [steps]);
36
- return /* @__PURE__ */ jsxs(
37
- "div",
38
- {
39
- className: cn(
40
- "rounded-lg border p-4",
41
- "bg-[var(--axis-surface-default)] border-[var(--axis-border-default)]",
42
- className
43
- ),
44
- children: [
45
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-4", children: [
46
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
47
- status === "running" && /* @__PURE__ */ jsx("div", { className: "w-2 h-2 rounded-full bg-[var(--axis-status-running)] animate-pulse" }),
48
- /* @__PURE__ */ jsxs("span", { className: "text-sm font-medium text-[var(--axis-text-primary)]", children: [
49
- status === "idle" && "\uB300\uAE30 \uC911",
50
- status === "running" && "\uC2E4\uD589 \uC911",
51
- status === "complete" && "\uC644\uB8CC",
52
- status === "error" && "\uC624\uB958 \uBC1C\uC0DD"
53
- ] })
54
- ] }),
55
- /* @__PURE__ */ jsxs("span", { className: "text-xs text-[var(--axis-text-secondary)]", children: [
56
- progressPercent,
57
- "%"
58
- ] })
59
- ] }),
60
- /* @__PURE__ */ jsx(
61
- "div",
62
- {
63
- role: "progressbar",
64
- "aria-valuenow": progressPercent,
65
- "aria-valuemin": 0,
66
- "aria-valuemax": 100,
67
- "aria-label": `\uC2E4\uD589 \uC9C4\uD589\uB960 ${progressPercent}%`,
68
- className: "w-full h-1.5 rounded-full bg-[var(--axis-surface-secondary)] mb-4",
69
- children: /* @__PURE__ */ jsx(
70
- "div",
71
- {
72
- className: "h-full rounded-full bg-[var(--axis-status-running)] transition-all duration-300",
73
- style: { width: `${progressPercent}%` }
74
- }
75
- )
76
- }
77
- ),
78
- /* @__PURE__ */ jsx("div", { role: "list", "aria-label": "\uC2E4\uD589 \uB2E8\uACC4", className: "space-y-2", children: steps.map((step, index) => /* @__PURE__ */ jsxs(
79
- "div",
80
- {
81
- role: "listitem",
82
- "aria-current": currentStep === index ? "step" : void 0,
83
- className: cn(
84
- "flex items-center gap-3 p-2 rounded-md transition-colors",
85
- currentStep === index && "bg-[var(--axis-surface-secondary)]"
86
- ),
87
- children: [
88
- /* @__PURE__ */ jsx(
89
- "div",
90
- {
91
- className: cn(
92
- "w-5 h-5 rounded-full flex items-center justify-center text-xs",
93
- statusColors[step.status]
94
- ),
95
- "aria-hidden": "true",
96
- children: statusIcons[step.status] || index + 1
97
- }
98
- ),
99
- /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
100
- /* @__PURE__ */ jsxs("span", { className: "sr-only", children: [
101
- STATUS_LABELS[step.status],
102
- ":"
103
- ] }),
104
- /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-[var(--axis-text-primary)] truncate", children: step.label }),
105
- step.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-[var(--axis-text-secondary)] truncate", children: step.description })
106
- ] })
107
- ]
108
- },
109
- step.id
110
- )) }),
111
- (onCancel || onRetry) && /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2 mt-4 pt-4 border-t border-[var(--axis-border-default)]", children: [
112
- status === "running" && onCancel && /* @__PURE__ */ jsx(
113
- "button",
114
- {
115
- onClick: onCancel,
116
- className: "px-3 py-1.5 text-sm rounded-md bg-[var(--axis-surface-secondary)] text-[var(--axis-text-primary)] hover:bg-[var(--axis-surface-tertiary)]",
117
- children: "\uCDE8\uC18C"
118
- }
119
- ),
120
- status === "error" && onRetry && /* @__PURE__ */ jsx(
121
- "button",
122
- {
123
- onClick: onRetry,
124
- className: "px-3 py-1.5 text-sm rounded-md bg-[var(--axis-button-bg-default)] text-[var(--axis-button-text-default)] hover:bg-[var(--axis-button-bg-hover)]",
125
- children: "\uC7AC\uC2DC\uB3C4"
126
- }
127
- )
128
- ] })
129
- ]
130
- }
131
- );
132
- }
133
-
134
- export {
135
- RunProgress
136
- };