UNPKG

@gfazioli/mantine-text-animate

Version:

The TextAnimate component allows you to animate text with various effects.

99 lines (95 loc) 2.06 kB
'use client'; 'use strict'; var core = require('@mantine/core'); var React = require('react'); var useTextTicker = require('./use-text-ticker.cjs'); var TextTicker_module = require('./TextTicker.module.css.cjs'); const defaultProps = { characterSet: "alphanumeric", customCharacters: "", delay: 0, speed: 1, easing: "ease-out", randomChangeSpeed: 1, revealDirection: "left-to-right", initialText: "random", animate: true }; const varsResolver = core.createVarsResolver((_, { delay, speed }) => ({ root: { "--text-ticker-animation-duration": `${1 / (speed || 1)}s`, "--text-ticker-animation-delay": `${delay || 0}s` } })); const TextTicker = core.polymorphicFactory((_props) => { const props = core.useProps("TextTicker", defaultProps, _props); const { value, initialText, animate, characterSet, customCharacters, delay, speed, easing, randomChangeSpeed, revealDirection, scrambleDuration, staggerDelay, onCompleted, classNames, style, styles, unstyled, vars, className, ...others } = props; const { text } = useTextTicker.useTextTicker({ value, initialText, animate, characterSet, customCharacters, delay, speed, easing, randomChangeSpeed, revealDirection, scrambleDuration, staggerDelay, onCompleted }); const getStyles = core.useStyles({ name: "TextTicker", props, classes: TextTicker_module, className, style, classNames, styles, unstyled, vars, varsResolver }); return /* @__PURE__ */ React.createElement( core.Box, { ...getStyles("root", { style: { display: "inline-block", fontFamily: "monospace", whiteSpace: "pre" } }), component: "p", "aria-live": "polite", ...others }, text ); }); TextTicker.classes = TextTicker_module; TextTicker.displayName = "TextTicker"; exports.TextTicker = TextTicker; //# sourceMappingURL=TextTicker.cjs.map