# xy-popover

> 基于 React Hooks 的气泡卡片组件

Latest version **0.1.0** (published 2019-11-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install xy-popover
pnpm add xy-popover
yarn add xy-popover
bun add xy-popover
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2019-11-19 |
| First published | 2019-05-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 13 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | XueYou |
| Maintainers | xueyou2000 |
| Keywords | react, react-component, xy-popover |

## Links

- npm: https://www.npmjs.com/package/xy-popover
- Repository: https://github.com/xueyou2000/xy-popover
- Homepage: https://github.com/xueyou2000/xy-popover#readme
- Issues: https://github.com/xueyou2000/xy-popover/issues
- npm.io page: https://npm.io/package/xy-popover

## Dependencies (4)

- [react](https://npm.io/package/react.md) ^16.12.0
- [react-dom](https://npm.io/package/react-dom.md) ^16.12.0
- [xy-trigger](https://npm.io/package/xy-trigger.md) ^0.0.94
- [utils-hooks](https://npm.io/package/utils-hooks.md) ^0.0.71

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2019-11-19
- 0.0.41 — 2019-09-04
- 0.0.4 — 2019-05-13
- 0.0.2 — 2019-05-08

## README

| ![IE](https://github.com/alrra/browser-logos/blob/master/src/edge/edge_48x48.png?raw=true) | ![Chrome](https://github.com/alrra/browser-logos/blob/master/src/chrome/chrome_48x48.png?raw=true) | ![Firefox](https://github.com/alrra/browser-logos/blob/master/src/firefox/firefox_48x48.png?raw=true) | ![Opera](https://github.com/alrra/browser-logos/blob/master/src/opera/opera_48x48.png?raw=true) | ![Safari](https://github.com/alrra/browser-logos/blob/master/src/safari/safari_48x48.png?raw=true) |
| ------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| IE 10+ ✔                                                                                   | Chrome 31.0+ ✔                                                                                     | Firefox 31.0+ ✔                                                                                       | Opera 30.0+ ✔                                                                                   | Safari 7.0+ ✔                                                                                      |

![NPM version](http://img.shields.io/npm/v/xy-popover.svg?style=flat-square)
![node version](https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square)
![npm download](https://img.shields.io/npm/dm/xy-popover.svg?style=flat-square)

[![xy-popover](https://nodei.co/npm/xy-popover.png)](https://npmjs.org/package/xy-popover)

# xy-popover

气泡卡片组件, 有可选标题和内容, 同`xy-trigger`和`xy-tooltip`组件基本相同

## 安装

```bash
# yarn
yarn add xy-popover
```

## 使用例子

```tsx
import React from "react";
import ReactDOM from "react-dom";
import Popover from "xy-popover";
ReactDOM.render(
    <Popover title="标题" content="描述内容">
        <button>按钮</button>
    </Popover>,
    container,
);
```

## API

| 属性               | 说明                   | 类型                       | 默认值    |
| ------------------ | ---------------------- | -------------------------- | --------- |
| title              | 漂浮提示标题           | React.ReactNode            | 无        |
| content            | 漂浮提示内容           | React.ReactNode            | 无        |
| visible            | 是否可视               | boolean                    | 无        |
| defaultVisible     | 默认是否可视           | boolean                    | 无        |
| children           | 包裹元素               | React.ReactNode            | 无        |
| popupClassName     | 弹出内容类名           | string                     | 无        |
| popupAlign         | 对齐选项               | DomAlignOption             | 无        |
| offsetSize         | 偏移距离               | number                     | 6         |
| destroyPopupOnHide | 是否隐藏时销毁         | boolean                    | false     |
| placement          | 显示方向               | PlacementType              | 无        |
| onChange           | 改变是否可视事件       | (visible: boolean) => void | 无        |
| action             | 触发方式               | TriggerAction[]            | ['hover'] |
| mouseDelay         | 鼠标事件判定延迟       | number                     | 300       |
| stretch            | 是否宽度与目标宽度对齐 | boolean                    | 无        |
| popupClickHide     | 包裹元素点击是否隐藏   | boolean                    | false     |

### PlacementType

> "left" | "right" | "top" | "bottom" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "topLeft" | "topRight" | "bottomLeft" | "bottomRight"

### TriggerAction

> "hover" | "click" | "focus" | "contextMenu"

## 开发

```sh
yarn run start
```

## 例子

http://localhost:6006

## 测试

```
yarn run test
```

## 开源许可

xy-popover is released under the MIT license.

---
_Source: https://npm.io/package/xy-popover · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
