import { clx, Input, Text } from "@medusajs/ui" import { ComponentPropsWithoutRef, ElementRef, forwardRef } from "react" type QuantityInputProps = Omit< ComponentPropsWithoutRef, "type" > & { /** * The unit the quantity is counted in, e.g. `lb`. When omitted the input is * rendered unchanged. */ unitOfMeasure?: string | null } /** * A number input that renders an inventory item's unit of measure as a suffix, * so a fractional quantity reads as `0.25 | lb`. * * The unit is a sibling of the input rather than an overlay on top of it: * padding the input to make room would shrink its content box, and browsers * anchor the native number stepper to that box, leaving the stepper floating * short of the separator. */ export const QuantityInput = forwardRef< ElementRef, QuantityInputProps >(({ unitOfMeasure, className, size = "base", ...props }, ref) => { if (!unitOfMeasure) { return ( ) } const isInvalid = props["aria-invalid"] === true || props["aria-invalid"] === "true" return (
{unitOfMeasure}
) }) QuantityInput.displayName = "QuantityInput"