├── .babelrc ├── .eslintrc ├── .gitignore ├── .npmignore ├── .travis.yml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── lib └── index.js ├── package-lock.json ├── package.json ├── spec ├── react-masonry-component-test.js └── setup │ ├── karma.conf.js │ └── test-style.css ├── typings.d.ts └── yarn.lock /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["react", "es2015"] 3 | } 4 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "node": true, 4 | "browser": true 5 | }, 6 | "extends": "eslint:recommended" 7 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled source # 2 | ################### 3 | *.com 4 | *.class 5 | *.dll 6 | *.exe 7 | *.o 8 | *.so 9 | 10 | # Packages # 11 | ############ 12 | # it's better to unpack these files and commit the raw source 13 | # git has its own built in compression methods 14 | *.7z 15 | *.dmg 16 | *.gz 17 | *.iso 18 | *.jar 19 | *.rar 20 | *.tar 21 | *.zip 22 | 23 | # Logs and databases # 24 | ###################### 25 | *.log 26 | *.sql 27 | *.sqlite 28 | 29 | # OS generated files # 30 | ###################### 31 | .DS_Store 32 | .DS_Store? 33 | ._* 34 | .Spotlight-V100 35 | .Trashes 36 | ehthumbs.db 37 | Thumbs.db 38 | 39 | # Editors # 40 | ########### 41 | .idea 42 | 43 | # Custom # 44 | ########## 45 | /node_modules 46 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /spec 3 | .babelrc -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "stable" 4 | - "8" 5 | - "6" 6 | - "5" 7 | - "4" -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 6.3.0 2 | ==== 3 | - Support React 17 4 | 5 | 6.2.1 6 | ==== 7 | - Fixes bug on unmounting compononent with disablesImagesLoaded set to true 8 | 9 | 6.2.0 10 | ===== 11 | - columnWidth TypeScript interface now also supports HTMLElement or null 12 | - transitionDuration TypeScript interface now also supports a string 13 | 14 | 6.1.1 15 | ===== 16 | #### New Features 17 | - Adds ability to pass in `imagesloaded` options to be passed on by React Masonry Component 18 | - Adds `number` type to the transitionDuration property on the Options TypeScript Interface 19 | 20 | #### Bug Fixes 21 | - Removes old imagesloaded listeners so there is only ever 1 active listener. 22 | - Correctly cleans up reference to imagesloaded handlers when the component is unmounted 23 | 24 | 6.0.2 25 | ===== 26 | - Allows gutter to be a number or string (Typescript) 27 | - Refactors item reloading to prevent race conditions 28 | 29 | 6.0.1 30 | ===== 31 | - Removes string style refs 32 | 33 | 6.0.0 34 | ===== 35 | - Updates React peer dependencies to include React@16.0.0 36 | - Uses Lodash library as dependency instead of individual lodash methods 37 | - Fixes children.length check on diff 38 | 39 | 5.0.7 40 | ===== 41 | - Adds `horizontalOrder` to TypeScript Masonry options Interface 42 | 43 | 5.0.6 44 | ===== 45 | - Adds support for TypeScript string columnWidth 46 | 47 | 5.0.5 48 | ===== 49 | - Switch to create-react-class and prop-types libraries 50 | 51 | 5.0.4 52 | ===== 53 | - Correctly removes onRemoveComplete listener 54 | 55 | 5.0.3 56 | ===== 57 | - Fixes `let` to `var` 58 | - DEV-ONLY Adds eslint 59 | 60 | 5.0.2 61 | ===== 62 | - Fixes es6 syntax used in index.js 63 | 64 | 5.0.1 65 | ===== 66 | - reverted 5.0.0 change 67 | - Fixes removing first element 68 | 69 | 5.0.0 70 | ===== 71 | - old children are now passed to the diffing algorithm without filtering 72 | 73 | 4.4.0 74 | ===== 75 | - Handle `onLayoutComplete` and `onRemoveComplete` callback handlers as part of the component 76 | 77 | 4.3.2 78 | ===== 79 | - Fixes TypeScript to use `export as namespace` syntax 80 | 81 | 4.3.1 82 | ===== 83 | - Fixes unmount when monitor children resize is disabled 84 | 85 | 4.3.0 86 | ===== 87 | - Removes willReceiveProps function as not needed 88 | - Make resizable children trigger masonry layout 89 | 90 | 4.2.3-beta 91 | ========== 92 | - Removes willReceiveProps function as possibly not needed 93 | 94 | 4.2.2 95 | ===== 96 | - Exports component as `default` to support import statement 97 | 98 | 4.2.0 99 | ===== 100 | - Adds Typescript 2.0 typings definition 101 | - Fixes unknownProps error (no longer passes unknown props to masonry el) 102 | 103 | 4.1.0 104 | ===== 105 | - Add onImagesLoaded event 106 | - Use lodash.assign instead of own extend function 107 | - Add option to fire imagesloaded after each image is loaded 108 | 109 | 4.0.4 110 | ===== 111 | - Call masonry.destroy() on component unmount 112 | 113 | 4.0.3 114 | ===== 115 | - Fix layout of prepended elements 116 | 117 | 4.0.2 118 | ===== 119 | - Fix peer dependency typos...(derp) 120 | 121 | 4.0.1 122 | ===== 123 | - Update React peer dependencies to include >=15.0.0 124 | 125 | 4.0.0 126 | ===== 127 | - Update masonry-layout to ^4.0.0 128 | 129 | 3.0.0 130 | ===== 131 | - Add peer dependency on React >= 0.14 132 | - No longer need to pass in React or execute component as a function 133 | - Use NPM dependencies instead of forked dependencies 134 | - Allow addition of custom props 135 | 136 | 2.0.0 137 | ===== 138 | - Remove < React 0.14 compatibility. 139 | - Compatible with React 0.14 and above only 140 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Eirik L. Vullum 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | React Masonry Component 2 | ======================= 3 | 4 | [![npm version](https://badge.fury.io/js/react-masonry-component.svg)](http://badge.fury.io/js/react-masonry-component) 5 | [![Build Status](https://travis-ci.org/eiriklv/react-masonry-component.svg?branch=master)](https://travis-ci.org/eiriklv/react-masonry-component) 6 | 7 | ### IE8 support 8 | if you wish to have IE8 support, v2 with React 0.14 is the highest version available. 9 | 10 | ### Table of contents 11 | 1. [Usage](#usage) 12 | 1. [Basic usage](#basic-usage) 13 | 2. [Custom props](#custom-props) 14 | 3. [Accessing Masonry instance](#accessing-masonry-instance) 15 | 4. [Images Loaded Options](#images-loaded-options) 16 | 5. [Events](#events) 17 | 18 | #### Introduction: 19 | A React.js Masonry component. (Also available as a [mixin](https://github.com/eiriklv/react-masonry-mixin) if needed) 20 | 21 | #### Live demo: 22 | [hearsay.me](https://hearsay-frontend.herokuapp.com) 23 | 24 | #### Usage: 25 | 26 | * The component is bundled with Masonry, so no additional dependencies needed! 27 | * You can optionally include Masonry as a script tag if there should be any reason for doing so 28 | `