@open-formulieren/formio-builder
Version:
An opinionated Formio webform builder for Open Forms
9 lines (8 loc) • 1.04 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { FormattedMessage } from 'react-intl';
const CharCount = ({ value, maxLength }) => {
const hasMaxLength = maxLength !== undefined;
const msg = hasMaxLength ? (_jsx(FormattedMessage, { id: 'CZ4Fby', defaultMessage: [{ type: 1, value: "length" }, { type: 0, value: " " }, { type: 6, value: "length", options: { one: { value: [{ type: 0, value: "character remaining" }] }, other: { value: [{ type: 0, value: "characters remaining" }] } }, offset: 0, pluralType: "cardinal" }], values: { length: maxLength - value.length } })) : (_jsx(FormattedMessage, { id: '5dp5j+', defaultMessage: [{ type: 1, value: "length" }, { type: 0, value: " " }, { type: 6, value: "length", options: { one: { value: [{ type: 0, value: "character" }] }, other: { value: [{ type: 0, value: "characters" }] } }, offset: 0, pluralType: "cardinal" }], values: { length: value.length } }));
return _jsx("span", Object.assign({ className: "text-muted" }, { children: msg }));
};
export default CharCount;