diff --git a/package.json b/package.json
index 7a1b812e..da219d58 100644
--- a/package.json
+++ b/package.json
@@ -147,7 +147,7 @@
"react-simple-dnd": "^0.1.2",
"react-sortable": "^1.2.0",
"react-split-pane": "^0.1.57",
- "react-textarea-autosize-inputref": "^4.1.0",
+ "react-textarea-autosize": "^4.3.2",
"react-toolbox": "^1.2.1",
"react-topbar-progress-indicator": "^1.0.0",
"react-waypoint": "^3.1.3",
diff --git a/src/components/PreviewPane/PreviewPane.js b/src/components/PreviewPane/PreviewPane.js
index 7ae7fa60..71693f4c 100644
--- a/src/components/PreviewPane/PreviewPane.js
+++ b/src/components/PreviewPane/PreviewPane.js
@@ -15,7 +15,7 @@ export default class PreviewPane extends React.Component {
getWidget = (field, value, props) => {
const { fieldsMetaData, getAsset } = props;
const widget = resolveWidget(field.get('widget'));
- return React.createElement(widget.preview, {
+ return !widget.preview ? null : React.createElement(widget.preview, {
field,
key: field.get('name'),
value: value && Map.isMap(value) ? value.get(field.get('name')) : value,
diff --git a/src/components/Widgets/BooleanControl.css b/src/components/Widgets/BooleanControl.css
new file mode 100644
index 00000000..8ad7912b
--- /dev/null
+++ b/src/components/Widgets/BooleanControl.css
@@ -0,0 +1,3 @@
+.switch {
+ display: inline-block;
+}
diff --git a/src/components/Widgets/BooleanControl.js b/src/components/Widgets/BooleanControl.js
index c95b655a..c902f395 100644
--- a/src/components/Widgets/BooleanControl.js
+++ b/src/components/Widgets/BooleanControl.js
@@ -1,6 +1,8 @@
import React, { PropTypes } from 'react';
import ImmutablePropTypes from "react-immutable-proptypes";
import Switch from 'react-toolbox/lib/switch';
+import { isBoolean } from 'lodash';
+import styles from './BooleanControl.css';
export default class BooleanControl extends React.Component {
render() {
@@ -8,7 +10,8 @@ export default class BooleanControl extends React.Component {
return (
);
diff --git a/src/components/Widgets/ControlHOC.js b/src/components/Widgets/ControlHOC.js
index df05805a..8e358905 100644
--- a/src/components/Widgets/ControlHOC.js
+++ b/src/components/Widgets/ControlHOC.js
@@ -9,8 +9,10 @@ class ControlHOC extends Component {
controlComponent: PropTypes.func.isRequired,
field: ImmutablePropTypes.map.isRequired,
value: PropTypes.oneOfType([
+ PropTypes.node,
PropTypes.object,
PropTypes.string,
+ PropTypes.bool,
]),
metadata: ImmutablePropTypes.map,
onChange: PropTypes.func.isRequired,
diff --git a/src/components/Widgets/DatePreview.js b/src/components/Widgets/DatePreview.js
index 154625df..70e5bc2f 100644
--- a/src/components/Widgets/DatePreview.js
+++ b/src/components/Widgets/DatePreview.js
@@ -6,5 +6,5 @@ export default function DatePreview({ value }) {
}
DatePreview.propTypes = {
- value: PropTypes.node,
+ value: PropTypes.object,
};
diff --git a/src/components/Widgets/DateTimePreview.js b/src/components/Widgets/DateTimePreview.js
index 154625df..2d78f9e8 100644
--- a/src/components/Widgets/DateTimePreview.js
+++ b/src/components/Widgets/DateTimePreview.js
@@ -1,10 +1,10 @@
import React, { PropTypes } from 'react';
import previewStyle from './defaultPreviewStyle';
-export default function DatePreview({ value }) {
+export default function DateTimePreview({ value }) {
return
{value ? value.toString() : null}
;
}
-DatePreview.propTypes = {
- value: PropTypes.node,
+DateTimePreview.propTypes = {
+ value: PropTypes.object,
};
diff --git a/src/components/Widgets/MarkdownControlElements/RawEditor/index.js b/src/components/Widgets/MarkdownControlElements/RawEditor/index.js
index afe62c72..649f41af 100644
--- a/src/components/Widgets/MarkdownControlElements/RawEditor/index.js
+++ b/src/components/Widgets/MarkdownControlElements/RawEditor/index.js
@@ -3,7 +3,7 @@ import MarkupIt from 'markup-it';
import markdownSyntax from 'markup-it/syntaxes/markdown';
import htmlSyntax from 'markup-it/syntaxes/html';
import CaretPosition from 'textarea-caret-position';
-import TextareaAutosize from 'react-textarea-autosize-inputref';
+import TextareaAutosize from 'react-textarea-autosize';
import registry from '../../../../lib/registry';
import { createAssetProxy } from '../../../../valueObjects/AssetProxy';
import Toolbar from '../Toolbar/Toolbar';
diff --git a/src/components/Widgets/ObjectControl.js b/src/components/Widgets/ObjectControl.js
index ac62fd71..0a0bb2e5 100644
--- a/src/components/Widgets/ObjectControl.js
+++ b/src/components/Widgets/ObjectControl.js
@@ -10,7 +10,11 @@ export default class ObjectControl extends Component {
onAddAsset: PropTypes.func.isRequired,
onRemoveAsset: PropTypes.func.isRequired,
getAsset: PropTypes.func.isRequired,
- value: PropTypes.node,
+ value: PropTypes.oneOfType([
+ PropTypes.node,
+ PropTypes.object,
+ PropTypes.bool,
+ ]),
field: PropTypes.object,
forID: PropTypes.string,
className: PropTypes.string,
@@ -35,6 +39,7 @@ export default class ObjectControl extends Component {
onAddAsset,
onRemoveAsset,
getAsset,
+ forID: field.get('name'),
})
}
diff --git a/src/components/Widgets/ObjectPreview.js b/src/components/Widgets/ObjectPreview.js
index 11787060..37159d89 100644
--- a/src/components/Widgets/ObjectPreview.js
+++ b/src/components/Widgets/ObjectPreview.js
@@ -6,7 +6,7 @@ export default class ObjectPreview extends Component {
widgetFor = (field) => {
const { value, getAsset } = this.props;
const widget = resolveWidget(field.get('widget'));
- return (
+ return !widget.preview ? null : (
{React.createElement(widget.preview, {
key: field.get('name'),
diff --git a/src/components/Widgets/SelectControl.js b/src/components/Widgets/SelectControl.js
index 160f24bd..22ce171e 100644
--- a/src/components/Widgets/SelectControl.js
+++ b/src/components/Widgets/SelectControl.js
@@ -34,7 +34,7 @@ SelectControl.propTypes = {
value: PropTypes.node,
forID: PropTypes.string.isRequired,
field: ImmutablePropTypes.contains({
- options: ImmutablePropTypes.listOf(PropTypes.oneOf([
+ options: ImmutablePropTypes.listOf(PropTypes.oneOfType([
PropTypes.string,
ImmutablePropTypes.contains({
label: PropTypes.string.isRequired,
diff --git a/src/components/Widgets/TextPreview.js b/src/components/Widgets/TextPreview.js
index 1a0d8a1b..2e1e4bd6 100644
--- a/src/components/Widgets/TextPreview.js
+++ b/src/components/Widgets/TextPreview.js
@@ -2,7 +2,7 @@ import React, { PropTypes } from 'react';
import previewStyle from './defaultPreviewStyle';
export default function TextPreview({ value }) {
- return
{value ? value.toString() : null}
;
+ return
{value}
;
}
TextPreview.propTypes = {
diff --git a/yarn.lock b/yarn.lock
index 9edd85b0..8fe20986 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -7090,9 +7090,11 @@ react-style-proptype@^3.0.0:
dependencies:
prop-types "^15.5.4"
-react-textarea-autosize-inputref@^4.1.0:
- version "4.1.0"
- resolved "https://registry.yarnpkg.com/react-textarea-autosize-inputref/-/react-textarea-autosize-inputref-4.1.0.tgz#4a12921f9c992a8e2c6ce569ab46982a96ca48f6"
+react-textarea-autosize@^4.3.2:
+ version "4.3.2"
+ resolved "https://registry.yarnpkg.com/react-textarea-autosize/-/react-textarea-autosize-4.3.2.tgz#962a52c68caceae408c18acecec29049b81e42fa"
+ dependencies:
+ prop-types "^15.5.8"
react-themeable@^1.1.0:
version "1.1.0"