## Description - Enabled the rule `@typescript-eslint/no-explicit-any` - Suppressed errors with comment ``` // TODO: Fix this the next time the file is edited // eslint-disable-next-line @typescript-eslint/no-explicit-any ``` Fixes #35308 ## Automation /ok-to-test tags="@tag.All" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/10181176984> > Commit: 7fc604e24fa234da7ab2ff56e0b1c715268796ee > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10181176984&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Wed, 31 Jul 2024 15:00:45 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No
71 lines
1.9 KiB
TypeScript
71 lines
1.9 KiB
TypeScript
import React, { memo } from "react";
|
|
import { Icon, IconSize } from "@design-system/widgets-old";
|
|
import { Button } from "@blueprintjs/core";
|
|
import { Colors } from "constants/Colors";
|
|
|
|
import { isEmptyOrNill } from "../../../utils/helpers";
|
|
import { StyledDiv } from "./index.styled";
|
|
import { CLASSNAMES } from "../constants";
|
|
|
|
export interface SelectButtonProps {
|
|
disabled?: boolean;
|
|
displayText?: string;
|
|
handleCancelClick?: (event: React.MouseEvent<Element, MouseEvent>) => void;
|
|
// TODO: Fix this the next time the file is edited
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
spanRef?: any;
|
|
togglePopoverVisibility: () => void;
|
|
tooltipText?: string;
|
|
value?: string;
|
|
hideCancelIcon?: boolean;
|
|
}
|
|
|
|
function SelectButton(props: SelectButtonProps) {
|
|
const {
|
|
disabled,
|
|
displayText,
|
|
handleCancelClick,
|
|
hideCancelIcon,
|
|
spanRef,
|
|
togglePopoverVisibility,
|
|
tooltipText,
|
|
value,
|
|
} = props;
|
|
|
|
return (
|
|
<Button
|
|
className={CLASSNAMES.selectButton}
|
|
data-testid="selectbutton.btn.main"
|
|
disabled={disabled}
|
|
onClick={togglePopoverVisibility}
|
|
rightIcon={
|
|
<StyledDiv>
|
|
{!isEmptyOrNill(value) && !hideCancelIcon ? (
|
|
<Icon
|
|
className="dropdown-icon cancel-icon"
|
|
data-testid="selectbutton.btn.cancel"
|
|
disabled={disabled}
|
|
fillColor={disabled ? Colors.GREY_7 : Colors.GREY_10}
|
|
name="cross"
|
|
onClick={handleCancelClick}
|
|
size={IconSize.XXS}
|
|
/>
|
|
) : null}
|
|
<Icon
|
|
className="dropdown-icon"
|
|
disabled={disabled}
|
|
fillColor={disabled ? Colors.GREY_7 : Colors.GREY_10}
|
|
name="dropdown"
|
|
/>
|
|
</StyledDiv>
|
|
}
|
|
>
|
|
<span ref={spanRef} title={tooltipText}>
|
|
{displayText}
|
|
</span>
|
|
</Button>
|
|
);
|
|
}
|
|
|
|
export default memo(SelectButton);
|