Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/forms / build / dist / src / new-forms / plugins / RadioGroupPlugin.js
Size: Mime:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const React = require("react");
const mobx_react_1 = require("xmobx/mobx-react");
const ToggleList_1 = require("@skava/ui/dist/components/molecules/ToggleList");
const common_1 = require("@skava/ui/dist/state/common");
const list = [
    {
        isSelected: false,
        label: 'Regular',
        value: 'regular',
    },
    {
        isSelected: false,
        label: 'Medium',
        value: 'medium',
    },
].map(item => common_1.toCommonState(item));
let RadioGroupPlugin = class RadioGroupPlugin extends React.Component {
    static isSatisfiedByProps(props) {
        return props.type === 'radioGroup';
    }
    render() {
        const { state } = this.props;
        const title = 'radio list title';
        return (React.createElement(React.Fragment, null,
            React.createElement("label", { htmlFor: state.identifier }, title),
            React.createElement(ToggleList_1.ToggleList, { breedType: "radio", id: state.identifier, list: list, title: title })));
    }
};
/**
 * @todo ensure 1 is selected if required?
 */
RadioGroupPlugin.defaultState = (inputState) => {
    const validator = (value) => inputState.attributes.required;
    return {
        validator,
    };
};
RadioGroupPlugin = tslib_1.__decorate([
    mobx_react_1.observer
], RadioGroupPlugin);
exports.RadioGroupPlugin = RadioGroupPlugin;
exports.default = RadioGroupPlugin;
//# sourceMappingURL=RadioGroupPlugin.js.map