@yandex/ymaps3-types
Version:
Types for ymaps3 maps library
50 lines (49 loc) • 2.02 kB
TypeScript
import type TReact from "react";
import type { Context } from "../Entities";
import { YMapGroupEntity } from "../YMapEnities";
import { overrideKeyReactify } from "../wrappers";
interface YMapContainerPropsImpl<TContext> {
onElement: (element?: Element) => void;
onContext: (context?: TContext) => void;
}
interface YMapContainerProps<TContext> {
tagName?: string;
className?: string;
style?: TReact.CSSProperties;
context?: Context<TContext>;
}
declare const defaultProps: {
tagName: string;
};
type DefaultProps = typeof defaultProps;
type ComputedYMapContainerProps<TContext> = YMapContainerProps<TContext> & YMapContainerPropsImpl<TContext>;
/**
* Allow adding or removing [[YMapEntity]] objects or usual DOM elements inside the YMap.
* ```tsx
* const container = <YMapContainer>
* <YMapMarker coordinates={[55.76, 37.64]}><div className="point"></div></YMapMarker>
* <div>Some text</div>
* </YMapContainer>;
*
* ReactDOM.render(<YMap>{container}</YMap, document.getElementById('root'));
* ```
* In this example, the `container` variable contains a `YMapContainer` object with two children: `YMapMarker` and `div`.
* - `YMapMarker` is a YMapEntity
* - `div` is a usual DOM element
*/
declare class YMapContainer extends YMapGroupEntity<ComputedYMapContainerProps<unknown>, DefaultProps> {
static defaultProps: {
tagName: string;
};
static [overrideKeyReactify]: import("../../reactify/reactify").CustomReactify<import("../YMapReactContainer").YMapReactContainer, TReact.FC<import("../YMapReactContainer").YMapReactContainerProps<unknown> & {
children?: TReact.ReactNode;
}>>;
element?: Element;
private _detachDom?;
private _disposeWatch?;
protected _onAttach(): void;
private _adjustContext;
protected _onDetach(): void;
protected _onUpdate(props: Partial<ComputedYMapContainerProps<unknown>>): void;
}
export { YMapContainer, YMapContainerProps, YMapContainerPropsImpl, ComputedYMapContainerProps };