@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.
- package/dist/components/organisms/ai/AIToolCall/AIToolCall.d.ts +9 -3
- package/dist/components/organisms/ai/AIToolRun/index.d.ts +1 -1
- package/dist/components/organisms/ai/AIToolRun/validation.d.ts +24 -3
- package/dist/components/organisms/ai/_shared/format-ai-duration.d.ts +1 -0
- package/dist/components/organisms/ai/_shared/workflow-step-renderer.d.ts +1 -0
- package/dist/index.js +52 -52
- package/dist/index151.js +1 -1
- package/dist/index174.js +10 -333
- package/dist/index174.js.map +1 -1
- package/dist/index175.js +310 -137
- package/dist/index175.js.map +1 -1
- package/dist/index176.js +148 -174
- package/dist/index176.js.map +1 -1
- package/dist/index177.js +186 -78
- package/dist/index177.js.map +1 -1
- package/dist/index178.js +74 -124
- package/dist/index178.js.map +1 -1
- package/dist/index179.js +133 -1
- package/dist/index179.js.map +1 -0
- package/dist/index180.js +2 -201
- package/dist/index181.js +201 -0
- package/dist/{index180.js.map → index181.js.map} +1 -1
- package/dist/index183.js +130 -166
- package/dist/index183.js.map +1 -1
- package/dist/index184.js +195 -983
- package/dist/index184.js.map +1 -1
- package/dist/index185.js +1069 -369
- package/dist/index185.js.map +1 -1
- package/dist/index186.js +395 -197
- package/dist/index186.js.map +1 -1
- package/dist/index187.js +198 -243
- package/dist/index187.js.map +1 -1
- package/dist/index188.js +263 -3
- package/dist/index188.js.map +1 -1
- package/dist/index189.js +3 -209
- package/dist/index189.js.map +1 -1
- package/dist/index190.js +190 -777
- package/dist/index190.js.map +1 -1
- package/dist/index191.js +771 -252
- package/dist/index191.js.map +1 -1
- package/dist/index192.js +250 -65
- package/dist/index192.js.map +1 -1
- package/dist/index193.js +72 -523
- package/dist/index193.js.map +1 -1
- package/dist/index194.js +537 -144
- package/dist/index194.js.map +1 -1
- package/dist/index195.js +139 -720
- package/dist/index195.js.map +1 -1
- package/dist/index196.js +707 -167
- package/dist/index196.js.map +1 -1
- package/dist/index197.js +175 -151
- package/dist/index197.js.map +1 -1
- package/dist/index198.js +152 -487
- package/dist/index198.js.map +1 -1
- package/dist/index199.js +472 -225
- package/dist/index199.js.map +1 -1
- package/dist/index200.js +236 -260
- package/dist/index200.js.map +1 -1
- package/dist/index201.js +265 -215
- package/dist/index201.js.map +1 -1
- package/dist/index202.js +207 -307
- package/dist/index202.js.map +1 -1
- package/dist/index203.js +302 -135
- package/dist/index203.js.map +1 -1
- package/dist/index204.js +140 -271
- package/dist/index204.js.map +1 -1
- package/dist/index205.js +263 -253
- package/dist/index205.js.map +1 -1
- package/dist/index206.js +244 -137
- package/dist/index206.js.map +1 -1
- package/dist/index207.js +100 -238
- package/dist/index207.js.map +1 -1
- package/dist/index208.js +278 -74
- package/dist/index208.js.map +1 -1
- package/dist/index209.js +56 -97
- package/dist/index209.js.map +1 -1
- package/dist/index210.js +142 -47
- package/dist/index210.js.map +1 -1
- package/dist/index211.js +38 -84
- package/dist/index211.js.map +1 -1
- package/dist/index212.js +72 -252
- package/dist/index212.js.map +1 -1
- package/dist/index213.js +274 -26
- package/dist/index213.js.map +1 -1
- package/dist/index214.js +29 -94
- package/dist/index214.js.map +1 -1
- package/dist/index215.js +98 -25
- package/dist/index215.js.map +1 -1
- package/dist/index216.js +20 -565
- package/dist/index216.js.map +1 -1
- package/dist/index217.js +564 -17
- package/dist/index217.js.map +1 -1
- package/dist/index218.js +20 -23
- package/dist/index218.js.map +1 -1
- package/dist/index219.js +20 -95
- package/dist/index219.js.map +1 -1
- package/dist/index220.js +92 -88
- package/dist/index220.js.map +1 -1
- package/dist/index221.js +97 -29
- package/dist/index221.js.map +1 -1
- package/dist/index222.js +24 -470
- package/dist/index222.js.map +1 -1
- package/dist/index223.js +446 -196
- package/dist/index223.js.map +1 -1
- package/dist/index224.js +199 -729
- package/dist/index224.js.map +1 -1
- package/dist/index225.js +750 -61
- package/dist/index225.js.map +1 -1
- package/dist/index226.js +58 -181
- package/dist/index226.js.map +1 -1
- package/dist/index227.js +175 -259
- package/dist/index227.js.map +1 -1
- package/dist/index228.js +246 -172
- package/dist/index228.js.map +1 -1
- package/dist/index229.js +195 -32
- package/dist/index229.js.map +1 -1
- package/dist/index230.js +12 -40
- package/dist/index230.js.map +1 -1
- package/dist/index231.js +23 -26
- package/dist/index231.js.map +1 -1
- package/dist/index232.js +45 -22
- package/dist/index232.js.map +1 -1
- package/dist/index233.js +27 -48
- package/dist/index233.js.map +1 -1
- package/dist/index234.js +52 -26
- package/dist/index234.js.map +1 -1
- package/dist/index235.js +40 -225
- package/dist/index235.js.map +1 -1
- package/dist/index236.js +217 -39
- package/dist/index236.js.map +1 -1
- package/dist/index237.js +50 -0
- package/dist/index237.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/wc/AIToolCall.js +218 -0
- package/dist/wc/AIToolCall.js.map +1 -0
- package/dist/wc/hf-ai-tool-call.js +34 -219
- package/dist/wc/hf-ai-tool-call.js.map +1 -1
- package/dist/wc/hf-ai-tool-run.js +673 -576
- package/dist/wc/hf-ai-tool-run.js.map +1 -1
- package/dist/wc/workflow-step-renderer.js +94 -86
- package/dist/wc/workflow-step-renderer.js.map +1 -1
- package/dist/wc-react/AIToolCall.js +218 -0
- package/dist/wc-react/AIToolCall.js.map +1 -0
- package/dist/wc-react/hf-ai-tool-call.js +32 -217
- package/dist/wc-react/hf-ai-tool-call.js.map +1 -1
- package/dist/wc-react/hf-ai-tool-run.js +698 -601
- package/dist/wc-react/hf-ai-tool-run.js.map +1 -1
- package/dist/wc-react/workflow-step-renderer.js +76 -68
- package/dist/wc-react/workflow-step-renderer.js.map +1 -1
- package/package.json +1 -1
- package/skills/humain-ui/SKILL.md +1 -1
- package/skills/humain-ui-wc/SKILL.md +1 -1
- package/skills/humain-ui-wc.skill +0 -0
- package/skills/humain-ui.skill +0 -0
- package/dist/index182.js +0 -143
- package/dist/index182.js.map +0 -1
- package/dist/wc/wrench.js +0 -10
- package/dist/wc/wrench.js.map +0 -1
- package/dist/wc-react/wrench.js +0 -10
- 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 {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
"
|
|
84
|
-
|
|
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
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
-
|
|
155
|
-
function
|
|
156
|
-
return /* @__PURE__ */ jsx(
|
|
157
|
-
|
|
158
|
-
"
|
|
159
|
-
className: cn("
|
|
160
|
-
|
|
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
|
-
|
|
164
|
-
function
|
|
165
|
-
return /* @__PURE__ */ jsx(
|
|
166
|
-
|
|
167
|
-
|
|
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
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
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
|
-
|
|
181
|
-
function
|
|
182
|
-
return /* @__PURE__ */ jsxs(
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
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: [
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
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
|
-
|
|
210
|
-
function
|
|
211
|
-
return /* @__PURE__ */
|
|
212
|
-
"data-slot": "
|
|
213
|
-
className: cn("
|
|
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
|
|
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
|
-
|
|
227
|
-
function
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
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
|
-
|
|
234
|
-
function
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
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
|
-
|
|
235
|
+
]
|
|
247
236
|
});
|
|
248
237
|
}
|
|
249
|
-
|
|
250
|
-
function
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
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
|
-
|
|
258
|
-
function
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
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
|
-
|
|
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 {
|
|
294
|
+
export { CommandMenu, CommandMenuFooter, CommandMenuGroupHeader, CommandMenuItem, CommandMenuPanel, CommandShortcutBadge, FooterNavIcon, FooterNavText, defaultFooterHints };
|
|
285
295
|
|
|
286
296
|
//# sourceMappingURL=index205.js.map
|