9 |
--------------------------------------------------------------------------------
/docs/demos/clip.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Clip
3 | nav:
4 | title: Demo
5 | path: /demo
6 | ---
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/demos/point.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Point
3 | nav:
4 | title: Demo
5 | path: /demo
6 | ---
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.fatherrc.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'father';
2 |
3 | export default defineConfig({
4 | plugins: ['@rc-component/father-plugin'],
5 | });
6 |
--------------------------------------------------------------------------------
/docs/demos/inside.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Inside
3 | nav:
4 | title: Demo
5 | path: /demo
6 | ---
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/demos/mobile.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Mobile
3 | nav:
4 | title: Demo
5 | path: /demo
6 | ---
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/demos/nested.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Nested
3 | nav:
4 | title: Demo
5 | path: /demo
6 | ---
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/demos/portal.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Portal
3 | nav:
4 | title: Demo
5 | path: /demo
6 | ---
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/demos/shadow.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Shadow
3 | nav:
4 | title: Demo
5 | path: /demo
6 | ---
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/demos/simple.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Simple
3 | nav:
4 | title: Demo
5 | path: /demo
6 | ---
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | hero:
3 | title: rc-trigger
4 | description: React Trigger Component
5 | ---
6 |
7 |
8 |
--------------------------------------------------------------------------------
/docs/demos/container.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Container
3 | nav:
4 | title: Demo
5 | path: /demo
6 | ---
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/demos/large-popup.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Large Popup
3 | nav:
4 | title: Demo
5 | path: /demo
6 | ---
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/demos/two-buttons.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Moving Popup
3 | nav:
4 | title: Demo
5 | path: /demo
6 | ---
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/demos/body-overflow.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Body Overflow
3 | nav:
4 | title: Demo
5 | path: /demo
6 | ---
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/demos/click-nested.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Click Nested
3 | nav:
4 | title: Demo
5 | path: /demo
6 | ---
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docs/demos/static-scroll.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Static Scroll
3 | nav:
4 | title: Demo
5 | path: /demo
6 | ---
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "endOfLine": "lf",
3 | "semi": true,
4 | "singleQuote": true,
5 | "tabWidth": 2,
6 | "trailingComma": "all",
7 | "jsxSingleQuote": false
8 | }
9 |
--------------------------------------------------------------------------------
/docs/demos/visible-fallback.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Visible Fallback
3 | nav:
4 | title: Demo
5 | path: /demo
6 | ---
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.github/workflows/main.yml:
--------------------------------------------------------------------------------
1 | name: ✅ test
2 | on: [push, pull_request]
3 | jobs:
4 | test:
5 | uses: react-component/rc-test/.github/workflows/test.yml@main
6 | secrets: inherit
7 |
--------------------------------------------------------------------------------
/now.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 2,
3 | "name": "rc-trigger",
4 | "builds": [
5 | {
6 | "src": "package.json",
7 | "use": "@now/static-build",
8 | "config": { "distDir": ".doc" }
9 | }
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | # top-most EditorConfig file
2 | root = true
3 |
4 | # Unix-style newlines with a newline ending every file
5 | [*.{js,css}]
6 | end_of_line = lf
7 | insert_final_newline = true
8 | indent_style = space
9 | indent_size = 2
10 |
--------------------------------------------------------------------------------
/tests/setup.js:
--------------------------------------------------------------------------------
1 | // jsdom add motion events to test CSSMotion
2 | window.AnimationEvent = window.AnimationEvent || (() => {});
3 | window.TransitionEvent = window.TransitionEvent || (() => {});
4 | global.ResizeObserver = jest.fn(() => {
5 | return {
6 | observe() { },
7 | unobserve() { },
8 | disconnect() { },
9 | };
10 | });
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "esnext",
4 | "moduleResolution": "node",
5 | "baseUrl": "./",
6 | "jsx": "react",
7 | "declaration": true,
8 | "skipLibCheck": true,
9 | "esModuleInterop": true,
10 | "allowSyntheticDefaultImports": true,
11 | "paths": {
12 | "@/*": ["src/*"],
13 | "@@/*": [".dumi/tmp/*"],
14 | "@rc-component/trigger": ["src/index.tsx"]
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Popup/PopupContent.tsx:
--------------------------------------------------------------------------------
1 | import * as React from 'react';
2 |
3 | export interface PopupContentProps {
4 | children?: React.ReactNode;
5 | cache?: boolean;
6 | }
7 |
8 | const PopupContent = React.memo(
9 | ({ children }: PopupContentProps) => children as React.ReactElement`visibleFirst` should not show in hidden region if still scrollable
40 | 41 | 49 | 50 |This is a example of trigger usage.
235 |You can adjust the value above
236 |which will also change the behaviour of popup.
237 |This is a example of trigger usage.
60 |You can adjust the value above
61 |which will also change the behavior of popup.
62 |
](http://godban.github.io/browsers-support-badges/)
](http://godban.github.io/browsers-support-badges/)
](http://godban.github.io/browsers-support-badges/)
](http://godban.github.io/browsers-support-badges/)
](http://godban.github.io/browsers-support-badges/)| name | 82 |type | 83 |default | 84 |description | 85 |
|---|---|---|---|
| alignPoint | 90 |bool | 91 |false | 92 |Popup will align with mouse position (support action of 'click', 'hover' and 'contextMenu') | 93 |
| popupClassName | 96 |string | 97 |98 | | additional className added to popup | 99 |
| forceRender | 102 |boolean | 103 |false | 104 |whether render popup before first show | 105 |
| destroyPopupOnHide | 108 |boolean | 109 |false | 110 |whether destroy popup when hide | 111 |
| getPopupClassNameFromAlign | 114 |getPopupClassNameFromAlign(align: Object):String | 115 |116 | | additional className added to popup according to align | 117 |
| action | 120 |string[] | 121 |['hover'] | 122 |which actions cause popup shown. enum of 'hover','click','focus','contextMenu' | 123 |
| mouseEnterDelay | 126 |number | 127 |0 | 128 |delay time to show when mouse enter. unit: s. | 129 |
| mouseLeaveDelay | 132 |number | 133 |0.1 | 134 |delay time to hide when mouse leave. unit: s. | 135 |
| popupStyle | 138 |Object | 139 |140 | | additional style of popup | 141 |
| prefixCls | 144 |String | 145 |rc-trigger-popup | 146 |prefix class name | 147 |
| popupTransitionName | 150 |String|Object | 151 |152 | | https://github.com/react-component/animate | 153 |
| maskTransitionName | 156 |String|Object | 157 |158 | | https://github.com/react-component/animate | 159 |
| onPopupVisibleChange | 162 |Function | 163 |164 | | call when popup visible is changed | 165 |
| mask | 168 |boolean | 169 |false | 170 |whether to support mask | 171 |
| maskClosable | 174 |boolean | 175 |true | 176 |whether to support click mask to hide | 177 |
| popupVisible | 180 |boolean | 181 |182 | | whether popup is visible | 183 |
| zIndex | 186 |number | 187 |188 | | popup's zIndex | 189 |
| defaultPopupVisible | 192 |boolean | 193 |194 | | whether popup is visible initially | 195 |
| popupAlign | 198 |Object: alignConfig of [dom-align](https://github.com/yiminghe/dom-align) | 199 |200 | | popup 's align config | 201 |
| onPopupAlign | 204 |function(popupDomNode, align) | 205 |206 | | callback when popup node is aligned | 207 |
| popup | 210 |React.Element | function() => React.Element | 211 |212 | | popup content | 213 |
| getPopupContainer | 216 |getPopupContainer(): HTMLElement | 217 |218 | | function returning html node which will act as popup container | 219 |
| getDocument | 222 |getDocument(): HTMLElement | 223 |224 | | function returning document node which will be attached click event to close trigger | 225 |
| popupPlacement | 228 |string | 229 |230 | | use preset popup align config from builtinPlacements, can be merged by popupAlign prop | 231 |
| builtinPlacements | 234 |object | 235 |236 | | builtin placement align map. used by placement prop | 237 |
| stretch | 240 |string | 241 |242 | | Let popup div stretch with trigger element. enums of 'width', 'minWidth', 'height', 'minHeight'. (You can also mixed with 'height minWidth') | 243 |