Sha256: 7856ac762200913890138233de13046767ab828a2c341587f3086405d77db5cc

Contents?: true

Size: 1.71 KB

Versions: 9

Compression:

Stored size: 1.71 KB

Contents

import React from 'react';

export class FieldSet extends React.Component {
    static propTypes = {
        title: React.PropTypes.string.isRequired,
        expanded: React.PropTypes.bool,
        containerClassName: React.PropTypes.string
    };
    getDefaultProps() {
        return (
            {expanded: true}
        );
    }

    getInitialState() {
        return (
            {expanded: this.props.expanded}
        );
    }

    componentWillReceiveProps(nextProps) {
        if (nextProps.expanded != null) { return this.setState({expanded: nextProps.expanded}); }
    }

    toggleExpanded() {
        return (
            this.setState({expanded: !this.state.expanded})
        );
    }

    render() {
        const colProps = _.omit(this.props, 'name', 'expanded', 'bodyClassName');
        const bodyClassName = _.export classnames("container", this.props.containerClassName);
        return (
            React.createElement(BS.Col, Object.assign({},  colProps),
                React.createElement("fieldset", {"export className": (
                    _.export classnames("collapsible", this.props.className, this.state.icon,
                        {expanded: this.state.expanded, collapsed: !this.state.expanded})
                )},
                    React.createElement("legend", {"onClick": (this.toggleExpanded)},
                        (this.props.title)
                    ),
                    React.createElement(BS.Collapse, {"in": (this.state.expanded)},
                        React.createElement("div", {"ref": "body", "export className": (bodyClassName)},
                            (this.props.children)
                        )
                    )
                )
            )
        );
    }
}

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
hippo-fw-0.9.5 client/hippo/components/shared/FieldSet.jsx
hippo-fw-0.9.4 client/hippo/components/shared/FieldSet.jsx
hippo-fw-0.9.3 client/hippo/components/shared/FieldSet.jsx
hippo-fw-0.9.2 client/hippo/components/shared/FieldSet.jsx
hippo-fw-0.9.1 client/hippo/components/shared/FieldSet.jsx
lanes-0.8.3 client/lanes/components/shared/FieldSet.jsx
lanes-0.8.2 client/lanes/components/shared/FieldSet.jsx
lanes-0.8.1 client/lanes/components/shared/FieldSet.jsx
lanes-0.8.0 client/lanes/components/shared/FieldSet.jsx