2022-05-25 20:26:30 -04:00
|
|
|
import { FC } from 'react';
|
|
|
|
|
|
|
|
|
|
import { CommonUIModule } from '../webpack';
|
2022-06-08 19:24:46 +02:00
|
|
|
import { ItemProps } from './Item';
|
2024-06-26 22:28:58 -04:00
|
|
|
import { createPropListRegex } from '../utils';
|
2022-05-25 20:26:30 -04:00
|
|
|
|
2022-06-08 19:24:46 +02:00
|
|
|
export interface ButtonItemProps extends ItemProps {
|
2022-05-25 20:26:30 -04:00
|
|
|
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>;
|