@humain/ui 2.1.62 → 2.1.65

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 (160) hide show
  1. package/dist/components/organisms/ai/AIToolCall/AIToolCall.d.ts +9 -3
  2. package/dist/components/organisms/ai/AIToolRun/index.d.ts +1 -1
  3. package/dist/components/organisms/ai/AIToolRun/validation.d.ts +24 -3
  4. package/dist/components/organisms/ai/_shared/format-ai-duration.d.ts +1 -0
  5. package/dist/components/organisms/ai/_shared/workflow-step-renderer.d.ts +1 -0
  6. package/dist/index.js +52 -52
  7. package/dist/index151.js +1 -1
  8. package/dist/index174.js +10 -333
  9. package/dist/index174.js.map +1 -1
  10. package/dist/index175.js +310 -137
  11. package/dist/index175.js.map +1 -1
  12. package/dist/index176.js +148 -174
  13. package/dist/index176.js.map +1 -1
  14. package/dist/index177.js +186 -78
  15. package/dist/index177.js.map +1 -1
  16. package/dist/index178.js +74 -124
  17. package/dist/index178.js.map +1 -1
  18. package/dist/index179.js +133 -1
  19. package/dist/index179.js.map +1 -0
  20. package/dist/index180.js +2 -201
  21. package/dist/index181.js +201 -0
  22. package/dist/{index180.js.map → index181.js.map} +1 -1
  23. package/dist/index183.js +130 -166
  24. package/dist/index183.js.map +1 -1
  25. package/dist/index184.js +195 -983
  26. package/dist/index184.js.map +1 -1
  27. package/dist/index185.js +1069 -369
  28. package/dist/index185.js.map +1 -1
  29. package/dist/index186.js +395 -197
  30. package/dist/index186.js.map +1 -1
  31. package/dist/index187.js +198 -243
  32. package/dist/index187.js.map +1 -1
  33. package/dist/index188.js +263 -3
  34. package/dist/index188.js.map +1 -1
  35. package/dist/index189.js +3 -209
  36. package/dist/index189.js.map +1 -1
  37. package/dist/index190.js +190 -777
  38. package/dist/index190.js.map +1 -1
  39. package/dist/index191.js +771 -252
  40. package/dist/index191.js.map +1 -1
  41. package/dist/index192.js +250 -65
  42. package/dist/index192.js.map +1 -1
  43. package/dist/index193.js +72 -523
  44. package/dist/index193.js.map +1 -1
  45. package/dist/index194.js +537 -144
  46. package/dist/index194.js.map +1 -1
  47. package/dist/index195.js +139 -720
  48. package/dist/index195.js.map +1 -1
  49. package/dist/index196.js +707 -167
  50. package/dist/index196.js.map +1 -1
  51. package/dist/index197.js +175 -151
  52. package/dist/index197.js.map +1 -1
  53. package/dist/index198.js +152 -487
  54. package/dist/index198.js.map +1 -1
  55. package/dist/index199.js +472 -225
  56. package/dist/index199.js.map +1 -1
  57. package/dist/index200.js +236 -260
  58. package/dist/index200.js.map +1 -1
  59. package/dist/index201.js +265 -215
  60. package/dist/index201.js.map +1 -1
  61. package/dist/index202.js +207 -307
  62. package/dist/index202.js.map +1 -1
  63. package/dist/index203.js +302 -135
  64. package/dist/index203.js.map +1 -1
  65. package/dist/index204.js +140 -271
  66. package/dist/index204.js.map +1 -1
  67. package/dist/index205.js +263 -253
  68. package/dist/index205.js.map +1 -1
  69. package/dist/index206.js +244 -137
  70. package/dist/index206.js.map +1 -1
  71. package/dist/index207.js +100 -238
  72. package/dist/index207.js.map +1 -1
  73. package/dist/index208.js +278 -74
  74. package/dist/index208.js.map +1 -1
  75. package/dist/index209.js +56 -97
  76. package/dist/index209.js.map +1 -1
  77. package/dist/index210.js +142 -47
  78. package/dist/index210.js.map +1 -1
  79. package/dist/index211.js +38 -84
  80. package/dist/index211.js.map +1 -1
  81. package/dist/index212.js +72 -252
  82. package/dist/index212.js.map +1 -1
  83. package/dist/index213.js +274 -26
  84. package/dist/index213.js.map +1 -1
  85. package/dist/index214.js +29 -94
  86. package/dist/index214.js.map +1 -1
  87. package/dist/index215.js +98 -25
  88. package/dist/index215.js.map +1 -1
  89. package/dist/index216.js +20 -565
  90. package/dist/index216.js.map +1 -1
  91. package/dist/index217.js +564 -17
  92. package/dist/index217.js.map +1 -1
  93. package/dist/index218.js +20 -23
  94. package/dist/index218.js.map +1 -1
  95. package/dist/index219.js +20 -95
  96. package/dist/index219.js.map +1 -1
  97. package/dist/index220.js +92 -88
  98. package/dist/index220.js.map +1 -1
  99. package/dist/index221.js +97 -29
  100. package/dist/index221.js.map +1 -1
  101. package/dist/index222.js +24 -470
  102. package/dist/index222.js.map +1 -1
  103. package/dist/index223.js +446 -196
  104. package/dist/index223.js.map +1 -1
  105. package/dist/index224.js +199 -729
  106. package/dist/index224.js.map +1 -1
  107. package/dist/index225.js +750 -61
  108. package/dist/index225.js.map +1 -1
  109. package/dist/index226.js +58 -181
  110. package/dist/index226.js.map +1 -1
  111. package/dist/index227.js +175 -259
  112. package/dist/index227.js.map +1 -1
  113. package/dist/index228.js +246 -172
  114. package/dist/index228.js.map +1 -1
  115. package/dist/index229.js +195 -32
  116. package/dist/index229.js.map +1 -1
  117. package/dist/index230.js +12 -40
  118. package/dist/index230.js.map +1 -1
  119. package/dist/index231.js +23 -26
  120. package/dist/index231.js.map +1 -1
  121. package/dist/index232.js +45 -22
  122. package/dist/index232.js.map +1 -1
  123. package/dist/index233.js +27 -48
  124. package/dist/index233.js.map +1 -1
  125. package/dist/index234.js +52 -26
  126. package/dist/index234.js.map +1 -1
  127. package/dist/index235.js +40 -225
  128. package/dist/index235.js.map +1 -1
  129. package/dist/index236.js +217 -39
  130. package/dist/index236.js.map +1 -1
  131. package/dist/index237.js +50 -0
  132. package/dist/index237.js.map +1 -0
  133. package/dist/styles.css +1 -1
  134. package/dist/wc/AIToolCall.js +218 -0
  135. package/dist/wc/AIToolCall.js.map +1 -0
  136. package/dist/wc/hf-ai-tool-call.js +34 -219
  137. package/dist/wc/hf-ai-tool-call.js.map +1 -1
  138. package/dist/wc/hf-ai-tool-run.js +673 -576
  139. package/dist/wc/hf-ai-tool-run.js.map +1 -1
  140. package/dist/wc/workflow-step-renderer.js +94 -86
  141. package/dist/wc/workflow-step-renderer.js.map +1 -1
  142. package/dist/wc-react/AIToolCall.js +218 -0
  143. package/dist/wc-react/AIToolCall.js.map +1 -0
  144. package/dist/wc-react/hf-ai-tool-call.js +32 -217
  145. package/dist/wc-react/hf-ai-tool-call.js.map +1 -1
  146. package/dist/wc-react/hf-ai-tool-run.js +698 -601
  147. package/dist/wc-react/hf-ai-tool-run.js.map +1 -1
  148. package/dist/wc-react/workflow-step-renderer.js +76 -68
  149. package/dist/wc-react/workflow-step-renderer.js.map +1 -1
  150. package/package.json +1 -1
  151. package/skills/humain-ui/SKILL.md +1 -1
  152. package/skills/humain-ui-wc/SKILL.md +1 -1
  153. package/skills/humain-ui-wc.skill +0 -0
  154. package/skills/humain-ui.skill +0 -0
  155. package/dist/index182.js +0 -143
  156. package/dist/index182.js.map +0 -1
  157. package/dist/wc/wrench.js +0 -10
  158. package/dist/wc/wrench.js.map +0 -1
  159. package/dist/wc-react/wrench.js +0 -10
  160. package/dist/wc-react/wrench.js.map +0 -1
package/dist/index202.js CHANGED
@@ -1,332 +1,232 @@
1
- import { cn } from "./index2.js";
2
- import { Button } from "./index5.js";
3
- import { Separator } from "./index51.js";
4
- import { Avatar } from "./index70.js";
5
- import { Kbd } from "./index106.js";
6
- import { Breadcrumb as BreadcrumbCompound, BreadcrumbEllipsis, BreadcrumbHomeLink, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from "./index131.js";
7
- import { DropdownMenu } from "./index191.js";
1
+ import { cn, extractText } from "./index2.js";
2
+ import { createSafeContext } from "./index21.js";
8
3
  import { cva } from "class-variance-authority";
9
- import { ArrowLeft, MoreHorizontal, Search } from "lucide-react";
4
+ import { Check } from "lucide-react";
10
5
  import * as React from "react";
11
6
  import { jsx, jsxs } from "react/jsx-runtime";
12
- //#region src/components/organisms/layout/PageHeader/PageHeader.tsx
13
- var pageHeaderVariants = cva("flex flex-col w-full", {
14
- variants: { variant: {
15
- simple: "gap-5",
16
- avatar: "gap-5",
17
- "banner-avatar": "gap-0",
18
- "banner-simple": "gap-0",
19
- "banner-avatar-centered": "gap-0",
20
- "banner-simple-centered": "gap-0"
21
- } },
22
- defaultVariants: { variant: "simple" }
7
+ //#region src/components/organisms/content/Steps/Steps.tsx
8
+ var stepIndicatorVariants = cva("flex items-center justify-center shrink-0 size-[38px] font-medium text-lg transition-all duration-200 ease-out motion-reduce:transition-none", {
9
+ variants: {
10
+ shape: {
11
+ rounded: "rounded-lg",
12
+ round: "rounded-full"
13
+ },
14
+ status: {
15
+ complete: "bg-primary text-primary-foreground shadow-sm",
16
+ active: "bg-primary-foreground border-2 border-primary text-primary shadow-sm",
17
+ incomplete: "bg-accent text-muted-foreground"
18
+ }
19
+ },
20
+ defaultVariants: {
21
+ shape: "rounded",
22
+ status: "incomplete"
23
+ }
23
24
  });
24
- var contentVariants = cva("flex flex-wrap items-start w-full", {
25
- variants: { variant: {
26
- simple: "gap-4",
27
- avatar: "gap-4 md:gap-5",
28
- "banner-avatar": "gap-4 md:gap-6",
29
- "banner-simple": "gap-4 md:gap-6",
30
- "banner-avatar-centered": "flex-col items-center text-center gap-4 md:gap-6",
31
- "banner-simple-centered": "flex-col items-center text-center gap-4 md:gap-6"
32
- } },
33
- defaultVariants: { variant: "simple" }
25
+ var stepConnectorVariants = cva("shrink-0 transition-colors duration-200 ease-out motion-reduce:transition-none", {
26
+ variants: {
27
+ orientation: {
28
+ horizontal: "h-0.5 flex-1 min-w-4 mx-2 mt-[18px]",
29
+ vertical: "w-0.5 h-[30px] my-1 ml-[18px]"
30
+ },
31
+ status: {
32
+ complete: "bg-primary",
33
+ incomplete: "bg-border"
34
+ }
35
+ },
36
+ defaultVariants: {
37
+ orientation: "horizontal",
38
+ status: "incomplete"
39
+ }
34
40
  });
35
- var bannerVariants = cva("relative w-full overflow-hidden bg-gradient-to-br from-secondary to-muted", {
36
- variants: { variant: {
37
- default: "h-40 md:h-60",
38
- centered: "h-40 md:h-60"
41
+ var stepLabelVariants = cva("text-base leading-6", {
42
+ variants: { status: {
43
+ complete: "text-card-foreground",
44
+ active: "text-card-foreground",
45
+ incomplete: "text-muted-foreground"
39
46
  } },
40
- defaultVariants: { variant: "default" }
47
+ defaultVariants: { status: "incomplete" }
41
48
  });
42
- var MAX_VISIBLE_HEADER_ACTIONS = 2;
43
- function getPageHeaderActionVariant(action, index, actionCount) {
44
- return action.variant ?? (index === actionCount - 1 ? "primary" : "secondary");
49
+ var stepSubtextVariants = cva("text-sm leading-5 text-muted-foreground");
50
+ var [StepsContext, useStepsContext] = createSafeContext("Steps");
51
+ /** Per-item index context injected by Steps parent via Children.map or flat API */
52
+ var StepIndexContext = React.createContext(0);
53
+ function StepIndicatorContent({ index, status, shape, bulletType }) {
54
+ if (bulletType === "icon") {
55
+ if (status === "complete") return /* @__PURE__ */ jsx(Check, { className: "size-[22px] delight-check-draw" });
56
+ if (status === "active") return /* @__PURE__ */ jsx("div", { className: cn("size-5 bg-primary", shape === "rounded" ? "rounded-sm" : "rounded-full") });
57
+ return /* @__PURE__ */ jsx("div", { className: "size-1.5 rounded-full bg-current" });
58
+ }
59
+ return index + 1;
45
60
  }
46
- function isPriorityHeaderAction(action, actionCount) {
47
- return getPageHeaderActionVariant(action, action.originalIndex, actionCount) === "primary";
48
- }
49
- function splitPageHeaderActions(actions) {
50
- const indexedActions = actions.map((action, originalIndex) => ({
51
- ...action,
52
- originalIndex
53
- }));
54
- if (indexedActions.length <= MAX_VISIBLE_HEADER_ACTIONS) return {
55
- visibleActions: indexedActions,
56
- overflowActions: []
57
- };
58
- const defaultVisibleActions = indexedActions.slice(0, MAX_VISIBLE_HEADER_ACTIONS);
59
- if (defaultVisibleActions.some((action) => isPriorityHeaderAction(action, indexedActions.length))) return {
60
- visibleActions: defaultVisibleActions,
61
- overflowActions: indexedActions.slice(MAX_VISIBLE_HEADER_ACTIONS)
62
- };
63
- const priorityAction = [...indexedActions].reverse().find((action) => isPriorityHeaderAction(action, indexedActions.length));
64
- if (!priorityAction) return {
65
- visibleActions: defaultVisibleActions,
66
- overflowActions: indexedActions.slice(MAX_VISIBLE_HEADER_ACTIONS)
67
- };
68
- const visibleActions = [indexedActions[0], priorityAction].sort((left, right) => left.originalIndex - right.originalIndex);
69
- const visibleIndexes = new Set(visibleActions.map((action) => action.originalIndex));
70
- return {
71
- visibleActions,
72
- overflowActions: indexedActions.filter((action) => !visibleIndexes.has(action.originalIndex))
73
- };
74
- }
75
- function getOverflowActionItemProps(action) {
76
- const disabled = Boolean(action.overflowProps?.disabled || action.buttonProps?.disabled || action.buttonProps?.loading);
77
- return {
78
- ...action.overflowProps,
79
- disabled
80
- };
81
- }
82
- function PageHeaderBreadcrumbs({ breadcrumbs }) {
83
- if (!breadcrumbs || breadcrumbs.length === 0) return null;
84
- return /* @__PURE__ */ jsx(BreadcrumbCompound, {
85
- className: "hidden md:flex delight-fade-in motion-reduce:!animate-none",
86
- children: /* @__PURE__ */ jsxs(BreadcrumbList, { children: [/* @__PURE__ */ jsx(BreadcrumbItem, { children: /* @__PURE__ */ jsx(BreadcrumbHomeLink, { href: "/" }) }), breadcrumbs.map((item, index) => {
87
- const isLast = index === breadcrumbs.length - 1;
88
- const hasEllipsis = breadcrumbs.length > 3;
89
- if (hasEllipsis && index === 1) return /* @__PURE__ */ jsxs(React.Fragment, { children: [/* @__PURE__ */ jsx(BreadcrumbSeparator, {}), /* @__PURE__ */ jsx(BreadcrumbItem, { children: /* @__PURE__ */ jsx(BreadcrumbEllipsis, {}) })] }, `ellipsis-${index}`);
90
- if (hasEllipsis && index > 1 && !isLast) return null;
91
- return /* @__PURE__ */ jsxs(React.Fragment, { children: [/* @__PURE__ */ jsx(BreadcrumbSeparator, {}), /* @__PURE__ */ jsx(BreadcrumbItem, { children: isLast || item.isCurrent ? /* @__PURE__ */ jsx(BreadcrumbPage, { children: item.label }) : /* @__PURE__ */ jsx(BreadcrumbLink, {
92
- href: item.href,
93
- children: item.label
94
- }) })] }, item.label);
95
- })] })
61
+ function StepIndicator({ index, status, shape, bulletType }) {
62
+ return /* @__PURE__ */ jsx("div", {
63
+ "data-slot": "steps-indicator",
64
+ "aria-hidden": "true",
65
+ className: cn(stepIndicatorVariants({
66
+ shape,
67
+ status
68
+ }), status === "complete" && "delight-check-bounce", status === "active" && "delight-pulse-once"),
69
+ children: /* @__PURE__ */ jsx(StepIndicatorContent, {
70
+ index,
71
+ status,
72
+ shape,
73
+ bulletType
74
+ })
96
75
  });
97
76
  }
98
- function PageHeaderBackButton({ breadcrumbs, onBackClick, backLabel }) {
99
- if (!onBackClick || !breadcrumbs || breadcrumbs.length === 0) return null;
100
- return /* @__PURE__ */ jsx(Button, {
101
- appearance: "link",
102
- variant: "primary",
103
- size: "sm",
104
- startIcon: /* @__PURE__ */ jsx(ArrowLeft, { className: "size-5" }),
105
- onClick: onBackClick,
106
- "aria-label": `Go back: ${backLabel}`,
107
- className: "md:hidden text-secondary-foreground px-0 hover:no-underline",
108
- children: backLabel
77
+ StepIndicator.displayName = "StepIndicator";
78
+ function StepConnector({ orientation, isComplete }) {
79
+ return /* @__PURE__ */ jsx("div", {
80
+ "data-slot": "steps-connector",
81
+ "aria-hidden": "true",
82
+ className: cn(stepConnectorVariants({
83
+ orientation,
84
+ status: isComplete ? "complete" : "incomplete"
85
+ }), isComplete && "delight-connector-fill")
109
86
  });
110
87
  }
111
- function PageHeaderActions({ actions }) {
112
- if (!actions || actions.length === 0) return null;
113
- const { visibleActions, overflowActions } = splitPageHeaderActions(actions);
114
- return /* @__PURE__ */ jsxs("div", {
115
- className: "flex items-center gap-3 delight-stagger motion-reduce:!animate-none",
116
- style: { "--delight-delay": "120ms" },
117
- children: [visibleActions.map((action) => /* @__PURE__ */ jsx(Button, {
118
- variant: action.variant ?? getPageHeaderActionVariant(action, action.originalIndex, actions.length),
119
- onClick: action.onClick,
120
- ...action.buttonProps,
121
- children: action.label
122
- }, `${action.label}-${action.originalIndex}`)), overflowActions.length > 0 && /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenu.Trigger, { render: /* @__PURE__ */ jsx(Button, {
123
- appearance: "ghost",
124
- size: "icon",
125
- "aria-label": "More actions",
126
- children: /* @__PURE__ */ jsx(MoreHorizontal, { className: "size-5" })
127
- }) }), /* @__PURE__ */ jsx(DropdownMenu.Popup, {
128
- align: "end",
129
- sideOffset: 4,
130
- children: /* @__PURE__ */ jsx(DropdownMenu.Items, { children: overflowActions.map((action) => /* @__PURE__ */ jsx(DropdownMenu.Item, {
131
- ...getOverflowActionItemProps(action),
132
- onClick: action.onClick,
133
- variant: action.variant === "destructive" ? "destructive" : "default",
134
- children: action.label
135
- }, `${action.label}-${action.originalIndex}`)) })
136
- })] })]
88
+ StepConnector.displayName = "StepConnector";
89
+ function StepsSubtext({ children, className }) {
90
+ return /* @__PURE__ */ jsx("span", {
91
+ "data-slot": "steps-subtext",
92
+ className: cn(stepSubtextVariants(), className),
93
+ children
137
94
  });
138
95
  }
139
- function PageHeaderSearch({ searchId, searchPlaceholder, searchShortcut, onSearch }) {
140
- if (!searchPlaceholder) return null;
141
- return /* @__PURE__ */ jsx("search", {
142
- className: "relative flex-1 min-w-0 max-w-xs delight-stagger motion-reduce:!animate-none",
143
- style: { "--delight-delay": "180ms" },
144
- children: /* @__PURE__ */ jsxs("div", {
145
- className: "group/search relative",
146
- children: [
147
- /* @__PURE__ */ jsx(Search, {
148
- className: "absolute start-3 top-1/2 -translate-y-1/2 size-5 text-text-quaternary pointer-events-none transition-colors duration-150 group-focus-within/search:text-primary motion-reduce:transition-none",
149
- "aria-hidden": "true"
150
- }),
151
- /* @__PURE__ */ jsx("input", {
152
- id: searchId,
153
- type: "text",
154
- placeholder: searchPlaceholder,
155
- "aria-label": searchPlaceholder,
156
- onChange: (e) => onSearch?.(e.target.value),
157
- className: cn("peer w-full rounded-lg border border-border bg-background py-2.5 pe-10 ps-10", "text-base text-foreground placeholder:text-muted-foreground", "shadow-xs transition-[border-color,box-shadow] duration-150 motion-reduce:transition-none", "focus-visible:border-primary focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-primary")
158
- }),
159
- searchShortcut && /* @__PURE__ */ jsx(Kbd, {
160
- variant: "outline",
161
- size: "xs",
162
- className: "absolute end-3 top-1/2 -translate-y-1/2 transition-opacity duration-150 peer-focus-visible:opacity-0 motion-reduce:transition-none",
163
- "aria-hidden": "true",
164
- children: searchShortcut
165
- })
166
- ]
167
- })
96
+ StepsSubtext.displayName = "Steps.Subtext";
97
+ function StepsItem({ status: statusOverride, onClick, children, className }) {
98
+ const ctx = useStepsContext();
99
+ const index = React.useContext(StepIndexContext);
100
+ const status = statusOverride ?? ctx.getStepStatus(index);
101
+ const isFirst = index === 0;
102
+ const handleClick = onClick ?? (ctx.onStepClick ? () => ctx.onStepClick?.(index) : void 0);
103
+ let label = null;
104
+ let subtext = null;
105
+ React.Children.forEach(children, (child) => {
106
+ if (React.isValidElement(child) && child.type === StepsSubtext) subtext = child;
107
+ else if (child != null && child !== false) label = child;
168
108
  });
169
- }
170
- function getPageHeaderInitials(name) {
171
- if (!name) return "";
172
- const words = name.split(" ").filter(Boolean);
173
- if (words.length >= 2) return `${words[0][0]}${words[1][0]}`.toUpperCase();
174
- return name.slice(0, 2).toUpperCase();
175
- }
176
- function PageHeaderAvatar({ hasAvatar, isBanner, avatarSrc, avatarFallback, avatarStatusIcon }) {
177
- if (!hasAvatar) return null;
178
- if (isBanner) return /* @__PURE__ */ jsxs("div", {
179
- className: cn("relative shrink-0 rounded-full ring-4 ring-bg-primary shadow-lg", "size-24 md:size-40", "delight-fade-in motion-reduce:!animate-none"),
180
- children: [avatarSrc ? /* @__PURE__ */ jsx("img", {
181
- src: avatarSrc,
182
- alt: avatarFallback || "",
183
- className: "size-full rounded-full object-cover"
184
- }) : /* @__PURE__ */ jsx("div", {
185
- className: "flex size-full items-center justify-center rounded-full bg-accent text-2xl font-semibold text-muted-foreground md:text-4xl",
186
- children: getPageHeaderInitials(avatarFallback)
187
- }), avatarStatusIcon === "verified" && /* @__PURE__ */ jsx("div", {
188
- className: "absolute bottom-0 end-0 flex size-6 items-center justify-center rounded-full border-2 border-primary bg-primary/10 md:size-10",
189
- children: /* @__PURE__ */ jsxs("svg", {
190
- className: "size-3 text-primary md:size-5",
191
- fill: "currentColor",
192
- viewBox: "0 0 20 20",
193
- "aria-hidden": "true",
194
- children: [/* @__PURE__ */ jsx("title", { children: "Verified" }), /* @__PURE__ */ jsx("path", {
195
- fillRule: "evenodd",
196
- d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",
197
- clipRule: "evenodd"
198
- })]
199
- })
200
- })]
109
+ const prevStepStatus = !isFirst ? ctx.getStepStatus(index - 1) : void 0;
110
+ const connector = !isFirst && /* @__PURE__ */ jsx(StepConnector, {
111
+ orientation: ctx.orientation,
112
+ isComplete: prevStepStatus === "complete"
201
113
  });
202
- return /* @__PURE__ */ jsx(Avatar, {
203
- src: avatarSrc,
204
- fallback: avatarFallback,
205
- alt: avatarFallback,
206
- size: "xl",
207
- indicator: avatarStatusIcon
114
+ const isHorizontal = ctx.orientation === "horizontal";
115
+ const indicator = /* @__PURE__ */ jsx(StepIndicator, {
116
+ index,
117
+ status,
118
+ shape: ctx.shape,
119
+ bulletType: ctx.bulletType
208
120
  });
209
- }
210
- function PageHeaderTextContent({ title, supportingText, isCentered }) {
211
- return /* @__PURE__ */ jsxs("div", {
212
- className: cn("flex flex-col min-w-0", isCentered ? "items-center" : "flex-1"),
213
- children: [/* @__PURE__ */ jsx("h1", {
214
- className: "text-xl font-semibold text-foreground leading-relaxed delight-stagger motion-reduce:!animate-none",
215
- style: { "--delight-delay": "0ms" },
216
- children: title
217
- }), supportingText && /* @__PURE__ */ jsx("p", {
218
- className: "text-base text-muted-foreground leading-6 max-w-prose delight-stagger motion-reduce:!animate-none",
219
- style: { "--delight-delay": "60ms" },
220
- children: supportingText
121
+ const labelElement = /* @__PURE__ */ jsxs("div", {
122
+ "data-slot": "steps-label",
123
+ className: cn("flex flex-col", isHorizontal ? "items-center gap-0.5 text-center w-0 whitespace-nowrap" : "items-start gap-0.5 ml-2.5"),
124
+ children: [/* @__PURE__ */ jsx("span", {
125
+ className: stepLabelVariants({ status }),
126
+ children: label
127
+ }), subtext]
128
+ });
129
+ const content = isHorizontal ? /* @__PURE__ */ jsxs("div", {
130
+ className: "flex w-full items-start",
131
+ children: [connector, /* @__PURE__ */ jsxs("div", {
132
+ className: "flex flex-col items-center",
133
+ children: [indicator, labelElement]
134
+ })]
135
+ }) : /* @__PURE__ */ jsxs("div", {
136
+ className: "flex flex-col items-start",
137
+ children: [connector, /* @__PURE__ */ jsxs("div", {
138
+ className: "flex items-center",
139
+ children: [indicator, labelElement]
221
140
  })]
222
141
  });
223
- }
224
- var PageHeader = React.forwardRef(({ variant = "simple", title, supportingText, breadcrumbs, actions, searchPlaceholder, searchShortcut = "⌘K", onSearch, showDivider = true, avatarSrc, avatarFallback, avatarStatusIcon = "verified", onBackClick, backLabel = "Back", className }, ref) => {
225
- const searchId = React.useId();
226
- const resolvedVariant = variant ?? "simple";
227
- const isBanner = resolvedVariant.startsWith("banner");
228
- const isCentered = resolvedVariant.includes("centered");
229
- const hasAvatar = resolvedVariant.includes("avatar");
230
- if (isBanner) return /* @__PURE__ */ jsxs("header", {
231
- ref,
232
- "data-slot": "page-header",
233
- className: cn(pageHeaderVariants({ variant: resolvedVariant }), className),
234
- children: [
235
- /* @__PURE__ */ jsxs("div", {
236
- className: "relative",
237
- children: [/* @__PURE__ */ jsx("div", {
238
- className: bannerVariants({ variant: isCentered ? "centered" : "default" }),
239
- "aria-hidden": "true"
240
- }), hasAvatar && /* @__PURE__ */ jsx("div", {
241
- className: cn("absolute inset-x-0 px-4 md:px-8", "-bottom-12 md:-bottom-20", isCentered && "flex justify-center"),
242
- children: /* @__PURE__ */ jsx(PageHeaderAvatar, {
243
- hasAvatar,
244
- isBanner,
245
- avatarSrc,
246
- avatarFallback,
247
- avatarStatusIcon
248
- })
249
- })]
250
- }),
251
- /* @__PURE__ */ jsxs("div", {
252
- className: cn("px-4 md:px-8", hasAvatar ? "pt-16 md:pt-24" : "pt-6", isCentered && "flex flex-col items-center"),
253
- children: [
254
- /* @__PURE__ */ jsx("div", {
255
- className: "md:hidden mb-4",
256
- children: /* @__PURE__ */ jsx(PageHeaderBackButton, {
257
- breadcrumbs,
258
- onBackClick,
259
- backLabel
260
- })
261
- }),
262
- !isCentered && /* @__PURE__ */ jsx("div", {
263
- className: "hidden md:block",
264
- children: /* @__PURE__ */ jsx(PageHeaderBreadcrumbs, { breadcrumbs })
265
- }),
266
- /* @__PURE__ */ jsxs("div", {
267
- className: cn(contentVariants({ variant: resolvedVariant }), "mt-4 md:mt-6"),
268
- children: [
269
- /* @__PURE__ */ jsx(PageHeaderTextContent, {
270
- title,
271
- supportingText,
272
- isCentered
273
- }),
274
- /* @__PURE__ */ jsx(PageHeaderActions, { actions }),
275
- /* @__PURE__ */ jsx(PageHeaderSearch, {
276
- searchId,
277
- searchPlaceholder,
278
- searchShortcut,
279
- onSearch
280
- })
281
- ]
282
- })
283
- ]
284
- }),
285
- showDivider && /* @__PURE__ */ jsx(Separator, { className: "mt-5 delight-connector-fill motion-reduce:!animate-none" })
286
- ]
142
+ const labelText = React.useMemo(() => extractText(label), [label]);
143
+ const statusSuffix = status === "complete" ? ", completed" : status === "active" ? ", current" : "";
144
+ return /* @__PURE__ */ jsx("li", {
145
+ "data-slot": "steps-item",
146
+ "aria-current": status === "active" ? "step" : void 0,
147
+ "aria-label": !handleClick && labelText ? `Step ${index + 1}: ${labelText}${statusSuffix}` : void 0,
148
+ className: cn(isHorizontal && !isFirst && "flex-1", !handleClick && className),
149
+ children: handleClick ? /* @__PURE__ */ jsx("button", {
150
+ type: "button",
151
+ onClick: handleClick,
152
+ "aria-label": `Step ${index + 1}: ${labelText || ""}${statusSuffix}`,
153
+ className: cn("cursor-pointer", isHorizontal && "w-full", className, "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-background rounded-sm"),
154
+ children: content
155
+ }) : content
287
156
  });
288
- return /* @__PURE__ */ jsxs("header", {
289
- ref,
290
- "data-slot": "page-header",
291
- className: cn(pageHeaderVariants({ variant: resolvedVariant }), className),
292
- children: [
293
- breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(PageHeaderBreadcrumbs, { breadcrumbs }), /* @__PURE__ */ jsx(PageHeaderBackButton, {
294
- breadcrumbs,
295
- onBackClick,
296
- backLabel
297
- })] }),
298
- /* @__PURE__ */ jsxs("div", {
299
- className: cn(contentVariants({ variant: resolvedVariant })),
300
- children: [
301
- /* @__PURE__ */ jsxs("div", {
302
- className: cn("flex gap-4 items-center flex-1 min-w-0", hasAvatar && "flex-row"),
303
- children: [/* @__PURE__ */ jsx(PageHeaderAvatar, {
304
- hasAvatar,
305
- isBanner,
306
- avatarSrc,
307
- avatarFallback,
308
- avatarStatusIcon
309
- }), /* @__PURE__ */ jsx(PageHeaderTextContent, {
310
- title,
311
- supportingText,
312
- isCentered
313
- })]
314
- }),
315
- /* @__PURE__ */ jsx(PageHeaderActions, { actions }),
316
- /* @__PURE__ */ jsx(PageHeaderSearch, {
317
- searchId,
318
- searchPlaceholder,
319
- searchShortcut,
320
- onSearch
321
- })
322
- ]
323
- }),
324
- showDivider && /* @__PURE__ */ jsx(Separator, { className: "delight-connector-fill motion-reduce:!animate-none" })
325
- ]
157
+ }
158
+ StepsItem.displayName = "Steps.Item";
159
+ /**
160
+ * Steps displays a multi-step progress indicator for wizards and workflows.
161
+ * Supports horizontal/vertical orientation, numbered or icon bullets, and clickable steps.
162
+ *
163
+ * @llms Wizard/workflow progress with horizontal/vertical layout, numbered or icon steps
164
+ * @example
165
+ * ```tsx
166
+ * <Steps
167
+ * steps={[{ label: 'Details' }, { label: 'Payment' }, { label: 'Confirm' }]}
168
+ * currentStep={1}
169
+ * orientation="horizontal"
170
+ * />
171
+ * ```
172
+ */
173
+ function Steps({ steps, currentStep = 0, orientation = "horizontal", shape = "rounded", bulletType = "text", onStepClick, children, className }) {
174
+ const getStepStatus = React.useCallback((index) => {
175
+ if (index < currentStep) return "complete";
176
+ if (index === currentStep) return "active";
177
+ return "incomplete";
178
+ }, [currentStep]);
179
+ const contextValue = React.useMemo(() => ({
180
+ orientation,
181
+ shape,
182
+ bulletType,
183
+ onStepClick,
184
+ getStepStatus
185
+ }), [
186
+ orientation,
187
+ shape,
188
+ bulletType,
189
+ onStepClick,
190
+ getStepStatus
191
+ ]);
192
+ const useCompoundAPI = !steps && React.Children.count(children) > 0;
193
+ const renderFlatAPI = () => {
194
+ if (!steps || steps.length === 0) return null;
195
+ return steps.map((step, index) => /* @__PURE__ */ jsx(StepIndexContext.Provider, {
196
+ value: index,
197
+ children: /* @__PURE__ */ jsxs(StepsItem, { children: [step.label, step.subtext && /* @__PURE__ */ jsx(StepsSubtext, { children: step.subtext })] })
198
+ }, `${index}-${step.label}`));
199
+ };
200
+ const renderCompoundAPI = () => {
201
+ return React.Children.map(children, (child, index) => /* @__PURE__ */ jsx(StepIndexContext.Provider, {
202
+ value: index,
203
+ children: child
204
+ }));
205
+ };
206
+ return /* @__PURE__ */ jsx(StepsContext.Provider, {
207
+ value: contextValue,
208
+ children: /* @__PURE__ */ jsx("nav", {
209
+ "aria-label": "Progress steps",
210
+ "data-slot": "steps",
211
+ tabIndex: 0,
212
+ className: cn("overflow-x-auto focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", className),
213
+ children: /* @__PURE__ */ jsx("ol", {
214
+ "data-slot": "steps-list",
215
+ className: cn("flex", orientation === "horizontal" ? "flex-row items-start" : "flex-col items-start"),
216
+ children: useCompoundAPI ? renderCompoundAPI() : renderFlatAPI()
217
+ })
218
+ })
326
219
  });
220
+ }
221
+ Steps.displayName = "Steps";
222
+ /**
223
+ * @llms Wizard/workflow progress with horizontal/vertical layout, numbered or icon steps
224
+ */
225
+ var StepsCompound = Object.assign(Steps, {
226
+ Item: StepsItem,
227
+ Subtext: StepsSubtext
327
228
  });
328
- PageHeader.displayName = "PageHeader";
329
229
  //#endregion
330
- export { PageHeader, bannerVariants, contentVariants, pageHeaderVariants };
230
+ export { StepsCompound as Steps, StepsCompound, StepsItem, StepsSubtext, stepConnectorVariants, stepIndicatorVariants, stepLabelVariants, stepSubtextVariants };
331
231
 
332
232
  //# sourceMappingURL=index202.js.map