Files
decky-frontend-lib/src/components/ButtonItem.ts

17 lines
624 B
TypeScript
Raw Normal View History

import { FC } from 'react';
import { CommonUIModule } from '../webpack';
import { ItemProps } from './Item';
2024-06-26 22:28:58 -04:00
import { createPropListRegex } from '../utils';
export interface ButtonItemProps extends ItemProps {
onClick?(e: MouseEvent): void;
disabled?: boolean;
}
2024-06-26 22:28:58 -04:00
const buttonItemRegex = createPropListRegex(["highlightOnFocus", "childrenContainerWidth"], false);
2024-05-12 15:48:13 -04:00
export const ButtonItem = Object.values(CommonUIModule).find(
(mod: any) =>
2024-06-26 22:28:58 -04:00
(mod?.render?.toString && buttonItemRegex.test(mod.render.toString())) ||
mod?.render?.toString?.().includes('childrenContainerWidth:"min"'),
2024-05-12 15:48:13 -04:00
) as FC<ButtonItemProps>;