@humain/ui 2.1.63 → 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 +7 -339
  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 +79 -78
  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 +58 -57
  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/index205.js CHANGED
@@ -1,286 +1,296 @@
1
1
  "use client";
2
2
  import { cn } from "./index2.js";
3
- import { useControllableState } from "./index12.js";
4
- import { createSafeContext } from "./index21.js";
5
- import { Check, ChevronRight } from "lucide-react";
3
+ import { Button, ClearButton } from "./index5.js";
4
+ import { Avatar } from "./index70.js";
5
+ import { Kbd } from "./index106.js";
6
+ import { Command as CommandNamespace, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator } from "./index120.js";
7
+ import { ArrowDown, ArrowUp, CornerDownLeft, Search, Settings } from "lucide-react";
6
8
  import * as React from "react";
7
9
  import { jsx, jsxs } from "react/jsx-runtime";
8
- import { Menu as Menu$1 } from "@base-ui/react/menu";
9
- //#region src/components/organisms/menus/ContextMenu/ContextMenu.tsx
10
- var [ContextMenuContext, useContextMenuContext] = createSafeContext("ContextMenu");
11
- function Root({ children, anchorPoint, open: controlledOpen, defaultOpen = false, onOpenChange }) {
12
- const [position, setPosition] = React.useState({
13
- x: 0,
14
- y: 0
15
- });
16
- const [open, setOpen] = useControllableState({
17
- value: controlledOpen,
18
- defaultValue: defaultOpen,
19
- onChange: onOpenChange
20
- });
21
- return /* @__PURE__ */ jsx(ContextMenuContext.Provider, {
22
- value: {
23
- open,
24
- setOpen,
25
- position: anchorPoint ?? position,
26
- setPosition
27
- },
28
- children: /* @__PURE__ */ jsx(Menu$1.Root, {
29
- "data-slot": "context-menu",
30
- open,
31
- onOpenChange: setOpen,
32
- children
33
- })
34
- });
35
- }
36
- Root.displayName = "ContextMenu.Root";
37
- function Trigger({ children, className, disabled = false, onKeyDown: onKeyDownProp, ...props }) {
38
- const { setOpen, setPosition } = useContextMenuContext();
39
- return /* @__PURE__ */ jsx("button", {
40
- type: "button",
41
- "data-slot": "context-menu-trigger",
42
- onContextMenu: React.useCallback((event) => {
43
- if (disabled) return;
44
- event.preventDefault();
45
- setPosition({
46
- x: event.clientX,
47
- y: event.clientY
48
- });
49
- setOpen(true);
50
- }, [
51
- disabled,
52
- setOpen,
53
- setPosition
54
- ]),
55
- onKeyDown: React.useCallback((event) => {
56
- onKeyDownProp?.(event);
57
- if (event.defaultPrevented) return;
58
- if (disabled) return;
59
- if (event.key === "F10" && event.shiftKey) {
60
- event.preventDefault();
61
- const rect = event.currentTarget.getBoundingClientRect();
62
- setPosition({
63
- x: rect.left + rect.width / 2,
64
- y: rect.top + rect.height / 2
65
- });
66
- setOpen(true);
67
- }
68
- }, [
69
- disabled,
70
- onKeyDownProp,
71
- setOpen,
72
- setPosition
73
- ]),
74
- className,
75
- disabled,
76
- ...props,
77
- children
78
- });
10
+ //#region src/components/organisms/menus/CommandMenu/CommandMenu.tsx
11
+ var DEFAULT_COMMAND_MENU_MAX_HEIGHT = 336;
12
+ var DEFAULT_COMMAND_MENU_PLACEHOLDER = "Type a command or search...";
13
+ var COMMAND_MENU_SHELL_CLASS_NAME = "w-full max-w-[508px] overflow-hidden rounded-xl border border-input bg-background shadow-lg";
14
+ function getCommandMenuMaxHeight(maxHeight) {
15
+ return Number.isFinite(maxHeight) && maxHeight >= 0 ? maxHeight : DEFAULT_COMMAND_MENU_MAX_HEIGHT;
79
16
  }
80
- Trigger.displayName = "ContextMenu.Trigger";
81
- function Portal({ ...props }) {
82
- return /* @__PURE__ */ jsx(Menu$1.Portal, {
83
- "data-slot": "context-menu-portal",
84
- ...props
85
- });
86
- }
87
- Portal.displayName = "ContextMenu.Portal";
88
- var popupMotionClassName = "data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 motion-reduce:animate-none";
89
- var popupSurfaceClassName = "border border-border bg-popover text-popover-foreground rounded-lg p-1 shadow-sm duration-100 origin-(--transform-origin) outline-none";
90
- function isPortalContainerRef(container) {
91
- return container !== null && typeof container === "object" && "current" in container;
92
- }
93
- function usePortalContainer(container) {
94
- return React.useMemo(() => {
95
- if (container == null || isPortalContainerRef(container)) return container;
96
- return { current: container };
97
- }, [container]);
98
- }
99
- function resolvePortalContextElement(container) {
100
- const resolvedContainer = isPortalContainerRef(container) ? container.current : container;
101
- if (!resolvedContainer) return void 0;
102
- return "host" in resolvedContainer ? resolvedContainer.host : resolvedContainer;
103
- }
104
- function Popup({ alignOffset = 0, container, sideOffset = 0, className, ...props }) {
105
- const { position } = useContextMenuContext();
106
- const portalContainer = usePortalContainer(container);
107
- const portalContextElement = resolvePortalContextElement(container);
108
- const virtualAnchor = React.useMemo(() => ({
109
- contextElement: portalContextElement,
110
- getBoundingClientRect: () => ({
111
- x: position.x,
112
- y: position.y,
113
- width: 0,
114
- height: 0,
115
- top: position.y,
116
- right: position.x,
117
- bottom: position.y,
118
- left: position.x,
119
- toJSON: () => ({})
120
- })
121
- }), [
122
- portalContextElement,
123
- position.x,
124
- position.y
125
- ]);
126
- return /* @__PURE__ */ jsx(Menu$1.Portal, {
127
- container: portalContainer,
128
- children: /* @__PURE__ */ jsx(Menu$1.Positioner, {
129
- "data-anchor-x": position.x,
130
- "data-anchor-y": position.y,
131
- "data-slot": "context-menu-positioner",
132
- className: "isolate z-50 outline-none",
133
- anchor: virtualAnchor,
134
- side: "bottom",
135
- align: "start",
136
- sideOffset,
137
- alignOffset,
138
- collisionPadding: 8,
139
- children: /* @__PURE__ */ jsx(Menu$1.Popup, {
140
- "data-slot": "context-menu-popup",
141
- className: cn(popupMotionClassName, popupSurfaceClassName, "min-w-32 z-50 max-h-(--available-height) overflow-x-hidden overflow-y-auto data-closed:overflow-hidden", className),
142
- ...props
143
- })
144
- })
145
- });
17
+ function usePlatformShortcut() {
18
+ const [shortcut, setShortcut] = React.useState("⌘/");
19
+ React.useEffect(() => {
20
+ if (!/Mac|iPhone|iPad/i.test(navigator.userAgent)) setShortcut("Ctrl /");
21
+ }, []);
22
+ return shortcut;
146
23
  }
147
- Popup.displayName = "ContextMenu.Popup";
148
- function Group({ ...props }) {
149
- return /* @__PURE__ */ jsx(Menu$1.Group, {
150
- "data-slot": "context-menu-group",
151
- ...props
24
+ function CommandShortcutBadge({ children, className }) {
25
+ return /* @__PURE__ */ jsx(Kbd, {
26
+ variant: "solid",
27
+ size: "sm",
28
+ className: cn("shadow-xs", className),
29
+ children
152
30
  });
153
31
  }
154
- Group.displayName = "ContextMenu.Group";
155
- function Label({ className, inset, ...props }) {
156
- return /* @__PURE__ */ jsx(Menu$1.GroupLabel, {
157
- "data-slot": "context-menu-label",
158
- "data-inset": inset,
159
- className: cn("text-foreground px-2 py-1.5 text-sm leading-5 font-medium data-[inset]:ps-8", className),
160
- ...props
32
+ CommandShortcutBadge.displayName = "CommandMenu.ShortcutBadge";
33
+ function FooterNavIcon({ children, className }) {
34
+ return /* @__PURE__ */ jsx(Kbd, {
35
+ variant: "footer",
36
+ size: "sm",
37
+ className: cn("p-1.5", className),
38
+ children
161
39
  });
162
40
  }
163
- Label.displayName = "ContextMenu.Label";
164
- function Item({ className, inset, variant = "default", ...props }) {
165
- return /* @__PURE__ */ jsx(Menu$1.Item, {
166
- "data-slot": "context-menu-item",
167
- "data-inset": inset,
168
- "data-variant": variant,
169
- className: cn("focus:bg-accent focus:text-popover-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-popover-foreground gap-2 rounded-md px-2 py-1.5 text-base leading-6 [&_svg:not([class*='size-'])]:size-4 group/context-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[inset]:ps-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 transition-[color,background-color,transform] duration-150 ease-smooth active:scale-[0.99] motion-reduce:transition-none motion-reduce:active:scale-100", className),
170
- ...props
41
+ FooterNavIcon.displayName = "CommandMenu.FooterNavIcon";
42
+ function FooterNavText({ children, className }) {
43
+ return /* @__PURE__ */ jsx("span", {
44
+ className: cn("text-sm font-semibold text-text-quaternary", className),
45
+ children
171
46
  });
172
47
  }
173
- Item.displayName = "ContextMenu.Item";
174
- function Sub({ ...props }) {
175
- return /* @__PURE__ */ jsx(Menu$1.SubmenuRoot, {
176
- "data-slot": "context-menu-sub",
177
- ...props
48
+ FooterNavText.displayName = "CommandMenu.FooterNavText";
49
+ var defaultFooterHints = [
50
+ {
51
+ keys: /* @__PURE__ */ jsxs("div", {
52
+ className: "flex items-center gap-1",
53
+ children: [/* @__PURE__ */ jsx(FooterNavIcon, { children: /* @__PURE__ */ jsx(ArrowUp, { className: "size-2.5 text-text-quaternary" }) }), /* @__PURE__ */ jsx(FooterNavIcon, { children: /* @__PURE__ */ jsx(ArrowDown, { className: "size-2.5 text-text-quaternary" }) })]
54
+ }),
55
+ label: "to navigate"
56
+ },
57
+ {
58
+ keys: /* @__PURE__ */ jsx(FooterNavIcon, { children: /* @__PURE__ */ jsx(CornerDownLeft, { className: "size-2.5 text-text-quaternary" }) }),
59
+ label: "to select"
60
+ },
61
+ {
62
+ keys: /* @__PURE__ */ jsx(FooterNavIcon, {
63
+ className: "px-1.5 py-1",
64
+ children: /* @__PURE__ */ jsx("span", {
65
+ className: "text-xs font-semibold text-text-quaternary",
66
+ children: "esc"
67
+ })
68
+ }),
69
+ label: "to close"
70
+ }
71
+ ];
72
+ function CommandMenuFooter({ hints = defaultFooterHints, showSettingsButton = false, onSettingsClick, className }) {
73
+ return /* @__PURE__ */ jsxs("div", {
74
+ "data-slot": "command-menu-footer",
75
+ className: cn("flex items-center gap-3 border-t border-border bg-card/80 py-2 pe-2 ps-[18px] supports-backdrop-filter:backdrop-blur", className),
76
+ children: [/* @__PURE__ */ jsx("div", {
77
+ className: "hidden flex-1 items-start gap-4 [@media(hover:hover)]:flex",
78
+ children: hints.map((hint) => /* @__PURE__ */ jsxs("div", {
79
+ className: "flex items-center gap-2",
80
+ children: [hint.keys, /* @__PURE__ */ jsx(FooterNavText, { children: hint.label })]
81
+ }, hint.label))
82
+ }), showSettingsButton && /* @__PURE__ */ jsx(Button, {
83
+ appearance: "ghost",
84
+ variant: "secondary",
85
+ size: "icon",
86
+ className: "group ms-auto rounded-full bg-muted",
87
+ onClick: onSettingsClick,
88
+ "aria-label": "Settings",
89
+ children: /* @__PURE__ */ jsx(Settings, { className: "size-5 text-muted-foreground transition-transform duration-300 ease-out group-hover:rotate-90 motion-reduce:transition-none" })
90
+ })]
178
91
  });
179
92
  }
180
- Sub.displayName = "ContextMenu.Sub";
181
- function SubTrigger({ className, inset, children, ...props }) {
182
- return /* @__PURE__ */ jsxs(Menu$1.SubmenuTrigger, {
183
- "data-slot": "context-menu-sub-trigger",
184
- "data-inset": inset,
185
- className: cn("focus:bg-accent focus:text-popover-foreground data-open:bg-accent data-open:text-popover-foreground not-data-[variant=destructive]:focus:**:text-popover-foreground gap-2 rounded-md px-2 py-1.5 text-base leading-6 [&_svg:not([class*='size-'])]:size-4 group/ctx-sub flex cursor-default items-center outline-hidden select-none data-[inset]:ps-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 transition-[color,background-color,transform] duration-150 ease-smooth active:scale-[0.99] motion-reduce:transition-none motion-reduce:active:scale-100", className),
93
+ CommandMenuFooter.displayName = "CommandMenu.Footer";
94
+ function CommandMenuItem({ option, onSelect, className, ...props }) {
95
+ return /* @__PURE__ */ jsxs(CommandItem, {
96
+ value: option.id,
97
+ disabled: option.disabled,
98
+ showCheckIndicator: false,
99
+ onSelect: () => onSelect?.(option.id, option),
100
+ className: cn("flex cursor-pointer items-center gap-2 transition-colors duration-150 motion-reduce:transition-none", className),
186
101
  ...props,
187
- children: [children, /* @__PURE__ */ jsx(ChevronRight, { className: "ms-auto rtl:rotate-180 transition-transform duration-150 group-data-open/ctx-sub:translate-x-0.5" })]
188
- });
189
- }
190
- SubTrigger.displayName = "ContextMenu.SubTrigger";
191
- function SubPopup({ className, container, ...props }) {
192
- const portalContainer = usePortalContainer(container);
193
- return /* @__PURE__ */ jsx(Menu$1.Portal, {
194
- container: portalContainer,
195
- children: /* @__PURE__ */ jsx(Menu$1.Positioner, {
196
- className: "isolate z-50 outline-none",
197
- side: "right",
198
- align: "start",
199
- sideOffset: 0,
200
- alignOffset: -3,
201
- children: /* @__PURE__ */ jsx(Menu$1.Popup, {
202
- "data-slot": "context-menu-sub-popup",
203
- className: cn(popupMotionClassName, "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", popupSurfaceClassName, "min-w-[96px] w-auto", className),
204
- ...props
102
+ children: [
103
+ option.avatar && /* @__PURE__ */ jsx(Avatar, {
104
+ src: option.avatar.src,
105
+ fallback: option.avatar.fallback || option.label.charAt(0),
106
+ size: "sm",
107
+ className: "size-6 shrink-0"
108
+ }),
109
+ option.icon && !option.avatar && /* @__PURE__ */ jsx("span", {
110
+ className: "flex size-4 shrink-0 items-center justify-center text-muted-foreground [&_svg]:size-4",
111
+ children: option.icon
112
+ }),
113
+ /* @__PURE__ */ jsxs("div", {
114
+ className: "flex min-w-0 flex-1 items-center gap-2 text-sm leading-5",
115
+ children: [/* @__PURE__ */ jsx("span", {
116
+ className: "min-w-0 truncate font-normal text-foreground",
117
+ children: option.label
118
+ }), option.subtitle && /* @__PURE__ */ jsx("span", {
119
+ className: "min-w-0 truncate font-normal text-muted-foreground",
120
+ children: option.subtitle
121
+ })]
122
+ }),
123
+ option.shortcut && /* @__PURE__ */ jsx(CommandShortcutBadge, {
124
+ className: "transition-colors duration-150 group-data-[selected=true]/command-item:bg-primary/10 group-data-[selected=true]/command-item:text-primary",
125
+ children: option.shortcut
205
126
  })
206
- })
127
+ ]
207
128
  });
208
129
  }
209
- SubPopup.displayName = "ContextMenu.SubPopup";
210
- function CheckboxItem({ className, children, checked, ...props }) {
211
- return /* @__PURE__ */ jsxs(Menu$1.CheckboxItem, {
212
- "data-slot": "context-menu-checkbox-item",
213
- className: cn("focus:bg-accent focus:text-popover-foreground focus:**:text-popover-foreground gap-2 rounded-md py-1.5 pe-2 ps-8 text-base leading-6 [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 transition-colors duration-150 ease-smooth motion-reduce:transition-none", className),
214
- checked,
130
+ CommandMenuItem.displayName = "CommandMenu.Item";
131
+ function CommandMenuGroupHeader({ children, className, ...props }) {
132
+ return /* @__PURE__ */ jsx("h3", {
133
+ "data-slot": "command-menu-group-header",
134
+ className: cn("px-2 py-1.5 text-xs font-medium text-muted-foreground", className),
215
135
  ...props,
216
- children: [/* @__PURE__ */ jsx("span", {
217
- className: "pointer-events-none absolute start-2 flex size-4 items-center justify-center",
218
- "data-slot": "context-menu-checkbox-item-indicator",
219
- children: /* @__PURE__ */ jsx(Menu$1.CheckboxItemIndicator, {
220
- className: "animate-in zoom-in-75 duration-150 motion-reduce:animate-none",
221
- children: /* @__PURE__ */ jsx(Check, {})
222
- })
223
- }), children]
136
+ children
224
137
  });
225
138
  }
226
- CheckboxItem.displayName = "ContextMenu.CheckboxItem";
227
- function RadioGroup({ ...props }) {
228
- return /* @__PURE__ */ jsx(Menu$1.RadioGroup, {
229
- "data-slot": "context-menu-radio-group",
230
- ...props
139
+ CommandMenuGroupHeader.displayName = "CommandMenu.GroupHeader";
140
+ function CommandMenuGroupSection({ group, optionRenderer }) {
141
+ const headingId = React.useId();
142
+ return /* @__PURE__ */ jsxs(CommandGroup, {
143
+ "aria-labelledby": headingId,
144
+ className: "px-2 py-1",
145
+ children: [/* @__PURE__ */ jsx(CommandMenuGroupHeader, {
146
+ id: headingId,
147
+ children: group.label
148
+ }), /* @__PURE__ */ jsx("div", {
149
+ className: "flex flex-col",
150
+ children: group.options.map(optionRenderer)
151
+ })]
231
152
  });
232
153
  }
233
- RadioGroup.displayName = "ContextMenu.RadioGroup";
234
- function RadioItem({ className, children, ...props }) {
235
- return /* @__PURE__ */ jsxs(Menu$1.RadioItem, {
236
- "data-slot": "context-menu-radio-item",
237
- className: cn("focus:bg-accent focus:text-popover-foreground focus:**:text-popover-foreground gap-2 rounded-md py-1.5 pe-2 ps-8 text-base leading-6 [&_svg:not([class*='size-'])]:size-4 relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 transition-colors duration-150 ease-smooth motion-reduce:transition-none", className),
238
- ...props,
239
- children: [/* @__PURE__ */ jsx("span", {
240
- className: "pointer-events-none absolute start-2 flex size-4 items-center justify-center",
241
- "data-slot": "context-menu-radio-item-indicator",
242
- children: /* @__PURE__ */ jsx(Menu$1.RadioItemIndicator, {
243
- className: "animate-in zoom-in-75 duration-150 motion-reduce:animate-none",
244
- children: /* @__PURE__ */ jsx(Check, {})
154
+ CommandMenuGroupSection.displayName = "CommandMenu.GroupSection";
155
+ function CommandMenuBodyContent({ children, groups, options, optionRenderer }) {
156
+ if (children) return children;
157
+ if (groups.length > 0) return groups.map((group, index) => /* @__PURE__ */ jsxs(React.Fragment, { children: [index > 0 && /* @__PURE__ */ jsx(CommandSeparator, { className: "mx-0" }), /* @__PURE__ */ jsx(CommandMenuGroupSection, {
158
+ group,
159
+ optionRenderer
160
+ })] }, group.id));
161
+ return /* @__PURE__ */ jsx("div", {
162
+ className: "flex flex-col p-2",
163
+ children: options.map(optionRenderer)
164
+ });
165
+ }
166
+ function CommandMenuBody({ children, groups, options, onSelect, onClose, placeholder, emptyText, emptyState, showShortcut, shortcutText, showFooter, footerHints, showSettingsButton, onSettingsClick, maxHeight, filter }) {
167
+ const safeMaxHeight = getCommandMenuMaxHeight(maxHeight);
168
+ const renderOption = (option) => /* @__PURE__ */ jsx(CommandMenuItem, {
169
+ option,
170
+ onSelect
171
+ }, option.id);
172
+ return /* @__PURE__ */ jsxs(CommandNamespace, {
173
+ filter,
174
+ className: "rounded-none border-0 shadow-none",
175
+ "data-slot": "command-menu",
176
+ children: [
177
+ /* @__PURE__ */ jsx("search", {
178
+ "aria-label": "Command menu search",
179
+ className: "block border-b border-input bg-background",
180
+ children: /* @__PURE__ */ jsx(CommandInput, { render: ({ clearSearch, value, ...inputProps }) => {
181
+ const canClose = typeof onClose === "function";
182
+ const clearOrClose = () => {
183
+ if (value) {
184
+ clearSearch();
185
+ return;
186
+ }
187
+ onClose?.();
188
+ };
189
+ return /* @__PURE__ */ jsxs("div", {
190
+ "data-slot": "command-menu-input",
191
+ "cmdk-input-wrapper": "",
192
+ className: "flex h-11 items-center gap-2 px-3",
193
+ children: [
194
+ /* @__PURE__ */ jsx(Search, {
195
+ className: "size-4 shrink-0 text-muted-foreground opacity-50",
196
+ "aria-hidden": "true"
197
+ }),
198
+ /* @__PURE__ */ jsx("input", {
199
+ ...inputProps,
200
+ value,
201
+ placeholder,
202
+ "aria-label": placeholder,
203
+ className: "min-w-0 flex-1 bg-transparent text-sm leading-5 text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50"
204
+ }),
205
+ showShortcut && /* @__PURE__ */ jsx(CommandShortcutBadge, { children: shortcutText }),
206
+ /* @__PURE__ */ jsx(ClearButton, {
207
+ size: "icon-xs",
208
+ className: "-me-1 rounded-sm p-0 opacity-50 hover:opacity-80 focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:size-4",
209
+ disabled: !value && !canClose,
210
+ "aria-label": value ? "Clear search" : canClose ? "Close command menu" : "Clear search",
211
+ onClick: clearOrClose
212
+ })
213
+ ]
214
+ });
215
+ } })
216
+ }),
217
+ /* @__PURE__ */ jsxs(CommandList, {
218
+ style: { maxHeight: safeMaxHeight },
219
+ className: "overflow-y-auto p-0",
220
+ children: [/* @__PURE__ */ jsx(CommandEmpty, {
221
+ className: "py-6 text-center text-sm text-muted-foreground animate-in fade-in-0 duration-200 motion-reduce:animate-none",
222
+ children: emptyState || emptyText
223
+ }), /* @__PURE__ */ jsx(CommandMenuBodyContent, {
224
+ groups,
225
+ options,
226
+ optionRenderer: renderOption,
227
+ children
228
+ })]
229
+ }),
230
+ showFooter && /* @__PURE__ */ jsx(CommandMenuFooter, {
231
+ hints: footerHints,
232
+ showSettingsButton,
233
+ onSettingsClick
245
234
  })
246
- }), children]
235
+ ]
247
236
  });
248
237
  }
249
- RadioItem.displayName = "ContextMenu.RadioItem";
250
- function Separator({ className, ...props }) {
251
- return /* @__PURE__ */ jsx(Menu$1.Separator, {
252
- "data-slot": "context-menu-separator",
253
- className: cn("bg-border my-1 h-px", className),
254
- ...props
238
+ CommandMenuBody.displayName = "CommandMenu.Body";
239
+ function CommandMenu({ open, onOpenChange, placeholder = DEFAULT_COMMAND_MENU_PLACEHOLDER, emptyText = "No results found.", emptyState, options = [], groups = [], onSelect, showShortcut = false, shortcutText, showFooter = false, footerHints, showSettingsButton = false, onSettingsClick, className, maxHeight = DEFAULT_COMMAND_MENU_MAX_HEIGHT, filter, children }) {
240
+ const platformShortcut = usePlatformShortcut();
241
+ const resolvedShortcut = shortcutText ?? platformShortcut;
242
+ return /* @__PURE__ */ jsx(CommandDialog, {
243
+ open,
244
+ onOpenChange,
245
+ className: cn("max-w-[508px] sm:max-w-[508px]", className),
246
+ children: /* @__PURE__ */ jsx(CommandMenuBody, {
247
+ placeholder,
248
+ emptyText,
249
+ emptyState,
250
+ options,
251
+ groups,
252
+ onSelect,
253
+ onClose: () => onOpenChange?.(false),
254
+ showShortcut,
255
+ shortcutText: resolvedShortcut,
256
+ showFooter,
257
+ footerHints,
258
+ showSettingsButton,
259
+ onSettingsClick,
260
+ maxHeight,
261
+ filter,
262
+ children
263
+ })
255
264
  });
256
265
  }
257
- Separator.displayName = "ContextMenu.Separator";
258
- function Shortcut({ className, ...props }) {
259
- return /* @__PURE__ */ jsx("span", {
260
- "data-slot": "context-menu-shortcut",
261
- className: cn("text-muted-foreground group-focus/context-menu-item:text-popover-foreground ms-auto text-xs tracking-widest transition-colors duration-150 ease-smooth motion-reduce:transition-none", className),
262
- ...props
266
+ CommandMenu.displayName = "CommandMenu";
267
+ function CommandMenuPanel({ placeholder = DEFAULT_COMMAND_MENU_PLACEHOLDER, emptyText = "No results found.", emptyState, options = [], groups = [], onSelect, showShortcut = false, shortcutText, showFooter = false, footerHints, showSettingsButton = false, onSettingsClick, className, maxHeight = DEFAULT_COMMAND_MENU_MAX_HEIGHT, filter, children }) {
268
+ const platformShortcut = usePlatformShortcut();
269
+ const resolvedShortcut = shortcutText ?? platformShortcut;
270
+ return /* @__PURE__ */ jsx("div", {
271
+ "data-slot": "command-menu-panel",
272
+ className: cn(COMMAND_MENU_SHELL_CLASS_NAME, className),
273
+ children: /* @__PURE__ */ jsx(CommandMenuBody, {
274
+ placeholder,
275
+ emptyText,
276
+ emptyState,
277
+ options,
278
+ groups,
279
+ onSelect,
280
+ showShortcut,
281
+ shortcutText: resolvedShortcut,
282
+ showFooter,
283
+ footerHints,
284
+ showSettingsButton,
285
+ onSettingsClick,
286
+ maxHeight,
287
+ filter,
288
+ children
289
+ })
263
290
  });
264
291
  }
265
- Shortcut.displayName = "ContextMenu.Shortcut";
266
- var ContextMenu = Object.assign(Root, {
267
- Root,
268
- Trigger,
269
- Portal,
270
- Popup,
271
- Group,
272
- Label,
273
- Item,
274
- Sub,
275
- SubTrigger,
276
- SubPopup,
277
- CheckboxItem,
278
- RadioGroup,
279
- RadioItem,
280
- Separator,
281
- Shortcut
282
- });
292
+ CommandMenuPanel.displayName = "CommandMenu.Panel";
283
293
  //#endregion
284
- export { ContextMenu, CheckboxItem as ContextMenuCheckboxItem, Group as ContextMenuGroup, Item as ContextMenuItem, Label as ContextMenuLabel, Popup as ContextMenuPopup, Portal as ContextMenuPortal, RadioGroup as ContextMenuRadioGroup, RadioItem as ContextMenuRadioItem, Root as ContextMenuRoot, Separator as ContextMenuSeparator, Shortcut as ContextMenuShortcut, Sub as ContextMenuSub, SubPopup as ContextMenuSubPopup, SubTrigger as ContextMenuSubTrigger, Trigger as ContextMenuTrigger };
294
+ export { CommandMenu, CommandMenuFooter, CommandMenuGroupHeader, CommandMenuItem, CommandMenuPanel, CommandShortcutBadge, FooterNavIcon, FooterNavText, defaultFooterHints };
285
295
 
286
296
  //# sourceMappingURL=index205.js.map