/* @oracle/oraclejet-preact: undefined */
import { jsxs, Fragment, jsx } from 'preact/jsx-runtime';
import { u as useTooltipOnTruncation } from './useTooltipOnTruncation-175bf8a6.js';
import './TabbableModeContext-7d8ad946.js';
import { u as useTabbableMode } from './useTabbableMode-a3a351d0.js';
import { c as classNames } from './classNames-4e12b00d.js';
import { m as mergeInterpolations } from './mergeInterpolations-e2db2a66.js';
import { multiVariantStyles, styles } from './UNSAFE_Text/themes/TextStyles.css.js';
import { g as getClientHints } from './clientHints-f850225e.js';

const interpolations = [
    ({ lineClamp }) => !lineClamp ? {} : { class: styles.lineClamp, webkitLineClamp: lineClamp }
];
const styleInterpolations = mergeInterpolations(interpolations);
function TruncatingText({ children, hyphens, size, truncation, variant = 'inherit', weight, overflowWrap = 'anywhere', ...props }) {
    const clientHints = getClientHints();
    const variantClasses = multiVariantStyles({
        hyphens,
        size,
        truncation,
        variant,
        weight,
        overflowWrap,
        safariStyles: clientHints.browser === 'safari' ? 'needs' : 'noNeed'
    });
    const { class: interpolatedClasses, ...styles } = styleInterpolations(props);
    const classes = classNames([variantClasses, interpolatedClasses]);
    const { isTabbable } = useTabbableMode();
    const { tooltipOnTruncationProps, tooltipContent, isTextTruncated } = useTooltipOnTruncation(children, variant === 'disabled');
    return (jsxs(Fragment, { children: [jsx("span", { ...tooltipOnTruncationProps, tabIndex: isTextTruncated && isTabbable ? 0 : -1, class: classes, style: styles, id: props.id, children: children }), tooltipContent] }));
}

export { TruncatingText as T };
//# sourceMappingURL=TruncatingText-fd66e0e0.js.map
