@mantine/code-highlight
Version:
Code highlight with Mantine theme
48 lines (44 loc) • 1.48 kB
JavaScript
'use client';
;
var jsxRuntime = require('react/jsx-runtime');
var core = require('@mantine/core');
var CodeHighlight_context = require('../CodeHighlight.context.cjs');
const defaultProps = {};
const CodeHighlightControl = core.polymorphicFactory(
(_props, ref) => {
const props = core.useProps("CodeHighlightControl", defaultProps, _props);
const { children, vars, tooltipLabel, ...others } = props;
const ctx = CodeHighlight_context.useCodeHighlightContext();
const tooltipStyles = ctx.getStyles("controlTooltip");
const control = /* @__PURE__ */ jsxRuntime.jsx(
core.ActionIcon,
{
ref,
...ctx.getStyles("control"),
...others,
variant: "none",
"data-code-color-scheme": ctx.codeColorScheme,
children
}
);
if (tooltipLabel) {
return /* @__PURE__ */ jsxRuntime.jsx(
core.Tooltip,
{
label: tooltipLabel,
fz: "sm",
position: "bottom",
classNames: { tooltip: tooltipStyles.className },
styles: { tooltip: tooltipStyles.style },
"data-code-color-scheme": ctx.codeColorScheme,
transitionProps: { duration: 0 },
children: control
}
);
}
return control;
}
);
CodeHighlightControl.displayName = "@mantine/code-highlight/CodeHighlightControl";
exports.CodeHighlightControl = CodeHighlightControl;
//# sourceMappingURL=CodeHighlightControl.cjs.map