import {Fragment, type ReactNode} from 'react'; import type {DraggableSyntheticListeners, UseDraggableArguments} from '@dnd-kit/core'; import styled from '@emotion/styled'; import {Button} from 'sentry/components/button'; import {IconDelete, IconGrabbable} from 'sentry/icons'; import {t} from 'sentry/locale'; import {space} from 'sentry/styles/space'; import type {QueryFieldValue} from 'sentry/utils/discover/fields'; import {QueryField as TableQueryField} from 'sentry/views/discover/table/queryField'; import {FieldValueKind} from 'sentry/views/discover/table/types'; export interface QueryFieldProps { fieldOptions: React.ComponentProps['fieldOptions']; onChange: (newValue: QueryFieldValue) => void; value: QueryFieldValue; attributes?: UseDraggableArguments['attributes']; canDelete?: boolean; canDrag?: boolean; fieldValidationError?: ReactNode; forwardRef?: React.Ref; isDragging?: boolean; listeners?: DraggableSyntheticListeners; onDelete?: () => void; style?: React.CSSProperties; } export function QueryField({ onDelete, onChange, fieldOptions, value, forwardRef, listeners, attributes, canDelete, canDrag, style, fieldValidationError, isDragging, }: QueryFieldProps) { return ( {isDragging ? null : ( {canDrag && ( } size="zero" borderless /> )} option.value.kind !== FieldValueKind.FUNCTION} /> {fieldValidationError ? fieldValidationError : null} {canDelete && (