{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "text-input",
  "type": "registry:ui",
  "title": "TextInput",
  "description": "A single-line text field for short free-form input (search, email, amounts, URLs).",
  "dependencies": [
    "@radix-ui/react-compose-refs@^1.1.3",
    "@remixicon/react@^4.9.0",
    "class-variance-authority@^0.7.1"
  ],
  "registryDependencies": [
    "https://wideset.co/r/button.json",
    "https://wideset.co/r/icon-button.json",
    "https://wideset.co/r/motion.json",
    "https://wideset.co/r/styles.json",
    "https://wideset.co/r/utils.json"
  ],
  "files": [
    {
      "path": "src/components/text-input/TextInput.context.ts",
      "type": "registry:ui",
      "target": "components/ui/wideset/text-input/TextInput.context.ts",
      "content": "'use client';\n\nimport { createContext, useContext } from 'react';\n\nimport type { TextInputContextValue } from './TextInput.types';\n\nexport const TextInputContext = createContext<TextInputContextValue | undefined>(undefined);\n\nexport const useTextInputContext = () => {\n  const context = useContext(TextInputContext);\n\n  if (context === undefined) {\n    throw new Error('useTextInputContext must be used within a <TextInput>');\n  }\n\n  return context;\n};\n"
    },
    {
      "path": "src/components/text-input/TextInput.logic.ts",
      "type": "registry:ui",
      "target": "components/ui/wideset/text-input/TextInput.logic.ts",
      "content": "/**\n * Sets an input's value the way typing does: through the native setter, then a\n * bubbling `input` event. React's change tracking sees a real edit, so `onChange`\n * fires with the element as `event.target`, and native listeners fire too.\n */\nexport const setNativeInputValue = (input: HTMLInputElement, value: string) => {\n  const view = input.ownerDocument.defaultView ?? window;\n  const setValue = Object.getOwnPropertyDescriptor(view.HTMLInputElement.prototype, 'value')?.set;\n  setValue?.call(input, value);\n  input.dispatchEvent(new view.Event('input', { bubbles: true }));\n};\n"
    },
    {
      "path": "src/components/text-input/TextInput.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/text-input/TextInput.tsx",
      "content": "'use client';\n\nimport React, { useState } from 'react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { useDefaultMotion } from '@/lib/wideset/motion/MotionProvider';\nimport { TextInputContext } from './TextInput.context';\nimport type { TextInputProps, TextInputWithSubComponents } from './TextInput.types';\nimport { textInputMotionVariants, textInputVariants } from './TextInput.variants';\nimport { TextInputButton } from './TextInputButton';\nimport { TextInputClearButton } from './TextInputClearButton';\nimport { TextInputIcon } from './TextInputIcon';\nimport { TextInputIconButton } from './TextInputIconButton';\nimport { TextInputInput } from './TextInputInput';\nimport { TextInputPrefix } from './TextInputPrefix';\nimport { TextInputSuffix } from './TextInputSuffix';\n\nconst TextInput = React.forwardRef<HTMLInputElement, TextInputProps>(\n  (\n    {\n      size = 'md',\n      variant,\n      disabled = false,\n      children,\n      className,\n      preset,\n      value,\n      onChange,\n      defaultMotion,\n      ...rest\n    },\n    ref,\n  ) => {\n    // The other props and the ref go to the `<input>`, composed or not; the part marker\n    // belongs to the root, and a composing component (Search, ComboBox) passes its own.\n    const { 'data-slot': dataSlot = 'text-input', ...props } = rest as typeof rest & {\n      'data-slot'?: string;\n    };\n    const inputRef = React.useRef<HTMLInputElement>(null);\n    const isControlled = value !== undefined;\n    const motion = useDefaultMotion(defaultMotion);\n\n    const [internalValue, setInternalValue] = useState('');\n    const currentValue = isControlled ? String(value ?? '') : internalValue;\n\n    /** The single write path — keeps the mirror in sync, then reports outward. */\n    const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n      if (!isControlled) setInternalValue(event.target.value);\n      onChange?.(event);\n    };\n\n    return (\n      <TextInputContext.Provider\n        value={{\n          size,\n          variant,\n          disabled,\n          inputRef,\n          currentValue,\n          handleChange,\n          motion,\n          inputProps: props,\n          forwardedInputRef: ref,\n        }}\n      >\n        <div\n          data-slot={dataSlot}\n          className={cn(\n            textInputVariants({ size, variant, preset }),\n            textInputMotionVariants({ enabled: motion }),\n            className,\n          )}\n          data-disabled={disabled}\n          data-danger={variant === 'danger'}\n        >\n          {children || <TextInputInput />}\n        </div>\n      </TextInputContext.Provider>\n    );\n  },\n) as TextInputWithSubComponents;\n\nTextInput.displayName = 'TextInput';\n\nTextInput.Prefix = TextInputPrefix;\nTextInput.Suffix = TextInputSuffix;\nTextInput.Input = TextInputInput;\nTextInput.IconButton = TextInputIconButton;\nTextInput.Button = TextInputButton;\nTextInput.Icon = TextInputIcon;\nTextInput.ClearButton = TextInputClearButton;\n\nexport { TextInput };\n"
    },
    {
      "path": "src/components/text-input/TextInput.types.ts",
      "type": "registry:ui",
      "target": "components/ui/wideset/text-input/TextInput.types.ts",
      "content": "import type { RemixiconComponentType } from '@remixicon/react';\nimport type { VariantProps } from 'class-variance-authority';\nimport type {\n  ComponentProps,\n  ForwardRefExoticComponent,\n  InputHTMLAttributes,\n  MouseEventHandler,\n  PropsWithoutRef,\n  ReactNode,\n  Ref,\n  RefAttributes,\n  RefObject,\n} from 'react';\n\nimport type { MotionProps } from '@/lib/wideset/motion/Motion.types';\nimport type { Button } from '../button/Button';\nimport type { IconButton } from '../button/IconButton';\nimport type { textInputVariants } from './TextInput.variants';\nimport type { TextInputPrefix } from './TextInputPrefix';\nimport type { TextInputSuffix } from './TextInputSuffix';\n\nexport type TextInputContextValue = {\n  size: VariantProps<typeof textInputVariants>['size'];\n  variant: VariantProps<typeof textInputVariants>['variant'];\n  inputRef: RefObject<HTMLInputElement | null>;\n  disabled?: boolean;\n  /** Current input value — the root's `value` when controlled, its mirror otherwise. */\n  currentValue: string;\n  /**\n   * The input's change handler: syncs the uncontrolled mirror, then calls the\n   * root's `onChange`. The clear button reaches it through a real `input` event\n   * on the element, never by calling it directly.\n   */\n  handleChange: (event: React.ChangeEvent<HTMLInputElement>) => void;\n  motion: boolean;\n  /** Input props given to the root; `TextInput.Input` spreads them under its own. */\n  inputProps?: TextInputInputProps;\n  /** The ref given to the root; `TextInput.Input` attaches it beside `inputRef`. */\n  forwardedInputRef?: Ref<HTMLInputElement>;\n};\n\n/**\n * `defaultValue` is omitted: without `value` the field keeps its own value,\n * starting empty. To start with a value, control it with `value` + `onChange`.\n */\nexport type TextInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'defaultValue'> &\n  MotionProps &\n  VariantProps<typeof textInputVariants> & {\n    /** Layout/context overrides for the outer container. Visual styling goes through `variant`, `preset` and `size`. */\n    className?: string;\n    /**\n     * Compound subcomponents (`TextInput.Prefix`, `TextInput.Input`, `TextInput.Suffix`, …). When omitted, a default `<input>` is rendered.\n     * Input props and the `ref` given to the root reach `TextInput.Input` too; a prop set on `TextInput.Input` wins. Use one `TextInput.Input` per field.\n     */\n    children?: ReactNode;\n  };\n\nexport type TextInputWithSubComponents = ForwardRefExoticComponent<\n  PropsWithoutRef<TextInputProps> & RefAttributes<HTMLInputElement>\n> & {\n  Prefix: typeof TextInputPrefix;\n  Suffix: typeof TextInputSuffix;\n  Input: typeof import('./TextInputInput').TextInputInput;\n  IconButton: typeof import('./TextInputIconButton').TextInputIconButton;\n  Button: typeof import('./TextInputButton').TextInputButton;\n  Icon: typeof import('./TextInputIcon').TextInputIcon;\n  ClearButton: typeof import('./TextInputClearButton').TextInputClearButton;\n};\n\n/** The native input inside a composed field. */\nexport type TextInputInputProps = Omit<\n  InputHTMLAttributes<HTMLInputElement>,\n  'size' | 'defaultValue'\n> & {\n  /** Additional CSS classes merged with the rendered element. */\n  className?: string;\n};\n\n/** An icon action within the input. */\nexport type TextInputIconButtonProps = ComponentProps<typeof IconButton>;\n\n/** A text action within the input. */\nexport type TextInputButtonProps = ComponentProps<typeof Button>;\n\n/** An icon rendered within `TextInput`. */\nexport type TextInputIconProps = {\n  /** The icon to render inside a `TextInput.Prefix` / `TextInput.Suffix`. Sized automatically from the input's `size`. */\n  icon: RemixiconComponentType;\n  /** Layout/context overrides for the icon. */\n  className?: string;\n};\n\n/** The action clearing the input value. */\nexport type TextInputClearButtonProps = Omit<\n  ComponentProps<typeof IconButton>,\n  'icon' | 'children' | 'asChild' | 'preset' | 'variant' | 'size' | 'disabled'\n> & {\n  /** Icon rendered inside the clear button. Defaults to `RiCloseLine`. */\n  icon?: RemixiconComponentType;\n  /** Accessible label. Defaults to `'Clear'`. */\n  'aria-label'?: string;\n  /**\n   * Runs before the field is cleared. Call `event.preventDefault()` to keep the value, for\n   * example while a save is in progress.\n   */\n  onClick?: MouseEventHandler<HTMLButtonElement>;\n  /**\n   * Called after the value is cleared and the input's `onChange` has run with an empty value,\n   * in both controlled and uncontrolled modes. Use it for side effects such as resetting\n   * filters; validate in `onChange`, which also sees a value deleted by hand.\n   */\n  onClear?: () => void;\n  /** Layout/context overrides for the button. */\n  className?: string;\n  /** Layout/context overrides for the icon. */\n  iconClassName?: string;\n};\n"
    },
    {
      "path": "src/components/text-input/TextInput.variants.ts",
      "type": "registry:ui",
      "target": "components/ui/wideset/text-input/TextInput.variants.ts",
      "content": "import { cva } from 'class-variance-authority';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { fieldFocusMotion, fieldShakeWithinMotion } from '@/lib/wideset/motion/recipes';\n\nexport const textInputVariants = cva(\n  cn(\n    'text-ws-static-strong relative flex w-full max-w-full items-center overflow-hidden',\n    'data-[disabled=true]:text-ws-static-subtle',\n  ),\n  {\n    variants: {\n      preset: {\n        border: cn(\n          'shadow-ws-forms-base bg-ws-static-highlight-base border-ws-dynamic-secondary-default border',\n          'data-[disabled=true]:border-ws-dynamic-secondary-disabled data-[disabled=true]:bg-ws-static-alpha-subtle',\n          'data-[disabled=true]:hover:not-focus-within:border-ws-dynamic-secondary-disabled',\n          'data-[disabled=true]:active:border-ws-dynamic-secondary-disabled',\n          'data-[disabled=true]:focus-within:not-active:border-ws-dynamic-secondary-disabled',\n        ),\n        ghost: cn('border border-transparent bg-transparent', ''),\n      },\n      variant: {\n        /*\n         * `:active` propagates from any descendant, so pressing an affix button\n         * (clear, reveal, …) would otherwise put the whole field in its pressed\n         * state and drop the focus ring for the duration of the press.\n         * `not-has-[button:active]` keeps \"pressed\" meaning the field itself,\n         * and the paired `has-[button:active]` rule holds the focus ring.\n         */\n        primary: cn(\n          'hover:not-focus-within:not-data-[disabled=true]:border-ws-dynamic-secondary-hover',\n          'active:not-has-[button:active]:not-data-[disabled=true]:border-ws-dynamic-secondary-pressed',\n          'focus-within:not-active:border-ws-dynamic-primary-strong-default focus-within:not-active:shadow-ws-forms-active',\n          'focus-within:has-[button:active]:border-ws-dynamic-primary-strong-default focus-within:has-[button:active]:shadow-ws-forms-active',\n        ),\n        danger: cn(\n          'hover:not-focus-within:not-data-[disabled=true]:border-ws-dynamic-danger-strong-hover',\n          'active:not-has-[button:active]:not-data-[disabled=true]:border-ws-dynamic-danger-strong-pressed',\n          'focus-within:not-active:border-ws-dynamic-danger-strong-default focus-within:not-active:shadow-ws-forms-active-danger',\n          'focus-within:has-[button:active]:border-ws-dynamic-danger-strong-default focus-within:has-[button:active]:shadow-ws-forms-active-danger',\n        ),\n      },\n      size: {\n        sm: 'typography-label-sm h-ws-forms-sm rounded-ws-control-lg',\n        md: 'typography-label-sm h-ws-forms-md rounded-ws-control-lg',\n        lg: 'typography-label-md h-ws-forms-lg rounded-ws-control-xl',\n      },\n    },\n    compoundVariants: [\n      {\n        preset: 'border',\n        variant: 'danger',\n        className: 'border-ws-dynamic-danger-strong-default',\n      },\n      {\n        preset: 'ghost',\n        variant: 'danger',\n        className: 'not-data-[disabled=true]:border-ws-dynamic-danger-strong-default',\n      },\n    ],\n    defaultVariants: {\n      preset: 'border',\n      variant: 'primary',\n      size: 'md',\n    },\n  },\n);\n\nexport const textInputMotionVariants = cva('', {\n  variants: {\n    enabled: { true: cn(fieldFocusMotion, fieldShakeWithinMotion), false: '' },\n  },\n  defaultVariants: { enabled: true },\n});\n\nexport const textInputInfoVariants = cva(\n  cn(\n    'text-ws-static-subtle border-ws-static-base flex h-full shrink-0 items-center justify-center',\n    'data-[disabled=true]:border-ws-static-base data-[disabled=true]:opacity-50',\n    // An affix whose only child renders nothing (a clear button on an empty\n    // field) must not keep reserving its inset — it would eat input width and\n    // leave a dead click-to-focus strip.\n    'empty:hidden',\n  ),\n  {\n    variants: {\n      size: {\n        sm: '',\n        md: '',\n        lg: '',\n      },\n      position: {\n        prefix: '',\n        suffix: '',\n      },\n      inner: {\n        true: '',\n        false: '',\n      },\n      /**\n       * Figma sets the affix inset from the *kind* of content, not just the size:\n       * `Type=Text` is roomier than an icon, and an icon button — which carries its\n       * own internal padding — is tighter still. Figma's `Avatar`, `Entity` and\n       * `Icon` types all resolve to the same numbers, so they share `icon` here.\n       */\n      content: {\n        text: '',\n        icon: '',\n        iconButton: '',\n      },\n    },\n    compoundVariants: [\n      {\n        position: 'prefix',\n        inner: false,\n        className: 'border-r',\n      },\n      {\n        position: 'suffix',\n        inner: false,\n        className: 'border-l',\n      },\n\n      // ── Contained (Figma `Contained=True`) — symmetric inset ──────────────\n      // A boxed affix is at least as wide as the control is tall, so short\n      // content (\"$\", an icon) sits in a 1:1 square; longer text keeps the px\n      // inset and grows past it.\n      { inner: false, size: 'sm', className: 'min-w-ws-forms-sm' },\n      { inner: false, size: 'md', className: 'min-w-ws-forms-md' },\n      { inner: false, size: 'lg', className: 'min-w-ws-forms-lg' },\n      { inner: false, content: 'text', size: ['sm', 'md', 'lg'], className: 'px-ws-7' },\n      { inner: false, content: 'icon', size: 'sm', className: 'px-ws-5' },\n      { inner: false, content: 'icon', size: ['md', 'lg'], className: 'px-ws-7' },\n      { inner: false, content: 'iconButton', size: ['sm', 'md'], className: 'px-ws-3' },\n      { inner: false, content: 'iconButton', size: 'lg', className: 'px-ws-5' },\n\n      // ── Inner prefix (Figma `Contained=False`) — leading inset only ───────\n      {\n        inner: true,\n        position: 'prefix',\n        content: 'text',\n        size: ['sm', 'md', 'lg'],\n        className: 'pl-ws-7',\n      },\n      { inner: true, position: 'prefix', content: 'icon', size: 'sm', className: 'pl-ws-5' },\n      {\n        inner: true,\n        position: 'prefix',\n        content: 'icon',\n        size: ['md', 'lg'],\n        className: 'pl-ws-7',\n      },\n      {\n        inner: true,\n        position: 'prefix',\n        content: 'iconButton',\n        size: ['sm', 'md'],\n        className: 'pl-ws-3',\n      },\n      { inner: true, position: 'prefix', content: 'iconButton', size: 'lg', className: 'pl-ws-5' },\n\n      // ── Inner suffix — trailing inset only. Figma collapses every content\n      //    type to Gap/5 at Large, while the matching prefix stays Gap/7. ────\n      {\n        inner: true,\n        position: 'suffix',\n        content: 'text',\n        size: ['sm', 'md'],\n        className: 'pr-ws-7',\n      },\n      { inner: true, position: 'suffix', content: 'icon', size: 'sm', className: 'pr-ws-5' },\n      { inner: true, position: 'suffix', content: 'icon', size: 'md', className: 'pr-ws-7' },\n      {\n        inner: true,\n        position: 'suffix',\n        content: 'iconButton',\n        size: ['sm', 'md'],\n        className: 'pr-ws-3',\n      },\n      {\n        inner: true,\n        position: 'suffix',\n        content: ['text', 'icon', 'iconButton'],\n        size: 'lg',\n        className: 'pr-ws-5',\n      },\n    ],\n    defaultVariants: {\n      size: 'md',\n      position: 'prefix',\n      inner: false,\n      content: 'icon',\n    },\n  },\n);\n\nexport const textInputClearButtonVariants = cva('shrink-0 p-0', {\n  variants: {\n    size: {\n      sm: 'size-ws-11',\n      md: 'size-ws-13',\n      lg: 'size-ws-14',\n    },\n  },\n  defaultVariants: {\n    size: 'md',\n  },\n});\n\nexport const textInputClearButtonIconVariants = cva('w-auto p-0', {\n  variants: {\n    size: {\n      sm: 'size-ws-9',\n      md: 'size-ws-9',\n      lg: 'size-ws-11',\n    },\n  },\n  defaultVariants: {\n    size: 'md',\n  },\n});\n\nexport const textInputInputVariants = cva(\n  cn(\n    'placeholder:text-ws-static-subtle h-full w-full appearance-none bg-transparent text-inherit outline-hidden',\n    'data-[disabled=true]:opacity-75 data-[disabled=true]:placeholder-shown:opacity-50',\n    // `type=\"search\"` is kept for semantics (screen readers announce a search\n    // field, Escape clears it), but WebKit paints its own cancel button on top\n    // of ours as soon as the input has a value. `appearance-none` on the input\n    // itself does not remove it — the pseudo-element has to be reset directly.\n    '[&::-webkit-search-cancel-button]:appearance-none [&::-webkit-search-decoration]:appearance-none',\n  ),\n  {\n    variants: {\n      size: {\n        sm: 'px-ws-7',\n        md: 'px-ws-9',\n        lg: 'px-ws-9',\n      },\n    },\n  },\n);\n"
    },
    {
      "path": "src/components/text-input/TextInputButton.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/text-input/TextInputButton.tsx",
      "content": "'use client';\n\nimport { cn } from '@/lib/wideset/utils';\n\nimport { Button } from '../button/Button';\nimport { useTextInputContext } from './TextInput.context';\nimport type { TextInputButtonProps } from './TextInput.types';\n\n/** Negative inline margin that cancels each Button size's own `px-*`. */\nconst BUTTON_PADDING_RESET = { sm: '-mx-ws-6', md: '-mx-ws-7', lg: '-mx-ws-9' } as const;\n\nexport const TextInputButton = ({\n  onClick,\n  className,\n  defaultMotion,\n  ...props\n}: TextInputButtonProps) => {\n  const { size, motion } = useTextInputContext();\n\n  return (\n    <Button\n      data-slot=\"text-input-button\"\n      preset=\"ghost\"\n      variant=\"secondary\"\n      onClick={(event) => {\n        event.stopPropagation();\n        onClick?.(event);\n      }}\n      // Figma's `Type=Text` affix is bare text inset by the affix padding alone\n      // (Gap/7 at every size). A ghost Button brings its own px, so cancel it\n      // exactly and let the affix own the visible inset.\n      className={cn(BUTTON_PADDING_RESET[size ?? 'md'], className)}\n      defaultMotion={defaultMotion ?? motion}\n      {...props}\n      size={size}\n    />\n  );\n};\n\nTextInputButton.displayName = 'TextInput.Button';\n"
    },
    {
      "path": "src/components/text-input/TextInputClearButton.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/text-input/TextInputClearButton.tsx",
      "content": "'use client';\n\nimport { RiCloseLine } from '@remixicon/react';\nimport React from 'react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { IconButton } from '../button/IconButton';\nimport { useTextInputContext } from './TextInput.context';\nimport { setNativeInputValue } from './TextInput.logic';\nimport type { TextInputClearButtonProps } from './TextInput.types';\nimport {\n  textInputClearButtonIconVariants,\n  textInputClearButtonVariants,\n} from './TextInput.variants';\n\nexport const TextInputClearButton = React.forwardRef<HTMLButtonElement, TextInputClearButtonProps>(\n  (\n    {\n      icon = RiCloseLine,\n      'aria-label': ariaLabel = 'Clear',\n      onClear,\n      onClick,\n      onMouseDown,\n      className,\n      iconClassName,\n      defaultMotion,\n      ...props\n    },\n    ref,\n  ) => {\n    const { size, disabled, currentValue, inputRef, inputProps, motion } = useTextInputContext();\n\n    if (!currentValue || disabled || inputProps?.readOnly) return null;\n\n    return (\n      <IconButton\n        ref={ref}\n        data-slot=\"text-input-clear-button\"\n        aria-label={ariaLabel}\n        icon={icon}\n        preset=\"ghost\"\n        variant=\"secondary\"\n        iconClassName={cn(textInputClearButtonIconVariants({ size }), iconClassName)}\n        className={cn(textInputClearButtonVariants({ size }), className)}\n        defaultMotion={defaultMotion ?? motion}\n        {...props}\n        // Mouse-down moves focus to the button before the click lands, so the\n        // field visibly loses its focus ring for a frame. Keep focus where it is.\n        onMouseDown={(event) => {\n          onMouseDown?.(event);\n          event.preventDefault();\n        }}\n        onClick={(event) => {\n          onClick?.(event);\n          if (event.defaultPrevented) return;\n          event.preventDefault();\n          event.stopPropagation();\n          const input = inputRef.current;\n          if (!input) return;\n          // A real `input` event, so every `onChange` on the input (and form\n          // libraries reading `event.target.name`) sees the clear as an edit.\n          setNativeInputValue(input, '');\n          input.focus();\n          onClear?.();\n        }}\n      />\n    );\n  },\n);\n\nTextInputClearButton.displayName = 'TextInput.ClearButton';\n"
    },
    {
      "path": "src/components/text-input/TextInputIcon.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/text-input/TextInputIcon.tsx",
      "content": "'use client';\n\nimport { cn } from '@/lib/wideset/utils';\n\nimport type { TextInputIconProps } from './TextInput.types';\n\n// Figma binds the in-field icon to Size/9 (16px) at every control size — see\n// Prefix `Type=Icon` and the Search prefix entity. It does not scale with `size`.\n// `data-slot` is not a public prop: a composing component (`ComboBox.Icon`) passes its own.\nexport const TextInputIcon = ({\n  icon: Icon,\n  className,\n  'data-slot': dataSlot = 'text-input-icon',\n}: TextInputIconProps & { 'data-slot'?: string }) => (\n  <Icon\n    data-slot={dataSlot}\n    aria-hidden=\"true\"\n    focusable=\"false\"\n    className={cn('size-ws-9', className)}\n  />\n);\n\nTextInputIcon.displayName = 'TextInput.Icon';\n"
    },
    {
      "path": "src/components/text-input/TextInputIconButton.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/text-input/TextInputIconButton.tsx",
      "content": "'use client';\n\nimport { cn } from '@/lib/wideset/utils';\n\nimport { IconButton } from '../button/IconButton';\nimport { useTextInputContext } from './TextInput.context';\nimport type { TextInputIconButtonProps } from './TextInput.types';\n\n/**\n * Figma sizes an in-field icon button one step below the field it sits in:\n * `Components/Forms/XSmall` (24) inside a Small field, `Forms/Small` (32) inside\n * both Medium and Large. That mapping also lands the radius Figma asks for —\n * `Control/md` at xs, `Control/lg` at sm.\n */\nconst ICON_BUTTON_SIZE = { sm: 'xs', md: 'sm', lg: 'sm' } as const;\n\nexport const TextInputIconButton = ({\n  onClick,\n  className,\n  defaultMotion,\n  ...props\n}: TextInputIconButtonProps) => {\n  const { size, motion } = useTextInputContext();\n\n  return (\n    <IconButton\n      data-slot=\"text-input-icon-button\"\n      preset=\"ghost\"\n      variant=\"secondary\"\n      onClick={(event) => {\n        event.stopPropagation();\n        onClick?.(event);\n      }}\n      className={cn(className)}\n      defaultMotion={defaultMotion ?? motion}\n      {...props}\n      size={ICON_BUTTON_SIZE[size ?? 'md']}\n    />\n  );\n};\n\nTextInputIconButton.displayName = 'TextInput.IconButton';\n"
    },
    {
      "path": "src/components/text-input/TextInputInfo.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/text-input/TextInputInfo.tsx",
      "content": "'use client';\n\nimport type { VariantProps } from 'class-variance-authority';\nimport React from 'react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { useTextInputContext } from './TextInput.context';\nimport { textInputInfoVariants } from './TextInput.variants';\n\nexport type TextInputInfoProps = React.HTMLAttributes<HTMLDivElement> &\n  VariantProps<typeof textInputInfoVariants> & {\n    position: 'prefix' | 'suffix';\n    /**\n     * What this affix holds. Figma insets an affix by the kind of content it\n     * carries, not only by `size` — text sits roomier than an icon, and an icon\n     * button (which has padding of its own) tighter than both.\n     *\n     * Inferred from `children` when omitted, so the common cases need no prop.\n     */\n    content?: 'text' | 'icon' | 'iconButton';\n  };\n\n/**\n * Matched on `displayName` rather than on the component identity: `TextInput.types`\n * already imports Prefix/Suffix, so importing the subcomponents here would close an\n * import cycle back into this file.\n */\nconst CONTENT_BY_DISPLAY_NAME: Record<string, 'text' | 'icon' | 'iconButton'> = {\n  'TextInput.IconButton': 'iconButton',\n  'TextInput.ClearButton': 'iconButton',\n  'TextInput.Icon': 'icon',\n  'TextInput.Button': 'text',\n};\n\nconst inferContent = (children: React.ReactNode): 'text' | 'icon' | 'iconButton' => {\n  const nodes = React.Children.toArray(children);\n  if (nodes.length === 0) return 'icon';\n\n  const kinds = nodes.map((node) => {\n    if (typeof node === 'string' || typeof node === 'number') return 'text';\n    if (React.isValidElement(node)) {\n      const name = (node.type as { displayName?: string })?.displayName;\n      if (name && CONTENT_BY_DISPLAY_NAME[name]) return CONTENT_BY_DISPLAY_NAME[name];\n    }\n    return 'icon';\n  });\n\n  // An icon button dominates: it brings its own padding, so the affix tightens\n  // around it even when it sits next to other content.\n  if (kinds.includes('iconButton')) return 'iconButton';\n  return kinds.every((k) => k === 'text') ? 'text' : 'icon';\n};\n\nexport const TextInputInfo = ({\n  className,\n  children,\n  inner,\n  position,\n  content,\n  onClick,\n  ...props\n}: TextInputInfoProps) => {\n  const { inputRef, size, disabled } = useTextInputContext();\n  const resolvedContent = content ?? inferContent(children);\n\n  const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n    onClick?.(event);\n    if (event.defaultPrevented) return;\n    inputRef.current?.focus();\n  };\n\n  return (\n    <div\n      {...props}\n      role=\"none\"\n      onClick={handleClick}\n      data-disabled={disabled}\n      className={cn(\n        textInputInfoVariants({ size, position, inner, content: resolvedContent }),\n        className,\n      )}\n    >\n      {children}\n    </div>\n  );\n};\n\nTextInputInfo.displayName = 'TextInput.Info';\n"
    },
    {
      "path": "src/components/text-input/TextInputInput.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/text-input/TextInputInput.tsx",
      "content": "'use client';\n\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport React from 'react';\nimport { cn } from '@/lib/wideset/utils';\n\nimport { useTextInputContext } from './TextInput.context';\nimport type { TextInputInputProps } from './TextInput.types';\nimport { textInputInputVariants } from './TextInput.variants';\n\nexport const TextInputInput = React.forwardRef<HTMLInputElement, TextInputInputProps>(\n  ({ className, ...ownProps }, ref) => {\n    const {\n      inputRef,\n      forwardedInputRef,\n      inputProps,\n      variant,\n      disabled,\n      size,\n      currentValue,\n      handleChange,\n    } = useTextInputContext();\n    const composedRef = useComposedRefs(inputRef, forwardedInputRef, ref);\n\n    return (\n      <input\n        ref={composedRef}\n        data-slot=\"text-input-input\"\n        type=\"text\"\n        // Before the spreads, so an explicit `aria-invalid` (even `false`) wins.\n        aria-invalid={variant === 'danger' || undefined}\n        data-disabled={disabled}\n        disabled={disabled}\n        // Root wiring first, then the root's input props, then this part's own:\n        // an explicit `value`/`onChange` here still wins (a display-only trigger, say).\n        value={currentValue}\n        onChange={handleChange}\n        {...inputProps}\n        {...ownProps}\n        className={cn(textInputInputVariants({ size }), className)}\n      />\n    );\n  },\n);\n\nTextInputInput.displayName = 'TextInput.Input';\n"
    },
    {
      "path": "src/components/text-input/TextInputPrefix.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/text-input/TextInputPrefix.tsx",
      "content": "'use client';\n\nimport { TextInputInfo, type TextInputInfoProps } from './TextInputInfo';\n\nexport type TextInputPrefixProps = Omit<TextInputInfoProps, 'position'>;\n\nexport const TextInputPrefix = (props: TextInputPrefixProps) => {\n  return <TextInputInfo data-slot=\"text-input-prefix\" position=\"prefix\" {...props} />;\n};\n\nTextInputPrefix.displayName = 'TextInput.Prefix';\n"
    },
    {
      "path": "src/components/text-input/TextInputSuffix.tsx",
      "type": "registry:ui",
      "target": "components/ui/wideset/text-input/TextInputSuffix.tsx",
      "content": "'use client';\n\nimport { TextInputInfo, type TextInputInfoProps } from './TextInputInfo';\n\nexport type TextInputSuffixProps = Omit<TextInputInfoProps, 'position'>;\n\nexport const TextInputSuffix = (props: TextInputSuffixProps) => {\n  return <TextInputInfo data-slot=\"text-input-suffix\" position=\"suffix\" {...props} />;\n};\n\nTextInputSuffix.displayName = 'TextInput.Suffix';\n"
    }
  ],
  "meta": {
    "version": "1.0.0",
    "commit": "8bb3627"
  }
}
