Files
zeekayandHanzo Dev 751ef5c778 rename the framework to @hanzo/gui and the loader to @hanzogui/loader
Both old names are owned by a different npm account (artemis-prime), so
publishing them returns 403 — which is how this surfaced: the 8.0.0 run
shipped @hanzogui/logo and @hanzogui/demos depending on [email protected], a
version that cannot be published and therefore does not exist. Those two
were uninstallable.

@hanzo/gui and @hanzogui/* are ours, so the framework now carries the name
it is imported by everywhere downstream, and the loader moves under the
scope we control.

The rewrite is limited to package references. `DEBUG?.startsWith('hanzogui')`
is a log-namespace filter and join(dir, 'hanzogui') is a path — rewriting
either would change behaviour, so both are untouched.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-30 20:23:18 -07:00

125 lines
3.0 KiB
TypeScript

import { LinearGradient } from '@hanzogui/linear-gradient'
import { ChevronDown, ChevronUp } from '@hanzogui/lucide-icons-2'
import type { SelectItemProps, SelectProps, SelectTriggerProps } from '@hanzo/gui'
import { Select as GuiSelect, YStack, useProps, withStaticProperties } from '@hanzo/gui'
export const SelectItem = ({ children, index, ...props }: SelectItemProps) => {
return (
<GuiSelect.Item index={index + 1} borderColor="transparent" {...props}>
<GuiSelect.ItemText>{children}</GuiSelect.ItemText>
</GuiSelect.Item>
)
}
const SelectComponent = (
propsIn: SelectProps & SelectTriggerProps & { placeholder?: string }
) => {
const {
placeholder,
id,
value,
defaultValue,
onValueChange,
open,
defaultOpen,
onOpenChange,
dir,
name,
autoComplete,
size,
children,
onActiveChange,
renderValue,
variant,
...selectTriggerProps
} = useProps(propsIn)
const selectProps = {
id,
value,
defaultValue,
onActiveChange,
onValueChange,
open,
defaultOpen,
onOpenChange,
dir,
name,
autoComplete,
size,
renderValue,
} as SelectProps
return (
<GuiSelect {...selectProps} zIndex={1_000_000}>
<GuiSelect.Trigger iconAfter={ChevronDown} {...selectTriggerProps}>
<GuiSelect.Value placeholder={placeholder} />
</GuiSelect.Trigger>
<GuiSelect.Content>
<GuiSelect.ScrollUpButton
items="center"
justify="center"
position="relative"
width="100%"
height="$3"
>
<YStack z={10}>
<ChevronUp size={20} />
</YStack>
<LinearGradient
start={[0, 0]}
end={[0, 1]}
fullscreen
colors={['$background', '$background0']}
rounded="$4"
/>
</GuiSelect.ScrollUpButton>
<GuiSelect.Viewport
opacity={1}
y={0}
enterStyle={{
opacity: 0,
scale: 0.98,
}}
exitStyle={{
opacity: 0,
scale: 0.98,
}}
bg="transparent"
className="blur-medium"
borderWidth={1}
borderColor="$borderColor"
>
{children}
</GuiSelect.Viewport>
<GuiSelect.ScrollDownButton
items="center"
justify="center"
position="relative"
width="100%"
height="$3"
>
<YStack z={10}>
<ChevronDown size={20} />
</YStack>
<LinearGradient
start={[0, 0]}
end={[0, 1]}
fullscreen
colors={['$background0', '$background']}
rounded="$4"
/>
</GuiSelect.ScrollDownButton>
</GuiSelect.Content>
</GuiSelect>
)
}
export const Select = withStaticProperties(SelectComponent, {
Item: SelectItem,
ItemText: GuiSelect.ItemText,
Group: GuiSelect.Group,
Label: GuiSelect.Label,
})