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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@sinoui/pop

v0.1.31

Published

弹出效果组件是用于给指定元素的点击或者 hover 动作添加一个附着的弹出框。

Downloads

22

Readme

弹出效果组件

弹出效果组件是用于给指定元素的点击或者 hover 动作添加一个附着的弹出框。

特性:

  • [x] 可自由控制弹出内容的渲染
  • [x] 可以包含任何内容
  • [x] 支持点击和 hover
  • [x] 进场、出场动画
  • [x] 弹出框的显示位置
  • [x] 支持在 Modal 中使用
  • [x] 支持自调整位置,不能超出屏幕之外
  • [x] z-index

使用方式:

import Pop from '@sinoui/pop';

export default function PopDemo() {
  return (
    <Pop render={() => <div>这是弹出的内容</div>}>
      <div>这是内容</div>
    </Pop>
  );
}

Pop 组件有以下属性:

| 属性名 | 属性类型 | 属性说明 | | ------------------------ | --------------------------------- | -------------------------------- | | render | ({close}) => React.ReactNode | 渲染弹出内容的函数 | | children | React.ReactNode | 应用效果的内容 | | className | string | 应用到容器的类 | | style | React.CSSProperties | 应用到容器上的样式 | | popContentClassName | string | 应用到弹出框上的类 | | popContentStyle | React.CSSProperties | 应用到弹出框上的样式 | | popAction | 'click' 或者 'hover' | 弹出效果的动作类型。默认为 click | | verticalPosition | 'top' 或者 'bottom' 或者 'center' | 弹出框在垂直方向的位置 | | horizontalPosition | 'left' 或者 'right' 或者 'center' | 弹出框在水平方向的位置 | | verticalOrigionPosition | 'top' 或者 'bottom' 或者 'center' | 弹出框定位时垂直方向的原点位置 | | horizontalOriginPosition | 'left' 或者 'right' 或者 'center' | 弹出框在水平方向的原点位置 | | innerRef | (dom?: HTMLElement) => void | 引用 dom 元素 |

弹出框显示的默认位置:

  • verticalPosition: 'bottom'
  • horizontalPosition: 'left'
  • verticalOrigionPosition: 'top'
  • horizontalOriginPosition: 'left'

关于弹出框的位置

弹出框的位置是弹出框的原点相对于参照物的原点重合定义的。verticalPositionhorizontalPosition是定义参照物的原点的位置,verticalOriginPositonhorizontalOriginPosition是定义弹出框的原点位置。如:

定义参照物的原点位置为参照物的顶点:

<Pop verticalPosition="top" horizontalPosition="left" />

定义参照物的原点位置位于参照物的顶部并且水平居中的位置:

<Pop verticalPosition="top" horizontalPosition="center" />