mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
Moves apps/sim/components/emcn into a shared @sim/emcn package consumed directly by apps/sim and apps/docs. cn/keyboard/use-copy-to-clipboard move into the package; all imports become direct @sim/emcn (icons via @sim/emcn/icons, CSS via file path). ChipModal email validation is now prop-driven (quickValidateEmail stays in apps/sim, injected via validate). Docs drops its local chip/chip-dropdown/dropdown-menu mirrors and consumes @sim/emcn.
43 lines
1.0 KiB
TypeScript
43 lines
1.0 KiB
TypeScript
'use client'
|
|
|
|
import {
|
|
chipContentIconClass,
|
|
chipFilledFillTokens,
|
|
chipGeometryClass,
|
|
TRIGGER_BORDER_CLASS,
|
|
} from '@sim/emcn'
|
|
import { Search } from 'lucide-react'
|
|
import { cn } from '@/lib/utils'
|
|
|
|
export function SearchTrigger() {
|
|
const openSearchDialog = () => {
|
|
const event = new KeyboardEvent('keydown', {
|
|
key: 'k',
|
|
metaKey: true,
|
|
bubbles: true,
|
|
})
|
|
document.dispatchEvent(event)
|
|
}
|
|
|
|
return (
|
|
<button
|
|
type='button'
|
|
data-search-trigger
|
|
className={cn(
|
|
chipGeometryClass,
|
|
chipFilledFillTokens,
|
|
TRIGGER_BORDER_CLASS,
|
|
'flex w-[360px] cursor-pointer font-season text-[var(--text-muted)] transition-colors hover:bg-[var(--surface-active)]'
|
|
)}
|
|
onClick={openSearchDialog}
|
|
>
|
|
<Search className={chipContentIconClass} />
|
|
<span>Search…</span>
|
|
<kbd className='ml-auto flex items-center'>
|
|
<span className='text-[15px]'>⌘</span>
|
|
<span className='text-[12px]'>K</span>
|
|
</kbd>
|
|
</button>
|
|
)
|
|
}
|