mirror of
https://github.com/hanzoai/gui.git
synced 2026-10-25 02:31:41 +00:00
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]>
167 lines
5.0 KiB
TypeScript
167 lines
5.0 KiB
TypeScript
import { H3, H4, ListItem, Paragraph, Separator, View, XStack, YStack } from '@hanzo/gui'
|
|
|
|
import { Code } from '~/components/Code'
|
|
|
|
export type PropDef = {
|
|
name: string
|
|
required?: boolean
|
|
deprecated?: boolean
|
|
default?: string | boolean
|
|
type: string
|
|
description?: string
|
|
}
|
|
|
|
export function PropsTable({
|
|
title = 'Props',
|
|
data,
|
|
'aria-label': ariaLabel,
|
|
'aria-labelledby': ariaLabelledBy,
|
|
}: {
|
|
title?: string
|
|
data: PropDef[]
|
|
'aria-label'?: string
|
|
'aria-labelledby'?: string
|
|
}) {
|
|
const hasAriaLabel = !!(ariaLabel || ariaLabelledBy)
|
|
return (
|
|
<YStack
|
|
borderWidth={1}
|
|
borderColor="$borderColor"
|
|
flex={1}
|
|
flexBasis="auto"
|
|
aria-label={hasAriaLabel ? ariaLabel : 'Component Props'}
|
|
aria-labelledby={ariaLabelledBy}
|
|
my="$4"
|
|
rounded="$4"
|
|
overflow="hidden"
|
|
mx="$-4"
|
|
$sm={{
|
|
mx: 0,
|
|
}}
|
|
>
|
|
<XStack items="center" py="$2" px="$4" bg="$color1">
|
|
<H3 size="$3">{title}</H3>
|
|
</XStack>
|
|
{data.map(
|
|
({ name, type, required, deprecated, default: defaultValue, description }, i) => (
|
|
<ListItem
|
|
key={`${name}-${i}`}
|
|
p={0}
|
|
borderBottomWidth={1}
|
|
borderBottomColor="$color4"
|
|
py="$3"
|
|
pointerEvents="none"
|
|
bg={i % 2 === 1 ? '$color0025' : 'transparent'}
|
|
>
|
|
<YStack width="100%">
|
|
<XStack
|
|
position="relative"
|
|
py="$1"
|
|
px="$4"
|
|
$sm={{ flexDirection: 'column' }}
|
|
>
|
|
<XStack minW="30%" items="center" justify="space-between">
|
|
<H4
|
|
color="$color"
|
|
fontWeight="700"
|
|
fontFamily="$mono"
|
|
textTransform="none"
|
|
textDecorationLine={deprecated ? 'line-through' : 'none'}
|
|
size="$5"
|
|
width={280}
|
|
>
|
|
{name}
|
|
{required ? (
|
|
<Paragraph
|
|
render="span"
|
|
// @ts-ignore
|
|
fontSize="inherit"
|
|
opacity={0.5}
|
|
>
|
|
{' '}
|
|
<Paragraph render="span" fontWeight="300">
|
|
(required)
|
|
</Paragraph>
|
|
</Paragraph>
|
|
) : null}
|
|
</H4>
|
|
</XStack>
|
|
|
|
{!!type && (
|
|
<>
|
|
<Separator self="stretch" vertical mx="$3.5" my="$2" />
|
|
|
|
<XStack
|
|
flex={2}
|
|
flexBasis="auto"
|
|
minW="30%"
|
|
items="center"
|
|
$xs={{
|
|
flexDirection: 'column',
|
|
items: 'flex-start',
|
|
}}
|
|
>
|
|
<Paragraph
|
|
size="$3"
|
|
opacity={0.8}
|
|
fontFamily="$mono"
|
|
overflow="hidden"
|
|
ellipsis
|
|
mr="auto"
|
|
>
|
|
{type}
|
|
</Paragraph>
|
|
|
|
<XStack items="center">
|
|
{defaultValue ? (
|
|
<XStack items="center" gap="$1">
|
|
<Paragraph opacity={0.5} size="$2">
|
|
Default:
|
|
</Paragraph>
|
|
{/* @ts-ignore */}
|
|
<Code my="$-1" bg="$backgroundPress">
|
|
{defaultValue}
|
|
</Code>
|
|
</XStack>
|
|
) : null}
|
|
|
|
{Boolean(defaultValue) && (
|
|
<Separator self="stretch" vertical mx="$3.5" my="$2" />
|
|
)}
|
|
|
|
{deprecated ? (
|
|
<View
|
|
width="$8"
|
|
items="center"
|
|
theme="red"
|
|
bg="$red2"
|
|
borderWidth={1}
|
|
rounded="$2"
|
|
>
|
|
<Paragraph render="span" size="$2" fontWeight="300">
|
|
deprecated
|
|
</Paragraph>
|
|
</View>
|
|
) : null}
|
|
</XStack>
|
|
</XStack>
|
|
</>
|
|
)}
|
|
</XStack>
|
|
|
|
{!!description && (
|
|
<YStack py="$1" px="$4">
|
|
<Paragraph size="$3" opacity={0.65}>
|
|
{description}
|
|
</Paragraph>
|
|
</YStack>
|
|
)}
|
|
</YStack>
|
|
<Separator my={2} />
|
|
</ListItem>
|
|
)
|
|
)}
|
|
</YStack>
|
|
)
|
|
}
|