import * as React from "react"; import { type VariantProps } from "class-variance-authority"; declare const toggleVariants: (props?: ({ variant?: "default" | "outline" | "soft" | null | undefined; size?: "lg" | "md" | "sm" | "xs" | null | undefined; shape?: "default" | "pill" | "sharp" | null | undefined; } & import("class-variance-authority/types").ClassProp) | undefined) => string; /** * Not exported on its own β€” it is folded into `ToggleProp` and `ToggleGroupItemProp` so there is * one public name per component. */ type ToggleCountFields = { /** * Optional numeric count rendered as a borderless counter pill after the label β€” the SAME * vocabulary `Button` already defines, so a counted segmented toggle and a counted filter tab * read identically. Formatted with `Intl.NumberFormat` in the active locale (never `String(n)`, * never a hand-rolled thousands separator). */ count?: number; /** Cap for `count` β€” beyond it the pill shows `{overflowCount}+` (e.g. `99+`). */ overflowCount?: number; /** Render the pill when `count` is 0. Default `true`, matching Button. */ showZero?: boolean; /** * Localized description of what the count MEANS, folded into the accessible name so the control * never announces as a bare number ("πŸ‘ 3" β†’ "thumbs up, 3 reactions"). Supply it whenever the * visible label is an icon or an emoji; with a text label the label itself already carries the * meaning. */ countLabel?: string; }; /** * The repo's two-state vocabulary, kept VERBATIM from the Radix era. React Aria spells the same * four things `isSelected` / `defaultSelected` / `onChange` / `isDisabled`; the translation lives * inside this file so no consumer ever has to learn RAC's names. */ type TogglePressedFields = { /** Controlled pressed state β€” RAC `isSelected`. */ pressed?: boolean; /** Uncontrolled initial pressed state β€” RAC `defaultSelected`. */ defaultPressed?: boolean; /** Fired with the NEW pressed state β€” RAC `onChange`. */ onPressedChange?: (pressed: boolean) => void; }; /** * Counter pill shared by `Toggle`, `ToggleGroupItem` and `Tabs` items. ACCESSIBLE NAME. * * `slot` names the hooks the pill emits (`data-slot="-count"` / `.ui--count`) so a * third component can reuse the whole construction β€” the Intl formatting, the `overflowCount` * cap, and above all the `aria-hidden` + `sr-only` split that keeps Β«ζœͺ対応12Β» out of the * accessible name (gh#734) β€” without a second counting API growing beside this one (gh#762). * It defaults to `toggle`, so every existing call emits the identical markup it always has. */ declare function useCounterPill({ count, overflowCount, showZero, countLabel, ariaLabel, slot, }: ToggleCountFields & { ariaLabel?: string; slot?: string; }): { pill: null; resolvedAriaLabel: string | undefined; } | { pill: React.JSX.Element; resolvedAriaLabel: string | undefined; }; /** * RAC's `filterDOMProps` forwards only `id`, `data-*`, the four labelling `aria-*` and the global * mouse/pointer events; `title`, `tabIndex` and the rarer DOM props are dropped silently, and * Radix forwarded ALL of them. `render` is RAC's own escape hatch: the raw props go on first, RAC's * merged ones second so its `type`/`disabled`/`aria-pressed`/handlers always win. * * Two exceptions, both of which Radix owned: `tabIndex` stays the caller's, and so does `id` β€” * inside a ToggleButtonGroup RAC spends `id` as the selection KEY and blanks the DOM attribute, * which would otherwise silently drop the id off every grouped item. */ declare function restoreDomProps

(raw: P, domProps: React.JSX.IntrinsicElements["button"]): React.JSX.Element; export type ToggleProp = React.ComponentPropsWithoutRef<"button"> & TogglePressedFields & VariantProps & ToggleCountFields; export type ToggleProps = ToggleProp; export declare const Toggle: React.ForwardRefExoticComponent, HTMLButtonElement>, "ref"> & TogglePressedFields & VariantProps<(props?: ({ variant?: "default" | "outline" | "soft" | null | undefined; size?: "lg" | "md" | "sm" | "xs" | null | undefined; shape?: "default" | "pill" | "sharp" | null | undefined; } & import("class-variance-authority/types").ClassProp) | undefined) => string> & ToggleCountFields & React.RefAttributes>; export { toggleVariants, useCounterPill, restoreDomProps }; export type { ToggleCountFields, TogglePressedFields };