()
| 372 | } |
| 373 | |
| 374 | const Search: s.Component = () => { |
| 375 | const ctx = useAppCtx() |
| 376 | const structure = useStructure() |
| 377 | |
| 378 | const [value, setValue] = s.createSignal('') |
| 379 | |
| 380 | const handleChange = (v: string): void => { |
| 381 | setValue(v) |
| 382 | structure.search('') |
| 383 | } |
| 384 | |
| 385 | const edge_container_base = 'edge-container-base absolute inset-y-1 center-child' |
| 386 | const icon_base = 'w-3.5 h-3.5 color-disabled' |
| 387 | |
| 388 | return ( |
| 389 | <form |
| 390 | class={`${hover_background} group b-x b-solid b-panel-2 grow relative overflow-hidden`} |
| 391 | onSubmit={e => { |
| 392 | e.preventDefault() |
| 393 | structure.search(value()) |
| 394 | }} |
| 395 | onReset={() => handleChange('')} |
| 396 | > |
| 397 | <style>{ |
| 398 | /*css*/ ` |
| 399 | .edge-container-base { |
| 400 | height: calc(100% - ${theme.spacing[2]}) |
| 401 | } |
| 402 | ` |
| 403 | }</style> |
| 404 | <input |
| 405 | ref={input => { |
| 406 | if (ctx.options.useShortcuts) { |
| 407 | createShortcut(['/'], () => input.focus()) |
| 408 | createShortcut(['Escape'], () => { |
| 409 | if (document.activeElement === input) input.blur() |
| 410 | if (input.value) handleChange((input.value = '')) |
| 411 | }) |
| 412 | } |
| 413 | }} |
| 414 | class="w-full text-lg p-x-6 transition-padding leading-9 placeholder:text-disabled group-focus-within:p-l-2" |
| 415 | style={{ |
| 416 | height: theme.spacing.header_height, |
| 417 | }} |
| 418 | type="text" |
| 419 | placeholder="Search" |
| 420 | onInput={e => handleChange(e.currentTarget.value)} |
| 421 | onPaste={e => handleChange(e.currentTarget.value)} |
| 422 | /> |
| 423 | <div |
| 424 | class={`${edge_container_base} pointer-events-none left-0 p-l-1.5 transition-transform group-focus-within:-translate-x-full`} |
| 425 | > |
| 426 | <ui.icon.Search class={icon_base} /> |
| 427 | </div> |
| 428 | {value() && ( |
| 429 | <button |
| 430 | class={`${hover_background} ${edge_container_base} right-1 p-x-.5 rounded`} |
| 431 | type="reset" |
nothing calls this directly
no test coverage detected
searching dependent graphs…