UNPKG

@sap-ux/ui-components

Version:
71 lines 2.77 kB
import React from 'react'; import type { IToggleProps } from '@fluentui/react'; import type { UIComponentMessagesProps } from '../../helper/ValidationMessage'; export interface UIToggleProps extends IToggleProps, UIComponentMessagesProps { inlineLabelLeft?: boolean; labelFlexGrow?: boolean; size?: UIToggleSize; } export declare enum UIToggleSize { Standard = "Standard", Small = "Small" } /** * UIToggle component. * based on https://developer.microsoft.com/en-us/fluentui#/controls/web/toggle * * @exports * @class UIToggle * @extends {React.Component<IToggleProps, {}>} */ export declare class UIToggle extends React.Component<UIToggleProps, {}> { private readonly toggleRootRef; /** * Initializes component properties. * * @param {UIToggleProps} props */ constructor(props: UIToggleProps); /** * Lifecycle method called immediately after a component is mounted. * Executes initialization logic such as DOM manipulations or fetching data. * * @returns {void} This method does not return a value. */ componentDidMount(): void; /** * Determines whether the component should update when the new props are received. * This method is typically used for performance optimization. * * @param {UIToggleProps} nextProps - The next props to be received by the component. * @returns {boolean} A boolean value indicating whether the component should update. */ shouldComponentUpdate(nextProps: UIToggleProps): boolean; /** * Handles the change event triggered by the user interaction. * * @param {React.MouseEvent<HTMLElement>} event - The mouse event object associated with the interaction. * @param {boolean} [checked] - An optional parameter indicating the current state of the interaction. * @returns {void} This method does not return a value. */ handleChange(event: React.MouseEvent<HTMLElement>, checked?: boolean): void; /** * Replaces the thumb element of a toggle switch with an icon based on the toggle's state. * * @param {boolean} [checked] Optional. Represents the state of the toggle switch. If not provided, it checks `defaultChecked` prop or defaults to `false`. * @returns {void} Does not return a value. */ replaceThumbWithIcon(checked?: boolean): void; /** * Method returns size of margin bottom for root container depending on current props state. * * @param {string} [message] Validation message. * @returns {number | undefined} Value for margin bottom. */ getMarginBottom(message?: string): number | undefined; /** * @returns {JSX.Element} */ render(): JSX.Element; } //# sourceMappingURL=UIToggle.d.ts.map