import { type FormEvent } from 'react'; import { type DataTestId, type MaskingProps, type StylingProps, type WithChildren, type AriaLabelingProps, type DOMProps } from '@dynatrace/strato-components/core'; /** * @public */ export interface ToggleButtonGroupBaseProps extends WithChildren, DOMProps, AriaLabelingProps, StylingProps, DataTestId, MaskingProps { /** * When true, at least one item in the group has to be active. Otherwise, no item needs to be active. * @defaultValue false */ required?: boolean; /** * When true, all items in the group are read only. * @defaultValue false */ readOnly?: boolean; /** Name used for the component when submitting it in a form. */ name?: string; /** * When true, all items in the group are disabled and this means for example they cannot be interacted with. * @defaultValue false */ disabled?: boolean; } /** * @public */ export interface ToggleButtonGroupControlledProps { /** The value of the group (uncontrolled). */ defaultValue?: never; /** The controlled value for the entire ToggleButtonGroup. */ value: string; /** Handler that is called when the value of the group changes. */ onChange: (value: string, event?: FormEvent) => void; } /** * @public */ export interface ToggleButtonGroupUncontrolledProps { /** The value of the group (uncontrolled). */ defaultValue?: string; /** The controlled value for the entire ToggleButtonGroup. */ value?: never; /** Handler that is called when the value of the group changes. */ onChange?: never; } /** * @public */ export type ToggleButtonGroupProps = ToggleButtonGroupBaseProps & (ToggleButtonGroupControlledProps | ToggleButtonGroupUncontrolledProps); /** * @public */ export interface ToggleButtonGroupItemProps extends WithChildren, DOMProps, AriaLabelingProps, StylingProps, DataTestId { /** * When true, the item cannot be clicked for example. * @defaultValue false */ disabled?: boolean; /** The controlled value of the ToggleButtonGroupItem. */ value: string; /** * Zero or more items in a group can be checked. * @defaultValue false */ checked?: boolean; /** * Indicates if the mover is currently over the item. * @defaultValue false */ hovered?: boolean; } /** * @internal */ export interface RadioGroupState { readonly id?: string; readonly isDisabled: boolean; readonly isReadOnly: boolean; readonly isRequired: boolean; readonly selectedValue: string | null; setSelectedValue(value: string): void; readonly lastFocusedValue: string | null; setLastFocusedValue(value: string): void; readonly firstFocusableValue?: string | null; readonly selectedIsDisabled?: boolean; }