diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/flyout/dynamic_rule_form_flyout.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/flyout/dynamic_rule_form_flyout.tsx index 74766b8aa54c9..b6c73e5b0ee20 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/flyout/dynamic_rule_form_flyout.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/flyout/dynamic_rule_form_flyout.tsx @@ -34,12 +34,12 @@ export interface DynamicRuleFormFlyoutProps { * the loading state of its footer buttons. The time field is automatically * derived from the query's available date fields. */ -const DynamicRuleFormFlyoutInner: React.FC = ({ +const DynamicRuleFormFlyoutInner = ({ push, onClose, query, services, -}) => { +}: DynamicRuleFormFlyoutProps) => { const { createRule, isLoading } = useCreateRule({ http: services.http, notifications: services.notifications, @@ -62,7 +62,7 @@ const DynamicRuleFormFlyoutInner: React.FC = ({ ); }; -export const DynamicRuleFormFlyout: React.FC = (props) => { +export const DynamicRuleFormFlyout = (props: DynamicRuleFormFlyoutProps) => { const queryClient = useMemo(() => new QueryClient(), []); return ( diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/flyout/error_callout.test.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/flyout/error_callout.test.tsx index 18755a7b25d65..1d76fb064324e 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/flyout/error_callout.test.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/flyout/error_callout.test.tsx @@ -13,11 +13,15 @@ import type { FormValues } from '../form/types'; import { ErrorCallOut } from './error_callout'; // Wrapper component that provides form context with configurable state -const TestWrapper: React.FC<{ +const TestWrapper = ({ + errors = {}, + isSubmitted = false, + children, +}: { errors?: FieldErrors; isSubmitted?: boolean; children: React.ReactNode; -}> = ({ errors = {}, isSubmitted = false, children }) => { +}) => { const methods = useForm({ defaultValues: { kind: 'alert', diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/flyout/error_callout.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/flyout/error_callout.tsx index d1531e0cda3e3..3a1ae100632cf 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/flyout/error_callout.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/flyout/error_callout.tsx @@ -34,7 +34,7 @@ const extractErrorMessages = (errors: FieldErrors): string[] => { return messages; }; -export const ErrorCallOut: React.FC = () => { +export const ErrorCallOut = () => { const { formState: { errors, isSubmitted }, } = useFormContext(); diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/flyout/index.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/flyout/index.tsx index c4f640eaf9613..0bffa8a7b557d 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/flyout/index.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/flyout/index.tsx @@ -34,21 +34,21 @@ const LazyStandaloneRuleFormFlyout = React.lazy(() => export { LazyDynamicRuleFormFlyout, LazyStandaloneRuleFormFlyout, LazyRuleFormFlyout }; /** Base flyout wrapper - use with DynamicRuleForm or StandaloneRuleForm as children */ -export const RuleFormFlyout: React.FC = (props) => ( +export const RuleFormFlyout = (props: RuleFormFlyoutProps) => ( }> ); /** Pre-composed flyout for Discover integration - syncs with external query changes */ -export const DynamicRuleFormFlyout: React.FC = (props) => ( +export const DynamicRuleFormFlyout = (props: DynamicRuleFormFlyoutProps) => ( }> ); /** Pre-composed flyout for classic experience - static initialization */ -export const StandaloneRuleFormFlyout: React.FC = (props) => ( +export const StandaloneRuleFormFlyout = (props: StandaloneRuleFormFlyoutProps) => ( }> diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/flyout/rule_form_flyout.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/flyout/rule_form_flyout.tsx index ba86b88d8e794..30dbf1a2597e4 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/flyout/rule_form_flyout.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/flyout/rule_form_flyout.tsx @@ -35,12 +35,12 @@ export interface RuleFormFlyoutProps { * Use DynamicRuleFormFlyout or StandaloneRuleFormFlyout for pre-composed * flyouts that handle form submission and state management. */ -export const RuleFormFlyout: React.FC = ({ +export const RuleFormFlyout = ({ push = true, onClose, isLoading = false, children, -}) => { +}: RuleFormFlyoutProps) => { return ( = ({ +const StandaloneRuleFormFlyoutInner = ({ push, onClose, query, services, -}) => { +}: StandaloneRuleFormFlyoutProps) => { const { createRule, isLoading } = useCreateRule({ http: services.http, notifications: services.notifications, @@ -62,7 +62,7 @@ const StandaloneRuleFormFlyoutInner: React.FC = ( ); }; -export const StandaloneRuleFormFlyout: React.FC = (props) => { +export const StandaloneRuleFormFlyout = (props: StandaloneRuleFormFlyoutProps) => { const queryClient = useMemo(() => new QueryClient(), []); return ( diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/components/edit_mode_toggle.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/components/edit_mode_toggle.tsx index 460ebe9afebbf..f1fb167a2f2a9 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/components/edit_mode_toggle.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/components/edit_mode_toggle.tsx @@ -36,7 +36,7 @@ const toggleButtons = [ }, ]; -export const EditModeToggle: React.FC = ({ editMode, onChange, disabled }) => { +export const EditModeToggle = ({ editMode, onChange, disabled }: EditModeToggleProps) => { const handleChange = (optionId: string) => { onChange(optionId as EditMode); }; diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/contexts/rule_form_context.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/contexts/rule_form_context.tsx index 2282403dedae1..3dbc7800c7884 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/contexts/rule_form_context.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/contexts/rule_form_context.tsx @@ -40,9 +40,11 @@ const RuleFormContext = createContext(undefine * * `meta` defaults to `{ layout: 'page' }` when omitted. */ -export const RuleFormProvider: React.FC< - PropsWithChildren<{ services: RuleFormServices; meta?: RuleFormMeta }> -> = ({ children, services, meta = DEFAULT_META }) => { +export const RuleFormProvider = ({ + children, + services, + meta = DEFAULT_META, +}: PropsWithChildren<{ services: RuleFormServices; meta?: RuleFormMeta }>) => { const value = useMemo(() => ({ services, meta }), [services, meta]); return {children}; }; diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/dynamic_rule_form.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/dynamic_rule_form.tsx index 54a9aa64fd34c..942abeae118b9 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/dynamic_rule_form.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/dynamic_rule_form.tsx @@ -52,7 +52,7 @@ export interface DynamicRuleFormProps { * Uses react-hook-form's `values` prop to sync form state on each prop change, * with `resetOptions: { keepDirtyValues: true }` to preserve user input. */ -export const DynamicRuleForm: React.FC = ({ +export const DynamicRuleForm = ({ query, services, layout, @@ -65,7 +65,7 @@ export const DynamicRuleForm: React.FC = ({ onCancel, submitLabel, cancelLabel, -}) => { +}: DynamicRuleFormProps) => { // Get default form values derived from the query const formValues = useFormDefaults({ query }); diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/field_groups/alert_conditions_field_group.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/field_groups/alert_conditions_field_group.tsx index e87d857d76838..f9fea8ee6a039 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/field_groups/alert_conditions_field_group.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/field_groups/alert_conditions_field_group.tsx @@ -32,7 +32,7 @@ import { RecoveryDelayField } from '../fields/recovery_delay_field'; * uses RecoveryBaseQueryOnlyField (full ES|QL editor with "not same as eval" validation) * - Recovery delay (recovering state transition: immediate / breaches / duration) */ -export const AlertConditionsFieldGroup: React.FC = () => { +export const AlertConditionsFieldGroup = () => { const { control } = useFormContext(); const { data } = useRuleFormServices(); const kind = useWatch({ control, name: 'kind' }); diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/field_groups/condition_field_group.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/field_groups/condition_field_group.tsx index 118d53a09c251..0c2acdc3b74a4 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/field_groups/condition_field_group.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/field_groups/condition_field_group.tsx @@ -35,9 +35,7 @@ interface ConditionFieldGroupProps { * The base query defines what data is being evaluated, while the * condition field defines the threshold or filter that triggers alerts. */ -export const ConditionFieldGroup: React.FC = ({ - includeBase = false, -}) => { +export const ConditionFieldGroup = ({ includeBase = false }: ConditionFieldGroupProps) => { const { control } = useFormContext(); // Read the base query from form state (initialized via useFormDefaults) diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/field_groups/field_group.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/field_groups/field_group.tsx index 497fd47bd3278..432cc024a54bb 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/field_groups/field_group.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/field_groups/field_group.tsx @@ -13,7 +13,7 @@ interface FieldGroupProps { children: React.ReactNode; } -export const FieldGroup: React.FC = ({ title, children }) => { +export const FieldGroup = ({ title, children }: FieldGroupProps) => { return ( diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/field_groups/rule_details_field_group.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/field_groups/rule_details_field_group.tsx index 9afd450f9d0c7..12b3e96f32498 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/field_groups/rule_details_field_group.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/field_groups/rule_details_field_group.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { TagsField } from '../fields/tags_field'; import { DescriptionField } from '../fields/description_field'; -export const RuleDetailsFieldGroup: React.FC = () => { +export const RuleDetailsFieldGroup = () => { return ( <> diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/field_groups/rule_execution_field_group.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/field_groups/rule_execution_field_group.tsx index 5b4930eacf285..3bb86d11f77c4 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/field_groups/rule_execution_field_group.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/field_groups/rule_execution_field_group.tsx @@ -11,7 +11,7 @@ import { FieldGroup } from './field_group'; import { ScheduleField } from '../fields/schedule_field'; import { LookbackWindowField } from '../fields/lookback_window_field'; -export const RuleExecutionFieldGroup: React.FC = () => { +export const RuleExecutionFieldGroup = () => { return ( { +export const AlertDelayField = () => { const { control, setValue } = useFormContext(); const stateTransition = useWatch({ control, name: 'stateTransition' }); const [selectedMode, setSelectedMode] = useState(deriveMode(stateTransition)); diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/description_field.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/description_field.tsx index b05558dfc6764..524667325ccee 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/description_field.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/description_field.tsx @@ -13,7 +13,7 @@ import type { FormValues } from '../types'; const DESCRIPTION_ROW_ID = 'ruleV2FormDescriptionField'; -export const DescriptionField: React.FC = () => { +export const DescriptionField = () => { const { control, watch } = useFormContext(); const descriptionValue = watch('metadata.description'); diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/enabled_field.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/enabled_field.tsx index 0828a8672967c..7ffd47106d41f 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/enabled_field.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/enabled_field.tsx @@ -11,7 +11,7 @@ import { EuiFormRow, EuiSwitch } from '@elastic/eui'; import { Controller, useFormContext } from 'react-hook-form'; import type { FormValues } from '../types'; -export const EnabledField: React.FC = () => { +export const EnabledField = () => { const { control } = useFormContext(); return ( diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/esql_editor_field.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/esql_editor_field.tsx index 6c018ab3caa0a..d1a388bb2d7ad 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/esql_editor_field.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/esql_editor_field.tsx @@ -78,7 +78,7 @@ export interface EsqlEditorFieldProps { * /> * ``` */ -export const EsqlEditorField: React.FC = ({ +export const EsqlEditorField = ({ name, label, labelTooltip, @@ -91,7 +91,7 @@ export const EsqlEditorField: React.FC = ({ rules, errors: serverErrors, warning: serverWarning, -}) => { +}: EsqlEditorFieldProps) => { const { control } = useFormContext(); const labelElement = label ? ( diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/evaluation_query_field.test.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/evaluation_query_field.test.tsx index 71c40b8d331be..6483f4d7ea13c 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/evaluation_query_field.test.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/evaluation_query_field.test.tsx @@ -94,7 +94,7 @@ describe('EvaluationQueryField', () => { it('shows required error when submitted with empty value', async () => { const queryClient = createTestQueryClient(); - const WrapperWithSubmit: React.FC<{ children: React.ReactNode }> = ({ children }) => { + const WrapperWithSubmit = ({ children }: { children: React.ReactNode }) => { const form = useForm({ defaultValues: { ...defaultTestFormValues, @@ -131,7 +131,7 @@ describe('EvaluationQueryField', () => { it('shows validation error for invalid ES|QL query syntax', async () => { const queryClient = createTestQueryClient(); - const WrapperWithSubmit: React.FC<{ children: React.ReactNode }> = ({ children }) => { + const WrapperWithSubmit = ({ children }: { children: React.ReactNode }) => { const form = useForm({ defaultValues: { ...defaultTestFormValues, @@ -168,7 +168,7 @@ describe('EvaluationQueryField', () => { it('shows validation error for incomplete query', async () => { const queryClient = createTestQueryClient(); - const WrapperWithSubmit: React.FC<{ children: React.ReactNode }> = ({ children }) => { + const WrapperWithSubmit = ({ children }: { children: React.ReactNode }) => { const form = useForm({ defaultValues: { ...defaultTestFormValues, diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/evaluation_query_field.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/evaluation_query_field.tsx index 956a8ee6389e0..322413fdc8174 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/evaluation_query_field.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/evaluation_query_field.tsx @@ -17,9 +17,9 @@ interface EvaluationQueryFieldProps { height?: string | number; } -export const EvaluationQueryField: React.FC = ({ +export const EvaluationQueryField = ({ height = EDITOR_HEIGHT_INLINE, -}) => { +}: EvaluationQueryFieldProps) => { return ( { +export const GroupFieldSelect = () => { const { data } = useRuleFormServices(); const { control, setValue, getValues } = useFormContext(); const query = useWatch({ name: 'evaluation.query.base', control }); diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/kind_field.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/kind_field.tsx index 68a9bd2ec5543..e5a3ebb7fcefb 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/kind_field.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/kind_field.tsx @@ -13,7 +13,7 @@ import type { FormValues } from '../types'; const CARD_ID = 'ruleV2KindField'; -export const KindField: React.FC = () => { +export const KindField = () => { const { control } = useFormContext(); return ( diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/lookback_window_field.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/lookback_window_field.tsx index d1c01d91e658e..586ef7b39331d 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/lookback_window_field.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/lookback_window_field.tsx @@ -14,7 +14,7 @@ import { LookbackWindow } from './lookback_window'; const LOOKBACK_WINDOW_ROW_ID = 'ruleV2FormLookbackWindowField'; -export const LookbackWindowField: React.FC = () => { +export const LookbackWindowField = () => { const { control } = useFormContext(); return ( diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/name_field.test.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/name_field.test.tsx index 9ec1bbabc4ced..f4ca9a70c263a 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/name_field.test.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/name_field.test.tsx @@ -64,7 +64,7 @@ describe('NameField', () => { it('shows required error when submitted with empty value', async () => { const queryClient = createTestQueryClient(); - const WrapperWithSubmit: React.FC<{ children: React.ReactNode }> = ({ children }) => { + const WrapperWithSubmit = ({ children }: { children: React.ReactNode }) => { const form = useForm({ defaultValues: defaultTestFormValues, }); diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/name_field.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/name_field.tsx index 390d7e24c8485..bba48bf3ed812 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/name_field.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/name_field.tsx @@ -16,7 +16,7 @@ const DEFAULT_NAME = i18n.translate('xpack.alertingV2.ruleForm.defaultRuleName', defaultMessage: 'Untitled rule', }); -export const NameField: React.FC = () => { +export const NameField = () => { const { control } = useFormContext(); const { euiTheme } = useEuiTheme(); const editTitleId = useGeneratedHtmlId({ prefix: 'ruleNameInlineEdit' }); diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/query_results_grid.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/query_results_grid.tsx index 59e9d8f19135f..abeebfed80e89 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/query_results_grid.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/query_results_grid.tsx @@ -74,7 +74,7 @@ export interface QueryResultsGridProps { * * Used by both the rule preview and recovery preview components. */ -export const QueryResultsGrid: React.FC = ({ +export const QueryResultsGrid = ({ title, dataTestSubj, emptyBody, @@ -88,7 +88,7 @@ export const QueryResultsGrid: React.FC = ({ groupingFields = [], uniqueGroupCount, hasValidQuery = false, -}) => { +}: QueryResultsGridProps) => { const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: DEFAULT_PAGE_SIZE }); const onChangeItemsPerPage = useCallback( diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_base_and_condition_field.test.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_base_and_condition_field.test.tsx index fc7feadfa8765..64ec71e39e774 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_base_and_condition_field.test.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_base_and_condition_field.test.tsx @@ -46,7 +46,7 @@ jest.mock('./recovery_base_query_field', () => ({ * Helper to capture the form instance so tests can call getValues() directly. */ let formRef: UseFormReturn | undefined; -const FormRefCapture: React.FC = () => { +const FormRefCapture = () => { formRef = useFormContext(); return null; }; diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_base_and_condition_field.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_base_and_condition_field.tsx index 4e6215c15405a..8a3f89b6969b0 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_base_and_condition_field.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_base_and_condition_field.tsx @@ -37,9 +37,9 @@ interface RecoveryBaseAndConditionFieldProps { * Validation logic is provided by the `useRecoveryValidation` hook via the * `validation` prop. Seeding and field management are handled locally. */ -export const RecoveryBaseAndConditionField: React.FC = ({ +export const RecoveryBaseAndConditionField = ({ validation, -}) => { +}: RecoveryBaseAndConditionFieldProps) => { const { getValues, setValue } = useFormContext(); const { recoveryBaseQuery, diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_base_query_field.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_base_query_field.tsx index c2ea49efa4b52..b4667383af90c 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_base_query_field.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_base_query_field.tsx @@ -35,12 +35,12 @@ interface RecoveryBaseQueryFieldProps { * All validation logic (syntax, grouping, differs-from-evaluation) is provided * externally via the `rules` and `errors` props from the `useRecoveryValidation` hook. */ -export const RecoveryBaseQueryField: React.FC = ({ +export const RecoveryBaseQueryField = ({ labelTooltip = DEFAULT_TOOLTIP, dataTestSubj = 'recoveryQueryField', rules, errors, -}) => { +}: RecoveryBaseQueryFieldProps) => { return ( ({ * Helper to capture the form instance so tests can call getValues() directly. */ let formRef: UseFormReturn | undefined; -const FormRefCapture: React.FC = () => { +const FormRefCapture = () => { formRef = useFormContext(); return null; }; diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_base_query_only_field.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_base_query_only_field.tsx index d89897f214f23..f3908381e90a8 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_base_query_only_field.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_base_query_only_field.tsx @@ -26,9 +26,7 @@ interface RecoveryBaseQueryOnlyFieldProps { * Validation logic is provided by the `useRecoveryValidation` hook via the * `validation` prop. Seeding is handled locally on mount. */ -export const RecoveryBaseQueryOnlyField: React.FC = ({ - validation, -}) => { +export const RecoveryBaseQueryOnlyField = ({ validation }: RecoveryBaseQueryOnlyFieldProps) => { const { fullBaseQueryRules, groupingValidationError } = validation; const { getValues, setValue } = useFormContext(); diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_delay_field.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_delay_field.tsx index 6192e5d4f690a..70b1f4b9cfcd9 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_delay_field.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_delay_field.tsx @@ -48,7 +48,7 @@ const deriveMode = (stateTransition?: { return 'immediate'; }; -export const RecoveryDelayField: React.FC = () => { +export const RecoveryDelayField = () => { const { control, setValue } = useFormContext(); const stateTransition = useWatch({ control, name: 'stateTransition' }); const [selectedMode, setSelectedMode] = useState(deriveMode(stateTransition)); diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_results_preview.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_results_preview.tsx index 4dda045128272..d5041983c283e 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_results_preview.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_results_preview.tsx @@ -17,7 +17,7 @@ import { QueryResultsGrid } from './query_results_grid'; * the recovery policy type is `'query'`. Delegates grid rendering to * `QueryResultsGrid`. */ -export const RecoveryResultsPreview: React.FC = () => { +export const RecoveryResultsPreview = () => { const { columns, rows, diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_type_field.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_type_field.tsx index 38d9690763e65..eb48a7fceb8ad 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_type_field.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/recovery_type_field.tsx @@ -34,7 +34,7 @@ const RECOVERY_TYPE_OPTIONS: Array<{ value: RecoveryPolicyType; text: string }> * - `no_breach`: Alert recovers when the evaluation condition is no longer breached * - `query`: Alert recovers when a custom ES|QL recovery query matches */ -export const RecoveryTypeField: React.FC = () => { +export const RecoveryTypeField = () => { const { control } = useFormContext(); return ( diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/rule_preview_panel.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/rule_preview_panel.tsx index 0506e543a751f..7fe541257c0c4 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/rule_preview_panel.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/rule_preview_panel.tsx @@ -22,7 +22,7 @@ import { RecoveryResultsPreview } from './recovery_results_preview'; * - **Flyout layout**: Renders a trigger button that opens a nested flyout * containing both previews. */ -export const RulePreviewPanel: React.FC = () => { +export const RulePreviewPanel = () => { const { layout } = useRuleFormMeta(); const { control } = useFormContext(); const recoveryType = useWatch({ control, name: 'recoveryPolicy.type' }); @@ -45,7 +45,7 @@ export const RulePreviewPanel: React.FC = () => { return ; }; -const FlyoutPreview: React.FC<{ showRecoveryPreview: boolean }> = ({ showRecoveryPreview }) => { +const FlyoutPreview = ({ showRecoveryPreview }: { showRecoveryPreview: boolean }) => { const [isOpen, setIsOpen] = useState(false); const openFlyout = useCallback(() => setIsOpen(true), []); diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/rule_results_preview.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/rule_results_preview.tsx index 15ff791c3a2b7..5981b40c4b3a4 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/rule_results_preview.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/rule_results_preview.tsx @@ -16,7 +16,7 @@ import { QueryResultsGrid } from './query_results_grid'; * Displays a live preview of the evaluation ES|QL query results as the user * configures the rule form. Delegates grid rendering to `QueryResultsGrid`. */ -export const RuleResultsPreview: React.FC = () => { +export const RuleResultsPreview = () => { const { columns, rows, diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/schedule_field.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/schedule_field.tsx index 7dc21b7817e93..5113e638a42f1 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/schedule_field.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/schedule_field.tsx @@ -14,7 +14,7 @@ import { RuleSchedule } from './rule_schedule'; const SCHEDULE_ROW_ID = 'ruleV2FormScheduleField'; -export const ScheduleField: React.FC = () => { +export const ScheduleField = () => { const { control } = useFormContext(); return ( diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/state_transition_count_field.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/state_transition_count_field.tsx index d600a8c254061..303db928168fc 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/state_transition_count_field.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/state_transition_count_field.tsx @@ -35,10 +35,10 @@ const TEST_SUBJS: Record = { recovering: 'recoveryTransitionCountInput', }; -export const StateTransitionCountField: React.FC = ({ +export const StateTransitionCountField = ({ prependLabel, variant = 'pending', -}) => { +}: StateTransitionCountFieldProps) => { const { control, getValues, setValue } = useFormContext(); const fieldName = FIELD_NAMES[variant]; const testSubj = TEST_SUBJS[variant]; diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/state_transition_timeframe_field.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/state_transition_timeframe_field.tsx index 90aaa9e6164f4..a96eac4e4976c 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/state_transition_timeframe_field.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/state_transition_timeframe_field.tsx @@ -44,10 +44,10 @@ const UNIT_TEST_SUBJS: Record = { recovering: 'recoveryTransitionTimeframeUnitInput', }; -export const StateTransitionTimeframeField: React.FC = ({ +export const StateTransitionTimeframeField = ({ numberPrependLabel, variant = 'pending', -}) => { +}: StateTransitionTimeframeFieldProps) => { const { control, getValues, setValue } = useFormContext(); const fieldName = FIELD_NAMES[variant]; @@ -95,7 +95,7 @@ interface StateTransitionTimeframeInputProps { unitTestSubj?: string; } -const StateTransitionTimeframeInput: React.FC = ({ +const StateTransitionTimeframeInput = ({ value, onChange, errors, @@ -103,7 +103,7 @@ const StateTransitionTimeframeInput: React.FC { +}: StateTransitionTimeframeInputProps) => { const intervalNumber = useMemo(() => getDurationNumberInItsUnit(value || '2m'), [value]); const intervalUnit = useMemo(() => getDurationUnitValue(value || '2m'), [value]); diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/tags_field.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/tags_field.tsx index 160a3e08682da..665b913bfde9e 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/tags_field.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/tags_field.tsx @@ -11,7 +11,7 @@ import { EuiFormRow, EuiComboBox } from '@elastic/eui'; import { Controller, useFormContext } from 'react-hook-form'; import type { FormValues } from '../types'; -export const TagsField: React.FC = () => { +export const TagsField = () => { const { control } = useFormContext(); return ( diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/time_field_select.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/time_field_select.tsx index 99771d8647fca..ab2bd0b459b56 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/time_field_select.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/time_field_select.tsx @@ -17,7 +17,7 @@ import { useRuleFormServices } from '../contexts'; const PREFERRED_TIME_FIELD = '@timestamp'; -export const TimeFieldSelect: React.FC = () => { +export const TimeFieldSelect = () => { const { http, dataViews } = useRuleFormServices(); const { control, setValue, getValues } = useFormContext(); const query = useWatch({ name: 'evaluation.query.base', control }); diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/where_clause_editor.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/where_clause_editor.tsx index 135a3f4891da0..778b8d166b2ce 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/where_clause_editor.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/fields/where_clause_editor.tsx @@ -60,7 +60,7 @@ interface EditorFieldProps { queryCallbacks?: ESQLCallbacks; } -const EditorField: React.FC = ({ +const EditorField = ({ value, onChange, label, @@ -74,7 +74,7 @@ const EditorField: React.FC = ({ suggestionProvider, baseQuery, queryCallbacks, -}) => { +}: EditorFieldProps) => { // Build the label element with optional tooltip const labelElement = label ? ( labelTooltip ? ( @@ -359,7 +359,7 @@ const EditorField: React.FC = ({ * // Form value will be: "WHERE count > 100" * ``` */ -export const WhereClauseEditor: React.FC = ({ +export const WhereClauseEditor = ({ name, label, labelTooltip, @@ -370,7 +370,7 @@ export const WhereClauseEditor: React.FC = ({ isOptional = true, baseQuery = '', rules, -}) => { +}: WhereClauseEditorProps) => { const { control } = useFormContext(); const { data } = useRuleFormServices(); const search = data.search.search; diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/gui_rule_form.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/gui_rule_form.tsx index d8bb170be7b24..7b82383d2701e 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/gui_rule_form.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/gui_rule_form.tsx @@ -35,10 +35,7 @@ export interface GuiRuleFormProps { * * Requires a FormProvider context with FormValues type to be present in the component tree. */ -export const GuiRuleForm: React.FC = ({ - onSubmit, - includeQueryEditor = true, -}) => { +export const GuiRuleForm = ({ onSubmit, includeQueryEditor = true }: GuiRuleFormProps) => { const { handleSubmit } = useFormContext(); return ( diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/index.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/index.tsx index eae14a0e5d1b1..e5d0789af2fed 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/index.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/index.tsx @@ -23,13 +23,13 @@ const LazyStandaloneRuleForm = React.lazy(() => })) ); -export const DynamicRuleForm: React.FC = (props) => ( +export const DynamicRuleForm = (props: DynamicRuleFormProps) => ( }> ); -export const StandaloneRuleForm: React.FC = (props) => ( +export const StandaloneRuleForm = (props: StandaloneRuleFormProps) => ( }> @@ -42,7 +42,7 @@ const LazyRuleResultsPreview = React.lazy(() => })) ); -export const RuleResultsPreview: React.FC = () => ( +export const RuleResultsPreview = () => ( }> diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/rule_form.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/rule_form.tsx index 978a6c8266b83..606b8bfa026fc 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/rule_form.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/rule_form.tsx @@ -68,12 +68,12 @@ interface SubmissionButtonsProps { cancelLabel?: React.ReactNode; } -const SubmissionButtons: React.FC = ({ +const SubmissionButtons = ({ isSubmitting, onCancel, submitLabel, cancelLabel, -}) => { +}: SubmissionButtonsProps) => { const defaultSubmitLabel = ( ); @@ -122,7 +122,7 @@ const SubmissionButtons: React.FC = ({ * (depending on whether `ruleId` is present) to persist the rule via the API * and calls `onSuccess` after a successful save. */ -const RuleFormContent: React.FC = ({ +const RuleFormContent = ({ onSubmit: externalOnSubmit, onSuccess, includeQueryEditor = true, @@ -134,7 +134,7 @@ const RuleFormContent: React.FC = ({ submitLabel, cancelLabel, ruleId, -}) => { +}: RuleFormProps) => { const { reset } = useFormContext(); const services = useRuleFormServices(); const { layout } = useRuleFormMeta(); @@ -273,7 +273,7 @@ const RuleFormContent: React.FC = ({ * Includes its own QueryClientProvider for react-query hooks used by field components. * Services and layout metadata are provided via RuleFormProvider context, eliminating prop drilling. */ -export const RuleForm: React.FC = ({ layout = 'page', ...props }) => { +export const RuleForm = ({ layout = 'page', ...props }: RuleFormProps) => { const queryClient = useMemo( () => new QueryClient({ diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/standalone_rule_form.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/standalone_rule_form.tsx index de4947defbbaf..ef2bf402d52a7 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/standalone_rule_form.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/standalone_rule_form.tsx @@ -59,7 +59,7 @@ export interface StandaloneRuleFormProps { * Uses react-hook-form's `defaultValues` for static initialization. * Time field is auto-selected by TimeFieldSelect based on available date fields. */ -export const StandaloneRuleForm: React.FC = ({ +export const StandaloneRuleForm = ({ query, services, layout, @@ -74,7 +74,7 @@ export const StandaloneRuleForm: React.FC = ({ cancelLabel, initialValues, ruleId, -}) => { +}: StandaloneRuleFormProps) => { const queryDefaults = useFormDefaults({ query }); const defaultValues = useMemo( diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/yaml_rule_form.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/yaml_rule_form.tsx index a2e3d5c4cc5cc..5b269684ce9f4 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/yaml_rule_form.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/form/yaml_rule_form.tsx @@ -37,12 +37,12 @@ export interface YamlRuleFormProps { * Provides a YAML editor for editing rule configuration with ES|QL autocomplete. * Validates the YAML on submission and converts it to FormValues. */ -export const YamlRuleForm: React.FC = ({ +export const YamlRuleForm = ({ services, onSubmit, isDisabled = false, isSubmitting = false, -}) => { +}: YamlRuleFormProps) => { const { getValues } = useFormContext(); const [yaml, setYaml] = useState(() => { const values = getValues(); diff --git a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/test_utils.tsx b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/test_utils.tsx index ff4b333c788f6..aafbb89429a3a 100644 --- a/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/test_utils.tsx +++ b/x-pack/platform/packages/shared/response-ops/alerting-v2-rule-form/test_utils.tsx @@ -88,7 +88,7 @@ export const createFormWrapper = ( ) => { const queryClient = createTestQueryClient(); - const Wrapper: React.FC<{ children: React.ReactNode }> = ({ children }) => { + const Wrapper = ({ children }: { children: React.ReactNode }) => { const form = useForm({ defaultValues: { ...defaultTestFormValues,