mirror of
https://github.com/zoriya/v10.git
synced 2026-08-11 00:19:28 +00:00
25 lines
904 B
JavaScript
25 lines
904 B
JavaScript
"use client";
|
|
import { renderElement } from "../../utils/use-render.js";
|
|
import { useTooltipContext } from "./context.js";
|
|
import { forwardRef } from "react";
|
|
//#region src/ui/tooltip/tooltip-shortcut.tsx
|
|
/** Keyboard shortcut hint; apply skin `className` (CSS: `media-tooltip__kbd`; Tailwind: `popup.tooltipShortcut`). */
|
|
const TooltipShortcut = forwardRef(function TooltipShortcut({ render, className, style, children, ...elementProps }, forwardedRef) {
|
|
const { state, stateAttrMap, content } = useTooltipContext();
|
|
const shortcut = children !== void 0 && children !== null ? children : content?.shortcut ?? null;
|
|
if (!shortcut) return null;
|
|
return renderElement("kbd", {
|
|
render,
|
|
className,
|
|
style
|
|
}, {
|
|
state,
|
|
stateAttrMap,
|
|
ref: forwardedRef,
|
|
props: [elementProps, { children: shortcut }]
|
|
});
|
|
});
|
|
//#endregion
|
|
export { TooltipShortcut };
|
|
|
|
//# sourceMappingURL=tooltip-shortcut.js.map
|