@aappddeevv/dynamics-client-ui
Version:
## What is it? A library to help you create great dynamics applications.
28 lines • 1.42 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const React = require("react");
const react_radio_group_1 = require("react-radio-group");
function RadioBoxItem(_a) {
var { value, label } = _a, rest = tslib_1.__rest(_a, ["value", "label"]);
return (React.createElement("div", Object.assign({ style: { height: 20 } }, rest),
React.createElement("label", null,
React.createElement(react_radio_group_1.Radio, { value: value }),
label)));
}
exports.RadioBoxItem = RadioBoxItem;
/** Render items vertically using a flexbox . */
function DefaultComponent(_a) {
var { children } = _a, rest = tslib_1.__rest(_a, ["children"]);
return (React.createElement("div", Object.assign({ style: { display: "flex", flexDirection: "column" } }, rest), children));
}
exports.DefaultComponent = DefaultComponent;
function RadioSelect(_a) {
var { options, Component } = _a, rest = tslib_1.__rest(_a, ["options", "Component"]);
const content = (options || []).map(opt => React.createElement(RadioBoxItem, Object.assign({ key: opt.value.toString() }, opt)));
const c = Component || DefaultComponent;
return (React.createElement(react_radio_group_1.RadioGroup, Object.assign({ Component: c }, rest), content));
}
exports.RadioSelect = RadioSelect;
exports.default = RadioSelect;
//# sourceMappingURL=RadioSelect.js.map