npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

yh-react-popover

v0.3.0

Published

yh-react-popover popover组件

Readme

yh-react-popover

build

popover 气泡弹窗组件

预览地址:https://yehuozhili.github.io/yh-react-popover/

简介

  • 由于我在开发 h5dooring 时发现 antd 的 popover 会闪烁位移,而且给定宽高也不能解决此问题,所以直接自己实现个 popover。最终成功替换了 antd 的 popover 解决了此问题。

  • 目前写的这个 popover 只支持 click,有别的需要以后再说。

快速上手

  • 需求 react 与 react-dom 大于 16.8 即可
npm i  yh-react-popover
  • 只需要传 content 为弹窗内容即可工作,direction 默认为 top

  • popover 包裹元素不需要绑事件。

import Popover from 'yh-react-popover'
<Popover directions="TR" content={<div>TRcontent</div>}>
	<button>TR</button>
</Popover>

api

export interface PopoverProps {
	//这个是弹窗内容
	content: ReactNode;
	//这个是方向 默认top
	directions: PopDirections;
	//回调强制刷新函数,用来重新计算位置
	callback?: (v: Function) => void;
	//用来回调关闭函数,如果content中有需要点击关闭的,使用此回调参数
	closeFuncCallback?: Function;
	//触发元素的壳的样式
	constDomStyle?: CSSProperties;
	//弹窗元素的壳的样式
	modalDomStyle?: CSSProperties;
	//小三角的元素样式
	triangleDomStyle?: CSSProperties;
	//弹窗内层壳的样式,一般不用改
	innerDomStyle?: CSSProperties;
	//触发元素内层壳的样式,一般不用改
	innerConstDomStyle?: CSSProperties;
	//modal的ref回调,一般用于绑定事件
	modalRefCallback?: (v: RefObject<HTMLDivElement>) => void;
	//要modal外关闭元素则true,否则false,default true
	needOutsideClose?: boolean;
}
  • 里面绑定的 div 是 inline-block,想修改样式只要用 innerConstDomStyle 与 constDomStyle 把 display 改为 block 即可。

  • callback 的强制刷新可以用 useState 存起来,在监听事件比如 scroll 中进行调用。