diff --git a/src/onegov/feriennet/assets/js/volunteer-cart.jsx b/src/onegov/feriennet/assets/js/volunteer-cart.jsx index e41a0d962e..dcd31637d0 100644 --- a/src/onegov/feriennet/assets/js/volunteer-cart.jsx +++ b/src/onegov/feriennet/assets/js/volunteer-cart.jsx @@ -1,4 +1,4 @@ -var VolunteerCart = React.createClass({ +var VolunteerCart = createReactClass({ getInitialState: function() { return {'items': []}; }, diff --git a/src/onegov/form/assets/js/format.jsx b/src/onegov/form/assets/js/format.jsx index f617f59285..fe56d1f45e 100644 --- a/src/onegov/form/assets/js/format.jsx +++ b/src/onegov/form/assets/js/format.jsx @@ -1,4 +1,4 @@ -var FormcodeFormat = React.createClass({ +var FormcodeFormat = createReactClass({ getInitialState: function() { return {fields: []}; }, @@ -28,7 +28,7 @@ var FormcodeFormat = React.createClass({ } }); -var FormcodeFormatFields = React.createClass({ +var FormcodeFormatFields = createReactClass({ render: function() { var self = this; return ( @@ -49,7 +49,7 @@ var FormcodeFormatFields = React.createClass({ } }); -var FormcodeFormatField = React.createClass({ +var FormcodeFormatField = createReactClass({ handleClick: function() { var format = '[' + this.props.field.human_id + ']'; formcodeUtils.updateTarget(this.props.target, format, null, ' '); diff --git a/src/onegov/form/assets/js/select.jsx b/src/onegov/form/assets/js/select.jsx index 619b20bd4e..64a692cd83 100644 --- a/src/onegov/form/assets/js/select.jsx +++ b/src/onegov/form/assets/js/select.jsx @@ -1,4 +1,4 @@ -var FormcodeSelect = React.createClass({ +var FormcodeSelect = createReactClass({ getInitialState: function() { var values = this.getTarget().value.split('\n').filter(function(line) { return line.trim() !== ''; @@ -119,7 +119,7 @@ var FormcodeSelect = React.createClass({ } }); -var FormcodeSelectField = React.createClass({ +var FormcodeSelectField = createReactClass({ handleChange: function() { this.props.handler(this.props.id); }, diff --git a/src/onegov/form/assets/js/snippets.jsx b/src/onegov/form/assets/js/snippets.jsx index faf12359e2..cc84494a67 100644 --- a/src/onegov/form/assets/js/snippets.jsx +++ b/src/onegov/form/assets/js/snippets.jsx @@ -4,7 +4,7 @@ */ // Renders the formsnippets given by FormApp -var FormSnippets = React.createClass({ +var FormSnippets = createReactClass({ render: function() { var self = this; @@ -36,7 +36,7 @@ var FormSnippets = React.createClass({ }); // Renders a single formsnippet and handles the insertion logic -var FormSnippet = React.createClass({ +var FormSnippet = createReactClass({ insertSnippet: function(snippet) { formcodeUtils.updateTarget(this.props.target, snippet, this.props.snippet[0]); }, diff --git a/src/onegov/form/assets/js/togglebutton.jsx b/src/onegov/form/assets/js/togglebutton.jsx index d839d7cad3..8f19741f8f 100644 --- a/src/onegov/form/assets/js/togglebutton.jsx +++ b/src/onegov/form/assets/js/togglebutton.jsx @@ -1,7 +1,7 @@ // Takes its children and wraps them in a toggleable element, which is a button // that pops up a menu when clicked. -var ToggleButton = React.createClass({ // eslint-disable-line no-unused-vars +var ToggleButton = createReactClass({ // eslint-disable-line no-unused-vars getInitialState: function() { return { visible: false diff --git a/src/onegov/form/assets/js/watcher.jsx b/src/onegov/form/assets/js/watcher.jsx index 8d96af4495..c9932bf55c 100644 --- a/src/onegov/form/assets/js/watcher.jsx +++ b/src/onegov/form/assets/js/watcher.jsx @@ -58,7 +58,7 @@ var FormcodeWatcherRegistry = function() { window.formcodeWatcherRegistry = FormcodeWatcherRegistry(); -var WatchedFields = React.createClass({ +var WatchedFields = createReactClass({ getInitialState: function() { return {fields: []}; }, diff --git a/src/onegov/org/app.py b/src/onegov/org/app.py index 47500e8845..81d19b0e94 100644 --- a/src/onegov/org/app.py +++ b/src/onegov/org/app.py @@ -735,6 +735,7 @@ def get_editor_asset() -> 'Iterator[str]': @OrgApp.webasset('timeline') def get_timeline_asset() -> 'Iterator[str]': + yield 'react-transition-group.js' yield 'timeline.jsx' @@ -805,8 +806,9 @@ def get_common_asset() -> 'Iterator[str]': yield 'foundation.topbar.js' yield 'intercooler.js' yield 'underscore.js' - yield 'react.js' - yield 'react-dom.js' + yield 'react.min.js' + yield 'react-dom.min.js' + yield 'create-react-class.min.js' yield 'form_dependencies.js' yield 'confirm.jsx' yield 'typeahead.jsx' diff --git a/src/onegov/org/assets/js/confirm.jsx b/src/onegov/org/assets/js/confirm.jsx index 9588087f9a..29548b516a 100644 --- a/src/onegov/org/assets/js/confirm.jsx +++ b/src/onegov/org/assets/js/confirm.jsx @@ -21,7 +21,7 @@ Renders the zurb foundation reveal model. Takes question, yes and no as options (those are the texts for the respective elements). */ -var Confirmation = React.createClass({ +var Confirmation = createReactClass({ render: function() { return (
@@ -42,7 +42,7 @@ var Confirmation = React.createClass({ The confirmation, if no 'yes' button is supplied (to inform the user why some action can't be taken). */ -var DenyConfirmation = React.createClass({ +var DenyConfirmation = createReactClass({ render: function() { return (
diff --git a/src/onegov/org/assets/js/create-react-class.min.js b/src/onegov/org/assets/js/create-react-class.min.js new file mode 100644 index 0000000000..8d89e92727 --- /dev/null +++ b/src/onegov/org/assets/js/create-react-class.min.js @@ -0,0 +1 @@ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.createReactClass=e(require("react")):t.createReactClass=e(t.React)}(this,function(t){return function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=2)}([function(t,e,n){"use strict";function o(t){return t}function r(t,e,n){function r(t,e){var n=N.hasOwnProperty(e)?N[e]:null;b.hasOwnProperty(e)&&s("OVERRIDE_BASE"===n,"ReactClassInterface: You are attempting to override `%s` from your class specification. Ensure that your method names do not overlap with React methods.",e),t&&s("DEFINE_MANY"===n||"DEFINE_MANY_MERGED"===n,"ReactClassInterface: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",e)}function u(t,n){if(n){s("function"!=typeof n,"ReactClass: You're attempting to use a component class or function as a mixin. Instead, just use a regular object."),s(!e(n),"ReactClass: You're attempting to use a component as a mixin. Instead, just use a regular object.");var o=t.prototype,i=o.__reactAutoBindPairs;n.hasOwnProperty(c)&&g.mixins(t,n.mixins);for(var a in n)if(n.hasOwnProperty(a)&&a!==c){var u=n[a],p=o.hasOwnProperty(a);if(r(p,a),g.hasOwnProperty(a))g[a](t,u);else{var l=N.hasOwnProperty(a),E="function"==typeof u,m=E&&!l&&!p&&!1!==n.autobind;if(m)i.push(a,u),o[a]=u;else if(p){var h=N[a];s(l&&("DEFINE_MANY_MERGED"===h||"DEFINE_MANY"===h),"ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.",h,a),"DEFINE_MANY_MERGED"===h?o[a]=f(o[a],u):"DEFINE_MANY"===h&&(o[a]=d(o[a],u))}else o[a]=u}}}else;}function p(t,e){if(e)for(var n in e){var o=e[n];if(e.hasOwnProperty(n)){var r=n in g;s(!r,'ReactClass: You are attempting to define a reserved property, `%s`, that shouldn\'t be on the "statics" key. Define it as an instance property instead; it will still be accessible on the constructor.',n);var i=n in t;if(i){var a=_.hasOwnProperty(n)?_[n]:null;return s("DEFINE_MANY_MERGED"===a,"ReactClass: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.",n),void(t[n]=f(t[n],o))}t[n]=o}}}function l(t,e){s(t&&e&&"object"==typeof t&&"object"==typeof e,"mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.");for(var n in e)e.hasOwnProperty(n)&&(s(void 0===t[n],"mergeIntoWithNoDuplicateKeys(): Tried to merge two objects with the same key: `%s`. This conflict may be due to a mixin; in particular, this may be caused by two getInitialState() or getDefaultProps() methods returning objects with clashing keys.",n),t[n]=e[n]);return t}function f(t,e){return function(){var n=t.apply(this,arguments),o=e.apply(this,arguments);if(null==n)return o;if(null==o)return n;var r={};return l(r,n),l(r,o),r}}function d(t,e){return function(){t.apply(this,arguments),e.apply(this,arguments)}}function E(t,e){var n=e.bind(t);return n}function m(t){for(var e=t.__reactAutoBindPairs,n=0;n @@ -33,7 +33,7 @@ var ManyFields = React.createClass({ } }); -var ManyDates = React.createClass({ +var ManyDates = createReactClass({ getInitialState: function() { var state = { values: _.clone(this.props.data.values) @@ -132,7 +132,7 @@ var ManyDates = React.createClass({ } }); -var ManyDateTimeRanges = React.createClass({ +var ManyDateTimeRanges = createReactClass({ getInitialState: function() { var state = { values: _.clone(this.props.data.values) @@ -245,7 +245,7 @@ var ManyDateTimeRanges = React.createClass({ } }); -var DateTimePickerField = React.createClass({ +var DateTimePickerField = createReactClass({ componentWillMount: function() { this.id = _.uniqueId(this.props.type + '-'); }, @@ -295,7 +295,7 @@ var DateTimePickerField = React.createClass({ } }); -var ManyLinks = React.createClass({ +var ManyLinks = createReactClass({ getInitialState: function() { var state = { values: _.clone(this.props.data.values) @@ -408,7 +408,7 @@ var ManyLinks = React.createClass({ } }); -var StringField = React.createClass({ +var StringField = createReactClass({ componentWillMount: function() { this.id = _.uniqueId(this.props.type + '-'); }, diff --git a/src/onegov/org/assets/js/monthly-view.jsx b/src/onegov/org/assets/js/monthly-view.jsx index 916ebfa863..cb50320ec9 100644 --- a/src/onegov/org/assets/js/monthly-view.jsx +++ b/src/onegov/org/assets/js/monthly-view.jsx @@ -71,7 +71,7 @@ var BUTTON_LABELS = { } }; -var MonthlyView = React.createClass({ +var MonthlyView = createReactClass({ render: function() { var locale = $('html').attr('lang').substring(0, 2); diff --git a/src/onegov/org/assets/js/prompt.jsx b/src/onegov/org/assets/js/prompt.jsx index eae183af44..fc9470d5bf 100644 --- a/src/onegov/org/assets/js/prompt.jsx +++ b/src/onegov/org/assets/js/prompt.jsx @@ -17,7 +17,7 @@ Renders the zurb foundation reveal model. Takes question, yes and no as options (those are the texts for the respective elements). */ -var Prompt = React.createClass({ +var Prompt = createReactClass({ getInitialState: function() { return { @@ -31,7 +31,7 @@ var Prompt = React.createClass({ render: function() { return ( -
+

{this.props.question}

{this.props.info}

@@ -58,7 +58,10 @@ var Prompt = React.createClass({ */ var showPrompt = function(options) { var el = $("
"); - + var dialog = $("
") + dialog.attr('data-reveal', "") + dialog.attr('role', "dialog") + dialog.appendTo(el) $('body').append(el); var prompt = ReactDOM.render( @@ -70,33 +73,31 @@ var showPrompt = function(options) { value={options.value} placeholder={options.placeholder} />, - el.get(0) + dialog.get(0) ); - var prompt_el = $(ReactDOM.findDOMNode(prompt)); - - prompt_el.find('a.cancel').click(function() { - dropPrompt(prompt_el); + dialog.find('a.cancel').click(function() { + dropPrompt(dialog); return false; }); - prompt_el.find('a.ok').click(function() { + dialog.find('a.ok').click(function() { options.success.call(options.target, prompt.state.value.trim()); - dropPrompt(prompt_el); + dropPrompt(dialog); return false; }); - prompt_el.find('input, a.ok').enter(function(e) { + dialog.find('input, a.ok').enter(function(e) { options.success.call(options.target, prompt.state.value.trim()); - dropPrompt(prompt_el); + dropPrompt(dialog); return false; }); $('body').one('opened.fndtn.reveal', function() { - prompt_el.find('input').focus().select(); + dialog.find('input').focus().select(); }); - prompt_el.foundation('reveal', 'open'); + dialog.foundation('reveal', 'open'); }; var dropPrompt = function(el) { diff --git a/src/onegov/org/assets/js/react-dom.js b/src/onegov/org/assets/js/react-dom.js index 9c8699b683..aadc619790 100644 --- a/src/onegov/org/assets/js/react-dom.js +++ b/src/onegov/org/assets/js/react-dom.js @@ -1,42 +1,29869 @@ /** - * ReactDOM v15.3.2 + * @license React + * react-dom.development.js * - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * Copyright (c) Facebook, Inc. and its affiliates. * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. */ -// Based off https://github.com/ForbesLindesay/umd/blob/master/template.js -;(function(f) { - // CommonJS - if (typeof exports === "object" && typeof module !== "undefined") { - module.exports = f(require('react')); - - // RequireJS - } else if (typeof define === "function" && define.amd) { - define(['react'], f); - - //