@cimpress/react-components
Version:
React components to support the MCP styleguide
117 lines • 4.84 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importDefault(require("react"));
const react_components_1 = require("@cimpress/react-components");
const radio_jsx_1 = __importDefault(require("!raw-loader!./radio.jsx"));
const radio_jsx_2 = __importDefault(require("./radio.jsx"));
const radioinline_jsx_1 = __importDefault(require("!raw-loader!./radioinline.jsx"));
const radioinline_jsx_2 = __importDefault(require("./radioinline.jsx"));
const TabbedComponentDoc_1 = __importDefault(require("../../shared/TabbedComponentDoc"));
const RadioDocs = () => {
const radioGroupPropInfos = [
{
name: 'inline',
type: 'boolean',
default: 'false',
description: 'If true, radio options will display in a row instead of stacked. If there is not enough width for all options, radios will wrap.',
},
{
name: 'children',
type: 'node',
default: '',
description: (react_1.default.createElement("div", null,
"Pass ",
react_1.default.createElement("code", null, "<Radio />"),
" elements as children to the radio group.")),
},
{
name: 'defaultSelected',
type: 'any',
default: '',
description: 'The default radio group selection. If no default is defined, no radio button will be initially selected.',
},
{
name: 'valueSelected',
type: 'any',
default: '',
description: 'The current selected value of the radio group.',
},
{
name: 'onChange',
type: 'function',
default: '',
description: (react_1.default.createElement("div", null,
react_1.default.createElement("p", null, "Callback function that is fired when the selected radio button changes. "),
react_1.default.createElement("p", null,
"Signature: ",
react_1.default.createElement("code", null,
"function(event: object, value: undefined) ",
'=>',
" void"),
' '),
react_1.default.createElement("p", null,
react_1.default.createElement("code", null, "event:"),
" Change event targeting the radio button."),
react_1.default.createElement("p", null,
react_1.default.createElement("code", null, "value:"),
" Value of the selected radio button",
' '))),
},
];
const propInfos = [
{
name: 'name',
type: 'string',
default: '',
description: 'Name to apply to the child radio buttons.',
},
{
name: 'className',
type: 'string',
default: '',
description: 'Additional classNames to be appended to the parent container of the radio buttons',
},
{
name: 'label',
type: 'string or node',
default: '',
description: 'Label for the radio button.',
},
{
name: 'id',
type: 'string',
default: '',
description: 'ID prop for the input field',
},
{
name: 'value',
type: 'any',
default: '',
description: 'Value of the radio button',
},
{
name: 'disabled',
type: 'boolean',
default: 'false',
description: 'Marks the radio button as disabled',
},
{
name: 'className',
type: 'string',
default: '',
description: 'Additional classNames to be appended to the parent element of the input field',
},
];
return (react_1.default.createElement("div", null,
react_1.default.createElement(TabbedComponentDoc_1.default, { name: "Radio Group", propInfos: radioGroupPropInfos }),
react_1.default.createElement(TabbedComponentDoc_1.default, { name: "Radio", propInfos: propInfos },
react_1.default.createElement(radio_jsx_2.default, null),
react_1.default.createElement(react_components_1.CodeExample, { code: radio_jsx_1.default }),
react_1.default.createElement(radioinline_jsx_2.default, null),
react_1.default.createElement(react_components_1.CodeExample, { code: radioinline_jsx_1.default }))));
};
exports.default = RadioDocs;
//# sourceMappingURL=index.js.map