UNPKG

@yandex/ymaps3-types

Version:

Types for ymaps3 maps library

95 lines (94 loc) 3.29 kB
import { YMapComplexEntity, YMapGroupEntity } from "../YMapEnities"; import { overrideKeyReactify } from "../wrappers"; /** * Properties for [[YMapControlCommonButton]] * ```typescript * const button = new YMapControlCommonButton({ * text: 'Click me!', * disabled: false, * color: 'black', * background: 'white', * onClick: () => { * console.log('Button clicked'); * } * }); * ``` */ export type YMapControlCommonButtonProps = { /** On click handler */ onClick?: () => void; /** Should be disabled */ disabled?: boolean; /** Text content */ text?: string; /** Text color */ color?: string; /** Background color */ background?: string; /** HTML element */ element?: HTMLElement; }; export type YMapControlButtonProps = YMapControlCommonButtonProps; /** @module YMapControlButton */ /** * Default control button. Can be used as a base for custom controls. * ```javascript * const map = new ymaps3.YMap(document.getElementById('map-root'), {...}); * const controls = new ymaps3.YMapControls({position: 'bottom right'}); * const button = new ymaps3.YMapControlCommonButton({ * text: 'Click me!', * onClick: () => { * console.log('Button clicked'); * } * }); * controls.addChild(button); * ``` * More about controls: [Yandex Maps API controls](https://yandex.com/dev/jsapi30/doc/en/dg/concepts/controls/) */ export declare class YMapControlCommonButton extends YMapGroupEntity<YMapControlCommonButtonProps> { private _element?; private _detachDom?; private _unwatchThemeContext?; protected _onAttach(): void; private _updateElement; protected _onUpdate(props: Partial<YMapControlCommonButtonProps>): void; protected _onDetach(): void; private _updateTheme; } /** * The control element - button. * ```javascript * const map = new YMap(document.getElementById('map-root'), {...}); * const controls = new YMapControls({position: 'top left horizontal'}); * let count = 0; * const button = new YMapControlButton({ * text: 'Click me!', * onClick: () => { * button.update({text: 'Clicked:' + ++count}); * } * }); * controls.addChild(button); * map.addChild(controls); * ``` * * @see <https://yandex.ru/dev/jsapi30/doc/en/dg/concepts/controls/> */ export declare class YMapControlButton extends YMapComplexEntity<YMapControlButtonProps> { static [overrideKeyReactify]: import("../../reactify/reactify").CustomReactify<YMapControlButton, import("react").ForwardRefExoticComponent<{ onClick?: (() => void) | undefined; disabled?: boolean | undefined; text?: string | undefined; color?: string | undefined; background?: string | undefined; element?: HTMLElement | undefined; children?: import("react").ReactNode; ref?: import("react").Ref<import("../Entities").GenericEntity<YMapControlCommonButtonProps, {}, import("../Entities").GenericRootEntity<unknown, {}>>> | undefined; key?: import("react").Key | null | undefined; }>>; private _control; private _button; protected _onAttach(): void; protected _onUpdate(props: Partial<YMapControlButtonProps>): void; protected _onDetach(): void; get text(): string | undefined; }