import { define } from 'forge' import { theme } from './theme' import { Section } from './section' import { H2 } from './text' import { VStack, HStack } from './stack' export const Input = define('Input', { parts: { Wrapper: { display: 'flex', flexDirection: 'column', gap: theme('spacing-1'), flex: 1, minWidth: 0, }, Label: { base: 'label', fontSize: theme('fontSize-sm'), fontWeight: 500, color: theme('colors-fg'), }, Field: { base: 'input', height: 40, padding: `${theme('spacing-2')} ${theme('spacing-3')}`, borderRadius: theme('radius-md'), border: `1px solid ${theme('colors-border')}`, background: theme('colors-bg'), fontSize: theme('fontSize-sm'), outline: 'none', flex: 1, states: { ':focus': { borderColor: theme('colors-borderActive'), }, ':disabled': { opacity: 0.5, cursor: 'not-allowed', }, }, }, }, variants: { labelPosition: { above: { parts: { Wrapper: { flexDirection: 'column', gap: theme('spacing-1'), }, }, }, left: { parts: { Wrapper: { flexDirection: 'row', alignItems: 'center', gap: theme('spacing-1'), }, }, }, right: { parts: { Wrapper: { flexDirection: 'row-reverse', alignItems: 'center', gap: theme('spacing-1'), }, }, }, }, }, render({ props, parts: { Root, Wrapper, Label, Field } }) { const { children, labelPosition = 'above', ...inputProps } = props if (!children) { return } return ( ) }, }) export type InputProps = Parameters[0] export const Test = () => { return (
{/* Basic inputs */}

Basic Inputs

{/* Custom styling */}

Custom Styling

{/* With values */}

With Values

{/* Disabled state */}

Disabled State

{/* Label above */}

Label Above

Name Email Password
{/* Label to the left */}

Label Left

Name Email Password
{/* Label to the right */}

Label Right

Name Email Password
{/* Horizontal layout */}

Horizontal Layout

First Last Age
) }