UNPKG

@yandex/ui

Version:

Yandex UI components

26 lines (25 loc) 1.26 kB
import { __assign, __read } from "tslib"; import React, { useState } from 'react'; import { withControl } from '@yandex-lego/components/withControl'; import { Text } from '@yandex-lego/components/Text/bundle'; import { Button } from '@yandex-lego/components/Button/desktop/bundle'; var Component = function (props) { return (React.createElement(Button, __assign({}, props, { view: "action", size: "m" }), ' ', "Button", ' ')); }; var EnhancedComponent = withControl(Component); export var Default = function () { var _a = __read(useState('No state'), 2), curState = _a[0], setCurState = _a[1]; var handleBlur = function () { return setCurState('Handle blur'); }; var handleFocus = function () { return setCurState('Handle focus'); }; var handleMouseDown = function () { return setCurState('Handle mouse down'); }; var handleMouseUp = function () { return setCurState('Handle mouse up'); }; return (React.createElement(React.Fragment, null, React.createElement(EnhancedComponent, { onBlur: handleBlur, onFocus: handleFocus, onMouseDown: handleMouseDown, onMouseUp: handleMouseUp }), ' ', "\u00A0", React.createElement(Text, null, " ", curState, " "))); };