From 96899839061f53ee80745ab045d5b09cdb2a1556 Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Tue, 15 May 2018 17:51:16 -0400 Subject: [PATCH 01/44] WIP --- package.json | 1 + src/Field.js | 1 + src/Form.js | 45 ++++--- src/FormContext.js | 301 +++++++++++++++++++++++++------------------ src/FormState.js | 54 ++++++++ src/FormTrigger.js | 218 ++++++++++++++++++------------- src/Message.js | 40 +++++- test/Context.spec.js | 87 ++++++++++++- yarn.lock | 14 ++ 9 files changed, 521 insertions(+), 240 deletions(-) create mode 100644 src/FormState.js diff --git a/package.json b/package.json index e9d7b84..a674a2d 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "dependencies": { "chain-function": "^1.0.0", "classnames": "^2.2.5", + "immer": "^1.3.0", "invariant": "^2.2.4", "lodash": "^4.17.10", "prop-types": "^15.6.1", diff --git a/src/Field.js b/src/Field.js index e97a5c6..9bb3d6a 100644 --- a/src/Field.js +++ b/src/Field.js @@ -103,6 +103,7 @@ class Field extends React.PureComponent { } constructComponent = (bindingProps, triggerMeta = {}) => { + console.log('trigger', triggerMeta) let { formContext } = this let { name, diff --git a/src/Form.js b/src/Form.js index 7db5752..f25ba51 100644 --- a/src/Form.js +++ b/src/Form.js @@ -13,7 +13,7 @@ import errorManager from './errorManager' import errToJSON from './utils/errToJSON' import * as ErrorUtils from './utils/ErrorUtils' -import FormContext from './FormContext' +import FormContext, { withPublish } from './FormContext' let BindingContext = BC.ControlledComponent @@ -372,19 +372,21 @@ class Form extends React.PureComponent { }, } - props.publish('messages', props.errors) - props.publish('groups', this.groups) - props.publish('form', { - onSubmit: this.handleSubmit, - onValidate: this.handleValidationRequest, - addToGroup: (name, grpName) => { - let group = this.groups[grpName] || (this.groups[grpName] = []) - if (group.indexOf(name) !== -1) return - - group.push(name) - setTimeout(() => props.publish('groups', this.groups)) - return () => name => group.filter(i => i !== name) - }, + props.publish(state => { + state.messages = props.errors + state.groups = this.groups + state.form = { + onSubmit: this.handleSubmit, + onValidate: this.handleValidationRequest, + addToGroup: (name, grpName) => + props.publish(state => { + let group = state.groups[grpName] || (state.groups[grpName] = []) + if (group.indexOf(name) !== -1) return + + group.push(name) + return () => name => group.filter(i => i !== name) + }), + } }) } @@ -392,7 +394,10 @@ class Form extends React.PureComponent { const { errors, publish, delay, schema } = this.props const schemaChanged = schema !== prevProps.schema - if (errors !== prevProps.errors) publish('messages', errors) + if (errors !== prevProps.errors) + publish(state => { + state.messages = errors + }) if (schemaChanged) { this.enqueue(Object.keys(errors || {})) @@ -520,7 +525,9 @@ class Form extends React.PureComponent { setSubmitting(submitting) { if (this.unmounted) return - this.props.publish('submitting', submitting) + this.props.publish(s => { + s.submitting = submitting + }) } notify(event, ...args) { @@ -589,7 +596,7 @@ class Form extends React.PureComponent { } } -const PolyFilledForm = polyfill(Form) +let DecoratedForm = withPublish(polyfill(Form)) function maybeWarn(debug, errors, target) { if (!debug) return @@ -610,9 +617,7 @@ const ControlledForm = uncontrollable( */ React.forwardRef((props, ref) => ( - - {publish => } - + )), { diff --git a/src/FormContext.js b/src/FormContext.js index 3436323..d287b62 100644 --- a/src/FormContext.js +++ b/src/FormContext.js @@ -1,171 +1,224 @@ import PropTypes from 'prop-types' import React from 'react' +import produce from 'immer' +import mapContextToProps from 'react-context-toolbox/lib/mapContextToProps' import { Consumer as FormConsumer } from './Form' export const DEFAULT_CHANNEL = '@@parent' -const contextKey = `@@react-formal-subscription-key` -const contextTypes = () => {} - -const splitChannel = channel => channel.split(':') +// const ContextPublisher = React.createContext({ publish() {}, stop() {} }) +const State = React.createContext({}) class FormContext extends React.Component { - static contextTypes = { - [contextKey]: contextTypes, - } - static childContextTypes = { - [contextKey]: contextTypes, - } - constructor(...args) { super(...args) - this.data = new Map() - this.handlers = new Map() - - this.subscriptionContext = { + const publisher = { stop: (channel, propagateIfPossible) => { if (!this.shouldHandleChannel(channel, propagateIfPossible)) { return this.getParent().stop(channel) } - this.data.delete(channel) - const handlers = this.handlers.get(channel) - handlers && handlers.clear() + this.update(this.state, draft => { + draft.formState[channel] = null + }) }, - - publish: (channel, args, propagateIfPossible) => { + publish: (channel, fn, propagateIfPossible) => { if (!this.shouldHandleChannel(channel, propagateIfPossible)) return this.getParent().publish(channel, args) - this.data.set(channel, args) - const handlers = this.handlers.get(channel) - handlers && handlers.forEach(fn => fn(args)) + this.update(this.state, draft => { + draft.formState[channel] = draft.formState[channel] || {} + fn(draft.formState[channel]) + }) }, + } - get: channel => - this.data.has(channel) - ? this.data.get(channel) - : this.getParent() && this.getParent().get(channel), - - subscribe: (channel, handler) => { - if (!this.shouldHandleChannel(channel)) - return this.getParent().subscribe(channel, handler) + this.state = { + formState: {}, + combinedState: {}, + publisher, + } + } - const handlers = this.handlers.get(channel) || new Set() - if (!handlers.has(handler)) { - handlers.add(handler) - this.handlers.set(channel, handlers) - } - return () => handlers.delete(handler) + static getDerivededStateFromProps({ parentContext }, prevState) { + if (!parentContext) return + return { + parentContext, + combinedState: { + ...parentContext.combinedState, + ...prevState.formState, }, } } - getChildContext() { - return { [contextKey]: this.subscriptionContext } - } - getParent() { - return this.context[contextKey] - } - shouldHandleChannel(channel, force) { - const group = splitChannel(channel)[0] - return !this.getParent() || (group === DEFAULT_CHANNEL && !force) - } - render() { - if (typeof this.props.children === 'function') - return this.props.children(this.subscriptionContext) + update = (channel, fn) => { + const nextState = produce(this.state, draft => { + fn(draft) + if (!draft.parentContext) { + draft.combinedState = draft.formState + return + } - return this.props.children - } -} - -class Publisher extends React.Component { - static propTypes = { - group: PropTypes.string, - bubbles: PropTypes.bool, - } - static contextTypes = { - [contextKey]: contextTypes, - } + draft.combinedState = { + ...draft.parentContext.combinedState, + ...draft.formState, + } + }) - constructor(...args) { - super(...args) - this.group = this.props.group || DEFAULT_CHANNEL - this.bubbles = this.props.bubbles - this.channels = [] + if (nextState !== this.state) { + console.log('updating state', nextState) + this.setState(nextState) + } } - componentWillUnmount() { - if (!this.context[contextKey]) return - this.channels.forEach(channel => - this.context[contextKey].stop(channel, this.bubbles) - ) + getParent() { + return this.props.parentContext && this.props.parentContext.publisher } - publish = (key, args) => { - if (!this.context[contextKey]) return - - const channel = `${this.group}:${key}` - this.channels.push(channel) - this.context[contextKey].publish(channel, args, this.bubbles) + shouldHandleChannel(channel, force) { + return !this.getParent() || (channel === DEFAULT_CHANNEL && !force) } render() { - return this.props.children(this.publish) + console.log('Reeender', this.state) + return ( + {this.props.children} + ) } } -class Subscriber extends React.Component { - static propTypes = { - channels: PropTypes.array.isRequired, - formKey: PropTypes.oneOfType([ - PropTypes.string.isRequired, - PropTypes.array.isRequired, - ]), - } - - static contextTypes = { - [contextKey]: contextTypes, +export const withPublish = Component => + mapContextToProps( + State.Consumer, + ({ publisher }, props) => ({ + publish: fn => + publisher.publish(props.formKey || DEFAULT_CHANNEL, fn, true), + stop: () => publisher.stop(props.formKey || DEFAULT_CHANNEL, true), + }), + Component + ) + +class ConsumerIndirection extends React.Component { + shouldComponentUpdate({ state }) { + const currentState = this.props.state + return state.some((observedState, i) => observedState !== currentState[i]) } - componentWillUnmount() { - this.unmounted = true - this.subs && this.subs.forEach(fn => fn()) - } - update = () => { - if (!this.unmounted) this.forceUpdate() - } - subscribe(contextFormKey) { - if (this.subs || !this.context[contextKey]) return - const { formKey, channels } = this.props - - let key = formKey || contextFormKey || DEFAULT_CHANNEL - this.channels = [] - channels.map(channel => { - this.channels.push(`${key}:${channel}`) - this.context[contextKey].subscribe(`${key}:${channel}`, this.update) - }) - } - - get() { - if (!this.context[contextKey]) return [] - return this.channels.map(channel => this.context[contextKey].get(channel)) - } - render() { - return ( - - {({ formKey }) => { - this.subscribe(formKey) - return this.props.children(...this.get()) - }} - - ) + const { children, state } = this.props + return children(state) } } -FormContext.Publisher = Publisher -FormContext.Subscriber = Subscriber +export const withState = (render, selectors) => { + return React.forwardRef((props, ref) => ( + + {({ formKey }) => { + const key = props.formKey || formKey || DEFAULT_CHANNEL + return ( + + {fullState => + fullState.combinedState[key] ? ( + fn(fullState.combinedState[key]))} + > + {state => render(...state, props, ref)} + + ) : null + } + + ) + }} + + )) +} + +// class Publisher extends React.Component { +// static propTypes = { +// group: PropTypes.string, +// bubbles: PropTypes.bool, +// } +// static contextTypes = { +// [contextKey]: contextTypes, +// } + +// constructor(...args) { +// super(...args) +// this.group = this.props.group || DEFAULT_CHANNEL +// this.bubbles = this.props.bubbles +// this.channels = [] +// } + +// componentWillUnmount() { +// if (!this.context[contextKey]) return +// this.channels.forEach(channel => +// this.context[contextKey].stop(channel, this.bubbles) +// ) +// } + +// publish = (key, args) => { +// if (!this.context[contextKey]) return + +// const channel = `${this.group}:${key}` +// this.channels.push(channel) +// this.context[contextKey].publish(channel, args, this.bubbles) +// } + +// render() { +// return this.props.children(this.publish) +// } +// } + +// class Subscriber extends React.Component { +// static propTypes = { +// channels: PropTypes.array.isRequired, +// formKey: PropTypes.oneOfType([ +// PropTypes.string.isRequired, +// PropTypes.array.isRequired, +// ]), +// } + +// static contextTypes = { +// [contextKey]: contextTypes, +// } +// componentWillUnmount() { +// this.unmounted = true +// this.subs && this.subs.forEach(fn => fn()) +// } +// update = () => { +// if (!this.unmounted) this.forceUpdate() +// } +// subscribe(contextFormKey) { +// if (this.subs || !this.context[contextKey]) return +// const { formKey, channels } = this.props + +// let key = formKey || contextFormKey || DEFAULT_CHANNEL +// this.channels = [] +// channels.map(channel => { +// this.channels.push(`${key}:${channel}`) +// this.context[contextKey].subscribe(`${key}:${channel}`, this.update) +// }) +// } + +// get() { +// if (!this.context[contextKey]) return [] +// return this.channels.map(channel => this.context[contextKey].get(channel)) +// } + +// render() { +// return ( +// +// {({ formKey }) => { +// this.subscribe(formKey) +// return this.props.children(...this.get()) +// }} +// +// ) +// } +// } + +// FormContext.Publisher = Publisher +// FormContext.Subscriber = Subscriber export default FormContext diff --git a/src/FormState.js b/src/FormState.js new file mode 100644 index 0000000..a3a28e7 --- /dev/null +++ b/src/FormState.js @@ -0,0 +1,54 @@ +import React from 'react' +import produce from 'immer' + +const State = React.createContext() + +class ConsumerIndirection extends React.Component<> { + shouldComponentUpdate({ state }) { + const currentState = this.props.state + return state.some((observedState, i) => observedState !== currentState[i]) + } + render() { + const { children, state } = this.props + return children(...state) + } +} + +const Consumer = React.forwardRef(({ children, selector }) => ( + + {state => ( + fn(state))}> + {children} + + )} + +)) + +export const createState = listener => { + return function update(currentState, fn) { + const nextState = produce(currentState, fn) + if (nextState !== currentState) { + listener(currentState) + } + } + + // class Provider extends React.Component { + // state = initial + + // componentDidMount() { + // listener = () => { + // this.setState(currentState) + // } + // } + + // render() { + // return ( + // + // {this.props.children} + // + // ) + // } + // } + + // return { Provider, Consumer } +} diff --git a/src/FormTrigger.js b/src/FormTrigger.js index b24da29..090bc60 100644 --- a/src/FormTrigger.js +++ b/src/FormTrigger.js @@ -1,9 +1,8 @@ import PropTypes from 'prop-types' import React from 'react' -import createBridge from 'topeka/createChildBridge' import warning from 'warning' -import FormContext from './FormContext' +import { withState } from './FormContext' import { filterAndMapMessages, namesForGroup } from './utils/ErrorUtils' let stringOrArrayOfStrings = PropTypes.oneOfType([ @@ -13,94 +12,133 @@ let stringOrArrayOfStrings = PropTypes.oneOfType([ const channels = ['messages', 'groups', 'form', 'submitting'] -class FormTrigger extends React.Component { - static propTypes = { - formKey: PropTypes.string, - - noValidate: PropTypes.bool.isRequired, - events: stringOrArrayOfStrings, - for: PropTypes.string, - triggers: PropTypes.arrayOf(PropTypes.string), - - mapMessages: PropTypes.func, - children: PropTypes.oneOfType([PropTypes.func, PropTypes.element]), - - group: stringOrArrayOfStrings, - } - - static defaultProps = { - events: 'onChange', - noValidate: false, - } - - constructor(...args) { - super(...args) - - this.getBridgeProps = createBridge(this.handleEvent) - } - - componentWillUnmount() { - this.removeFromGroup && this.removeFromGroup() - } - - handleEvent = (event, ...args) => { - let { noValidate, formKey, triggers, group } = this.props - - let names = triggers || this.names - if (noValidate || !names) return - - if (!this.form) { - return warning( - false, - (group === '@submit' - ? 'A Form submit event ' - : `A validation for ${names} `) + - `was triggered from a component outside the context of a Form. ` + - `The Field, Button, or Trigger should be wrapped in a Form or Form.Context component` + - (formKey ? ` with the formKey: "${formKey}" ` : '.') - ) +// class FormTrigger extends React.Component { +// static propTypes = { +// formKey: PropTypes.string, + +// noValidate: PropTypes.bool.isRequired, +// events: stringOrArrayOfStrings, +// for: PropTypes.string, +// triggers: PropTypes.arrayOf(PropTypes.string), + +// mapMessages: PropTypes.func, +// children: PropTypes.oneOfType([PropTypes.func, PropTypes.element]), + +// group: stringOrArrayOfStrings, +// } + +// static defaultProps = { +// events: 'onChange', +// noValidate: false, +// } + +// constructor(...args) { +// super(...args) + +// this.getBridgeProps = createBridge(this.handleEvent) +// } + +// componentWillUnmount() { +// this.removeFromGroup && this.removeFromGroup() +// } + +// handleEvent = (event, ...args) => { +// let { noValidate, formKey, triggers, group } = this.props + +// let names = triggers || this.names +// if (noValidate || !names) return + +// if (!this.form) { +// return warning( +// false, +// (group === '@submit' +// ? 'A Form submit event ' +// : `A validation for ${names} `) + +// `was triggered from a component outside the context of a Form. ` + +// `The Field, Button, or Trigger should be wrapped in a Form or Form.Context component` + +// (formKey ? ` with the formKey: "${formKey}" ` : '.') +// ) +// } + +// if (group === '@submit') return this.form.onSubmit() + +// this.form.onValidate(names, event, args) +// } + +// render() { +// let { for: names, messages, submitting, events } = this.props + +// return ( +// +// {(messages, groups, form, submitting) => { +// if ( +// form && +// !this.removeFromGroup && +// name && +// group && +// group !== '@submit' +// ) { +// this.removeFromGroup = form.addToGroup(name, group) +// } + +// this.form = form +// this.names = name || namesForGroup(group, groups) +// messages = this.submitting = !!submitting + +// return this.props.children({ +// props: this.getBridgeProps(this.props.events), +// submitting, +// messages, +// }) +// }} +// +// ) +// } +// } + +export default withState((messages, groups, form, submitting, props, ref) => { + const { + for: name, + group, + formKey, + noValidate, + triggers, + mapMessages, + events, + } = props + const names = name || namesForGroup(group, groups) + + const eventHandlers = {} + for (const event of events) { + eventHandlers[event] = (...args) => { + let fieldsToValidate = triggers || names + if (noValidate || !fieldsToValidate) return + + if (!form) { + return warning( + false, + (group === '@submit' + ? 'A Form submit event ' + : `A validation for ${fieldsToValidate} `) + + `was triggered from a component outside the context of a Form. ` + + `The Field, Button, or Trigger should be wrapped in a Form or Form.Context component` + + (formKey ? ` with the formKey: "${formKey}" ` : '.') + ) + } + + if (group === '@submit') return form.onSubmit() + form.onValidate(fieldsToValidate, event, args) } - - if (group === '@submit') return this.form.onSubmit() - - this.form.onValidate(names, event, args) - } - - render() { - let { for: name, group, mapMessages, formKey } = this.props - - return ( - - {(messages, groups, form, submitting) => { - if ( - form && - !this.removeFromGroup && - name && - group && - group !== '@submit' - ) { - this.removeFromGroup = form.addToGroup(name, group) - } - - this.form = form - this.names = name || namesForGroup(group, groups) - this.messages = filterAndMapMessages({ - messages, - mapMessages, - names: this.names, - }) - - this.submitting = !!submitting - - return this.props.children({ - props: this.getBridgeProps(this.props.events), - messages: this.messages || {}, - submitting: this.submitting, - }) - }} - - ) } -} -export default FormTrigger + return props.children({ + submitting, + props: eventHandlers, + messages: + filterAndMapMessages({ + names, + messages, + mapMessages, + }) || {}, + }) +}, channels.map(c => s => s[c])) diff --git a/src/Message.js b/src/Message.js index e85cbe3..be9a9d0 100644 --- a/src/Message.js +++ b/src/Message.js @@ -4,7 +4,7 @@ import cn from 'classnames' import uniq from './utils/uniqMessage' import { filterAndMapMessages, namesForGroup } from './utils/ErrorUtils' -import FormContext from './FormContext' +import { withState } from './FormContext' let flatten = (arr, next) => arr.concat(next) const channels = ['messages', 'groups'] @@ -97,4 +97,40 @@ class Message extends React.PureComponent { } } -export default Message +function render( + messages, + groups, + { + for: names, + group, + className, + errorClass, + extract, + filter, + children, + ...props + } +) { + messages = filterAndMapMessages({ + messages, + names: names || namesForGroup(group, groups), + }) + + if (!messages || !Object.keys(messages).length) return null + + return children( + Object.values(messages) + .reduce(flatten, []) + .filter((...args) => filter(...args, extract)) + .map(extract), + { + ...props, + className: cn(className, errorClass), + } + ) +} + +export default withState(render, [ + state => state.messages, + state => state.groups, +]) diff --git a/test/Context.spec.js b/test/Context.spec.js index c611719..6b08126 100644 --- a/test/Context.spec.js +++ b/test/Context.spec.js @@ -7,6 +7,7 @@ import Form from '../src' describe('Form Context', () => { let schema = yup.object({ name: yup.string().default(''), + other: yup.string().default(''), }) it('should simulate an onSubmit in the Form', function(done) { @@ -24,7 +25,7 @@ describe('Form Context', () => { .simulate('click') }) - it('should simulate an onSubmit from outside the form', function(done) { + it.only('should simulate an onSubmit from outside the form', function(done) { mount(
{ .simulate('click') }) + it('should not conflate unkeyed forms', function(done) { + mount( + + setTimeout(done, 10))} + > + + + + +
done(new Error('ooops')))} + schema={schema} + defaultValue={{}} + > + + +
+ ) + .find(Form.Button) + .simulate('click') + }) + + it('should not submit multiple unkeyed forms (last wins)', function(done) { + mount( + +
done(new Error('ooops')))} + schema={schema} + defaultValue={{}} + > + + + +
setTimeout(done, 10))} + > + + + + +
+ ) + .find(Form.Button) + .simulate('click') + }) + it('should not conflate unkeyed forms in different trees', done => { + mount( +
+ +
done(new Error('ooops')))} + schema={schema} + defaultValue={{}} + > + + +
+ + +
setTimeout(done, 10))} + > + + + +
+
+ ) + .find(Form.Button) + .simulate('click') + }) + it('should simulate an onSubmit in correct Form', function(done) { mount( @@ -110,11 +190,10 @@ describe('Form Context', () => { .simulate('click') setTimeout(() => { - stub.should.have.been.calledOnce(); - stub.restore(); + stub.should.have.been.calledOnce() + stub.restore() done() }, 10) - }) it('should fall-through to next context', done => { diff --git a/yarn.lock b/yarn.lock index 3d1c9b3..606664c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4069,6 +4069,10 @@ image-size@~0.5.0: version "0.5.5" resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.5.5.tgz#09dfd4ab9d20e29eb1c3e80b8990378df9e3cb9c" +immer@^1.2.1, immer@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/immer/-/immer-1.3.0.tgz#b5c462dad2a129ad909eb4a180de63ffaa348d12" + import-loader@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/import-loader/-/import-loader-1.0.1.tgz#73f1a8400f4e928051b4d9a6754dff4c0ba2bab4" @@ -6805,6 +6809,16 @@ react-component-metadata@^3.0.0: babylon "^6.7.0" lodash "^3.8.0" +"react-context-toolbox@file:../4c-context": + version "0.0.0-development" + +react-copy-write@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/react-copy-write/-/react-copy-write-0.1.0.tgz#6de986210199d2af615641cd67b54ad145a40d4b" + dependencies: + immer "^1.2.1" + invariant "^2.2.4" + react-docgen@^2.20.0: version "2.20.0" resolved "https://registry.yarnpkg.com/react-docgen/-/react-docgen-2.20.0.tgz#41a6da483a34a4aaed041a9909f5e61864d681cb" From 1b9f955a1558f83adbb6bce3c224585d9aaa20a4 Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Tue, 19 Jun 2018 16:47:33 -0400 Subject: [PATCH 02/44] WIP --- package.json | 6 +- src/Field.js | 133 +++++++------------ src/Form.js | 107 ++++++---------- src/FormContext.js | 277 +++++++++++++++++----------------------- src/FormTrigger.js | 245 +++++++++++++++++++---------------- src/Message.js | 38 ++---- src/utils/ErrorUtils.js | 16 +-- test/Context.spec.js | 7 +- test/Field.spec.js | 7 +- test/Form.spec.js | 2 +- test/Trigger.spec.js | 23 ++-- yarn.lock | 30 ++--- 12 files changed, 394 insertions(+), 497 deletions(-) diff --git a/package.json b/package.json index a674a2d..6c8b01e 100644 --- a/package.json +++ b/package.json @@ -56,8 +56,10 @@ "immer": "^1.3.0", "invariant": "^2.2.4", "lodash": "^4.17.10", + "memoize-one": "^3.1.1", "prop-types": "^15.6.1", "property-expr": "^1.4.0", + "react-context-toolbox": "^1.1.0", "react-lifecycles-compat": "^3.0.4", "topeka": "^3.0.2", "uncontrollable": "^6.0.0", @@ -90,10 +92,10 @@ "markdown-jsx-loader": "^3.0.2", "marked": "^0.4.0", "prismjs": "^1.14.0", - "react": "^16.4.0", + "react": "^16.4.1", "react-bootstrap": "^0.32.1", "react-component-metadata": "^3.0.0", - "react-dom": "^16.4.0", + "react-dom": "^16.4.1", "react-formal": "^0.28.2", "react-router": "^4.2.0", "react-router-dom": "^4.2.2", diff --git a/src/Field.js b/src/Field.js index 9bb3d6a..b6a53a4 100644 --- a/src/Field.js +++ b/src/Field.js @@ -10,7 +10,8 @@ import { Consumer } from './Form' import isNativeType from './utils/isNativeType' import resolveFieldComponent from './utils/resolveFieldComponent' import FormTrigger from './FormTrigger' -import { inclusiveMapMessages } from './utils/ErrorUtils' +import { inclusiveMapMessages, filterAndMapMessages } from './utils/ErrorUtils' +import { withState } from './FormContext' function notify(handler, args) { handler && handler(...args) @@ -103,7 +104,6 @@ class Field extends React.PureComponent { } constructComponent = (bindingProps, triggerMeta = {}) => { - console.log('trigger', triggerMeta) let { formContext } = this let { name, @@ -157,6 +157,8 @@ class Field extends React.PureComponent { } if (this.shouldValidate()) { + // console.log('trigger', triggerMeta) + let messages = triggerMeta.messages let invalid = messages && !!Object.keys(messages).length @@ -180,57 +182,45 @@ class Field extends React.PureComponent { } render() { + let { + name, + exclusive, + mapFromValue, + alsoValidates, + events = config.events, + } = this.props + + let mapMessages = !exclusive ? inclusiveMapMessages : undefined + + if (typeof mapFromValue !== 'object') + mapFromValue = { [name]: mapFromValue } + + if (!this.shouldValidate()) { + return ( + + {this.constructComponent} + + ) + } + + let triggers + if (alsoValidates != null) { + triggers = [name].concat(alsoValidates) + } + return ( - - {formContext => { - let { - name, - group, - exclusive, - mapFromValue, - alsoValidates, - events = config.events, - } = this.props - - this.formContext = formContext - - let mapMessages = !exclusive ? inclusiveMapMessages : undefined - - if (typeof mapFromValue !== 'object') - mapFromValue = { [name]: mapFromValue } - - if (!this.shouldValidate()) { - return ( - - {this.constructComponent} - - ) - } - - let triggers - if (alsoValidates != null) { - triggers = [name].concat(alsoValidates) - } - - return ( - - {bindingProps => ( - - {triggerMeta => - this.constructComponent(bindingProps, triggerMeta) - } - - )} - - ) - }} - + + {bindingProps => ( + + {triggerMeta => this.constructComponent(bindingProps, triggerMeta)} + + )} + ) } @@ -260,41 +250,6 @@ Field.propTypes = { */ name: PropTypes.string.isRequired, - /** - * Group Fields together with a common `group` name. Groups can be - * validated together, helpful for multi-part forms. - * - * ```editable - *
- * - * - * - * - * - * - * - * - * Validate Name - * - * - * ``` - */ - group: PropTypes.string, - /** * The Component Input the form should render. You can sepcify a builtin type * with a string name e.g `'text'`, `'datetime-local'`, etc. or provide a Component @@ -484,3 +439,7 @@ Field.propTypes = { export default React.forwardRef((props, ref) => ( )) +// const _st = {} +// withState({ messages, submitting }) => { + +// }, state => state || _st) diff --git a/src/Form.js b/src/Form.js index f25ba51..faa16b2 100644 --- a/src/Form.js +++ b/src/Form.js @@ -30,13 +30,6 @@ let splitPath = path => { let isValidationError = err => err && err.name === 'ValidationError' -export const { Provider, Consumer } = React.createContext({ - context: null, - noValidate: false, - onFieldError() {}, - getSchemaForPath() {}, -}) - const YUP_OPTIONS = [ 'context', 'stripUnknown', @@ -334,24 +327,13 @@ class Form extends React.PureComponent { setter, } - static getDerivedStateFromProps( - { formKey, schema, context, noValidate }, - prevState - ) { + static getDerivedStateFromProps({ schema, noValidate }, prevState) { if (schema === prevState.schema && prevState.noValidate === noValidate) return null - const { getSchemaForPath, onFieldError } = prevState.formContext return { schema, noValidate, - formContext: { - getSchemaForPath, - onFieldError, - formKey, - context, - noValidate, - }, } } @@ -359,35 +341,20 @@ class Form extends React.PureComponent { super(props, context) this.queue = [] - this.groups = Object.create(null) this.errors = errorManager(this.validatePath) - this.state = { - formContext: { - formKey: props.formKey, - getSchemaForPath: this.getSchemaForPath, - onFieldError: this.handleFieldError, - noValidate: props.noValidate, - context: props.context, - }, - } - - props.publish(state => { - state.messages = props.errors - state.groups = this.groups - state.form = { - onSubmit: this.handleSubmit, - onValidate: this.handleValidationRequest, - addToGroup: (name, grpName) => - props.publish(state => { - let group = state.groups[grpName] || (state.groups[grpName] = []) - if (group.indexOf(name) !== -1) return - - group.push(name) - return () => name => group.filter(i => i !== name) - }), - } - }) + this.state = {} + + props.publish(state => ({ + ...state, + messages: props.errors, + context: props.context, + noValidate: false, + onSubmit: this.handleSubmit, + onValidate: this.handleValidationRequest, + onFieldError: this.handleFieldError, + getSchemaForPath: this.getSchemaForPath, + })) } componentDidUpdate(prevProps) { @@ -395,9 +362,10 @@ class Form extends React.PureComponent { const schemaChanged = schema !== prevProps.schema if (errors !== prevProps.errors) - publish(state => { - state.messages = errors - }) + publish(state => ({ + ...state, + messages: errors, + })) if (schemaChanged) { this.enqueue(Object.keys(errors || {})) @@ -525,9 +493,9 @@ class Form extends React.PureComponent { setSubmitting(submitting) { if (this.unmounted) return - this.props.publish(s => { - s.submitting = submitting - }) + this.props.publish( + s => (s.submitting === submitting ? s : { ...s, submitting }) + ) } notify(event, ...args) { @@ -568,6 +536,8 @@ class Form extends React.PureComponent { let props = omit(this.props, [ ...YUP_OPTIONS, ...Object.keys(Form.propTypes), + 'stop', + 'publish', ]) delete props.publish @@ -582,21 +552,19 @@ class Form extends React.PureComponent { children = {children} } return ( - - - {children} - - + + {children} + ) } } -let DecoratedForm = withPublish(polyfill(Form)) +polyfill(Form) function maybeWarn(debug, errors, target) { if (!debug) return @@ -615,11 +583,14 @@ const ControlledForm = uncontrollable( * Wraps each Form in it's own Context, so it can pass context state to * it's own children. */ - React.forwardRef((props, ref) => ( - - - - )), + React.forwardRef((props, ref) => { + const key = props.formKey + return ( + + {publish =>
} + + ) + }), { value: 'onChange', errors: 'onError', diff --git a/src/FormContext.js b/src/FormContext.js index d287b62..8e4dbb6 100644 --- a/src/FormContext.js +++ b/src/FormContext.js @@ -1,51 +1,41 @@ import PropTypes from 'prop-types' import React from 'react' -import produce from 'immer' import mapContextToProps from 'react-context-toolbox/lib/mapContextToProps' +import forwardRef from 'react-context-toolbox/lib/forwardRef' -import { Consumer as FormConsumer } from './Form' +// import { Consumer as FormConsumer } from './Form' export const DEFAULT_CHANNEL = '@@parent' -// const ContextPublisher = React.createContext({ publish() {}, stop() {} }) -const State = React.createContext({}) - +const State = React.createContext(/*{ + formState: {}, + combinedState: {}, +} */) +let id = 0 class FormContext extends React.Component { constructor(...args) { super(...args) - - const publisher = { - stop: (channel, propagateIfPossible) => { - if (!this.shouldHandleChannel(channel, propagateIfPossible)) { - return this.getParent().stop(channel) - } - - this.update(this.state, draft => { - draft.formState[channel] = null - }) - }, - publish: (channel, fn, propagateIfPossible) => { - if (!this.shouldHandleChannel(channel, propagateIfPossible)) - return this.getParent().publish(channel, args) - - this.update(this.state, draft => { - draft.formState[channel] = draft.formState[channel] || {} - fn(draft.formState[channel]) - }) - }, - } + this.id = id++ this.state = { formState: {}, combinedState: {}, - publisher, + update: this.update, + defaultKey: this.props.defaultKey || DEFAULT_CHANNEL, } } - static getDerivededStateFromProps({ parentContext }, prevState) { - if (!parentContext) return + static getDerivedStateFromProps( + { parentContext, defaultKey = DEFAULT_CHANNEL }, + prevState + ) { + if (!parentContext) + return { + combinedState: prevState.formState, + } + return { - parentContext, + defaultKey, combinedState: { ...parentContext.combinedState, ...prevState.formState, @@ -53,38 +43,47 @@ class FormContext extends React.Component { } } - update = (channel, fn) => { - const nextState = produce(this.state, draft => { - fn(draft) - if (!draft.parentContext) { - draft.combinedState = draft.formState - return - } + getParent() { + return this.props.parentContext && this.props.parentContext.publisher + } - draft.combinedState = { - ...draft.parentContext.combinedState, - ...draft.formState, - } - }) + update = (channel, fn, propagateIfPossible) => { + const { parentContext } = this.props - if (nextState !== this.state) { - console.log('updating state', nextState) - this.setState(nextState) + if (parentContext) { + parentContext.update(channel, fn, false) + + if (!propagateIfPossible) return + // console.log('publish to parent', this.id) } - } - getParent() { - return this.props.parentContext && this.props.parentContext.publisher + this.setState(({ formState }) => { + const channelState = formState[channel] + const nextChannelState = fn(channelState || {}) + // TODO: optimize the nullish case + if (nextChannelState === channelState) return null + // console.log(this.id, 'updating for channel: ', channel) + return { + formState: { + ...formState, + [channel]: nextChannelState, + }, + } + }) } - shouldHandleChannel(channel, force) { - return !this.getParent() || (channel === DEFAULT_CHANNEL && !force) + publish = fn => { + this.update(this.props.defaultKey || DEFAULT_CHANNEL, fn, true) } render() { - console.log('Reeender', this.state) + // console.log('Reeender', this.id) return ( - {this.props.children} + + {typeof this.props.children === 'function' + ? this.props.children(this.publish) + : this.props.children} + ) } } @@ -95,7 +94,6 @@ export const withPublish = Component => ({ publisher }, props) => ({ publish: fn => publisher.publish(props.formKey || DEFAULT_CHANNEL, fn, true), - stop: () => publisher.stop(props.formKey || DEFAULT_CHANNEL, true), }), Component ) @@ -106,119 +104,72 @@ class ConsumerIndirection extends React.Component { return state.some((observedState, i) => observedState !== currentState[i]) } render() { - const { children, state } = this.props + const { + children, + state, + Component, + mapToProps, + innerRef, + props, + } = this.props + if (Component) + return + return children(state) } } -export const withState = (render, selectors) => { - return React.forwardRef((props, ref) => ( - - {({ formKey }) => { - const key = props.formKey || formKey || DEFAULT_CHANNEL - return ( - - {fullState => - fullState.combinedState[key] ? ( - fn(fullState.combinedState[key]))} - > - {state => render(...state, props, ref)} - - ) : null - } - - ) - }} - - )) +export const withState = (render, selectors, { displayName, ...rest } = {}) => { + const fn = (props, ref) => { + return ( + + {context => { + const key = + props.formKey || (context ? context.defaultKey : DEFAULT_CHANNEL) + const state = context && context.combinedState[key] + + return ( + fn(state, props))}> + {state => render(...state, props, ref)} + + ) + }} + + ) + } + fn.displayName = displayName + return Object.assign(React.forwardRef(fn), rest) +} + +export const withState2 = (Component, selectors, mapToProps, staticProps) => { + return forwardRef((props, ref) => { + return ( + + {context => { + const key = + props.formKey || (context ? context.defaultKey : DEFAULT_CHANNEL) + + const state = selectors.map(fn => + fn(context && context.combinedState[key], props) + ) + + return ( + + ) + }} + + ) + }, staticProps) } -// class Publisher extends React.Component { -// static propTypes = { -// group: PropTypes.string, -// bubbles: PropTypes.bool, -// } -// static contextTypes = { -// [contextKey]: contextTypes, -// } - -// constructor(...args) { -// super(...args) -// this.group = this.props.group || DEFAULT_CHANNEL -// this.bubbles = this.props.bubbles -// this.channels = [] -// } - -// componentWillUnmount() { -// if (!this.context[contextKey]) return -// this.channels.forEach(channel => -// this.context[contextKey].stop(channel, this.bubbles) -// ) -// } - -// publish = (key, args) => { -// if (!this.context[contextKey]) return - -// const channel = `${this.group}:${key}` -// this.channels.push(channel) -// this.context[contextKey].publish(channel, args, this.bubbles) -// } - -// render() { -// return this.props.children(this.publish) -// } -// } - -// class Subscriber extends React.Component { -// static propTypes = { -// channels: PropTypes.array.isRequired, -// formKey: PropTypes.oneOfType([ -// PropTypes.string.isRequired, -// PropTypes.array.isRequired, -// ]), -// } - -// static contextTypes = { -// [contextKey]: contextTypes, -// } -// componentWillUnmount() { -// this.unmounted = true -// this.subs && this.subs.forEach(fn => fn()) -// } -// update = () => { -// if (!this.unmounted) this.forceUpdate() -// } -// subscribe(contextFormKey) { -// if (this.subs || !this.context[contextKey]) return -// const { formKey, channels } = this.props - -// let key = formKey || contextFormKey || DEFAULT_CHANNEL -// this.channels = [] -// channels.map(channel => { -// this.channels.push(`${key}:${channel}`) -// this.context[contextKey].subscribe(`${key}:${channel}`, this.update) -// }) -// } - -// get() { -// if (!this.context[contextKey]) return [] -// return this.channels.map(channel => this.context[contextKey].get(channel)) -// } - -// render() { -// return ( -// -// {({ formKey }) => { -// this.subscribe(formKey) -// return this.props.children(...this.get()) -// }} -// -// ) -// } -// } - -// FormContext.Publisher = Publisher -// FormContext.Subscriber = Subscriber - -export default FormContext +export default mapContextToProps( + State.Consumer, + parentContext => ({ parentContext }), + FormContext +) diff --git a/src/FormTrigger.js b/src/FormTrigger.js index 090bc60..10ab833 100644 --- a/src/FormTrigger.js +++ b/src/FormTrigger.js @@ -1,123 +1,135 @@ import PropTypes from 'prop-types' import React from 'react' import warning from 'warning' +import memoize from 'memoize-one' -import { withState } from './FormContext' -import { filterAndMapMessages, namesForGroup } from './utils/ErrorUtils' +import { withState2 } from './FormContext' +import { filterAndMapMessages } from './utils/ErrorUtils' let stringOrArrayOfStrings = PropTypes.oneOfType([ PropTypes.string, PropTypes.arrayOf(PropTypes.string), ]) -const channels = ['messages', 'groups', 'form', 'submitting'] - -// class FormTrigger extends React.Component { -// static propTypes = { -// formKey: PropTypes.string, - -// noValidate: PropTypes.bool.isRequired, -// events: stringOrArrayOfStrings, -// for: PropTypes.string, -// triggers: PropTypes.arrayOf(PropTypes.string), - -// mapMessages: PropTypes.func, -// children: PropTypes.oneOfType([PropTypes.func, PropTypes.element]), - -// group: stringOrArrayOfStrings, -// } - -// static defaultProps = { -// events: 'onChange', -// noValidate: false, -// } - -// constructor(...args) { -// super(...args) - -// this.getBridgeProps = createBridge(this.handleEvent) -// } - -// componentWillUnmount() { -// this.removeFromGroup && this.removeFromGroup() -// } - -// handleEvent = (event, ...args) => { -// let { noValidate, formKey, triggers, group } = this.props - -// let names = triggers || this.names -// if (noValidate || !names) return - -// if (!this.form) { -// return warning( -// false, -// (group === '@submit' -// ? 'A Form submit event ' -// : `A validation for ${names} `) + -// `was triggered from a component outside the context of a Form. ` + -// `The Field, Button, or Trigger should be wrapped in a Form or Form.Context component` + -// (formKey ? ` with the formKey: "${formKey}" ` : '.') -// ) -// } - -// if (group === '@submit') return this.form.onSubmit() - -// this.form.onValidate(names, event, args) -// } - -// render() { -// let { for: names, messages, submitting, events } = this.props - -// return ( -// -// {(messages, groups, form, submitting) => { -// if ( -// form && -// !this.removeFromGroup && -// name && -// group && -// group !== '@submit' -// ) { -// this.removeFromGroup = form.addToGroup(name, group) -// } - -// this.form = form -// this.names = name || namesForGroup(group, groups) -// messages = this.submitting = !!submitting - -// return this.props.children({ -// props: this.getBridgeProps(this.props.events), -// submitting, -// messages, -// }) -// }} -// -// ) -// } -// } - -export default withState((messages, groups, form, submitting, props, ref) => { - const { - for: name, - group, +export const filterAndMap = memoize( + filterAndMapMessages, + (a, b) => + a.messages === b.messages && + a.names === b.names && + a.mapMessages === b.mapMessages +) + +class FormTrigger extends React.Component { + static propTypes = { + formKey: PropTypes.string, + + noValidate: PropTypes.bool.isRequired, + events: stringOrArrayOfStrings, + for: PropTypes.string, + triggers: PropTypes.arrayOf(PropTypes.string), + + mapMessages: PropTypes.func, + children: PropTypes.oneOfType([PropTypes.func, PropTypes.element]), + + group: stringOrArrayOfStrings, + } + + static defaultProps = { + events: 'onChange', + noValidate: false, + } + + constructor(...args) { + super(...args) + + this.getBridgeProps = createBridge(this.handleEvent) + } + + componentWillUnmount() { + this.removeFromGroup && this.removeFromGroup() + } + + handleEvent = (event, ...args) => { + let { noValidate, formKey, triggers, group } = this.props + + let names = triggers || this.names + if (noValidate || !names) return + + if (!this.form) { + return warning( + false, + (group === '@submit' + ? 'A Form submit event ' + : `A validation for ${names} `) + + `was triggered from a component outside the context of a Form. ` + + `The Field, Button, or Trigger should be wrapped in a Form or Form.Context component` + + (formKey ? ` with the formKey: "${formKey}" ` : '.') + ) + } + + if (group === '@submit') return this.form.onSubmit() + + this.form.onValidate(names, event, args) + } + + render() { + let { for: names, messages, submitting, events } = this.props + + return ( + + {(messages, groups, form, submitting) => { + if ( + form && + !this.removeFromGroup && + name && + group && + group !== '@submit' + ) { + this.removeFromGroup = form.addToGroup(name, group) + } + + this.form = form + this.names = name || namesForGroup(group, groups) + messages = this.submitting = !!submitting + + return this.props.children({ + props: this.getBridgeProps(this.props.events), + submitting, + messages, + }) + }} + + ) + } +} + +function FormTrigger( + messages = {}, + onSubmit, + onValidate, + submitting = false, + props, + ref +) { + let { + for: names, formKey, - noValidate, triggers, - mapMessages, - events, + noValidate = false, + events = 'onChange', } = props - const names = name || namesForGroup(group, groups) const eventHandlers = {} - for (const event of events) { + for (const event of [].concat(events)) { eventHandlers[event] = (...args) => { let fieldsToValidate = triggers || names - if (noValidate || !fieldsToValidate) return - if (!form) { + if (noValidate) return + + if (!onSubmit) { return warning( false, - (group === '@submit' + (!fieldsToValidate ? 'A Form submit event ' : `A validation for ${fieldsToValidate} `) + `was triggered from a component outside the context of a Form. ` + @@ -126,19 +138,34 @@ export default withState((messages, groups, form, submitting, props, ref) => { ) } - if (group === '@submit') return form.onSubmit() - form.onValidate(fieldsToValidate, event, args) + if (!fieldsToValidate) onSubmit() + else onValidate(fieldsToValidate, event, args) } } return props.children({ + ref, submitting, + messages, props: eventHandlers, - messages: - filterAndMapMessages({ - names, - messages, - mapMessages, - }) || {}, }) -}, channels.map(c => s => s[c])) +} + +export default withState( + FormTrigger, + [ + (state, props) => + state && + filterAndMap({ + messages: state.messages, + names: props.for, + mapMessages: props.mapMessages, + }), + state => state && state.onSubmit, + state => state && state.onValidate, + state => state && state.submitting, + ], + { + displayName: 'FormTrigger', + } +) diff --git a/src/Message.js b/src/Message.js index be9a9d0..3d2b2c6 100644 --- a/src/Message.js +++ b/src/Message.js @@ -3,11 +3,11 @@ import PropTypes from 'prop-types' import cn from 'classnames' import uniq from './utils/uniqMessage' -import { filterAndMapMessages, namesForGroup } from './utils/ErrorUtils' +import { filterAndMapMessages } from './utils/ErrorUtils' import { withState } from './FormContext' let flatten = (arr, next) => arr.concat(next) -const channels = ['messages', 'groups'] +const channels = ['messages'] /** * Represents a Form validation error message. Only renders when the @@ -21,7 +21,7 @@ class Message extends React.PureComponent { PropTypes.string, PropTypes.arrayOf(PropTypes.string), ]), - group: PropTypes.string, + formKey: PropTypes.string, /** @@ -61,7 +61,6 @@ class Message extends React.PureComponent { render() { let { for: names, - group, formKey, className, errorClass, @@ -73,10 +72,10 @@ class Message extends React.PureComponent { return ( - {(messages, groups) => { + {messages => { messages = filterAndMapMessages({ messages, - names: names || namesForGroup(group, groups), + names, }) if (!messages || !Object.keys(messages).length) return null @@ -97,24 +96,11 @@ class Message extends React.PureComponent { } } -function render( +function FormMessage( messages, - groups, - { - for: names, - group, - className, - errorClass, - extract, - filter, - children, - ...props - } + { for: names, className, errorClass, extract, filter, children, ...props } ) { - messages = filterAndMapMessages({ - messages, - names: names || namesForGroup(group, groups), - }) + messages = filterAndMapMessages({ messages, names }) if (!messages || !Object.keys(messages).length) return null @@ -130,7 +116,7 @@ function render( ) } -export default withState(render, [ - state => state.messages, - state => state.groups, -]) +// FormMessage.propTypes = propTypes +// FormMessage.defaultProps = defaultProps; + +export default withState(FormMessage, [state => state && state.messages]) diff --git a/src/utils/ErrorUtils.js b/src/utils/ErrorUtils.js index e515a35..d836161 100644 --- a/src/utils/ErrorUtils.js +++ b/src/utils/ErrorUtils.js @@ -55,14 +55,14 @@ export function pickMessages(messages, names) { return pick(messages, names) } -export function namesForGroup(group, allGroups) { - if (!group || !allGroups) return [] - group = group ? [].concat(group) : [] - - return uniq( - group.reduce((fields, group) => fields.concat(allGroups[group]), []) - ) -} +// export function namesForGroup(group, allGroups) { +// if (!group || !allGroups) return [] +// group = group ? [].concat(group) : [] + +// return uniq( +// group.reduce((fields, group) => fields.concat(allGroups[group]), []) +// ) +// } export function filter(messages, baseName) { const paths = Object.keys(messages) diff --git a/test/Context.spec.js b/test/Context.spec.js index 6b08126..99c0b60 100644 --- a/test/Context.spec.js +++ b/test/Context.spec.js @@ -10,7 +10,7 @@ describe('Form Context', () => { other: yup.string().default(''), }) - it('should simulate an onSubmit in the Form', function(done) { + it.only('should simulate an onSubmit in the Form', function(done) { mount( done())} @@ -25,7 +25,7 @@ describe('Form Context', () => { .simulate('click') }) - it.only('should simulate an onSubmit from outside the form', function(done) { + it('should simulate an onSubmit from outside the form', function(done) { mount( { .simulate('click') }) - it('should not submit multiple unkeyed forms (last wins)', function(done) { + it('should not submit multiple unkeyed forms (last wins)', done => { mount( { defaultValue={{}} > +
done(new Error('submitted wrong form!'))} diff --git a/test/Field.spec.js b/test/Field.spec.js index b401271..9260279 100644 --- a/test/Field.spec.js +++ b/test/Field.spec.js @@ -242,14 +242,17 @@ describe('Field', () => { }) describe('meta', () => { - it('should pass meta to form', () => { + it('should pass meta to form', done => { let Input = ({ meta }) => { + //first pass isn't correct since form hasn't propagated it's state yet. + if (!meta.invalid) return null + meta.invalid.should.equals(true) meta.valid.should.equals(false) meta.errors.should.eqls({ name: 'foo', }) - + done() return null } diff --git a/test/Form.spec.js b/test/Form.spec.js index a078eda..5729858 100644 --- a/test/Form.spec.js +++ b/test/Form.spec.js @@ -42,7 +42,7 @@ describe('Form', () => { Form.getter('foo', { foo: 5 }).should.equal(5) }) - it('should pass messages', () => { + it.only('should pass messages', () => { let wrapper = mount(
diff --git a/test/Trigger.spec.js b/test/Trigger.spec.js index 9111bb6..5259078 100644 --- a/test/Trigger.spec.js +++ b/test/Trigger.spec.js @@ -9,7 +9,6 @@ const sleep = ms => new Promise(y => setTimeout(() => y(), ms)) describe('Trigger', () => { const schema = yup.object({ fieldA: yup.mixed(), fieldB: yup.mixed() }) - it('should simulate event for name', () => { let spy = sinon.spy(), wrapper = mount( @@ -46,7 +45,7 @@ describe('Trigger', () => { spy.args[0][0].fields.should.eql(['fieldA', 'fieldB']) }) - it('should simulate group', function(done) { + it('should simulate for `triggers`', function(done) { function spy({ fields }) { fields.should.eql(['fieldA']) done() @@ -55,15 +54,15 @@ describe('Trigger', () => { let wrapper = mount(
- + {({ props }) => } {({ props }) => } - - {({ props }) =>
@@ -72,20 +71,20 @@ describe('Trigger', () => { wrapper.find('button').simulate('click') }) - it('should trigger a submit', function(done) { + it('should trigger a submit', done => { let wrapper = mount(
done()}>
- + {({ props }) => } - + {({ props }) => } - - {({ props }) =>
@@ -101,13 +100,13 @@ describe('Trigger', () => {
- {({ submitting }) => `submitting: ${submitting}`} + {({ submitting }) => submitting: {String(submitting)}}
) - let trigger = wrapper.find(Form.Trigger) + let trigger = wrapper.find('span') trigger.text().should.equal('submitting: false') diff --git a/yarn.lock b/yarn.lock index 606664c..a54d1ac 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4069,7 +4069,7 @@ image-size@~0.5.0: version "0.5.5" resolved "https://registry.yarnpkg.com/image-size/-/image-size-0.5.5.tgz#09dfd4ab9d20e29eb1c3e80b8990378df9e3cb9c" -immer@^1.2.1, immer@^1.3.0: +immer@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/immer/-/immer-1.3.0.tgz#b5c462dad2a129ad909eb4a180de63ffaa348d12" @@ -5292,6 +5292,10 @@ mem@^1.1.0: dependencies: mimic-fn "^1.0.0" +memoize-one@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/memoize-one/-/memoize-one-3.1.1.tgz#ef609811e3bc28970eac2884eece64d167830d17" + memory-fs@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/memory-fs/-/memory-fs-0.2.0.tgz#f2bb25368bc121e391c2520de92969caee0a0290" @@ -6809,15 +6813,9 @@ react-component-metadata@^3.0.0: babylon "^6.7.0" lodash "^3.8.0" -"react-context-toolbox@file:../4c-context": - version "0.0.0-development" - -react-copy-write@^0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/react-copy-write/-/react-copy-write-0.1.0.tgz#6de986210199d2af615641cd67b54ad145a40d4b" - dependencies: - immer "^1.2.1" - invariant "^2.2.4" +react-context-toolbox@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/react-context-toolbox/-/react-context-toolbox-1.1.0.tgz#4a6f5d3b949b8e1647aa0f0fb659f189958d5fab" react-docgen@^2.20.0: version "2.20.0" @@ -6831,9 +6829,9 @@ react-docgen@^2.20.0: node-dir "^0.1.10" recast "^0.12.6" -react-dom@^16.4.0: - version "16.4.0" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.4.0.tgz#099f067dd5827ce36a29eaf9a6cdc7cbf6216b1e" +react-dom@^16.4.1: + version "16.4.1" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.4.1.tgz#7f8b0223b3a5fbe205116c56deb85de32685dad6" dependencies: fbjs "^0.8.16" loose-envify "^1.1.0" @@ -6937,9 +6935,9 @@ react-transition-group@^2.0.0, react-transition-group@^2.2.0: prop-types "^15.5.8" warning "^3.0.0" -react@^16.4.0: - version "16.4.0" - resolved "https://registry.yarnpkg.com/react/-/react-16.4.0.tgz#402c2db83335336fba1962c08b98c6272617d585" +react@^16.4.1: + version "16.4.1" + resolved "https://registry.yarnpkg.com/react/-/react-16.4.1.tgz#de51ba5764b5dbcd1f9079037b862bd26b82fe32" dependencies: fbjs "^0.8.16" loose-envify "^1.1.0" From 3499e22d971b4e35de222202356e3a68713542d2 Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Wed, 20 Jun 2018 15:50:43 -0400 Subject: [PATCH 03/44] WIP --- src/Field.js | 260 ++++++++++++++------------- src/Field.js.bak | 436 +++++++++++++++++++++++++++++++++++++++++++++ src/Form.js | 16 +- src/FormButton.js | 75 ++++++-- src/FormContext.js | 59 +----- src/FormTrigger.js | 190 ++++++++++---------- test/Field.spec.js | 131 +++++--------- 7 files changed, 791 insertions(+), 376 deletions(-) create mode 100644 src/Field.js.bak diff --git a/src/Field.js b/src/Field.js index b6a53a4..54193d2 100644 --- a/src/Field.js +++ b/src/Field.js @@ -3,10 +3,10 @@ import omit from 'lodash/omit' import React from 'react' import PropTypes from 'prop-types' import { Binding } from 'topeka' -import invariant from 'invariant' +import warning from 'warning' +import memoize from 'memoize-one' import config from './config' -import { Consumer } from './Form' import isNativeType from './utils/isNativeType' import resolveFieldComponent from './utils/resolveFieldComponent' import FormTrigger from './FormTrigger' @@ -17,20 +17,6 @@ function notify(handler, args) { handler && handler(...args) } -function getValue(value, bindTo, getter) { - if (typeof bindTo === 'function') { - return bindTo(value, getter) - } - if (typeof bindTo === 'string') { - return getter(bindTo, value) - } - - return Object.keys(bindTo).reduce((obj, key) => { - obj[key] = getValue(value, bindTo[key], getter) - return obj - }, {}) -} - /** * The Field Component renders a form control and handles input value updates and validations. * Changes to the Field value are automatically propagated back up to the containing Form @@ -76,101 +62,137 @@ class Field extends React.PureComponent { constructor(...args) { super(...args) this.eventHandlers = {} + this.createEventHandlers(this.props) + + this.memoFilterAndMapMessages = memoize( + filterAndMapMessages, + (a, b) => + a.messages === b.messages && + a.names === b.names && + a.mapMessages === b.mapMessages + ) } - bindTo = (_value, getter) => { - let { mapToValue, name } = this.props - let value = getValue(_value, mapToValue || name, getter) + buildMeta() { + let { + name, + exclusive, + messages, + submitting, + noValidate, + formMethods, + yupContext, + errorClass = config.errorClass, + } = this.props + + let schema + try { - // ensure that no inputs are left uncontrolled - if (value === undefined) value = null + schema = formMethods && name && formMethods.getSchemaForPath(name) + } catch (err) { /* ignore */ } // prettier-ignore - return value - } + let meta = { + schema, + errorClass, + context: yupContext, + onError: this.handleFieldError, + } + if (!noValidate) { + const errors = this.memoFilterAndMapMessages({ + messages, + names: name, + mapMessages: !exclusive ? inclusiveMapMessages : undefined, + }) + + meta.errors = errors + meta.invalid = !!Object.keys(errors).length + meta.valid = !meta.invalid + meta.submitting = submitting + } + + return meta + } // create a set of handlers with a stable identity so as not to // thwart SCU checks createEventHandlers({ events = config.events }) { if (events == null) return ;[].concat(events).forEach(event => { let handler = (...args) => { - notify(this._fieldProps[event], args) - notify(this._bindingProps[event], args) - notify(this._triggerProps[event], args) + notify(this.props[event], args) + notify(this.props.bindingProps[event], args) + + this.handleValidateField(event, args) } + this.eventHandlers[event] = this.eventHandlers[event] || handler }) } - constructComponent = (bindingProps, triggerMeta = {}) => { - let { formContext } = this + handleValidateField(event, args) { + const { name, alsoValidates, formMethods, noValidate } = this.props + + if (noValidate || !formMethods) return + + let fieldsToValidate = [name] + if (alsoValidates != null) fieldsToValidate.concat(alsoValidates) + + formMethods.onValidate(fieldsToValidate, event, args) + } + + handleFieldError = errors => { + let { name, formMethods } = this.props + + return formMethods.onFieldError(name, errors) + } + + render() { let { name, type, children, className, fieldRef, + noMeta, + noValidate, noResolveType, - errorClass = config.errorClass, + bindingProps, + formMethods, } = this.props - let fieldProps = omit(this.props, Object.keys(Field.propTypes)) - - fieldProps = Object.assign( + let fieldProps = Object.assign( { name }, - (this._fieldProps = fieldProps), - (this._bindingProps = bindingProps), - (this._triggerProps = triggerMeta.props || {}), + omit(this.props, Object.keys(Field.propTypes)), this.eventHandlers ) - let schema - try { - schema = name && formContext.getSchemaForPath(name) - } catch (err) { - /* ignore */ - } + // ensure that no inputs are left uncontrolled + fieldProps.value = + bindingProps.value === undefined ? null : bindingProps.value + + const meta = this.buildMeta() if (process.env.NODE_ENV !== 'production') - invariant( - formContext.noValidate || !name || schema, + warning( + !formMethods || noValidate || !name || meta.schema, `There is no corresponding schema defined for this field: "${name}" ` + "Each Field's `name` prop must be a valid path defined by the parent Form schema" ) let [Component, resolvedType] = !noResolveType - ? resolveFieldComponent(type, schema) + ? resolveFieldComponent(type, meta.schema) : [null, type] fieldProps.type = isNativeType(resolvedType) ? resolvedType : undefined - let meta = { - resolvedType, - errorClass, - schema, - onError: errors => formContext.onFieldError(name, errors), - } - - if (formContext.context) { - meta.context = formContext.context // lol - } - - if (this.shouldValidate()) { - // console.log('trigger', triggerMeta) - - let messages = triggerMeta.messages - let invalid = messages && !!Object.keys(messages).length - - meta.errors = messages - meta.invalid = invalid - meta.valid = !meta.invalid - meta.submitting = triggerMeta.submitting + meta.resolvedType = resolvedType - fieldProps.className = cn(className, invalid && errorClass) + if (!noValidate) { + fieldProps.className = cn(className, meta.invalid && meta.errorClass) } - if (!this.props.noMeta) fieldProps.meta = meta + if (!noMeta) fieldProps.meta = meta if (fieldRef) fieldProps.ref = fieldRef // Escape hatch for more complex Field types. @@ -180,53 +202,6 @@ class Field extends React.PureComponent { return {children} } - - render() { - let { - name, - exclusive, - mapFromValue, - alsoValidates, - events = config.events, - } = this.props - - let mapMessages = !exclusive ? inclusiveMapMessages : undefined - - if (typeof mapFromValue !== 'object') - mapFromValue = { [name]: mapFromValue } - - if (!this.shouldValidate()) { - return ( - - {this.constructComponent} - - ) - } - - let triggers - if (alsoValidates != null) { - triggers = [name].concat(alsoValidates) - } - - return ( - - {bindingProps => ( - - {triggerMeta => this.constructComponent(bindingProps, triggerMeta)} - - )} - - ) - } - - shouldValidate() { - return !(this.props.noValidate || this.formContext.noValidate) - } } Field.propTypes = { @@ -355,7 +330,7 @@ Field.propTypes = { * /> * ``` */ - mapToValue: PropTypes.oneOfType([PropTypes.func, PropTypes.object]), + mapToValue: PropTypes.func, /** * The css class added to the Field Input when it fails validation @@ -434,12 +409,55 @@ Field.propTypes = { /** @private */ noResolveType: PropTypes.bool, + /** @private */ + bindingProps: PropTypes.object, + /** @private */ + yupContext: PropTypes.any, + /** @private */ + messages: PropTypes.object, + /** @private */ + formMethods: PropTypes.object, + /** @private */ + submitting: PropTypes.bool, } -export default React.forwardRef((props, ref) => ( - -)) -// const _st = {} -// withState({ messages, submitting }) => { +export default withState( + ( + formMethods, + messages = {}, + submitting, + noValidate, + yupContext, + props, + ref + ) => { + let { mapToValue, mapFromValue, name, fieldRef, ...rest } = props -// }, state => state || _st) + return ( + + {bindingProps => ( + + )} + + ) + }, + [ + state => state.formMethods, + state => state.messages, + state => state.submitting, + state => state.noValidate, + state => state.yupContext, + ] +) diff --git a/src/Field.js.bak b/src/Field.js.bak new file mode 100644 index 0000000..8cd0e9c --- /dev/null +++ b/src/Field.js.bak @@ -0,0 +1,436 @@ +import cn from 'classnames' +import omit from 'lodash/omit' +import React from 'react' +import PropTypes from 'prop-types' +import { Binding } from 'topeka' +import invariant from 'invariant' + +import config from './config' +import { Consumer } from './Form' +import isNativeType from './utils/isNativeType' +import resolveFieldComponent from './utils/resolveFieldComponent' +import FormTrigger from './FormTrigger' +import { inclusiveMapMessages, filterAndMapMessages } from './utils/ErrorUtils' +import { withState } from './FormContext' + +function notify(handler, args) { + handler && handler(...args) +} + +function getValue(value, bindTo, getter) { + if (typeof bindTo === 'function') { + return bindTo(value, getter) + } + if (typeof bindTo === 'string') { + return getter(bindTo, value) + } + + return Object.keys(bindTo).reduce((obj, key) => { + obj[key] = getValue(value, bindTo[key], getter) + return obj + }, {}) +} + +/** + * The Field Component renders a form control and handles input value updates and validations. + * Changes to the Field value are automatically propagated back up to the containing Form + * Component. + * + * Fields provide a light abstraction over normal input components where values and onChange handlers + * are take care of for you. Beyond that they just render the input for their type, Fields whille pass along + * any props and children to the input so you can easily configure new input types. + * + * ```editable + *
+ * + * + * + * + * + * + * + * + * + * + * Submit + * + * ``` + */ +class Field extends React.PureComponent { + static defaultProps = { + type: '', + exclusive: false, + fieldRef: null, + } + + constructor(...args) { + super(...args) + this.eventHandlers = {} + this.createEventHandlers(this.props) + } + + bindTo = (_value, getter) => { + let { mapToValue, name } = this.props + let value = getValue(_value, mapToValue || name, getter) + + // ensure that no inputs are left uncontrolled + if (value === undefined) value = null + + return value + } + + // create a set of handlers with a stable identity so as not to + // thwart SCU checks + createEventHandlers({ events = config.events }) { + if (events == null) return + ;[].concat(events).forEach(event => { + let handler = (...args) => { + notify(this._fieldProps[event], args) + notify(this._bindingProps[event], args) + notify(this._triggerProps[event], args) + } + this.eventHandlers[event] = this.eventHandlers[event] || handler + }) + } + + constructComponent = (bindingProps, triggerMeta = {}) => { + let { formContext } = this + let { + name, + type, + children, + className, + fieldRef, + noResolveType, + errorClass = config.errorClass, + } = this.props + + let fieldProps = omit(this.props, Object.keys(Field.propTypes)) + + fieldProps = Object.assign( + { name }, + (this._fieldProps = fieldProps), + (this._bindingProps = bindingProps), + (this._triggerProps = triggerMeta.props || {}), + this.eventHandlers + ) + + let schema + try { + schema = name && formContext.getSchemaForPath(name) + } catch (err) { + /* ignore */ + } + + if (process.env.NODE_ENV !== 'production') + invariant( + formContext.noValidate || !name || schema, + `There is no corresponding schema defined for this field: "${name}" ` + + "Each Field's `name` prop must be a valid path defined by the parent Form schema" + ) + + let [Component, resolvedType] = !noResolveType + ? resolveFieldComponent(type, schema) + : [null, type] + + fieldProps.type = isNativeType(resolvedType) ? resolvedType : undefined + + let meta = { + resolvedType, + errorClass, + schema, + onError: errors => formContext.onFieldError(name, errors), + } + + if (formContext.context) { + meta.context = formContext.context // lol + } + + if (this.shouldValidate()) { + // console.log('trigger', triggerMeta) + + let messages = triggerMeta.messages + let invalid = messages && !!Object.keys(messages).length + + meta.errors = messages + meta.invalid = invalid + meta.valid = !meta.invalid + meta.submitting = triggerMeta.submitting + + fieldProps.className = cn(className, invalid && errorClass) + } + + if (!this.props.noMeta) fieldProps.meta = meta + if (fieldRef) fieldProps.ref = fieldRef + + // Escape hatch for more complex Field types. + if (typeof children === 'function') { + return children(fieldProps, Component) + } + + return {children} + } + + render() { + let { + name, + exclusive, + mapFromValue, + alsoValidates, + events = config.events, + } = this.props + + let mapMessages = !exclusive ? inclusiveMapMessages : undefined + + if (typeof mapFromValue !== 'object') + mapFromValue = { [name]: mapFromValue } + + if (!this.shouldValidate()) { + return ( + + {this.constructComponent} + + ) + } + + let triggers + if (alsoValidates != null) { + triggers = [name].concat(alsoValidates) + } + + return ( + + {bindingProps => this.constructComponent(bindingProps)} + + ) + } + + shouldValidate() { + return !(this.props.noValidate || this.formContext.noValidate) + } +} + +Field.propTypes = { + /** + * The Field name, which should be path corresponding to a specific form `value` path. + * + * ```js + * // given the form value + * value = { + * name: { first: '' } + * languages: ['english', 'spanish'] + * } + * + * // the path "name.first" would update the "first" property of the form value + * + * + * // use indexes for paths that cross arrays + * + * + * ``` + */ + name: PropTypes.string.isRequired, + + /** + * The Component Input the form should render. You can sepcify a builtin type + * with a string name e.g `'text'`, `'datetime-local'`, etc. or provide a Component + * type class directly. When no type is provided the Field will attempt determine + * the correct input from the corresponding scheme. A Field corresponding to a `yup.number()` + * will render a `type='number'` input by default. + * + * ```editable + *
+ * Use the schema to determine type + * + * + * Override it! + * + * + * Use a custom Component + * (need native 'datetime' support to see it) + * + * + * + * ``` + * Custom Inputs should comply with the basic input api contract: set a value via a `value` prop and + * broadcast changes to that value via an `onChange` handler. + * + * You can also permenantly map Components to a string `type` name via the top-level + * `addInputType()` api. + */ + type: PropTypes.oneOfType([PropTypes.func, PropTypes.string]), + + /** + * Event name or array of event names that the Field should trigger a validation. + */ + events: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.arrayOf(PropTypes.string), + ]), + + /** + * Customize how the Field value maps to the overall Form `value`. + * `mapFromValue` can be a a string property name or a function that returns a + * value for `name`'d path, allowing you to set commuted values from the Field. + * + * ```js + * fieldValue.first + ' ' + fieldValue.last} + * /> + * ``` + * + * You can also provide an object hash, mapping paths of the Form `value` + * to fields in the field value using a string field name, or a function accessor. + * + * ```editable + *
+ * + * + * + * + * date, + * 'age': date => + * (new Date()).getFullYear() - date.getFullYear() + * }}/> + + * + * + * + * Submit + * + * ``` + */ + mapFromValue: PropTypes.oneOfType([ + PropTypes.func, + PropTypes.string, + PropTypes.object, + ]), + + /** + * Map the Form value to the Field value. By default + * the `name` of the Field is used to extract the relevant + * property from the Form value. + * + * ```js + * pick(model, 'location', 'locationId')} + * /> + * ``` + */ + mapToValue: PropTypes.oneOfType([PropTypes.func, PropTypes.object]), + + /** + * The css class added to the Field Input when it fails validation + */ + errorClass: PropTypes.string, + + /** + * Tells the Field to trigger validation for addition paths as well as its own (`name`). + * Useful when used in conjuction with a `mapFromValue` hash that updates more than one value, or + * if you want to trigger validation for the parent path as well. + * + * ```js + * + * + * ``` + */ + alsoValidates: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.arrayOf(PropTypes.string), + ]), + + /** + * Indicates whether child fields of the named field + * affect the active state ofthe field. + * + * ```js + * -> 'names' + * -> 'names.first' + * -> 'names.last' + * ``` + * + * Are all considered "part" of a field named `'names'` by default. + */ + exclusive: PropTypes.bool, + + /** + * Disables validation for the Field. + */ + noValidate: PropTypes.bool, + + /** + * When children is the traditional react element or nodes, they are + * passed through as-is to the Field `type` component. + * + * ```jsx + * + * + * + * + * ``` + * + * When `children` is a function, its called with the processed field + * props and the resolved Field Input component, for more advanced use cases + * + * ```jsx + * + * {(props, Input) => + * + * + * + * } + * + * ``` + */ + children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]), + + /** + * Instruct the field to not inject the `meta` prop into the input + */ + noMeta: PropTypes.bool, + + /** + * Attach a ref to the rendered input component + */ + fieldRef: PropTypes.func, + + /** @private */ + noResolveType: PropTypes.bool, +} + +export default React.forwardRef((props, ref) => ( + +)) +// const _st = {} +// withState({ messages, submitting }) => { + +// }, state => state || _st) diff --git a/src/Form.js b/src/Form.js index faa16b2..4388b22 100644 --- a/src/Form.js +++ b/src/Form.js @@ -13,7 +13,7 @@ import errorManager from './errorManager' import errToJSON from './utils/errToJSON' import * as ErrorUtils from './utils/ErrorUtils' -import FormContext, { withPublish } from './FormContext' +import FormContext from './FormContext' let BindingContext = BC.ControlledComponent @@ -348,12 +348,14 @@ class Form extends React.PureComponent { props.publish(state => ({ ...state, messages: props.errors, - context: props.context, - noValidate: false, - onSubmit: this.handleSubmit, - onValidate: this.handleValidationRequest, - onFieldError: this.handleFieldError, - getSchemaForPath: this.getSchemaForPath, + yupContext: props.context, + noValidate: props.noValidate, // FIXME: should update + formMethods: { + onSubmit: this.handleSubmit, + onValidate: this.handleValidationRequest, + onFieldError: this.handleFieldError, + getSchemaForPath: this.getSchemaForPath, + }, })) } diff --git a/src/FormButton.js b/src/FormButton.js index 012bdd9..4ef8f2f 100644 --- a/src/FormButton.js +++ b/src/FormButton.js @@ -1,17 +1,12 @@ import chain from 'chain-function' import PropTypes from 'prop-types' import React from 'react' +import warning from 'warning' -import Trigger from './FormTrigger' +import { withState } from './FormContext' -function mergeWithEvents(events, objects) { - let result = Object.assign({}, ...objects) - if (events) - [].concat(events).forEach(event => { - let handlers = objects.map(p => p[event]) - result[event] = chain(...handlers) - }) - return result +function notify(handler, args) { + handler && handler(...args) } /** @@ -25,11 +20,11 @@ class FormButton extends React.Component { type: PropTypes.oneOf(['button', 'submit']), /** - * Specify a group to validate, if empty the entire form will be validated. + * Specify particular fields to validate in the related form. If empty the entire form will be validated. * If the button type is 'submit' the group will be ignored and the * entire form will be validated prior to submission. */ - group: PropTypes.string, + triggers: PropTypes.arrayOf(PropTypes.string.isRequired), /** * The key of `Form` that "owns" this button. Validation will be triggered @@ -64,20 +59,61 @@ class FormButton extends React.Component { events: ['onClick'], } + constructor(...args) { + super(...args) + this.eventHandlers = {} + + const { events } = this.props + + if (events) { + ;[].concat(events).forEach(event => { + let handler = (...args) => { + this.props[event] && this.props[event](args) + + this.handleValidateField(event, args) + } + + this.eventHandlers[event] = this.eventHandlers[event] || handler + }) + } + } + + handleSubmit(event, args) { + const { formMethods, triggers, formKey } = this.props + if (!formMethods) { + return warning( + false, + (!triggers ? 'A Form submit event ' : `A validation for ${triggers} `) + + `was triggered from a component outside the context of a Form. ` + + `The Field, Button, or Trigger should be wrapped in a Form or Form.Context component` + + (formKey ? ` with the formKey: "${formKey}" ` : '.') + ) + } + + if (triggers && triggers.length) + formMethods.onValidate(triggers, event, args) + } render() { let { - group, events, + triggers, component: Component, formKey, children, ...props } = this.props - if (props.type.toLowerCase() === 'submit') group = '@submit' + if (events) + for (let event of [].concat(events)) + this.eventHandlers[event] = + this.eventHandlers[event] || + ((...args) => { + this.props[event] && this.props[event](args) + this.handleSubmit() + }) return ( - + {meta => typeof children === 'function' ? ( children({ @@ -86,7 +122,7 @@ class FormButton extends React.Component { }) ) : ( - {children} + {children} ) } @@ -95,4 +131,11 @@ class FormButton extends React.Component { } } -export default FormButton +export default withState( + (formMethods, messages, submitting) => , + [ + state => state.formMethods, + state => state.messages, + state => state.submitting, + ] +) diff --git a/src/FormContext.js b/src/FormContext.js index 8e4dbb6..1ae775b 100644 --- a/src/FormContext.js +++ b/src/FormContext.js @@ -3,14 +3,10 @@ import React from 'react' import mapContextToProps from 'react-context-toolbox/lib/mapContextToProps' import forwardRef from 'react-context-toolbox/lib/forwardRef' -// import { Consumer as FormConsumer } from './Form' - export const DEFAULT_CHANNEL = '@@parent' -const State = React.createContext(/*{ - formState: {}, - combinedState: {}, -} */) +const State = React.createContext() + let id = 0 class FormContext extends React.Component { constructor(...args) { @@ -43,10 +39,6 @@ class FormContext extends React.Component { } } - getParent() { - return this.props.parentContext && this.props.parentContext.publisher - } - update = (channel, fn, propagateIfPossible) => { const { parentContext } = this.props @@ -104,22 +96,13 @@ class ConsumerIndirection extends React.Component { return state.some((observedState, i) => observedState !== currentState[i]) } render() { - const { - children, - state, - Component, - mapToProps, - innerRef, - props, - } = this.props - if (Component) - return + const { children, state } = this.props return children(state) } } -export const withState = (render, selectors, { displayName, ...rest } = {}) => { +export const withState = (render, selectors, { displayName } = {}) => { const fn = (props, ref) => { return ( @@ -129,7 +112,9 @@ export const withState = (render, selectors, { displayName, ...rest } = {}) => { const state = context && context.combinedState[key] return ( - fn(state, props))}> + state && fn(state, props))} + > {state => render(...state, props, ref)} ) @@ -137,35 +122,7 @@ export const withState = (render, selectors, { displayName, ...rest } = {}) => { ) } - fn.displayName = displayName - return Object.assign(React.forwardRef(fn), rest) -} - -export const withState2 = (Component, selectors, mapToProps, staticProps) => { - return forwardRef((props, ref) => { - return ( - - {context => { - const key = - props.formKey || (context ? context.defaultKey : DEFAULT_CHANNEL) - - const state = selectors.map(fn => - fn(context && context.combinedState[key], props) - ) - - return ( - - ) - }} - - ) - }, staticProps) + return forwardRef(fn, { displayName }) } export default mapContextToProps( diff --git a/src/FormTrigger.js b/src/FormTrigger.js index 10ab833..6b2ee44 100644 --- a/src/FormTrigger.js +++ b/src/FormTrigger.js @@ -3,7 +3,7 @@ import React from 'react' import warning from 'warning' import memoize from 'memoize-one' -import { withState2 } from './FormContext' +import { withState } from './FormContext' import { filterAndMapMessages } from './utils/ErrorUtils' let stringOrArrayOfStrings = PropTypes.oneOfType([ @@ -19,94 +19,93 @@ export const filterAndMap = memoize( a.mapMessages === b.mapMessages ) -class FormTrigger extends React.Component { - static propTypes = { - formKey: PropTypes.string, - - noValidate: PropTypes.bool.isRequired, - events: stringOrArrayOfStrings, - for: PropTypes.string, - triggers: PropTypes.arrayOf(PropTypes.string), - - mapMessages: PropTypes.func, - children: PropTypes.oneOfType([PropTypes.func, PropTypes.element]), - - group: stringOrArrayOfStrings, - } - - static defaultProps = { - events: 'onChange', - noValidate: false, - } - - constructor(...args) { - super(...args) - - this.getBridgeProps = createBridge(this.handleEvent) - } - - componentWillUnmount() { - this.removeFromGroup && this.removeFromGroup() - } - - handleEvent = (event, ...args) => { - let { noValidate, formKey, triggers, group } = this.props - - let names = triggers || this.names - if (noValidate || !names) return - - if (!this.form) { - return warning( - false, - (group === '@submit' - ? 'A Form submit event ' - : `A validation for ${names} `) + - `was triggered from a component outside the context of a Form. ` + - `The Field, Button, or Trigger should be wrapped in a Form or Form.Context component` + - (formKey ? ` with the formKey: "${formKey}" ` : '.') - ) - } - - if (group === '@submit') return this.form.onSubmit() - - this.form.onValidate(names, event, args) - } - - render() { - let { for: names, messages, submitting, events } = this.props - - return ( - - {(messages, groups, form, submitting) => { - if ( - form && - !this.removeFromGroup && - name && - group && - group !== '@submit' - ) { - this.removeFromGroup = form.addToGroup(name, group) - } - - this.form = form - this.names = name || namesForGroup(group, groups) - messages = this.submitting = !!submitting - - return this.props.children({ - props: this.getBridgeProps(this.props.events), - submitting, - messages, - }) - }} - - ) - } -} +// class FormTrigger extends React.Component { +// static propTypes = { +// formKey: PropTypes.string, + +// noValidate: PropTypes.bool.isRequired, +// events: stringOrArrayOfStrings, +// for: PropTypes.string, +// triggers: PropTypes.arrayOf(PropTypes.string), + +// mapMessages: PropTypes.func, +// children: PropTypes.oneOfType([PropTypes.func, PropTypes.element]), + +// group: stringOrArrayOfStrings, +// } + +// static defaultProps = { +// events: 'onChange', +// noValidate: false, +// } + +// constructor(...args) { +// super(...args) + +// this.getBridgeProps = createBridge(this.handleEvent) +// } + +// componentWillUnmount() { +// this.removeFromGroup && this.removeFromGroup() +// } + +// handleEvent = (event, ...args) => { +// let { noValidate, formKey, triggers, group } = this.props + +// let names = triggers || this.names +// if (noValidate || !names) return + +// if (!this.form) { +// return warning( +// false, +// (group === '@submit' +// ? 'A Form submit event ' +// : `A validation for ${names} `) + +// `was triggered from a component outside the context of a Form. ` + +// `The Field, Button, or Trigger should be wrapped in a Form or Form.Context component` + +// (formKey ? ` with the formKey: "${formKey}" ` : '.') +// ) +// } + +// if (group === '@submit') return this.form.onSubmit() + +// this.form.onValidate(names, event, args) +// } + +// render() { +// let { for: names, messages, submitting, events } = this.props + +// return ( +// +// {(messages, groups, form, submitting) => { +// if ( +// form && +// !this.removeFromGroup && +// name && +// group && +// group !== '@submit' +// ) { +// this.removeFromGroup = form.addToGroup(name, group) +// } + +// this.form = form +// this.names = name || namesForGroup(group, groups) +// messages = this.submitting = !!submitting + +// return this.props.children({ +// props: this.getBridgeProps(this.props.events), +// submitting, +// messages, +// }) +// }} +// +// ) +// } +// } function FormTrigger( messages = {}, - onSubmit, - onValidate, + { onSubmit, onValidate } = {}, submitting = false, props, ref @@ -146,24 +145,21 @@ function FormTrigger( return props.children({ ref, submitting, - messages, props: eventHandlers, + messages: filterAndMapMessages({ + names, + messages, + mapMessages: props.mapMessages, + }), }) } export default withState( FormTrigger, [ - (state, props) => - state && - filterAndMap({ - messages: state.messages, - names: props.for, - mapMessages: props.mapMessages, - }), - state => state && state.onSubmit, - state => state && state.onValidate, - state => state && state.submitting, + state => state.messages, + state => state.formMethods, + state => state.submitting, ], { displayName: 'FormTrigger', diff --git a/test/Field.spec.js b/test/Field.spec.js index 9260279..a0e240f 100644 --- a/test/Field.spec.js +++ b/test/Field.spec.js @@ -160,85 +160,91 @@ describe('Field', () => { spy.should.have.been.and.calledWith({ other: 'john' }) }) - it('gets value from map accessor', function() { + it('maps values from hash', function() { + let spy = sinon.spy() mount( -
+ e.value, + text: 'text', }} /> ) - .assertSingle(TestInput) - .prop('value') - .should.eql({ - first: 'foo', - last: 'bar', - }) + .assertSingle('input') + .simulate('change', { value: 'john', text: 'hi' }) + + spy.should.have.been.calledOnce.and.calledWith({ name: 'john', text: 'hi' }) }) - it('gets value from map accessor functions', function() { + it('should pass all args to mapFromValue', function(done) { + let spy = sinon.spy() mount( -
+ v.name, - last: v => v.lastName, + mapFromValue={(...args) => { + args.length.should.equal(2) + args[1].should.equal('hi') + done() }} /> ) - .assertSingle(TestInput) - .prop('value') - .should.eql({ - first: 'foo', - last: 'bar', - }) + .assertSingle('input') + .simulate('change') }) - it('maps values from hash', function() { - let spy = sinon.spy() + it('should add inner ref', function() { + let inst mount( -
+ e.value, - text: 'text', + fieldRef={r => { + inst = r }} /> ) - .assertSingle('input') - .simulate('change', { value: 'john', text: 'hi' }) - - spy.should.have.been.calledOnce.and.calledWith({ name: 'john', text: 'hi' }) + ;(inst instanceof TestInput).should.be.true() }) - it('should pass all args to mapFromValue', function(done) { - let spy = sinon.spy() + it('should forward inner ref', function() { + let inst mount( -
+ { - args.length.should.equal(2) - args[1].should.equal('hi') - done() + ref={r => { + inst = r }} /> ) - .assertSingle('input') - .simulate('change') + ;(inst instanceof TestInput).should.be.true() + }) + + it('should work with conditional schema', function() { + const spy = sinon.stub(console, 'error').callsFake(() => {}) + + let render = name => { + mount( +
+ + + ) + } + // render('jason') + // spy.should.not.have.been.called() + render('john') + spy.should.have.been.called() }) describe('meta', () => { @@ -424,47 +430,4 @@ describe('Field', () => { onError({ '[1].baz.foo': 'bar' }).should.eql({ 'name[1].baz.foo': 'bar' }) }) }) - - it('should add inner ref', function() { - let inst - mount( -
- { - inst = r - }} - /> - - ) - ;(inst instanceof TestInput).should.be.true() - }) - - it('should forward inner ref', function() { - let inst - mount( -
- { - inst = r - }} - /> - - ) - ;(inst instanceof TestInput).should.be.true() - }) - - it('should work with conditional schema', function() { - let render = name => - ReactDOMServer.renderToString( -
- - - ) - ;(() => render('jason')).should.not.throw() - ;(() => render('john')).should.throw() - }) }) From 7b7ed862bd80297f688ea51bc0b97f362d9505a9 Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Fri, 22 Jun 2018 16:31:48 -0400 Subject: [PATCH 04/44] done --- .eslintrc | 9 + README.md | 4 +- docs/app.js | 4 +- docs/bundle.js | 57738 +++++++++++++++--------------- docs/pages/intro.md | 2 +- src/Field.js | 37 +- src/Field.js.bak | 436 - src/FieldArray.js | 3 + src/Form.js | 9 +- src/FormButton.js | 141 - src/FormContext.js | 20 +- src/FormState.js | 54 - src/FormSubmit.js | 148 + src/FormTrigger.js | 167 - src/Message.js | 133 +- src/NestedForm.js | 24 +- src/Summary.js | 11 +- src/index.js | 6 +- src/inputs/File.js | 25 +- src/utils/ErrorUtils.js | 11 - src/utils/createEventHandler.js | 17 + test/Button.spec.js | 8 +- test/Context.spec.js | 48 +- test/Field.spec.js | 46 +- test/FieldArray.spec.js | 2 +- test/Form.spec.js | 10 +- test/Message.spec.js | 13 +- test/Trigger.spec.js | 52 +- www/src/examples/Form.js | 2 +- www/src/examples/intro.js | 2 +- www/src/layouts/api.js | 2 +- 31 files changed, 29262 insertions(+), 29922 deletions(-) delete mode 100644 src/Field.js.bak delete mode 100644 src/FormButton.js delete mode 100644 src/FormState.js create mode 100644 src/FormSubmit.js delete mode 100644 src/FormTrigger.js create mode 100644 src/utils/createEventHandler.js diff --git a/.eslintrc b/.eslintrc index ac5e619..1e0741a 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,2 +1,11 @@ parser: babel-eslint extends: jason/react +rules: { + no-unused-vars: [2, { + "vars": "all", + "args": "after-used", + "varsIgnorePattern": "^_", + "argsIgnorePattern": "^_", + }], + +} diff --git a/README.md b/README.md index 0f6022c..1e23d0f 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ var yup = require('yup') var modelSchema = yup.object({ name: yup.object({ first: yup.string().required('Name is required'), - last: yup.string().required('Name is required') + last: yup.string().required('Name is required') }), dateOfBirth: yup.date() .max(new Date(), 'You can be born in the future!') @@ -52,7 +52,7 @@ render() { - Submit + Submit ) } diff --git a/docs/app.js b/docs/app.js index ed1b171..67ca3f3 100644 --- a/docs/app.js +++ b/docs/app.js @@ -93,7 +93,7 @@ class Docs extends React.Component { Form.Summary
  • - Form.Button + Form.Submit
  • Schema @@ -204,7 +204,7 @@ var routes = ( /> 1) { @@ -578,7 +578,7 @@ cachedSetTimeout(drainQueue, 0); } }; - + // v8 likes predictible objects function Item(fun, array) { this.fun = fun; @@ -593,9 +593,9 @@ process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; - + function noop() {} - + process.on = noop; process.addListener = noop; process.once = noop; @@ -603,11 +603,11 @@ process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; - + process.binding = function (name) { throw new Error('process.binding is not supported'); }; - + process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); @@ -623,30 +623,30 @@ /* eslint-disable no-unused-vars */ var hasOwnProperty = Object.prototype.hasOwnProperty; var propIsEnumerable = Object.prototype.propertyIsEnumerable; - + function toObject(val) { if (val === null || val === undefined) { throw new TypeError('Object.assign cannot be called with null or undefined'); } - + return Object(val); } - + function shouldUseNative() { try { if (!Object.assign) { return false; } - + // Detect buggy property enumeration order in older V8 versions. - + // https://bugs.chromium.org/p/v8/issues/detail?id=4118 var test1 = new String('abc'); // eslint-disable-line test1[5] = 'de'; if (Object.getOwnPropertyNames(test1)[0] === '5') { return false; } - + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 var test2 = {}; for (var i = 0; i < 10; i++) { @@ -658,7 +658,7 @@ if (order2.join('') !== '0123456789') { return false; } - + // https://bugs.chromium.org/p/v8/issues/detail?id=3056 var test3 = {}; 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { @@ -668,28 +668,28 @@ 'abcdefghijklmnopqrst') { return false; } - + return true; } catch (e) { // We don't expect any of the above to throw, but better to be safe. return false; } } - + module.exports = shouldUseNative() ? Object.assign : function (target, source) { var from; var to = toObject(target); var symbols; - + for (var s = 1; s < arguments.length; s++) { from = Object(arguments[s]); - + for (var key in from) { if (hasOwnProperty.call(from, key)) { to[key] = from[key]; } } - + if (Object.getOwnPropertySymbols) { symbols = Object.getOwnPropertySymbols(from); for (var i = 0; i < symbols.length; i++) { @@ -699,7 +699,7 @@ } } } - + return to; }; @@ -718,23 +718,23 @@ * * @providesModule ReactChildren */ - + 'use strict'; - + var PooledClass = __webpack_require__(16); var ReactElement = __webpack_require__(19); - + var emptyFunction = __webpack_require__(22); var traverseAllChildren = __webpack_require__(24); - + var twoArgumentPooler = PooledClass.twoArgumentPooler; var fourArgumentPooler = PooledClass.fourArgumentPooler; - + var userProvidedKeyEscapeRegex = /\/+/g; function escapeUserProvidedKey(text) { return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/'); } - + /** * PooledClass representing the bookkeeping associated with performing a child * traversal. Allows avoiding binding callbacks. @@ -754,14 +754,14 @@ this.count = 0; }; PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler); - + function forEachSingleChild(bookKeeping, child, name) { var func = bookKeeping.func; var context = bookKeeping.context; - + func.call(context, child, bookKeeping.count++); } - + /** * Iterates through children that are typically specified as `props.children`. * @@ -782,7 +782,7 @@ traverseAllChildren(children, forEachSingleChild, traverseContext); ForEachBookKeeping.release(traverseContext); } - + /** * PooledClass representing the bookkeeping associated with performing a child * mapping. Allows avoiding binding callbacks. @@ -807,14 +807,14 @@ this.count = 0; }; PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler); - + function mapSingleChildIntoContext(bookKeeping, child, childKey) { var result = bookKeeping.result; var keyPrefix = bookKeeping.keyPrefix; var func = bookKeeping.func; var context = bookKeeping.context; - - + + var mappedChild = func.call(context, child, bookKeeping.count++); if (Array.isArray(mappedChild)) { mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument); @@ -828,7 +828,7 @@ result.push(mappedChild); } } - + function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) { var escapedPrefix = ''; if (prefix != null) { @@ -838,7 +838,7 @@ traverseAllChildren(children, mapSingleChildIntoContext, traverseContext); MapBookKeeping.release(traverseContext); } - + /** * Maps children that are typically specified as `props.children`. * @@ -860,11 +860,11 @@ mapIntoWithKeyPrefixInternal(children, result, null, func, context); return result; } - + function forEachSingleChildDummy(traverseContext, child, name) { return null; } - + /** * Count the number of children that are typically specified as * `props.children`. @@ -877,7 +877,7 @@ function countChildren(children, context) { return traverseAllChildren(children, forEachSingleChildDummy, null); } - + /** * Flatten a children object (typically specified as `props.children`) and * return an array with appropriately re-keyed children. @@ -889,7 +889,7 @@ mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument); return result; } - + var ReactChildren = { forEach: forEachChildren, map: mapChildren, @@ -897,7 +897,7 @@ count: countChildren, toArray: toArray }; - + module.exports = ReactChildren; /***/ }, @@ -914,13 +914,13 @@ * * @providesModule PooledClass */ - + 'use strict'; - + var _prodInvariant = __webpack_require__(17); - + var invariant = __webpack_require__(18); - + /** * Static poolers. Several custom versions for each potential number of * arguments. A completely generic pooler is easy to implement, but would @@ -938,7 +938,7 @@ return new Klass(copyFieldsFrom); } }; - + var twoArgumentPooler = function (a1, a2) { var Klass = this; if (Klass.instancePool.length) { @@ -949,7 +949,7 @@ return new Klass(a1, a2); } }; - + var threeArgumentPooler = function (a1, a2, a3) { var Klass = this; if (Klass.instancePool.length) { @@ -960,7 +960,7 @@ return new Klass(a1, a2, a3); } }; - + var fourArgumentPooler = function (a1, a2, a3, a4) { var Klass = this; if (Klass.instancePool.length) { @@ -971,7 +971,7 @@ return new Klass(a1, a2, a3, a4); } }; - + var fiveArgumentPooler = function (a1, a2, a3, a4, a5) { var Klass = this; if (Klass.instancePool.length) { @@ -982,7 +982,7 @@ return new Klass(a1, a2, a3, a4, a5); } }; - + var standardReleaser = function (instance) { var Klass = this; !(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0; @@ -991,10 +991,10 @@ Klass.instancePool.push(instance); } }; - + var DEFAULT_POOL_SIZE = 10; var DEFAULT_POOLER = oneArgumentPooler; - + /** * Augments `CopyConstructor` to be a poolable class, augmenting only the class * itself (statically) not adding any prototypical fields. Any CopyConstructor @@ -1014,7 +1014,7 @@ NewKlass.release = standardReleaser; return NewKlass; }; - + var PooledClass = { addPoolingTo: addPoolingTo, oneArgumentPooler: oneArgumentPooler, @@ -1023,7 +1023,7 @@ fourArgumentPooler: fourArgumentPooler, fiveArgumentPooler: fiveArgumentPooler }; - + module.exports = PooledClass; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -1040,35 +1040,35 @@ * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule reactProdInvariant - * + * */ 'use strict'; - + /** * WARNING: DO NOT manually require this module. * This is a replacement for `invariant(...)` used by the error code system * and will _only_ be required by the corresponding babel pass. * It always throws. */ - + function reactProdInvariant(code) { var argCount = arguments.length - 1; - + var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code; - + for (var argIdx = 0; argIdx < argCount; argIdx++) { message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]); } - + message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.'; - + var error = new Error(message); error.name = 'Invariant Violation'; error.framesToPop = 1; // we don't care about reactProdInvariant's own frame - + throw error; } - + module.exports = reactProdInvariant; /***/ }, @@ -1084,9 +1084,9 @@ * of patent rights can be found in the PATENTS file in the same directory. * */ - + 'use strict'; - + /** * Use invariant() to assert state which your program assumes to be true. * @@ -1097,14 +1097,14 @@ * The invariant message will be stripped in production, but the invariant * will remain to ensure logic does not differ in production. */ - + function invariant(condition, format, a, b, c, d, e, f) { if (process.env.NODE_ENV !== 'production') { if (format === undefined) { throw new Error('invariant requires an error message argument'); } } - + if (!condition) { var error; if (format === undefined) { @@ -1117,12 +1117,12 @@ })); error.name = 'Invariant Violation'; } - + error.framesToPop = 1; // we don't care about invariant's own frame throw error; } } - + module.exports = invariant; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -1140,30 +1140,30 @@ * * @providesModule ReactElement */ - + 'use strict'; - + var _assign = __webpack_require__(14); - + var ReactCurrentOwner = __webpack_require__(20); - + var warning = __webpack_require__(21); var canDefineProperty = __webpack_require__(23); var hasOwnProperty = Object.prototype.hasOwnProperty; - + // The Symbol used to tag the ReactElement type. If there is no native Symbol // nor polyfill, then a plain number is used for performance. var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7; - + var RESERVED_PROPS = { key: true, ref: true, __self: true, __source: true }; - + var specialPropKeyWarningShown, specialPropRefWarningShown; - + function hasValidRef(config) { if (process.env.NODE_ENV !== 'production') { if (hasOwnProperty.call(config, 'ref')) { @@ -1175,7 +1175,7 @@ } return config.ref !== undefined; } - + function hasValidKey(config) { if (process.env.NODE_ENV !== 'production') { if (hasOwnProperty.call(config, 'key')) { @@ -1187,7 +1187,7 @@ } return config.key !== undefined; } - + function defineKeyPropWarningGetter(props, displayName) { var warnAboutAccessingKey = function () { if (!specialPropKeyWarningShown) { @@ -1201,7 +1201,7 @@ configurable: true }); } - + function defineRefPropWarningGetter(props, displayName) { var warnAboutAccessingRef = function () { if (!specialPropRefWarningShown) { @@ -1215,7 +1215,7 @@ configurable: true }); } - + /** * Factory method to create a new React element. This no longer adheres to * the class pattern, so do not use new to call it. Also, no instanceof check @@ -1240,17 +1240,17 @@ var element = { // This tag allow us to uniquely identify this as a React Element $$typeof: REACT_ELEMENT_TYPE, - + // Built-in properties that belong on the element type: type, key: key, ref: ref, props: props, - + // Record the component responsible for creating this element. _owner: owner }; - + if (process.env.NODE_ENV !== 'production') { // The validation flag is currently mutative. We put it on // an external backing store so that we can freeze the whole object. @@ -1258,7 +1258,7 @@ // commonly used development environments. element._store = {}; var shadowChildren = Array.isArray(props.children) ? props.children.slice(0) : props.children; - + // To make comparing ReactElements easier for testing purposes, we make // the validation flag non-enumerable (where possible, which should // include every environment we run tests in), so the test framework @@ -1302,25 +1302,25 @@ Object.freeze(element); } } - + return element; }; - + /** * Create and return a new ReactElement of the given type. * See https://facebook.github.io/react/docs/top-level-api.html#react.createelement */ ReactElement.createElement = function (type, config, children) { var propName; - + // Reserved names are extracted var props = {}; - + var key = null; var ref = null; var self = null; var source = null; - + if (config != null) { if (process.env.NODE_ENV !== 'production') { process.env.NODE_ENV !== 'production' ? warning( @@ -1329,14 +1329,14 @@ /* eslint-enable no-proto */ 'React.createElement(...): Expected props argument to be a plain object. ' + 'Properties defined in its prototype chain will be ignored.') : void 0; } - + if (hasValidRef(config)) { ref = config.ref; } if (hasValidKey(config)) { key = '' + config.key; } - + self = config.__self === undefined ? null : config.__self; source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object @@ -1346,7 +1346,7 @@ } } } - + // Children can be more than one argument, and those are transferred onto // the newly allocated props object. var childrenLength = arguments.length - 2; @@ -1359,7 +1359,7 @@ } props.children = childArray; } - + // Resolve default props if (type && type.defaultProps) { var defaultProps = type.defaultProps; @@ -1384,7 +1384,7 @@ } return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); }; - + /** * Return a function that produces ReactElements of a given type. * See https://facebook.github.io/react/docs/top-level-api.html#react.createfactory @@ -1399,23 +1399,23 @@ factory.type = type; return factory; }; - + ReactElement.cloneAndReplaceKey = function (oldElement, newKey) { var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); - + return newElement; }; - + /** * Clone and return a new ReactElement using element as the starting point. * See https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement */ ReactElement.cloneElement = function (element, config, children) { var propName; - + // Original props are copied var props = _assign({}, element.props); - + // Reserved names are extracted var key = element.key; var ref = element.ref; @@ -1425,10 +1425,10 @@ // transpiler, and the original source is probably a better indicator of the // true owner. var source = element._source; - + // Owner will be preserved, unless ref is overridden var owner = element._owner; - + if (config != null) { if (process.env.NODE_ENV !== 'production') { process.env.NODE_ENV !== 'production' ? warning( @@ -1437,7 +1437,7 @@ /* eslint-enable no-proto */ 'React.cloneElement(...): Expected props argument to be a plain object. ' + 'Properties defined in its prototype chain will be ignored.') : void 0; } - + if (hasValidRef(config)) { // Silently steal the ref from the parent. ref = config.ref; @@ -1446,7 +1446,7 @@ if (hasValidKey(config)) { key = '' + config.key; } - + // Remaining properties override existing props var defaultProps; if (element.type && element.type.defaultProps) { @@ -1463,7 +1463,7 @@ } } } - + // Children can be more than one argument, and those are transferred onto // the newly allocated props object. var childrenLength = arguments.length - 2; @@ -1476,10 +1476,10 @@ } props.children = childArray; } - + return ReactElement(element.type, key, ref, self, source, owner, props); }; - + /** * Verifies the object is a ReactElement. * See https://facebook.github.io/react/docs/top-level-api.html#react.isvalidelement @@ -1490,9 +1490,9 @@ ReactElement.isValidElement = function (object) { return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; }; - + ReactElement.REACT_ELEMENT_TYPE = REACT_ELEMENT_TYPE; - + module.exports = ReactElement; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -1510,26 +1510,26 @@ * * @providesModule ReactCurrentOwner */ - + 'use strict'; - + /** * Keeps track of the current owner. * * The current owner is the component who should own any components that are * currently being constructed. */ - + var ReactCurrentOwner = { - + /** * @internal * @type {ReactComponent} */ current: null - + }; - + module.exports = ReactCurrentOwner; /***/ }, @@ -1545,27 +1545,27 @@ * of patent rights can be found in the PATENTS file in the same directory. * */ - + 'use strict'; - + var emptyFunction = __webpack_require__(22); - + /** * Similar to invariant but only logs a warning if the condition is not met. * This can be used to log issues in development environments in critical * paths. Removing the logging code for production environments will keep the * same logic and follow the same code paths. */ - + var warning = emptyFunction; - + if (process.env.NODE_ENV !== 'production') { (function () { var printWarning = function printWarning(format) { for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } - + var argIndex = 0; var message = 'Warning: ' + format.replace(/%s/g, function () { return args[argIndex++]; @@ -1580,27 +1580,27 @@ throw new Error(message); } catch (x) {} }; - + warning = function warning(condition, format) { if (format === undefined) { throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); } - + if (format.indexOf('Failed Composite propType: ') === 0) { return; // Ignore CompositeComponent proptype check. } - + if (!condition) { for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { args[_key2 - 2] = arguments[_key2]; } - + printWarning.apply(undefined, [format].concat(args)); } }; })(); } - + module.exports = warning; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -1609,7 +1609,7 @@ /***/ function(module, exports) { "use strict"; - + /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. @@ -1618,22 +1618,22 @@ * 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. * - * + * */ - + function makeEmptyFunction(arg) { return function () { return arg; }; } - + /** * This function accepts and discards inputs; it has no side effects. This is * primarily useful idiomatically for overridable function endpoints which * always need to be callable, since JS lacks a null-call idiom ala Cocoa. */ var emptyFunction = function emptyFunction() {}; - + emptyFunction.thatReturns = makeEmptyFunction; emptyFunction.thatReturnsFalse = makeEmptyFunction(false); emptyFunction.thatReturnsTrue = makeEmptyFunction(true); @@ -1644,7 +1644,7 @@ emptyFunction.thatReturnsArgument = function (arg) { return arg; }; - + module.exports = emptyFunction; /***/ }, @@ -1661,9 +1661,9 @@ * * @providesModule canDefineProperty */ - + 'use strict'; - + var canDefineProperty = false; if (process.env.NODE_ENV !== 'production') { try { @@ -1673,7 +1673,7 @@ // IE will fail on defineProperty } } - + module.exports = canDefineProperty; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -1691,29 +1691,29 @@ * * @providesModule traverseAllChildren */ - + 'use strict'; - + var _prodInvariant = __webpack_require__(17); - + var ReactCurrentOwner = __webpack_require__(20); var ReactElement = __webpack_require__(19); - + var getIteratorFn = __webpack_require__(25); var invariant = __webpack_require__(18); var KeyEscapeUtils = __webpack_require__(26); var warning = __webpack_require__(21); - + var SEPARATOR = '.'; var SUBSEPARATOR = ':'; - + /** * TODO: Test that a single child and an array with one item have the same key * pattern. */ - + var didWarnAboutMaps = false; - + /** * Generate a key string that identifies a component within a set. * @@ -1731,7 +1731,7 @@ // Implicit key determined by the index in the set return index.toString(36); } - + /** * @param {?*} children Children tree container. * @param {!string} nameSoFar Name of the key path so far. @@ -1742,12 +1742,12 @@ */ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) { var type = typeof children; - + if (type === 'undefined' || type === 'boolean') { // All of the above are perceived as null. children = null; } - + if (children === null || type === 'string' || type === 'number' || ReactElement.isValidElement(children)) { callback(traverseContext, children, // If it's the only child, treat the name as if it was wrapped in an array @@ -1755,12 +1755,12 @@ nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar); return 1; } - + var child; var nextName; var subtreeCount = 0; // Count of children found in the current subtree. var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; - + if (Array.isArray(children)) { for (var i = 0; i < children.length; i++) { child = children[i]; @@ -1819,10 +1819,10 @@ true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : _prodInvariant('31', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : void 0; } } - + return subtreeCount; } - + /** * Traverses children that are typically specified as `props.children`, but * might also be specified through attributes: @@ -1843,10 +1843,10 @@ if (children == null) { return 0; } - + return traverseAllChildrenImpl(children, '', callback, traverseContext); } - + module.exports = traverseAllChildren; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -1863,16 +1863,16 @@ * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getIteratorFn - * + * */ - + 'use strict'; - + /* global Symbol */ - + var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. - + /** * Returns the iterator method function contained on the iterable object. * @@ -1893,7 +1893,7 @@ return iteratorFn; } } - + module.exports = getIteratorFn; /***/ }, @@ -1909,18 +1909,18 @@ * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule KeyEscapeUtils - * + * */ - + 'use strict'; - + /** * Escape and wrap key so it is safe to use as a reactid * * @param {string} key to be escaped. * @return {string} the escaped key. */ - + function escape(key) { var escapeRegex = /[=:]/g; var escaperLookup = { @@ -1930,10 +1930,10 @@ var escapedString = ('' + key).replace(escapeRegex, function (match) { return escaperLookup[match]; }); - + return '$' + escapedString; } - + /** * Unescape and unwrap key for human-readable display * @@ -1947,17 +1947,17 @@ '=2': ':' }; var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1); - + return ('' + keySubstring).replace(unescapeRegex, function (match) { return unescaperLookup[match]; }); } - + var KeyEscapeUtils = { escape: escape, unescape: unescape }; - + module.exports = KeyEscapeUtils; /***/ }, @@ -1974,18 +1974,18 @@ * * @providesModule ReactComponent */ - + 'use strict'; - + var _prodInvariant = __webpack_require__(17); - + var ReactNoopUpdateQueue = __webpack_require__(28); - + var canDefineProperty = __webpack_require__(23); var emptyObject = __webpack_require__(29); var invariant = __webpack_require__(18); var warning = __webpack_require__(21); - + /** * Base class helpers for the updating state of a component. */ @@ -1997,9 +1997,9 @@ // renderer. this.updater = updater || ReactNoopUpdateQueue; } - + ReactComponent.prototype.isReactComponent = {}; - + /** * Sets a subset of the state. Always use this to mutate * state. You should treat `this.state` as immutable. @@ -2032,7 +2032,7 @@ this.updater.enqueueCallback(this, callback, 'setState'); } }; - + /** * Forces an update. This should only be invoked when it is known with * certainty that we are **not** in a DOM transaction. @@ -2053,7 +2053,7 @@ this.updater.enqueueCallback(this, callback, 'forceUpdate'); } }; - + /** * Deprecated APIs. These APIs used to exist on classic React classes but since * we would like to deprecate them, we're not going to move them over to this @@ -2080,7 +2080,7 @@ } } } - + module.exports = ReactComponent; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -2098,23 +2098,23 @@ * * @providesModule ReactNoopUpdateQueue */ - + 'use strict'; - + var warning = __webpack_require__(21); - + function warnNoop(publicInstance, callerName) { if (process.env.NODE_ENV !== 'production') { var constructor = publicInstance.constructor; process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0; } } - + /** * This is the abstract API for an update queue. */ var ReactNoopUpdateQueue = { - + /** * Checks whether or not this composite component is mounted. * @param {ReactClass} publicInstance The instance we want to test. @@ -2125,7 +2125,7 @@ isMounted: function (publicInstance) { return false; }, - + /** * Enqueue a callback that will be executed after all the pending updates * have processed. @@ -2135,7 +2135,7 @@ * @internal */ enqueueCallback: function (publicInstance, callback) {}, - + /** * Forces an update. This should only be invoked when it is known with * certainty that we are **not** in a DOM transaction. @@ -2152,7 +2152,7 @@ enqueueForceUpdate: function (publicInstance) { warnNoop(publicInstance, 'forceUpdate'); }, - + /** * Replaces all of the state. Always use this or `setState` to mutate state. * You should treat `this.state` as immutable. @@ -2167,7 +2167,7 @@ enqueueReplaceState: function (publicInstance, completeState) { warnNoop(publicInstance, 'replaceState'); }, - + /** * Sets a subset of the state. This only exists because _pendingState is * internal. This provides a merging strategy that is not available to deep @@ -2182,7 +2182,7 @@ warnNoop(publicInstance, 'setState'); } }; - + module.exports = ReactNoopUpdateQueue; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -2199,15 +2199,15 @@ * of patent rights can be found in the PATENTS file in the same directory. * */ - + 'use strict'; - + var emptyObject = {}; - + if (process.env.NODE_ENV !== 'production') { Object.freeze(emptyObject); } - + module.exports = emptyObject; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -2225,16 +2225,16 @@ * * @providesModule ReactPureComponent */ - + 'use strict'; - + var _assign = __webpack_require__(14); - + var ReactComponent = __webpack_require__(27); var ReactNoopUpdateQueue = __webpack_require__(28); - + var emptyObject = __webpack_require__(29); - + /** * Base class helpers for the updating state of a component. */ @@ -2247,7 +2247,7 @@ // renderer. this.updater = updater || ReactNoopUpdateQueue; } - + function ComponentDummy() {} ComponentDummy.prototype = ReactComponent.prototype; ReactPureComponent.prototype = new ComponentDummy(); @@ -2255,7 +2255,7 @@ // Avoid an extra prototype jump for these methods. _assign(ReactPureComponent.prototype, ReactComponent.prototype); ReactPureComponent.prototype.isPureReactComponent = true; - + module.exports = ReactPureComponent; /***/ }, @@ -2272,26 +2272,26 @@ * * @providesModule ReactClass */ - + 'use strict'; - + var _prodInvariant = __webpack_require__(17), _assign = __webpack_require__(14); - + var ReactComponent = __webpack_require__(27); var ReactElement = __webpack_require__(19); var ReactPropTypeLocations = __webpack_require__(32); var ReactPropTypeLocationNames = __webpack_require__(34); var ReactNoopUpdateQueue = __webpack_require__(28); - + var emptyObject = __webpack_require__(29); var invariant = __webpack_require__(18); var keyMirror = __webpack_require__(33); var keyOf = __webpack_require__(35); var warning = __webpack_require__(21); - + var MIXINS_KEY = keyOf({ mixins: null }); - + /** * Policies that describe methods in `ReactClassInterface`. */ @@ -2316,9 +2316,9 @@ */ DEFINE_MANY_MERGED: null }); - + var injectedMixins = []; - + /** * Composite components are higher-level components that compose other composite * or host components. @@ -2342,7 +2342,7 @@ * @internal */ var ReactClassInterface = { - + /** * An array of Mixin objects to include when defining your component. * @@ -2350,7 +2350,7 @@ * @optional */ mixins: SpecPolicy.DEFINE_MANY, - + /** * An object containing properties and methods that should be defined on * the component's constructor instead of its prototype (static methods). @@ -2359,7 +2359,7 @@ * @optional */ statics: SpecPolicy.DEFINE_MANY, - + /** * Definition of prop types for this component. * @@ -2367,7 +2367,7 @@ * @optional */ propTypes: SpecPolicy.DEFINE_MANY, - + /** * Definition of context types for this component. * @@ -2375,7 +2375,7 @@ * @optional */ contextTypes: SpecPolicy.DEFINE_MANY, - + /** * Definition of context types this component sets for its children. * @@ -2383,9 +2383,9 @@ * @optional */ childContextTypes: SpecPolicy.DEFINE_MANY, - + // ==== Definition methods ==== - + /** * Invoked when the component is mounted. Values in the mapping will be set on * `this.props` if that prop is not specified (i.e. using an `in` check). @@ -2397,7 +2397,7 @@ * @optional */ getDefaultProps: SpecPolicy.DEFINE_MANY_MERGED, - + /** * Invoked once before the component is mounted. The return value will be used * as the initial value of `this.state`. @@ -2413,13 +2413,13 @@ * @optional */ getInitialState: SpecPolicy.DEFINE_MANY_MERGED, - + /** * @return {object} * @optional */ getChildContext: SpecPolicy.DEFINE_MANY_MERGED, - + /** * Uses props from `this.props` and state from `this.state` to render the * structure of the component. @@ -2437,9 +2437,9 @@ * @required */ render: SpecPolicy.DEFINE_ONCE, - + // ==== Delegate methods ==== - + /** * Invoked when the component is initially created and about to be mounted. * This may have side effects, but any external subscriptions or data created @@ -2448,7 +2448,7 @@ * @optional */ componentWillMount: SpecPolicy.DEFINE_MANY, - + /** * Invoked when the component has been mounted and has a DOM representation. * However, there is no guarantee that the DOM node is in the document. @@ -2460,7 +2460,7 @@ * @optional */ componentDidMount: SpecPolicy.DEFINE_MANY, - + /** * Invoked before the component receives new props. * @@ -2481,7 +2481,7 @@ * @optional */ componentWillReceiveProps: SpecPolicy.DEFINE_MANY, - + /** * Invoked while deciding if the component should be updated as a result of * receiving new props, state and/or context. @@ -2503,7 +2503,7 @@ * @optional */ shouldComponentUpdate: SpecPolicy.DEFINE_ONCE, - + /** * Invoked when the component is about to update due to a transition from * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState` @@ -2520,7 +2520,7 @@ * @optional */ componentWillUpdate: SpecPolicy.DEFINE_MANY, - + /** * Invoked when the component's DOM representation has been updated. * @@ -2534,7 +2534,7 @@ * @optional */ componentDidUpdate: SpecPolicy.DEFINE_MANY, - + /** * Invoked when the component is about to be removed from its parent and have * its DOM representation destroyed. @@ -2547,9 +2547,9 @@ * @optional */ componentWillUnmount: SpecPolicy.DEFINE_MANY, - + // ==== Advanced methods ==== - + /** * Updates the component's currently mounted DOM representation. * @@ -2561,9 +2561,9 @@ * @overridable */ updateComponent: SpecPolicy.OVERRIDE_BASE - + }; - + /** * Mapping from class specification keys to special processing functions. * @@ -2617,7 +2617,7 @@ mixStaticSpecIntoComponent(Constructor, statics); }, autobind: function () {} }; - + // noop function validateTypeDef(Constructor, typeDef, location) { for (var propName in typeDef) { @@ -2628,21 +2628,21 @@ } } } - + function validateMethodOverride(isAlreadyDefined, name) { var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null; - + // Disallow overriding of base class methods unless explicitly allowed. if (ReactClassMixin.hasOwnProperty(name)) { !(specPolicy === SpecPolicy.OVERRIDE_BASE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override `%s` from your class specification. Ensure that your method names do not overlap with React methods.', name) : _prodInvariant('73', name) : void 0; } - + // Disallow defining methods more than once unless explicitly allowed. if (isAlreadyDefined) { !(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.', name) : _prodInvariant('74', name) : void 0; } } - + /** * Mixin helper which handles policy validation and reserved * specification keys when building React classes. @@ -2652,40 +2652,40 @@ if (process.env.NODE_ENV !== 'production') { var typeofSpec = typeof spec; var isMixinValid = typeofSpec === 'object' && spec !== null; - + process.env.NODE_ENV !== 'production' ? warning(isMixinValid, '%s: You\'re attempting to include a mixin that is either null ' + 'or not an object. Check the mixins included by the component, ' + 'as well as any mixins they include themselves. ' + 'Expected object but got %s.', Constructor.displayName || 'ReactClass', spec === null ? null : typeofSpec) : void 0; } - + return; } - + !(typeof spec !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to use a component class or function as a mixin. Instead, just use a regular object.') : _prodInvariant('75') : void 0; !!ReactElement.isValidElement(spec) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to use a component as a mixin. Instead, just use a regular object.') : _prodInvariant('76') : void 0; - + var proto = Constructor.prototype; var autoBindPairs = proto.__reactAutoBindPairs; - + // By handling mixins before any other properties, we ensure the same // chaining order is applied to methods with DEFINE_MANY policy, whether // mixins are listed before or after these methods in the spec. if (spec.hasOwnProperty(MIXINS_KEY)) { RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); } - + for (var name in spec) { if (!spec.hasOwnProperty(name)) { continue; } - + if (name === MIXINS_KEY) { // We have already handled mixins in a special case above. continue; } - + var property = spec[name]; var isAlreadyDefined = proto.hasOwnProperty(name); validateMethodOverride(isAlreadyDefined, name); - + if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { RESERVED_SPEC_KEYS[name](Constructor, property); } else { @@ -2696,17 +2696,17 @@ var isReactClassMethod = ReactClassInterface.hasOwnProperty(name); var isFunction = typeof property === 'function'; var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false; - + if (shouldAutoBind) { autoBindPairs.push(name, property); proto[name] = property; } else { if (isAlreadyDefined) { var specPolicy = ReactClassInterface[name]; - + // These cases should already be caught by validateMethodOverride. !(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.', specPolicy, name) : _prodInvariant('77', specPolicy, name) : void 0; - + // For methods which are defined more than once, call the existing // methods before calling the new property, merging if appropriate. if (specPolicy === SpecPolicy.DEFINE_MANY_MERGED) { @@ -2728,7 +2728,7 @@ } } } - + function mixStaticSpecIntoComponent(Constructor, statics) { if (!statics) { return; @@ -2738,16 +2738,16 @@ if (!statics.hasOwnProperty(name)) { continue; } - + var isReserved = name in RESERVED_SPEC_KEYS; !!isReserved ? process.env.NODE_ENV !== 'production' ? invariant(false, '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.', name) : _prodInvariant('78', name) : void 0; - + var isInherited = name in Constructor; !!isInherited ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.', name) : _prodInvariant('79', name) : void 0; Constructor[name] = property; } } - + /** * Merge two objects, but throw if both contain the same key. * @@ -2757,7 +2757,7 @@ */ function mergeIntoWithNoDuplicateKeys(one, two) { !(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : _prodInvariant('80') : void 0; - + for (var key in two) { if (two.hasOwnProperty(key)) { !(one[key] === undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, '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.', key) : _prodInvariant('81', key) : void 0; @@ -2766,7 +2766,7 @@ } return one; } - + /** * Creates a function that invokes two functions and merges their return values. * @@ -2790,7 +2790,7 @@ return c; }; } - + /** * Creates a function that invokes two functions and ignores their return vales. * @@ -2805,7 +2805,7 @@ two.apply(this, arguments); }; } - + /** * Binds a method to the component. * @@ -2825,7 +2825,7 @@ for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } - + // User is trying to bind() an autobound method; we effectively will // ignore the value of "this" that the user is trying to use, so // let's warn. @@ -2844,7 +2844,7 @@ } return boundMethod; } - + /** * Binds all auto-bound methods in a component. * @@ -2858,13 +2858,13 @@ component[autoBindKey] = bindAutoBindMethod(component, method); } } - + /** * Add more to the ReactClass base class. These are all legacy features and * therefore not already part of the modern ReactComponent. */ var ReactClassMixin = { - + /** * TODO: This will be deprecated because state should always keep a consistent * type signature and the only use case for this, is to avoid that. @@ -2875,7 +2875,7 @@ this.updater.enqueueCallback(this, callback, 'replaceState'); } }, - + /** * Checks whether or not this composite component is mounted. * @return {boolean} True if mounted, false otherwise. @@ -2886,17 +2886,17 @@ return this.updater.isMounted(this); } }; - + var ReactClassComponent = function () {}; _assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin); - + /** * Module for creating composite components. * * @class ReactClass */ var ReactClass = { - + /** * Creates a composite component class given a class specification. * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass @@ -2909,26 +2909,26 @@ var Constructor = function (props, context, updater) { // This constructor gets overridden by mocks. The argument is used // by mocks to assert on what gets mounted. - + if (process.env.NODE_ENV !== 'production') { process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0; } - + // Wire up auto-binding if (this.__reactAutoBindPairs.length) { bindAutoBindMethods(this); } - + this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; - + this.state = null; - + // ReactClasses doesn't have constructors. Instead, they use the // getInitialState and componentWillMount methods for initialization. - + var initialState = this.getInitialState ? this.getInitialState() : null; if (process.env.NODE_ENV !== 'production') { // We allow auto-mocks to proceed as if they're returning null. @@ -2939,22 +2939,22 @@ } } !(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : _prodInvariant('82', Constructor.displayName || 'ReactCompositeComponent') : void 0; - + this.state = initialState; }; Constructor.prototype = new ReactClassComponent(); Constructor.prototype.constructor = Constructor; Constructor.prototype.__reactAutoBindPairs = []; - + injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor)); - + mixSpecIntoComponent(Constructor, spec); - + // Initialize the defaultProps property after all mixins have been merged. if (Constructor.getDefaultProps) { Constructor.defaultProps = Constructor.getDefaultProps(); } - + if (process.env.NODE_ENV !== 'production') { // This is a tag to indicate that the use of these method names is ok, // since it's used with createClass. If it's not, then it's likely a @@ -2967,32 +2967,32 @@ Constructor.prototype.getInitialState.isReactClassApproved = {}; } } - + !Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : _prodInvariant('83') : void 0; - + if (process.env.NODE_ENV !== 'production') { process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : void 0; process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : void 0; } - + // Reduce time spent doing lookups by setting these on the prototype. for (var methodName in ReactClassInterface) { if (!Constructor.prototype[methodName]) { Constructor.prototype[methodName] = null; } } - + return Constructor; }, - + injection: { injectMixin: function (mixin) { injectedMixins.push(mixin); } } - + }; - + module.exports = ReactClass; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -3010,17 +3010,17 @@ * * @providesModule ReactPropTypeLocations */ - + 'use strict'; - + var keyMirror = __webpack_require__(33); - + var ReactPropTypeLocations = keyMirror({ prop: null, context: null, childContext: null }); - + module.exports = ReactPropTypeLocations; /***/ }, @@ -3037,11 +3037,11 @@ * * @typechecks static-only */ - + 'use strict'; - + var invariant = __webpack_require__(18); - + /** * Constructs an enumeration with keys equal to their value. * @@ -3072,7 +3072,7 @@ } return ret; }; - + module.exports = keyMirror; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -3090,11 +3090,11 @@ * * @providesModule ReactPropTypeLocationNames */ - + 'use strict'; - + var ReactPropTypeLocationNames = {}; - + if (process.env.NODE_ENV !== 'production') { ReactPropTypeLocationNames = { prop: 'prop', @@ -3102,7 +3102,7 @@ childContext: 'child context' }; } - + module.exports = ReactPropTypeLocationNames; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -3111,7 +3111,7 @@ /***/ function(module, exports) { "use strict"; - + /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. @@ -3121,7 +3121,7 @@ * of patent rights can be found in the PATENTS file in the same directory. * */ - + /** * Allows extraction of a minified key. Let's the build system minify keys * without losing the ability to dynamically use key strings as values @@ -3142,7 +3142,7 @@ } return null; }; - + module.exports = keyOf; /***/ }, @@ -3159,11 +3159,11 @@ * * @providesModule ReactDOMFactories */ - + 'use strict'; - + var ReactElement = __webpack_require__(19); - + /** * Create a factory that creates HTML tag elements. * @@ -3174,7 +3174,7 @@ var ReactElementValidator = __webpack_require__(37); createDOMFactory = ReactElementValidator.createFactory; } - + /** * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes. * This is also accessible via `React.DOM`. @@ -3295,7 +3295,7 @@ 'var': createDOMFactory('var'), video: createDOMFactory('video'), wbr: createDOMFactory('wbr'), - + // SVG circle: createDOMFactory('circle'), clipPath: createDOMFactory('clipPath'), @@ -3317,7 +3317,7 @@ text: createDOMFactory('text'), tspan: createDOMFactory('tspan') }; - + module.exports = ReactDOMFactories; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -3335,27 +3335,27 @@ * * @providesModule ReactElementValidator */ - + /** * ReactElementValidator provides a wrapper around a element factory * which validates the props passed to the element. This is intended to be * used only in DEV and could be replaced by a static type checker for languages * that support it. */ - + 'use strict'; - + var ReactCurrentOwner = __webpack_require__(20); var ReactComponentTreeHook = __webpack_require__(38); var ReactElement = __webpack_require__(19); var ReactPropTypeLocations = __webpack_require__(32); - + var checkReactTypeSpec = __webpack_require__(39); - + var canDefineProperty = __webpack_require__(23); var getIteratorFn = __webpack_require__(25); var warning = __webpack_require__(21); - + function getDeclarationErrorAddendum() { if (ReactCurrentOwner.current) { var name = ReactCurrentOwner.current.getName(); @@ -3365,17 +3365,17 @@ } return ''; } - + /** * Warn if there's no key explicitly set on dynamic arrays of children or * object keys are not valid. This allows us to keep track of children between * updates. */ var ownerHasKeyUseWarning = {}; - + function getCurrentComponentErrorInfo(parentType) { var info = getDeclarationErrorAddendum(); - + if (!info) { var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; if (parentName) { @@ -3384,7 +3384,7 @@ } return info; } - + /** * Warn if the element doesn't have an explicit key assigned to it. * This element is in an array. The array could grow and shrink or be @@ -3401,15 +3401,15 @@ return; } element._store.validated = true; - + var memoizer = ownerHasKeyUseWarning.uniqueKey || (ownerHasKeyUseWarning.uniqueKey = {}); - + var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); if (memoizer[currentComponentErrorInfo]) { return; } memoizer[currentComponentErrorInfo] = true; - + // Usually the current owner is the offender, but if it accepts children as a // property, it may be the creator of the child that's responsible for // assigning it a key. @@ -3418,10 +3418,10 @@ // Give the component that originally created this child. childOwner = ' It was passed a child from ' + element._owner.getName() + '.'; } - + process.env.NODE_ENV !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.%s', currentComponentErrorInfo, childOwner, ReactComponentTreeHook.getCurrentStackAddendum(element)) : void 0; } - + /** * Ensure that every element either is passed in a static location, in an * array with an explicit keys property defined, or in an object literal @@ -3463,7 +3463,7 @@ } } } - + /** * Given an element, validate that its props follow the propTypes definition, * provided by the type. @@ -3483,9 +3483,9 @@ process.env.NODE_ENV !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0; } } - + var ReactElementValidator = { - + createElement: function (type, props, children) { var validType = typeof type === 'string' || typeof type === 'function'; // We warn in this case but don't throw. We expect the element creation to @@ -3493,15 +3493,15 @@ if (!validType) { process.env.NODE_ENV !== 'production' ? warning(false, 'React.createElement: type should not be null, undefined, boolean, or ' + 'number. It should be a string (for DOM elements) or a ReactClass ' + '(for composite components).%s', getDeclarationErrorAddendum()) : void 0; } - + var element = ReactElement.createElement.apply(this, arguments); - + // The result can be nullish if a mock or a custom function is used. // TODO: Drop this when these are no longer allowed as the type argument. if (element == null) { return element; } - + // Skip key warning if the type isn't valid since our key validation logic // doesn't expect a non-string/function type and can throw confusing errors. // We don't want exception behavior to differ between dev and prod. @@ -3512,17 +3512,17 @@ validateChildKeys(arguments[i], type); } } - + validatePropTypes(element); - + return element; }, - + createFactory: function (type) { var validatedFactory = ReactElementValidator.createElement.bind(null, type); // Legacy hook TODO: Warn if this is accessed validatedFactory.type = type; - + if (process.env.NODE_ENV !== 'production') { if (canDefineProperty) { Object.defineProperty(validatedFactory, 'type', { @@ -3537,10 +3537,10 @@ }); } } - + return validatedFactory; }, - + cloneElement: function (element, props, children) { var newElement = ReactElement.cloneElement.apply(this, arguments); for (var i = 2; i < arguments.length; i++) { @@ -3549,9 +3549,9 @@ validatePropTypes(newElement); return newElement; } - + }; - + module.exports = ReactElementValidator; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -3569,16 +3569,16 @@ * * @providesModule ReactComponentTreeHook */ - + 'use strict'; - + var _prodInvariant = __webpack_require__(17); - + var ReactCurrentOwner = __webpack_require__(20); - + var invariant = __webpack_require__(18); var warning = __webpack_require__(21); - + function isNative(fn) { // Based on isNative() from Lodash var funcToString = Function.prototype.toString; @@ -3597,7 +3597,7 @@ return false; } } - + var canUseCollections = // Array.from typeof Array.from === 'function' && @@ -3609,13 +3609,13 @@ typeof Set === 'function' && isNative(Set) && // Set.prototype.keys Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys); - + var itemMap; var rootIDSet; - + var itemByKey; var rootByKey; - + if (canUseCollections) { itemMap = new Map(); rootIDSet = new Set(); @@ -3623,9 +3623,9 @@ itemByKey = {}; rootByKey = {}; } - + var unmountedIDs = []; - + // Use non-numeric keys to prevent V8 performance issues: // https://github.com/facebook/react/pull/7232 function getKeyFromID(id) { @@ -3634,7 +3634,7 @@ function getIDFromKey(key) { return parseInt(key.substr(1), 10); } - + function get(id) { if (canUseCollections) { return itemMap.get(id); @@ -3643,7 +3643,7 @@ return itemByKey[key]; } } - + function remove(id) { if (canUseCollections) { itemMap['delete'](id); @@ -3652,7 +3652,7 @@ delete itemByKey[key]; } } - + function create(id, element, parentID) { var item = { element: element, @@ -3662,7 +3662,7 @@ isMounted: false, updateCount: 0 }; - + if (canUseCollections) { itemMap.set(id, item); } else { @@ -3670,7 +3670,7 @@ itemByKey[key] = item; } } - + function addRoot(id) { if (canUseCollections) { rootIDSet.add(id); @@ -3679,7 +3679,7 @@ rootByKey[key] = true; } } - + function removeRoot(id) { if (canUseCollections) { rootIDSet['delete'](id); @@ -3688,7 +3688,7 @@ delete rootByKey[key]; } } - + function getRegisteredIDs() { if (canUseCollections) { return Array.from(itemMap.keys()); @@ -3696,7 +3696,7 @@ return Object.keys(itemByKey).map(getIDFromKey); } } - + function getRootIDs() { if (canUseCollections) { return Array.from(rootIDSet.keys()); @@ -3704,21 +3704,21 @@ return Object.keys(rootByKey).map(getIDFromKey); } } - + function purgeDeep(id) { var item = get(id); if (item) { var childIDs = item.childIDs; - + remove(id); childIDs.forEach(purgeDeep); } } - + function describeComponentFrame(name, source, ownerName) { return '\n in ' + name + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : ''); } - + function getDisplayName(element) { if (element == null) { return '#empty'; @@ -3730,7 +3730,7 @@ return element.type.displayName || element.type.name || 'Unknown'; } } - + function describeID(id) { var name = ReactComponentTreeHook.getDisplayName(id); var element = ReactComponentTreeHook.getElement(id); @@ -3742,12 +3742,12 @@ process.env.NODE_ENV !== 'production' ? warning(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id) : void 0; return describeComponentFrame(name, element && element._source, ownerName); } - + var ReactComponentTreeHook = { onSetChildren: function (id, nextChildIDs) { var item = get(id); item.childIDs = nextChildIDs; - + for (var i = 0; i < nextChildIDs.length; i++) { var nextChildID = nextChildIDs[i]; var nextChild = get(nextChildID); @@ -3813,7 +3813,7 @@ // Should only be used for testing. return; } - + for (var i = 0; i < unmountedIDs.length; i++) { var id = unmountedIDs[i]; purgeDeep(id); @@ -3832,10 +3832,10 @@ var owner = topElement._owner; info += describeComponentFrame(name || 'Unknown', topElement._source, owner && owner.getName()); } - + var currentOwner = ReactCurrentOwner.current; var id = currentOwner && currentOwner._debugID; - + info += ReactComponentTreeHook.getStackAddendumByID(id); return info; }, @@ -3893,13 +3893,13 @@ var item = get(id); return item ? item.updateCount : 0; }, - - + + getRegisteredIDs: getRegisteredIDs, - + getRootIDs: getRootIDs }; - + module.exports = ReactComponentTreeHook; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -3917,19 +3917,19 @@ * * @providesModule checkReactTypeSpec */ - + 'use strict'; - + var _prodInvariant = __webpack_require__(17); - + var ReactPropTypeLocationNames = __webpack_require__(34); var ReactPropTypesSecret = __webpack_require__(40); - + var invariant = __webpack_require__(18); var warning = __webpack_require__(21); - + var ReactComponentTreeHook; - + if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV === 'test') { // Temporary hack. // Inline requires don't work well with Jest: @@ -3938,9 +3938,9 @@ // https://github.com/facebook/react/pull/7178 ReactComponentTreeHook = __webpack_require__(38); } - + var loggedTypeFailures = {}; - + /** * Assert that the values match with the type specs. * Error messages are memorized and will only be shown once. @@ -3973,9 +3973,9 @@ // Only monitor this failure once because there tends to be a lot of the // same error. loggedTypeFailures[error.message] = true; - + var componentStackInfo = ''; - + if (process.env.NODE_ENV !== 'production') { if (!ReactComponentTreeHook) { ReactComponentTreeHook = __webpack_require__(38); @@ -3986,13 +3986,13 @@ componentStackInfo = ReactComponentTreeHook.getCurrentStackAddendum(element); } } - + process.env.NODE_ENV !== 'production' ? warning(false, 'Failed %s type: %s%s', location, error.message, componentStackInfo) : void 0; } } } } - + module.exports = checkReactTypeSpec; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -4010,11 +4010,11 @@ * * @providesModule ReactPropTypesSecret */ - + 'use strict'; - + var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; - + module.exports = ReactPropTypesSecret; /***/ }, @@ -4031,17 +4031,17 @@ * * @providesModule ReactPropTypes */ - + 'use strict'; - + var ReactElement = __webpack_require__(19); var ReactPropTypeLocationNames = __webpack_require__(34); var ReactPropTypesSecret = __webpack_require__(40); - + var emptyFunction = __webpack_require__(22); var getIteratorFn = __webpack_require__(25); var warning = __webpack_require__(21); - + /** * Collection of methods that allow declaration and validation of props that are * supplied to React components. Example usage: @@ -4088,9 +4088,9 @@ * * @internal */ - + var ANONYMOUS = '<>'; - + var ReactPropTypes = { array: createPrimitiveTypeChecker('array'), bool: createPrimitiveTypeChecker('boolean'), @@ -4099,7 +4099,7 @@ object: createPrimitiveTypeChecker('object'), string: createPrimitiveTypeChecker('string'), symbol: createPrimitiveTypeChecker('symbol'), - + any: createAnyTypeChecker(), arrayOf: createArrayOfTypeChecker, element: createElementTypeChecker(), @@ -4110,7 +4110,7 @@ oneOfType: createUnionTypeChecker, shape: createShapeTypeChecker }; - + /** * inlined Object.is polyfill to avoid requiring consumers ship their own * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is @@ -4128,7 +4128,7 @@ } } /*eslint-enable no-self-compare*/ - + /** * We use an Error-like object for backward compatibility as people may call * PropTypes directly and inspect their output. However we don't use real @@ -4142,7 +4142,7 @@ } // Make `instanceof Error` still work for returned errors. PropTypeError.prototype = Error.prototype; - + function createChainableTypeChecker(validate) { if (process.env.NODE_ENV !== 'production') { var manualPropTypeCallCache = {}; @@ -4169,13 +4169,13 @@ return validate(props, propName, componentName, location, propFullName); } } - + var chainedCheckType = checkType.bind(null, false); chainedCheckType.isRequired = checkType.bind(null, true); - + return chainedCheckType; } - + function createPrimitiveTypeChecker(expectedType) { function validate(props, propName, componentName, location, propFullName, secret) { var propValue = props[propName]; @@ -4186,18 +4186,18 @@ // check, but we can offer a more precise error message here rather than // 'of type `object`'. var preciseType = getPreciseType(propValue); - + return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); } return null; } return createChainableTypeChecker(validate); } - + function createAnyTypeChecker() { return createChainableTypeChecker(emptyFunction.thatReturns(null)); } - + function createArrayOfTypeChecker(typeChecker) { function validate(props, propName, componentName, location, propFullName) { if (typeof typeChecker !== 'function') { @@ -4219,7 +4219,7 @@ } return createChainableTypeChecker(validate); } - + function createElementTypeChecker() { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; @@ -4232,7 +4232,7 @@ } return createChainableTypeChecker(validate); } - + function createInstanceTypeChecker(expectedClass) { function validate(props, propName, componentName, location, propFullName) { if (!(props[propName] instanceof expectedClass)) { @@ -4245,13 +4245,13 @@ } return createChainableTypeChecker(validate); } - + function createEnumTypeChecker(expectedValues) { if (!Array.isArray(expectedValues)) { process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0; return emptyFunction.thatReturnsNull; } - + function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; for (var i = 0; i < expectedValues.length; i++) { @@ -4259,14 +4259,14 @@ return null; } } - + var locationName = ReactPropTypeLocationNames[location]; var valuesString = JSON.stringify(expectedValues); return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); } return createChainableTypeChecker(validate); } - + function createObjectOfTypeChecker(typeChecker) { function validate(props, propName, componentName, location, propFullName) { if (typeof typeChecker !== 'function') { @@ -4290,13 +4290,13 @@ } return createChainableTypeChecker(validate); } - + function createUnionTypeChecker(arrayOfTypeCheckers) { if (!Array.isArray(arrayOfTypeCheckers)) { process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; return emptyFunction.thatReturnsNull; } - + function validate(props, propName, componentName, location, propFullName) { for (var i = 0; i < arrayOfTypeCheckers.length; i++) { var checker = arrayOfTypeCheckers[i]; @@ -4304,13 +4304,13 @@ return null; } } - + var locationName = ReactPropTypeLocationNames[location]; return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); } return createChainableTypeChecker(validate); } - + function createNodeChecker() { function validate(props, propName, componentName, location, propFullName) { if (!isNode(props[propName])) { @@ -4321,7 +4321,7 @@ } return createChainableTypeChecker(validate); } - + function createShapeTypeChecker(shapeTypes) { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; @@ -4344,7 +4344,7 @@ } return createChainableTypeChecker(validate); } - + function isNode(propValue) { switch (typeof propValue) { case 'number': @@ -4360,7 +4360,7 @@ if (propValue === null || ReactElement.isValidElement(propValue)) { return true; } - + var iteratorFn = getIteratorFn(propValue); if (iteratorFn) { var iterator = iteratorFn.call(propValue); @@ -4385,32 +4385,32 @@ } else { return false; } - + return true; default: return false; } } - + function isSymbol(propType, propValue) { // Native Symbol. if (propType === 'symbol') { return true; } - + // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' if (propValue['@@toStringTag'] === 'Symbol') { return true; } - + // Fallback for non-spec compliant Symbols which are polyfilled. if (typeof Symbol === 'function' && propValue instanceof Symbol) { return true; } - + return false; } - + // Equivalent of `typeof` but with special handling for array and regexp. function getPropType(propValue) { var propType = typeof propValue; @@ -4428,7 +4428,7 @@ } return propType; } - + // This handles more types than `getPropType`. Only used for error messages. // See `createPrimitiveTypeChecker`. function getPreciseType(propValue) { @@ -4442,7 +4442,7 @@ } return propType; } - + // Returns class name of the object, if any. function getClassName(propValue) { if (!propValue.constructor || !propValue.constructor.name) { @@ -4450,7 +4450,7 @@ } return propValue.constructor.name; } - + module.exports = ReactPropTypes; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -4468,9 +4468,9 @@ * * @providesModule ReactVersion */ - + 'use strict'; - + module.exports = '15.3.1'; /***/ }, @@ -4488,13 +4488,13 @@ * @providesModule onlyChild */ 'use strict'; - + var _prodInvariant = __webpack_require__(17); - + var ReactElement = __webpack_require__(19); - + var invariant = __webpack_require__(18); - + /** * Returns the first child in a collection of children and verifies that there * is only one child in the collection. @@ -4513,7 +4513,7 @@ !ReactElement.isValidElement(children) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React.Children.only expected to receive a single React element child.') : _prodInvariant('143') : void 0; return children; } - + module.exports = onlyChild; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -4529,19 +4529,19 @@ * 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. */ - + if (process.env.NODE_ENV !== 'production') { var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' && Symbol.for && Symbol.for('react.element')) || 0xeac7; - + var isValidElement = function(object) { return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; }; - + // By explicitly using `prop-types` you are opting into new development behavior. // http://fb.me/prop-types-in-prod var throwOnDirectAccess = true; @@ -4551,7 +4551,7 @@ // http://fb.me/prop-types-in-prod module.exports = __webpack_require__(51)(); } - + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) /***/ }, @@ -4566,21 +4566,21 @@ * 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. */ - + 'use strict'; - + var emptyFunction = __webpack_require__(46); var invariant = __webpack_require__(47); var warning = __webpack_require__(48); - + var ReactPropTypesSecret = __webpack_require__(49); var checkPropTypes = __webpack_require__(50); - + module.exports = function(isValidElement, throwOnDirectAccess) { /* global Symbol */ var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. - + /** * Returns the iterator method function contained on the iterable object. * @@ -4601,7 +4601,7 @@ return iteratorFn; } } - + /** * Collection of methods that allow declaration and validation of props that are * supplied to React components. Example usage: @@ -4648,9 +4648,9 @@ * * @internal */ - + var ANONYMOUS = '<>'; - + // Important! // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. var ReactPropTypes = { @@ -4661,7 +4661,7 @@ object: createPrimitiveTypeChecker('object'), string: createPrimitiveTypeChecker('string'), symbol: createPrimitiveTypeChecker('symbol'), - + any: createAnyTypeChecker(), arrayOf: createArrayOfTypeChecker, element: createElementTypeChecker(), @@ -4672,7 +4672,7 @@ oneOfType: createUnionTypeChecker, shape: createShapeTypeChecker }; - + /** * inlined Object.is polyfill to avoid requiring consumers ship their own * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is @@ -4690,7 +4690,7 @@ } } /*eslint-enable no-self-compare*/ - + /** * We use an Error-like object for backward compatibility as people may call * PropTypes directly and inspect their output. However, we don't use real @@ -4704,7 +4704,7 @@ } // Make `instanceof Error` still work for returned errors. PropTypeError.prototype = Error.prototype; - + function createChainableTypeChecker(validate) { if (process.env.NODE_ENV !== 'production') { var manualPropTypeCallCache = {}; @@ -4713,7 +4713,7 @@ function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { componentName = componentName || ANONYMOUS; propFullName = propFullName || propName; - + if (secret !== ReactPropTypesSecret) { if (throwOnDirectAccess) { // New behavior only for users of `prop-types` package @@ -4758,13 +4758,13 @@ return validate(props, propName, componentName, location, propFullName); } } - + var chainedCheckType = checkType.bind(null, false); chainedCheckType.isRequired = checkType.bind(null, true); - + return chainedCheckType; } - + function createPrimitiveTypeChecker(expectedType) { function validate(props, propName, componentName, location, propFullName, secret) { var propValue = props[propName]; @@ -4774,18 +4774,18 @@ // check, but we can offer a more precise error message here rather than // 'of type `object`'. var preciseType = getPreciseType(propValue); - + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); } return null; } return createChainableTypeChecker(validate); } - + function createAnyTypeChecker() { return createChainableTypeChecker(emptyFunction.thatReturnsNull); } - + function createArrayOfTypeChecker(typeChecker) { function validate(props, propName, componentName, location, propFullName) { if (typeof typeChecker !== 'function') { @@ -4806,7 +4806,7 @@ } return createChainableTypeChecker(validate); } - + function createElementTypeChecker() { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; @@ -4818,7 +4818,7 @@ } return createChainableTypeChecker(validate); } - + function createInstanceTypeChecker(expectedClass) { function validate(props, propName, componentName, location, propFullName) { if (!(props[propName] instanceof expectedClass)) { @@ -4830,13 +4830,13 @@ } return createChainableTypeChecker(validate); } - + function createEnumTypeChecker(expectedValues) { if (!Array.isArray(expectedValues)) { process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0; return emptyFunction.thatReturnsNull; } - + function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; for (var i = 0; i < expectedValues.length; i++) { @@ -4844,13 +4844,13 @@ return null; } } - + var valuesString = JSON.stringify(expectedValues); return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); } return createChainableTypeChecker(validate); } - + function createObjectOfTypeChecker(typeChecker) { function validate(props, propName, componentName, location, propFullName) { if (typeof typeChecker !== 'function') { @@ -4873,13 +4873,13 @@ } return createChainableTypeChecker(validate); } - + function createUnionTypeChecker(arrayOfTypeCheckers) { if (!Array.isArray(arrayOfTypeCheckers)) { process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; return emptyFunction.thatReturnsNull; } - + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { var checker = arrayOfTypeCheckers[i]; if (typeof checker !== 'function') { @@ -4893,7 +4893,7 @@ return emptyFunction.thatReturnsNull; } } - + function validate(props, propName, componentName, location, propFullName) { for (var i = 0; i < arrayOfTypeCheckers.length; i++) { var checker = arrayOfTypeCheckers[i]; @@ -4901,12 +4901,12 @@ return null; } } - + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); } return createChainableTypeChecker(validate); } - + function createNodeChecker() { function validate(props, propName, componentName, location, propFullName) { if (!isNode(props[propName])) { @@ -4916,7 +4916,7 @@ } return createChainableTypeChecker(validate); } - + function createShapeTypeChecker(shapeTypes) { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; @@ -4938,7 +4938,7 @@ } return createChainableTypeChecker(validate); } - + function isNode(propValue) { switch (typeof propValue) { case 'number': @@ -4954,7 +4954,7 @@ if (propValue === null || isValidElement(propValue)) { return true; } - + var iteratorFn = getIteratorFn(propValue); if (iteratorFn) { var iterator = iteratorFn.call(propValue); @@ -4979,32 +4979,32 @@ } else { return false; } - + return true; default: return false; } } - + function isSymbol(propType, propValue) { // Native Symbol. if (propType === 'symbol') { return true; } - + // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' if (propValue['@@toStringTag'] === 'Symbol') { return true; } - + // Fallback for non-spec compliant Symbols which are polyfilled. if (typeof Symbol === 'function' && propValue instanceof Symbol) { return true; } - + return false; } - + // Equivalent of `typeof` but with special handling for array and regexp. function getPropType(propValue) { var propType = typeof propValue; @@ -5022,7 +5022,7 @@ } return propType; } - + // This handles more types than `getPropType`. Only used for error messages. // See `createPrimitiveTypeChecker`. function getPreciseType(propValue) { @@ -5039,7 +5039,7 @@ } return propType; } - + // Returns a string that is postfixed to a warning about an invalid type. // For example, "undefined" or "of type array" function getPostfixForTypeWarning(value) { @@ -5056,7 +5056,7 @@ return type; } } - + // Returns class name of the object, if any. function getClassName(propValue) { if (!propValue.constructor || !propValue.constructor.name) { @@ -5064,13 +5064,13 @@ } return propValue.constructor.name; } - + ReactPropTypes.checkPropTypes = checkPropTypes; ReactPropTypes.PropTypes = ReactPropTypes; - + return ReactPropTypes; }; - + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) /***/ }, @@ -5078,7 +5078,7 @@ /***/ function(module, exports) { "use strict"; - + /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. @@ -5087,22 +5087,22 @@ * 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. * - * + * */ - + function makeEmptyFunction(arg) { return function () { return arg; }; } - + /** * This function accepts and discards inputs; it has no side effects. This is * primarily useful idiomatically for overridable function endpoints which * always need to be callable, since JS lacks a null-call idiom ala Cocoa. */ var emptyFunction = function emptyFunction() {}; - + emptyFunction.thatReturns = makeEmptyFunction; emptyFunction.thatReturnsFalse = makeEmptyFunction(false); emptyFunction.thatReturnsTrue = makeEmptyFunction(true); @@ -5113,7 +5113,7 @@ emptyFunction.thatReturnsArgument = function (arg) { return arg; }; - + module.exports = emptyFunction; /***/ }, @@ -5129,9 +5129,9 @@ * of patent rights can be found in the PATENTS file in the same directory. * */ - + 'use strict'; - + /** * Use invariant() to assert state which your program assumes to be true. * @@ -5142,9 +5142,9 @@ * The invariant message will be stripped in production, but the invariant * will remain to ensure logic does not differ in production. */ - + var validateFormat = function validateFormat(format) {}; - + if (process.env.NODE_ENV !== 'production') { validateFormat = function validateFormat(format) { if (format === undefined) { @@ -5152,10 +5152,10 @@ } }; } - + function invariant(condition, format, a, b, c, d, e, f) { validateFormat(format); - + if (!condition) { var error; if (format === undefined) { @@ -5168,12 +5168,12 @@ })); error.name = 'Invariant Violation'; } - + error.framesToPop = 1; // we don't care about invariant's own frame throw error; } } - + module.exports = invariant; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -5190,27 +5190,27 @@ * of patent rights can be found in the PATENTS file in the same directory. * */ - + 'use strict'; - + var emptyFunction = __webpack_require__(46); - + /** * Similar to invariant but only logs a warning if the condition is not met. * This can be used to log issues in development environments in critical * paths. Removing the logging code for production environments will keep the * same logic and follow the same code paths. */ - + var warning = emptyFunction; - + if (process.env.NODE_ENV !== 'production') { (function () { var printWarning = function printWarning(format) { for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } - + var argIndex = 0; var message = 'Warning: ' + format.replace(/%s/g, function () { return args[argIndex++]; @@ -5225,27 +5225,27 @@ throw new Error(message); } catch (x) {} }; - + warning = function warning(condition, format) { if (format === undefined) { throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); } - + if (format.indexOf('Failed Composite propType: ') === 0) { return; // Ignore CompositeComponent proptype check. } - + if (!condition) { for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { args[_key2 - 2] = arguments[_key2]; } - + printWarning.apply(undefined, [format].concat(args)); } }; })(); } - + module.exports = warning; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -5261,11 +5261,11 @@ * 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. */ - + 'use strict'; - + var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; - + module.exports = ReactPropTypesSecret; @@ -5281,16 +5281,16 @@ * 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. */ - + 'use strict'; - + if (process.env.NODE_ENV !== 'production') { var invariant = __webpack_require__(47); var warning = __webpack_require__(48); var ReactPropTypesSecret = __webpack_require__(49); var loggedTypeFailures = {}; } - + /** * Assert that the values match with the type specs. * Error messages are memorized and will only be shown once. @@ -5323,18 +5323,18 @@ // Only monitor this failure once because there tends to be a lot of the // same error. loggedTypeFailures[error.message] = true; - + var stack = getStack ? getStack() : ''; - + warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : ''); } } } } } - + module.exports = checkPropTypes; - + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) /***/ }, @@ -5349,12 +5349,12 @@ * 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. */ - + 'use strict'; - + var emptyFunction = __webpack_require__(46); var invariant = __webpack_require__(47); - + module.exports = function() { // Important! // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. @@ -5378,7 +5378,7 @@ object: shim, string: shim, symbol: shim, - + any: shim, arrayOf: getShim, element: shim, @@ -5389,10 +5389,10 @@ oneOfType: getShim, shape: getShim }; - + ReactPropTypes.checkPropTypes = emptyFunction; ReactPropTypes.PropTypes = ReactPropTypes; - + return ReactPropTypes; }; @@ -5402,7 +5402,7 @@ /***/ function(module, exports, __webpack_require__) { 'use strict'; - + module.exports = __webpack_require__(53); @@ -5420,36 +5420,36 @@ * * @providesModule ReactDOM */ - + /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/ - + 'use strict'; - + var ReactDOMComponentTree = __webpack_require__(54); var ReactDefaultInjection = __webpack_require__(57); var ReactMount = __webpack_require__(180); var ReactReconciler = __webpack_require__(77); var ReactUpdates = __webpack_require__(74); var ReactVersion = __webpack_require__(42); - + var findDOMNode = __webpack_require__(185); var getHostComponentFromComposite = __webpack_require__(186); var renderSubtreeIntoContainer = __webpack_require__(187); var warning = __webpack_require__(21); - + ReactDefaultInjection.inject(); - + var ReactDOM = { findDOMNode: findDOMNode, render: ReactMount.render, unmountComponentAtNode: ReactMount.unmountComponentAtNode, version: ReactVersion, - + /* eslint-disable camelcase */ unstable_batchedUpdates: ReactUpdates.batchedUpdates, unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer }; - + // Inject the runtime into a devtools global hook regardless of browser. // Allows for debugging when the hook is injected on the page. /* eslint-enable camelcase */ @@ -5473,11 +5473,11 @@ Reconciler: ReactReconciler }); } - + if (process.env.NODE_ENV !== 'production') { var ExecutionEnvironment = __webpack_require__(67); if (ExecutionEnvironment.canUseDOM && window.top === window.self) { - + // First check if devtools is not installed if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { // If we're in Chrome or Firefox, provide a download link if not installed. @@ -5487,20 +5487,20 @@ console.debug('Download the React DevTools ' + (showFileUrlMessage ? 'and use an HTTP server (instead of a file: URL) ' : '') + 'for a better development experience: ' + 'https://fb.me/react-devtools'); } } - + var testFunc = function testFn() {}; process.env.NODE_ENV !== 'production' ? warning((testFunc.name || testFunc.toString()).indexOf('testFn') !== -1, 'It looks like you\'re using a minified copy of the development build ' + 'of React. When deploying React apps to production, make sure to use ' + 'the production build which skips development warnings and is faster. ' + 'See https://fb.me/react-minification for more details.') : void 0; - + // If we're in IE8, check to see if we are in compatibility mode and provide // information on preventing compatibility mode var ieCompatibilityMode = document.documentMode && document.documentMode < 8; - + process.env.NODE_ENV !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '') : void 0; - + var expectedFeatures = [ // shims Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim]; - + for (var i = 0; i < expectedFeatures.length; i++) { if (!expectedFeatures[i]) { process.env.NODE_ENV !== 'production' ? warning(false, 'One or more ES5 shims expected by React are not available: ' + 'https://fb.me/react-warning-polyfills') : void 0; @@ -5509,16 +5509,16 @@ } } } - + if (process.env.NODE_ENV !== 'production') { var ReactInstrumentation = __webpack_require__(80); var ReactDOMUnknownPropertyHook = __webpack_require__(188); var ReactDOMNullInputValuePropHook = __webpack_require__(189); - + ReactInstrumentation.debugTool.addHook(ReactDOMUnknownPropertyHook); ReactInstrumentation.debugTool.addHook(ReactDOMNullInputValuePropHook); } - + module.exports = ReactDOM; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -5536,21 +5536,21 @@ * * @providesModule ReactDOMComponentTree */ - + 'use strict'; - + var _prodInvariant = __webpack_require__(17); - + var DOMProperty = __webpack_require__(55); var ReactDOMComponentFlags = __webpack_require__(56); - + var invariant = __webpack_require__(18); - + var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME; var Flags = ReactDOMComponentFlags; - + var internalInstanceKey = '__reactInternalInstance$' + Math.random().toString(36).slice(2); - + /** * Drill down (through composites and empty components) until we get a host or * host text component. @@ -5565,7 +5565,7 @@ } return component; } - + /** * Populate `_hostNode` on the rendered host/text component with the given * DOM node. The passed `inst` can be a composite. @@ -5575,7 +5575,7 @@ hostInst._hostNode = node; node[internalInstanceKey] = hostInst; } - + function uncacheNode(inst) { var node = inst._hostNode; if (node) { @@ -5583,7 +5583,7 @@ inst._hostNode = null; } } - + /** * Populate `_hostNode` on each child of `inst`, assuming that the children * match up with the DOM (element) children of `node`. @@ -5626,7 +5626,7 @@ } inst._flags |= Flags.hasCachedChildNodes; } - + /** * Given a DOM node, return the closest ReactDOMComponent or * ReactDOMTextComponent instance ancestor. @@ -5635,7 +5635,7 @@ if (node[internalInstanceKey]) { return node[internalInstanceKey]; } - + // Walk up the tree until we find an ancestor whose instance we have cached. var parents = []; while (!node[internalInstanceKey]) { @@ -5648,7 +5648,7 @@ return null; } } - + var closest; var inst; for (; node && (inst = node[internalInstanceKey]); node = parents.pop()) { @@ -5657,10 +5657,10 @@ precacheChildNodes(inst, node); } } - + return closest; } - + /** * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent * instance, or null if the node was not rendered by this React. @@ -5673,7 +5673,7 @@ return null; } } - + /** * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding * DOM node. @@ -5682,11 +5682,11 @@ // Without this first invariant, passing a non-DOM-component triggers the next // invariant for a missing parent, which is super confusing. !(inst._hostNode !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0; - + if (inst._hostNode) { return inst._hostNode; } - + // Walk up the tree until we find an ancestor whose DOM node we have cached. var parents = []; while (!inst._hostNode) { @@ -5694,16 +5694,16 @@ !inst._hostParent ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React DOM tree root should always have a node reference.') : _prodInvariant('34') : void 0; inst = inst._hostParent; } - + // Now parents contains each ancestor that does *not* have a cached native // node, and `inst` is the deepest ancestor that does. for (; parents.length; inst = parents.pop()) { precacheChildNodes(inst, inst._hostNode); } - + return inst._hostNode; } - + var ReactDOMComponentTree = { getClosestInstanceFromNode: getClosestInstanceFromNode, getInstanceFromNode: getInstanceFromNode, @@ -5712,7 +5712,7 @@ precacheNode: precacheNode, uncacheNode: uncacheNode }; - + module.exports = ReactDOMComponentTree; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -5730,17 +5730,17 @@ * * @providesModule DOMProperty */ - + 'use strict'; - + var _prodInvariant = __webpack_require__(17); - + var invariant = __webpack_require__(18); - + function checkMask(value, bitmask) { return (value & bitmask) === bitmask; } - + var DOMPropertyInjection = { /** * Mapping from normalized, camelcased property names to a configuration that @@ -5751,7 +5751,7 @@ HAS_NUMERIC_VALUE: 0x8, HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8, HAS_OVERLOADED_BOOLEAN_VALUE: 0x20, - + /** * Inject some specialized knowledge about the DOM. This takes a config object * with the following properties: @@ -5787,23 +5787,23 @@ var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {}; var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {}; var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {}; - + if (domPropertyConfig.isCustomAttribute) { DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute); } - + for (var propName in Properties) { !!DOMProperty.properties.hasOwnProperty(propName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property \'%s\' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.', propName) : _prodInvariant('48', propName) : void 0; - + var lowerCased = propName.toLowerCase(); var propConfig = Properties[propName]; - + var propertyInfo = { attributeName: lowerCased, attributeNamespace: null, propertyName: propName, mutationMethod: null, - + mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY), hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE), hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE), @@ -5811,11 +5811,11 @@ hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE) }; !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s', propName) : _prodInvariant('50', propName) : void 0; - + if (process.env.NODE_ENV !== 'production') { DOMProperty.getPossibleStandardName[lowerCased] = propName; } - + if (DOMAttributeNames.hasOwnProperty(propName)) { var attributeName = DOMAttributeNames[propName]; propertyInfo.attributeName = attributeName; @@ -5823,28 +5823,28 @@ DOMProperty.getPossibleStandardName[attributeName] = propName; } } - + if (DOMAttributeNamespaces.hasOwnProperty(propName)) { propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName]; } - + if (DOMPropertyNames.hasOwnProperty(propName)) { propertyInfo.propertyName = DOMPropertyNames[propName]; } - + if (DOMMutationMethods.hasOwnProperty(propName)) { propertyInfo.mutationMethod = DOMMutationMethods[propName]; } - + DOMProperty.properties[propName] = propertyInfo; } } }; - + /* eslint-disable max-len */ var ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD'; /* eslint-enable max-len */ - + /** * DOMProperty exports lookup objects that can be used like functions: * @@ -5859,13 +5859,13 @@ * @see http://jsperf.com/key-missing */ var DOMProperty = { - + ID_ATTRIBUTE_NAME: 'data-reactid', ROOT_ATTRIBUTE_NAME: 'data-reactroot', - + ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR, ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040', - + /** * Map from property "standard name" to an object with info about how to set * the property in the DOM. Each object contains: @@ -5895,19 +5895,19 @@ * strictly equal to true; present with a value otherwise. */ properties: {}, - + /** * Mapping from lowercase property names to the properly cased version, used * to warn in the case of missing properties. Available only in __DEV__. * @type {Object} */ getPossibleStandardName: process.env.NODE_ENV !== 'production' ? {} : null, - + /** * All of the isCustomAttribute() functions that have been injected. */ _isCustomAttributeFunctions: [], - + /** * Checks whether a property name is a custom attribute. * @method @@ -5921,10 +5921,10 @@ } return false; }, - + injection: DOMPropertyInjection }; - + module.exports = DOMProperty; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -5942,13 +5942,13 @@ * * @providesModule ReactDOMComponentFlags */ - + 'use strict'; - + var ReactDOMComponentFlags = { hasCachedChildNodes: 1 << 0 }; - + module.exports = ReactDOMComponentFlags; /***/ }, @@ -5965,9 +5965,9 @@ * * @providesModule ReactDefaultInjection */ - + 'use strict'; - + var BeforeInputEventPlugin = __webpack_require__(58); var ChangeEventPlugin = __webpack_require__(73); var DefaultEventPluginOrder = __webpack_require__(91); @@ -5986,9 +5986,9 @@ var SVGDOMPropertyConfig = __webpack_require__(167); var SelectEventPlugin = __webpack_require__(168); var SimpleEventPlugin = __webpack_require__(169); - + var alreadyInjected = false; - + function inject() { if (alreadyInjected) { // TODO: This is currently true because these injections are shared between @@ -5997,16 +5997,16 @@ return; } alreadyInjected = true; - + ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener); - + /** * Inject modules for resolving DOM hierarchy and plugin ordering. */ ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder); ReactInjection.EventPluginUtils.injectComponentTree(ReactDOMComponentTree); ReactInjection.EventPluginUtils.injectTreeTraversal(ReactDOMTreeTraversal); - + /** * Some important event plugins included by default (without having to require * them). @@ -6018,24 +6018,24 @@ SelectEventPlugin: SelectEventPlugin, BeforeInputEventPlugin: BeforeInputEventPlugin }); - + ReactInjection.HostComponent.injectGenericComponentClass(ReactDOMComponent); - + ReactInjection.HostComponent.injectTextComponentClass(ReactDOMTextComponent); - + ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig); ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig); - + ReactInjection.EmptyComponent.injectEmptyComponentFactory(function (instantiate) { return new ReactDOMEmptyComponent(instantiate); }); - + ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction); ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy); - + ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment); } - + module.exports = { inject: inject }; @@ -6054,38 +6054,38 @@ * * @providesModule BeforeInputEventPlugin */ - + 'use strict'; - + var EventConstants = __webpack_require__(59); var EventPropagators = __webpack_require__(60); var ExecutionEnvironment = __webpack_require__(67); var FallbackCompositionState = __webpack_require__(68); var SyntheticCompositionEvent = __webpack_require__(70); var SyntheticInputEvent = __webpack_require__(72); - + var keyOf = __webpack_require__(35); - + var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space var START_KEYCODE = 229; - + var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window; - + var documentMode = null; if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) { documentMode = document.documentMode; } - + // Webkit offers a very useful `textInput` event that can be used to // directly represent `beforeInput`. The IE `textinput` event is not as // useful, so we don't use it. var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto(); - + // In IE9+, we have access to composition events, but the data supplied // by the native compositionend event may be incorrect. Japanese ideographic // spaces, for instance (\u3000) are not recorded correctly. var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11); - + /** * Opera <= 12 includes TextEvent in window, but does not fire * text input events. Rely on keypress instead. @@ -6094,12 +6094,12 @@ var opera = window.opera; return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12; } - + var SPACEBAR_CODE = 32; var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE); - + var topLevelTypes = EventConstants.topLevelTypes; - + // Events and their corresponding property names. var eventTypes = { beforeInput: { @@ -6131,10 +6131,10 @@ dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionUpdate, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown] } }; - + // Track whether we've ever handled a keypress on the space key. var hasSpaceKeypress = false; - + /** * Return whether a native keypress event is assumed to be a command. * This is required because Firefox fires `keypress` events for key commands @@ -6145,7 +6145,7 @@ // ctrlKey && altKey is equivalent to AltGr, and is not a command. !(nativeEvent.ctrlKey && nativeEvent.altKey); } - + /** * Translate native top level events into event types. * @@ -6162,7 +6162,7 @@ return eventTypes.compositionUpdate; } } - + /** * Does our fallback best-guess model think this event signifies that * composition has begun? @@ -6174,7 +6174,7 @@ function isFallbackCompositionStart(topLevelType, nativeEvent) { return topLevelType === topLevelTypes.topKeyDown && nativeEvent.keyCode === START_KEYCODE; } - + /** * Does our fallback mode think that this event is the end of composition? * @@ -6200,7 +6200,7 @@ return false; } } - + /** * Google Input Tools provides composition data via a CustomEvent, * with the `data` property populated in the `detail` object. If this @@ -6217,17 +6217,17 @@ } return null; } - + // Track the current IME composition fallback object, if any. var currentComposition = null; - + /** * @return {?object} A SyntheticCompositionEvent. */ function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { var eventType; var fallbackData; - + if (canUseCompositionEvent) { eventType = getCompositionEventType(topLevelType); } else if (!currentComposition) { @@ -6237,11 +6237,11 @@ } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) { eventType = eventTypes.compositionEnd; } - + if (!eventType) { return null; } - + if (useFallbackCompositionData) { // The current composition is stored statically and must not be // overwritten while composition continues. @@ -6253,9 +6253,9 @@ } } } - + var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget); - + if (fallbackData) { // Inject data generated from fallback path into the synthetic event. // This matches the property of native CompositionEventInterface. @@ -6266,11 +6266,11 @@ event.data = customData; } } - + EventPropagators.accumulateTwoPhaseDispatches(event); return event; } - + /** * @param {string} topLevelType Record from `EventConstants`. * @param {object} nativeEvent Native browser event. @@ -6299,29 +6299,29 @@ if (which !== SPACEBAR_CODE) { return null; } - + hasSpaceKeypress = true; return SPACEBAR_CHAR; - + case topLevelTypes.topTextInput: // Record the characters to be added to the DOM. var chars = nativeEvent.data; - + // If it's a spacebar character, assume that we have already handled // it at the keypress level and bail immediately. Android Chrome // doesn't give us keycodes, so we need to blacklist it. if (chars === SPACEBAR_CHAR && hasSpaceKeypress) { return null; } - + return chars; - + default: // For other native event types, do nothing. return null; } } - + /** * For browsers that do not provide the `textInput` event, extract the * appropriate string to use for SyntheticInputEvent. @@ -6342,7 +6342,7 @@ } return null; } - + switch (topLevelType) { case topLevelTypes.topPaste: // If a paste event occurs after a keypress, throw out the input @@ -6375,7 +6375,7 @@ return null; } } - + /** * Extract a SyntheticInputEvent for `beforeInput`, based on either native * `textInput` or fallback behavior. @@ -6384,26 +6384,26 @@ */ function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) { var chars; - + if (canUseTextInputEvent) { chars = getNativeBeforeInputChars(topLevelType, nativeEvent); } else { chars = getFallbackBeforeInputChars(topLevelType, nativeEvent); } - + // If no characters are being inserted, no BeforeInput event should // be fired. if (!chars) { return null; } - + var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget); - + event.data = chars; EventPropagators.accumulateTwoPhaseDispatches(event); return event; } - + /** * Create an `onBeforeInput` event to match * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents. @@ -6423,14 +6423,14 @@ * `composition` event types. */ var BeforeInputEventPlugin = { - + eventTypes: eventTypes, - + extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { return [extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget)]; } }; - + module.exports = BeforeInputEventPlugin; /***/ }, @@ -6447,13 +6447,13 @@ * * @providesModule EventConstants */ - + 'use strict'; - + var keyMirror = __webpack_require__(33); - + var PropagationPhases = keyMirror({ bubbled: null, captured: null }); - + /** * Types of raw signals from the browser caught at the top level. */ @@ -6527,12 +6527,12 @@ topWaiting: null, topWheel: null }); - + var EventConstants = { topLevelTypes: topLevelTypes, PropagationPhases: PropagationPhases }; - + module.exports = EventConstants; /***/ }, @@ -6549,20 +6549,20 @@ * * @providesModule EventPropagators */ - + 'use strict'; - + var EventConstants = __webpack_require__(59); var EventPluginHub = __webpack_require__(61); var EventPluginUtils = __webpack_require__(63); - + var accumulateInto = __webpack_require__(65); var forEachAccumulated = __webpack_require__(66); var warning = __webpack_require__(21); - + var PropagationPhases = EventConstants.PropagationPhases; var getListener = EventPluginHub.getListener; - + /** * Some event types have a notion of different registration names for different * "phases" of propagation. This finds listeners by a given phase. @@ -6571,7 +6571,7 @@ var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase]; return getListener(inst, registrationName); } - + /** * Tags a `SyntheticEvent` with dispatched listeners. Creating this function * here, allows us to not have to bind or create functions for each event. @@ -6589,7 +6589,7 @@ event._dispatchInstances = accumulateInto(event._dispatchInstances, inst); } } - + /** * Collect dispatches (must be entirely collected before dispatching - see unit * tests). Lazily allocate the array to conserve memory. We must loop through @@ -6602,7 +6602,7 @@ EventPluginUtils.traverseTwoPhase(event._targetInst, accumulateDirectionalDispatches, event); } } - + /** * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID. */ @@ -6613,7 +6613,7 @@ EventPluginUtils.traverseTwoPhase(parentInst, accumulateDirectionalDispatches, event); } } - + /** * Accumulates without regard to direction, does not look for phased * registration names. Same as `accumulateDirectDispatchesSingle` but without @@ -6629,7 +6629,7 @@ } } } - + /** * Accumulates dispatches on an `SyntheticEvent`, but only for the * `dispatchMarker`. @@ -6640,23 +6640,23 @@ accumulateDispatches(event._targetInst, null, event); } } - + function accumulateTwoPhaseDispatches(events) { forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle); } - + function accumulateTwoPhaseDispatchesSkipTarget(events) { forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget); } - + function accumulateEnterLeaveDispatches(leave, enter, from, to) { EventPluginUtils.traverseEnterLeave(from, to, accumulateDispatches, leave, enter); } - + function accumulateDirectDispatches(events) { forEachAccumulated(events, accumulateDirectDispatchesSingle); } - + /** * A small set of propagation patterns, each of which will accept a small amount * of information, and generate a set of "dispatch ready event objects" - which @@ -6674,7 +6674,7 @@ accumulateDirectDispatches: accumulateDirectDispatches, accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches }; - + module.exports = EventPropagators; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -6692,30 +6692,30 @@ * * @providesModule EventPluginHub */ - + 'use strict'; - + var _prodInvariant = __webpack_require__(17); - + var EventPluginRegistry = __webpack_require__(62); var EventPluginUtils = __webpack_require__(63); var ReactErrorUtils = __webpack_require__(64); - + var accumulateInto = __webpack_require__(65); var forEachAccumulated = __webpack_require__(66); var invariant = __webpack_require__(18); - + /** * Internal store for event listeners */ var listenerBank = {}; - + /** * Internal queue of events that have accumulated their dispatches and are * waiting to have their dispatches executed. */ var eventQueue = null; - + /** * Dispatches an event and releases it back into the pool, unless persistent. * @@ -6726,7 +6726,7 @@ var executeDispatchesAndRelease = function (event, simulated) { if (event) { EventPluginUtils.executeDispatchesInOrder(event, simulated); - + if (!event.isPersistent()) { event.constructor.release(event); } @@ -6738,13 +6738,13 @@ var executeDispatchesAndReleaseTopLevel = function (e) { return executeDispatchesAndRelease(e, false); }; - + var getDictionaryKey = function (inst) { // Prevents V8 performance issue: // https://github.com/facebook/react/pull/7232 return '.' + inst._rootNodeID; }; - + /** * This is a unified interface for event plugins to be installed and configured. * @@ -6768,25 +6768,25 @@ * @public */ var EventPluginHub = { - + /** * Methods for injecting dependencies. */ injection: { - + /** * @param {array} InjectedEventPluginOrder * @public */ injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder, - + /** * @param {object} injectedNamesToPlugins Map from names to plugin modules. */ injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName - + }, - + /** * Stores `listener` at `listenerBank[registrationName][key]`. Is idempotent. * @@ -6796,17 +6796,17 @@ */ putListener: function (inst, registrationName, listener) { !(typeof listener === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : _prodInvariant('94', registrationName, typeof listener) : void 0; - + var key = getDictionaryKey(inst); var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {}); bankForRegistrationName[key] = listener; - + var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; if (PluginModule && PluginModule.didPutListener) { PluginModule.didPutListener(inst, registrationName, listener); } }, - + /** * @param {object} inst The instance, which is the source of events. * @param {string} registrationName Name of listener (e.g. `onClick`). @@ -6817,7 +6817,7 @@ var key = getDictionaryKey(inst); return bankForRegistrationName && bankForRegistrationName[key]; }, - + /** * Deletes a listener from the registration bank. * @@ -6829,7 +6829,7 @@ if (PluginModule && PluginModule.willDeleteListener) { PluginModule.willDeleteListener(inst, registrationName); } - + var bankForRegistrationName = listenerBank[registrationName]; // TODO: This should never be null -- when is it? if (bankForRegistrationName) { @@ -6837,7 +6837,7 @@ delete bankForRegistrationName[key]; } }, - + /** * Deletes all listeners for the DOM element with the supplied ID. * @@ -6849,20 +6849,20 @@ if (!listenerBank.hasOwnProperty(registrationName)) { continue; } - + if (!listenerBank[registrationName][key]) { continue; } - + var PluginModule = EventPluginRegistry.registrationNameModules[registrationName]; if (PluginModule && PluginModule.willDeleteListener) { PluginModule.willDeleteListener(inst, registrationName); } - + delete listenerBank[registrationName][key]; } }, - + /** * Allows registered plugins an opportunity to extract events from top-level * native browser events. @@ -6885,7 +6885,7 @@ } return events; }, - + /** * Enqueues a synthetic event that should be dispatched when * `processEventQueue` is invoked. @@ -6898,7 +6898,7 @@ eventQueue = accumulateInto(eventQueue, events); } }, - + /** * Dispatches all synthetic events on the event queue. * @@ -6918,20 +6918,20 @@ // This would be a good time to rethrow if any of the event handlers threw. ReactErrorUtils.rethrowCaughtError(); }, - + /** * These are needed for tests only. Do not use! */ __purge: function () { listenerBank = {}; }, - + __getListenerBank: function () { return listenerBank; } - + }; - + module.exports = EventPluginHub; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -6949,23 +6949,23 @@ * * @providesModule EventPluginRegistry */ - + 'use strict'; - + var _prodInvariant = __webpack_require__(17); - + var invariant = __webpack_require__(18); - + /** * Injectable ordering of event plugins. */ var EventPluginOrder = null; - + /** * Injectable mapping from names to event plugin modules. */ var namesToPlugins = {}; - + /** * Recomputes the plugin list using the injected plugins and plugin ordering. * @@ -6991,7 +6991,7 @@ } } } - + /** * Publishes an event so that it can be dispatched by the supplied plugin. * @@ -7003,7 +7003,7 @@ function publishEventForPlugin(dispatchConfig, PluginModule, eventName) { !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : _prodInvariant('99', eventName) : void 0; EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig; - + var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; if (phasedRegistrationNames) { for (var phaseName in phasedRegistrationNames) { @@ -7019,7 +7019,7 @@ } return false; } - + /** * Publishes a registration name that is used to identify dispatched events and * can be used with `EventPluginHub.putListener` to register listeners. @@ -7032,44 +7032,44 @@ !!EventPluginRegistry.registrationNameModules[registrationName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : _prodInvariant('100', registrationName) : void 0; EventPluginRegistry.registrationNameModules[registrationName] = PluginModule; EventPluginRegistry.registrationNameDependencies[registrationName] = PluginModule.eventTypes[eventName].dependencies; - + if (process.env.NODE_ENV !== 'production') { var lowerCasedName = registrationName.toLowerCase(); EventPluginRegistry.possibleRegistrationNames[lowerCasedName] = registrationName; - + if (registrationName === 'onDoubleClick') { EventPluginRegistry.possibleRegistrationNames.ondblclick = registrationName; } } } - + /** * Registers plugins so that they can extract and dispatch events. * * @see {EventPluginHub} */ var EventPluginRegistry = { - + /** * Ordered list of injected plugins. */ plugins: [], - + /** * Mapping from event name to dispatch config */ eventNameDispatchConfigs: {}, - + /** * Mapping from registration name to plugin module */ registrationNameModules: {}, - + /** * Mapping from registration name to event name */ registrationNameDependencies: {}, - + /** * Mapping from lowercase registration names to the properly cased version, * used to warn in the case of missing event handlers. Available @@ -7077,7 +7077,7 @@ * @type {Object} */ possibleRegistrationNames: process.env.NODE_ENV !== 'production' ? {} : null, - + /** * Injects an ordering of plugins (by plugin name). This allows the ordering * to be decoupled from injection of the actual plugins so that ordering is @@ -7093,7 +7093,7 @@ EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder); recomputePluginOrdering(); }, - + /** * Injects plugins to be used by `EventPluginHub`. The plugin names must be * in the ordering injected by `injectEventPluginOrder`. @@ -7121,7 +7121,7 @@ recomputePluginOrdering(); } }, - + /** * Looks up the plugin for the supplied event. * @@ -7145,7 +7145,7 @@ } return null; }, - + /** * Exposed for unit testing. * @private @@ -7158,21 +7158,21 @@ } } EventPluginRegistry.plugins.length = 0; - + var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs; for (var eventName in eventNameDispatchConfigs) { if (eventNameDispatchConfigs.hasOwnProperty(eventName)) { delete eventNameDispatchConfigs[eventName]; } } - + var registrationNameModules = EventPluginRegistry.registrationNameModules; for (var registrationName in registrationNameModules) { if (registrationNameModules.hasOwnProperty(registrationName)) { delete registrationNameModules[registrationName]; } } - + if (process.env.NODE_ENV !== 'production') { var possibleRegistrationNames = EventPluginRegistry.possibleRegistrationNames; for (var lowerCasedName in possibleRegistrationNames) { @@ -7182,9 +7182,9 @@ } } } - + }; - + module.exports = EventPluginRegistry; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -7202,21 +7202,21 @@ * * @providesModule EventPluginUtils */ - + 'use strict'; - + var _prodInvariant = __webpack_require__(17); - + var EventConstants = __webpack_require__(59); var ReactErrorUtils = __webpack_require__(64); - + var invariant = __webpack_require__(18); var warning = __webpack_require__(21); - + /** * Injected dependencies: */ - + /** * - `ComponentTree`: [required] Module that can convert between React instances * and actual node references. @@ -7237,36 +7237,36 @@ } } }; - + var topLevelTypes = EventConstants.topLevelTypes; - + function isEndish(topLevelType) { return topLevelType === topLevelTypes.topMouseUp || topLevelType === topLevelTypes.topTouchEnd || topLevelType === topLevelTypes.topTouchCancel; } - + function isMoveish(topLevelType) { return topLevelType === topLevelTypes.topMouseMove || topLevelType === topLevelTypes.topTouchMove; } function isStartish(topLevelType) { return topLevelType === topLevelTypes.topMouseDown || topLevelType === topLevelTypes.topTouchStart; } - + var validateEventDispatches; if (process.env.NODE_ENV !== 'production') { validateEventDispatches = function (event) { var dispatchListeners = event._dispatchListeners; var dispatchInstances = event._dispatchInstances; - + var listenersIsArr = Array.isArray(dispatchListeners); var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0; - + var instancesIsArr = Array.isArray(dispatchInstances); var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0; - + process.env.NODE_ENV !== 'production' ? warning(instancesIsArr === listenersIsArr && instancesLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : void 0; }; } - + /** * Dispatch the event to the listener. * @param {SyntheticEvent} event SyntheticEvent to handle @@ -7284,7 +7284,7 @@ } event.currentTarget = null; } - + /** * Standard/simple iteration through an event's collected dispatches. */ @@ -7308,7 +7308,7 @@ event._dispatchListeners = null; event._dispatchInstances = null; } - + /** * Standard/simple iteration through an event's collected dispatches, but stops * at the first dispatch execution returning true, and returns that id. @@ -7339,7 +7339,7 @@ } return null; } - + /** * @see executeDispatchesInOrderStopAtTrueImpl */ @@ -7349,7 +7349,7 @@ event._dispatchListeners = null; return ret; } - + /** * Execution of a "direct" dispatch - there must be at most one dispatch * accumulated on the event or it is considered an error. It doesn't really make @@ -7373,7 +7373,7 @@ event._dispatchInstances = null; return res; } - + /** * @param {SyntheticEvent} event * @return {boolean} True iff number of dispatches accumulated is greater than 0. @@ -7381,7 +7381,7 @@ function hasDispatches(event) { return !!event._dispatchListeners; } - + /** * General utilities that are useful in creating custom Event Plugins. */ @@ -7389,12 +7389,12 @@ isEndish: isEndish, isMoveish: isMoveish, isStartish: isStartish, - + executeDirectDispatch: executeDirectDispatch, executeDispatchesInOrder: executeDispatchesInOrder, executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue, hasDispatches: hasDispatches, - + getInstanceFromNode: function (node) { return ComponentTree.getInstanceFromNode(node); }, @@ -7416,10 +7416,10 @@ traverseEnterLeave: function (from, to, fn, argFrom, argTo) { return TreeTraversal.traverseEnterLeave(from, to, fn, argFrom, argTo); }, - + injection: injection }; - + module.exports = EventPluginUtils; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -7437,11 +7437,11 @@ * * @providesModule ReactErrorUtils */ - + 'use strict'; - + var caughtError = null; - + /** * Call a function while guarding against errors that happens within it. * @@ -7460,16 +7460,16 @@ return undefined; } } - + var ReactErrorUtils = { invokeGuardedCallback: invokeGuardedCallback, - + /** * Invoked by ReactTestUtils.Simulate so that any errors thrown by the event * handler are sure to be rethrown by rethrowCaughtError. */ invokeGuardedCallbackWithCatch: invokeGuardedCallback, - + /** * During execution of guarded functions we will capture the first error which * we will rethrow to be handled by the top level error handler. @@ -7482,7 +7482,7 @@ } } }; - + if (process.env.NODE_ENV !== 'production') { /** * To help development we can get better devtools integration by simulating a @@ -7501,7 +7501,7 @@ }; } } - + module.exports = ReactErrorUtils; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -7518,15 +7518,15 @@ * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule accumulateInto - * + * */ - + 'use strict'; - + var _prodInvariant = __webpack_require__(17); - + var invariant = __webpack_require__(18); - + /** * Accumulates items that must not be null or undefined into the first one. This * is used to conserve memory by avoiding array allocations, and thus sacrifices @@ -7539,14 +7539,14 @@ * * @return {*|array<*>} An accumulation of items. */ - + function accumulateInto(current, next) { !(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : _prodInvariant('30') : void 0; - + if (current == null) { return next; } - + // Both are not empty. Warning: Never call x.concat(y) when you are not // certain that x is an Array (x could be a string with concat method). if (Array.isArray(current)) { @@ -7557,15 +7557,15 @@ current.push(next); return current; } - + if (Array.isArray(next)) { // A bit too dangerous to mutate `next`. return [current].concat(next); } - + return [current, next]; } - + module.exports = accumulateInto; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -7582,11 +7582,11 @@ * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule forEachAccumulated - * + * */ - + 'use strict'; - + /** * @param {array} arr an "accumulation" of items which is either an Array or * a single item. Useful when paired with the `accumulate` module. This is a @@ -7594,7 +7594,7 @@ * handling the case when there is exactly one item (and we do not need to * allocate an array). */ - + function forEachAccumulated(arr, cb, scope) { if (Array.isArray(arr)) { arr.forEach(cb, scope); @@ -7602,7 +7602,7 @@ cb.call(scope, arr); } } - + module.exports = forEachAccumulated; /***/ }, @@ -7618,11 +7618,11 @@ * of patent rights can be found in the PATENTS file in the same directory. * */ - + 'use strict'; - + var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); - + /** * Simple, lightweight module assisting with the detection and context of * Worker. Helps avoid circular dependencies and allows code to reason about @@ -7630,19 +7630,19 @@ * `ReactWorker` dependency. */ var ExecutionEnvironment = { - + canUseDOM: canUseDOM, - + canUseWorkers: typeof Worker !== 'undefined', - + canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent), - + canUseViewport: canUseDOM && !!window.screen, - + isInWorker: !canUseDOM // For now, this is true - might change in the future. - + }; - + module.exports = ExecutionEnvironment; /***/ }, @@ -7659,15 +7659,15 @@ * * @providesModule FallbackCompositionState */ - + 'use strict'; - + var _assign = __webpack_require__(14); - + var PooledClass = __webpack_require__(16); - + var getTextContentAccessor = __webpack_require__(69); - + /** * This helper class stores information about text content of a target node, * allowing comparison of content before and after a given event. @@ -7684,14 +7684,14 @@ this._startText = this.getText(); this._fallbackText = null; } - + _assign(FallbackCompositionState.prototype, { destructor: function () { this._root = null; this._startText = null; this._fallbackText = null; }, - + /** * Get current text of input. * @@ -7703,7 +7703,7 @@ } return this._root[getTextContentAccessor()]; }, - + /** * Determine the differing substring between the initially stored * text content and the current content. @@ -7714,35 +7714,35 @@ if (this._fallbackText) { return this._fallbackText; } - + var start; var startValue = this._startText; var startLength = startValue.length; var end; var endValue = this.getText(); var endLength = endValue.length; - + for (start = 0; start < startLength; start++) { if (startValue[start] !== endValue[start]) { break; } } - + var minEnd = startLength - start; for (end = 1; end <= minEnd; end++) { if (startValue[startLength - end] !== endValue[endLength - end]) { break; } } - + var sliceTail = end > 1 ? 1 - end : undefined; this._fallbackText = endValue.slice(start, sliceTail); return this._fallbackText; } }); - + PooledClass.addPoolingTo(FallbackCompositionState); - + module.exports = FallbackCompositionState; /***/ }, @@ -7759,13 +7759,13 @@ * * @providesModule getTextContentAccessor */ - + 'use strict'; - + var ExecutionEnvironment = __webpack_require__(67); - + var contentKey = null; - + /** * Gets the key used to access text content on a DOM node. * @@ -7780,7 +7780,7 @@ } return contentKey; } - + module.exports = getTextContentAccessor; /***/ }, @@ -7797,11 +7797,11 @@ * * @providesModule SyntheticCompositionEvent */ - + 'use strict'; - + var SyntheticEvent = __webpack_require__(71); - + /** * @interface Event * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents @@ -7809,7 +7809,7 @@ var CompositionEventInterface = { data: null }; - + /** * @param {object} dispatchConfig Configuration used to dispatch this event. * @param {string} dispatchMarker Marker identifying the event target. @@ -7819,9 +7819,9 @@ function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); } - + SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface); - + module.exports = SyntheticCompositionEvent; /***/ }, @@ -7838,21 +7838,21 @@ * * @providesModule SyntheticEvent */ - + 'use strict'; - + var _assign = __webpack_require__(14); - + var PooledClass = __webpack_require__(16); - + var emptyFunction = __webpack_require__(22); var warning = __webpack_require__(21); - + var didWarnForAddedNewProperty = false; var isProxySupported = typeof Proxy === 'function'; - + var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances']; - + /** * @interface Event * @see http://www.w3.org/TR/DOM-Level-3-Events/ @@ -7871,7 +7871,7 @@ defaultPrevented: null, isTrusted: null }; - + /** * Synthetic events are dispatched by event plugins, typically in response to a * top-level event delegation handler. @@ -7897,11 +7897,11 @@ delete this.preventDefault; delete this.stopPropagation; } - + this.dispatchConfig = dispatchConfig; this._targetInst = targetInst; this.nativeEvent = nativeEvent; - + var Interface = this.constructor.Interface; for (var propName in Interface) { if (!Interface.hasOwnProperty(propName)) { @@ -7921,7 +7921,7 @@ } } } - + var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false; if (defaultPrevented) { this.isDefaultPrevented = emptyFunction.thatReturnsTrue; @@ -7931,16 +7931,16 @@ this.isPropagationStopped = emptyFunction.thatReturnsFalse; return this; } - + _assign(SyntheticEvent.prototype, { - + preventDefault: function () { this.defaultPrevented = true; var event = this.nativeEvent; if (!event) { return; } - + if (event.preventDefault) { event.preventDefault(); } else { @@ -7948,13 +7948,13 @@ } this.isDefaultPrevented = emptyFunction.thatReturnsTrue; }, - + stopPropagation: function () { var event = this.nativeEvent; if (!event) { return; } - + if (event.stopPropagation) { event.stopPropagation(); } else if (typeof event.cancelBubble !== 'unknown') { @@ -7966,10 +7966,10 @@ // IE specific). event.cancelBubble = true; } - + this.isPropagationStopped = emptyFunction.thatReturnsTrue; }, - + /** * We release all dispatched `SyntheticEvent`s after each event loop, adding * them back into the pool. This allows a way to hold onto a reference that @@ -7978,14 +7978,14 @@ persist: function () { this.isPersistent = emptyFunction.thatReturnsTrue; }, - + /** * Checks if this event should be released back into the pool. * * @return {boolean} True if this should not be released, false otherwise. */ isPersistent: emptyFunction.thatReturnsFalse, - + /** * `PooledClass` looks for `destructor` on each instance it releases. */ @@ -8007,11 +8007,11 @@ Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction)); } } - + }); - + SyntheticEvent.Interface = EventInterface; - + if (process.env.NODE_ENV !== 'production') { if (isProxySupported) { /*eslint-disable no-func-assign */ @@ -8043,25 +8043,25 @@ */ SyntheticEvent.augmentClass = function (Class, Interface) { var Super = this; - + var E = function () {}; E.prototype = Super.prototype; var prototype = new E(); - + _assign(prototype, Class.prototype); Class.prototype = prototype; Class.prototype.constructor = Class; - + Class.Interface = _assign({}, Super.Interface, Interface); Class.augmentClass = Super.augmentClass; - + PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler); }; - + PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler); - + module.exports = SyntheticEvent; - + /** * Helper to nullify syntheticEvent instance properties when destructing * @@ -8076,20 +8076,20 @@ set: set, get: get }; - + function set(val) { var action = isFunction ? 'setting the method' : 'setting the property'; warn(action, 'This is effectively a no-op'); return val; } - + function get() { var action = isFunction ? 'accessing the method' : 'accessing the property'; var result = isFunction ? 'This is a no-op function' : 'This is set to null'; warn(action, result); return getVal; } - + function warn(action, result) { var warningCondition = false; process.env.NODE_ENV !== 'production' ? warning(warningCondition, 'This synthetic event is reused for performance reasons. If you\'re seeing this, ' + 'you\'re %s `%s` on a released/nullified synthetic event. %s. ' + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0; @@ -8111,11 +8111,11 @@ * * @providesModule SyntheticInputEvent */ - + 'use strict'; - + var SyntheticEvent = __webpack_require__(71); - + /** * @interface Event * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105 @@ -8124,7 +8124,7 @@ var InputEventInterface = { data: null }; - + /** * @param {object} dispatchConfig Configuration used to dispatch this event. * @param {string} dispatchMarker Marker identifying the event target. @@ -8134,9 +8134,9 @@ function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); } - + SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface); - + module.exports = SyntheticInputEvent; /***/ }, @@ -8153,9 +8153,9 @@ * * @providesModule ChangeEventPlugin */ - + 'use strict'; - + var EventConstants = __webpack_require__(59); var EventPluginHub = __webpack_require__(61); var EventPropagators = __webpack_require__(60); @@ -8163,14 +8163,14 @@ var ReactDOMComponentTree = __webpack_require__(54); var ReactUpdates = __webpack_require__(74); var SyntheticEvent = __webpack_require__(71); - + var getEventTarget = __webpack_require__(88); var isEventSupported = __webpack_require__(89); var isTextInputElement = __webpack_require__(90); var keyOf = __webpack_require__(35); - + var topLevelTypes = EventConstants.topLevelTypes; - + var eventTypes = { change: { phasedRegistrationNames: { @@ -8180,7 +8180,7 @@ dependencies: [topLevelTypes.topBlur, topLevelTypes.topChange, topLevelTypes.topClick, topLevelTypes.topFocus, topLevelTypes.topInput, topLevelTypes.topKeyDown, topLevelTypes.topKeyUp, topLevelTypes.topSelectionChange] } }; - + /** * For IE shims */ @@ -8188,7 +8188,7 @@ var activeElementInst = null; var activeElementValue = null; var activeElementValueProp = null; - + /** * SECTION: handle `change` event */ @@ -8196,17 +8196,17 @@ var nodeName = elem.nodeName && elem.nodeName.toLowerCase(); return nodeName === 'select' || nodeName === 'input' && elem.type === 'file'; } - + var doesChangeEventBubble = false; if (ExecutionEnvironment.canUseDOM) { // See `handleChange` comment below doesChangeEventBubble = isEventSupported('change') && (!('documentMode' in document) || document.documentMode > 8); } - + function manualDispatchChangeEvent(nativeEvent) { var event = SyntheticEvent.getPooled(eventTypes.change, activeElementInst, nativeEvent, getEventTarget(nativeEvent)); EventPropagators.accumulateTwoPhaseDispatches(event); - + // If change and propertychange bubbled, we'd just bind to it like all the // other events and have it go through ReactBrowserEventEmitter. Since it // doesn't, we manually listen for the events and so we have to enqueue and @@ -8220,18 +8220,18 @@ // handlers can run. See https://github.com/facebook/react/issues/708. ReactUpdates.batchedUpdates(runEventInBatch, event); } - + function runEventInBatch(event) { EventPluginHub.enqueueEvents(event); EventPluginHub.processEventQueue(false); } - + function startWatchingForChangeEventIE8(target, targetInst) { activeElement = target; activeElementInst = targetInst; activeElement.attachEvent('onchange', manualDispatchChangeEvent); } - + function stopWatchingForChangeEventIE8() { if (!activeElement) { return; @@ -8240,7 +8240,7 @@ activeElement = null; activeElementInst = null; } - + function getTargetInstForChangeEvent(topLevelType, targetInst) { if (topLevelType === topLevelTypes.topChange) { return targetInst; @@ -8256,7 +8256,7 @@ stopWatchingForChangeEventIE8(); } } - + /** * SECTION: handle `input` event */ @@ -8268,7 +8268,7 @@ // changes or when an input with a placeholder is focused. isInputEventSupported = isEventSupported('input') && (!('documentMode' in document) || document.documentMode > 11); } - + /** * (For IE <=11) Replacement getter/setter for the `value` property that gets * set on the active element. @@ -8283,7 +8283,7 @@ activeElementValueProp.set.call(this, val); } }; - + /** * (For IE <=11) Starts tracking propertychange events on the passed-in element * and override the value property so that we can distinguish user events from @@ -8294,7 +8294,7 @@ activeElementInst = targetInst; activeElementValue = target.value; activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value'); - + // Not guarded in a canDefineProperty check: IE8 supports defineProperty only // on DOM elements Object.defineProperty(activeElement, 'value', newValueProp); @@ -8304,7 +8304,7 @@ activeElement.addEventListener('propertychange', handlePropertyChange, false); } } - + /** * (For IE <=11) Removes the event listeners from the currently-tracked element, * if any exists. @@ -8313,22 +8313,22 @@ if (!activeElement) { return; } - + // delete restores the original property definition delete activeElement.value; - + if (activeElement.detachEvent) { activeElement.detachEvent('onpropertychange', handlePropertyChange); } else { activeElement.removeEventListener('propertychange', handlePropertyChange, false); } - + activeElement = null; activeElementInst = null; activeElementValue = null; activeElementValueProp = null; } - + /** * (For IE <=11) Handles a propertychange event, sending a `change` event if * the value of the active element has changed. @@ -8342,10 +8342,10 @@ return; } activeElementValue = value; - + manualDispatchChangeEvent(nativeEvent); } - + /** * If a `change` event should be fired, returns the target's ID. */ @@ -8356,7 +8356,7 @@ return targetInst; } } - + function handleEventsForInputEventIE(topLevelType, target, targetInst) { if (topLevelType === topLevelTypes.topFocus) { // In IE8, we can capture almost all .value changes by adding a @@ -8378,7 +8378,7 @@ stopWatchingForValueChange(); } } - + // For IE8 and IE9. function getTargetInstForInputEventIE(topLevelType, targetInst) { if (topLevelType === topLevelTypes.topSelectionChange || topLevelType === topLevelTypes.topKeyUp || topLevelType === topLevelTypes.topKeyDown) { @@ -8398,7 +8398,7 @@ } } } - + /** * SECTION: handle `click` event */ @@ -8408,13 +8408,13 @@ // until `blur` in IE8. return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio'); } - + function getTargetInstForClickEvent(topLevelType, targetInst) { if (topLevelType === topLevelTypes.topClick) { return targetInst; } } - + /** * This plugin creates an `onChange` event that normalizes change events * across form elements. This event fires at a time when it's possible to @@ -8426,12 +8426,12 @@ * - select */ var ChangeEventPlugin = { - + eventTypes: eventTypes, - + extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) { var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window; - + var getTargetInstFunc, handleEventFunc; if (shouldUseChangeEvent(targetNode)) { if (doesChangeEventBubble) { @@ -8449,7 +8449,7 @@ } else if (shouldUseClickEvent(targetNode)) { getTargetInstFunc = getTargetInstForClickEvent; } - + if (getTargetInstFunc) { var inst = getTargetInstFunc(topLevelType, targetInst); if (inst) { @@ -8459,14 +8459,14 @@ return event; } } - + if (handleEventFunc) { handleEventFunc(topLevelType, targetNode, targetInst); } } - + }; - + module.exports = ChangeEventPlugin; /***/ }, @@ -8483,31 +8483,31 @@ * * @providesModule ReactUpdates */ - + 'use strict'; - + var _prodInvariant = __webpack_require__(17), _assign = __webpack_require__(14); - + var CallbackQueue = __webpack_require__(75); var PooledClass = __webpack_require__(16); var ReactFeatureFlags = __webpack_require__(76); var ReactReconciler = __webpack_require__(77); var Transaction = __webpack_require__(87); - + var invariant = __webpack_require__(18); - + var dirtyComponents = []; var updateBatchNumber = 0; var asapCallbackQueue = CallbackQueue.getPooled(); var asapEnqueued = false; - + var batchingStrategy = null; - + function ensureInjected() { !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching strategy') : _prodInvariant('123') : void 0; } - + var NESTED_UPDATES = { initialize: function () { this.dirtyComponentsLength = dirtyComponents.length; @@ -8526,7 +8526,7 @@ } } }; - + var UPDATE_QUEUEING = { initialize: function () { this.callbackQueue.reset(); @@ -8535,9 +8535,9 @@ this.callbackQueue.notifyAll(); } }; - + var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING]; - + function ReactUpdatesFlushTransaction() { this.reinitializeTransaction(); this.dirtyComponentsLength = null; @@ -8545,12 +8545,12 @@ this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled( /* useCreateElement */true); } - + _assign(ReactUpdatesFlushTransaction.prototype, Transaction.Mixin, { getTransactionWrappers: function () { return TRANSACTION_WRAPPERS; }, - + destructor: function () { this.dirtyComponentsLength = null; CallbackQueue.release(this.callbackQueue); @@ -8558,21 +8558,21 @@ ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction); this.reconcileTransaction = null; }, - + perform: function (method, scope, a) { // Essentially calls `this.reconcileTransaction.perform(method, scope, a)` // with this transaction's wrappers around it. return Transaction.Mixin.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a); } }); - + PooledClass.addPoolingTo(ReactUpdatesFlushTransaction); - + function batchedUpdates(callback, a, b, c, d, e) { ensureInjected(); batchingStrategy.batchedUpdates(callback, a, b, c, d, e); } - + /** * Array comparator for ReactComponents by mount ordering. * @@ -8583,35 +8583,35 @@ function mountOrderComparator(c1, c2) { return c1._mountOrder - c2._mountOrder; } - + function runBatchedUpdates(transaction) { var len = transaction.dirtyComponentsLength; !(len === dirtyComponents.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to match dirty-components array length (%s).', len, dirtyComponents.length) : _prodInvariant('124', len, dirtyComponents.length) : void 0; - + // Since reconciling a component higher in the owner hierarchy usually (not // always -- see shouldComponentUpdate()) will reconcile children, reconcile // them before their children by sorting the array. dirtyComponents.sort(mountOrderComparator); - + // Any updates enqueued while reconciling must be performed after this entire // batch. Otherwise, if dirtyComponents is [A, B] where A has children B and // C, B could update twice in a single batch if C's render enqueues an update // to B (since B would have already updated, we should skip it, and the only // way we can know to do so is by checking the batch counter). updateBatchNumber++; - + for (var i = 0; i < len; i++) { // If a component is unmounted before pending changes apply, it will still // be here, but we assume that it has cleared its _pendingCallbacks and // that performUpdateIfNecessary is a noop. var component = dirtyComponents[i]; - + // If performUpdateIfNecessary happens to enqueue any new updates, we // shouldn't execute the callbacks until the next render happens, so // stash the callbacks first var callbacks = component._pendingCallbacks; component._pendingCallbacks = null; - + var markerName; if (ReactFeatureFlags.logTopLevelRenders) { var namedComponent = component; @@ -8622,13 +8622,13 @@ markerName = 'React update: ' + namedComponent.getName(); console.time(markerName); } - + ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction, updateBatchNumber); - + if (markerName) { console.timeEnd(markerName); } - + if (callbacks) { for (var j = 0; j < callbacks.length; j++) { transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance()); @@ -8636,7 +8636,7 @@ } } } - + var flushBatchedUpdates = function () { // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents // array and perform any updates enqueued by mount-ready handlers (i.e., @@ -8648,7 +8648,7 @@ transaction.perform(runBatchedUpdates, null, transaction); ReactUpdatesFlushTransaction.release(transaction); } - + if (asapEnqueued) { asapEnqueued = false; var queue = asapCallbackQueue; @@ -8658,31 +8658,31 @@ } } }; - + /** * Mark a component as needing a rerender, adding an optional callback to a * list of functions which will be executed once the rerender occurs. */ function enqueueUpdate(component) { ensureInjected(); - + // Various parts of our code (such as ReactCompositeComponent's // _renderValidatedComponent) assume that calls to render aren't nested; // verify that that's the case. (This is called by each top-level update // function, like setState, forceUpdate, etc.; creation and // destruction of top-level components is guarded in ReactMount.) - + if (!batchingStrategy.isBatchingUpdates) { batchingStrategy.batchedUpdates(enqueueUpdate, component); return; } - + dirtyComponents.push(component); if (component._updateBatchNumber == null) { component._updateBatchNumber = updateBatchNumber + 1; } } - + /** * Enqueue a callback to be run at the end of the current batching cycle. Throws * if no updates are currently being performed. @@ -8692,13 +8692,13 @@ asapCallbackQueue.enqueue(callback, context); asapEnqueued = true; } - + var ReactUpdatesInjection = { injectReconcileTransaction: function (ReconcileTransaction) { !ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : _prodInvariant('126') : void 0; ReactUpdates.ReactReconcileTransaction = ReconcileTransaction; }, - + injectBatchingStrategy: function (_batchingStrategy) { !_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : _prodInvariant('127') : void 0; !(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : _prodInvariant('128') : void 0; @@ -8706,7 +8706,7 @@ batchingStrategy = _batchingStrategy; } }; - + var ReactUpdates = { /** * React references `ReactReconcileTransaction` using this property in order @@ -8715,14 +8715,14 @@ * @internal */ ReactReconcileTransaction: null, - + batchedUpdates: batchedUpdates, enqueueUpdate: enqueueUpdate, flushBatchedUpdates: flushBatchedUpdates, injection: ReactUpdatesInjection, asap: asap }; - + module.exports = ReactUpdates; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -8740,16 +8740,16 @@ * * @providesModule CallbackQueue */ - + 'use strict'; - + var _prodInvariant = __webpack_require__(17), _assign = __webpack_require__(14); - + var PooledClass = __webpack_require__(16); - + var invariant = __webpack_require__(18); - + /** * A specialized pseudo-event module to help keep track of components waiting to * be notified when their DOM representations are available for use. @@ -8765,9 +8765,9 @@ this._callbacks = null; this._contexts = null; } - + _assign(CallbackQueue.prototype, { - + /** * Enqueues a callback to be invoked when `notifyAll` is invoked. * @@ -8781,7 +8781,7 @@ this._callbacks.push(callback); this._contexts.push(context); }, - + /** * Invokes all enqueued callbacks and clears the queue. This is invoked after * the DOM representation of a component has been created or updated. @@ -8802,18 +8802,18 @@ contexts.length = 0; } }, - + checkpoint: function () { return this._callbacks ? this._callbacks.length : 0; }, - + rollback: function (len) { if (this._callbacks) { this._callbacks.length = len; this._contexts.length = len; } }, - + /** * Resets the internal queue. * @@ -8823,18 +8823,18 @@ this._callbacks = null; this._contexts = null; }, - + /** * `PooledClass` looks for this. */ destructor: function () { this.reset(); } - + }); - + PooledClass.addPoolingTo(CallbackQueue); - + module.exports = CallbackQueue; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -8851,18 +8851,18 @@ * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactFeatureFlags - * + * */ - + 'use strict'; - + var ReactFeatureFlags = { // When true, call console.time() before and .timeEnd() after each top-level // render (both initial renders and updates). Useful when looking at prod-mode // timeline profiles in Chrome, for example. logTopLevelRenders: false }; - + module.exports = ReactFeatureFlags; /***/ }, @@ -8879,14 +8879,14 @@ * * @providesModule ReactReconciler */ - + 'use strict'; - + var ReactRef = __webpack_require__(78); var ReactInstrumentation = __webpack_require__(80); - + var warning = __webpack_require__(21); - + /** * Helper to call ReactRef.attachRefs with this composite component, split out * to avoid allocations in the transaction mount-ready queue. @@ -8894,9 +8894,9 @@ function attachRefs() { ReactRef.attachRefs(this, this._currentElement); } - + var ReactReconciler = { - + /** * Initializes the component, renders markup, and registers event listeners. * @@ -8926,7 +8926,7 @@ } return markup; }, - + /** * Returns a value that can be passed to * ReactComponentEnvironment.replaceNodeWithMarkup. @@ -8934,7 +8934,7 @@ getHostNode: function (internalInstance) { return internalInstance.getHostNode(); }, - + /** * Releases any resources allocated by `mountComponent`. * @@ -8955,7 +8955,7 @@ } } }, - + /** * Update a component using a new element. * @@ -8967,7 +8967,7 @@ */ receiveComponent: function (internalInstance, nextElement, transaction, context) { var prevElement = internalInstance._currentElement; - + if (nextElement === prevElement && context === internalInstance._context) { // Since elements are immutable after the owner is rendered, // we can do a cheap identity compare here to determine if this is a @@ -8976,37 +8976,37 @@ // the element. We explicitly check for the existence of an owner since // it's possible for an element created outside a composite to be // deeply mutated and reused. - + // TODO: Bailing out early is just a perf optimization right? // TODO: Removing the return statement should affect correctness? return; } - + if (process.env.NODE_ENV !== 'production') { if (internalInstance._debugID !== 0) { ReactInstrumentation.debugTool.onBeforeUpdateComponent(internalInstance._debugID, nextElement); } } - + var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement); - + if (refsChanged) { ReactRef.detachRefs(internalInstance, prevElement); } - + internalInstance.receiveComponent(nextElement, transaction, context); - + if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) { transaction.getReactMountReady().enqueue(attachRefs, internalInstance); } - + if (process.env.NODE_ENV !== 'production') { if (internalInstance._debugID !== 0) { ReactInstrumentation.debugTool.onUpdateComponent(internalInstance._debugID); } } }, - + /** * Flush any dirty changes in a component. * @@ -9033,9 +9033,9 @@ } } } - + }; - + module.exports = ReactReconciler; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -9053,13 +9053,13 @@ * * @providesModule ReactRef */ - + 'use strict'; - + var ReactOwner = __webpack_require__(79); - + var ReactRef = {}; - + function attachRef(ref, component, owner) { if (typeof ref === 'function') { ref(component.getPublicInstance()); @@ -9068,7 +9068,7 @@ ReactOwner.addComponentAsRefTo(component, ref, owner); } } - + function detachRef(ref, component, owner) { if (typeof ref === 'function') { ref(null); @@ -9077,7 +9077,7 @@ ReactOwner.removeComponentAsRefFrom(component, ref, owner); } } - + ReactRef.attachRefs = function (instance, element) { if (element === null || element === false) { return; @@ -9087,23 +9087,23 @@ attachRef(ref, instance, element._owner); } }; - + ReactRef.shouldUpdateRefs = function (prevElement, nextElement) { // If either the owner or a `ref` has changed, make sure the newest owner // has stored a reference to `this`, and the previous owner (if different) // has forgotten the reference to `this`. We use the element instead // of the public this.props because the post processing cannot determine // a ref. The ref conceptually lives on the element. - + // TODO: Should this even be possible? The owner cannot change because // it's forbidden by shouldUpdateReactComponent. The ref can change // if you swap the keys of but not the refs. Reconsider where this check // is made. It probably belongs where the key checking and // instantiateReactComponent is done. - + var prevEmpty = prevElement === null || prevElement === false; var nextEmpty = nextElement === null || nextElement === false; - + return ( // This has a few false positives w/r/t empty components. prevEmpty || nextEmpty || nextElement.ref !== prevElement.ref || @@ -9111,7 +9111,7 @@ typeof nextElement.ref === 'string' && nextElement._owner !== prevElement._owner ); }; - + ReactRef.detachRefs = function (instance, element) { if (element === null || element === false) { return; @@ -9121,7 +9121,7 @@ detachRef(ref, instance, element._owner); } }; - + module.exports = ReactRef; /***/ }, @@ -9138,13 +9138,13 @@ * * @providesModule ReactOwner */ - + 'use strict'; - + var _prodInvariant = __webpack_require__(17); - + var invariant = __webpack_require__(18); - + /** * ReactOwners are capable of storing references to owned components. * @@ -9176,7 +9176,7 @@ * @class ReactOwner */ var ReactOwner = { - + /** * @param {?object} object * @return {boolean} True if `object` is a valid owner. @@ -9185,7 +9185,7 @@ isValidOwner: function (object) { return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function'); }, - + /** * Adds a component by ref to an owner component. * @@ -9199,7 +9199,7 @@ !ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component\'s `render` method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).') : _prodInvariant('119') : void 0; owner.attachRef(ref, component); }, - + /** * Removes a component by ref from an owner component. * @@ -9218,9 +9218,9 @@ owner.detachRef(ref); } } - + }; - + module.exports = ReactOwner; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -9238,16 +9238,16 @@ * * @providesModule ReactInstrumentation */ - + 'use strict'; - + var debugTool = null; - + if (process.env.NODE_ENV !== 'production') { var ReactDebugTool = __webpack_require__(81); debugTool = ReactDebugTool; } - + module.exports = { debugTool: debugTool }; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -9265,21 +9265,21 @@ * * @providesModule ReactDebugTool */ - + 'use strict'; - + var ReactInvalidSetStateWarningHook = __webpack_require__(82); var ReactHostOperationHistoryHook = __webpack_require__(83); var ReactComponentTreeHook = __webpack_require__(38); var ReactChildrenMutationWarningHook = __webpack_require__(84); var ExecutionEnvironment = __webpack_require__(67); - + var performanceNow = __webpack_require__(85); var warning = __webpack_require__(21); - + var hooks = []; var didHookThrowForEvent = {}; - + function callHook(event, fn, context, arg1, arg2, arg3, arg4, arg5) { try { fn.call(context, arg1, arg2, arg3, arg4, arg5); @@ -9288,7 +9288,7 @@ didHookThrowForEvent[event] = true; } } - + function emitEvent(event, arg1, arg2, arg3, arg4, arg5) { for (var i = 0; i < hooks.length; i++) { var hook = hooks[i]; @@ -9298,7 +9298,7 @@ } } } - + var isProfiling = false; var flushHistory = []; var lifeCycleTimerStack = []; @@ -9309,14 +9309,14 @@ var currentTimerStartTime = null; var currentTimerNestedFlushDuration = null; var currentTimerType = null; - + var lifeCycleTimerHasWarned = false; - + function clearHistory() { ReactComponentTreeHook.purgeUnmountedComponents(); ReactHostOperationHistoryHook.clearHistory(); } - + function getTreeSnapshot(registeredIDs) { return registeredIDs.reduce(function (tree, id) { var ownerID = ReactComponentTreeHook.getOwnerID(id); @@ -9333,19 +9333,19 @@ return tree; }, {}); } - + function resetMeasurements() { var previousStartTime = currentFlushStartTime; var previousMeasurements = currentFlushMeasurements || []; var previousOperations = ReactHostOperationHistoryHook.getHistory(); - + if (currentFlushNesting === 0) { currentFlushStartTime = null; currentFlushMeasurements = null; clearHistory(); return; } - + if (previousMeasurements.length || previousOperations.length) { var registeredIDs = ReactComponentTreeHook.getRegisteredIDs(); flushHistory.push({ @@ -9355,15 +9355,15 @@ treeSnapshot: getTreeSnapshot(registeredIDs) }); } - + clearHistory(); currentFlushStartTime = performanceNow(); currentFlushMeasurements = []; } - + function checkDebugID(debugID) { var allowRoot = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; - + if (allowRoot && debugID === 0) { return; } @@ -9371,7 +9371,7 @@ process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDebugTool: debugID may not be empty.') : void 0; } } - + function beginLifeCycleTimer(debugID, timerType) { if (currentFlushNesting === 0) { return; @@ -9385,7 +9385,7 @@ currentTimerDebugID = debugID; currentTimerType = timerType; } - + function endLifeCycleTimer(debugID, timerType) { if (currentFlushNesting === 0) { return; @@ -9406,7 +9406,7 @@ currentTimerDebugID = null; currentTimerType = null; } - + function pauseCurrentLifeCycleTimer() { var currentTimer = { startTime: currentTimerStartTime, @@ -9420,22 +9420,22 @@ currentTimerDebugID = null; currentTimerType = null; } - + function resumeCurrentLifeCycleTimer() { var _lifeCycleTimerStack$ = lifeCycleTimerStack.pop(); - + var startTime = _lifeCycleTimerStack$.startTime; var nestedFlushStartTime = _lifeCycleTimerStack$.nestedFlushStartTime; var debugID = _lifeCycleTimerStack$.debugID; var timerType = _lifeCycleTimerStack$.timerType; - + var nestedFlushDuration = performanceNow() - nestedFlushStartTime; currentTimerStartTime = startTime; currentTimerNestedFlushDuration += nestedFlushDuration; currentTimerDebugID = debugID; currentTimerType = timerType; } - + var ReactDebugTool = { addHook: function (hook) { hooks.push(hook); @@ -9455,7 +9455,7 @@ if (isProfiling) { return; } - + isProfiling = true; flushHistory.length = 0; resetMeasurements(); @@ -9465,7 +9465,7 @@ if (!isProfiling) { return; } - + isProfiling = false; resetMeasurements(); ReactDebugTool.removeHook(ReactHostOperationHistoryHook); @@ -9548,11 +9548,11 @@ emitEvent('onTestEvent'); } }; - + // TODO remove these when RN/www gets updated ReactDebugTool.addDevtool = ReactDebugTool.addHook; ReactDebugTool.removeDevtool = ReactDebugTool.removeHook; - + ReactDebugTool.addHook(ReactInvalidSetStateWarningHook); ReactDebugTool.addHook(ReactComponentTreeHook); ReactDebugTool.addHook(ReactChildrenMutationWarningHook); @@ -9560,7 +9560,7 @@ if (/[?&]react_perf\b/.test(url)) { ReactDebugTool.beginProfiling(); } - + module.exports = ReactDebugTool; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -9578,19 +9578,19 @@ * * @providesModule ReactInvalidSetStateWarningHook */ - + 'use strict'; - + var warning = __webpack_require__(21); - + if (process.env.NODE_ENV !== 'production') { var processingChildContext = false; - + var warnInvalidSetState = function () { process.env.NODE_ENV !== 'production' ? warning(!processingChildContext, 'setState(...): Cannot call setState() inside getChildContext()') : void 0; }; } - + var ReactInvalidSetStateWarningHook = { onBeginProcessingChildContext: function () { processingChildContext = true; @@ -9602,7 +9602,7 @@ warnInvalidSetState(); } }; - + module.exports = ReactInvalidSetStateWarningHook; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -9620,11 +9620,11 @@ * * @providesModule ReactHostOperationHistoryHook */ - + 'use strict'; - + var history = []; - + var ReactHostOperationHistoryHook = { onHostOperation: function (debugID, type, payload) { history.push({ @@ -9638,14 +9638,14 @@ // Should only be used for tests. return; } - + history = []; }, getHistory: function () { return history; } }; - + module.exports = ReactHostOperationHistoryHook; /***/ }, @@ -9662,13 +9662,13 @@ * * @providesModule ReactChildrenMutationWarningHook */ - + 'use strict'; - + var ReactComponentTreeHook = __webpack_require__(38); - + var warning = __webpack_require__(21); - + function handleElement(debugID, element) { if (element == null) { return; @@ -9695,7 +9695,7 @@ process.env.NODE_ENV !== 'production' ? warning(false, 'Component\'s children should not be mutated.%s', ReactComponentTreeHook.getStackAddendumByID(debugID)) : void 0; } } - + var ReactChildrenMutationWarningHook = { onMountComponent: function (debugID) { handleElement(debugID, ReactComponentTreeHook.getElement(debugID)); @@ -9704,7 +9704,7 @@ handleElement(debugID, ReactComponentTreeHook.getElement(debugID)); } }; - + module.exports = ReactChildrenMutationWarningHook; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -9713,7 +9713,7 @@ /***/ function(module, exports, __webpack_require__) { 'use strict'; - + /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. @@ -9724,11 +9724,11 @@ * * @typechecks */ - + var performance = __webpack_require__(86); - + var performanceNow; - + /** * Detect if we can use `window.performance.now()` and gracefully fallback to * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now @@ -9743,7 +9743,7 @@ return Date.now(); }; } - + module.exports = performanceNow; /***/ }, @@ -9760,17 +9760,17 @@ * * @typechecks */ - + 'use strict'; - + var ExecutionEnvironment = __webpack_require__(67); - + var performance; - + if (ExecutionEnvironment.canUseDOM) { performance = window.performance || window.msPerformance || window.webkitPerformance; } - + module.exports = performance || {}; /***/ }, @@ -9787,13 +9787,13 @@ * * @providesModule Transaction */ - + 'use strict'; - + var _prodInvariant = __webpack_require__(17); - + var invariant = __webpack_require__(18); - + /** * `Transaction` creates a black box that is able to wrap any method such that * certain invariants are maintained before and after the method is invoked @@ -9872,19 +9872,19 @@ } this._isInTransaction = false; }, - + _isInTransaction: false, - + /** * @abstract * @return {Array} Array of transaction wrappers. */ getTransactionWrappers: null, - + isInTransaction: function () { return !!this._isInTransaction; }, - + /** * Executes the function within a safety window. Use this for the top level * methods that result in large amounts of computation/mutations that would @@ -9935,7 +9935,7 @@ } return ret; }, - + initializeAll: function (startIndex) { var transactionWrappers = this.transactionWrappers; for (var i = startIndex; i < transactionWrappers.length; i++) { @@ -9959,7 +9959,7 @@ } } }, - + /** * Invokes each of `this.transactionWrappers.close[i]` functions, passing into * them the respective return values of `this.transactionWrappers.init[i]` @@ -9997,18 +9997,18 @@ this.wrapperInitData.length = 0; } }; - + var Transaction = { - + Mixin: Mixin, - + /** * Token to look for to determine if an error occurred. */ OBSERVED_ERROR: {} - + }; - + module.exports = Transaction; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -10026,9 +10026,9 @@ * * @providesModule getEventTarget */ - + 'use strict'; - + /** * Gets the target node from a native browser event by accounting for * inconsistencies in browser DOM APIs. @@ -10036,20 +10036,20 @@ * @param {object} nativeEvent Native browser event. * @return {DOMEventTarget} Target node. */ - + function getEventTarget(nativeEvent) { var target = nativeEvent.target || nativeEvent.srcElement || window; - + // Normalize SVG element events #4963 if (target.correspondingUseElement) { target = target.correspondingUseElement; } - + // Safari may fire events on text nodes (Node.TEXT_NODE is 3). // @see http://www.quirksmode.org/js/events_properties.html return target.nodeType === 3 ? target.parentNode : target; } - + module.exports = getEventTarget; /***/ }, @@ -10066,11 +10066,11 @@ * * @providesModule isEventSupported */ - + 'use strict'; - + var ExecutionEnvironment = __webpack_require__(67); - + var useHasFeature; if (ExecutionEnvironment.canUseDOM) { useHasFeature = document.implementation && document.implementation.hasFeature && @@ -10078,7 +10078,7 @@ // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature document.implementation.hasFeature('', '') !== true; } - + /** * Checks if an event is supported in the current execution environment. * @@ -10097,24 +10097,24 @@ if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) { return false; } - + var eventName = 'on' + eventNameSuffix; var isSupported = eventName in document; - + if (!isSupported) { var element = document.createElement('div'); element.setAttribute(eventName, 'return;'); isSupported = typeof element[eventName] === 'function'; } - + if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') { // This is the only way to test support for the `wheel` event in IE9+. isSupported = document.implementation.hasFeature('Events.wheel', '3.0'); } - + return isSupported; } - + module.exports = isEventSupported; /***/ }, @@ -10130,15 +10130,15 @@ * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule isTextInputElement - * + * */ - + 'use strict'; - + /** * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary */ - + var supportedInputTypes = { 'color': true, 'date': true, @@ -10156,21 +10156,21 @@ 'url': true, 'week': true }; - + function isTextInputElement(elem) { var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); - + if (nodeName === 'input') { return !!supportedInputTypes[elem.type]; } - + if (nodeName === 'textarea') { return true; } - + return false; } - + module.exports = isTextInputElement; /***/ }, @@ -10187,11 +10187,11 @@ * * @providesModule DefaultEventPluginOrder */ - + 'use strict'; - + var keyOf = __webpack_require__(35); - + /** * Module that is injectable into `EventPluginHub`, that specifies a * deterministic ordering of `EventPlugin`s. A convenient way to reason about @@ -10202,7 +10202,7 @@ * preventing default on events is convenient in `SimpleEventPlugin` handlers. */ var DefaultEventPluginOrder = [keyOf({ ResponderEventPlugin: null }), keyOf({ SimpleEventPlugin: null }), keyOf({ TapEventPlugin: null }), keyOf({ EnterLeaveEventPlugin: null }), keyOf({ ChangeEventPlugin: null }), keyOf({ SelectEventPlugin: null }), keyOf({ BeforeInputEventPlugin: null })]; - + module.exports = DefaultEventPluginOrder; /***/ }, @@ -10219,18 +10219,18 @@ * * @providesModule EnterLeaveEventPlugin */ - + 'use strict'; - + var EventConstants = __webpack_require__(59); var EventPropagators = __webpack_require__(60); var ReactDOMComponentTree = __webpack_require__(54); var SyntheticMouseEvent = __webpack_require__(93); - + var keyOf = __webpack_require__(35); - + var topLevelTypes = EventConstants.topLevelTypes; - + var eventTypes = { mouseEnter: { registrationName: keyOf({ onMouseEnter: null }), @@ -10241,11 +10241,11 @@ dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver] } }; - + var EnterLeaveEventPlugin = { - + eventTypes: eventTypes, - + /** * For almost every interaction we care about, there will be both a top-level * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that @@ -10261,7 +10261,7 @@ // Must not be a mouse in or mouse out - ignoring. return null; } - + var win; if (nativeEventTarget.window === nativeEventTarget) { // `nativeEventTarget` is probably a window object. @@ -10275,7 +10275,7 @@ win = window; } } - + var from; var to; if (topLevelType === topLevelTypes.topMouseOut) { @@ -10287,32 +10287,32 @@ from = null; to = targetInst; } - + if (from === to) { // Nothing pertains to our managed components. return null; } - + var fromNode = from == null ? win : ReactDOMComponentTree.getNodeFromInstance(from); var toNode = to == null ? win : ReactDOMComponentTree.getNodeFromInstance(to); - + var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, from, nativeEvent, nativeEventTarget); leave.type = 'mouseleave'; leave.target = fromNode; leave.relatedTarget = toNode; - + var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, to, nativeEvent, nativeEventTarget); enter.type = 'mouseenter'; enter.target = toNode; enter.relatedTarget = fromNode; - + EventPropagators.accumulateEnterLeaveDispatches(leave, enter, from, to); - + return [leave, enter]; } - + }; - + module.exports = EnterLeaveEventPlugin; /***/ }, @@ -10329,14 +10329,14 @@ * * @providesModule SyntheticMouseEvent */ - + 'use strict'; - + var SyntheticUIEvent = __webpack_require__(94); var ViewportMetrics = __webpack_require__(95); - + var getEventModifierState = __webpack_require__(96); - + /** * @interface MouseEvent * @see http://www.w3.org/TR/DOM-Level-3-Events/ @@ -10377,7 +10377,7 @@ return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop; } }; - + /** * @param {object} dispatchConfig Configuration used to dispatch this event. * @param {string} dispatchMarker Marker identifying the event target. @@ -10387,9 +10387,9 @@ function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); } - + SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface); - + module.exports = SyntheticMouseEvent; /***/ }, @@ -10406,13 +10406,13 @@ * * @providesModule SyntheticUIEvent */ - + 'use strict'; - + var SyntheticEvent = __webpack_require__(71); - + var getEventTarget = __webpack_require__(88); - + /** * @interface UIEvent * @see http://www.w3.org/TR/DOM-Level-3-Events/ @@ -10422,13 +10422,13 @@ if (event.view) { return event.view; } - + var target = getEventTarget(event); if (target.window === target) { // target is a window object return target; } - + var doc = target.ownerDocument; // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. if (doc) { @@ -10441,7 +10441,7 @@ return event.detail || 0; } }; - + /** * @param {object} dispatchConfig Configuration used to dispatch this event. * @param {string} dispatchMarker Marker identifying the event target. @@ -10451,9 +10451,9 @@ function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) { return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget); } - + SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface); - + module.exports = SyntheticUIEvent; /***/ }, @@ -10470,22 +10470,22 @@ * * @providesModule ViewportMetrics */ - + 'use strict'; - + var ViewportMetrics = { - + currentScrollLeft: 0, - + currentScrollTop: 0, - + refreshScrollValues: function (scrollPosition) { ViewportMetrics.currentScrollLeft = scrollPosition.x; ViewportMetrics.currentScrollTop = scrollPosition.y; } - + }; - + module.exports = ViewportMetrics; /***/ }, @@ -10502,21 +10502,21 @@ * * @providesModule getEventModifierState */ - + 'use strict'; - + /** * Translation from modifier key to the associated property in the event. * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers */ - + var modifierKeyToProp = { 'Alt': 'altKey', 'Control': 'ctrlKey', 'Meta': 'metaKey', 'Shift': 'shiftKey' }; - + // IE8 does not implement getModifierState so we simply map it to the only // modifier keys exposed by the event itself, does not support Lock-keys. // Currently, all major browsers except Chrome seems to support Lock-keys. @@ -10529,11 +10529,11 @@ var keyProp = modifierKeyToProp[keyArg]; return keyProp ? !!nativeEvent[keyProp] : false; } - + function getEventModifierState(nativeEvent) { return modifierStateGetter; } - + module.exports = getEventModifierState; /***/ }, @@ -10550,17 +10550,17 @@ * * @providesModule HTMLDOMPropertyConfig */ - + 'use strict'; - + var DOMProperty = __webpack_require__(55); - + var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY; var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE; var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE; var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE; var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE; - + var HTMLDOMPropertyConfig = { isCustomAttribute: RegExp.prototype.test.bind(new RegExp('^(data|aria)-[' + DOMProperty.ATTRIBUTE_NAME_CHAR + ']*$')), Properties: { @@ -10695,7 +10695,7 @@ width: 0, wmode: 0, wrap: 0, - + /** * RDFa Properties */ @@ -10708,7 +10708,7 @@ resource: 0, 'typeof': 0, vocab: 0, - + /** * Non-standard Properties */ @@ -10747,7 +10747,7 @@ }, DOMPropertyNames: {} }; - + module.exports = HTMLDOMPropertyConfig; /***/ }, @@ -10764,25 +10764,25 @@ * * @providesModule ReactComponentBrowserEnvironment */ - + 'use strict'; - + var DOMChildrenOperations = __webpack_require__(99); var ReactDOMIDOperations = __webpack_require__(111); - + /** * Abstracts away all functionality of the reconciler that requires knowledge of * the browser context. TODO: These callers should be refactored to avoid the * need for this injection. */ var ReactComponentBrowserEnvironment = { - + processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates, - + replaceNodeWithMarkup: DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup - + }; - + module.exports = ReactComponentBrowserEnvironment; /***/ }, @@ -10799,19 +10799,19 @@ * * @providesModule DOMChildrenOperations */ - + 'use strict'; - + var DOMLazyTree = __webpack_require__(100); var Danger = __webpack_require__(106); var ReactMultiChildUpdateTypes = __webpack_require__(110); var ReactDOMComponentTree = __webpack_require__(54); var ReactInstrumentation = __webpack_require__(80); - + var createMicrosoftUnsafeLocalFunction = __webpack_require__(103); var setInnerHTML = __webpack_require__(102); var setTextContent = __webpack_require__(104); - + function getNodeAfter(parentNode, node) { // Special case for text components, which return [open, close] comments // from getHostNode. @@ -10820,7 +10820,7 @@ } return node ? node.nextSibling : parentNode.firstChild; } - + /** * Inserts `childNode` as a child of `parentNode` at the `index`. * @@ -10835,11 +10835,11 @@ // we are careful to use `null`.) parentNode.insertBefore(childNode, referenceNode); }); - + function insertLazyTreeChildAt(parentNode, childTree, referenceNode) { DOMLazyTree.insertTreeBefore(parentNode, childTree, referenceNode); } - + function moveChild(parentNode, childNode, referenceNode) { if (Array.isArray(childNode)) { moveDelimitedText(parentNode, childNode[0], childNode[1], referenceNode); @@ -10847,7 +10847,7 @@ insertChildAt(parentNode, childNode, referenceNode); } } - + function removeChild(parentNode, childNode) { if (Array.isArray(childNode)) { var closingComment = childNode[1]; @@ -10857,7 +10857,7 @@ } parentNode.removeChild(childNode); } - + function moveDelimitedText(parentNode, openingComment, closingComment, referenceNode) { var node = openingComment; while (true) { @@ -10869,7 +10869,7 @@ node = nextNode; } } - + function removeDelimitedText(parentNode, startNode, closingComment) { while (true) { var node = startNode.nextSibling; @@ -10881,7 +10881,7 @@ } } } - + function replaceDelimitedText(openingComment, closingComment, stringText) { var parentNode = openingComment.parentNode; var nodeAfterComment = openingComment.nextSibling; @@ -10901,12 +10901,12 @@ removeDelimitedText(parentNode, openingComment, closingComment); } } - + if (process.env.NODE_ENV !== 'production') { ReactInstrumentation.debugTool.onHostOperation(ReactDOMComponentTree.getInstanceFromNode(openingComment)._debugID, 'replace text', stringText); } } - + var dangerouslyReplaceNodeWithMarkup = Danger.dangerouslyReplaceNodeWithMarkup; if (process.env.NODE_ENV !== 'production') { dangerouslyReplaceNodeWithMarkup = function (oldChild, markup, prevInstance) { @@ -10921,16 +10921,16 @@ } }; } - + /** * Operations for updating with DOM children. */ var DOMChildrenOperations = { - + dangerouslyReplaceNodeWithMarkup: dangerouslyReplaceNodeWithMarkup, - + replaceDelimitedText: replaceDelimitedText, - + /** * Updates a component's children by processing a series of updates. The * update configurations are each expected to have a `parentNode` property. @@ -10942,7 +10942,7 @@ if (process.env.NODE_ENV !== 'production') { var parentNodeDebugID = ReactDOMComponentTree.getInstanceFromNode(parentNode)._debugID; } - + for (var k = 0; k < updates.length; k++) { var update = updates[k]; switch (update.type) { @@ -10979,9 +10979,9 @@ } } } - + }; - + module.exports = DOMChildrenOperations; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -10999,18 +10999,18 @@ * * @providesModule DOMLazyTree */ - + 'use strict'; - + var DOMNamespaces = __webpack_require__(101); var setInnerHTML = __webpack_require__(102); - + var createMicrosoftUnsafeLocalFunction = __webpack_require__(103); var setTextContent = __webpack_require__(104); - + var ELEMENT_NODE_TYPE = 1; var DOCUMENT_FRAGMENT_NODE_TYPE = 11; - + /** * In IE (8-11) and Edge, appending nodes with no children is dramatically * faster than appending a full subtree, so we essentially queue up the @@ -11023,7 +11023,7 @@ * See https://github.com/spicyj/innerhtml-vs-createelement-vs-clonenode. */ var enableLazy = typeof document !== 'undefined' && typeof document.documentMode === 'number' || typeof navigator !== 'undefined' && typeof navigator.userAgent === 'string' && /\bEdge\/\d/.test(navigator.userAgent); - + function insertTreeChildren(tree) { if (!enableLazy) { return; @@ -11040,7 +11040,7 @@ setTextContent(node, tree.text); } } - + var insertTreeBefore = createMicrosoftUnsafeLocalFunction(function (parentNode, tree, referenceNode) { // DocumentFragments aren't actually part of the DOM after insertion so // appending children won't update the DOM. We need to ensure the fragment @@ -11056,12 +11056,12 @@ insertTreeChildren(tree); } }); - + function replaceChildWithTree(oldNode, newTree) { oldNode.parentNode.replaceChild(newTree.node, oldNode); insertTreeChildren(newTree); } - + function queueChild(parentTree, childTree) { if (enableLazy) { parentTree.children.push(childTree); @@ -11069,7 +11069,7 @@ parentTree.node.appendChild(childTree.node); } } - + function queueHTML(tree, html) { if (enableLazy) { tree.html = html; @@ -11077,7 +11077,7 @@ setInnerHTML(tree.node, html); } } - + function queueText(tree, text) { if (enableLazy) { tree.text = text; @@ -11085,11 +11085,11 @@ setTextContent(tree.node, text); } } - + function toString() { return this.node.nodeName; } - + function DOMLazyTree(node) { return { node: node, @@ -11099,13 +11099,13 @@ toString: toString }; } - + DOMLazyTree.insertTreeBefore = insertTreeBefore; DOMLazyTree.replaceChildWithTree = replaceChildWithTree; DOMLazyTree.queueChild = queueChild; DOMLazyTree.queueHTML = queueHTML; DOMLazyTree.queueText = queueText; - + module.exports = DOMLazyTree; /***/ }, @@ -11122,15 +11122,15 @@ * * @providesModule DOMNamespaces */ - + 'use strict'; - + var DOMNamespaces = { html: 'http://www.w3.org/1999/xhtml', mathml: 'http://www.w3.org/1998/Math/MathML', svg: 'http://www.w3.org/2000/svg' }; - + module.exports = DOMNamespaces; /***/ }, @@ -11147,20 +11147,20 @@ * * @providesModule setInnerHTML */ - + 'use strict'; - + var ExecutionEnvironment = __webpack_require__(67); var DOMNamespaces = __webpack_require__(101); - + var WHITESPACE_TEST = /^[ \r\n\t\f]/; var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/; - + var createMicrosoftUnsafeLocalFunction = __webpack_require__(103); - + // SVG temp container for IE lacking innerHTML var reusableSVGContainer; - + /** * Set the innerHTML property of a node, ensuring that whitespace is preserved * even in IE8. @@ -11184,13 +11184,13 @@ node.innerHTML = html; } }); - + if (ExecutionEnvironment.canUseDOM) { // IE8: When updating a just created node with innerHTML only leading // whitespace is removed. When updating an existing node with innerHTML // whitespace in root TextNodes is also collapsed. // @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html - + // Feature detection; only IE8 is known to behave improperly like this. var testElement = document.createElement('div'); testElement.innerHTML = ' '; @@ -11204,7 +11204,7 @@ if (node.parentNode) { node.parentNode.replaceChild(node, node); } - + // We also implement a workaround for non-visible tags disappearing into // thin air on IE8, this only happens if there is no visible text // in-front of the non-visible tags. Piggyback on the whitespace fix @@ -11217,7 +11217,7 @@ // the actual Unicode character (by Babel, for example). // https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216 node.innerHTML = String.fromCharCode(0xFEFF) + html; - + // deleteData leaves an empty `TextNode` which offsets the index of all // children. Definitely want to avoid this. var textNode = node.firstChild; @@ -11233,7 +11233,7 @@ } testElement = null; } - + module.exports = setInnerHTML; /***/ }, @@ -11250,15 +11250,15 @@ * * @providesModule createMicrosoftUnsafeLocalFunction */ - + /* globals MSApp */ - + 'use strict'; - + /** * Create a function which has 'unsafe' privileges (required by windows8 apps) */ - + var createMicrosoftUnsafeLocalFunction = function (func) { if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) { return function (arg0, arg1, arg2, arg3) { @@ -11270,7 +11270,7 @@ return func; } }; - + module.exports = createMicrosoftUnsafeLocalFunction; /***/ }, @@ -11287,13 +11287,13 @@ * * @providesModule setTextContent */ - + 'use strict'; - + var ExecutionEnvironment = __webpack_require__(67); var escapeTextContentForBrowser = __webpack_require__(105); var setInnerHTML = __webpack_require__(102); - + /** * Set the textContent property of a node, ensuring that whitespace is preserved * even in IE8. innerText is a poor substitute for textContent and, among many @@ -11307,7 +11307,7 @@ var setTextContent = function (node, text) { if (text) { var firstChild = node.firstChild; - + if (firstChild && firstChild === node.lastChild && firstChild.nodeType === 3) { firstChild.nodeValue = text; return; @@ -11315,7 +11315,7 @@ } node.textContent = text; }; - + if (ExecutionEnvironment.canUseDOM) { if (!('textContent' in document.documentElement)) { setTextContent = function (node, text) { @@ -11323,7 +11323,7 @@ }; } } - + module.exports = setTextContent; /***/ }, @@ -11365,17 +11365,17 @@ * * @providesModule escapeTextContentForBrowser */ - + 'use strict'; - + // code copied and modified from escape-html /** * Module variables. * @private */ - + var matchHtmlRegExp = /["'&<>]/; - + /** * Escape special characters in the given string of html. * @@ -11383,20 +11383,20 @@ * @return {string} * @public */ - + function escapeHtml(string) { var str = '' + string; var match = matchHtmlRegExp.exec(str); - + if (!match) { return str; } - + var escape; var html = ''; var index = 0; var lastIndex = 0; - + for (index = match.index; index < str.length; index++) { switch (str.charCodeAt(index)) { case 34: @@ -11422,20 +11422,20 @@ default: continue; } - + if (lastIndex !== index) { html += str.substring(lastIndex, index); } - + lastIndex = index + 1; html += escape; } - + return lastIndex !== index ? html + str.substring(lastIndex, index) : html; } // end code copied and modified from escape-html - - + + /** * Escapes text to prevent scripting attacks. * @@ -11451,7 +11451,7 @@ } return escapeHtml(text); } - + module.exports = escapeTextContentForBrowser; /***/ }, @@ -11468,20 +11468,20 @@ * * @providesModule Danger */ - + 'use strict'; - + var _prodInvariant = __webpack_require__(17); - + var DOMLazyTree = __webpack_require__(100); var ExecutionEnvironment = __webpack_require__(67); - + var createNodesFromMarkup = __webpack_require__(107); var emptyFunction = __webpack_require__(22); var invariant = __webpack_require__(18); - + var Danger = { - + /** * Replaces a node with a string of markup at its current position within its * parent. The markup must render into a single root node. @@ -11494,7 +11494,7 @@ !ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a worker thread. Make sure `window` and `document` are available globally before requiring React when unit testing or use ReactDOMServer.renderToString() for server rendering.') : _prodInvariant('56') : void 0; !markup ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : _prodInvariant('57') : void 0; !(oldChild.nodeName !== 'HTML') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the node. This is because browser quirks make this unreliable and/or slow. If you want to render to the root you must use server rendering. See ReactDOMServer.renderToString().') : _prodInvariant('58') : void 0; - + if (typeof markup === 'string') { var newChild = createNodesFromMarkup(markup, emptyFunction)[0]; oldChild.parentNode.replaceChild(newChild, oldChild); @@ -11502,9 +11502,9 @@ DOMLazyTree.replaceChildWithTree(oldChild, markup); } } - + }; - + module.exports = Danger; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) @@ -11513,7 +11513,7 @@ /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(process) {'use strict'; - + /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. @@ -11524,25 +11524,25 @@ * * @typechecks */ - + /*eslint-disable fb-www/unsafe-html*/ - + var ExecutionEnvironment = __webpack_require__(67); - + var createArrayFromMixed = __webpack_require__(108); var getMarkupWrap = __webpack_require__(109); var invariant = __webpack_require__(18); - + /** * Dummy container used to render all markup. */ var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null; - + /** * Pattern used by `getNodeName`. */ var nodeNamePattern = /^\s*<(\w+)/; - + /** * Extracts the `nodeName` of the first element in a string of markup. * @@ -11553,7 +11553,7 @@ var nodeNameMatch = markup.match(nodeNamePattern); return nodeNameMatch && nodeNameMatch[1].toLowerCase(); } - + /** * Creates an array containing the nodes rendered from the supplied markup. The * optionally supplied `handleScript` function will be invoked once for each @@ -11568,11 +11568,11 @@ var node = dummyNode; !!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : void 0; var nodeName = getNodeName(markup); - + var wrap = nodeName && getMarkupWrap(nodeName); if (wrap) { node.innerHTML = wrap[1] + markup + wrap[2]; - + var wrapDepth = wrap[0]; while (wrapDepth--) { node = node.lastChild; @@ -11580,20 +11580,20 @@ } else { node.innerHTML = markup; } - + var scripts = node.getElementsByTagName('script'); if (scripts.length) { !handleScript ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup(...): Unexpected
    \ No newline at end of file diff --git a/www/public/logo.png b/www/public/logo.png deleted file mode 100644 index 26d7a9a74803bf0a21829e2f368fcaf89132a0bc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4135 zcmZvfX*AT~+sA)1V;TEkvScuJLM3aqM#vV~vkWnovL*XoW8b2o?2Vm}ZG@2QLbiyE zvNMz=>s0o~|2fY&|2NNz`~F_%{@mA_>s)U>@rDLk478VN0RUjo(bh1&$o~HvDAmPX zWl^1b5uCo77QQB)&b|Tm-cEp;qbJ4*spDb)(8<`z-Z98)z)2YZmy~ufv1AJq!}6Sjl4xq5#35U?hwJg@j^JFd!TWfYkts z2mtyY@PBc^i_4$h=RJ9mq%+7X(8hAMCVti|UL$ngwwibrayY*@I$x0d(&*I{0Vqbaz?Xo9^Ypn;N;s7NUNS0R1>LP=Yd_WyNeR7z}4N>T- zfKiRplOb?S1!bZnzK-xAach6k8TS+5$Tgi6MA*s=Z*uIY-L7ff645C z1~0C;0W0-@m!n%cy zMmVNL@z?XnwD1Yp-iIU+8L>bAvkh&F`U+!dzGvo@SP4m`t$t=ie31Tf45Gy}=)YCnnA4t$H84MtEJYv_JR^)!=qf#S# zzIMW(@amqdSyXgo92AN7B|IPVBM_PH7(S(Vy_fB!0({p0N@TqLs={X`@j!@r17ly( zYOb`ZY@u=`^rZM5w$}YlZVC%Rbt#$1SFi=JQfhy)p?37xeIGxrLMr7>TMfhVGYp`* zhS#qkm++bFkeac{Dw#{kIzXIetN~@d_TguGHb@C(P(l!e$z4s$9Jn$PCsv`mO>=H= z9+RpXT*&cQ7~W^&$BAnIke+HBTjAGl*KYMCJehpT9FX?S#(l)%m(~ft3#2{mkQAd0 zv!E7{LN$ePL0CfSmOkGwYzHH%eDivja72)0(KQfEpS;5#IW{uR-*|-)g#6Pv6)p8! zd`rv~b60`8NOL_oQPa?nADPFn*Ih5dw^NRgC3tFFZG)TKV!2+SF7wOv$Hc}+{dQ#l zjR&Z|&rop2>!<7fT@$v{QEuEFVC6c8nEF`sDZCy6E8mTk1(4gbqPpfA#+Rwl;$f0S zR8ax*PNgAq{sD4gFpu;nMoAv8u)Zgb#H7w@_4~V8XzT)RFfW_``njRY8d}1ZSj4d` zSC{g1IAfx?6YRz#A{3M`p%{oF;y*)PNLNH|x%60W^VSK37BYkPze<%)(0?0|8`%)Q zwMj|6@Bs4orP(2imdHYS%QK4AH)%9a&FzmtDw+xv+#wGjp148QH*g(GrVDgDbeA{? zWrfMT^z|VO8793@?laxtti?QS8P#Sg-CqC}!BkAb)vwEUndwBGezO}lV65r;A|p0h z8EIjvv>S3=axJP0&chUZqu9>a$CHs=T8T~X!t517N%uU6uWc=6AeJei*RE$+y$O=g zssoF*Zd@xLvlgA>EN~DxV(um^Gve=?)U`sV4^&H6=MxsP7F4=|Td4)4Tj+YF%L8k8 z`4Dt5OZa>DR38T2dK*(TE(8&FQE|@vc1r4xj33Kun&#}B?rI}Neozj1vEJzX&{u&g z&);>$+)I<|3K&{Z7+l) zg^c{u06~K<5Abf41ei4!Y;mUe!5y1*3l@{YSCZCqYoGqtgyf*gJ61wr=|sUquOf44&_4k`U4R$Bw6dPk!v%3TjVJIqaRrktH2};=yH@oi5y~LatVc@_h5^2OucY|$Ho0YwM-W@N; zI45ANI}@+W^blgijWQ13wr;wf$WsaZ&!e$fu2}D{o;&huSYkS6nj<>;wR9vIUq|jR zQ2Wat@N76lCj#h^8yM0n=Q=YOzQQlP2|p12UbCO?qL1c&R=bB@zay@SB}4nN;g@ku z;2t+_(PSo>k(_>em52oW^e!hoJSdf72P}Jc2YPx#lwmqmkN~>z=kQyTck3P7ZXADXzW zl)=K%Yp@NFI7{PWkH|lYSU6u++vRM9f63Qs`8%(?KU`MiDlK!+ga2z;`Z(pVC1$*+ zySQeN62CT5>+LADAu3xV9cKojp1LGoZZ%x|D>ubTlPgN^#L%I_`5;&{V&{XtL3+n& z0=uN)qnFG~f>zRru^O`A%a;FI-dQvYPOr*l2%EXa^)%JMA}m&-%KCXdyq6e59A+G? znQ~U$$*!u1q$hNpTp~Wl5>h`F#1yn7Fw}Y@`7_aqfzfp$cxSHSuN0xZkXnAST0y{{ z>7ULvOgVw#AE}ts%{7XC!<*61Od33Yl-t?f{OflDuGChaN`wUKYYVSqH=D0nG3`wf z*ADL~zn8Dn&cr>(16|VhvhlT__iGqvt@GSQJs89>)bZvg3U=GKXCpY~=DliEj%%4d zXH{o-V2VwJ;1x`ijisu%inC&*;H|L(AEreC(dE1cU7ZV(puUe-g0d#TRZ8$pv@*2Q6f@J>If zZY$e#tT$IRdxatxJjcsLKv_SRBJ8k9ltuwq{#?XuOnqur^I{C_9(LL8uHR7(BR}B zvnQ3c2SDMvFR}`cLAcWVnSc&*c2@#$QGWTEojFy$sIND#V#$2>IQI=4i%2$dMzh73 zujE+~cZjBbxy6!O{K2TXjvH(Er|kqY%Z9RDpM&$4EeGV@kC}7hxn>1fHKW3t@N}PO z_$#L3gU1Qx;61AJ5~(V$dv==1ddt3bP8*;_&U|}4#m+DLG-#mM1DpAWJ3osv(q&#g zazVo$HZxJ)!7GhyY!gfSci2OqC&kQq-CcIG3R;lnUv3YV*?VIU z^4r>PK@W4neKzj2ks{Xog(MgxMB5|-m1k+@#eZ5VXn#Gls4@j zfQ>lpjo1KpOR&Rx*K!4;6#2uVYAamBr`WxNMT*&vatK!cxAnqm{-ySqN0nHj6|Ur4 z(oIFSLP@*g(7Nr&F+AUESrz@}`LRYLNdfg=N1Id_n`IR^`({GwvUL*q>vrSiu zt|Z0Z9aTJF$(@s=*%P+_ARqG;+|k<=UJ8d`|AntmdEOR6^6GShP$#I=oF;>LTALT{ zH%*sx@9rOsU9Lg(lw=dDeL5l#xKWG;`t>5{^oQ=fP2=H)_OiEZg1b@)4kl?0a_+LU z_aAVGBM%}9Eu~f|R9YSiUX!C1*!Q|||GuQQD*_+VHxO*~VWnk3mvj|f-Uz~M@CYR@ z*E zfMRsx1S4BZZ`+}jID*twQ!0pD9SMyv9%*E>)0@`Pk=cngr|bQAZ$foJY8-U~FU)%Q z?(p6b0(&p%1LdubaO6iqi27O8)=}4RIi+YLo0$+}h7{GsFwLp_a)D!)N+K>MN3&>4Vo9q^?i^sWfSHM7KGglTlF^eT6Z$~w=JdvvDVZaj z4{9d?L@m-llE$wI_r6|HOa|zTK(Jb-80v+N7bwy!U@6s<_vY}~{7`BnpBhV7vMN}> z&1793aLE(m3s|MKLjfxaqFG+=DASEKys;n@CQ8sgL+^XG=_Lj4;#dIJ*dr|SRnxLV z-^7G%vxV}0I0TGLtu0>lYp1rMIrnk07nQGAKhZl2qxnm7VaoL)ubIIAHRb$a%IU)V0Ub>Pjq2NW5&r}3!INzO diff --git a/www/public/render-page.js b/www/public/render-page.js new file mode 100644 index 0000000..d838e78 --- /dev/null +++ b/www/public/render-page.js @@ -0,0 +1,40760 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(require("@reach/router"), require("core-js/fn/object/assign"), require("core-js/modules/es6.array.sort"), require("fs"), require("lodash"), require("lodash/camelCase"), require("lodash/cloneDeepWith"), require("lodash/has"), require("lodash/mapKeys"), require("lodash/mapValues"), require("lodash/omit"), require("lodash/omitBy"), require("lodash/pick"), require("lodash/snakeCase"), require("lodash/toArray"), require("lodash/uniq"), require("path"), require("react"), require("react-dom/server")); + else if(typeof define === 'function' && define.amd) + define("lib", ["@reach/router", "core-js/fn/object/assign", "core-js/modules/es6.array.sort", "fs", "lodash", "lodash/camelCase", "lodash/cloneDeepWith", "lodash/has", "lodash/mapKeys", "lodash/mapValues", "lodash/omit", "lodash/omitBy", "lodash/pick", "lodash/snakeCase", "lodash/toArray", "lodash/uniq", "path", "react", "react-dom/server"], factory); + else if(typeof exports === 'object') + exports["lib"] = factory(require("@reach/router"), require("core-js/fn/object/assign"), require("core-js/modules/es6.array.sort"), require("fs"), require("lodash"), require("lodash/camelCase"), require("lodash/cloneDeepWith"), require("lodash/has"), require("lodash/mapKeys"), require("lodash/mapValues"), require("lodash/omit"), require("lodash/omitBy"), require("lodash/pick"), require("lodash/snakeCase"), require("lodash/toArray"), require("lodash/uniq"), require("path"), require("react"), require("react-dom/server")); + else + root["lib"] = factory(root["@reach/router"], root["core-js/fn/object/assign"], root["core-js/modules/es6.array.sort"], root["fs"], root["lodash"], root["lodash/camelCase"], root["lodash/cloneDeepWith"], root["lodash/has"], root["lodash/mapKeys"], root["lodash/mapValues"], root["lodash/omit"], root["lodash/omitBy"], root["lodash/pick"], root["lodash/snakeCase"], root["lodash/toArray"], root["lodash/uniq"], root["path"], root["react"], root["react-dom/server"]); +})(this, function(__WEBPACK_EXTERNAL_MODULE__reach_router__, __WEBPACK_EXTERNAL_MODULE_core_js_fn_object_assign__, __WEBPACK_EXTERNAL_MODULE_core_js_modules_es6_array_sort__, __WEBPACK_EXTERNAL_MODULE_fs__, __WEBPACK_EXTERNAL_MODULE_lodash__, __WEBPACK_EXTERNAL_MODULE_lodash_camelCase__, __WEBPACK_EXTERNAL_MODULE_lodash_cloneDeepWith__, __WEBPACK_EXTERNAL_MODULE_lodash_has__, __WEBPACK_EXTERNAL_MODULE_lodash_mapKeys__, __WEBPACK_EXTERNAL_MODULE_lodash_mapValues__, __WEBPACK_EXTERNAL_MODULE_lodash_omit__, __WEBPACK_EXTERNAL_MODULE_lodash_omitBy__, __WEBPACK_EXTERNAL_MODULE_lodash_pick__, __WEBPACK_EXTERNAL_MODULE_lodash_snakeCase__, __WEBPACK_EXTERNAL_MODULE_lodash_toArray__, __WEBPACK_EXTERNAL_MODULE_lodash_uniq__, __WEBPACK_EXTERNAL_MODULE_path__, __WEBPACK_EXTERNAL_MODULE_react__, __WEBPACK_EXTERNAL_MODULE_react_dom_server__) { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = "/"; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = "./.cache/static-entry.js"); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ "../node_modules/memoize-one/dist/memoize-one.esm.js": +/*!***********************************************************!*\ + !*** ../node_modules/memoize-one/dist/memoize-one.esm.js ***! + \***********************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +var simpleIsEqual = function simpleIsEqual(a, b) { + return a === b; +}; + +function index (resultFn, isEqual) { + if (isEqual === void 0) { + isEqual = simpleIsEqual; + } + + var lastThis; + var lastArgs = []; + var lastResult; + var calledOnce = false; + + var isNewArgEqualToLast = function isNewArgEqualToLast(newArg, index) { + return isEqual(newArg, lastArgs[index]); + }; + + var result = function result() { + for (var _len = arguments.length, newArgs = new Array(_len), _key = 0; _key < _len; _key++) { + newArgs[_key] = arguments[_key]; + } + + if (calledOnce && lastThis === this && newArgs.length === lastArgs.length && newArgs.every(isNewArgEqualToLast)) { + return lastResult; + } + + lastResult = resultFn.apply(this, newArgs); + calledOnce = true; + lastThis = this; + lastArgs = newArgs; + return lastResult; + }; + + return result; +} + +/* harmony default export */ __webpack_exports__["default"] = (index); + + +/***/ }), + +/***/ "../node_modules/property-expr/index.js": +/*!**********************************************!*\ + !*** ../node_modules/property-expr/index.js ***! + \**********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Based on Kendo UI Core expression code + */ + + +function Cache(maxSize) { + this._maxSize = maxSize + this.clear() +} +Cache.prototype.clear = function() { + this._size = 0 + this._values = {} +} +Cache.prototype.get = function(key) { + return this._values[key] +} +Cache.prototype.set = function(key, value) { + this._size >= this._maxSize && this.clear() + if (!this._values.hasOwnProperty(key)) { + this._size++ + } + return this._values[key] = value +} + +var SPLIT_REGEX = /[^.^\]^[]+|(?=\[\]|\.\.)/g, + DIGIT_REGEX = /^\d+$/, + LEAD_DIGIT_REGEX = /^\d/, + SPEC_CHAR_REGEX = /[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g, + CLEAN_QUOTES_REGEX = /^\s*(['"]?)(.*?)(\1)\s*$/, + MAX_CACHE_SIZE = 512 + +var contentSecurityPolicy = false, + pathCache = new Cache(MAX_CACHE_SIZE), + setCache = new Cache(MAX_CACHE_SIZE), + getCache = new Cache(MAX_CACHE_SIZE) + +try { + new Function('') +} catch (error) { + contentSecurityPolicy = true +} + +module.exports = { + Cache: Cache, + + expr: expr, + + split: split, + + normalizePath: normalizePath, + + setter: contentSecurityPolicy + ? function(path) { + var parts = normalizePath(path) + return function(data, value) { + return setterFallback(parts, data, value) + } + } + : function(path) { + return setCache.get(path) || setCache.set( + path, + new Function( + 'data, value', + expr(path, 'data') + ' = value' + ) + ) + }, + + getter: contentSecurityPolicy + ? function(path, safe) { + var parts = normalizePath(path) + return function(data) { + return getterFallback(parts, safe, data) + } + } + : function(path, safe) { + var key = path + '_' + safe + return getCache.get(key) || getCache.set( + key, + new Function('data', 'return ' + expr(path, safe, 'data')) + ) + }, + + join: function(segments) { + return segments.reduce(function(path, part) { + return ( + path + + (isQuoted(part) || DIGIT_REGEX.test(part) + ? '[' + part + ']' + : (path ? '.' : '') + part) + ) + }, '') + }, + + forEach: function(path, cb, thisArg) { + forEach(split(path), cb, thisArg) + } +} + +function setterFallback(parts, data, value) { + var index = 0, + len = parts.length + while (index < len - 1) { + data = data[parts[index++]] + } + data[parts[index]] = value +} + +function getterFallback(parts, safe, data) { + var index = 0, + len = parts.length + while (index < len) { + if (data != null || !safe) { + data = data[parts[index++]] + } else { + return + } + } + return data +} + +function normalizePath(path) { + return pathCache.get(path) || pathCache.set( + path, + split(path).map(function(part) { + return part.replace(CLEAN_QUOTES_REGEX, '$2') + }) + ) +} + +function split(path) { + return path.match(SPLIT_REGEX) +} + +function expr(expression, safe, param) { + expression = expression || '' + + if (typeof safe === 'string') { + param = safe + safe = false + } + + param = param || 'data' + + if (expression && expression.charAt(0) !== '[') expression = '.' + expression + + return safe ? makeSafe(expression, param) : param + expression +} + +function forEach(parts, iter, thisArg) { + var len = parts.length, + part, + idx, + isArray, + isBracket + + for (idx = 0; idx < len; idx++) { + part = parts[idx] + + if (part) { + if (shouldBeQuoted(part)) { + part = '"' + part + '"' + } + + isBracket = isQuoted(part) + isArray = !isBracket && /^\d+$/.test(part) + + iter.call(thisArg, part, isBracket, isArray, idx, parts) + } + } +} + +function isQuoted(str) { + return ( + typeof str === 'string' && str && ["'", '"'].indexOf(str.charAt(0)) !== -1 + ) +} + +function makeSafe(path, param) { + var result = param, + parts = split(path), + isLast + + forEach(parts, function(part, isBracket, isArray, idx, parts) { + isLast = idx === parts.length - 1 + + part = isBracket || isArray ? '[' + part + ']' : '.' + part + + result += part + (!isLast ? ' || {})' : ')') + }) + + return new Array(parts.length + 1).join('(') + result +} + +function hasLeadingNumber(part) { + return part.match(LEAD_DIGIT_REGEX) && !part.match(DIGIT_REGEX) +} + +function hasSpecialChars(part) { + return SPEC_CHAR_REGEX.test(part) +} + +function shouldBeQuoted(part) { + return !isQuoted(part) && (hasLeadingNumber(part) || hasSpecialChars(part)) +} + + +/***/ }), + +/***/ "../node_modules/react-context-toolbox/lib/forwardRef.js": +/*!***************************************************************!*\ + !*** ../node_modules/react-context-toolbox/lib/forwardRef.js ***! + \***************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.__esModule = true; +exports.default = forwardRef; + +var _react = _interopRequireDefault(__webpack_require__(/*! react */ "react")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function forwardRef(renderFn, _ref) { + var displayName = _ref.displayName, + propTypes = _ref.propTypes, + defaultProps = _ref.defaultProps, + _ref$allowFallback = _ref.allowFallback, + allowFallback = _ref$allowFallback === void 0 ? false : _ref$allowFallback; + + var render = function render(props, ref) { + return renderFn(props, ref); + }; + + Object.assign(render, { + displayName: displayName + }); + if (_react.default.forwardRef || !allowFallback) return Object.assign(_react.default.forwardRef(render), { + propTypes: propTypes, + defaultProps: defaultProps + }); + return Object.assign(function (props) { + return render(props, null); + }, { + displayName: displayName, + propTypes: propTypes, + defaultProps: defaultProps + }); +} + +/***/ }), + +/***/ "../node_modules/react-context-toolbox/lib/mapContextToProps.js": +/*!**********************************************************************!*\ + !*** ../node_modules/react-context-toolbox/lib/mapContextToProps.js ***! + \**********************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.__esModule = true; +exports.default = mapContextToProps; + +var _react = _interopRequireDefault(__webpack_require__(/*! react */ "react")); + +var _forwardRef = _interopRequireDefault(__webpack_require__(/*! ./forwardRef */ "../node_modules/react-context-toolbox/lib/forwardRef.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _extends() { _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; }; return _extends.apply(this, arguments); } + +var getDisplayName = function getDisplayName(Component) { + var name = typeof Component === 'string' ? Component : Component.name || Component.displayName; + return name ? "ContextTransform(" + name + ")" : 'ContextTransform'; +}; + +function $mapContextToProps(_ref, Component) { + var maybeArrayOfConsumers = _ref.consumers, + mapToProps = _ref.mapToProps, + displayName = _ref.displayName, + _ref$forwardRefAs = _ref.forwardRefAs, + forwardRefAs = _ref$forwardRefAs === void 0 ? 'ref' : _ref$forwardRefAs; + var consumers = maybeArrayOfConsumers; + + if (!Array.isArray(maybeArrayOfConsumers)) { + consumers = [maybeArrayOfConsumers]; + } + + var SingleConsumer = consumers[0]; + + function singleRender(props, ref) { + var _extends2; + + var propsWithRef = _extends((_extends2 = {}, _extends2[forwardRefAs] = ref, _extends2), props); + + return _react.default.createElement(SingleConsumer, null, function (value) { + return _react.default.createElement(Component, _extends({}, propsWithRef, mapToProps(value, props))); + }); + } + + function multiRender(props, ref) { + var _extends3; + + var propsWithRef = _extends((_extends3 = {}, _extends3[forwardRefAs] = ref, _extends3), props); + + return consumers.reduceRight(function (inner, Consumer) { + return function () { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _react.default.createElement(Consumer, null, function (value) { + return inner.apply(void 0, args.concat([value])); + }); + }; + }, function () { + for (var _len2 = arguments.length, contexts = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + contexts[_key2] = arguments[_key2]; + } + + return _react.default.createElement(Component, _extends({}, propsWithRef, mapToProps.apply(void 0, contexts.concat([props])))); + })(); + } + + var contextTransform = consumers.length === 1 ? singleRender : multiRender; + return (0, _forwardRef.default)(contextTransform, { + displayName: displayName || getDisplayName(Component) + }); +} + +function mapContextToProps(maybeOpts, mapToProps, Component) { + if (arguments.length === 2) return $mapContextToProps(maybeOpts, mapToProps); + return $mapContextToProps({ + consumers: maybeOpts, + mapToProps: mapToProps + }, Component); +} + +/***/ }), + +/***/ "../node_modules/synchronous-promise/index.js": +/*!****************************************************!*\ + !*** ../node_modules/synchronous-promise/index.js ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* jshint node: true */ + +function makeArrayFrom(obj) { + return Array.prototype.slice.apply(obj); +} +var + PENDING = "pending", + RESOLVED = "resolved", + REJECTED = "rejected"; + +function SynchronousPromise(handler) { + this.status = PENDING; + this._continuations = []; + this._parent = null; + this._paused = false; + if (handler) { + handler.call( + this, + this._continueWith.bind(this), + this._failWith.bind(this) + ); + } +} + +function looksLikeAPromise(obj) { + return obj && typeof (obj.then) === "function"; +} + +SynchronousPromise.prototype = { + then: function (nextFn, catchFn) { + var next = SynchronousPromise.unresolved()._setParent(this); + if (this._isRejected()) { + if (this._paused) { + this._continuations.push({ + promise: next, + nextFn: nextFn, + catchFn: catchFn + }); + return next; + } + if (catchFn) { + try { + var catchResult = catchFn(this._error); + if (looksLikeAPromise(catchResult)) { + this._chainPromiseData(catchResult, next); + return next; + } else { + return SynchronousPromise.resolve(catchResult)._setParent(this); + } + } catch (e) { + return SynchronousPromise.reject(e)._setParent(this); + } + } + return SynchronousPromise.reject(this._error)._setParent(this); + } + this._continuations.push({ + promise: next, + nextFn: nextFn, + catchFn: catchFn + }); + this._runResolutions(); + return next; + }, + catch: function (handler) { + if (this._isResolved()) { + return SynchronousPromise.resolve(this._data)._setParent(this); + } + var next = SynchronousPromise.unresolved()._setParent(this); + this._continuations.push({ + promise: next, + catchFn: handler + }); + this._runRejections(); + return next; + }, + pause: function () { + this._paused = true; + return this; + }, + resume: function () { + var firstPaused = this._findFirstPaused(); + if (firstPaused) { + firstPaused._paused = false; + firstPaused._runResolutions(); + firstPaused._runRejections(); + } + return this; + }, + _findAncestry: function () { + return this._continuations.reduce(function (acc, cur) { + if (cur.promise) { + var node = { + promise: cur.promise, + children: cur.promise._findAncestry() + }; + acc.push(node); + } + return acc; + }, []); + }, + _setParent: function (parent) { + if (this._parent) { + throw new Error("parent already set"); + } + this._parent = parent; + return this; + }, + _continueWith: function (data) { + var firstPending = this._findFirstPending(); + if (firstPending) { + firstPending._data = data; + firstPending._setResolved(); + } + }, + _findFirstPending: function () { + return this._findFirstAncestor(function (test) { + return test._isPending && test._isPending(); + }); + }, + _findFirstPaused: function () { + return this._findFirstAncestor(function (test) { + return test._paused; + }); + }, + _findFirstAncestor: function (matching) { + var test = this; + var result; + while (test) { + if (matching(test)) { + result = test; + } + test = test._parent; + } + return result; + }, + _failWith: function (error) { + var firstRejected = this._findFirstPending(); + if (firstRejected) { + firstRejected._error = error; + firstRejected._setRejected(); + } + }, + _takeContinuations: function () { + return this._continuations.splice(0, this._continuations.length); + }, + _runRejections: function () { + if (this._paused || !this._isRejected()) { + return; + } + var + error = this._error, + continuations = this._takeContinuations(), + self = this; + continuations.forEach(function (cont) { + if (cont.catchFn) { + try { + var catchResult = cont.catchFn(error); + self._handleUserFunctionResult(catchResult, cont.promise); + } catch (e) { + var message = e.message; + cont.promise.reject(e); + } + } else { + cont.promise.reject(error); + } + }); + }, + _runResolutions: function () { + if (this._paused || !this._isResolved()) { + return; + } + var continuations = this._takeContinuations(); + if (looksLikeAPromise(this._data)) { + return this._handleWhenResolvedDataIsPromise(this._data); + } + var data = this._data; + var self = this; + continuations.forEach(function (cont) { + if (cont.nextFn) { + try { + var result = cont.nextFn(data); + self._handleUserFunctionResult(result, cont.promise); + } catch (e) { + self._handleResolutionError(e, cont); + } + } else if (cont.promise) { + cont.promise.resolve(data); + } + }); + }, + _handleResolutionError: function (e, continuation) { + this._setRejected(); + if (continuation.catchFn) { + try { + continuation.catchFn(e); + return; + } catch (e2) { + e = e2; + } + } + if (continuation.promise) { + continuation.promise.reject(e); + } + }, + _handleWhenResolvedDataIsPromise: function (data) { + var self = this; + return data.then(function (result) { + self._data = result; + self._runResolutions(); + }).catch(function (error) { + self._error = error; + self._setRejected(); + self._runRejections(); + }); + }, + _handleUserFunctionResult: function (data, nextSynchronousPromise) { + if (looksLikeAPromise(data)) { + this._chainPromiseData(data, nextSynchronousPromise); + } else { + nextSynchronousPromise.resolve(data); + } + }, + _chainPromiseData: function (promiseData, nextSynchronousPromise) { + promiseData.then(function (newData) { + nextSynchronousPromise.resolve(newData); + }).catch(function (newError) { + nextSynchronousPromise.reject(newError); + }); + }, + _setResolved: function () { + this.status = RESOLVED; + if (!this._paused) { + this._runResolutions(); + } + }, + _setRejected: function () { + this.status = REJECTED; + if (!this._paused) { + this._runRejections(); + } + }, + _isPending: function () { + return this.status === PENDING; + }, + _isResolved: function () { + return this.status === RESOLVED; + }, + _isRejected: function () { + return this.status === REJECTED; + } +}; + +SynchronousPromise.resolve = function (result) { + return new SynchronousPromise(function (resolve, reject) { + if (looksLikeAPromise(result)) { + result.then(function (newResult) { + resolve(newResult); + }).catch(function (error) { + reject(error); + }); + } else { + resolve(result); + } + }); +}; + +SynchronousPromise.reject = function (result) { + return new SynchronousPromise(function (resolve, reject) { + reject(result); + }); +}; + +SynchronousPromise.unresolved = function () { + return new SynchronousPromise(function (resolve, reject) { + this.resolve = resolve; + this.reject = reject; + }); +}; + +SynchronousPromise.all = function () { + var args = makeArrayFrom(arguments); + if (Array.isArray(args[0])) { + args = args[0]; + } + if (!args.length) { + return SynchronousPromise.resolve([]); + } + return new SynchronousPromise(function (resolve, reject) { + var + allData = [], + numResolved = 0, + doResolve = function () { + if (numResolved === args.length) { + resolve(allData); + } + }, + rejected = false, + doReject = function (err) { + if (rejected) { + return; + } + rejected = true; + reject(err); + }; + args.forEach(function (arg, idx) { + SynchronousPromise.resolve(arg).then(function (thisResult) { + allData[idx] = thisResult; + numResolved += 1; + doResolve(); + }).catch(function (err) { + doReject(err); + }); + }); + }); +}; + +/* jshint ignore:start */ +if (Promise === SynchronousPromise) { + throw new Error("Please use SynchronousPromise.installGlobally() to install globally"); +} +var RealPromise = Promise; +SynchronousPromise.installGlobally = function(__awaiter) { + if (Promise === SynchronousPromise) { + return __awaiter; + } + var result = patchAwaiterIfRequired(__awaiter); + Promise = SynchronousPromise; + return result; +}; + +SynchronousPromise.uninstallGlobally = function() { + if (Promise === SynchronousPromise) { + Promise = RealPromise; + } +}; + +function patchAwaiterIfRequired(__awaiter) { + if (typeof(__awaiter) === "undefined" || __awaiter.__patched) { + return __awaiter; + } + var originalAwaiter = __awaiter; + __awaiter = function() { + var Promise = RealPromise; + originalAwaiter.apply(this, makeArrayFrom(arguments)); + }; + __awaiter.__patched = true; + return __awaiter; +} +/* jshint ignore:end */ + +module.exports = { + SynchronousPromise: SynchronousPromise +}; + +/***/ }), + +/***/ "../node_modules/topeka/Binding.js": +/*!*****************************************!*\ + !*** ../node_modules/topeka/Binding.js ***! + \*****************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); + +exports.__esModule = true; +exports.default = void 0; + +var _inheritsLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inheritsLoose */ "./node_modules/@babel/runtime/helpers/inheritsLoose.js")); + +var _react = _interopRequireDefault(__webpack_require__(/*! react */ "react")); + +var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js")); + +var _reactLifecyclesCompat = __webpack_require__(/*! react-lifecycles-compat */ "./.cache/react-lifecycles-compat.js"); + +var _BindingContext = __webpack_require__(/*! ./BindingContext */ "../node_modules/topeka/BindingContext.js"); + +var _createChildBridge = _interopRequireDefault(__webpack_require__(/*! ./createChildBridge */ "../node_modules/topeka/createChildBridge.js")); + +var _StaticContainer = _interopRequireDefault(__webpack_require__(/*! ./StaticContainer */ "../node_modules/topeka/StaticContainer.js")); + +function extractTargetValue(arg) { + if (arg && arg.target && arg.target.tagName) { + return arg.target.value; + } + + return arg; +} +/** + * Hello + */ + + +var Binding = +/*#__PURE__*/ +function (_React$PureComponent) { + (0, _inheritsLoose2.default)(Binding, _React$PureComponent); + + Binding.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, prevState) { + var propsChanged = prevState && nextProps !== prevState.__lastProps; + return { + propsChanged: propsChanged, + __lastProps: nextProps + }; + }; + + function Binding(props, context) { + var _this; + + _this = _React$PureComponent.call(this, props, context) || this; + + _this.handleEvent = function (event) { + var _this$props = _this.props, + bindTo = _this$props.bindTo, + _this$props$mapValue = _this$props.mapValue, + mapValue = _this$props$mapValue === void 0 ? extractTargetValue : _this$props$mapValue; + + if (typeof bindTo === 'string') { + var _mapValue; + + if (typeof mapValue !== 'object') mapValue = (_mapValue = {}, _mapValue[bindTo] = mapValue, _mapValue); + } + + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + if (_this.updateBindingValue && mapValue) _this.updateBindingValue(mapValue, args); + }; + + _this.state = {}; + _this.getBridgeProps = (0, _createChildBridge.default)(_this.handleEvent); + return _this; + } + + var _proto = Binding.prototype; + + _proto.render = function render() { + var _this2 = this; + + return _react.default.createElement(_BindingContext.Consumer, null, function (context) { + _this2.updateBindingValue = context && context.updateBindingValue; + var _this2$props = _this2.props, + changeProp = _this2$props.changeProp, + valueProp = _this2$props.valueProp, + children = _this2$props.children, + bindTo = _this2$props.bindTo; + + var childProps = _this2.getBridgeProps(changeProp); + + var valueChanged = true; + + if (context) { + var lastValue = _this2._value; + childProps[valueProp] = _this2._value = context.getValue(bindTo); + valueChanged = lastValue !== _this2._value; + } + + var propsChanged = _this2.state.propsChanged; + return _react.default.createElement(_StaticContainer.default, { + props: childProps, + shouldUpdate: propsChanged || valueChanged + }, children); + }); + }; + + return Binding; +}(_react.default.PureComponent); + +Binding.propTypes = { + /** + * A callback prop name that the Binding should listen for changes on. + * + * ```js + * + * {props => } + * + * ``` + */ + changeProp: _propTypes.default.string.isRequired, + + /** + * A prop name for the Binding to set from the BindingContext. + * + * ```js + * + * {props => } + * + * ``` + */ + valueProp: _propTypes.default.string.isRequired, + + /** + * An field name or accessor function, extracting the Binding value + * from the overall BindingContext value. If a function, it's called + * with the form value, and the current Form `getter`. + * + * ```js + * + * + * + * + * { + * let [first, last] = getter(model, 'details.name').split(' ') + * return { first, last } + * }} + * > + * {props => } + * + * ``` + */ + bindTo: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.func]).isRequired, + + /** + * Customize how the Binding return value maps to the overall BindingContext `value`. + * `mapValue` can be a a string property name or a function that returns a + * value to be set to the `bindTo` field. + * + * **note:** the default value will attempt to extract the value from `target.value` + * so that native inputs will just work as expected. + * + * ```js + * + * dropdownValue.first + ' ' + dropdownValue.last + * } + * > + * {props => } + * + * ``` + * + * You can also provide an object hash, mapping paths of the BindingContext `value` + * to fields in the Binding value using a string field name, or a function accessor. + * + * ```js + * { + * let [first, last] = model.name.split(' ') + * return { first, last } + * }} + * mapValue={{ + * name: dropdownValue => + * dropdownValue.first + ' ' + dropdownValue.last + * }} + * > + * {props => } + * + * ``` + * + * @type func | string | object + */ + mapValue: function mapValue(props, propName, componentName) { + if (typeof props.bindTo === 'function' && typeof props[propName] === 'function') return new Error(propName + " must be an Object or a string, when `bindTo` is a function"); + + for (var _len2 = arguments.length, args = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) { + args[_key2 - 3] = arguments[_key2]; + } + + return _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string, _propTypes.default.func]).apply(void 0, [props, propName, componentName].concat(args)); + }, + + /** + * A render function that returns a react element and is + * passed the binding callbacks and value. + * + * ```js + * let Surround = (props) =>
    {props.children}
    + * + * + * {(props)=> + * + * + * + * } + * + * ``` + */ + children: _propTypes.default.func.isRequired +}; +Binding.defaultProps = { + changeProp: 'onChange', + valueProp: 'value' +}; + +var _default = (0, _reactLifecyclesCompat.polyfill)(Binding); + +exports.default = _default; +module.exports = exports["default"]; + +/***/ }), + +/***/ "../node_modules/topeka/BindingContext.js": +/*!************************************************!*\ + !*** ../node_modules/topeka/BindingContext.js ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); + +exports.__esModule = true; +exports.default = exports.Consumer = exports.Provider = void 0; + +var _inheritsLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inheritsLoose */ "./node_modules/@babel/runtime/helpers/inheritsLoose.js")); + +var _react = _interopRequireDefault(__webpack_require__(/*! react */ "react")); + +var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js")); + +var _uncontrollable = _interopRequireDefault(__webpack_require__(/*! uncontrollable */ "./node_modules/uncontrollable/index.js")); + +var _invariant = _interopRequireDefault(__webpack_require__(/*! invariant */ "./node_modules/invariant/invariant.js")); + +var _propertyExpr = _interopRequireDefault(__webpack_require__(/*! property-expr */ "../node_modules/property-expr/index.js")); + +var _reactLifecyclesCompat = __webpack_require__(/*! react-lifecycles-compat */ "./.cache/react-lifecycles-compat.js"); + +var _updateIn = _interopRequireDefault(__webpack_require__(/*! ./updateIn */ "../node_modules/topeka/updateIn.js")); + +var defaultSetter = function defaultSetter(path, model, val) { + return (0, _updateIn.default)(model, path, val); +}; + +function wrapSetter(setter) { + return function () { + var result = setter.apply(void 0, arguments); + !(result && typeof result === 'object') ? false ? undefined : invariant(false) : void 0; + return result; + }; +} + +var _React$createContext = _react.default.createContext({ + getValue: function getValue() {}, + updateBindingValue: function updateBindingValue() {} +}), + Provider = _React$createContext.Provider, + Consumer = _React$createContext.Consumer; + +exports.Consumer = Consumer; +exports.Provider = Provider; + +var BindingContext = +/*#__PURE__*/ +function (_React$Component) { + (0, _inheritsLoose2.default)(BindingContext, _React$Component); + + BindingContext.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) { + var value = _ref.value, + getter = _ref.getter; + + if (value === prevState.value && getter === prevState.getter) { + return null; + } + + return { + value: value, + getter: getter, + bindingContext: { + updateBindingValue: prevState.bindingContext.updateBindingValue, + getValue: function getValue(pathOrAccessor) { + return typeof pathOrAccessor === 'function' ? pathOrAccessor(value, getter) : getter(pathOrAccessor, value); + } + } + }; + }; + + function BindingContext() { + var _this; + + for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) { + _args[_key] = arguments[_key]; + } + + _this = _React$Component.call.apply(_React$Component, [this].concat(_args)) || this; + + _this.updateBindingValue = function (mapValue, args) { + var _this$props = _this.props, + model = _this$props.value, + updater = _this$props.setter, + onChange = _this$props.onChange; + var paths = []; + if (false) {} + Object.keys(mapValue).forEach(function (key) { + var field = mapValue[key], + value; + if (typeof field === 'function') value = field.apply(void 0, args);else if (field === '.' || field == null || args[0] == null) value = args[0];else { + value = _propertyExpr.default.getter(field, true)(args[0]); + } + if (paths.indexOf(key) === -1) paths.push(key); + model = updater(key, model, value, defaultSetter); + }); + onChange(model, paths); + }; + + _this.state = { + bindingContext: { + updateBindingValue: _this.updateBindingValue + } + }; + return _this; + } + + var _proto = BindingContext.prototype; + + _proto.render = function render() { + return _react.default.createElement(Provider, { + value: this.state.bindingContext + }, this.props.children); + }; + + return BindingContext; +}(_react.default.Component); + +BindingContext.propTypes = { + /** + * BindingContext value object, can be left uncontrolled; + * use the `defaultValue` prop to initialize an uncontrolled BindingContext. + * + * BindingContext assumes that `value` is immutable so you must provide a _new_ value + * object to trigger an update. The `` components do this by default. + */ + value: _propTypes.default.object, + + /** + * Callback that is called when the `value` prop changes. + * + * ```js + * function( + * value: object, + * updatedPaths: array + * ) + * ``` + */ + onChange: _propTypes.default.func, + + /** + * A function used to extract value paths from the Context value. + * `getter` is called with `path` and `value` and should return the value at that path. + * `getter()` is used when a `` provides a string `accessor`. + * + * ```js + * function( + * path: string, + * value: any, + * ) -> object + * ``` + */ + getter: _propTypes.default.func, + + /** + * A value setter function. `setter` is called with `path`, the context `value` and the path `value`. + * The `setter` must return updated form `value`, which allows you to leave the original value unmutated. + * + * ```js + * function( + * path: string, + * formValue: object, + * pathValue: any + * ) -> object + * ``` + */ + setter: _propTypes.default.func +}; +BindingContext.defaultProps = { + getter: function getter(path, model) { + return path ? _propertyExpr.default.getter(path, true)(model || {}) : model; + }, + setter: defaultSetter +}; + +var _default = (0, _uncontrollable.default)((0, _reactLifecyclesCompat.polyfill)(BindingContext), { + value: 'onChange' +}); + +exports.default = _default; + +/***/ }), + +/***/ "../node_modules/topeka/StaticContainer.js": +/*!*************************************************!*\ + !*** ../node_modules/topeka/StaticContainer.js ***! + \*************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); + +exports.__esModule = true; +exports.default = void 0; + +var _inheritsLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inheritsLoose */ "./node_modules/@babel/runtime/helpers/inheritsLoose.js")); + +var _react = _interopRequireDefault(__webpack_require__(/*! react */ "react")); + +var StaticContainer = +/*#__PURE__*/ +function (_React$Component) { + (0, _inheritsLoose2.default)(StaticContainer, _React$Component); + + function StaticContainer() { + return _React$Component.apply(this, arguments) || this; + } + + var _proto = StaticContainer.prototype; + + _proto.shouldComponentUpdate = function shouldComponentUpdate(props) { + return !!props.shouldUpdate; // eslint-disable-line + }; + + _proto.render = function render() { + return this.props.children(this.props.props); // eslint-disable-line + }; + + return StaticContainer; +}(_react.default.Component); + +exports.default = StaticContainer; +module.exports = exports["default"]; + +/***/ }), + +/***/ "../node_modules/topeka/createChildBridge.js": +/*!***************************************************!*\ + !*** ../node_modules/topeka/createChildBridge.js ***! + \***************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.__esModule = true; +exports.default = createChildBridge; + +function createChildBridge(handleEvent, deprecatedRender) { + var eventMap = {}; + + var getEvents = function getEvents(events) { + var result = {}; + + if (events) { + ; + [].concat(events).forEach(function (event) { + eventMap[event] = result[event] = eventMap[event] || function () { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + handleEvent.apply(void 0, [event].concat(args)); + }; + }); + } + + return result; + }; + + return deprecatedRender ? function (event) { + return deprecatedRender(getEvents(event)); + } : getEvents; +} + +module.exports = exports["default"]; + +/***/ }), + +/***/ "../node_modules/topeka/index.js": +/*!***************************************!*\ + !*** ../node_modules/topeka/index.js ***! + \***************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); + +exports.__esModule = true; + +var _BindingContext = _interopRequireDefault(__webpack_require__(/*! ./BindingContext */ "../node_modules/topeka/BindingContext.js")); + +exports.BindingContext = _BindingContext.default; + +var _Binding = _interopRequireDefault(__webpack_require__(/*! ./Binding */ "../node_modules/topeka/Binding.js")); + +exports.Binding = _Binding.default; + +var _updateIn = _interopRequireDefault(__webpack_require__(/*! ./updateIn */ "../node_modules/topeka/updateIn.js")); + +exports.updateIn = _updateIn.default; + +/***/ }), + +/***/ "../node_modules/topeka/updateIn.js": +/*!******************************************!*\ + !*** ../node_modules/topeka/updateIn.js ***! + \******************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); + +exports.__esModule = true; +exports.default = update; + +var _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ "./node_modules/@babel/runtime/helpers/extends.js")); + +var _propertyExpr = _interopRequireDefault(__webpack_require__(/*! property-expr */ "../node_modules/property-expr/index.js")); + +var IS_ARRAY = /^\d+$/; + +function update(model, path, value) { + var parts = _propertyExpr.default.split(path), + newModel = copy(model), + part, + islast; + + if (newModel == null) newModel = IS_ARRAY.test(parts[0]) ? [] : {}; + var current = newModel; + + for (var idx = 0; idx < parts.length; idx++) { + islast = idx === parts.length - 1; + part = clean(parts[idx]); + if (islast) current[part] = value;else { + current = current[part] = current[part] == null ? IS_ARRAY.test(parts[idx + 1]) ? [] : {} : copy(current[part]); + } + } + + return newModel; +} + +function clean(part) { + return isQuoted(part) ? part.substr(1, part.length - 2) : part; +} + +function isQuoted(str) { + return typeof str === 'string' && str && (str[0] === '"' || str[0] === "'"); +} + +function copy(value) { + return Array.isArray(value) ? value.concat() : value !== null && typeof value === 'object' ? (0, _extends2.default)(new value.constructor(), value) : value; +} + +module.exports = exports["default"]; + +/***/ }), + +/***/ "../node_modules/toposort/index.js": +/*!*****************************************!*\ + !*** ../node_modules/toposort/index.js ***! + \*****************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + + +/** + * Topological sorting function + * + * @param {Array} edges + * @returns {Array} + */ + +module.exports = function(edges) { + return toposort(uniqueNodes(edges), edges) +} + +module.exports.array = toposort + +function toposort(nodes, edges) { + var cursor = nodes.length + , sorted = new Array(cursor) + , visited = {} + , i = cursor + // Better data structures make algorithm much faster. + , outgoingEdges = makeOutgoingEdges(edges) + , nodesHash = makeNodesHash(nodes) + + // check for unknown nodes + edges.forEach(function(edge) { + if (!nodesHash.has(edge[0]) || !nodesHash.has(edge[1])) { + throw new Error('Unknown node. There is an unknown node in the supplied edges.') + } + }) + + while (i--) { + if (!visited[i]) visit(nodes[i], i, new Set()) + } + + return sorted + + function visit(node, i, predecessors) { + if(predecessors.has(node)) { + var nodeRep + try { + nodeRep = ", node was:" + JSON.stringify(node) + } catch(e) { + nodeRep = "" + } + throw new Error('Cyclic dependency' + nodeRep) + } + + if (!nodesHash.has(node)) { + throw new Error('Found unknown node. Make sure to provided all involved nodes. Unknown node: '+JSON.stringify(node)) + } + + if (visited[i]) return; + visited[i] = true + + var outgoing = outgoingEdges.get(node) || new Set() + outgoing = Array.from(outgoing) + + if (i = outgoing.length) { + predecessors.add(node) + do { + var child = outgoing[--i] + visit(child, nodesHash.get(child), predecessors) + } while (i) + predecessors.delete(node) + } + + sorted[--cursor] = node + } +} + +function uniqueNodes(arr){ + var res = new Set() + for (var i = 0, len = arr.length; i < len; i++) { + var edge = arr[i] + res.add(edge[0]) + res.add(edge[1]) + } + return Array.from(res) +} + +function makeOutgoingEdges(arr){ + var edges = new Map() + for (var i = 0, len = arr.length; i < len; i++) { + var edge = arr[i] + if (!edges.has(edge[0])) edges.set(edge[0], new Set()) + if (!edges.has(edge[1])) edges.set(edge[1], new Set()) + edges.get(edge[0]).add(edge[1]) + } + return edges +} + +function makeNodesHash(arr){ + var res = new Map() + for (var i = 0, len = arr.length; i < len; i++) { + res.set(arr[i], i) + } + return res +} + + +/***/ }), + +/***/ "../node_modules/yup/lib/Condition.js": +/*!********************************************!*\ + !*** ../node_modules/yup/lib/Condition.js ***! + \********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); + +exports.__esModule = true; +exports.default = void 0; + +var _has = _interopRequireDefault(__webpack_require__(/*! lodash/has */ "lodash/has")); + +var _isSchema = _interopRequireDefault(__webpack_require__(/*! ./util/isSchema */ "../node_modules/yup/lib/util/isSchema.js")); + +function callOrConcat(schema) { + if (typeof schema === 'function') return schema; + return function (base) { + return base.concat(schema); + }; +} + +var Conditional = +/*#__PURE__*/ +function () { + function Conditional(refs, options) { + var is = options.is, + then = options.then, + otherwise = options.otherwise; + this.refs = [].concat(refs); + then = callOrConcat(then); + otherwise = callOrConcat(otherwise); + if (typeof options === 'function') this.fn = options;else { + if (!(0, _has.default)(options, 'is')) throw new TypeError('`is:` is required for `when()` conditions'); + if (!options.then && !options.otherwise) throw new TypeError('either `then:` or `otherwise:` is required for `when()` conditions'); + var isFn = typeof is === 'function' ? is : function () { + for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) { + values[_key] = arguments[_key]; + } + + return values.every(function (value) { + return value === is; + }); + }; + + this.fn = function () { + for (var _len2 = arguments.length, values = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + values[_key2] = arguments[_key2]; + } + + var currentSchema = values.pop(); + var option = isFn.apply(void 0, values) ? then : otherwise; + return option(currentSchema); + }; + } + } + + var _proto = Conditional.prototype; + + _proto.getValue = function getValue(parent, context) { + var values = this.refs.map(function (r) { + return r.getValue(parent, context); + }); + return values; + }; + + _proto.resolve = function resolve(ctx, values) { + var schema = this.fn.apply(ctx, values.concat(ctx)); + if (schema !== undefined && !(0, _isSchema.default)(schema)) throw new TypeError('conditions must return a schema object'); + return schema || ctx; + }; + + return Conditional; +}(); + +var _default = Conditional; +exports.default = _default; +module.exports = exports["default"]; + +/***/ }), + +/***/ "../node_modules/yup/lib/Lazy.js": +/*!***************************************!*\ + !*** ../node_modules/yup/lib/Lazy.js ***! + \***************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); + +exports.__esModule = true; +exports.default = void 0; + +var _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/objectWithoutPropertiesLoose */ "./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js")); + +var _isSchema = _interopRequireDefault(__webpack_require__(/*! ./util/isSchema */ "../node_modules/yup/lib/util/isSchema.js")); + +var Lazy = +/*#__PURE__*/ +function () { + function Lazy(mapFn) { + this._resolve = function () { + var schema = mapFn.apply(void 0, arguments); + if (!(0, _isSchema.default)(schema)) throw new TypeError('lazy() functions must return a valid schema'); + return schema; + }; + } + + var _proto = Lazy.prototype; + + _proto.resolve = function resolve(_ref) { + var value = _ref.value, + rest = (0, _objectWithoutPropertiesLoose2.default)(_ref, ["value"]); + return this._resolve(value, rest); + }; + + _proto.cast = function cast(value, options) { + return this._resolve(value, options).cast(value, options); + }; + + _proto.validate = function validate(value, options) { + return this._resolve(value, options).validate(value, options); + }; + + return Lazy; +}(); + +Lazy.prototype.__isYupSchema__ = true; +var _default = Lazy; +exports.default = _default; +module.exports = exports["default"]; + +/***/ }), + +/***/ "../node_modules/yup/lib/Reference.js": +/*!********************************************!*\ + !*** ../node_modules/yup/lib/Reference.js ***! + \********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.__esModule = true; +exports.default = void 0; + +var _propertyExpr = __webpack_require__(/*! property-expr */ "../node_modules/property-expr/index.js"); + +var validateName = function validateName(d) { + if (typeof d !== 'string') throw new TypeError("ref's must be strings, got: " + d); +}; + +var Reference = +/*#__PURE__*/ +function () { + Reference.isRef = function isRef(value) { + return !!(value && (value.__isYupRef || value instanceof Reference)); + }; + + var _proto = Reference.prototype; + + _proto.toString = function toString() { + return "Ref(" + this.key + ")"; + }; + + function Reference(key, mapFn, options) { + if (options === void 0) { + options = {}; + } + + validateName(key); + var prefix = options.contextPrefix || '$'; + + if (typeof key === 'function') { + key = '.'; + } + + this.key = key.trim(); + this.prefix = prefix; + this.isContext = this.key.indexOf(prefix) === 0; + this.isSelf = this.key === '.'; + this.path = this.isContext ? this.key.slice(this.prefix.length) : this.key; + this._get = (0, _propertyExpr.getter)(this.path, true); + + this.map = mapFn || function (value) { + return value; + }; + } + + _proto.resolve = function resolve() { + return this; + }; + + _proto.cast = function cast(value, _ref) { + var parent = _ref.parent, + context = _ref.context; + return this.getValue(parent, context); + }; + + _proto.getValue = function getValue(parent, context) { + var isContext = this.isContext; + + var value = this._get(isContext ? context : parent || context || {}); + + return this.map(value); + }; + + return Reference; +}(); + +exports.default = Reference; +Reference.prototype.__isYupRef = true; +module.exports = exports["default"]; + +/***/ }), + +/***/ "../node_modules/yup/lib/ValidationError.js": +/*!**************************************************!*\ + !*** ../node_modules/yup/lib/ValidationError.js ***! + \**************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); + +exports.__esModule = true; +exports.default = ValidationError; + +var _printValue = _interopRequireDefault(__webpack_require__(/*! ./util/printValue */ "../node_modules/yup/lib/util/printValue.js")); + +var strReg = /\$\{\s*(\w+)\s*\}/g; + +var replace = function replace(str) { + return function (params) { + return str.replace(strReg, function (_, key) { + return (0, _printValue.default)(params[key]); + }); + }; +}; + +function ValidationError(errors, value, field, type) { + var _this = this; + + this.name = 'ValidationError'; + this.value = value; + this.path = field; + this.type = type; + this.errors = []; + this.inner = []; + if (errors) [].concat(errors).forEach(function (err) { + _this.errors = _this.errors.concat(err.errors || err); + if (err.inner) _this.inner = _this.inner.concat(err.inner.length ? err.inner : err); + }); + this.message = this.errors.length > 1 ? this.errors.length + " errors occurred" : this.errors[0]; + if (Error.captureStackTrace) Error.captureStackTrace(this, ValidationError); +} + +ValidationError.prototype = Object.create(Error.prototype); +ValidationError.prototype.constructor = ValidationError; + +ValidationError.isError = function (err) { + return err && err.name === 'ValidationError'; +}; + +ValidationError.formatError = function (message, params) { + if (typeof message === 'string') message = replace(message); + + var fn = function fn(params) { + params.path = params.label || params.path || 'this'; + return typeof message === 'function' ? message(params) : message; + }; + + return arguments.length === 1 ? fn : fn(params); +}; + +module.exports = exports["default"]; + +/***/ }), + +/***/ "../node_modules/yup/lib/array.js": +/*!****************************************!*\ + !*** ../node_modules/yup/lib/array.js ***! + \****************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _interopRequireWildcard = __webpack_require__(/*! @babel/runtime/helpers/interopRequireWildcard */ "./node_modules/@babel/runtime/helpers/interopRequireWildcard.js"); + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); + +exports.__esModule = true; +exports.default = void 0; + +var _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ "./node_modules/@babel/runtime/helpers/extends.js")); + +var _taggedTemplateLiteralLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/taggedTemplateLiteralLoose */ "./node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js")); + +var _inherits = _interopRequireDefault(__webpack_require__(/*! ./util/inherits */ "../node_modules/yup/lib/util/inherits.js")); + +var _isAbsent = _interopRequireDefault(__webpack_require__(/*! ./util/isAbsent */ "../node_modules/yup/lib/util/isAbsent.js")); + +var _isSchema = _interopRequireDefault(__webpack_require__(/*! ./util/isSchema */ "../node_modules/yup/lib/util/isSchema.js")); + +var _makePath = _interopRequireDefault(__webpack_require__(/*! ./util/makePath */ "../node_modules/yup/lib/util/makePath.js")); + +var _printValue = _interopRequireDefault(__webpack_require__(/*! ./util/printValue */ "../node_modules/yup/lib/util/printValue.js")); + +var _mixed = _interopRequireDefault(__webpack_require__(/*! ./mixed */ "../node_modules/yup/lib/mixed.js")); + +var _locale = __webpack_require__(/*! ./locale */ "../node_modules/yup/lib/locale.js"); + +var _runValidations = _interopRequireWildcard(__webpack_require__(/*! ./util/runValidations */ "../node_modules/yup/lib/util/runValidations.js")); + +function _templateObject() { + var data = (0, _taggedTemplateLiteralLoose2.default)(["", "[", "]"]); + + _templateObject = function _templateObject() { + return data; + }; + + return data; +} + +var hasLength = function hasLength(value) { + return !(0, _isAbsent.default)(value) && value.length > 0; +}; + +var _default = ArraySchema; +exports.default = _default; + +function ArraySchema(type) { + var _this = this; + + if (!(this instanceof ArraySchema)) return new ArraySchema(type); + + _mixed.default.call(this, { + type: 'array' + }); // `undefined` specifically means uninitialized, as opposed to + // "no subtype" + + + this._subType = undefined; + this.withMutation(function () { + _this.transform(function (values) { + if (typeof values === 'string') try { + values = JSON.parse(values); + } catch (err) { + values = null; + } + return this.isType(values) ? values : null; + }); + + if (type) _this.of(type); + }); +} + +(0, _inherits.default)(ArraySchema, _mixed.default, { + _typeCheck: function _typeCheck(v) { + return Array.isArray(v); + }, + _cast: function _cast(_value, _opts) { + var _this2 = this; + + var value = _mixed.default.prototype._cast.call(this, _value, _opts); //should ignore nulls here + + + if (!this._typeCheck(value) || !this._subType) return value; + return value.map(function (v) { + return _this2._subType.cast(v, _opts); + }); + }, + _validate: function _validate(_value, options) { + var _this3 = this; + + if (options === void 0) { + options = {}; + } + + var errors = []; + var sync = options.sync; + var path = options.path; + var subType = this._subType; + + var endEarly = this._option('abortEarly', options); + + var recursive = this._option('recursive', options); + + var originalValue = options.originalValue != null ? options.originalValue : _value; + return _mixed.default.prototype._validate.call(this, _value, options).catch((0, _runValidations.propagateErrors)(endEarly, errors)).then(function (value) { + if (!recursive || !subType || !_this3._typeCheck(value)) { + if (errors.length) throw errors[0]; + return value; + } + + originalValue = originalValue || value; + var validations = value.map(function (item, idx) { + var path = (0, _makePath.default)(_templateObject(), options.path, idx); // object._validate note for isStrict explanation + + var innerOptions = (0, _extends2.default)({}, options, { + path: path, + strict: true, + parent: value, + originalValue: originalValue[idx] + }); + if (subType.validate) return subType.validate(item, innerOptions); + return true; + }); + return (0, _runValidations.default)({ + sync: sync, + path: path, + value: value, + errors: errors, + endEarly: endEarly, + validations: validations + }); + }); + }, + of: function of(schema) { + var next = this.clone(); + if (schema !== false && !(0, _isSchema.default)(schema)) throw new TypeError('`array.of()` sub-schema must be a valid yup schema, or `false` to negate a current sub-schema. ' + 'not: ' + (0, _printValue.default)(schema)); + next._subType = schema; + return next; + }, + required: function required(message) { + if (message === void 0) { + message = _locale.mixed.required; + } + + var next = _mixed.default.prototype.required.call(this, message); + + return next.test({ + message: message, + name: 'required', + test: hasLength + }); + }, + min: function min(_min, message) { + message = message || _locale.array.min; + return this.test({ + message: message, + name: 'min', + exclusive: true, + params: { + min: _min + }, + test: function test(value) { + return (0, _isAbsent.default)(value) || value.length >= this.resolve(_min); + } + }); + }, + max: function max(_max, message) { + message = message || _locale.array.max; + return this.test({ + message: message, + name: 'max', + exclusive: true, + params: { + max: _max + }, + test: function test(value) { + return (0, _isAbsent.default)(value) || value.length <= this.resolve(_max); + } + }); + }, + ensure: function ensure() { + return this.default(function () { + return []; + }).transform(function (val) { + return val === null ? [] : [].concat(val); + }); + }, + compact: function compact(rejector) { + var reject = !rejector ? function (v) { + return !!v; + } : function (v, i, a) { + return !rejector(v, i, a); + }; + return this.transform(function (values) { + return values != null ? values.filter(reject) : values; + }); + }, + describe: function describe() { + var base = _mixed.default.prototype.describe.call(this); + + if (this._subType) base.innerType = this._subType.describe(); + return base; + } +}); +module.exports = exports["default"]; + +/***/ }), + +/***/ "../node_modules/yup/lib/boolean.js": +/*!******************************************!*\ + !*** ../node_modules/yup/lib/boolean.js ***! + \******************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); + +exports.__esModule = true; +exports.default = void 0; + +var _inherits = _interopRequireDefault(__webpack_require__(/*! ./util/inherits */ "../node_modules/yup/lib/util/inherits.js")); + +var _mixed = _interopRequireDefault(__webpack_require__(/*! ./mixed */ "../node_modules/yup/lib/mixed.js")); + +var _default = BooleanSchema; +exports.default = _default; + +function BooleanSchema() { + var _this = this; + + if (!(this instanceof BooleanSchema)) return new BooleanSchema(); + + _mixed.default.call(this, { + type: 'boolean' + }); + + this.withMutation(function () { + _this.transform(function (value) { + if (!this.isType(value)) { + if (/^(true|1)$/i.test(value)) return true; + if (/^(false|0)$/i.test(value)) return false; + } + + return value; + }); + }); +} + +(0, _inherits.default)(BooleanSchema, _mixed.default, { + _typeCheck: function _typeCheck(v) { + if (v instanceof Boolean) v = v.valueOf(); + return typeof v === 'boolean'; + } +}); +module.exports = exports["default"]; + +/***/ }), + +/***/ "../node_modules/yup/lib/date.js": +/*!***************************************!*\ + !*** ../node_modules/yup/lib/date.js ***! + \***************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); + +exports.__esModule = true; +exports.default = void 0; + +var _mixed = _interopRequireDefault(__webpack_require__(/*! ./mixed */ "../node_modules/yup/lib/mixed.js")); + +var _inherits = _interopRequireDefault(__webpack_require__(/*! ./util/inherits */ "../node_modules/yup/lib/util/inherits.js")); + +var _isodate = _interopRequireDefault(__webpack_require__(/*! ./util/isodate */ "../node_modules/yup/lib/util/isodate.js")); + +var _locale = __webpack_require__(/*! ./locale */ "../node_modules/yup/lib/locale.js"); + +var _isAbsent = _interopRequireDefault(__webpack_require__(/*! ./util/isAbsent */ "../node_modules/yup/lib/util/isAbsent.js")); + +var _Reference = _interopRequireDefault(__webpack_require__(/*! ./Reference */ "../node_modules/yup/lib/Reference.js")); + +var invalidDate = new Date(''); + +var isDate = function isDate(obj) { + return Object.prototype.toString.call(obj) === '[object Date]'; +}; + +var _default = DateSchema; +exports.default = _default; + +function DateSchema() { + var _this = this; + + if (!(this instanceof DateSchema)) return new DateSchema(); + + _mixed.default.call(this, { + type: 'date' + }); + + this.withMutation(function () { + _this.transform(function (value) { + if (this.isType(value)) return isDate(value) ? new Date(value) : value; + value = (0, _isodate.default)(value); + return value ? new Date(value) : invalidDate; + }); + }); +} + +(0, _inherits.default)(DateSchema, _mixed.default, { + _typeCheck: function _typeCheck(v) { + return isDate(v) && !isNaN(v.getTime()); + }, + min: function min(_min, message) { + if (message === void 0) { + message = _locale.date.min; + } + + var limit = _min; + + if (!_Reference.default.isRef(limit)) { + limit = this.cast(_min); + if (!this._typeCheck(limit)) throw new TypeError('`min` must be a Date or a value that can be `cast()` to a Date'); + } + + return this.test({ + message: message, + name: 'min', + exclusive: true, + params: { + min: _min + }, + test: function test(value) { + return (0, _isAbsent.default)(value) || value >= this.resolve(limit); + } + }); + }, + max: function max(_max, message) { + if (message === void 0) { + message = _locale.date.max; + } + + var limit = _max; + + if (!_Reference.default.isRef(limit)) { + limit = this.cast(_max); + if (!this._typeCheck(limit)) throw new TypeError('`max` must be a Date or a value that can be `cast()` to a Date'); + } + + return this.test({ + message: message, + name: 'max', + exclusive: true, + params: { + max: _max + }, + test: function test(value) { + return (0, _isAbsent.default)(value) || value <= this.resolve(limit); + } + }); + } +}); +module.exports = exports["default"]; + +/***/ }), + +/***/ "../node_modules/yup/lib/index.js": +/*!****************************************!*\ + !*** ../node_modules/yup/lib/index.js ***! + \****************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); + +exports.__esModule = true; +exports.addMethod = addMethod; +exports.lazy = exports.ref = exports.boolean = void 0; + +var _mixed = _interopRequireDefault(__webpack_require__(/*! ./mixed */ "../node_modules/yup/lib/mixed.js")); + +exports.mixed = _mixed.default; + +var _boolean = _interopRequireDefault(__webpack_require__(/*! ./boolean */ "../node_modules/yup/lib/boolean.js")); + +exports.bool = _boolean.default; + +var _string = _interopRequireDefault(__webpack_require__(/*! ./string */ "../node_modules/yup/lib/string.js")); + +exports.string = _string.default; + +var _number = _interopRequireDefault(__webpack_require__(/*! ./number */ "../node_modules/yup/lib/number.js")); + +exports.number = _number.default; + +var _date = _interopRequireDefault(__webpack_require__(/*! ./date */ "../node_modules/yup/lib/date.js")); + +exports.date = _date.default; + +var _object = _interopRequireDefault(__webpack_require__(/*! ./object */ "../node_modules/yup/lib/object.js")); + +exports.object = _object.default; + +var _array = _interopRequireDefault(__webpack_require__(/*! ./array */ "../node_modules/yup/lib/array.js")); + +exports.array = _array.default; + +var _Reference = _interopRequireDefault(__webpack_require__(/*! ./Reference */ "../node_modules/yup/lib/Reference.js")); + +var _Lazy = _interopRequireDefault(__webpack_require__(/*! ./Lazy */ "../node_modules/yup/lib/Lazy.js")); + +var _ValidationError = _interopRequireDefault(__webpack_require__(/*! ./ValidationError */ "../node_modules/yup/lib/ValidationError.js")); + +exports.ValidationError = _ValidationError.default; + +var _reach = _interopRequireDefault(__webpack_require__(/*! ./util/reach */ "../node_modules/yup/lib/util/reach.js")); + +exports.reach = _reach.default; + +var _isSchema = _interopRequireDefault(__webpack_require__(/*! ./util/isSchema */ "../node_modules/yup/lib/util/isSchema.js")); + +exports.isSchema = _isSchema.default; + +var _setLocale = _interopRequireDefault(__webpack_require__(/*! ./setLocale */ "../node_modules/yup/lib/setLocale.js")); + +exports.setLocale = _setLocale.default; +var boolean = _boolean.default; +exports.boolean = boolean; + +var ref = function ref(key, options) { + return new _Reference.default(key, options); +}; + +exports.ref = ref; + +var lazy = function lazy(fn) { + return new _Lazy.default(fn); +}; + +exports.lazy = lazy; + +function addMethod(schemaType, name, fn) { + if (!schemaType || !(0, _isSchema.default)(schemaType.prototype)) throw new TypeError('You must provide a yup schema constructor function'); + if (typeof name !== 'string') throw new TypeError('A Method name must be provided'); + if (typeof fn !== 'function') throw new TypeError('Method function must be provided'); + schemaType.prototype[name] = fn; +} + +/***/ }), + +/***/ "../node_modules/yup/lib/locale.js": +/*!*****************************************!*\ + !*** ../node_modules/yup/lib/locale.js ***! + \*****************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); + +exports.__esModule = true; +exports.default = exports.array = exports.object = exports.boolean = exports.date = exports.number = exports.string = exports.mixed = void 0; + +var _printValue = _interopRequireDefault(__webpack_require__(/*! ./util/printValue */ "../node_modules/yup/lib/util/printValue.js")); + +var mixed = { + default: '${path} is invalid', + required: '${path} is a required field', + oneOf: '${path} must be one of the following values: ${values}', + notOneOf: '${path} must not be one of the following values: ${values}', + notType: function notType(_ref) { + var path = _ref.path, + type = _ref.type, + value = _ref.value, + originalValue = _ref.originalValue; + var isCast = originalValue != null && originalValue !== value; + var msg = path + " must be a `" + type + "` type, " + ("but the final value was: `" + (0, _printValue.default)(value, true) + "`") + (isCast ? " (cast from the value `" + (0, _printValue.default)(originalValue, true) + "`)." : '.'); + + if (value === null) { + msg += "\n If \"null\" is intended as an empty value be sure to mark the schema as `.nullable()`"; + } + + return msg; + } +}; +exports.mixed = mixed; +var string = { + length: '${path} must be exactly ${length} characters', + min: '${path} must be at least ${min} characters', + max: '${path} must be at most ${max} characters', + matches: '${path} must match the following: "${regex}"', + email: '${path} must be a valid email', + url: '${path} must be a valid URL', + trim: '${path} must be a trimmed string', + lowercase: '${path} must be a lowercase string', + uppercase: '${path} must be a upper case string' +}; +exports.string = string; +var number = { + min: '${path} must be greater than or equal to ${min}', + max: '${path} must be less than or equal to ${max}', + lessThan: '${path} must be less than ${less}', + moreThan: '${path} must be greater than ${more}', + notEqual: '${path} must be not equal to ${notEqual}', + positive: '${path} must be a positive number', + negative: '${path} must be a negative number', + integer: '${path} must be an integer' +}; +exports.number = number; +var date = { + min: '${path} field must be later than ${min}', + max: '${path} field must be at earlier than ${max}' +}; +exports.date = date; +var boolean = {}; +exports.boolean = boolean; +var object = { + noUnknown: '${path} field cannot have keys not specified in the object shape' +}; +exports.object = object; +var array = { + min: '${path} field must have at least ${min} items', + max: '${path} field must have less than or equal to ${max} items' +}; +exports.array = array; +var _default = { + mixed: mixed, + string: string, + number: number, + date: date, + object: object, + array: array, + boolean: boolean +}; +exports.default = _default; + +/***/ }), + +/***/ "../node_modules/yup/lib/mixed.js": +/*!****************************************!*\ + !*** ../node_modules/yup/lib/mixed.js ***! + \****************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); + +exports.__esModule = true; +exports.default = SchemaType; + +var _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ "./node_modules/@babel/runtime/helpers/extends.js")); + +var _has = _interopRequireDefault(__webpack_require__(/*! lodash/has */ "lodash/has")); + +var _cloneDeepWith = _interopRequireDefault(__webpack_require__(/*! lodash/cloneDeepWith */ "lodash/cloneDeepWith")); + +var _toArray2 = _interopRequireDefault(__webpack_require__(/*! lodash/toArray */ "lodash/toArray")); + +var _locale = __webpack_require__(/*! ./locale */ "../node_modules/yup/lib/locale.js"); + +var _Condition = _interopRequireDefault(__webpack_require__(/*! ./Condition */ "../node_modules/yup/lib/Condition.js")); + +var _runValidations = _interopRequireDefault(__webpack_require__(/*! ./util/runValidations */ "../node_modules/yup/lib/util/runValidations.js")); + +var _merge = _interopRequireDefault(__webpack_require__(/*! ./util/merge */ "../node_modules/yup/lib/util/merge.js")); + +var _isSchema = _interopRequireDefault(__webpack_require__(/*! ./util/isSchema */ "../node_modules/yup/lib/util/isSchema.js")); + +var _isAbsent = _interopRequireDefault(__webpack_require__(/*! ./util/isAbsent */ "../node_modules/yup/lib/util/isAbsent.js")); + +var _createValidation = _interopRequireDefault(__webpack_require__(/*! ./util/createValidation */ "../node_modules/yup/lib/util/createValidation.js")); + +var _printValue = _interopRequireDefault(__webpack_require__(/*! ./util/printValue */ "../node_modules/yup/lib/util/printValue.js")); + +var _Reference = _interopRequireDefault(__webpack_require__(/*! ./Reference */ "../node_modules/yup/lib/Reference.js")); + +var _reach = __webpack_require__(/*! ./util/reach */ "../node_modules/yup/lib/util/reach.js"); + +var notEmpty = function notEmpty(value) { + return !(0, _isAbsent.default)(value); +}; + +var RefSet = +/*#__PURE__*/ +function () { + function RefSet() { + this.list = new Set(); + this.refs = new Map(); + } + + var _proto = RefSet.prototype; + + _proto.toArray = function toArray() { + return (0, _toArray2.default)(this.list).concat((0, _toArray2.default)(this.refs.values())); + }; + + _proto.add = function add(value) { + _Reference.default.isRef(value) ? this.refs.set(value.key, value) : this.list.add(value); + }; + + _proto.delete = function _delete(value) { + _Reference.default.isRef(value) ? this.refs.delete(value.key, value) : this.list.delete(value); + }; + + _proto.has = function has(value, resolve) { + if (this.list.has(value)) return true; + var item, + values = this.refs.values(); + + while (item = values.next(), !item.done) { + if (resolve(item.value) === value) return true; + } + + return false; + }; + + return RefSet; +}(); + +function SchemaType(options) { + var _this = this; + + if (options === void 0) { + options = {}; + } + + if (!(this instanceof SchemaType)) return new SchemaType(); + this._deps = []; + this._conditions = []; + this._options = { + abortEarly: true, + recursive: true + }; + this._exclusive = Object.create(null); + this._whitelist = new RefSet(); + this._blacklist = new RefSet(); + this.tests = []; + this.transforms = []; + this.withMutation(function () { + _this.typeError(_locale.mixed.notType); + }); + if ((0, _has.default)(options, 'default')) this._defaultDefault = options.default; + this._type = options.type || 'mixed'; +} + +var proto = SchemaType.prototype = { + __isYupSchema__: true, + constructor: SchemaType, + clone: function clone() { + var _this2 = this; + + if (this._mutate) return this; // if the nested value is a schema we can skip cloning, since + // they are already immutable + + return (0, _cloneDeepWith.default)(this, function (value) { + if ((0, _isSchema.default)(value) && value !== _this2) return value; + }); + }, + label: function label(_label) { + var next = this.clone(); + next._label = _label; + return next; + }, + meta: function meta(obj) { + if (arguments.length === 0) return this._meta; + var next = this.clone(); + next._meta = (0, _extends2.default)(next._meta || {}, obj); + return next; + }, + withMutation: function withMutation(fn) { + this._mutate = true; + var result = fn(this); + this._mutate = false; + return result; + }, + concat: function concat(schema) { + if (!schema) return this; + if (schema._type !== this._type && this._type !== 'mixed') throw new TypeError("You cannot `concat()` schema's of different types: " + this._type + " and " + schema._type); + var cloned = this.clone(); + var next = (0, _merge.default)(this.clone(), schema.clone()); // undefined isn't merged over, but is a valid value for default + + if ((0, _has.default)(schema, '_default')) next._default = schema._default; + next.tests = cloned.tests; + next._exclusive = cloned._exclusive; // manually add the new tests to ensure + // the deduping logic is consistent + + schema.tests.forEach(function (fn) { + next = next.test(fn.TEST); + }); + next._type = schema._type; + return next; + }, + isType: function isType(v) { + if (this._nullable && v === null) return true; + return !this._typeCheck || this._typeCheck(v); + }, + resolve: function resolve(_ref) { + var context = _ref.context, + parent = _ref.parent; + + if (this._conditions.length) { + return this._conditions.reduce(function (schema, match) { + return match.resolve(schema, match.getValue(parent, context)); + }, this); + } + + return this; + }, + cast: function cast(value, options) { + if (options === void 0) { + options = {}; + } + + var resolvedSchema = this.resolve(options); + + var result = resolvedSchema._cast(value, options); + + if (value !== undefined && options.assert !== false && resolvedSchema.isType(result) !== true) { + var formattedValue = (0, _printValue.default)(value); + var formattedResult = (0, _printValue.default)(result); + throw new TypeError("The value of " + (options.path || 'field') + " could not be cast to a value " + ("that satisfies the schema type: \"" + resolvedSchema._type + "\". \n\n") + ("attempted value: " + formattedValue + " \n") + (formattedResult !== formattedValue ? "result of cast: " + formattedResult : '')); + } + + return result; + }, + _cast: function _cast(rawValue) { + var _this3 = this; + + var value = rawValue === undefined ? rawValue : this.transforms.reduce(function (value, fn) { + return fn.call(_this3, value, rawValue); + }, rawValue); + + if (value === undefined && (0, _has.default)(this, '_default')) { + value = this.default(); + } + + return value; + }, + _validate: function _validate(_value, options) { + var _this4 = this; + + if (options === void 0) { + options = {}; + } + + var value = _value; + var originalValue = options.originalValue != null ? options.originalValue : _value; + + var isStrict = this._option('strict', options); + + var endEarly = this._option('abortEarly', options); + + var sync = options.sync; + var path = options.path; + var label = this._label; + + if (!isStrict) { + value = this._cast(value, (0, _extends2.default)({ + assert: false + }, options)); + } // value is cast, we can check if it meets type requirements + + + var validationParams = { + value: value, + path: path, + schema: this, + options: options, + label: label, + originalValue: originalValue, + sync: sync + }; + var initialTests = []; + if (this._typeError) initialTests.push(this._typeError(validationParams)); + if (this._whitelistError) initialTests.push(this._whitelistError(validationParams)); + if (this._blacklistError) initialTests.push(this._blacklistError(validationParams)); + return (0, _runValidations.default)({ + validations: initialTests, + endEarly: endEarly, + value: value, + path: path, + sync: sync + }).then(function (value) { + return (0, _runValidations.default)({ + path: path, + sync: sync, + value: value, + endEarly: endEarly, + validations: _this4.tests.map(function (fn) { + return fn(validationParams); + }) + }); + }); + }, + validate: function validate(value, options) { + if (options === void 0) { + options = {}; + } + + var schema = this.resolve(options); + return schema._validate(value, options); + }, + validateSync: function validateSync(value, options) { + if (options === void 0) { + options = {}; + } + + var schema = this.resolve(options); + var result, err; + + schema._validate(value, (0, _extends2.default)({}, options, { + sync: true + })).then(function (r) { + return result = r; + }).catch(function (e) { + return err = e; + }); + + if (err) throw err; + return result; + }, + isValid: function isValid(value, options) { + return this.validate(value, options).then(function () { + return true; + }).catch(function (err) { + if (err.name === 'ValidationError') return false; + throw err; + }); + }, + isValidSync: function isValidSync(value, options) { + try { + this.validateSync(value, (0, _extends2.default)({}, options)); + return true; + } catch (err) { + if (err.name === 'ValidationError') return false; + throw err; + } + }, + getDefault: function getDefault(options) { + if (options === void 0) { + options = {}; + } + + var schema = this.resolve(options); + return schema.default(); + }, + default: function _default(def) { + if (arguments.length === 0) { + var defaultValue = (0, _has.default)(this, '_default') ? this._default : this._defaultDefault; + return typeof defaultValue === 'function' ? defaultValue.call(this) : (0, _cloneDeepWith.default)(defaultValue); + } + + var next = this.clone(); + next._default = def; + return next; + }, + strict: function strict() { + var next = this.clone(); + next._options.strict = true; + return next; + }, + required: function required(message) { + if (message === void 0) { + message = _locale.mixed.required; + } + + return this.test({ + message: message, + name: 'required', + test: notEmpty + }); + }, + notRequired: function notRequired() { + var next = this.clone(); + next.tests = next.tests.filter(function (test) { + return test.TEST_NAME !== 'required'; + }); + return next; + }, + nullable: function nullable(value) { + var next = this.clone(); + next._nullable = value === false ? false : true; + return next; + }, + transform: function transform(fn) { + var next = this.clone(); + next.transforms.push(fn); + return next; + }, + + /** + * Adds a test function to the schema's queue of tests. + * tests can be exclusive or non-exclusive. + * + * - exclusive tests, will replace any existing tests of the same name. + * - non-exclusive: can be stacked + * + * If a non-exclusive test is added to a schema with an exclusive test of the same name + * the exclusive test is removed and further tests of the same name will be stacked. + * + * If an exclusive test is added to a schema with non-exclusive tests of the same name + * the previous tests are removed and further tests of the same name will replace each other. + */ + test: function test() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + var opts = args[0]; + + if (args.length > 1) { + var name = args[0], + message = args[1], + test = args[2]; + + if (test == null) { + test = message; + message = _locale.mixed.default; + } + + opts = { + name: name, + test: test, + message: message, + exclusive: false + }; + } + + if (typeof opts.test !== 'function') throw new TypeError('`test` is a required parameters'); + var next = this.clone(); + var validate = (0, _createValidation.default)(opts); + var isExclusive = opts.exclusive || opts.name && next._exclusive[opts.name] === true; + + if (opts.exclusive && !opts.name) { + throw new TypeError('Exclusive tests must provide a unique `name` identifying the test'); + } + + next._exclusive[opts.name] = !!opts.exclusive; + next.tests = next.tests.filter(function (fn) { + if (fn.TEST_NAME === opts.name) { + if (isExclusive) return false; + if (fn.TEST.test === validate.TEST.test) return false; + } + + return true; + }); + next.tests.push(validate); + return next; + }, + when: function when(keys, options) { + var next = this.clone(), + deps = [].concat(keys).map(function (key) { + return new _Reference.default(key); + }); + deps.forEach(function (dep) { + if (!dep.isContext) next._deps.push(dep.key); + }); + + next._conditions.push(new _Condition.default(deps, options)); + + return next; + }, + typeError: function typeError(message) { + var next = this.clone(); + next._typeError = (0, _createValidation.default)({ + message: message, + name: 'typeError', + test: function test(value) { + if (value !== undefined && !this.schema.isType(value)) return this.createError({ + params: { + type: this.schema._type + } + }); + return true; + } + }); + return next; + }, + oneOf: function oneOf(enums, message) { + if (message === void 0) { + message = _locale.mixed.oneOf; + } + + var next = this.clone(); + enums.forEach(function (val) { + next._whitelist.add(val); + + next._blacklist.delete(val); + }); + next._whitelistError = (0, _createValidation.default)({ + message: message, + name: 'oneOf', + test: function test(value) { + if (value === undefined) return true; + var valids = this.schema._whitelist; + return valids.has(value, this.resolve) ? true : this.createError({ + params: { + values: valids.toArray().join(', ') + } + }); + } + }); + return next; + }, + notOneOf: function notOneOf(enums, message) { + if (message === void 0) { + message = _locale.mixed.notOneOf; + } + + var next = this.clone(); + enums.forEach(function (val) { + next._blacklist.add(val); + + next._whitelist.delete(val); + }); + next._blacklistError = (0, _createValidation.default)({ + message: message, + name: 'notOneOf', + test: function test(value) { + var invalids = this.schema._blacklist; + if (invalids.has(value, this.resolve)) return this.createError({ + params: { + values: invalids.toArray().join(', ') + } + }); + return true; + } + }); + return next; + }, + strip: function strip(_strip) { + if (_strip === void 0) { + _strip = true; + } + + var next = this.clone(); + next._strip = _strip; + return next; + }, + _option: function _option(key, overrides) { + return (0, _has.default)(overrides, key) ? overrides[key] : this._options[key]; + }, + describe: function describe() { + var next = this.clone(); + return { + type: next._type, + meta: next._meta, + label: next._label, + tests: next.tests.map(function (fn) { + return fn.TEST_NAME; + }, {}).filter(function (n, idx, list) { + return list.indexOf(n) === idx; + }) + }; + } +}; +var _arr = ['validate', 'validateSync']; + +var _loop = function _loop() { + var method = _arr[_i]; + + proto[method + "At"] = function (path, value, options) { + if (options === void 0) { + options = {}; + } + + var _getIn = (0, _reach.getIn)(this, path, value, options.context), + parent = _getIn.parent, + parentPath = _getIn.parentPath, + schema = _getIn.schema; + + return schema[method](parent[parentPath], (0, _extends2.default)({}, options, { + parent: parent, + path: parentPath + })); + }; +}; + +for (var _i = 0; _i < _arr.length; _i++) { + _loop(); +} + +var _arr2 = ['equals', 'is']; + +for (var _i2 = 0; _i2 < _arr2.length; _i2++) { + var alias = _arr2[_i2]; + proto[alias] = proto.oneOf; +} + +var _arr3 = ['not', 'nope']; + +for (var _i3 = 0; _i3 < _arr3.length; _i3++) { + var _alias = _arr3[_i3]; + proto[_alias] = proto.notOneOf; +} + +module.exports = exports["default"]; + +/***/ }), + +/***/ "../node_modules/yup/lib/number.js": +/*!*****************************************!*\ + !*** ../node_modules/yup/lib/number.js ***! + \*****************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); + +exports.__esModule = true; +exports.default = NumberSchema; + +var _inherits = _interopRequireDefault(__webpack_require__(/*! ./util/inherits */ "../node_modules/yup/lib/util/inherits.js")); + +var _mixed = _interopRequireDefault(__webpack_require__(/*! ./mixed */ "../node_modules/yup/lib/mixed.js")); + +var _locale = __webpack_require__(/*! ./locale */ "../node_modules/yup/lib/locale.js"); + +var _isAbsent = _interopRequireDefault(__webpack_require__(/*! ./util/isAbsent */ "../node_modules/yup/lib/util/isAbsent.js")); + +var isNaN = function isNaN(value) { + return value != +value; +}; + +var isInteger = function isInteger(val) { + return (0, _isAbsent.default)(val) || val === (val | 0); +}; + +function NumberSchema() { + var _this = this; + + if (!(this instanceof NumberSchema)) return new NumberSchema(); + + _mixed.default.call(this, { + type: 'number' + }); + + this.withMutation(function () { + _this.transform(function (value) { + if (this.isType(value)) return value; + var parsed = parseFloat(value); + if (this.isType(parsed)) return parsed; + return NaN; + }); + }); +} + +(0, _inherits.default)(NumberSchema, _mixed.default, { + _typeCheck: function _typeCheck(value) { + if (value instanceof Number) value = value.valueOf(); + return typeof value === 'number' && !isNaN(value); + }, + min: function min(_min, message) { + if (message === void 0) { + message = _locale.number.min; + } + + return this.test({ + message: message, + name: 'min', + exclusive: true, + params: { + min: _min + }, + test: function test(value) { + return (0, _isAbsent.default)(value) || value >= this.resolve(_min); + } + }); + }, + max: function max(_max, message) { + if (message === void 0) { + message = _locale.number.max; + } + + return this.test({ + message: message, + name: 'max', + exclusive: true, + params: { + max: _max + }, + test: function test(value) { + return (0, _isAbsent.default)(value) || value <= this.resolve(_max); + } + }); + }, + lessThan: function lessThan(less, message) { + if (message === void 0) { + message = _locale.number.lessThan; + } + + return this.test({ + message: message, + name: 'max', + exclusive: true, + params: { + less: less + }, + test: function test(value) { + return (0, _isAbsent.default)(value) || value < this.resolve(less); + } + }); + }, + moreThan: function moreThan(more, message) { + if (message === void 0) { + message = _locale.number.moreThan; + } + + return this.test({ + message: message, + name: 'min', + exclusive: true, + params: { + more: more + }, + test: function test(value) { + return (0, _isAbsent.default)(value) || value > this.resolve(more); + } + }); + }, + positive: function positive(msg) { + if (msg === void 0) { + msg = _locale.number.positive; + } + + return this.min(0, msg); + }, + negative: function negative(msg) { + if (msg === void 0) { + msg = _locale.number.negative; + } + + return this.max(0, msg); + }, + integer: function integer(message) { + if (message === void 0) { + message = _locale.number.integer; + } + + return this.test({ + name: 'integer', + message: message, + test: isInteger + }); + }, + truncate: function truncate() { + return this.transform(function (value) { + return !(0, _isAbsent.default)(value) ? value | 0 : value; + }); + }, + round: function round(method) { + var avail = ['ceil', 'floor', 'round', 'trunc']; + method = method && method.toLowerCase() || 'round'; // this exists for symemtry with the new Math.trunc + + if (method === 'trunc') return this.truncate(); + if (avail.indexOf(method.toLowerCase()) === -1) throw new TypeError('Only valid options for round() are: ' + avail.join(', ')); + return this.transform(function (value) { + return !(0, _isAbsent.default)(value) ? Math[method](value) : value; + }); + } +}); +module.exports = exports["default"]; + +/***/ }), + +/***/ "../node_modules/yup/lib/object.js": +/*!*****************************************!*\ + !*** ../node_modules/yup/lib/object.js ***! + \*****************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _interopRequireWildcard = __webpack_require__(/*! @babel/runtime/helpers/interopRequireWildcard */ "./node_modules/@babel/runtime/helpers/interopRequireWildcard.js"); + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); + +exports.__esModule = true; +exports.default = ObjectSchema; + +var _taggedTemplateLiteralLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/taggedTemplateLiteralLoose */ "./node_modules/@babel/runtime/helpers/taggedTemplateLiteralLoose.js")); + +var _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ "./node_modules/@babel/runtime/helpers/extends.js")); + +var _has = _interopRequireDefault(__webpack_require__(/*! lodash/has */ "lodash/has")); + +var _snakeCase2 = _interopRequireDefault(__webpack_require__(/*! lodash/snakeCase */ "lodash/snakeCase")); + +var _camelCase2 = _interopRequireDefault(__webpack_require__(/*! lodash/camelCase */ "lodash/camelCase")); + +var _mapKeys = _interopRequireDefault(__webpack_require__(/*! lodash/mapKeys */ "lodash/mapKeys")); + +var _mapValues = _interopRequireDefault(__webpack_require__(/*! lodash/mapValues */ "lodash/mapValues")); + +var _propertyExpr = __webpack_require__(/*! property-expr */ "../node_modules/property-expr/index.js"); + +var _mixed = _interopRequireDefault(__webpack_require__(/*! ./mixed */ "../node_modules/yup/lib/mixed.js")); + +var _locale = __webpack_require__(/*! ./locale.js */ "../node_modules/yup/lib/locale.js"); + +var _sortFields = _interopRequireDefault(__webpack_require__(/*! ./util/sortFields */ "../node_modules/yup/lib/util/sortFields.js")); + +var _sortByKeyOrder = _interopRequireDefault(__webpack_require__(/*! ./util/sortByKeyOrder */ "../node_modules/yup/lib/util/sortByKeyOrder.js")); + +var _inherits = _interopRequireDefault(__webpack_require__(/*! ./util/inherits */ "../node_modules/yup/lib/util/inherits.js")); + +var _makePath = _interopRequireDefault(__webpack_require__(/*! ./util/makePath */ "../node_modules/yup/lib/util/makePath.js")); + +var _runValidations = _interopRequireWildcard(__webpack_require__(/*! ./util/runValidations */ "../node_modules/yup/lib/util/runValidations.js")); + +function _templateObject2() { + var data = (0, _taggedTemplateLiteralLoose2.default)(["", ".", ""]); + + _templateObject2 = function _templateObject2() { + return data; + }; + + return data; +} + +function _templateObject() { + var data = (0, _taggedTemplateLiteralLoose2.default)(["", ".", ""]); + + _templateObject = function _templateObject() { + return data; + }; + + return data; +} + +var isObject = function isObject(obj) { + return Object.prototype.toString.call(obj) === '[object Object]'; +}; + +function unknown(ctx, value) { + var known = Object.keys(ctx.fields); + return Object.keys(value).filter(function (key) { + return known.indexOf(key) === -1; + }); +} + +function ObjectSchema(spec) { + var _this2 = this; + + if (!(this instanceof ObjectSchema)) return new ObjectSchema(spec); + + _mixed.default.call(this, { + type: 'object', + default: function _default() { + var _this = this; + + if (!this._nodes.length) return undefined; + var dft = {}; + + this._nodes.forEach(function (key) { + dft[key] = _this.fields[key].default ? _this.fields[key].default() : undefined; + }); + + return dft; + } + }); + + this.fields = Object.create(null); + this._nodes = []; + this._excludedEdges = []; + this.withMutation(function () { + _this2.transform(function coerce(value) { + if (typeof value === 'string') { + try { + value = JSON.parse(value); + } catch (err) { + value = null; + } + } + + if (this.isType(value)) return value; + return null; + }); + + if (spec) { + _this2.shape(spec); + } + }); +} + +(0, _inherits.default)(ObjectSchema, _mixed.default, { + _typeCheck: function _typeCheck(value) { + return isObject(value) || typeof value === 'function'; + }, + _cast: function _cast(_value, options) { + var _this3 = this; + + if (options === void 0) { + options = {}; + } + + var value = _mixed.default.prototype._cast.call(this, _value, options); //should ignore nulls here + + + if (value === undefined) return this.default(); + if (!this._typeCheck(value)) return value; + var fields = this.fields; + var strip = this._option('stripUnknown', options) === true; + + var props = this._nodes.concat(Object.keys(value).filter(function (v) { + return _this3._nodes.indexOf(v) === -1; + })); + + var intermediateValue = {}; // is filled during the transform below + + var innerOptions = (0, _extends2.default)({}, options, { + parent: intermediateValue, + __validating: false + }); + props.forEach(function (prop) { + var field = fields[prop]; + var exists = (0, _has.default)(value, prop); + + if (field) { + var fieldValue; + var strict = field._options && field._options.strict; // safe to mutate since this is fired in sequence + + innerOptions.path = (0, _makePath.default)(_templateObject(), options.path, prop); + innerOptions.value = value[prop]; + field = field.resolve(innerOptions); + if (field._strip === true) return; + fieldValue = !options.__validating || !strict ? field.cast(value[prop], innerOptions) : value[prop]; + if (fieldValue !== undefined) intermediateValue[prop] = fieldValue; + } else if (exists && !strip) intermediateValue[prop] = value[prop]; + }); + return intermediateValue; + }, + _validate: function _validate(_value, opts) { + var _this4 = this; + + if (opts === void 0) { + opts = {}; + } + + var endEarly, recursive; + var sync = opts.sync; + var errors = []; + var originalValue = opts.originalValue != null ? opts.originalValue : _value; + endEarly = this._option('abortEarly', opts); + recursive = this._option('recursive', opts); + opts = (0, _extends2.default)({}, opts, { + __validating: true, + originalValue: originalValue + }); + return _mixed.default.prototype._validate.call(this, _value, opts).catch((0, _runValidations.propagateErrors)(endEarly, errors)).then(function (value) { + if (!recursive || !isObject(value)) { + // only iterate though actual objects + if (errors.length) throw errors[0]; + return value; + } + + originalValue = originalValue || value; + + var validations = _this4._nodes.map(function (key) { + var path = (0, _makePath.default)(_templateObject2(), opts.path, key); + var field = _this4.fields[key]; + var innerOptions = (0, _extends2.default)({}, opts, { + path: path, + parent: value, + originalValue: originalValue[key] + }); + + if (field) { + // inner fields are always strict: + // 1. this isn't strict so the casting will also have cast inner values + // 2. this is strict in which case the nested values weren't cast either + innerOptions.strict = true; + if (field.validate) return field.validate(value[key], innerOptions); + } + + return true; + }); + + return (0, _runValidations.default)({ + sync: sync, + validations: validations, + value: value, + errors: errors, + endEarly: endEarly, + path: opts.path, + sort: (0, _sortByKeyOrder.default)(_this4.fields) + }); + }); + }, + concat: function concat(schema) { + var next = _mixed.default.prototype.concat.call(this, schema); + + next._nodes = (0, _sortFields.default)(next.fields, next._excludedEdges); + return next; + }, + shape: function shape(schema, excludes) { + if (excludes === void 0) { + excludes = []; + } + + var next = this.clone(), + fields = (0, _extends2.default)(next.fields, schema); + next.fields = fields; + + if (excludes.length) { + if (!Array.isArray(excludes[0])) excludes = [excludes]; + var keys = excludes.map(function (_ref) { + var first = _ref[0], + second = _ref[1]; + return first + "-" + second; + }); + next._excludedEdges = next._excludedEdges.concat(keys); + } + + next._nodes = (0, _sortFields.default)(fields, next._excludedEdges); + return next; + }, + from: function from(_from, to, alias) { + var fromGetter = (0, _propertyExpr.getter)(_from, true); + return this.transform(function (obj) { + var newObj = obj; + if (obj == null) return obj; + + if ((0, _has.default)(obj, _from)) { + newObj = (0, _extends2.default)({}, obj); + if (!alias) delete obj[_from]; + newObj[to] = fromGetter(obj); + } + + return newObj; + }); + }, + noUnknown: function noUnknown(noAllow, message) { + if (noAllow === void 0) { + noAllow = true; + } + + if (message === void 0) { + message = _locale.object.noUnknown; + } + + if (typeof noAllow === 'string') { + message = noAllow; + noAllow = true; + } + + var next = this.test({ + name: 'noUnknown', + exclusive: true, + message: message, + test: function test(value) { + return value == null || !noAllow || unknown(this.schema, value).length === 0; + } + }); + if (noAllow) next._options.stripUnknown = true; + return next; + }, + transformKeys: function transformKeys(fn) { + return this.transform(function (obj) { + return obj && (0, _mapKeys.default)(obj, function (_, key) { + return fn(key); + }); + }); + }, + camelCase: function camelCase() { + return this.transformKeys(_camelCase2.default); + }, + snakeCase: function snakeCase() { + return this.transformKeys(_snakeCase2.default); + }, + constantCase: function constantCase() { + return this.transformKeys(function (key) { + return (0, _snakeCase2.default)(key).toUpperCase(); + }); + }, + describe: function describe() { + var base = _mixed.default.prototype.describe.call(this); + + base.fields = (0, _mapValues.default)(this.fields, function (value) { + return value.describe(); + }); + return base; + } +}); +module.exports = exports["default"]; + +/***/ }), + +/***/ "../node_modules/yup/lib/setLocale.js": +/*!********************************************!*\ + !*** ../node_modules/yup/lib/setLocale.js ***! + \********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); + +exports.__esModule = true; +exports.default = setLocale; + +var _locale = _interopRequireDefault(__webpack_require__(/*! ./locale */ "../node_modules/yup/lib/locale.js")); + +function setLocale(custom) { + Object.keys(custom).forEach(function (type) { + Object.keys(custom[type]).forEach(function (method) { + _locale.default[type][method] = custom[type][method]; + }); + }); +} + +module.exports = exports["default"]; + +/***/ }), + +/***/ "../node_modules/yup/lib/string.js": +/*!*****************************************!*\ + !*** ../node_modules/yup/lib/string.js ***! + \*****************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); + +exports.__esModule = true; +exports.default = StringSchema; + +var _inherits = _interopRequireDefault(__webpack_require__(/*! ./util/inherits */ "../node_modules/yup/lib/util/inherits.js")); + +var _mixed = _interopRequireDefault(__webpack_require__(/*! ./mixed */ "../node_modules/yup/lib/mixed.js")); + +var _locale = __webpack_require__(/*! ./locale */ "../node_modules/yup/lib/locale.js"); + +var _isAbsent = _interopRequireDefault(__webpack_require__(/*! ./util/isAbsent */ "../node_modules/yup/lib/util/isAbsent.js")); + +// eslint-disable-next-line +var rEmail = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i; // eslint-disable-next-line + +var rUrl = /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i; + +var hasLength = function hasLength(value) { + return (0, _isAbsent.default)(value) || value.length > 0; +}; + +var isTrimmed = function isTrimmed(value) { + return (0, _isAbsent.default)(value) || value === value.trim(); +}; + +function StringSchema() { + var _this = this; + + if (!(this instanceof StringSchema)) return new StringSchema(); + + _mixed.default.call(this, { + type: 'string' + }); + + this.withMutation(function () { + _this.transform(function (value) { + if (this.isType(value)) return value; + return value != null && value.toString ? value.toString() : value; + }); + }); +} + +(0, _inherits.default)(StringSchema, _mixed.default, { + _typeCheck: function _typeCheck(value) { + if (value instanceof String) value = value.valueOf(); + return typeof value === 'string'; + }, + required: function required(message) { + if (message === void 0) { + message = _locale.mixed.required; + } + + var next = _mixed.default.prototype.required.call(this, message); + + return next.test({ + message: message, + name: 'required', + test: hasLength + }); + }, + length: function length(_length, message) { + if (message === void 0) { + message = _locale.string.length; + } + + return this.test({ + message: message, + name: 'length', + exclusive: true, + params: { + length: _length + }, + test: function test(value) { + return (0, _isAbsent.default)(value) || value.length === this.resolve(_length); + } + }); + }, + min: function min(_min, message) { + if (message === void 0) { + message = _locale.string.min; + } + + return this.test({ + message: message, + name: 'min', + exclusive: true, + params: { + min: _min + }, + test: function test(value) { + return (0, _isAbsent.default)(value) || value.length >= this.resolve(_min); + } + }); + }, + max: function max(_max, message) { + if (message === void 0) { + message = _locale.string.max; + } + + return this.test({ + name: 'max', + exclusive: true, + message: message, + params: { + max: _max + }, + test: function test(value) { + return (0, _isAbsent.default)(value) || value.length <= this.resolve(_max); + } + }); + }, + matches: function matches(regex, options) { + var excludeEmptyString = false; + var message; + + if (options) { + if (options.message || options.hasOwnProperty('excludeEmptyString')) { + excludeEmptyString = options.excludeEmptyString; + message = options.message; + } else message = options; + } + + return this.test({ + message: message || _locale.string.matches, + params: { + regex: regex + }, + test: function test(value) { + return (0, _isAbsent.default)(value) || value === '' && excludeEmptyString || regex.test(value); + } + }); + }, + email: function email(message) { + if (message === void 0) { + message = _locale.string.email; + } + + return this.matches(rEmail, { + message: message, + excludeEmptyString: true + }); + }, + url: function url(message) { + if (message === void 0) { + message = _locale.string.url; + } + + return this.matches(rUrl, { + message: message, + excludeEmptyString: true + }); + }, + //-- transforms -- + ensure: function ensure() { + return this.default('').transform(function (val) { + return val === null ? '' : val; + }); + }, + trim: function trim(message) { + if (message === void 0) { + message = _locale.string.trim; + } + + return this.transform(function (val) { + return val != null ? val.trim() : val; + }).test({ + message: message, + name: 'trim', + test: isTrimmed + }); + }, + lowercase: function lowercase(message) { + if (message === void 0) { + message = _locale.string.lowercase; + } + + return this.transform(function (value) { + return !(0, _isAbsent.default)(value) ? value.toLowerCase() : value; + }).test({ + message: message, + name: 'string_case', + exclusive: true, + test: function test(value) { + return (0, _isAbsent.default)(value) || value === value.toLowerCase(); + } + }); + }, + uppercase: function uppercase(message) { + if (message === void 0) { + message = _locale.string.uppercase; + } + + return this.transform(function (value) { + return !(0, _isAbsent.default)(value) ? value.toUpperCase() : value; + }).test({ + message: message, + name: 'string_case', + exclusive: true, + test: function test(value) { + return (0, _isAbsent.default)(value) || value === value.toUpperCase(); + } + }); + } +}); +module.exports = exports["default"]; + +/***/ }), + +/***/ "../node_modules/yup/lib/util/createValidation.js": +/*!********************************************************!*\ + !*** ../node_modules/yup/lib/util/createValidation.js ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); + +exports.__esModule = true; +exports.default = createValidation; + +var _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/objectWithoutPropertiesLoose */ "./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js")); + +var _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ "./node_modules/@babel/runtime/helpers/extends.js")); + +var _mapValues = _interopRequireDefault(__webpack_require__(/*! lodash/mapValues */ "lodash/mapValues")); + +var _ValidationError = _interopRequireDefault(__webpack_require__(/*! ../ValidationError */ "../node_modules/yup/lib/ValidationError.js")); + +var _Reference = _interopRequireDefault(__webpack_require__(/*! ../Reference */ "../node_modules/yup/lib/Reference.js")); + +var _synchronousPromise = __webpack_require__(/*! synchronous-promise */ "../node_modules/synchronous-promise/index.js"); + +var formatError = _ValidationError.default.formatError; + +var thenable = function thenable(p) { + return p && typeof p.then === 'function' && typeof p.catch === 'function'; +}; + +function runTest(testFn, ctx, value, sync) { + var result = testFn.call(ctx, value); + if (!sync) return Promise.resolve(result); + + if (thenable(result)) { + throw new Error("Validation test of type: \"" + ctx.type + "\" returned a Promise during a synchronous validate. " + "This test will finish after the validate call has returned"); + } + + return _synchronousPromise.SynchronousPromise.resolve(result); +} + +function resolveParams(oldParams, newParams, resolve) { + return (0, _mapValues.default)((0, _extends2.default)({}, oldParams, newParams), resolve); +} + +function createErrorFactory(_ref) { + var value = _ref.value, + label = _ref.label, + resolve = _ref.resolve, + originalValue = _ref.originalValue, + opts = (0, _objectWithoutPropertiesLoose2.default)(_ref, ["value", "label", "resolve", "originalValue"]); + return function createError(_temp) { + var _ref2 = _temp === void 0 ? {} : _temp, + _ref2$path = _ref2.path, + path = _ref2$path === void 0 ? opts.path : _ref2$path, + _ref2$message = _ref2.message, + message = _ref2$message === void 0 ? opts.message : _ref2$message, + _ref2$type = _ref2.type, + type = _ref2$type === void 0 ? opts.name : _ref2$type, + params = _ref2.params; + + params = (0, _extends2.default)({ + path: path, + value: value, + originalValue: originalValue, + label: label + }, resolveParams(opts.params, params, resolve)); + return (0, _extends2.default)(new _ValidationError.default(formatError(message, params), value, path, type), { + params: params + }); + }; +} + +function createValidation(options) { + var name = options.name, + message = options.message, + test = options.test, + params = options.params; + + function validate(_ref3) { + var value = _ref3.value, + path = _ref3.path, + label = _ref3.label, + options = _ref3.options, + originalValue = _ref3.originalValue, + sync = _ref3.sync, + rest = (0, _objectWithoutPropertiesLoose2.default)(_ref3, ["value", "path", "label", "options", "originalValue", "sync"]); + var parent = options.parent; + + var resolve = function resolve(value) { + return _Reference.default.isRef(value) ? value.getValue(parent, options.context) : value; + }; + + var createError = createErrorFactory({ + message: message, + path: path, + value: value, + originalValue: originalValue, + params: params, + label: label, + resolve: resolve, + name: name + }); + var ctx = (0, _extends2.default)({ + path: path, + parent: parent, + type: name, + createError: createError, + resolve: resolve, + options: options + }, rest); + return runTest(test, ctx, value, sync).then(function (validOrError) { + if (_ValidationError.default.isError(validOrError)) throw validOrError;else if (!validOrError) throw createError(); + }); + } + + validate.TEST_NAME = name; + validate.TEST_FN = test; + validate.TEST = options; + return validate; +} + +module.exports.createErrorFactory = createErrorFactory; +module.exports = exports["default"]; + +/***/ }), + +/***/ "../node_modules/yup/lib/util/inherits.js": +/*!************************************************!*\ + !*** ../node_modules/yup/lib/util/inherits.js ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); + +exports.__esModule = true; +exports.default = inherits; + +var _extends2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/extends */ "./node_modules/@babel/runtime/helpers/extends.js")); + +function inherits(ctor, superCtor, spec) { + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + (0, _extends2.default)(ctor.prototype, spec); +} + +module.exports = exports["default"]; + +/***/ }), + +/***/ "../node_modules/yup/lib/util/isAbsent.js": +/*!************************************************!*\ + !*** ../node_modules/yup/lib/util/isAbsent.js ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.__esModule = true; +exports.default = void 0; + +var _default = function _default(value) { + return value == null; +}; + +exports.default = _default; +module.exports = exports["default"]; + +/***/ }), + +/***/ "../node_modules/yup/lib/util/isSchema.js": +/*!************************************************!*\ + !*** ../node_modules/yup/lib/util/isSchema.js ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.__esModule = true; +exports.default = void 0; + +var _default = function _default(obj) { + return obj && obj.__isYupSchema__; +}; + +exports.default = _default; +module.exports = exports["default"]; + +/***/ }), + +/***/ "../node_modules/yup/lib/util/isodate.js": +/*!***********************************************!*\ + !*** ../node_modules/yup/lib/util/isodate.js ***! + \***********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.__esModule = true; +exports.default = parseIsoDate; + +/* eslint-disable */ + +/** + * + * Date.parse with progressive enhancement for ISO 8601 + * NON-CONFORMANT EDITION. + * © 2011 Colin Snover + * Released under MIT license. + */ +// 1 YYYY 2 MM 3 DD 4 HH 5 mm 6 ss 7 msec 8 Z 9 ± 10 tzHH 11 tzmm +var isoReg = /^(\d{4}|[+\-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/; + +function parseIsoDate(date) { + var numericKeys = [1, 4, 5, 6, 7, 10, 11], + minutesOffset = 0, + timestamp, + struct; + + if (struct = isoReg.exec(date)) { + // avoid NaN timestamps caused by “undefined” values being passed to Date.UTC + for (var i = 0, k; k = numericKeys[i]; ++i) { + struct[k] = +struct[k] || 0; + } // allow undefined days and months + + + struct[2] = (+struct[2] || 1) - 1; + struct[3] = +struct[3] || 1; // allow arbitrary sub-second precision beyond milliseconds + + struct[7] = struct[7] ? String(struct[7]).substr(0, 3) : 0; // timestamps without timezone identifiers should be considered local time + + if ((struct[8] === undefined || struct[8] === '') && (struct[9] === undefined || struct[9] === '')) timestamp = +new Date(struct[1], struct[2], struct[3], struct[4], struct[5], struct[6], struct[7]);else { + if (struct[8] !== 'Z' && struct[9] !== undefined) { + minutesOffset = struct[10] * 60 + struct[11]; + if (struct[9] === '+') minutesOffset = 0 - minutesOffset; + } + + timestamp = Date.UTC(struct[1], struct[2], struct[3], struct[4], struct[5] + minutesOffset, struct[6], struct[7]); + } + } else timestamp = Date.parse ? Date.parse(date) : NaN; + + return timestamp; +} + +module.exports = exports["default"]; + +/***/ }), + +/***/ "../node_modules/yup/lib/util/makePath.js": +/*!************************************************!*\ + !*** ../node_modules/yup/lib/util/makePath.js ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.__esModule = true; +exports.default = makePath; + +function makePath(strings) { + for (var _len = arguments.length, values = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + values[_key - 1] = arguments[_key]; + } + + var path = strings.reduce(function (str, next) { + var value = values.shift(); + return str + (value == null ? '' : value) + next; + }); + return path.replace(/^\./, ''); +} + +module.exports = exports["default"]; + +/***/ }), + +/***/ "../node_modules/yup/lib/util/merge.js": +/*!*********************************************!*\ + !*** ../node_modules/yup/lib/util/merge.js ***! + \*********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); + +exports.__esModule = true; +exports.default = merge; + +var _has = _interopRequireDefault(__webpack_require__(/*! lodash/has */ "lodash/has")); + +var _isSchema = _interopRequireDefault(__webpack_require__(/*! ./isSchema */ "../node_modules/yup/lib/util/isSchema.js")); + +var isObject = function isObject(obj) { + return Object.prototype.toString.call(obj) === '[object Object]'; +}; + +function merge(target, source) { + for (var key in source) { + if ((0, _has.default)(source, key)) { + var targetVal = target[key], + sourceVal = source[key]; + if (sourceVal === undefined) continue; + + if ((0, _isSchema.default)(sourceVal)) { + target[key] = (0, _isSchema.default)(targetVal) ? targetVal.concat(sourceVal) : sourceVal; + } else if (isObject(sourceVal)) { + target[key] = isObject(targetVal) ? merge(targetVal, sourceVal) : sourceVal; + } else if (Array.isArray(sourceVal)) { + target[key] = Array.isArray(targetVal) ? targetVal.concat(sourceVal) : sourceVal; + } else target[key] = source[key]; + } + } + + return target; +} + +module.exports = exports["default"]; + +/***/ }), + +/***/ "../node_modules/yup/lib/util/printValue.js": +/*!**************************************************!*\ + !*** ../node_modules/yup/lib/util/printValue.js ***! + \**************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.__esModule = true; +exports.default = printValue; +var toString = Object.prototype.toString; +var errorToString = Error.prototype.toString; +var regExpToString = RegExp.prototype.toString; +var symbolToString = typeof Symbol !== 'undefined' ? Symbol.prototype.toString : function () { + return ''; +}; +var SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/; + +function printNumber(val) { + if (val != +val) return 'NaN'; + var isNegativeZero = val === 0 && 1 / val < 0; + return isNegativeZero ? '-0' : '' + val; +} + +function printSimpleValue(val, quoteStrings) { + if (quoteStrings === void 0) { + quoteStrings = false; + } + + if (val == null || val === true || val === false) return '' + val; + var typeOf = typeof val; + if (typeOf === 'number') return printNumber(val); + if (typeOf === 'string') return quoteStrings ? "\"" + val + "\"" : val; + if (typeOf === 'function') return '[Function ' + (val.name || 'anonymous') + ']'; + if (typeOf === 'symbol') return symbolToString.call(val).replace(SYMBOL_REGEXP, 'Symbol($1)'); + var tag = toString.call(val).slice(8, -1); + if (tag === 'Date') return isNaN(val.getTime()) ? '' + val : val.toISOString(val); + if (tag === 'Error' || val instanceof Error) return '[' + errorToString.call(val) + ']'; + if (tag === 'RegExp') return regExpToString.call(val); + return null; +} + +function printValue(value, quoteStrings) { + var result = printSimpleValue(value, quoteStrings); + if (result !== null) return result; + return JSON.stringify(value, function (key, value) { + var result = printSimpleValue(this[key], quoteStrings); + if (result !== null) return result; + return value; + }, 2); +} + +module.exports = exports["default"]; + +/***/ }), + +/***/ "../node_modules/yup/lib/util/reach.js": +/*!*********************************************!*\ + !*** ../node_modules/yup/lib/util/reach.js ***! + \*********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); + +exports.__esModule = true; +exports.getIn = getIn; +exports.default = void 0; + +var _propertyExpr = __webpack_require__(/*! property-expr */ "../node_modules/property-expr/index.js"); + +var _has = _interopRequireDefault(__webpack_require__(/*! lodash/has */ "lodash/has")); + +var trim = function trim(part) { + return part.substr(0, part.length - 1).substr(1); +}; + +function getIn(schema, path, value, context) { + var parent, lastPart, lastPartDebug; // if only one "value" arg then use it for both + + context = context || value; + (0, _propertyExpr.forEach)(path, function (_part, isBracket, isArray) { + var part = isBracket ? trim(_part) : _part; + + if (isArray || (0, _has.default)(schema, '_subType')) { + // we skipped an array: foo[].bar + var idx = isArray ? parseInt(part, 10) : 0; + schema = schema.resolve({ + context: context, + parent: parent, + value: value + })._subType; + + if (value) { + if (isArray && idx >= value.length) { + throw new Error("Yup.reach cannot resolve an array item at index: " + _part + ", in the path: " + path + ". " + "because there is no value at that index. "); + } + + value = value[idx]; + } + } + + if (!isArray) { + schema = schema.resolve({ + context: context, + parent: parent, + value: value + }); + if (!(0, _has.default)(schema, 'fields') || !(0, _has.default)(schema.fields, part)) throw new Error("The schema does not contain the path: " + path + ". " + ("(failed at: " + lastPartDebug + " which is a type: \"" + schema._type + "\") ")); + schema = schema.fields[part]; + parent = value; + value = value && value[part]; + lastPart = _part; + lastPartDebug = isBracket ? '[' + _part + ']' : '.' + _part; + } + }); + + if (schema) { + schema = schema.resolve({ + context: context, + parent: parent, + value: value + }); + } + + return { + schema: schema, + parent: parent, + parentPath: lastPart + }; +} + +var reach = function reach(obj, path, value, context) { + return getIn(obj, path, value, context).schema; +}; + +var _default = reach; +exports.default = _default; + +/***/ }), + +/***/ "../node_modules/yup/lib/util/runValidations.js": +/*!******************************************************!*\ + !*** ../node_modules/yup/lib/util/runValidations.js ***! + \******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); + +exports.__esModule = true; +exports.propagateErrors = propagateErrors; +exports.settled = settled; +exports.collectErrors = collectErrors; +exports.default = runValidations; + +var _objectWithoutPropertiesLoose2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/objectWithoutPropertiesLoose */ "./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js")); + +var _synchronousPromise = __webpack_require__(/*! synchronous-promise */ "../node_modules/synchronous-promise/index.js"); + +var _ValidationError = _interopRequireDefault(__webpack_require__(/*! ../ValidationError */ "../node_modules/yup/lib/ValidationError.js")); + +var promise = function promise(sync) { + return sync ? _synchronousPromise.SynchronousPromise : Promise; +}; + +var unwrapError = function unwrapError(errors) { + if (errors === void 0) { + errors = []; + } + + return errors.inner && errors.inner.length ? errors.inner : [].concat(errors); +}; + +function scopeToValue(promises, value, sync) { + //console.log('scopeToValue', promises, value) + var p = promise(sync).all(promises); //console.log('scopeToValue B', p) + + var b = p.catch(function (err) { + if (err.name === 'ValidationError') err.value = value; + throw err; + }); //console.log('scopeToValue c', b) + + var c = b.then(function () { + return value; + }); //console.log('scopeToValue d', c) + + return c; +} +/** + * If not failing on the first error, catch the errors + * and collect them in an array + */ + + +function propagateErrors(endEarly, errors) { + return endEarly ? null : function (err) { + errors.push(err); + return err.value; + }; +} + +function settled(promises, sync) { + var settle = function settle(promise) { + return promise.then(function (value) { + return { + fulfilled: true, + value: value + }; + }, function (value) { + return { + fulfilled: false, + value: value + }; + }); + }; + + return promise(sync).all(promises.map(settle)); +} + +function collectErrors(_ref) { + var validations = _ref.validations, + value = _ref.value, + path = _ref.path, + sync = _ref.sync, + errors = _ref.errors, + sort = _ref.sort; + errors = unwrapError(errors); + return settled(validations, sync).then(function (results) { + var nestedErrors = results.filter(function (r) { + return !r.fulfilled; + }).reduce(function (arr, _ref2) { + var error = _ref2.value; + + // we are only collecting validation errors + if (!_ValidationError.default.isError(error)) { + throw error; + } + + return arr.concat(error); + }, []); + if (sort) nestedErrors.sort(sort); //show parent errors after the nested ones: name.first, name + + errors = nestedErrors.concat(errors); + if (errors.length) throw new _ValidationError.default(errors, value, path); + return value; + }); +} + +function runValidations(_ref3) { + var endEarly = _ref3.endEarly, + options = (0, _objectWithoutPropertiesLoose2.default)(_ref3, ["endEarly"]); + if (endEarly) return scopeToValue(options.validations, options.value, options.sync); + return collectErrors(options); +} + +/***/ }), + +/***/ "../node_modules/yup/lib/util/sortByKeyOrder.js": +/*!******************************************************!*\ + !*** ../node_modules/yup/lib/util/sortByKeyOrder.js ***! + \******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.__esModule = true; +exports.default = sortByKeyOrder; + +function findIndex(arr, err) { + var idx = Infinity; + arr.some(function (key, ii) { + if (err.path.indexOf(key) !== -1) { + idx = ii; + return true; + } + }); + return idx; +} + +function sortByKeyOrder(fields) { + var keys = Object.keys(fields); + return function (a, b) { + return findIndex(keys, a) - findIndex(keys, b); + }; +} + +module.exports = exports["default"]; + +/***/ }), + +/***/ "../node_modules/yup/lib/util/sortFields.js": +/*!**************************************************!*\ + !*** ../node_modules/yup/lib/util/sortFields.js ***! + \**************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); + +exports.__esModule = true; +exports.default = sortFields; + +var _has = _interopRequireDefault(__webpack_require__(/*! lodash/has */ "lodash/has")); + +var _toposort = _interopRequireDefault(__webpack_require__(/*! toposort */ "../node_modules/toposort/index.js")); + +var _propertyExpr = __webpack_require__(/*! property-expr */ "../node_modules/property-expr/index.js"); + +var _Reference = _interopRequireDefault(__webpack_require__(/*! ../Reference */ "../node_modules/yup/lib/Reference.js")); + +var _isSchema = _interopRequireDefault(__webpack_require__(/*! ./isSchema */ "../node_modules/yup/lib/util/isSchema.js")); + +function sortFields(fields, excludes) { + if (excludes === void 0) { + excludes = []; + } + + var edges = [], + nodes = []; + + function addNode(depPath, key) { + var node = (0, _propertyExpr.split)(depPath)[0]; + if (!~nodes.indexOf(node)) nodes.push(node); + if (!~excludes.indexOf(key + "-" + node)) edges.push([key, node]); + } + + for (var key in fields) { + if ((0, _has.default)(fields, key)) { + var value = fields[key]; + if (!~nodes.indexOf(key)) nodes.push(key); + if (_Reference.default.isRef(value) && !value.isContext) addNode(value.path, key);else if ((0, _isSchema.default)(value) && value._deps) value._deps.forEach(function (path) { + return addNode(path, key); + }); + } + } + + return _toposort.default.array(nodes, edges).reverse(); +} + +module.exports = exports["default"]; + +/***/ }), + +/***/ "../src/Field.js": +/*!***********************!*\ + !*** ../src/Field.js ***! + \***********************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.__esModule = true; +exports.default = void 0; + +var _classnames = _interopRequireDefault(__webpack_require__(/*! classnames */ "./node_modules/classnames/index.js")); + +var _omit = _interopRequireDefault(__webpack_require__(/*! lodash/omit */ "lodash/omit")); + +var _react = _interopRequireDefault(__webpack_require__(/*! react */ "react")); + +var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js")); + +var _topeka = __webpack_require__(/*! topeka */ "../node_modules/topeka/index.js"); + +var _warning = _interopRequireDefault(__webpack_require__(/*! warning */ "./node_modules/warning/warning.js")); + +var _memoizeOne = _interopRequireDefault(__webpack_require__(/*! memoize-one */ "../node_modules/memoize-one/dist/memoize-one.esm.js")); + +var _shallowequal = _interopRequireDefault(__webpack_require__(/*! shallowequal */ "./node_modules/shallowequal/index.js")); + +var _config = _interopRequireDefault(__webpack_require__(/*! ./config */ "../src/config.js")); + +var _isNativeType = _interopRequireDefault(__webpack_require__(/*! ./utils/isNativeType */ "../src/utils/isNativeType.js")); + +var _resolveFieldComponent = _interopRequireDefault(__webpack_require__(/*! ./utils/resolveFieldComponent */ "../src/utils/resolveFieldComponent.js")); + +var _ErrorUtils = __webpack_require__(/*! ./utils/ErrorUtils */ "../src/utils/ErrorUtils.js"); + +var _FormContext = __webpack_require__(/*! ./FormContext */ "../src/FormContext.js"); + +var _createEventHandler = _interopRequireDefault(__webpack_require__(/*! ./utils/createEventHandler */ "../src/utils/createEventHandler.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } + +function _extends() { _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; }; return _extends.apply(this, arguments); } + +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } + +function notify(handler, args) { + handler && handler.apply(void 0, args); +} + +function isFilterMessagesEqual(a, b) { + var isEqual = (a.messages === b.messages || (0, _shallowequal.default)(a.messages, b.messages)) && a.names === b.names && a.mapMessages === b.mapMessages; // !isEqual && console.log('filter equal', a.messages, b.messages) + + return isEqual; +} +/** + * The Field Component renders a form control and handles input value updates and validations. + * Changes to the Field value are automatically propagated back up to the containing Form + * Component. + * + * Fields provide a light abstraction over normal input components where values and onChange handlers + * are take care of for you. Beyond that they just render the input for their type, Fields whille pass along + * any props and children to the input so you can easily configure new input types. + * + * ```editable + *
    + * + * + * + * + * + * + * + * + * + * + * Submit + * + * ``` + */ + + +var Field = +/*#__PURE__*/ +function (_React$PureComponent) { + _inheritsLoose(Field, _React$PureComponent); + + function Field() { + var _this; + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _React$PureComponent.call.apply(_React$PureComponent, [this].concat(args)) || this; + + _this.handleFieldError = function (errors) { + var _this$props = _this.props, + name = _this$props.name, + formMethods = _this$props.formMethods; + return formMethods.onFieldError(name, errors); + }; + + _this.eventHandlers = {}; + _this.getEventHandlers = (0, _createEventHandler.default)(function (event) { + return function () { + for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; + } + + notify(_this.props[event], args); + notify(_this.props.bindingProps[event], args); + + _this.handleValidateField(event, args); + }; + }); + _this.memoFilterAndMapMessages = (0, _memoizeOne.default)(_ErrorUtils.filterAndMapMessages, isFilterMessagesEqual); + return _this; + } + + var _proto = Field.prototype; + + _proto.buildMeta = function buildMeta() { + var _this$props2 = this.props, + name = _this$props2.name, + exclusive = _this$props2.exclusive, + messages = _this$props2.messages, + formMethods = _this$props2.formMethods, + yupContext = _this$props2.yupContext, + _this$props2$submitti = _this$props2.submitting, + submitting = _this$props2$submitti === void 0 ? false : _this$props2$submitti, + _this$props2$errorCla = _this$props2.errorClass, + errorClass = _this$props2$errorCla === void 0 ? _config.default.errorClass : _this$props2$errorCla; + var schema; + + try { + schema = formMethods.getSchemaForPath && name && formMethods.getSchemaForPath(name); + } catch (err) {} + /* ignore */ + // prettier-ignore + + + var meta = { + schema: schema, + errorClass: errorClass, + context: yupContext, + onError: this.handleFieldError + }; + var errors = this.memoFilterAndMapMessages({ + messages: messages, + names: name, + mapMessages: !exclusive ? _ErrorUtils.inclusiveMapMessages : undefined + }); + meta.errors = errors; + meta.invalid = !!Object.keys(errors).length; + meta.valid = !meta.invalid; + meta.submitting = submitting; + return meta; + }; + + _proto.handleValidateField = function handleValidateField(event, args) { + var _this$props3 = this.props, + name = _this$props3.name, + validates = _this$props3.validates, + formMethods = _this$props3.formMethods, + noValidate = _this$props3.noValidate; + if (noValidate || !formMethods) return; + var fieldsToValidate = validates != null ? [].concat(validates) : [name]; + formMethods.onValidate(fieldsToValidate, event, args); + }; + + _proto.render = function render() { + var _this$props4 = this.props, + name = _this$props4.name, + type = _this$props4.type, + children = _this$props4.children, + className = _this$props4.className, + fieldRef = _this$props4.fieldRef, + noMeta = _this$props4.noMeta, + noValidate = _this$props4.noValidate, + noResolveType = _this$props4.noResolveType, + bindingProps = _this$props4.bindingProps, + formMethods = _this$props4.formMethods, + _this$props4$events = _this$props4.events, + events = _this$props4$events === void 0 ? _config.default.events : _this$props4$events; + + var fieldProps = _extends({ + name: name + }, (0, _omit.default)(this.props, Object.keys(Field.propTypes)), bindingProps, this.getEventHandlers(events)); // ensure that no inputs are left uncontrolled + + + fieldProps.value = bindingProps.value === undefined ? null : bindingProps.value; + var meta = this.buildMeta(); + + if (false) {} + + var _ref = !noResolveType ? (0, _resolveFieldComponent.default)(type, meta.schema) : [null, type], + Component = _ref[0], + resolvedType = _ref[1]; + + fieldProps.type = (0, _isNativeType.default)(resolvedType) ? resolvedType : undefined; + meta.resolvedType = resolvedType; + + if (!noValidate) { + fieldProps.className = (0, _classnames.default)(className, meta.invalid && meta.errorClass); + } + + if (!noMeta) fieldProps.meta = meta; + if (fieldRef) fieldProps.ref = fieldRef; // Escape hatch for more complex Field types. + + if (typeof children === 'function') { + return children(fieldProps, Component); + } + + return _react.default.createElement(Component, fieldProps, children); + }; + + return Field; +}(_react.default.PureComponent); + +Field.defaultProps = { + type: '', + exclusive: false, + fieldRef: null +}; +Field.propTypes = { + /** + * The Field name, which should be path corresponding to a specific form `value` path. + * + * ```js + * // given the form value + * value = { + * name: { first: '' } + * languages: ['english', 'spanish'] + * } + * + * // the path "name.first" would update the "first" property of the form value + * + * + * // use indexes for paths that cross arrays + * + * + * ``` + */ + name: _propTypes.default.string.isRequired, + + /** + * The Component Input the form should render. You can sepcify a builtin type + * with a string name e.g `'text'`, `'datetime-local'`, etc. or provide a Component + * type class directly. When no type is provided the Field will attempt determine + * the correct input from the corresponding scheme. A Field corresponding to a `yup.number()` + * will render a `type='number'` input by default. + * + * ```editable + *
    + * Use the schema to determine type + * + * + * Override it! + * + * + * Use a custom Component + * (need native 'datetime' support to see it) + * + * + * + * ``` + * Custom Inputs should comply with the basic input api contract: set a value via a `value` prop and + * broadcast changes to that value via an `onChange` handler. + * + * You can also permenantly map Components to a string `type` name via the top-level + * `addInputType()` api. + */ + type: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.string]), + + /** + * Event name or array of event names that the Field should trigger a validation. + */ + events: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]), + + /** + * Customize how the Field value maps to the overall Form `value`. + * `mapFromValue` can be a a string property name or a function that returns a + * value for `name`'d path, allowing you to set commuted values from the Field. + * + * ```js + * fieldValue.first + ' ' + fieldValue.last} + * /> + * ``` + * + * You can also provide an object hash, mapping paths of the Form `value` + * to fields in the field value using a string field name, or a function accessor. + * + * ```editable + *
    + * + * + * + * + * date, + * 'age': date => + * (new Date()).getFullYear() - date.getFullYear() + * }}/> + * + * + * + * Submit + * + * ``` + */ + mapFromValue: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.string, _propTypes.default.object]), + + /** + * Map the Form value to the Field value. By default + * the `name` of the Field is used to extract the relevant + * property from the Form value. + * + * ```js + * pick(model, 'location', 'locationId')} + * /> + * ``` + */ + mapToValue: _propTypes.default.func, + + /** + * The css class added to the Field Input when it fails validation + */ + errorClass: _propTypes.default.string, + + /** + * Tells the Field to trigger validation for specific paths. + * Useful when used in conjuction with a `mapFromValue` hash that updates more than one value, or + * if you want to trigger validation for the parent path as well. + * + * > NOTE! This overrides the default behavior of validating the field itself by `name`, + * include the `name` if you want the field to validate itself. + * + * ```js + * + * + * ``` + */ + validates: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.arrayOf(_propTypes.default.string)]), + + /** + * Indicates whether child fields of the named field + * affect the active state ofthe field. + * + * ```js + * -> 'names' + * -> 'names.first' + * -> 'names.last' + * ``` + * + * Are all considered "part" of a field named `'names'` by default. + */ + exclusive: _propTypes.default.bool, + + /** + * Disables validation for the Field. + */ + noValidate: _propTypes.default.bool, + + /** + * When children is the traditional react element or nodes, they are + * passed through as-is to the Field `type` component. + * + * ```jsx + * + * + * + * + * ``` + * + * When `children` is a function, its called with the processed field + * props and the resolved Field Input component, for more advanced use cases + * + * ```jsx + * + * {(props, Input) => + * + * + * + * } + * + * ``` + */ + children: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func]), + + /** + * Instruct the field to not inject the `meta` prop into the input + */ + noMeta: _propTypes.default.bool, + + /** + * Attach a ref to the rendered input component + */ + fieldRef: _propTypes.default.func, + + /** @private */ + noResolveType: _propTypes.default.bool, + + /** @private */ + bindingProps: _propTypes.default.object, + + /** @private */ + yupContext: _propTypes.default.any, + + /** @private */ + messages: _propTypes.default.object, + + /** @private */ + formMethods: _propTypes.default.object, + + /** @private */ + getSchemaForPath: _propTypes.default.func, + + /** @private */ + submitting: _propTypes.default.bool +}; + +var _default = (0, _FormContext.withState)(function (formMethods, messages, submitting, noValidate, yupContext, props, ref) { + if (messages === void 0) { + messages = _ErrorUtils.EMPTY_ERRORS; + } + + var mapToValue = props.mapToValue, + mapFromValue = props.mapFromValue, + name = props.name, + fieldRef = props.fieldRef, + rest = _objectWithoutPropertiesLoose(props, ["mapToValue", "mapFromValue", "name", "fieldRef"]); + + return _react.default.createElement(_topeka.Binding, { + bindTo: mapToValue || name, + mapValue: mapFromValue + }, function (bindingProps) { + return _react.default.createElement(Field, _extends({}, rest, { + name: name, + fieldRef: fieldRef || ref, + bindingProps: bindingProps, + submitting: submitting, + messages: messages, + yupContext: yupContext, + formMethods: formMethods, + noValidate: props.noValidate == null ? noValidate : props.noValidate + })); + }); +}, [function (state) { + return state.formMethods; +}, function (state) { + return state.messages; +}, function (state) { + return state.submitting; +}, function (state) { + return state.noValidate; +}, function (state) { + return state.yupContext; +}]); + +exports.default = _default; +module.exports = exports["default"]; + +/***/ }), + +/***/ "../src/FieldArray.js": +/*!****************************!*\ + !*** ../src/FieldArray.js ***! + \****************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.__esModule = true; +exports.default = void 0; + +var _invariant = _interopRequireDefault(__webpack_require__(/*! invariant */ "./node_modules/invariant/invariant.js")); + +var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js")); + +var _react = _interopRequireDefault(__webpack_require__(/*! react */ "react")); + +var _ErrorUtils = __webpack_require__(/*! ./utils/ErrorUtils */ "../src/utils/ErrorUtils.js"); + +var _Field = _interopRequireDefault(__webpack_require__(/*! ./Field */ "../src/Field.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } + +function _extends() { _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; }; return _extends.apply(this, arguments); } + +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } + +function filter(messages, baseName) { + var paths = Object.keys(messages || {}); + var result = {}; + paths.forEach(function (path) { + if (path.indexOf(baseName) !== 0) return; + result[path] = messages[path]; + }); + return result; +} +/** + * A specialized `Form.Field` component that handles array fields. + * Specifically it handles errors correctly when items are added, removed, or + * reordered. + */ + + +var FieldArray = +/*#__PURE__*/ +function (_React$Component) { + _inheritsLoose(FieldArray, _React$Component); + + function FieldArray() { + var _this; + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this; + + _this.onAdd = function (item) { + var value = _this.fieldProps.value; + + _this.onInsert(item, value ? value.length : 0); + }; + + _this.onUpdate = function (updatedItem, oldItem) { + var _this$fieldProps = _this.fieldProps, + value = _this$fieldProps.value, + onChange = _this$fieldProps.onChange; + var index = value.indexOf(oldItem); + var newValue = value == null ? [] : value.concat(); + newValue.splice(index, 1, updatedItem); + onChange(newValue); + }; + + _this.onInsert = function (item, index) { + var _this$fieldProps2 = _this.fieldProps, + value = _this$fieldProps2.value, + onChange = _this$fieldProps2.onChange; + var newValue = value == null ? [] : value.concat(); + newValue.splice(index, 0, item); + onChange(newValue); + + _this.sendErrors(function (errors, name) { + return (0, _ErrorUtils.unshift)(errors, name, index); + }); + }; + + _this.onMove = function (item, toIndex) { + var _this$fieldProps3 = _this.fieldProps, + value = _this$fieldProps3.value, + onChange = _this$fieldProps3.onChange; + var fromIndex = value.indexOf(item); + var newValue = value == null ? [] : value.concat(); + !(fromIndex !== -1) ? false ? undefined : invariant(false) : void 0; + newValue.splice.apply(newValue, [toIndex, 0].concat(newValue.splice(fromIndex, 1))); // FIXME: doesn't handle syncing error state. + + onChange(newValue, { + action: 'move', + toIndex: toIndex, + fromIndex: fromIndex + }); + + _this.sendErrors(function (errors, name) { + return (0, _ErrorUtils.move)(errors, name, fromIndex, toIndex); + }); + }; + + _this.onRemove = function (item) { + var _this$fieldProps4 = _this.fieldProps, + value = _this$fieldProps4.value, + onChange = _this$fieldProps4.onChange; + if (value == null) return; + var index = value.indexOf(item); + onChange(value.filter(function (v) { + return v !== item; + })); + + _this.sendErrors(function (errors, name) { + return (0, _ErrorUtils.shift)(errors, name, index); + }); + }; + + _this.mapValues = function (fn) { + var _this$fieldProps5 = _this.fieldProps, + value = _this$fieldProps5.value, + name = _this$fieldProps5.name; + return value.map(function (item, index) { + return fn(item, name + "[" + index + "]", index); + }); + }; + + _this.items = function () { + var _this$fieldProps6 = _this.fieldProps, + values = _this$fieldProps6.value, + name = _this$fieldProps6.name; + return !values ? [] : values.map(function (value, index) { + var itemName = name + "[" + index + "]"; + var itemErrors = filter(_this.meta.errors, itemName); + return { + value: value, + name: itemName, + onChange: function onChange(item) { + return _this.onUpdate(item, values[index]); + }, + meta: _extends({}, _this.meta, { + errors: itemErrors, + valid: !Object.keys(itemErrors).length, + invalid: !!Object.keys(itemErrors).length, + onError: function onError(errors) { + return _this.onItemError(itemName, errors); + } + }) + }; + }); + }; + + return _this; + } + + var _proto = FieldArray.prototype; + + _proto.onItemError = function onItemError(name, errors) { + this.sendErrors(function (fieldErrors) { + return _extends({}, (0, _ErrorUtils.remove)(fieldErrors, name), errors); + }); + }; + + _proto.sendErrors = function sendErrors(fn) { + var name = this.fieldProps.name; + var _this$meta = this.meta, + errors = _this$meta.errors, + onError = _this$meta.onError; + onError(fn(errors || {}, name)); + }; + + _proto.render = function render() { + var _this2 = this; + + var _this$props = this.props, + children = _this$props.children, + fieldProps = _objectWithoutPropertiesLoose(_this$props, ["children"]); + + return _react.default.createElement(_Field.default, _extends({}, fieldProps, { + noResolveType: true + }), function (_ref) { + var meta = _ref.meta, + props = _objectWithoutPropertiesLoose(_ref, ["meta"]); + + _this2.fieldProps = props; + _this2.meta = meta; + + var nextProps = _extends({}, props, { + meta: meta, + arrayHelpers: { + items: _this2.items, + add: _this2.onAdd, + move: _this2.onMove, + insert: _this2.onInsert, + remove: _this2.onRemove, + update: _this2.onUpdate + } + }); + + return typeof children === 'function' ? children(nextProps) : _react.default.cloneElement(children, nextProps); + }); + }; + + return FieldArray; +}(_react.default.Component); + +FieldArray.propTypes = { + name: _propTypes.default.string.isRequired +}; +var _default = FieldArray; +exports.default = _default; +module.exports = exports["default"]; + +/***/ }), + +/***/ "../src/Form.js": +/*!**********************!*\ + !*** ../src/Form.js ***! + \**********************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.__esModule = true; +exports.default = void 0; + +var _topeka = __webpack_require__(/*! topeka */ "../node_modules/topeka/index.js"); + +var _omit = _interopRequireDefault(__webpack_require__(/*! lodash/omit */ "lodash/omit")); + +var _pick = _interopRequireDefault(__webpack_require__(/*! lodash/pick */ "lodash/pick")); + +var _propertyExpr = _interopRequireDefault(__webpack_require__(/*! property-expr */ "../node_modules/property-expr/index.js")); + +var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js")); + +var _uncontrollable = _interopRequireDefault(__webpack_require__(/*! uncontrollable */ "./node_modules/uncontrollable/index.js")); + +var _react = _interopRequireDefault(__webpack_require__(/*! react */ "react")); + +var _warning = _interopRequireDefault(__webpack_require__(/*! warning */ "./node_modules/warning/warning.js")); + +var _elementType = _interopRequireDefault(__webpack_require__(/*! prop-types-extra/lib/elementType */ "./node_modules/prop-types-extra/lib/elementType.js")); + +var _reach = _interopRequireDefault(__webpack_require__(/*! yup/lib/util/reach */ "../node_modules/yup/lib/util/reach.js")); + +var _shallowequal = _interopRequireDefault(__webpack_require__(/*! shallowequal */ "./node_modules/shallowequal/index.js")); + +var _errorManager = _interopRequireDefault(__webpack_require__(/*! ./errorManager */ "../src/errorManager.js")); + +var _errToJSON = _interopRequireDefault(__webpack_require__(/*! ./utils/errToJSON */ "../src/utils/errToJSON.js")); + +var ErrorUtils = _interopRequireWildcard(__webpack_require__(/*! ./utils/ErrorUtils */ "../src/utils/ErrorUtils.js")); + +var _FormContext = _interopRequireDefault(__webpack_require__(/*! ./FormContext */ "../src/FormContext.js")); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } + +function _extends() { _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; }; return _extends.apply(this, arguments); } + +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } + +var BindingContext = _topeka.BindingContext.ControlledComponent; + +var done = function done(e) { + return setTimeout(function () { + throw e; + }); +}; + +var splitPath = function splitPath(path) { + var parts = _propertyExpr.default.split(path); + + var tail = parts.pop(); + return [_propertyExpr.default.join(parts), tail]; +}; + +var isValidationError = function isValidationError(err) { + return err && err.name === 'ValidationError'; +}; + +var YUP_OPTIONS = ['context', 'stripUnknown', 'recursive', 'abortEarly', 'strict']; + +var getter = function getter(path, model) { + return path ? _propertyExpr.default.getter(path, true)(model || {}) : model; +}; + +var setter = BindingContext.defaultProps.setter; +/** + * Form component renders a `value` to be updated and validated by child Fields. + * Forms can be thought of as ``s for complex values, or models. A Form aggregates + * a bunch of smaller inputs, each in charge of updating a small part of the overall model. + * The Form will integrate and validate each change and fire a single unified `onChange` with the new `value`. + * + * Validation messages can be displayed anywhere inside a Form with Message Components. + * + * ```editable + * var defaultStr = yup.string().default('') + * + * var customerSchema = yup + * .object({ + * name: yup.object({ + * first: defaultStr + * .required('please enter a first name'), + * + * last: defaultStr + * .required('please enter a surname'), + * }), + * + * dateOfBirth: yup.date() + * .max(new Date(), "Are you a time traveler?!"), + * + * colorId: yup.number() + * .nullable() + * .required('Please select a dank color') + * }); + * + * var form = ( + *
    + *
    + * {\/\*'grandchildren' are no problem \*\/} + * + * + * + * + * + * + *
    + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * Submit + * + * ) + * ReactDOM.render(form, mountNode); + * ``` + */ + +var Form = +/*#__PURE__*/ +function (_React$PureComponent) { + _inheritsLoose(Form, _React$PureComponent); + + Form.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) { + var schema = _ref.schema, + noValidate = _ref.noValidate; + if (schema === prevState.schema && prevState.noValidate === noValidate) return null; + return { + schema: schema, + noValidate: noValidate + }; + }; + + function Form(_props, _context) { + var _this; + + _this = _React$PureComponent.call(this, _props, _context) || this; + + _this.getSchemaForPath = function (path, props) { + if (props === void 0) { + props = _this.props; + } + + var _props2 = props, + schema = _props2.schema, + value = _props2.value, + context = _props2.context; + return schema && path && (0, _reach.default)(schema, path, value, context); + }; + + _this.handleValidationRequest = function (fields, type, args) { + var _this$props = _this.props, + noValidate = _this$props.noValidate, + delay = _this$props.delay; + fields = [].concat(fields); + if (noValidate) return; + + _this.notify('onValidate', { + type: type, + fields: fields, + args: args + }); + + _this.enqueue(fields); + + if (type !== 'onChange') _this.flush(delay); + }; + + _this.handleFieldError = function (name, fieldErrors) { + var errors = _this.props.errors; + + _this.handleError(_extends(ErrorUtils.remove(errors, name), fieldErrors)); + }; + + _this.handleError = function (errors) { + _this.notify('onError', errors); + }; + + _this.handleSubmitSuccess = function (validatedValue) { + var submitForm = _this.props.submitForm; + + _this.notify('onSubmit', validatedValue); + + return Promise.resolve(submitForm && submitForm(validatedValue)).then(function () { + _this.setSubmitting(false); + + _this.props.publish(function (_ref2) { + var _ref2$submitCount = _ref2.submitCount, + submitCount = _ref2$submitCount === void 0 ? 0 : _ref2$submitCount; + return { + submitCount: submitCount + 1 + }; + }); + + _this.notify('onSubmitFinished'); + }, function (err) { + _this.setSubmitting(false); + + _this.notify('onSubmitFinished', err); + + throw err; + }); + }; + + _this.handleSubmitError = function (err) { + if (!isValidationError(err)) throw err; + var errors = (0, _errToJSON.default)(err); + maybeWarn(_this.props.debug, errors, 'onSubmit'); + + _this.notify('onError', errors); + + _this.notify('onInvalidSubmit', errors); + + _this.setSubmitting(false); + }; + + _this.handleSubmit = function (e) { + if (e && e.preventDefault) e.preventDefault(); + clearTimeout(_this.submitTimer); + _this.submitTimer = setTimeout(function () { + return _this.submit().catch(done); + }, 0); + }; + + _this.submit = function () { + var _this$props2 = _this.props, + schema = _this$props2.schema, + noValidate = _this$props2.noValidate, + value = _this$props2.value, + onSubmitFinished = _this$props2.onSubmitFinished, + errors = _this$props2.errors, + options = _objectWithoutPropertiesLoose(_this$props2, ["schema", "noValidate", "value", "onSubmitFinished", "errors"]); + + if (_this._submitting) { + return Promise.resolve(false); + } + + options.abortEarly = false; + options.strict = false; + + _this.notify('onBeforeSubmit', { + value: value, + errors: errors + }); + + if (noValidate) return Promise.resolve(true).then(function () { + return _this.notify('onSubmit', value); + }); + + _this.setSubmitting(true); + + return schema.validate(value, options) // no catch, we aren't interested in errors from onSubmit handlers + .then(_this.handleSubmitSuccess, _this.handleSubmitError).then(onSubmitFinished); + }; + + _this.debug = function () { + var _console; + + if (!_this.props.__debugName) return; + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + (_console = console).log.apply(_console, ['Form:', _this.props.__debugName].concat(args)); + }; + + _this.validatePath = function (path, _ref3) { + var props = _ref3.props; + var options = (0, _pick.default)(props, YUP_OPTIONS); + var abortEarly = options.abortEarly == null ? false : options.abortEarly; + var value = props.value, + getter = props.getter; + + var schema = _this.getSchemaForPath(path, props); + + var _splitPath = splitPath(path), + parentPath = _splitPath[0], + currentPath = _splitPath[1]; + + var parent = getter(parentPath, value) || {}; + var pathValue = parent != null ? parent[currentPath] : value; + return schema.validate(pathValue, _extends({}, options, { + abortEarly: abortEarly, + parent: parent, + path: path + })).then(function () { + return null; + }).catch(function (err) { + return err; + }); + }; + + _this.queue = []; + _this.errors = (0, _errorManager.default)(_this.validatePath); + _this.state = {}; + + _props.publish(function () { + return { + formMethods: { + onSubmit: _this.handleSubmit, + onValidate: _this.handleValidationRequest, + onFieldError: _this.handleFieldError, + getSchemaForPath: _this.getSchemaForPath + } + }; + }); + + return _this; + } + + var _proto = Form.prototype; + + _proto.componentDidUpdate = function componentDidUpdate(prevProps) { + var _this2 = this; + + var _this$props3 = this.props, + errors = _this$props3.errors, + publish = _this$props3.publish, + delay = _this$props3.delay, + schema = _this$props3.schema; + var schemaChanged = schema !== prevProps.schema; + publish(function (_ref4) { + var messages = _ref4.messages; + + _this2.debug('updating messages', errors, messages, errors === messages); + + return (0, _shallowequal.default)(errors, messages) ? null : { + messages: errors + }; + }); + + if (schemaChanged && errors) { + this.enqueue(Object.keys(errors)); + } + + this.flush(delay); + }; + + _proto.componentWillUnmount = function componentWillUnmount() { + this.unmounted = true; + clearTimeout(this.submitTimer); + clearTimeout(this.validationTimer); + }; + + _proto.collectErrors = function collectErrors(fields, props) { + if (props === void 0) { + props = this.props; + } + + return this.errors.collect(fields, props.errors, { + props: props + }); + }; + + _proto.enqueue = function enqueue(fields) { + this.queue = this.queue.concat(fields); + }; + + _proto.flush = function flush(delay) { + var _this3 = this; + + clearTimeout(this.validationTimer); + this.validationTimer = setTimeout(function () { + var fields = _this3.queue; + var props = _this3.props; + if (!fields.length) return; + _this3.queue = []; + + _this3.collectErrors(fields, _this3.props).then(function (errors) { + if (errors !== _this3.props.errors) { + maybeWarn(props.debug, errors, 'field validation'); + + _this3.notify('onError', errors); + } + }).catch(done); + }, delay); + }; + + _proto.setSubmitting = function setSubmitting(submitting) { + if (this.unmounted) return; // this state is duplicated locally because it can take longer for the + // submit state to flush than a user can re-submit which we don't want + + this._submitting = submitting; + this.props.publish(function (s) { + return s.submitting === submitting ? null : { + submitting: submitting + }; + }); + }; + + _proto.notify = function notify(event) { + var _this$props4; + + for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { + args[_key2 - 1] = arguments[_key2]; + } + + if (this.props[event]) (_this$props4 = this.props)[event].apply(_this$props4, args); + }; + + _proto.validate = function validate(fields) { + return this.collectErrors(fields); + }; + + _proto.render = function render() { + var _this$props5 = this.props, + children = _this$props5.children, + onChange = _this$props5.onChange, + value = _this$props5.value, + Element = _this$props5.as, + getter = _this$props5.getter, + setter = _this$props5.setter; + var props = (0, _omit.default)(this.props, YUP_OPTIONS.concat(Object.keys(Form.propTypes), ['stop', 'publish'])); + delete props.publish; + delete props.__debugName; + if (Element === 'form') props.noValidate = true; // disable html5 validation + + props.onSubmit = this.handleSubmit; + + if (Element === null || Element === false) { + children = _react.default.cloneElement(_react.default.Children.only(children), props); + } else { + children = _react.default.createElement(Element, props, children); + } + + return _react.default.createElement(BindingContext, { + value: value, + onChange: onChange, + getter: getter, + setter: setter + }, children); + }; + + return Form; +}(_react.default.PureComponent); + +Form.propTypes = { + /** + * Form value object, can be left [uncontrolled](/controllables); + * use the `defaultValue` prop to initialize an uncontrolled form. + */ + value: _propTypes.default.object, + + /** + * Callback that is called when the `value` prop changes. + * + * ```js + * function( + * value: object, + * updatedPaths: array + * ) + * ``` + */ + onChange: _propTypes.default.func, + + /** + * A unique key that names a `Form` within a surrounding `Form.Context`. + * Corresponding `Form.Submit`s with the same `formKey` will trigger validation. + */ + formKey: _propTypes.default.string, + + /** + * An object hash of field errors for the form. The object should be keyed with paths + * with the values being an array of messages or message objects. Errors can be + * left [uncontrolled](/controllables) (use `defaultErrors` to set an initial value) + * or managed along with the `onError` callback. You can use any object shape you'd like for + * messages, as long as you provide the Form.Message component an `extract` prop that + * understands how to pull out the strings message. By default it understands strings and objects + * with a `'message'` property. + * + * ```js + *
    + * ``` + */ + errors: _propTypes.default.object, + + /** + * Callback that is called when a validation error occurs. It is called with an `errors` object + * + * ```editable + * { + * if( errors.dateOfBirth ) + * errors.dateOfBirth = 'hijacked!' + * this.setState({ errors }) + * }}> + * + * + * + * + * Submit + * + * ``` + */ + onError: _propTypes.default.func, + + /** + * Callback that is called whenever a validation is triggered. + * It is called _before_ the validation is actually run. + * ```js + * function onValidate(event){ + * let { type, fields, args } = event + * } + * ``` + */ + onValidate: _propTypes.default.func, + + /** + * Callback that is fired in response to a submit, _before validation runs. + * + * ```js + * function onSubmit(formValue){ + * // do something with valid value + * } + * ``` + */ + onBeforeSubmit: _propTypes.default.func, + + /** + * Callback that is fired in response to a submit, after validation runs for the entire form. + * + * ```js + * function onSubmit(formValue){ + * // do something with valid value + * } + * ``` + */ + onSubmit: _propTypes.default.func, + onSubmitFinished: _propTypes.default.func, + + /* */ + submitForm: _propTypes.default.func, + + /** + * Callback that is fired when the native onSubmit event is triggered. Only relevant when + * the `component` prop renders a `
    ` tag. onInvalidSubmit will trigger only if the form is invalid. + * + * ```js + * function onInvalidSubmit(errors){ + * // do something with errors + * } + * ``` + */ + onInvalidSubmit: _propTypes.default.func, + + /** + * A value getter function. `getter` is called with `path` and `value` and + * should return the plain **javascript** value at the path. + * + * ```js + * function( + * path: string, + * value: any, + * ) -> object + * ``` + */ + getter: _propTypes.default.func, + + /** + * A value setter function. `setter` is called with `path`, the form `value` and the path `value`. + * The `setter` must return updated form `value`, which allows you to leave the original value unmutated. + * + * The default implementation uses the [react immutability helpers](http://facebook.github.io/react/docs/update.html), + * letting you treat the form `value` as immutable. + * ```js + * function( + * path: string, + * formValue: object, + * pathValue: any + * ) -> object + * ``` + */ + setter: _propTypes.default.func, + + /** + * Time in milliseconds that validations should be debounced. Reduces the amount of validation calls + * made at the expense of a slight delay. Helpful for performance. + */ + delay: _propTypes.default.number, + + /** + * Validations will be strict, making no attempt to coarce input values to the appropriate type. + */ + strict: _propTypes.default.bool, + + /** + * Turns off input validation for the Form, value updates will continue to work. + */ + noValidate: _propTypes.default.bool, + + /** + * A tag name or Component class the Form should render. + * + * If `null` are `false` the form will simply render it's child. In + * this instance there must only be one child. + */ + as: _propTypes.default.oneOfType([_elementType.default, _propTypes.default.oneOf([null, false])]), + + /** + * A Yup schema that validates the Form `value` prop. Used to validate the form input values + * For more information about the yup api check out: https://github.com/jquense/yup/blob/master/README.md + * @type {YupSchema} + */ + schema: function schema(props, name, componentName) { + var _PropTypes$any; + + for (var _len3 = arguments.length, args = new Array(_len3 > 3 ? _len3 - 3 : 0), _key3 = 3; _key3 < _len3; _key3++) { + args[_key3 - 3] = arguments[_key3]; + } + + var err = !props.noValidate && (_PropTypes$any = _propTypes.default.any).isRequired.apply(_PropTypes$any, [props, name, componentName].concat(args)); + + if (props[name]) { + var schema = props[name]; + if (!schema.__isYupSchema__ && !(schema.resolve && schema.validate)) err = new Error('`schema` must be a proper yup schema: (' + componentName + ')'); + } + + return err; + }, + + /** + * yup schema context + */ + context: _propTypes.default.object, + + /** + * toggle debug mode, which `console.warn`s validation errors + */ + debug: _propTypes.default.bool, + + /** @private */ + publish: _propTypes.default.func.isRequired +}; +Form.defaultProps = _extends({}, BindingContext.defaultProps, { + as: 'form', + strict: false, + delay: 300, + errors: ErrorUtils.EMPTY_ERRORS, + getter: getter, + setter: setter +}); + +function maybeWarn(debug, errors, target) { + if (!debug) return; + + if (false) { var keys; } +} + +var ControlledForm = (0, _uncontrollable.default)( +/** + * Wraps each Form in it's own Context, so it can pass context state to + * it's own children. + */ +_react.default.forwardRef(function (props, ref) { + var key = props.formKey; + return _react.default.createElement(_FormContext.default, { + __debugName: props.__debugName, + defaultKey: key, + initialState: { + messages: props.errors, + yupContext: props.context, + noValidate: props.noValidate, + // FIXME: should update + formMethods: { + getSchemaForPath: function getSchemaForPath(path) { + var schema = props.schema, + value = props.value, + context = props.context; + return schema && path && (0, _reach.default)(schema, path, value, context); + } + } + } + }, function (publish) { + return _react.default.createElement(Form, _extends({}, props, { + ref: ref, + publish: publish + })); + }); +}), { + value: 'onChange', + errors: 'onError' +}); +ControlledForm.getter = getter; +ControlledForm.setter = setter; +var _default = ControlledForm; +exports.default = _default; +module.exports = exports["default"]; + +/***/ }), + +/***/ "../src/FormContext.js": +/*!*****************************!*\ + !*** ../src/FormContext.js ***! + \*****************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.__esModule = true; +exports.default = exports.withState = exports.DEFAULT_CHANNEL = void 0; + +var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js")); + +var _reactDom = _interopRequireDefault(__webpack_require__(/*! react-dom */ "./node_modules/react-dom/index.js")); + +var _react = _interopRequireDefault(__webpack_require__(/*! react */ "react")); + +var _mapContextToProps = _interopRequireDefault(__webpack_require__(/*! react-context-toolbox/lib/mapContextToProps */ "../node_modules/react-context-toolbox/lib/mapContextToProps.js")); + +var _forwardRef = _interopRequireDefault(__webpack_require__(/*! react-context-toolbox/lib/forwardRef */ "../node_modules/react-context-toolbox/lib/forwardRef.js")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _extends() { _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; }; return _extends.apply(this, arguments); } + +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } + +var DEFAULT_CHANNEL = '@@parent'; +exports.DEFAULT_CHANNEL = DEFAULT_CHANNEL; + +var State = _react.default.createContext(); + +var FormContext = +/*#__PURE__*/ +function (_React$Component) { + _inheritsLoose(FormContext, _React$Component); + + function FormContext() { + var _formState; + + var _this; + + for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) { + _args[_key] = arguments[_key]; + } + + _this = _React$Component.call.apply(_React$Component, [this].concat(_args)) || this; + + _this.update = function (channel, fn, propagateIfPossible) { + _reactDom.default.unstable_batchedUpdates(function () { + if (_this.unmounted) return; + var parentContext = _this.props.parentContext; + + if (parentContext) { + parentContext.update(channel, fn, false); + if (!propagateIfPossible) return; + _this.props.__debugName && _this.debug('publish to parent'); + } + + _this.setState(function (_ref) { + var _extends2; + + var formState = _ref.formState; + var channelState = formState[channel]; + var nextChannelState = fn(channelState || {}); // TODO: optimize the nullish case + + if (nextChannelState === channelState || nextChannelState === null) { + _this.debug('no update for channel: ', channel); + + return null; + } + + _this.debug('updating for channel: ', channel); + + return { + formState: _extends({}, formState, (_extends2 = {}, _extends2[channel] = _extends({}, channelState, nextChannelState), _extends2)) + }; + }); + }); + }; + + _this.publish = function (fn, mutate) { + _this.update(_this.props.defaultKey || DEFAULT_CHANNEL, fn, true, mutate); + }; + + _this.debug = function () { + var _console; + + if (!_this.props.__debugName) return; + + for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; + } + + (_console = console).log.apply(_console, ['FormContext:', _this.props.__debugName].concat(args)); + }; + + _this.state = { + formState: (_formState = {}, _formState[_this.props.defaultKey || DEFAULT_CHANNEL] = _this.props.initialState, _formState), + combinedState: {}, + update: _this.update, + defaultKey: _this.props.defaultKey || DEFAULT_CHANNEL + }; + return _this; + } + + var _proto = FormContext.prototype; + + _proto.componentWillUnmount = function componentWillUnmount() { + this.unmounted = true; + }; + + FormContext.getDerivedStateFromProps = function getDerivedStateFromProps(_ref2, prevState) { + var parentContext = _ref2.parentContext, + _ref2$defaultKey = _ref2.defaultKey, + defaultKey = _ref2$defaultKey === void 0 ? DEFAULT_CHANNEL : _ref2$defaultKey; + if (!parentContext) return { + combinedState: prevState.formState + }; + return { + defaultKey: defaultKey, + combinedState: _extends({}, parentContext.combinedState, prevState.formState) + }; + }; + + _proto.render = function render() { + return _react.default.createElement(State.Provider, { + value: this.state + }, typeof this.props.children === 'function' ? this.props.children(this.publish) : this.props.children); + }; + + return FormContext; +}(_react.default.Component); + +FormContext.propTypes = { + /** @private */ + parentContext: _propTypes.default.object, + + /** @private */ + defaultKey: _propTypes.default.string, + + /** @private */ + initialState: _propTypes.default.object +}; + +var ConsumerIndirection = +/*#__PURE__*/ +function (_React$Component2) { + _inheritsLoose(ConsumerIndirection, _React$Component2); + + function ConsumerIndirection() { + return _React$Component2.apply(this, arguments) || this; + } + + var _proto2 = ConsumerIndirection.prototype; + + // eslint-disable-next-line react/prop-types + _proto2.shouldComponentUpdate = function shouldComponentUpdate(_ref3) { + var state = _ref3.state, + props = _ref3.props; + var currentState = this.props.state; + var shouldUpdate = props !== this.props.props || state.some(function (observedState, i) { + return observedState !== currentState[i]; + }); + return shouldUpdate; + }; + + _proto2.render = function render() { + var _this$props = this.props, + children = _this$props.children, + state = _this$props.state; + return children(state); + }; + + return ConsumerIndirection; +}(_react.default.Component); + +var withState = function withState(render, selectors, _temp) { + var _ref4 = _temp === void 0 ? {} : _temp, + displayName = _ref4.displayName; + + var fn = function fn(props, ref) { + return _react.default.createElement(State.Consumer, null, function (context) { + var key = props.formKey || (context ? context.defaultKey : DEFAULT_CHANNEL); // eslint-disable-line react/prop-types + + var state = context && context.combinedState[key]; + return _react.default.createElement(ConsumerIndirection, { + props: props, + state: selectors.map(function (fn) { + return state && fn(state, props); + }) + }, function (state) { + return render.apply(void 0, state.concat([props, ref])); + }); + }); + }; + + return (0, _forwardRef.default)(fn, { + displayName: displayName + }); +}; + +exports.withState = withState; + +var _default = (0, _mapContextToProps.default)(State.Consumer, function (parentContext) { + return { + parentContext: parentContext + }; +}, FormContext); + +exports.default = _default; + +/***/ }), + +/***/ "../src/FormSubmit.js": +/*!****************************!*\ + !*** ../src/FormSubmit.js ***! + \****************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.__esModule = true; +exports.default = void 0; + +var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js")); + +var _react = _interopRequireDefault(__webpack_require__(/*! react */ "react")); + +var _warning = _interopRequireDefault(__webpack_require__(/*! warning */ "./node_modules/warning/warning.js")); + +var _memoizeOne = _interopRequireDefault(__webpack_require__(/*! memoize-one */ "../node_modules/memoize-one/dist/memoize-one.esm.js")); + +var _elementType = _interopRequireDefault(__webpack_require__(/*! prop-types-extra/lib/elementType */ "./node_modules/prop-types-extra/lib/elementType.js")); + +var _createEventHandler = _interopRequireDefault(__webpack_require__(/*! ./utils/createEventHandler */ "../src/utils/createEventHandler.js")); + +var _ErrorUtils = __webpack_require__(/*! ./utils/ErrorUtils */ "../src/utils/ErrorUtils.js"); + +var _FormContext = __webpack_require__(/*! ./FormContext */ "../src/FormContext.js"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _extends() { _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; }; return _extends.apply(this, arguments); } + +function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } + +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } + +/** + * A Form submit button, for triggering validations for the entire form or specific fields. + */ +var FormSubmit = +/*#__PURE__*/ +function (_React$Component) { + _inheritsLoose(FormSubmit, _React$Component); + + function FormSubmit() { + var _this; + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this; + _this.eventHandlers = {}; + _this.getEventHandlers = (0, _createEventHandler.default)(function (event) { + return function () { + for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; + } + + _this.props[event] && _this.props[event](args); + + _this.handleSubmit(); + }; + }); + _this.memoFilterAndMapMessages = (0, _memoizeOne.default)(_ErrorUtils.filterAndMapMessages, function (a, b) { + return a.messages === b.messages && a.names === b.names && a.mapMessages === b.mapMessages; + }); + return _this; + } + + var _proto = FormSubmit.prototype; + + _proto.handleSubmit = function handleSubmit(event, args) { + var _this$props = this.props, + formMethods = _this$props.formMethods, + triggers = _this$props.triggers, + formKey = _this$props.formKey; + + if (!formMethods) { + return false ? undefined : void 0; + } + + if (triggers && triggers.length) formMethods.onValidate(triggers, event, args);else formMethods.onSubmit(); + }; + + _proto.render = function render() { + var _this$props2 = this.props, + events = _this$props2.events, + triggers = _this$props2.triggers, + children = _this$props2.children, + messages = _this$props2.messages, + submitCount = _this$props2.submitCount, + _this$props2$submitti = _this$props2.submitting, + submitting = _this$props2$submitti === void 0 ? false : _this$props2$submitti, + Component = _this$props2.as, + _0 = _this$props2.formKey, + _1 = _this$props2.formMethods, + props = _objectWithoutPropertiesLoose(_this$props2, ["events", "triggers", "children", "messages", "submitCount", "submitting", "as", "formKey", "formMethods"]); + + var partial = triggers && triggers.length; + + if (partial) { + messages = this.memoFilterAndMapMessages({ + messages: messages, + names: triggers + }); + } + + props = _extends(props, this.getEventHandlers(events)); + return typeof children === 'function' ? children({ + messages: messages, + props: props, + submitting: submitting, + submitCount: submitCount + }) : _react.default.createElement(Component, _extends({ + type: partial ? 'button' : 'submit' + }, props), children); + }; + + return FormSubmit; +}(_react.default.Component); + +FormSubmit.propTypes = { + /** + * The `