UNPKG

wix-style-react

Version:
21 lines 1.12 kB
import React from 'react'; import { dataHooks } from '../../constants'; import Text from '../../../Text'; import { SIZES, SKINS, WEIGHTS } from '../../../Text/constants'; import { st, classes } from './Suffix.st.css'; const CharactersLeft = ({ lengthLeft, labelSize, }) => { if (lengthLeft === undefined) return null; const colorProps = lengthLeft >= 0 ? { light: true, secondary: true } : { skin: SKINS.error }; return (React.createElement(Text, { className: st(classes.charCount, { labelSize, }), size: SIZES.small, weight: WEIGHTS.normal, ...colorProps, dataHook: dataHooks.counter, children: lengthLeft })); }; const Suffix = ({ suffix, charCount, labelPlacement, hasInlineElements, labelSize, }) => { return (React.createElement("div", { "aria-hidden": true, "data-hook": dataHooks.suffix, className: st(classes.root, { noLabel: labelPlacement !== 'top', hasInlineElements, }) }, suffix ?? (React.createElement(CharactersLeft, { lengthLeft: charCount, labelSize: labelSize })))); }; export default Suffix; //# sourceMappingURL=Suffix.js.map