{"version":3,"file":"Button.cjs","names":[],"sources":["../../../src/components/Button/Button.tsx"],"sourcesContent":["/**\n * @tempest-limits props-count — this is the design system's button: variant, size,\n * loading, fullWidth, iconOnly, pill, leftIcon and rightIcon are the whole\n * vocabulary every screen composes from. Eight orthogonal knobs on the most-used\n * component is the API working — the count rule is looking for two components fused\n * together, and there is only one here.\n */\nimport type { ButtonHTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./Button.module.css\";\n\nexport type ButtonVariant =\n    \"primary\" | \"secondary\" | \"danger\" | \"success\" | \"ghost\" | \"soft\" | \"outline\" | \"link\";\nexport type ButtonSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n\nexport interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n    variant?: ButtonVariant;\n    size?: ButtonSize;\n    loading?: boolean;\n    fullWidth?: boolean;\n    /** Removes horizontal padding and forces a square footprint (use with `aria-label`). */\n    iconOnly?: boolean;\n    /** Pill-shaped border radius. */\n    pill?: boolean;\n    leftIcon?: ReactNode;\n    rightIcon?: ReactNode;\n}\n\n/**\n * Primary action button with variants, sizes and a loading state that\n * preserves layout via an absolutely-positioned spinner.\n *\n * Variants: `primary` (solid), `secondary` (neutral), `danger`, `success`,\n * `ghost` (transparent), `soft` (tinted), `outline` (bordered), `link`.\n *\n * Sizes are density-aware — they read from `--tempest-control-height-*`\n * tokens which respond to the `data-tempest-density` attribute.\n */\nexport function Button({\n    variant = \"primary\",\n    size = \"md\",\n    loading = false,\n    fullWidth = false,\n    iconOnly = false,\n    pill = false,\n    leftIcon,\n    rightIcon,\n    disabled,\n    className,\n    children,\n    ...props\n}: ButtonProps) {\n    return (\n        <button\n            className={cn(\n                styles.button,\n                styles[variant],\n                styles[size],\n                iconOnly && styles.iconOnly,\n                pill && styles.pill,\n                loading && styles.loading,\n                fullWidth && styles.fullWidth,\n                className,\n            )}\n            disabled={disabled || loading}\n            {...props}\n        >\n            {loading && (\n                <span className={styles.spinner} aria-hidden>\n                    <SpinnerIcon />\n                </span>\n            )}\n            <span className={cn(styles.content, loading && styles.hiddenText)}>\n                {leftIcon}\n                {children}\n                {rightIcon}\n            </span>\n        </button>\n    );\n}\n\nfunction SpinnerIcon() {\n    return (\n        <svg\n            width=\"16\"\n            height=\"16\"\n            viewBox=\"0 0 24 24\"\n            fill=\"none\"\n            xmlns=\"http://www.w3.org/2000/svg\"\n        >\n            <path\n                d=\"M21 12a9 9 0 1 1-6.219-8.56\"\n                stroke=\"currentColor\"\n                strokeWidth=\"2\"\n                strokeLinecap=\"round\"\n            />\n        </svg>\n    );\n}\n"],"mappings":"0GAsCA,SAAgB,EAAO,CACnB,UAAU,UACV,OAAO,KACP,UAAU,GACV,YAAY,GACZ,WAAW,GACX,OAAO,GACP,WACA,YACA,WACA,YACA,WACA,GAAG,GACS,CACZ,OACI,EAAA,EAAA,KAAA,CAAC,SAAD,CACI,UAAW,EAAA,GACP,EAAA,QAAO,OACP,EAAA,QAAO,GACP,EAAA,QAAO,GACP,GAAY,EAAA,QAAO,SACnB,GAAQ,EAAA,QAAO,KACf,GAAW,EAAA,QAAO,QAClB,GAAa,EAAA,QAAO,UACpB,CACJ,EACA,SAAU,GAAY,EACtB,GAAI,EAZR,SAAA,CAcK,IACG,EAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAW,EAAA,QAAO,QAAS,cAAA,GAC7B,UAAA,EAAA,EAAA,IAAA,CAAC,EAAD,CAAc,CAAA,CACZ,CAAA,GAEV,EAAA,EAAA,KAAA,CAAC,OAAD,CAAM,UAAW,EAAA,GAAG,EAAA,QAAO,QAAS,GAAW,EAAA,QAAO,UAAU,EAAhE,SAAA,CACK,EACA,EACA,CACC,CACF,CAAA,CAAA,GAEhB,CAEA,SAAS,GAAc,CACnB,OACI,EAAA,EAAA,IAAA,CAAC,MAAD,CACI,MAAM,KACN,OAAO,KACP,QAAQ,YACR,KAAK,OACL,MAAM,6BAEN,UAAA,EAAA,EAAA,IAAA,CAAC,OAAD,CACI,EAAE,8BACF,OAAO,eACP,YAAY,IACZ,cAAc,OACjB,CAAA,CACA,CAAA,CAEb"}