From d1bb973c503fa6e034212c027cd29401f996db69 Mon Sep 17 00:00:00 2001 From: "Jason M. Zoladz" Date: Sat, 9 Apr 2016 12:22:02 -0400 Subject: [PATCH 1/2] Initial commit --- .gitignore | 6 ++ README.md | 4 +- bower.json | 25 +++++++++ docs/React/Addons/Animation/Props.md | 61 +++++++++++++++++++++ docs/React/Addons/Animation/Transition.md | 13 +++++ src/React/Addons/Animation/Props.purs | 40 ++++++++++++++ src/React/Addons/Animation/Transition.purs | 16 ++++++ src/React/Addons/Animation/TransitionFFI.js | 8 +++ 8 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 bower.json create mode 100644 docs/React/Addons/Animation/Props.md create mode 100644 docs/React/Addons/Animation/Transition.md create mode 100644 src/React/Addons/Animation/Props.purs create mode 100644 src/React/Addons/Animation/Transition.purs create mode 100644 src/React/Addons/Animation/TransitionFFI.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4d159c2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +/bower_components/ +/node_modules/ +/.pulp-cache/ +/output/ +/.psci* +/src/.webpack.js diff --git a/README.md b/README.md index e098e79..b56effd 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ # purescript-react-addons-css-transition-group -CSS Transition Groups for purescript-react +A PureScript interface to `ReactCSSTransitionGroup` for use with [`purescript-react`](https://github.com/purescript-contrib/purescript-react). + +Please see [React's Animation documentation](https://facebook.github.io/react/docs/animation.html) for details concerning proper usage. This API is byte-for-byte compatible. diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..e431108 --- /dev/null +++ b/bower.json @@ -0,0 +1,25 @@ +{ + "name": "purescript-react-addons-css-transition-group", + "version": "0.1.0", + "main": "", + "keywords": [ + "purescript", + "react", + "add-ons", + "addons", + "ReactCSSTransitionGroup", + "ReactTransitions" + ], + "repository": { + "type": "git", + "url": "https://github.com/purescript-contrib/purescript-react-addons-css-transition-group" + }, + "license": "MIT", + "ignore": [ + "*", + "!src/**/*" + ], + "dependencies": { + "purescript-react": "^0.7.1" + } +} diff --git a/docs/React/Addons/Animation/Props.md b/docs/React/Addons/Animation/Props.md new file mode 100644 index 0000000..9fb86f7 --- /dev/null +++ b/docs/React/Addons/Animation/Props.md @@ -0,0 +1,61 @@ +## Module React.Addons.Animation.Props + +See the [Animation section](https://facebook.github.io/react/docs/animation.html) of the React documentation for details concerning usage/API. +This API is byte-for-byte compatible. +Note: You must `npm install react-addons-css-transition-group` to use this module. + +#### `transitionName` + +``` purescript +transitionName :: String -> Props +``` + +#### `TransitionNames` + +``` purescript +type TransitionNames = { enter :: String, enterActive :: String, leave :: String, leaveActive :: String, appearActive :: String } +``` + +#### `transitionName'` + +``` purescript +transitionName' :: TransitionNames -> Props +``` + +#### `transitionAppear` + +``` purescript +transitionAppear :: Boolean -> Props +``` + +#### `transitionEnter` + +``` purescript +transitionEnter :: Boolean -> Props +``` + +#### `transitionLeave` + +``` purescript +transitionLeave :: Boolean -> Props +``` + +#### `transitionEnterTimeout` + +``` purescript +transitionEnterTimeout :: Int -> Props +``` + +#### `transitionLeaveTimeout` + +``` purescript +transitionLeaveTimeout :: Int -> Props +``` + +#### `component` + +``` purescript +component :: String -> Props +``` + + diff --git a/docs/React/Addons/Animation/Transition.md b/docs/React/Addons/Animation/Transition.md new file mode 100644 index 0000000..db53fa7 --- /dev/null +++ b/docs/React/Addons/Animation/Transition.md @@ -0,0 +1,13 @@ +## Module React.Addons.Animation.Transition + +See the [Animation section](https://facebook.github.io/react/docs/animation.html) of the React documentation for details concerning usage/API. +This API is byte-for-byte compatible. +Note: You must `npm install react-addons-css-transition-group` to use this module. + +#### `reactCSSTransitionGroup` + +``` purescript +reactCSSTransitionGroup :: Array Props -> Array ReactElement -> ReactElement +``` + + diff --git a/src/React/Addons/Animation/Props.purs b/src/React/Addons/Animation/Props.purs new file mode 100644 index 0000000..ad59f5e --- /dev/null +++ b/src/React/Addons/Animation/Props.purs @@ -0,0 +1,40 @@ +-- | See the [Animation section](https://facebook.github.io/react/docs/animation.html) of the React documentation for details concerning usage/API. +-- | This API is byte-for-byte compatible. + +-- | Note: You must `npm install react-addons-css-transition-group` to use this module. + +module React.Addons.Animation.Props where + +import React.DOM.Props + +transitionName :: String -> Props +transitionName = unsafeMkProps "transitionName" + +type TransitionNames = + { enter :: String + , enterActive :: String + , leave :: String + , leaveActive :: String + , appearActive :: String + } + +transitionName' :: TransitionNames -> Props +transitionName' = unsafeUnfoldProps "transitionName" + +transitionAppear :: Boolean -> Props +transitionAppear = unsafeMkProps "transitionAppear" + +transitionEnter :: Boolean -> Props +transitionEnter = unsafeMkProps "transitionEnter" + +transitionLeave :: Boolean -> Props +transitionLeave = unsafeMkProps "transitionLeave" + +transitionEnterTimeout :: Int -> Props +transitionEnterTimeout = unsafeMkProps "transitionEnterTimeout" + +transitionLeaveTimeout :: Int -> Props +transitionLeaveTimeout = unsafeMkProps "transitionLeaveTimeout" + +component :: String -> Props +component = unsafeMkProps "component" diff --git a/src/React/Addons/Animation/Transition.purs b/src/React/Addons/Animation/Transition.purs new file mode 100644 index 0000000..933c8c8 --- /dev/null +++ b/src/React/Addons/Animation/Transition.purs @@ -0,0 +1,16 @@ +-- | See the [Animation section](https://facebook.github.io/react/docs/animation.html) of the React documentation for details concerning usage/API. +-- | This API is byte-for-byte compatible. + +-- | Note: You must `npm install react-addons-css-transition-group` to use this module. + +module React.Addons.Animation.Transition (reactCSSTransitionGroup) where + +import Prelude ((<<<)) + +import React (ReactClass(), ReactElement(), createElementDynamic) +import React.DOM.Props (Props(), unsafeFromPropsArray) + +reactCSSTransitionGroup :: Array Props -> Array ReactElement -> ReactElement +reactCSSTransitionGroup = createElementDynamic reactCSSTransitionGroupClass <<< unsafeFromPropsArray + +foreign import reactCSSTransitionGroupClass :: forall props. ReactClass props diff --git a/src/React/Addons/Animation/TransitionFFI.js b/src/React/Addons/Animation/TransitionFFI.js new file mode 100644 index 0000000..582bea3 --- /dev/null +++ b/src/React/Addons/Animation/TransitionFFI.js @@ -0,0 +1,8 @@ +/* global exports */ +"use strict"; + +// module React.Addons.Animation.Transition + +var ReactCSSTransitionGroup = require('react-addons-css-transition-group'); + +exports.reactCSSTransitionGroupClass = ReactCSSTransitionGroup; From 6176bbe5a02d677e7176f228b23aaa1c1b11b40c Mon Sep 17 00:00:00 2001 From: jasonzoladz Date: Tue, 26 Apr 2016 14:49:59 -0400 Subject: [PATCH 2/2] Added MIT LICENSE --- LICENSE.txt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 LICENSE.txt diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..5523c36 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,7 @@ +The MIT License (MIT) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.