Files
agency/.pnpm-store/v3/files/be/4ec35bf5c82c6827dd48080c3b924517f880818982405bafc720bfb4ccdbb5087f65c5369ad10a77e0838bd2ead608b672e288b1a495b421cab330ed0a0bd1
hanzo-agent 5af6960b87 run project
Run: sess_f37640604ae254cb4d11dc6217f7b721
2026-09-30 00:04:56 +00:00

40 lines
2.0 KiB
Plaintext

import React from 'react'
/** Native-select build of the @hanzo/ui Select — same chrome, no portal. */
export function Select({ options = [], value, onChange, placeholder, style, children, ...rest }) {
const [focus, setFocus] = React.useState(false)
const [hover, setHover] = React.useState(false)
return (
<span style={{position:'relative',display:'inline-flex',alignItems:'center',width:'100%'}}>
{/* Same chrome as Input and Textarea — radius, hover lift, focus halo. */}
<select
value={value}
onChange={(e)=>onChange && onChange(e.target.value)}
onFocus={()=>setFocus(true)} onBlur={()=>setFocus(false)}
onMouseEnter={()=>setHover(true)} onMouseLeave={()=>setHover(false)}
style={{
appearance:'none',width:'100%',height:36,padding:'0 32px 0 12px',
fontFamily:'var(--font-sans)',fontSize:'var(--text-control)',color:'var(--foreground)',
background: hover && !focus ? 'var(--surface-3)' : 'var(--surface-2)',
border:'1px solid ' + (focus ? 'var(--border-focus)' : 'var(--border-control)'),
borderRadius:'var(--radius-md)',cursor:'pointer',
outline:'none',
boxShadow: focus ? 'var(--ring-focus)' : 'none',
transition:'border-color var(--duration-fast) var(--ease-out), background-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out)',
...style,
}}
{...rest}
>
{placeholder && <option value="">{placeholder}</option>}
{options.map((o) => {
const v = typeof o === 'string' ? o : o.value
const l = typeof o === 'string' ? o : o.label
return <option key={v} value={v}>{l}</option>
})}
{children}
</select>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="var(--text-helper)" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" style={{position:'absolute',right:10,pointerEvents:'none'}}><polyline points="6 9 12 15 18 9" /></svg>
</span>
)
}