UNPKG

@open-formulieren/formio-builder

Version:

An opinionated Formio webform builder for Open Forms

13 lines (12 loc) 1.16 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { FormattedMessage } from 'react-intl'; import { CheckboxInput } from './checkbox'; import Component from './component'; import Description from './description'; export const SelectBoxes = ({ name, options, label, required = false, tooltip = '', description = '', isLoading = false, }) => { if (isLoading) { return (_jsx(FormattedMessage, { id: 'BFq6vL', defaultMessage: [{ type: 0, value: "Loading values..." }] })); } return (_jsxs(Component, Object.assign({ type: "selectboxes", field: name, label: label, tooltip: tooltip, required: required }, { children: [_jsx("div", Object.assign({ className: "form-radio radio" }, { children: options.map(({ value, label, description }, index) => (_jsx("div", Object.assign({ className: "form-check" }, { children: _jsx("label", Object.assign({ className: "form-check-label" }, { children: _jsx(CheckboxInput, { name: `${name}.${value}`, label: label, optionDescription: description }) })) }), `option-${value}-${index}`))) })), description && _jsx(Description, { text: description })] }))); }; export default SelectBoxes;