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

57 lines
2.1 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;
/** Whether the toggle is selected by default. */
readonly defaultSelected: 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.
* @default 'single'
*/
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