UNPKG

@yandex/ui

Version:

Yandex UI components

14 lines (13 loc) 1.46 kB
import { __read } from "tslib"; import React, { useRef, useState } from 'react'; import { Popup } from '@yandex-lego/components/Popup/desktop/bundle'; import { Button } from '@yandex-lego/components/Button/desktop/bundle'; export var Target = function () { var scopeRef = useRef(null); var anchorRef = useRef(null); var _a = __read(useState(false), 2), visible = _a[0], setVisible = _a[1]; return (React.createElement("div", { ref: scopeRef }, React.createElement(Button, { onClick: function () { return setVisible(!visible); }, innerRef: anchorRef, size: "m", view: "default" }, "Open popup"), React.createElement(Popup, { hasTail: true, target: "anchor", anchor: anchorRef, direction: "bottom-start", view: "default", visible: visible, style: { maxWidth: 280 }, onClose: function () { return setVisible(false); }, scope: scopeRef }, React.createElement("div", { style: { padding: 16, fontFamily: 'var(--control-font-family)' } }, "\u041E\u0431\u0449\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430\u044F \u043C\u043D\u043E\u0433\u043E\u044F\u0437\u044B\u0447\u043D\u0430\u044F \u0443\u043D\u0438\u0432\u0435\u0440\u0441\u0430\u043B\u044C\u043D\u0430\u044F \u0438\u043D\u0442\u0435\u0440\u043D\u0435\u0442-\u044D\u043D\u0446\u0438\u043A\u043B\u043E\u043F\u0435\u0434\u0438\u044F \u0441\u043E \u0441\u0432\u043E\u0431\u043E\u0434\u043D\u044B\u043C \u043A\u043E\u043D\u0442\u0435\u043D\u0442\u043E\u043C.")))); };