Files
ontime/apps/client/src/views/cuesheet/cuesheet-table/cuesheet-table-elements/TextLikeInput.tsx
T
Carlos Valente 1849b4d39f Deps migration (#1988)
* chore: migrate eslint to oxlint

* chore: migrate prettier to oxfmt

* chore: migrate typescript

* chore: toThrow should have a expected value

* chore: cast test value as Day

* chore: small title fix

* chore: mocks should be hoisted

* chore: incorrect async useage

* chore: test should be inside description

* chore: test sohuld include an expeced

* chore: oxfmt

---------

Co-authored-by: alex-Arc <omnivox@LAPTOP-RC5SNBVV.localdomain>
2026-03-08 16:22:12 +01:00

46 lines
1.1 KiB
TypeScript

import { HTMLAttributes, PropsWithChildren, forwardRef, memo, useImperativeHandle, useRef } from 'react';
import { cx } from '../../../../common/utils/styleUtils';
import style from './TextLikeInput.module.scss';
interface TextLikeInputProps extends HTMLAttributes<HTMLSpanElement> {
offset?: 'over' | 'under' | 'muted' | null;
muted?: boolean;
disabled?: boolean;
}
const TextLikeInput = forwardRef(
(
{ offset, muted, disabled, children, className, ...elementProps }: PropsWithChildren<TextLikeInputProps>,
textRef,
) => {
const ref = useRef<HTMLDivElement | null>(null);
const classes = cx([
style.textInput,
offset && style[offset],
muted && style.muted,
disabled && style.disabled,
className,
]);
useImperativeHandle(textRef, () => {
return {
focusParentElement() {
ref.current?.parentElement?.focus();
},
};
});
return (
<div className={classes} tabIndex={disabled ? -1 : 0} {...elementProps} ref={ref}>
{children}
</div>
);
},
);
TextLikeInput.displayName = 'TextLikeInput';
export default memo(TextLikeInput);