Files
NapCatQQ/.pnpm-store/v3/files/f2/2cdc00204d51c593bc327412be4233938b662dc05d2906858067ffd01351ee71cb2dfb82458cec4bdc92657701d50ea7bed30ca62aac1160acaa38fed29094
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

52 lines
2.0 KiB
Plaintext

import { ToggleStateOptions } from "@react-types/checkbox";
import { Key } from "@react-types/shared";
export { ToggleStateOptions };
export interface ToggleState {
/** Whether the toggle is selected. */
readonly isSelected: boolean;
/** Updates selection state. */
setSelected(isSelected: boolean): void;
/** Toggle the selection state. */
toggle(): void;
}
/**
* Provides state management for toggle components like checkboxes and switches.
*/
export function useToggleState(props?: ToggleStateOptions): ToggleState;
export interface ToggleGroupProps {
/** Whether single or multiple selection is enabled. */
selectionMode?: 'single' | 'multiple';
/** Whether the collection allows empty selection. */
disallowEmptySelection?: boolean;
/** The currently selected keys in the collection (controlled). */
selectedKeys?: Iterable<Key>;
/** The initial selected keys in the collection (uncontrolled). */
defaultSelectedKeys?: Iterable<Key>;
/** Handler that is called when the selection changes. */
onSelectionChange?: (keys: Set<Key>) => void;
/** Whether all items are disabled. */
isDisabled?: boolean;
}
export interface ToggleGroupState {
/** Whether single or multiple selection is enabled. */
readonly selectionMode: 'single' | 'multiple';
/** Whether all items are disabled. */
readonly isDisabled: boolean;
/** A set of keys for items that are selected. */
readonly selectedKeys: Set<Key>;
/** Toggles the selected state for an item by its key. */
toggleKey(key: Key): void;
/** Sets whether the given key is selected. */
setSelected(key: Key, isSelected: boolean): void;
/** Replaces the set of selected keys. */
setSelectedKeys(keys: Set<Key>): void;
}
/**
* Manages state for a group of toggles.
* It supports both single and multiple selected items.
*/
export function useToggleGroupState(props: ToggleGroupProps): ToggleGroupState;
export type { ToggleProps } from '@react-types/checkbox';
//# sourceMappingURL=types.d.ts.map