diff --git a/lib/SuperSelectField.js b/lib/SuperSelectField.js index 002c06b..3803cfb 100644 --- a/lib/SuperSelectField.js +++ b/lib/SuperSelectField.js @@ -4,6 +4,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); +var _entries = require('babel-runtime/core-js/object/entries'); + +var _entries2 = _interopRequireDefault(_entries); + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); @@ -63,7 +67,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope // Utilities function areEqual(val1, val2) { if (!val1 || !val2 || (typeof val1 === 'undefined' ? 'undefined' : _typeof(val1)) !== (typeof val2 === 'undefined' ? 'undefined' : _typeof(val2))) return false;else if (typeof val1 === 'string' || typeof val1 === 'number' || typeof val1 === 'boolean') return val1 === val2;else if ((typeof val1 === 'undefined' ? 'undefined' : _typeof(val1)) === 'object') { - return Object.keys(val1).length === Object.keys(val2).length && Object.entries(val2).every(function (_ref) { + return Object.keys(val1).length === Object.keys(val2).length && (0, _entries2.default)(val2).every(function (_ref) { var _ref2 = _slicedToArray(_ref, 2), key2 = _ref2[0], value2 = _ref2[1]; diff --git a/package.json b/package.json index 9da80f0..7f4762b 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,10 @@ "react-infinite-any-height": "^1.0.4" }, "devDependencies": { - "babel-preset-es2015": "^6.24.0", - "babel-preset-stage-2": "^6.22.0", + "babel-plugin-transform-class-properties": "^6.23.0", + "babel-plugin-transform-object-entries": "^1.0.0", + "babel-plugin-transform-object-rest-spread": "^6.23.0", + "babel-preset-env": "^1.2.1", "enzyme": "^2.7.1", "flag-icon-css": "^2.8.0", "gh-pages": "^0.12.0", @@ -40,9 +42,23 @@ "react-tap-event-plugin": "^1.x || ^2.x" }, "babel": { + "plugins": [ + "transform-class-properties", + "transform-object-rest-spread", + "transform-object-entries" + ], "presets": [ - "es2015", - "stage-2", + [ + "env", + { + "targets": { + "browsers": [ + "last 2 versions", + "safari >= 7" + ] + } + } + ], "react" ] }, diff --git a/src/App.js b/src/App.js index d3ed457..53abe14 100644 --- a/src/App.js +++ b/src/App.js @@ -23,11 +23,11 @@ export default () => (
- } /> - } /> - } /> - } /> - } /> + + + + +
diff --git a/src/CodeExample3.js b/src/CodeExample3.js index 0a1116f..6a237ff 100644 --- a/src/CodeExample3.js +++ b/src/CodeExample3.js @@ -34,7 +34,23 @@ const displayState = state => state.length ? [...state].map(({ value, label }) => label || value).join(', ') : 'empty state' -const dataSource = ['Raphaël', 'Jessica', 'Naomie', 'Oliver', 'Wynona', 'Ben', 'Vincent', 'Clémentine', 'Angélique', 'Julien', 'Steve', 'Yoan', 'Nathalie', 'Marie', 'Renée'] +const dataSource = [ + {id: 0, name: 'Raphaël'}, + {id: 1, name: 'Jessica'}, + {id: 2, name: 'Naomie'}, + {id: 3, name: 'Oliver'}, + {id: 4, name: 'Wynona'}, + {id: 5, name: 'Ben'}, + {id: 6, name: 'Vincent'}, + {id: 7, name: 'Clémentine'}, + {id: 8, name: 'Angélique'}, + {id: 9, name: 'Julien'}, + {id: 10, name: 'Steve'}, + {id: 11, name: 'Yoan'}, + {id: 12, name: 'Nathalie'}, + {id: 13, name: 'Marie'}, + {id: 14, name: 'Renée'} +] class CodeExample extends Component { state = { @@ -95,7 +111,9 @@ class CodeExample extends Component { ) }) - const dataSourceNodes = dataSource.map((data, index) =>
{data}
) + const dataSourceNodes = dataSource.map(({id, name}, index) => ( +
{name}
+ )) return
diff --git a/yarn.lock b/yarn.lock index e6e4ed2..f922792 100644 --- a/yarn.lock +++ b/yarn.lock @@ -469,7 +469,7 @@ babel-messages@^6.22.0, babel-messages@^6.23.0: dependencies: babel-runtime "^6.22.0" -babel-plugin-check-es2015-constants@^6.22.0, babel-plugin-check-es2015-constants@^6.3.13: +babel-plugin-check-es2015-constants@^6.3.13: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz#35157b101426fd2ffd3da3f75c7d1e91835bbf8a" dependencies: @@ -568,7 +568,7 @@ babel-plugin-transform-class-constructor-call@^6.22.0: babel-runtime "^6.22.0" babel-template "^6.22.0" -babel-plugin-transform-class-properties@6.22.0, babel-plugin-transform-class-properties@^6.22.0: +babel-plugin-transform-class-properties@6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-class-properties/-/babel-plugin-transform-class-properties-6.22.0.tgz#aa78f8134495c7de06c097118ba061844e1dc1d8" dependencies: @@ -577,6 +577,15 @@ babel-plugin-transform-class-properties@6.22.0, babel-plugin-transform-class-pro babel-runtime "^6.22.0" babel-template "^6.22.0" +babel-plugin-transform-class-properties@^6.22.0, babel-plugin-transform-class-properties@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-class-properties/-/babel-plugin-transform-class-properties-6.23.0.tgz#187b747ee404399013563c993db038f34754ac3b" + dependencies: + babel-helper-function-name "^6.23.0" + babel-plugin-syntax-class-properties "^6.8.0" + babel-runtime "^6.22.0" + babel-template "^6.23.0" + babel-plugin-transform-decorators@^6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-decorators/-/babel-plugin-transform-decorators-6.22.0.tgz#c03635b27a23b23b7224f49232c237a73988d27c" @@ -594,19 +603,19 @@ babel-plugin-transform-do-expressions@^6.3.13: babel-plugin-syntax-do-expressions "^6.8.0" babel-runtime "^6.22.0" -babel-plugin-transform-es2015-arrow-functions@^6.22.0, babel-plugin-transform-es2015-arrow-functions@^6.3.13: +babel-plugin-transform-es2015-arrow-functions@^6.3.13: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz#452692cb711d5f79dc7f85e440ce41b9f244d221" dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-es2015-block-scoped-functions@^6.22.0, babel-plugin-transform-es2015-block-scoped-functions@^6.3.13: +babel-plugin-transform-es2015-block-scoped-functions@^6.3.13: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz#bbc51b49f964d70cb8d8e0b94e820246ce3a6141" dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-es2015-block-scoping@^6.22.0, babel-plugin-transform-es2015-block-scoping@^6.6.0: +babel-plugin-transform-es2015-block-scoping@^6.6.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.23.0.tgz#e48895cf0b375be148cd7c8879b422707a053b51" dependencies: @@ -616,7 +625,7 @@ babel-plugin-transform-es2015-block-scoping@^6.22.0, babel-plugin-transform-es20 babel-types "^6.23.0" lodash "^4.2.0" -babel-plugin-transform-es2015-classes@^6.22.0, babel-plugin-transform-es2015-classes@^6.6.0: +babel-plugin-transform-es2015-classes@^6.6.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.23.0.tgz#49b53f326202a2fd1b3bbaa5e2edd8a4f78643c1" dependencies: @@ -630,33 +639,33 @@ babel-plugin-transform-es2015-classes@^6.22.0, babel-plugin-transform-es2015-cla babel-traverse "^6.23.0" babel-types "^6.23.0" -babel-plugin-transform-es2015-computed-properties@^6.22.0, babel-plugin-transform-es2015-computed-properties@^6.3.13: +babel-plugin-transform-es2015-computed-properties@^6.3.13: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.22.0.tgz#7c383e9629bba4820c11b0425bdd6290f7f057e7" dependencies: babel-runtime "^6.22.0" babel-template "^6.22.0" -babel-plugin-transform-es2015-destructuring@^6.22.0, babel-plugin-transform-es2015-destructuring@^6.6.0: +babel-plugin-transform-es2015-destructuring@^6.6.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz#997bb1f1ab967f682d2b0876fe358d60e765c56d" dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-es2015-duplicate-keys@^6.22.0, babel-plugin-transform-es2015-duplicate-keys@^6.6.0: +babel-plugin-transform-es2015-duplicate-keys@^6.6.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.22.0.tgz#672397031c21610d72dd2bbb0ba9fb6277e1c36b" dependencies: babel-runtime "^6.22.0" babel-types "^6.22.0" -babel-plugin-transform-es2015-for-of@^6.22.0, babel-plugin-transform-es2015-for-of@^6.6.0: +babel-plugin-transform-es2015-for-of@^6.6.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz#f47c95b2b613df1d3ecc2fdb7573623c75248691" dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-es2015-function-name@^6.22.0, babel-plugin-transform-es2015-function-name@^6.3.13: +babel-plugin-transform-es2015-function-name@^6.3.13: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.22.0.tgz#f5fcc8b09093f9a23c76ac3d9e392c3ec4b77104" dependencies: @@ -664,7 +673,7 @@ babel-plugin-transform-es2015-function-name@^6.22.0, babel-plugin-transform-es20 babel-runtime "^6.22.0" babel-types "^6.22.0" -babel-plugin-transform-es2015-literals@^6.22.0, babel-plugin-transform-es2015-literals@^6.3.13: +babel-plugin-transform-es2015-literals@^6.3.13: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz#4f54a02d6cd66cf915280019a31d31925377ca2e" dependencies: @@ -687,7 +696,7 @@ babel-plugin-transform-es2015-modules-commonjs@^6.24.0, babel-plugin-transform-e babel-template "^6.23.0" babel-types "^6.23.0" -babel-plugin-transform-es2015-modules-systemjs@^6.12.0, babel-plugin-transform-es2015-modules-systemjs@^6.22.0: +babel-plugin-transform-es2015-modules-systemjs@^6.12.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.23.0.tgz#ae3469227ffac39b0310d90fec73bfdc4f6317b0" dependencies: @@ -695,7 +704,7 @@ babel-plugin-transform-es2015-modules-systemjs@^6.12.0, babel-plugin-transform-e babel-runtime "^6.22.0" babel-template "^6.23.0" -babel-plugin-transform-es2015-modules-umd@^6.12.0, babel-plugin-transform-es2015-modules-umd@^6.24.0: +babel-plugin-transform-es2015-modules-umd@^6.12.0: version "6.24.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.0.tgz#fd5fa63521cae8d273927c3958afd7c067733450" dependencies: @@ -703,14 +712,14 @@ babel-plugin-transform-es2015-modules-umd@^6.12.0, babel-plugin-transform-es2015 babel-runtime "^6.22.0" babel-template "^6.23.0" -babel-plugin-transform-es2015-object-super@^6.22.0, babel-plugin-transform-es2015-object-super@^6.3.13: +babel-plugin-transform-es2015-object-super@^6.3.13: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.22.0.tgz#daa60e114a042ea769dd53fe528fc82311eb98fc" dependencies: babel-helper-replace-supers "^6.22.0" babel-runtime "^6.22.0" -babel-plugin-transform-es2015-parameters@^6.22.0, babel-plugin-transform-es2015-parameters@^6.6.0: +babel-plugin-transform-es2015-parameters@^6.6.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.23.0.tgz#3a2aabb70c8af945d5ce386f1a4250625a83ae3b" dependencies: @@ -721,20 +730,20 @@ babel-plugin-transform-es2015-parameters@^6.22.0, babel-plugin-transform-es2015- babel-traverse "^6.23.0" babel-types "^6.23.0" -babel-plugin-transform-es2015-shorthand-properties@^6.22.0, babel-plugin-transform-es2015-shorthand-properties@^6.3.13: +babel-plugin-transform-es2015-shorthand-properties@^6.3.13: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.22.0.tgz#8ba776e0affaa60bff21e921403b8a652a2ff723" dependencies: babel-runtime "^6.22.0" babel-types "^6.22.0" -babel-plugin-transform-es2015-spread@^6.22.0, babel-plugin-transform-es2015-spread@^6.3.13: +babel-plugin-transform-es2015-spread@^6.3.13: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz#d6d68a99f89aedc4536c81a542e8dd9f1746f8d1" dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-es2015-sticky-regex@^6.22.0, babel-plugin-transform-es2015-sticky-regex@^6.3.13: +babel-plugin-transform-es2015-sticky-regex@^6.3.13: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.22.0.tgz#ab316829e866ee3f4b9eb96939757d19a5bc4593" dependencies: @@ -742,19 +751,19 @@ babel-plugin-transform-es2015-sticky-regex@^6.22.0, babel-plugin-transform-es201 babel-runtime "^6.22.0" babel-types "^6.22.0" -babel-plugin-transform-es2015-template-literals@^6.22.0, babel-plugin-transform-es2015-template-literals@^6.6.0: +babel-plugin-transform-es2015-template-literals@^6.6.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz#a84b3450f7e9f8f1f6839d6d687da84bb1236d8d" dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-es2015-typeof-symbol@^6.22.0, babel-plugin-transform-es2015-typeof-symbol@^6.6.0: +babel-plugin-transform-es2015-typeof-symbol@^6.6.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz#dec09f1cddff94b52ac73d505c84df59dcceb372" dependencies: babel-runtime "^6.22.0" -babel-plugin-transform-es2015-unicode-regex@^6.22.0, babel-plugin-transform-es2015-unicode-regex@^6.3.13: +babel-plugin-transform-es2015-unicode-regex@^6.3.13: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.22.0.tgz#8d9cc27e7ee1decfe65454fb986452a04a613d20" dependencies: @@ -791,13 +800,26 @@ babel-plugin-transform-function-bind@^6.3.13: babel-plugin-syntax-function-bind "^6.8.0" babel-runtime "^6.22.0" -babel-plugin-transform-object-rest-spread@6.22.0, babel-plugin-transform-object-rest-spread@^6.22.0: +babel-plugin-transform-object-entries@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-entries/-/babel-plugin-transform-object-entries-1.0.0.tgz#1a03754b323099f1d5c5c12c9dea70e6b3a1497f" + dependencies: + babel-runtime "^6.9.0" + +babel-plugin-transform-object-rest-spread@6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.22.0.tgz#1d419b55e68d2e4f64a5ff3373bd67d73c8e83bc" dependencies: babel-plugin-syntax-object-rest-spread "^6.8.0" babel-runtime "^6.22.0" +babel-plugin-transform-object-rest-spread@^6.22.0, babel-plugin-transform-object-rest-spread@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.23.0.tgz#875d6bc9be761c58a2ae3feee5dc4895d8c7f921" + dependencies: + babel-plugin-syntax-object-rest-spread "^6.8.0" + babel-runtime "^6.22.0" + babel-plugin-transform-react-constant-elements@6.22.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-react-constant-elements/-/babel-plugin-transform-react-constant-elements-6.22.0.tgz#4af456f80d283e8be00f00f12852354defa08ee1" @@ -840,7 +862,7 @@ babel-plugin-transform-react-jsx@^6.22.0, babel-plugin-transform-react-jsx@^6.3. babel-plugin-syntax-jsx "^6.8.0" babel-runtime "^6.22.0" -babel-plugin-transform-regenerator@6.22.0, babel-plugin-transform-regenerator@^6.22.0, babel-plugin-transform-regenerator@^6.6.0: +babel-plugin-transform-regenerator@6.22.0, babel-plugin-transform-regenerator@^6.6.0: version "6.22.0" resolved "https://registry.yarnpkg.com/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.22.0.tgz#65740593a319c44522157538d690b84094617ea6" dependencies: @@ -859,7 +881,7 @@ babel-plugin-transform-strict-mode@^6.22.0: babel-runtime "^6.22.0" babel-types "^6.22.0" -babel-preset-env@1.2.1: +babel-preset-env@1.2.1, babel-preset-env@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/babel-preset-env/-/babel-preset-env-1.2.1.tgz#659178f54df74a74765f796be4d290b5beeb3f5f" dependencies: @@ -894,35 +916,6 @@ babel-preset-env@1.2.1: electron-to-chromium "^1.1.0" invariant "^2.2.2" -babel-preset-es2015@^6.24.0: - version "6.24.0" - resolved "https://registry.yarnpkg.com/babel-preset-es2015/-/babel-preset-es2015-6.24.0.tgz#c162d68b1932696e036cd3110dc1ccd303d2673a" - dependencies: - babel-plugin-check-es2015-constants "^6.22.0" - babel-plugin-transform-es2015-arrow-functions "^6.22.0" - babel-plugin-transform-es2015-block-scoped-functions "^6.22.0" - babel-plugin-transform-es2015-block-scoping "^6.22.0" - babel-plugin-transform-es2015-classes "^6.22.0" - babel-plugin-transform-es2015-computed-properties "^6.22.0" - babel-plugin-transform-es2015-destructuring "^6.22.0" - babel-plugin-transform-es2015-duplicate-keys "^6.22.0" - babel-plugin-transform-es2015-for-of "^6.22.0" - babel-plugin-transform-es2015-function-name "^6.22.0" - babel-plugin-transform-es2015-literals "^6.22.0" - babel-plugin-transform-es2015-modules-amd "^6.24.0" - babel-plugin-transform-es2015-modules-commonjs "^6.24.0" - babel-plugin-transform-es2015-modules-systemjs "^6.22.0" - babel-plugin-transform-es2015-modules-umd "^6.24.0" - babel-plugin-transform-es2015-object-super "^6.22.0" - babel-plugin-transform-es2015-parameters "^6.22.0" - babel-plugin-transform-es2015-shorthand-properties "^6.22.0" - babel-plugin-transform-es2015-spread "^6.22.0" - babel-plugin-transform-es2015-sticky-regex "^6.22.0" - babel-plugin-transform-es2015-template-literals "^6.22.0" - babel-plugin-transform-es2015-typeof-symbol "^6.22.0" - babel-plugin-transform-es2015-unicode-regex "^6.22.0" - babel-plugin-transform-regenerator "^6.22.0" - babel-preset-jest@^18.0.0: version "18.0.0" resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-18.0.0.tgz#84faf8ca3ec65aba7d5e3f59bbaed935ab24049e" @@ -1023,7 +1016,7 @@ babel-runtime@6.22.0: core-js "^2.4.0" regenerator-runtime "^0.10.0" -babel-runtime@^6.18.0, babel-runtime@^6.20.0, babel-runtime@^6.22.0: +babel-runtime@^6.18.0, babel-runtime@^6.20.0, babel-runtime@^6.22.0, babel-runtime@^6.9.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.23.0.tgz#0a9489f144de70efb3ce4300accdb329e2fc543b" dependencies: