Skip to content

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
  • Loading branch information
yiminghe committed Oct 29, 2015
1 parent 1384fb1 commit f26fa8e
Show file tree
Hide file tree
Showing 16 changed files with 1,425 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*.{js,css}]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
*.iml
*.log
.idea
.ipr
.iws
*~
~*
*.diff
*.patch
*.bak
.DS_Store
Thumbs.db
.project
.*proj
.svn
*.swp
*.swo
*.pyc
*.pyo
node_modules
.cache
*.css
build
lib
36 changes: 36 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
language: node_js

sudo: false

notifications:
email:
- [email protected]

node_js:
- 4.0.0

before_install:
- |
if ! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md$)|(^(docs|examples))/'
then
echo "Only docs were updated, stopping build process."
exit
fi
phantomjs --version
script:
- |
if [ "$TEST_TYPE" = test ]; then
npm test
else
npm run $TEST_TYPE
fi
env:
matrix:
- TEST_TYPE=lint
- TEST_TYPE=browser-test
- TEST_TYPE=browser-test-cover


matrix:
allow_failures:
- env: "TEST_TYPE=saucelabs"
Empty file added HISTORY.md
Empty file.
193 changes: 191 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,191 @@
# trigger
base abstract trigger component
# rc-trigger
---

React Trigger Component


[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![gemnasium deps][gemnasium-image]][gemnasium-url]
[![node version][node-image]][node-url]
[![npm download][download-image]][download-url]

[npm-image]: http://img.shields.io/npm/v/rc-trigger.svg?style=flat-square
[npm-url]: http://npmjs.org/package/rc-trigger
[travis-image]: https://img.shields.io/travis/react-component/trigger.svg?style=flat-square
[travis-url]: https://travis-ci.org/react-component/trigger
[coveralls-image]: https://img.shields.io/coveralls/react-component/trigger.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/react-component/trigger?branch=master
[gemnasium-image]: http://img.shields.io/gemnasium/react-component/trigger.svg?style=flat-square
[gemnasium-url]: https://gemnasium.com/react-component/trigger
[node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square
[node-url]: http://nodejs.org/download/
[download-image]: https://img.shields.io/npm/dm/rc-trigger.svg?style=flat-square
[download-url]: https://npmjs.org/package/rc-trigger


## Browser Support

|![IE](https://raw.github.com/alrra/browser-logos/master/internet-explorer/internet-explorer_48x48.png) | ![Chrome](https://raw.github.com/alrra/browser-logos/master/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/firefox/firefox_48x48.png) | ![Opera](https://raw.github.com/alrra/browser-logos/master/opera/opera_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/safari/safari_48x48.png)|
| --- | --- | --- | --- | --- |
| IE 8+ ✔ | Chrome 31.0+ ✔ | Firefox 31.0+ ✔ | Opera 30.0+ ✔ | Safari 7.0+ ✔ |


## Development

```
npm install
npm start
```

## Example

http://localhost:8200/examples/

online example: http://react-component.github.io/trigger/examples/


## Feature

* support ie8,ie8+,chrome,firefox,safari


## install

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


## Usage

```js
var Trigger = require('rc-trigger');
var React = require('react');
var ReactDOM = require('react-dom')
ReactDOM.render(<Trigger align={{
points: ['tl', 'bl'],
offset: [0, 3]
}} trigger={['click']} popup={<span>popup</span>}>
<a href='#'>hover</a>
</Tooltip>, container);
```

## API

### props

<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">name</th>
<th style="width: 50px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>popupClassName</td>
<td>string</td>
<td></td>
<td>additional className added to popup</td>
</tr>
<tr>
<td>destroyPopupOnHide</td>
<td>boolean</td>
<td>false</td>
<td>whether destroy popup when hide</td>
</tr>
<tr>
<td>getPopupClassNameFromAlign</td>
<td>getPopupClassNameFromAlign(align: Object):String</td>
<td></td>
<td>additional className added to popup according to align</td>
</tr>
<tr>
<td>action</td>
<td>string[]</td>
<td>['hover']</td>
<td>which actions cause popup shown. enum of 'hover','click','focus'</td>
</tr>
<tr>
<td>mouseEnterDelay</td>
<td>number</td>
<td>0</td>
<td>delay time to show when mouse enter. unit: s.</td>
</tr>
<tr>
<td>mouseLeaveDelay</td>
<td>number</td>
<td>0.1</td>
<td>delay time to hide when mouse leave. unit: s.</td>
</tr>
<tr>
<td>popupStyle</td>
<td>Object</td>
<td></td>
<td>additional style of popup</td>
</tr>
<tr>
<td>prefixCls</td>
<td>String</td>
<td>rc-trigger-popup</td>
<td>prefix class name</td>
</tr>
<tr>
<td>popupTransitionName</td>
<td>String</td>
<td></td>
<td>same as https://github.com/react-component/animate</td>
</tr>
<tr>
<td>onPopupVisibleChange</td>
<td>Function</td>
<td></td>
<td>call when popup visible is changed</td>
</tr>
<tr>
<td>popupVisible</td>
<td>boolean</td>
<td></td>
<td>whether popup is visible</td>
</tr>
<tr>
<td>defaultPopupVisible</td>
<td>boolean</td>
<td></td>
<td>whether popup is visible initially</td>
</tr>
<tr>
<td>popupAlign</td>
<td>Object: alignConfig of [dom-align](https://github.com/yiminghe/dom-align)</td>
<td></td>
<td>popup 's align config</td>
</tr>
<tr>
<td>popup</td>
<td>React.Element</td>
<td></td>
<td>popup content</td>
</tr>
<tr>
<td>getPopupContainer</td>
<td>getPopupContainer(): HTMLElement</td>
<td></td>
<td>function returning html node which will act as popup container</td>
</tr>
</tbody>
</table>


## Test Case

http://localhost:8200/tests/runner.html?coverage

## Coverage

http://localhost:8200/node_modules/rc-server/node_modules/node-jscover/lib/front-end/jscoverage.html?w=http://localhost:8200/tests/runner.html?coverage

## License

rc-trigger is released under the MIT license.
70 changes: 70 additions & 0 deletions assets/index.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
@triggerPrefixCls: rc-trigger-popup;

.@{triggerPrefixCls} {
position: absolute;
left: -9999px;
top: -9999px;
z-index: 1070;
display: block;

&-hidden {
display: none;
}

.effect() {
animation-duration: 0.3s;
animation-fill-mode: both;
}

&&-zoom-enter, &&-zoom-leave {
display: block;
}

&-zoom-enter,&-zoom-appear {
opacity: 0;
.effect();
animation-timing-function: cubic-bezier(0.18, 0.89, 0.32, 1.28);
animation-play-state: paused;
}

&-zoom-leave {
.effect();
animation-timing-function: cubic-bezier(0.6, -0.3, 0.74, 0.05);
animation-play-state: paused;
}

&-zoom-enter&-zoom-enter-active, &-zoom-appear&-zoom-appear-active {
animation-name: rcTriggerZoomIn;
animation-play-state: running;
}

&-zoom-leave&-zoom-leave-active {
animation-name: rcTriggerZoomOut;
animation-play-state: running;
}

@keyframes rcTriggerZoomIn {
0% {
opacity: 0;
transform-origin: 50% 50%;
transform: scale(0, 0);
}
100% {
opacity: 1;
transform-origin: 50% 50%;
transform: scale(1, 1);
}
}
@keyframes rcTriggerZoomOut {
0% {
opacity: 1;
transform-origin: 50% 50%;
transform: scale(1, 1);
}
100% {
opacity: 0;
transform-origin: 50% 50%;
transform: scale(0, 0);
}
}
}
1 change: 1 addition & 0 deletions examples/simple.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
placeholder
Loading

0 comments on commit f26fa8e

Please sign in to comment.