UNPKG

dcl-ui-toolkit

Version:

A collection of UI helpers to make it easier to build a Decentraland scene using the SDK 7.

44 lines (43 loc) 1.63 kB
import ReactEcs from '@dcl/sdk/react-ecs'; import { EntityPropTypes } from '@dcl/react-ecs/dist/components/types'; import { UiLabelProps } from '@dcl/react-ecs/dist/components/Label/types'; import { InPromptUIObject, InPromptUIObjectConfig } from '../../InPromptUIObject'; export type PromptSwitchLabelElementProps = EntityPropTypes & Omit<UiLabelProps, 'value'>; export type PromptSwitchImageElementProps = Omit<EntityPropTypes, 'uiBackground'> & { uiBackground?: Omit<NonNullable<EntityPropTypes['uiBackground']>, 'uvs'>; }; export declare enum PromptSwitchStyles { ROUNDGREEN = "roundGreen", ROUNDRED = "roundRed", SQUAREGREEN = "squareGreen", SQUARERED = "squareRed" } export type PromptSwitchConfig = InPromptUIObjectConfig & { text: string | number; xPosition: number; yPosition: number; onCheck?: () => void; onUncheck?: () => void; startChecked?: boolean; style?: PromptSwitchStyles; }; export declare class PromptSwitch extends InPromptUIObject { imageElement: PromptSwitchImageElementProps; labelElement: PromptSwitchLabelElementProps; text: string | number; xPosition: number; yPosition: number; style: PromptSwitchStyles; startChecked: boolean; onUncheck: () => void; onCheck: () => void; private _checked; private _xPosition; private _yPosition; constructor({ parent, startHidden, text, xPosition, yPosition, onCheck, onUncheck, startChecked, style, }: PromptSwitchConfig); uncheck(): void; check(): void; render(key?: string): ReactEcs.JSX.Element; private _getImageStyle; private _click; }