/** * Small building blocks of the builder screens: one look for buttons, inputs, notices, empty * and loading states. Colours, spacing and radii come from the tokens in builder.css. */ import React, { useEffect, useId, useRef } from 'react'; import type { ReactNode } from 'react'; import { proUrl } from '../edition'; import { __ } from './i18n'; type ButtonProps = React.ButtonHTMLAttributes & { variant?: 'primary' | 'secondary' | 'ghost' | 'danger'; size?: 'sm' | 'md'; icon?: ReactNode; }; export function Button( { variant = 'secondary', size = 'md', icon, className = '', children, ...rest }: ButtonProps ) { return ( ); } export function Field( { label, hint, children }: { label: string; hint?: string; children: ( id: string ) => ReactNode } ) { const id = useId(); return (
{ children( id ) } { hint ?

{ hint }

: null }
); } export function TextInput( { label, value, onChange, hint, multiline = false, placeholder, type = 'text' }: { label: string; value: string; onChange: ( value: string ) => void; hint?: string; multiline?: boolean; placeholder?: string; type?: string } ) { return ( { ( id ) => multiline ? (