├── .idea ├── .name ├── vcs.xml ├── modules.xml ├── paper-swipe.iml ├── misc.xml └── workspace.xml ├── .gitignore ├── .yo-rc.json ├── LICENSE ├── bower.json ├── index.html ├── demo ├── index.html ├── swipe-list.html ├── boilerplate-generator.html └── simple-demo.html ├── README.md └── paper-swipe.html /.idea/.name: -------------------------------------------------------------------------------- 1 | paper-swipe -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | bower_components 2 | -------------------------------------------------------------------------------- /.yo-rc.json: -------------------------------------------------------------------------------- 1 | { 2 | "generator-polymer": { 3 | "ghUser": "motss" 4 | } 5 | } -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/paper-swipe.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 motss 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "paper-swipe", 3 | "version": "1.0.2", 4 | "authors": [ 5 | "motss " 6 | ], 7 | "description": "Custom Element with swiping feature named paper-swipe", 8 | "keywords": [ 9 | "web-component", 10 | "web-components", 11 | "polymer", 12 | "seed", 13 | "paper-swipe", 14 | "swipe", 15 | "paper", 16 | "motss" 17 | ], 18 | "main": "paper-swipe.html", 19 | "license": "MIT", 20 | "homepage": "https://github.com/motss/paper-swipe", 21 | "ignore": [ 22 | "/.*", 23 | "/test/", 24 | "LICENSE", 25 | "README.md" 26 | ], 27 | "dependencies": { 28 | "polymer": "Polymer/polymer#^1.2.3" 29 | }, 30 | "devDependencies": { 31 | "iron-component-page": "PolymerElements/iron-component-page#^1.0.0", 32 | "paper-checkbox": "polymerelements/paper-checkbox#^1.1.0", 33 | "paper-tabs": "polymerelements/paper-tabs#^1.3.3", 34 | "app-layout": "polymerlabs/app-layout#^0.0.6", 35 | "iron-pages": "polymerelements/iron-pages#^1.0.5", 36 | "iron-list": "polymerelements/iron-list#^1.2.0", 37 | "paper-item": "PolymerElements/paper-item#^1.1.3" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /demo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | paper-swipe Demo 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 55 | 56 | 57 | 97 | 98 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /demo/swipe-list.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 85 | 130 | 131 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![GitHub version](https://badge.fury.io/gh/motss%2Fpaper-swipe.svg)](http://badge.fury.io/gh/motss%2Fpaper-swipe) 2 | [![Bower version](https://badge.fury.io/bo/paper-swipe.svg)](http://badge.fury.io/bo/paper-swipe) 3 | 4 | # paper-swipe 5 | 6 | ## Update (1.0.0) 7 | Highlights of v1.0.0: 8 | - Added `fade` attribute for simple fade in/ fade out effect when swiping. 9 | - Removed `resetSwipe` attribute which is redundant and being taken care by new method `resetPosition()`. 10 | - Fixed layout issue on Safari Mobile. 11 | - Added custom mixins to style the element. 12 | - Prettier demo. 13 | - Code restructured. 14 | 15 | See the [component page](http://motss.github.io/paper-swipe/components/paper-swipe/) for more information. 16 | 17 | `paper-swipe` provides enables swipe gestures to swipe content to either the left or the right to unveil the underlay 18 | behind it. 19 | 20 | Example: 21 | 22 | By default, it can be swiped to either the left or the right. 23 | Swipe Gestures disabled 24 | Swipe with fade in/ fade out effect 25 | Only Left Swipe 26 | Only Right Swipe 27 | Tap Event Handler 28 | Panel is now at the edge of the screen 29 | 30 | `paper-swipe` allows user to use the custom DOM in the body to create basically any contents and it has two different 31 | sections which allows the customization by using the `content` and `underlay` attributes: 32 | 33 | Example: 34 | 35 | 36 |
Underlay content goes here...
37 |
Content of swiping element goes here...
38 |
39 | 40 | ## Event handling 41 | 42 | `paper-swipe` has been added some features to fire certain events such as `tap-underlay` and `edge` so that user can 43 | make use of it to perform additional functions as you like: 44 | 45 | Example: 46 | 47 | Underlay content goes here... 49 |
Fire `edge` event when the panel is at the edge of the screen...
50 |
51 | 52 | 53 |
Underlay content goes here...
54 |
Fire `tap-underlay` event when the panel is being clicked...
55 |
56 | 57 | There are two ways to disable the swiping on the content panel by using `on-tap-underlay` or `on-click` event handler: 58 | 59 | Example: 60 | 61 | 62 |
Click to reset the panel from the edge to its origin...
63 |
Swipe to remove the panel...
64 |
65 | 66 | 67 |
Click to reset the panel from the edge to its origin...
68 |
Swipe to remove the panel...
69 |
70 | 71 | ## Styling 72 | Note, it's important that specifying explicit height to the `paper-swipe` will render both the `content` and `underlay` layers to have the same height. Especially when multiple `paper-swipe` on the same document, explicit height will make all elements look consistent. 73 | 74 | paper-swipe { 75 | height: 100px; 76 | } 77 | 78 | paper-swipe { 79 | --paper-swipe: { 80 | height: 100px; 81 | }; 82 | } 83 | 84 | The following custom properties and mixins are also available for styling: 85 | 86 | Custom mixin | Description | Default 87 | ----------------|-------------|---------- 88 | `--paper-swipe` | `Mixin applied to paper-swipe` | `{}` 89 | `--paper-swipe-swipeable-container` | `Mixin applied to paper-swipe-swipeable-container` | `{}` 90 | `--paper-swipe-content` | `Mixin applied to swipeable content` | `{}` 91 | `--paper-swipe-underlay` | `Mixin applied to underlay beneath the swipeable content` | `{}` 92 | 93 | ## Demo + boilerplate generator 94 | [paper-swipe demo + boilerplate generator](http://motss.github.io/paper-swipe/components/paper-swipe/demo/index.html) 95 | 96 | ## Getting Started 97 | 98 | 1. Install with bower 99 | `bower install --save paper-swipe` 100 | 101 | 2. Load the web component and the dependencies 102 | 103 | ```html 104 | 105 | 106 | 107 | ``` 108 | 109 | 3. Markup with <paper-swipe></paper-swipe> 110 | 111 | 4. Done 112 | 113 | ### Supported Browsers 114 | 115 | [Same as Polymer](http://www.polymer-project.org/resources/compatibility.html) 116 | -------------------------------------------------------------------------------- /demo/boilerplate-generator.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 169 | 300 | 301 | -------------------------------------------------------------------------------- /demo/simple-demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 315 | 358 | 359 | -------------------------------------------------------------------------------- /paper-swipe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 87 | 88 | 89 | 144 | 145 | 146 | 534 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 17 | 18 | 19 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 62 | 63 | 71 | 72 | 73 | 74 | true 75 | 76 | 77 | 78 | 79 | 80 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 117 | 118 | 119 | 120 | 123 | 124 | 127 | 128 | 129 | 130 | 133 | 134 | 137 | 138 | 141 | 142 | 143 | 144 | 147 | 148 | 151 | 152 | 155 | 156 | 157 | 158 | 161 | 162 | 165 | 166 | 169 | 170 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 214 | 215 | 216 | 217 | 218 | 219 | true 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 1439216972057 232 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 264 | 267 | 268 | 269 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | --------------------------------------------------------------------------------