@arolariu/components
Version:
🎨 60+ beautiful, accessible React components built on Radix UI. TypeScript-first, tree-shakeable, SSR-ready. Perfect for modern web apps, design systems & rapid prototyping. Zero config, maximum flexibility! ⚡
74 lines (73 loc) • 2.82 kB
JavaScript
"use client";
;
var __webpack_require__ = {};
(()=>{
__webpack_require__.d = (exports1, definition)=>{
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
enumerable: true,
get: definition[key]
});
};
})();
(()=>{
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
})();
(()=>{
__webpack_require__.r = (exports1)=>{
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
value: 'Module'
});
Object.defineProperty(exports1, '__esModule', {
value: true
});
};
})();
var __webpack_exports__ = {};
__webpack_require__.r(__webpack_exports__);
__webpack_require__.d(__webpack_exports__, {
HighlightText: ()=>HighlightText
});
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
const external_react_namespaceObject = require("react");
const react_namespaceObject = require("motion/react");
const utils_cjs_namespaceObject = require("../../lib/utils.cjs");
const animation = {
backgroundSize: "100% 100%"
};
const HighlightText = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ text, className, inView = false, inViewMargin = "0px", transition = {
duration: 2,
ease: "easeInOut"
}, ...props }, ref)=>{
const localRef = external_react_namespaceObject.useRef(null);
external_react_namespaceObject.useImperativeHandle(ref, ()=>localRef.current);
const inViewResult = (0, react_namespaceObject.useInView)(localRef, {
once: true,
margin: inViewMargin
});
const isInView = !inView || inViewResult;
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_namespaceObject.motion.span, {
ref: localRef,
initial: {
backgroundSize: "0% 100%"
},
animate: isInView ? animation : void 0,
transition: transition,
style: {
backgroundRepeat: "no-repeat",
backgroundPosition: "left center",
display: "inline"
},
className: (0, utils_cjs_namespaceObject.cn)("relative inline-block px-2 py-1 rounded-lg bg-gradient-to-r from-blue-100 to-purple-100 dark:from-blue-500 dark:to-purple-500", className),
...props,
children: text
});
});
HighlightText.displayName = "HighlightText";
exports.HighlightText = __webpack_exports__.HighlightText;
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
"HighlightText"
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
Object.defineProperty(exports, '__esModule', {
value: true
});
//# sourceMappingURL=highlight-text.cjs.map