UNPKG

@modern-kit/react

Version:
65 lines (55 loc) 1.84 kB
'use strict'; var jsxRuntime = require('react/jsx-runtime'); var utilsPolymorphicForwardRef = require('../../utils/polymorphicForwardRef/index.cjs'); var componentsSlot = require('../Slot/index.cjs'); var classNames = require('classnames'); require('react'); require('../../hooks/useMergeRefs/index.cjs'); require('../../utils/mergeRefs/index.cjs'); require('@modern-kit/utils'); function styleInject(css, ref) { if ( ref === void 0 ) ref = {}; var insertAt = ref.insertAt; if (typeof document === 'undefined') { return; } var head = document.head || document.getElementsByTagName('head')[0]; var style = document.createElement('style'); style.type = 'text/css'; if (insertAt === 'top') { if (head.firstChild) { head.insertBefore(style, head.firstChild); } else { head.appendChild(style); } } else { head.appendChild(style); } if (style.styleSheet) { style.styleSheet.cssText = css; } else { style.appendChild(document.createTextNode(css)); } } var css_248z = ".AspectRatio-modules_aspectRatioWrapper__x4FNF>*{display:block;width:100%}"; var styles = {"aspectRatioWrapper":"AspectRatio-modules_aspectRatioWrapper__x4FNF"}; styleInject(css_248z); const AspectRatio = utilsPolymorphicForwardRef.polymorphicForwardRef( ({ ratio, style, as = "div", asChild = false, ...props }, ref) => { const AspectRatioWrapper = asChild ? componentsSlot.Slot : as; const slotStyle = { aspectRatio: ratio, ...style }; const className = asChild ? props.className : classNames(styles.aspectRatioWrapper, props.className); return /* @__PURE__ */ jsxRuntime.jsx( AspectRatioWrapper, { ref, style: slotStyle, className, ...props } ); } ); exports.AspectRatio = AspectRatio; //# sourceMappingURL=index.cjs.map