@vercel/geistdocs 1.2.2 → 1.3.0-canary.41d37f1
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/cli/index.js +3 -0
- package/dist/components/callout.d.ts +12 -0
- package/dist/components/callout.d.ts.map +1 -0
- package/dist/components/callout.js +7 -0
- package/dist/components/code-block-tabs.d.ts +7 -0
- package/dist/components/code-block-tabs.d.ts.map +1 -0
- package/dist/components/code-block-tabs.js +7 -0
- package/dist/components/code-block.d.ts +14 -0
- package/dist/components/code-block.d.ts.map +1 -0
- package/dist/components/code-block.js +41 -0
- package/dist/components/mermaid.d.ts +4 -0
- package/dist/components/mermaid.d.ts.map +1 -0
- package/dist/components/mermaid.js +44 -0
- package/dist/components/theme-aware-image.d.ts +12 -0
- package/dist/components/theme-aware-image.d.ts.map +1 -0
- package/dist/components/theme-aware-image.js +8 -0
- package/dist/components/video.d.ts +6 -0
- package/dist/components/video.d.ts.map +1 -0
- package/dist/components/video.js +3 -0
- package/dist/config.d.ts +52 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +1 -0
- package/dist/controls.d.ts +15 -0
- package/dist/controls.d.ts.map +1 -0
- package/dist/controls.js +52 -0
- package/dist/internal/chat/context.d.ts +19 -0
- package/dist/internal/chat/context.d.ts.map +1 -0
- package/dist/internal/chat/context.js +36 -0
- package/dist/internal/chat/conversation.d.ts +10 -0
- package/dist/internal/chat/conversation.d.ts.map +1 -0
- package/dist/internal/chat/conversation.js +16 -0
- package/dist/internal/chat/copy-chat.d.ts +5 -0
- package/dist/internal/chat/copy-chat.d.ts.map +1 -0
- package/dist/internal/chat/copy-chat.js +35 -0
- package/dist/internal/chat/db.d.ts +13 -0
- package/dist/internal/chat/db.d.ts.map +1 -0
- package/dist/internal/chat/db.js +19 -0
- package/dist/internal/chat/message-metadata.d.ts +8 -0
- package/dist/internal/chat/message-metadata.d.ts.map +1 -0
- package/dist/internal/chat/message-metadata.js +29 -0
- package/dist/internal/chat/message.d.ts +11 -0
- package/dist/internal/chat/message.d.ts.map +1 -0
- package/dist/internal/chat/message.js +11 -0
- package/dist/internal/chat/prompt-input.d.ts +13 -0
- package/dist/internal/chat/prompt-input.d.ts.map +1 -0
- package/dist/internal/chat/prompt-input.js +39 -0
- package/dist/internal/chat/shell.d.ts +2 -0
- package/dist/internal/chat/shell.d.ts.map +1 -0
- package/dist/internal/chat/shell.js +194 -0
- package/dist/internal/chat/shimmer.d.ts +11 -0
- package/dist/internal/chat/shimmer.d.ts.map +1 -0
- package/dist/internal/chat/shimmer.js +18 -0
- package/dist/internal/chat/sources.d.ts +13 -0
- package/dist/internal/chat/sources.d.ts.map +1 -0
- package/dist/internal/chat/sources.js +9 -0
- package/dist/internal/chat/suggestion.d.ts +11 -0
- package/dist/internal/chat/suggestion.d.ts.map +1 -0
- package/dist/internal/chat/suggestion.js +12 -0
- package/dist/internal/cn.d.ts +3 -0
- package/dist/internal/cn.d.ts.map +1 -0
- package/dist/internal/cn.js +3 -0
- package/dist/internal/feedback-action.d.ts +14 -0
- package/dist/internal/feedback-action.d.ts.map +1 -0
- package/dist/internal/feedback-action.js +34 -0
- package/dist/internal/i18n.d.ts +6 -0
- package/dist/internal/i18n.d.ts.map +1 -0
- package/dist/internal/i18n.js +18 -0
- package/dist/internal/languages.d.ts +7 -0
- package/dist/internal/languages.d.ts.map +1 -0
- package/dist/internal/languages.js +18 -0
- package/dist/internal/not-implemented.d.ts +2 -0
- package/dist/internal/not-implemented.d.ts.map +1 -0
- package/dist/internal/not-implemented.js +4 -0
- package/dist/internal/page-actions-client.d.ts +14 -0
- package/dist/internal/page-actions-client.d.ts.map +1 -0
- package/dist/internal/page-actions-client.js +154 -0
- package/dist/internal/page-actions.d.ts +18 -0
- package/dist/internal/page-actions.d.ts.map +1 -0
- package/dist/internal/page-actions.js +4 -0
- package/dist/internal/search.d.ts +5 -0
- package/dist/internal/search.d.ts.map +1 -0
- package/dist/internal/search.js +14 -0
- package/dist/internal/sidebar.d.ts +6 -0
- package/dist/internal/sidebar.d.ts.map +1 -0
- package/dist/internal/sidebar.js +37 -0
- package/dist/internal/ui/button-group.d.ts +13 -0
- package/dist/internal/ui/button-group.d.ts.map +1 -0
- package/dist/internal/ui/button-group.js +26 -0
- package/dist/internal/ui/button.d.ts +12 -0
- package/dist/internal/ui/button.d.ts.map +1 -0
- package/dist/internal/ui/button.js +33 -0
- package/dist/internal/ui/card.d.ts +6 -0
- package/dist/internal/ui/card.d.ts.map +1 -0
- package/dist/internal/ui/card.js +14 -0
- package/dist/internal/ui/collapsible.d.ts +6 -0
- package/dist/internal/ui/collapsible.d.ts.map +1 -0
- package/dist/internal/ui/collapsible.js +12 -0
- package/dist/internal/ui/drawer.d.ts +6 -0
- package/dist/internal/ui/drawer.d.ts.map +1 -0
- package/dist/internal/ui/drawer.js +13 -0
- package/dist/internal/ui/dropdown-menu.d.ts +22 -0
- package/dist/internal/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/internal/ui/dropdown-menu.js +41 -0
- package/dist/internal/ui/input-group.d.ts +15 -0
- package/dist/internal/ui/input-group.d.ts.map +1 -0
- package/dist/internal/ui/input-group.js +44 -0
- package/dist/internal/ui/input.d.ts +3 -0
- package/dist/internal/ui/input.d.ts.map +1 -0
- package/dist/internal/ui/input.js +5 -0
- package/dist/internal/ui/kbd.d.ts +4 -0
- package/dist/internal/ui/kbd.d.ts.map +1 -0
- package/dist/internal/ui/kbd.js +8 -0
- package/dist/internal/ui/popover.d.ts +6 -0
- package/dist/internal/ui/popover.d.ts.map +1 -0
- package/dist/internal/ui/popover.js +13 -0
- package/dist/internal/ui/scroll-area.d.ts +5 -0
- package/dist/internal/ui/scroll-area.d.ts.map +1 -0
- package/dist/internal/ui/scroll-area.js +12 -0
- package/dist/internal/ui/separator.d.ts +4 -0
- package/dist/internal/ui/separator.d.ts.map +1 -0
- package/dist/internal/ui/separator.js +7 -0
- package/dist/internal/ui/sheet.d.ts +10 -0
- package/dist/internal/ui/sheet.d.ts.map +1 -0
- package/dist/internal/ui/sheet.js +24 -0
- package/dist/internal/ui/sonner.d.ts +3 -0
- package/dist/internal/ui/sonner.d.ts.map +1 -0
- package/dist/internal/ui/sonner.js +20 -0
- package/dist/internal/ui/spinner.d.ts +3 -0
- package/dist/internal/ui/spinner.d.ts.map +1 -0
- package/dist/internal/ui/spinner.js +6 -0
- package/dist/internal/ui/textarea.d.ts +3 -0
- package/dist/internal/ui/textarea.d.ts.map +1 -0
- package/dist/internal/ui/textarea.js +5 -0
- package/dist/internal/ui/tooltip.d.ts +7 -0
- package/dist/internal/ui/tooltip.d.ts.map +1 -0
- package/dist/internal/ui/tooltip.js +16 -0
- package/dist/internal/use-mobile.d.ts +2 -0
- package/dist/internal/use-mobile.d.ts.map +1 -0
- package/dist/internal/use-mobile.js +16 -0
- package/dist/layout.d.ts +18 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +49 -0
- package/dist/mdx.d.ts +36 -0
- package/dist/mdx.d.ts.map +1 -0
- package/dist/mdx.js +72 -0
- package/dist/pages/docs.d.ts +55 -0
- package/dist/pages/docs.d.ts.map +1 -0
- package/dist/pages/docs.js +63 -0
- package/dist/proxy.d.ts +21 -0
- package/dist/proxy.d.ts.map +1 -0
- package/dist/proxy.js +109 -0
- package/dist/routes/chat.d.ts +13 -0
- package/dist/routes/chat.d.ts.map +1 -0
- package/dist/routes/chat.js +229 -0
- package/dist/routes/llms.d.ts +33 -0
- package/dist/routes/llms.d.ts.map +1 -0
- package/dist/routes/llms.js +39 -0
- package/dist/routes/search.d.ts +10 -0
- package/dist/routes/search.d.ts.map +1 -0
- package/dist/routes/search.js +33 -0
- package/dist/routes/sitemap.d.ts +35 -0
- package/dist/routes/sitemap.d.ts.map +1 -0
- package/dist/routes/sitemap.js +150 -0
- package/dist/source.d.ts +30 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +72 -0
- package/package.json +129 -9
- package/styles.css +193 -0
- package/template/_gitignore +1 -0
- package/template/app/[lang]/(home)/components/centered-section.tsx +26 -0
- package/template/app/[lang]/(home)/components/cta.tsx +19 -0
- package/template/app/[lang]/(home)/components/hero.tsx +27 -0
- package/template/app/[lang]/(home)/components/one-two-section.tsx +25 -0
- package/template/app/[lang]/(home)/components/templates.tsx +50 -0
- package/template/app/[lang]/(home)/components/text-grid-section.tsx +20 -0
- package/template/app/[lang]/(home)/layout.tsx +14 -0
- package/template/app/[lang]/(home)/page.tsx +126 -0
- package/template/app/[lang]/docs/[[...slug]]/page.tsx +19 -0
- package/template/app/[lang]/docs/layout.tsx +14 -0
- package/template/app/[lang]/layout.tsx +29 -0
- package/template/app/[lang]/llms.mdx/[[...slug]]/route.ts +7 -0
- package/template/app/[lang]/llms.txt/route.ts +6 -0
- package/template/app/[lang]/og/[...slug]/background.png +0 -0
- package/template/app/[lang]/og/[...slug]/geist-sans-regular.ttf +0 -0
- package/template/app/[lang]/og/[...slug]/geist-sans-semibold.ttf +0 -0
- package/template/app/[lang]/og/[...slug]/route.tsx +95 -0
- package/template/app/[lang]/rss.xml/route.ts +52 -0
- package/template/app/[lang]/sitemap.md/route.ts +9 -0
- package/template/app/actions/feedback/emotions.ts +18 -0
- package/template/app/actions/feedback/index.ts +45 -0
- package/template/app/api/chat/route.ts +8 -0
- package/template/app/api/search/route.ts +5 -0
- package/template/app/favicon.ico +0 -0
- package/template/app/global.css +2 -0
- package/template/app/robots.ts +14 -0
- package/template/app/sitemap.ts +36 -0
- package/template/app/styles/geistdocs.css +553 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-arrow-up-right-small.tsx +35 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-arrow-up-right.tsx +27 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-check.tsx +27 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-chevron-down-small.tsx +30 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-chevron-right.tsx +27 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-copy.tsx +27 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-file-text.tsx +25 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-menu-alt.tsx +27 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/icon-slash-forward.tsx +36 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/icons/index.tsx +11 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/index.tsx +14 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/logo-ai-elements.tsx +29 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/logo-ai-sdk.tsx +38 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/logo-chat-sdk.tsx +42 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/logo-flags-sdk.tsx +42 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/logo-icon-vercel.tsx +31 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/logo-streamdown.tsx +29 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/logo-vercel-oss.tsx +24 -0
- package/template/components/geistcn-fallbacks/geistcn-assets/logos/logo-workflow-sdk.tsx +73 -0
- package/template/components/geistdocs/callout.tsx +40 -0
- package/template/components/geistdocs/chat.tsx +24 -0
- package/template/components/geistdocs/code-block-tabs.tsx +61 -0
- package/template/components/geistdocs/code-block.tsx +134 -0
- package/template/components/geistdocs/copy-page.tsx +27 -0
- package/template/components/geistdocs/desktop-menu.tsx +52 -0
- package/template/components/geistdocs/docs-layout.tsx +20 -0
- package/template/components/geistdocs/docs-page.tsx +35 -0
- package/template/components/geistdocs/edit-source.tsx +30 -0
- package/template/components/geistdocs/feedback.tsx +139 -0
- package/template/components/geistdocs/footer.tsx +30 -0
- package/template/components/geistdocs/github-button.tsx +19 -0
- package/template/components/geistdocs/home-layout.tsx +46 -0
- package/template/components/geistdocs/icons.tsx +13 -0
- package/template/components/geistdocs/installer.tsx +58 -0
- package/template/components/geistdocs/language-selector.tsx +3 -0
- package/template/components/geistdocs/mdx-components.tsx +5 -0
- package/template/components/geistdocs/mermaid.tsx +68 -0
- package/template/components/geistdocs/mobile-docs-bar.tsx +81 -0
- package/template/components/geistdocs/mobile-menu.tsx +150 -0
- package/template/components/geistdocs/navbar-logo.tsx +124 -0
- package/template/components/geistdocs/navbar.tsx +22 -0
- package/template/components/geistdocs/provider.tsx +31 -0
- package/template/components/geistdocs/rss-button.tsx +10 -0
- package/template/components/geistdocs/scroll-top.tsx +21 -0
- package/template/components/geistdocs/search.tsx +17 -0
- package/template/components/geistdocs/sidebar.tsx +128 -0
- package/template/components/geistdocs/theme-aware-image.tsx +22 -0
- package/template/components/geistdocs/theme-toggle.tsx +3 -0
- package/template/components/geistdocs/video.tsx +16 -0
- package/template/components/ui/badge.tsx +46 -0
- package/template/components/ui/button-group.tsx +83 -0
- package/template/components/ui/button.tsx +60 -0
- package/template/components/ui/card.tsx +92 -0
- package/template/components/ui/collapsible.tsx +33 -0
- package/template/components/ui/command-prompt.tsx +488 -0
- package/template/components/ui/command.tsx +184 -0
- package/template/components/ui/dialog.tsx +143 -0
- package/template/components/ui/drawer.tsx +135 -0
- package/template/components/ui/dropdown-menu.tsx +257 -0
- package/template/components/ui/hover-card.tsx +44 -0
- package/template/components/ui/input-group.tsx +170 -0
- package/template/components/ui/input.tsx +21 -0
- package/template/components/ui/kbd.tsx +28 -0
- package/template/components/ui/navigation-menu.tsx +192 -0
- package/template/components/ui/popover.tsx +48 -0
- package/template/components/ui/scroll-area.tsx +58 -0
- package/template/components/ui/select.tsx +187 -0
- package/template/components/ui/separator.tsx +28 -0
- package/template/components/ui/sheet.tsx +139 -0
- package/template/components/ui/sonner.tsx +40 -0
- package/template/components/ui/spinner.tsx +16 -0
- package/template/components/ui/textarea.tsx +18 -0
- package/template/components/ui/tooltip.tsx +61 -0
- package/template/components.json +22 -0
- package/template/content/docs/ask-ai.cn.mdx +85 -0
- package/template/content/docs/ask-ai.mdx +85 -0
- package/template/content/docs/configuration.cn.mdx +115 -0
- package/template/content/docs/configuration.mdx +115 -0
- package/template/content/docs/deployment.cn.mdx +34 -0
- package/template/content/docs/deployment.mdx +34 -0
- package/template/content/docs/edit-on-github.cn.mdx +47 -0
- package/template/content/docs/edit-on-github.mdx +47 -0
- package/template/content/docs/env.cn.mdx +25 -0
- package/template/content/docs/env.mdx +25 -0
- package/template/content/docs/feedback.cn.mdx +85 -0
- package/template/content/docs/feedback.mdx +85 -0
- package/template/content/docs/getting-started.cn.mdx +86 -0
- package/template/content/docs/getting-started.mdx +86 -0
- package/template/content/docs/index.cn.mdx +54 -0
- package/template/content/docs/index.mdx +87 -0
- package/template/content/docs/internationalization.cn.mdx +113 -0
- package/template/content/docs/internationalization.mdx +117 -0
- package/template/content/docs/llms-txt.cn.mdx +50 -0
- package/template/content/docs/llms-txt.mdx +50 -0
- package/template/content/docs/md.cn.mdx +68 -0
- package/template/content/docs/md.mdx +68 -0
- package/template/content/docs/meta.json +21 -0
- package/template/content/docs/open-in-chat.cn.mdx +78 -0
- package/template/content/docs/open-in-chat.mdx +78 -0
- package/template/content/docs/provider.cn.mdx +69 -0
- package/template/content/docs/provider.mdx +69 -0
- package/template/content/docs/rss.cn.mdx +104 -0
- package/template/content/docs/rss.mdx +104 -0
- package/template/content/docs/syntax.cn.mdx +416 -0
- package/template/content/docs/syntax.mdx +407 -0
- package/template/content/docs/theme-aware-image.mdx +53 -0
- package/template/geistdocs.tsx +51 -0
- package/template/hooks/geistdocs/use-sidebar.ts +13 -0
- package/template/hooks/use-mobile.ts +19 -0
- package/template/lib/geistdocs/config.tsx +27 -0
- package/template/lib/geistdocs/fonts.ts +18 -0
- package/template/lib/geistdocs/i18n.ts +13 -0
- package/template/lib/geistdocs/md-tracking.ts +56 -0
- package/template/lib/geistdocs/source.ts +12 -0
- package/template/lib/utils.ts +6 -0
- package/template/next.config.ts +22 -0
- package/template/package.json +63 -0
- package/template/postcss.config.mjs +5 -0
- package/template/proxy.ts +16 -0
- package/template/source.config.ts +62 -0
- package/template/tsconfig.json +37 -0
- package/dist/index.js +0 -2
- /package/dist/{index.d.ts → cli/index.d.ts} +0 -0
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
4
|
+
import {
|
|
5
|
+
Children,
|
|
6
|
+
type ComponentPropsWithoutRef,
|
|
7
|
+
createContext,
|
|
8
|
+
isValidElement,
|
|
9
|
+
type JSX,
|
|
10
|
+
type ReactNode,
|
|
11
|
+
useContext,
|
|
12
|
+
useEffect,
|
|
13
|
+
useLayoutEffect,
|
|
14
|
+
useRef,
|
|
15
|
+
useState,
|
|
16
|
+
} from "react";
|
|
17
|
+
import { IconCheck } from "@/components/geistcn-fallbacks/geistcn-assets/icons/icon-check";
|
|
18
|
+
import { IconCopy } from "@/components/geistcn-fallbacks/geistcn-assets/icons/icon-copy";
|
|
19
|
+
import { cn } from "@/lib/utils";
|
|
20
|
+
|
|
21
|
+
type CommandPromptContextValue = {
|
|
22
|
+
value: string;
|
|
23
|
+
setValue: (value: string) => void;
|
|
24
|
+
copied: boolean;
|
|
25
|
+
copyActiveValue: () => void;
|
|
26
|
+
activeCopyValue: string;
|
|
27
|
+
setActiveCopyValue: (value: string) => void;
|
|
28
|
+
commandWidth?: number;
|
|
29
|
+
setCommandWidth: (value: number | undefined) => void;
|
|
30
|
+
isOverflowing: boolean;
|
|
31
|
+
setIsOverflowing: (value: boolean) => void;
|
|
32
|
+
canShowGradient: boolean;
|
|
33
|
+
setCanShowGradient: (value: boolean) => void;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const CommandPromptContext = createContext<CommandPromptContextValue | null>(
|
|
37
|
+
null
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
function useCommandPromptContext(component: string) {
|
|
41
|
+
const context = useContext(CommandPromptContext);
|
|
42
|
+
|
|
43
|
+
if (!context) {
|
|
44
|
+
throw new Error(`${component} must be used within CommandPrompt.Root`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return context;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
type CommandPromptRootProps = Omit<
|
|
51
|
+
ComponentPropsWithoutRef<"div">,
|
|
52
|
+
"onChange"
|
|
53
|
+
> & {
|
|
54
|
+
value?: string;
|
|
55
|
+
defaultValue?: string;
|
|
56
|
+
onValueChange?: (value: string) => void;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export function CommandPromptRoot({
|
|
60
|
+
value: valueProp,
|
|
61
|
+
defaultValue,
|
|
62
|
+
onValueChange,
|
|
63
|
+
className,
|
|
64
|
+
children,
|
|
65
|
+
...props
|
|
66
|
+
}: CommandPromptRootProps): JSX.Element {
|
|
67
|
+
const [uncontrolledValue, setUncontrolledValue] = useState(
|
|
68
|
+
defaultValue ?? ""
|
|
69
|
+
);
|
|
70
|
+
const [copied, setCopied] = useState(false);
|
|
71
|
+
const [activeCopyValue, setActiveCopyValue] = useState("");
|
|
72
|
+
const [commandWidth, setCommandWidth] = useState<number>();
|
|
73
|
+
const [isOverflowing, setIsOverflowing] = useState(false);
|
|
74
|
+
const [canShowGradient, setCanShowGradient] = useState(true);
|
|
75
|
+
const timeoutRef = useRef<ReturnType<typeof setTimeout>>(null);
|
|
76
|
+
const value = valueProp ?? uncontrolledValue;
|
|
77
|
+
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
return () => {
|
|
80
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
81
|
+
};
|
|
82
|
+
}, []);
|
|
83
|
+
|
|
84
|
+
function resetCopiedState() {
|
|
85
|
+
setCopied(false);
|
|
86
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function setValue(nextValue: string) {
|
|
90
|
+
if (valueProp === undefined) {
|
|
91
|
+
setUncontrolledValue(nextValue);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
resetCopiedState();
|
|
95
|
+
onValueChange?.(nextValue);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function copyActiveValue() {
|
|
99
|
+
if (!activeCopyValue) return;
|
|
100
|
+
|
|
101
|
+
void navigator.clipboard.writeText(activeCopyValue);
|
|
102
|
+
setCopied(true);
|
|
103
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
104
|
+
timeoutRef.current = setTimeout(() => setCopied(false), 1000);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<CommandPromptContext.Provider
|
|
109
|
+
value={{
|
|
110
|
+
value,
|
|
111
|
+
setValue,
|
|
112
|
+
copied,
|
|
113
|
+
copyActiveValue,
|
|
114
|
+
activeCopyValue,
|
|
115
|
+
setActiveCopyValue,
|
|
116
|
+
commandWidth,
|
|
117
|
+
setCommandWidth,
|
|
118
|
+
isOverflowing,
|
|
119
|
+
setIsOverflowing,
|
|
120
|
+
canShowGradient,
|
|
121
|
+
setCanShowGradient,
|
|
122
|
+
}}
|
|
123
|
+
>
|
|
124
|
+
<div
|
|
125
|
+
className={cn("w-full flex items-center flex-col gap-2", className)}
|
|
126
|
+
{...props}
|
|
127
|
+
>
|
|
128
|
+
{children}
|
|
129
|
+
</div>
|
|
130
|
+
</CommandPromptContext.Provider>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function CommandPromptList({
|
|
135
|
+
className,
|
|
136
|
+
...props
|
|
137
|
+
}: ComponentPropsWithoutRef<"div">): JSX.Element {
|
|
138
|
+
return <div className={cn("flex items-center", className)} {...props} />;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
type CommandPromptTriggerProps = ComponentPropsWithoutRef<"button"> & {
|
|
142
|
+
value: string;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export function CommandPromptTrigger({
|
|
146
|
+
value,
|
|
147
|
+
className,
|
|
148
|
+
onClick,
|
|
149
|
+
children,
|
|
150
|
+
...props
|
|
151
|
+
}: CommandPromptTriggerProps): JSX.Element {
|
|
152
|
+
const context = useCommandPromptContext("CommandPrompt.Trigger");
|
|
153
|
+
const active = context.value === value;
|
|
154
|
+
|
|
155
|
+
return (
|
|
156
|
+
<button
|
|
157
|
+
aria-pressed={active}
|
|
158
|
+
className={cn(
|
|
159
|
+
"cursor-pointer text-gray-900 hover:text-gray-1000 px-3 py-2",
|
|
160
|
+
"text-label-13! font-medium! touch-manipulation border-none bg-transparent rounded-sm",
|
|
161
|
+
"outline outline-2 outline-offset-2 outline-transparent focus-visible:outline-[var(--ds-focus-color)]",
|
|
162
|
+
"text-gray-900 data-[active]:text-gray-1000 data-[active]:font-medium",
|
|
163
|
+
"flex gap-1.5 items-center whitespace-nowrap",
|
|
164
|
+
className
|
|
165
|
+
)}
|
|
166
|
+
data-active={active ? "" : undefined}
|
|
167
|
+
onClick={(event) => {
|
|
168
|
+
onClick?.(event);
|
|
169
|
+
if (event.defaultPrevented) return;
|
|
170
|
+
context.setValue(value);
|
|
171
|
+
}}
|
|
172
|
+
type="button"
|
|
173
|
+
{...props}
|
|
174
|
+
>
|
|
175
|
+
{children}
|
|
176
|
+
</button>
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export function CommandPromptTriggerDivider({
|
|
181
|
+
className,
|
|
182
|
+
...props
|
|
183
|
+
}: ComponentPropsWithoutRef<"div">): JSX.Element {
|
|
184
|
+
return (
|
|
185
|
+
<div
|
|
186
|
+
aria-hidden
|
|
187
|
+
className={cn("w-px h-3 bg-gray-400", className)}
|
|
188
|
+
{...props}
|
|
189
|
+
/>
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export function CommandPromptSurface({
|
|
194
|
+
className,
|
|
195
|
+
onClick,
|
|
196
|
+
children,
|
|
197
|
+
}: {
|
|
198
|
+
className?: string;
|
|
199
|
+
children: ReactNode;
|
|
200
|
+
onClick?: ComponentPropsWithoutRef<"div">["onClick"];
|
|
201
|
+
}): JSX.Element {
|
|
202
|
+
const context = useCommandPromptContext("CommandPrompt.Surface");
|
|
203
|
+
const shouldReduceMotion = useReducedMotion();
|
|
204
|
+
|
|
205
|
+
return (
|
|
206
|
+
<motion.div
|
|
207
|
+
className={cn(
|
|
208
|
+
"relative flex items-center group gap-1 material-small transition-colors pl-5 py-2 pr-3 max-w-[calc(100vw-48px)] rounded-full",
|
|
209
|
+
className
|
|
210
|
+
)}
|
|
211
|
+
layout
|
|
212
|
+
onClick={(event) => {
|
|
213
|
+
onClick?.(event);
|
|
214
|
+
if (event.defaultPrevented) return;
|
|
215
|
+
if (window.getSelection()?.toString()) return;
|
|
216
|
+
context.copyActiveValue();
|
|
217
|
+
}}
|
|
218
|
+
transition={
|
|
219
|
+
shouldReduceMotion
|
|
220
|
+
? { duration: 0 }
|
|
221
|
+
: { type: "spring", bounce: 0, duration: 0.4 }
|
|
222
|
+
}
|
|
223
|
+
>
|
|
224
|
+
{children}
|
|
225
|
+
</motion.div>
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export function CommandPromptPrefix({
|
|
230
|
+
className,
|
|
231
|
+
...props
|
|
232
|
+
}: ComponentPropsWithoutRef<"span">): JSX.Element {
|
|
233
|
+
return (
|
|
234
|
+
<span
|
|
235
|
+
className={cn("block text-label-16-mono! text-gray-500 pr-1", className)}
|
|
236
|
+
{...props}
|
|
237
|
+
/>
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
type CommandPromptContentProps = {
|
|
242
|
+
value: string;
|
|
243
|
+
copyValue?: string;
|
|
244
|
+
className?: string;
|
|
245
|
+
children: ReactNode;
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
export function CommandPromptViewport({
|
|
249
|
+
className,
|
|
250
|
+
children,
|
|
251
|
+
}: {
|
|
252
|
+
className?: string;
|
|
253
|
+
children: ReactNode;
|
|
254
|
+
}): JSX.Element {
|
|
255
|
+
const context = useCommandPromptContext("CommandPrompt.Viewport");
|
|
256
|
+
const shouldReduceMotion = useReducedMotion();
|
|
257
|
+
const {
|
|
258
|
+
commandWidth,
|
|
259
|
+
canShowGradient,
|
|
260
|
+
isOverflowing,
|
|
261
|
+
setActiveCopyValue,
|
|
262
|
+
setCanShowGradient,
|
|
263
|
+
setCommandWidth,
|
|
264
|
+
setIsOverflowing,
|
|
265
|
+
} = context;
|
|
266
|
+
const measureRef = useRef<HTMLSpanElement>(null);
|
|
267
|
+
const scrollObserverCleanup = useRef<(() => void) | null>(null);
|
|
268
|
+
const items = Children.toArray(children)
|
|
269
|
+
.filter((child): child is React.ReactElement<CommandPromptContentProps> =>
|
|
270
|
+
isValidElement<CommandPromptContentProps>(child)
|
|
271
|
+
)
|
|
272
|
+
.map((child) => child.props);
|
|
273
|
+
const activeItem = items.find((item) => item.value === context.value);
|
|
274
|
+
const command = activeItem?.children ?? null;
|
|
275
|
+
const fallbackCopyValue =
|
|
276
|
+
typeof command === "string" || typeof command === "number"
|
|
277
|
+
? String(command)
|
|
278
|
+
: Children.toArray(command)
|
|
279
|
+
.filter(
|
|
280
|
+
(child): child is string | number =>
|
|
281
|
+
typeof child === "string" || typeof child === "number"
|
|
282
|
+
)
|
|
283
|
+
.join("");
|
|
284
|
+
const copyValue = activeItem?.copyValue ?? fallbackCopyValue;
|
|
285
|
+
|
|
286
|
+
useLayoutEffect(() => {
|
|
287
|
+
setIsOverflowing(false);
|
|
288
|
+
setCanShowGradient(Boolean(shouldReduceMotion));
|
|
289
|
+
}, [copyValue, setCanShowGradient, setIsOverflowing, shouldReduceMotion]);
|
|
290
|
+
|
|
291
|
+
useEffect(() => {
|
|
292
|
+
setActiveCopyValue(copyValue);
|
|
293
|
+
|
|
294
|
+
return () => {
|
|
295
|
+
setIsOverflowing(false);
|
|
296
|
+
scrollObserverCleanup.current?.();
|
|
297
|
+
scrollObserverCleanup.current = null;
|
|
298
|
+
};
|
|
299
|
+
}, [copyValue, setActiveCopyValue, setIsOverflowing]);
|
|
300
|
+
|
|
301
|
+
useLayoutEffect(() => {
|
|
302
|
+
if (!measureRef.current) return;
|
|
303
|
+
|
|
304
|
+
setCommandWidth(measureRef.current.getBoundingClientRect().width);
|
|
305
|
+
}, [command, copyValue, setCommandWidth]);
|
|
306
|
+
|
|
307
|
+
return (
|
|
308
|
+
<motion.span
|
|
309
|
+
animate={
|
|
310
|
+
commandWidth === undefined
|
|
311
|
+
? undefined
|
|
312
|
+
: { width: shouldReduceMotion ? "auto" : commandWidth }
|
|
313
|
+
}
|
|
314
|
+
className={cn(
|
|
315
|
+
"relative block min-w-0 overflow-hidden text-label-14-mono! text-gray-1000",
|
|
316
|
+
className
|
|
317
|
+
)}
|
|
318
|
+
initial={false}
|
|
319
|
+
onAnimationComplete={() => {
|
|
320
|
+
setCanShowGradient(true);
|
|
321
|
+
}}
|
|
322
|
+
transition={
|
|
323
|
+
shouldReduceMotion
|
|
324
|
+
? { duration: 0 }
|
|
325
|
+
: { type: "spring", bounce: 0, duration: 0.4 }
|
|
326
|
+
}
|
|
327
|
+
>
|
|
328
|
+
<span
|
|
329
|
+
aria-hidden
|
|
330
|
+
className="pointer-events-none invisible absolute whitespace-nowrap"
|
|
331
|
+
ref={measureRef}
|
|
332
|
+
>
|
|
333
|
+
{command}
|
|
334
|
+
</span>
|
|
335
|
+
<AnimatePresence initial={false} mode="wait">
|
|
336
|
+
{Children.toArray(children).map((child) => {
|
|
337
|
+
if (!isValidElement<CommandPromptContentProps>(child)) return null;
|
|
338
|
+
if (child.props.value !== context.value) return null;
|
|
339
|
+
|
|
340
|
+
return (
|
|
341
|
+
<motion.span
|
|
342
|
+
animate={{ opacity: 1, filter: "blur(0px)" }}
|
|
343
|
+
className={cn(
|
|
344
|
+
"block whitespace-nowrap min-w-0 py-2",
|
|
345
|
+
canShowGradient && isOverflowing
|
|
346
|
+
? "overflow-x-auto"
|
|
347
|
+
: "overflow-x-hidden",
|
|
348
|
+
child.props.className
|
|
349
|
+
)}
|
|
350
|
+
exit={{ opacity: 0, filter: "blur(1px)" }}
|
|
351
|
+
initial={{ opacity: 0, filter: "blur(1px)" }}
|
|
352
|
+
key={copyValue}
|
|
353
|
+
ref={(element) => {
|
|
354
|
+
scrollObserverCleanup.current?.();
|
|
355
|
+
scrollObserverCleanup.current = null;
|
|
356
|
+
if (!element) return;
|
|
357
|
+
|
|
358
|
+
const checkOverflow = () => {
|
|
359
|
+
setIsOverflowing(element.scrollWidth > element.clientWidth);
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
checkOverflow();
|
|
363
|
+
const observer = new ResizeObserver(checkOverflow);
|
|
364
|
+
observer.observe(element);
|
|
365
|
+
scrollObserverCleanup.current = () => observer.disconnect();
|
|
366
|
+
}}
|
|
367
|
+
transition={
|
|
368
|
+
shouldReduceMotion ? { duration: 0 } : { duration: 0.15 }
|
|
369
|
+
}
|
|
370
|
+
>
|
|
371
|
+
{child.props.children}
|
|
372
|
+
</motion.span>
|
|
373
|
+
);
|
|
374
|
+
})}
|
|
375
|
+
</AnimatePresence>
|
|
376
|
+
<AnimatePresence>
|
|
377
|
+
{canShowGradient && isOverflowing && (
|
|
378
|
+
<motion.span
|
|
379
|
+
animate={{ opacity: 1 }}
|
|
380
|
+
aria-hidden
|
|
381
|
+
className="pointer-events-none block z-10 absolute right-0 bg-gradient-to-r from-transparent to-background-100 top-0 bottom-0 w-4"
|
|
382
|
+
exit={{ opacity: 0 }}
|
|
383
|
+
initial={{ opacity: 0 }}
|
|
384
|
+
transition={
|
|
385
|
+
shouldReduceMotion ? { duration: 0 } : { duration: 0.2 }
|
|
386
|
+
}
|
|
387
|
+
/>
|
|
388
|
+
)}
|
|
389
|
+
</AnimatePresence>
|
|
390
|
+
</motion.span>
|
|
391
|
+
);
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export function CommandPromptContent(
|
|
395
|
+
_props: CommandPromptContentProps
|
|
396
|
+
): JSX.Element | null {
|
|
397
|
+
return null;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export function CommandPromptCopy({
|
|
401
|
+
className,
|
|
402
|
+
onClick,
|
|
403
|
+
...props
|
|
404
|
+
}: ComponentPropsWithoutRef<"button">): JSX.Element {
|
|
405
|
+
const context = useCommandPromptContext("CommandPrompt.Copy");
|
|
406
|
+
const shouldReduceMotion = useReducedMotion();
|
|
407
|
+
|
|
408
|
+
return (
|
|
409
|
+
<button
|
|
410
|
+
aria-label={context.copied ? "Copied" : "Copy command"}
|
|
411
|
+
className={cn(
|
|
412
|
+
"text-gray-1000 rounded-full border-none bg-transparent shrink-0 cursor-pointer relative size-8 flex items-center justify-center translate-x-0.5",
|
|
413
|
+
"group-hover:bg-gray-alpha-100 hover:!bg-gray-alpha-200 transition-colors touch-manipulation",
|
|
414
|
+
"outline-2 outline-offset-2 outline-transparent focus-visible:outline-[var(--ds-focus-color)]",
|
|
415
|
+
className
|
|
416
|
+
)}
|
|
417
|
+
onClick={(event) => {
|
|
418
|
+
onClick?.(event);
|
|
419
|
+
if (event.defaultPrevented) return;
|
|
420
|
+
event.stopPropagation();
|
|
421
|
+
context.copyActiveValue();
|
|
422
|
+
}}
|
|
423
|
+
type="button"
|
|
424
|
+
{...props}
|
|
425
|
+
>
|
|
426
|
+
<AnimatePresence initial={false}>
|
|
427
|
+
{!context.copied && (
|
|
428
|
+
<motion.span
|
|
429
|
+
animate={{
|
|
430
|
+
opacity: 1,
|
|
431
|
+
transform: "scale(1)",
|
|
432
|
+
filter: "blur(0px)",
|
|
433
|
+
}}
|
|
434
|
+
className="absolute inset-0 flex items-center justify-center"
|
|
435
|
+
exit={{
|
|
436
|
+
opacity: 0,
|
|
437
|
+
transform: "scale(0.5)",
|
|
438
|
+
filter: "blur(1px)",
|
|
439
|
+
}}
|
|
440
|
+
initial={{
|
|
441
|
+
opacity: 0,
|
|
442
|
+
transform: "scale(0.5)",
|
|
443
|
+
filter: "blur(1px)",
|
|
444
|
+
}}
|
|
445
|
+
key="copy"
|
|
446
|
+
transition={
|
|
447
|
+
shouldReduceMotion
|
|
448
|
+
? { duration: 0 }
|
|
449
|
+
: { duration: 0.2, ease: [0.23, 1, 0.32, 1] }
|
|
450
|
+
}
|
|
451
|
+
>
|
|
452
|
+
<IconCopy className="block" size={16} />
|
|
453
|
+
</motion.span>
|
|
454
|
+
)}
|
|
455
|
+
</AnimatePresence>
|
|
456
|
+
<AnimatePresence initial={false}>
|
|
457
|
+
{context.copied && (
|
|
458
|
+
<motion.span
|
|
459
|
+
animate={{
|
|
460
|
+
opacity: 1,
|
|
461
|
+
transform: "scale(1)",
|
|
462
|
+
filter: "blur(0px)",
|
|
463
|
+
}}
|
|
464
|
+
className="absolute inset-0 flex items-center justify-center"
|
|
465
|
+
exit={{
|
|
466
|
+
opacity: 0,
|
|
467
|
+
transform: "scale(0.5)",
|
|
468
|
+
filter: "blur(1px)",
|
|
469
|
+
}}
|
|
470
|
+
initial={{
|
|
471
|
+
opacity: 0,
|
|
472
|
+
transform: "scale(0.5)",
|
|
473
|
+
filter: "blur(1px)",
|
|
474
|
+
}}
|
|
475
|
+
key="check"
|
|
476
|
+
transition={
|
|
477
|
+
shouldReduceMotion
|
|
478
|
+
? { duration: 0 }
|
|
479
|
+
: { duration: 0.2, ease: [0.23, 1, 0.32, 1] }
|
|
480
|
+
}
|
|
481
|
+
>
|
|
482
|
+
<IconCheck className="block" size={16} />
|
|
483
|
+
</motion.span>
|
|
484
|
+
)}
|
|
485
|
+
</AnimatePresence>
|
|
486
|
+
</button>
|
|
487
|
+
);
|
|
488
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Command as CommandPrimitive } from "cmdk"
|
|
5
|
+
import { SearchIcon } from "lucide-react"
|
|
6
|
+
|
|
7
|
+
import { cn } from "@/lib/utils"
|
|
8
|
+
import {
|
|
9
|
+
Dialog,
|
|
10
|
+
DialogContent,
|
|
11
|
+
DialogDescription,
|
|
12
|
+
DialogHeader,
|
|
13
|
+
DialogTitle,
|
|
14
|
+
} from "@/components/ui/dialog"
|
|
15
|
+
|
|
16
|
+
function Command({
|
|
17
|
+
className,
|
|
18
|
+
...props
|
|
19
|
+
}: React.ComponentProps<typeof CommandPrimitive>) {
|
|
20
|
+
return (
|
|
21
|
+
<CommandPrimitive
|
|
22
|
+
data-slot="command"
|
|
23
|
+
className={cn(
|
|
24
|
+
"bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
|
|
25
|
+
className
|
|
26
|
+
)}
|
|
27
|
+
{...props}
|
|
28
|
+
/>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function CommandDialog({
|
|
33
|
+
title = "Command Palette",
|
|
34
|
+
description = "Search for a command to run...",
|
|
35
|
+
children,
|
|
36
|
+
className,
|
|
37
|
+
showCloseButton = true,
|
|
38
|
+
...props
|
|
39
|
+
}: React.ComponentProps<typeof Dialog> & {
|
|
40
|
+
title?: string
|
|
41
|
+
description?: string
|
|
42
|
+
className?: string
|
|
43
|
+
showCloseButton?: boolean
|
|
44
|
+
}) {
|
|
45
|
+
return (
|
|
46
|
+
<Dialog {...props}>
|
|
47
|
+
<DialogHeader className="sr-only">
|
|
48
|
+
<DialogTitle>{title}</DialogTitle>
|
|
49
|
+
<DialogDescription>{description}</DialogDescription>
|
|
50
|
+
</DialogHeader>
|
|
51
|
+
<DialogContent
|
|
52
|
+
className={cn("overflow-hidden p-0", className)}
|
|
53
|
+
showCloseButton={showCloseButton}
|
|
54
|
+
>
|
|
55
|
+
<Command className="[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
|
|
56
|
+
{children}
|
|
57
|
+
</Command>
|
|
58
|
+
</DialogContent>
|
|
59
|
+
</Dialog>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function CommandInput({
|
|
64
|
+
className,
|
|
65
|
+
...props
|
|
66
|
+
}: React.ComponentProps<typeof CommandPrimitive.Input>) {
|
|
67
|
+
return (
|
|
68
|
+
<div
|
|
69
|
+
data-slot="command-input-wrapper"
|
|
70
|
+
className="flex h-9 items-center gap-2 border-b px-3"
|
|
71
|
+
>
|
|
72
|
+
<SearchIcon className="size-4 shrink-0 opacity-50" />
|
|
73
|
+
<CommandPrimitive.Input
|
|
74
|
+
data-slot="command-input"
|
|
75
|
+
className={cn(
|
|
76
|
+
"placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
|
|
77
|
+
className
|
|
78
|
+
)}
|
|
79
|
+
{...props}
|
|
80
|
+
/>
|
|
81
|
+
</div>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function CommandList({
|
|
86
|
+
className,
|
|
87
|
+
...props
|
|
88
|
+
}: React.ComponentProps<typeof CommandPrimitive.List>) {
|
|
89
|
+
return (
|
|
90
|
+
<CommandPrimitive.List
|
|
91
|
+
data-slot="command-list"
|
|
92
|
+
className={cn(
|
|
93
|
+
"max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",
|
|
94
|
+
className
|
|
95
|
+
)}
|
|
96
|
+
{...props}
|
|
97
|
+
/>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function CommandEmpty({
|
|
102
|
+
...props
|
|
103
|
+
}: React.ComponentProps<typeof CommandPrimitive.Empty>) {
|
|
104
|
+
return (
|
|
105
|
+
<CommandPrimitive.Empty
|
|
106
|
+
data-slot="command-empty"
|
|
107
|
+
className="py-6 text-center text-sm"
|
|
108
|
+
{...props}
|
|
109
|
+
/>
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function CommandGroup({
|
|
114
|
+
className,
|
|
115
|
+
...props
|
|
116
|
+
}: React.ComponentProps<typeof CommandPrimitive.Group>) {
|
|
117
|
+
return (
|
|
118
|
+
<CommandPrimitive.Group
|
|
119
|
+
data-slot="command-group"
|
|
120
|
+
className={cn(
|
|
121
|
+
"text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
|
|
122
|
+
className
|
|
123
|
+
)}
|
|
124
|
+
{...props}
|
|
125
|
+
/>
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function CommandSeparator({
|
|
130
|
+
className,
|
|
131
|
+
...props
|
|
132
|
+
}: React.ComponentProps<typeof CommandPrimitive.Separator>) {
|
|
133
|
+
return (
|
|
134
|
+
<CommandPrimitive.Separator
|
|
135
|
+
data-slot="command-separator"
|
|
136
|
+
className={cn("bg-border -mx-1 h-px", className)}
|
|
137
|
+
{...props}
|
|
138
|
+
/>
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function CommandItem({
|
|
143
|
+
className,
|
|
144
|
+
...props
|
|
145
|
+
}: React.ComponentProps<typeof CommandPrimitive.Item>) {
|
|
146
|
+
return (
|
|
147
|
+
<CommandPrimitive.Item
|
|
148
|
+
data-slot="command-item"
|
|
149
|
+
className={cn(
|
|
150
|
+
"data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
151
|
+
className
|
|
152
|
+
)}
|
|
153
|
+
{...props}
|
|
154
|
+
/>
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function CommandShortcut({
|
|
159
|
+
className,
|
|
160
|
+
...props
|
|
161
|
+
}: React.ComponentProps<"span">) {
|
|
162
|
+
return (
|
|
163
|
+
<span
|
|
164
|
+
data-slot="command-shortcut"
|
|
165
|
+
className={cn(
|
|
166
|
+
"text-muted-foreground ml-auto text-xs tracking-widest",
|
|
167
|
+
className
|
|
168
|
+
)}
|
|
169
|
+
{...props}
|
|
170
|
+
/>
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export {
|
|
175
|
+
Command,
|
|
176
|
+
CommandDialog,
|
|
177
|
+
CommandInput,
|
|
178
|
+
CommandList,
|
|
179
|
+
CommandEmpty,
|
|
180
|
+
CommandGroup,
|
|
181
|
+
CommandItem,
|
|
182
|
+
CommandShortcut,
|
|
183
|
+
CommandSeparator,
|
|
184
|
+
}
|