diff --git a/.changeset/multiline-search-bar-always-visible.md b/.changeset/multiline-search-bar-always-visible.md new file mode 100644 index 0000000000..7eaa144c79 --- /dev/null +++ b/.changeset/multiline-search-bar-always-visible.md @@ -0,0 +1,13 @@ +--- +'@hyperdx/app': patch +--- + +fix: keep a multi-line query visible when the field is not focused + +Multi-line SQL fields collapsed to a single line whenever they lost focus, so everything past the first line was hidden until you clicked back into them. Focusing one expanded it into a floating overlay that covered the content underneath — and in a container sized to its content, that overlay left the layout flow and shrank the field to a sliver one character wide. + +Any field that allows multiple lines now simply sizes to its content, focused or not, growing the layout rather than floating over it, up to 150px before it scrolls. That covers the search WHERE, SELECT and ORDER BY, the chart editor's SQL fields, and PromQL. Lucene search fields similarly grow up to four lines. Fields with `allowMultiline={false}` remain single-line in both SQL and Lucene. The focus overlay is gone rather than made optional, so there is no longer a separate expand-on-focus state to reason about. + +The language switch beside the search bar stretches to match, with no divider between it and the input. A Lucene bar at the default size also no longer overhangs that switch. The Lucene input reserved a 38px row while drawing a 36px box inside it, so the switch — sized to the 36px the SQL editor uses — stood 2px proud of the input. Both languages now take their height from one shared table, so the seam is flush and the bar does not change height when you switch. Only the default size was affected; the compact bar was already consistent at 30px. + +Focus recolors the whole control, including the language switch, without overriding an error or warning border. diff --git a/packages/app/src/components/DashboardFiltersModal/QueryExpressionFilterEditForm.tsx b/packages/app/src/components/DashboardFiltersModal/QueryExpressionFilterEditForm.tsx index 0eeb04b47f..de206bde6c 100644 --- a/packages/app/src/components/DashboardFiltersModal/QueryExpressionFilterEditForm.tsx +++ b/packages/app/src/components/DashboardFiltersModal/QueryExpressionFilterEditForm.tsx @@ -181,7 +181,6 @@ export const QueryExpressionFilterEditForm = ({ control={control} name="expression" placeholder="SQL column or expression" - language="sql" enableHotkey rules={{ required: true }} parentRef={TOOLTIP_PORTAL_TARGET} diff --git a/packages/app/src/components/HeatmapSettingsDrawer.tsx b/packages/app/src/components/HeatmapSettingsDrawer.tsx index 8bc07138cf..975f1701f3 100644 --- a/packages/app/src/components/HeatmapSettingsDrawer.tsx +++ b/packages/app/src/components/HeatmapSettingsDrawer.tsx @@ -97,7 +97,6 @@ export default function HeatmapSettingsDrawer({ size="xs" tooltipText="Controls the Y axis range and scale — defines the metric plotted vertically." placeholder="SQL expression" - language="sql" onSubmit={form.handleSubmit(onSubmit)} label="Value" error={form.formState.errors.value?.message} @@ -111,7 +110,6 @@ export default function HeatmapSettingsDrawer({ control={form.control} name="count" placeholder="SQL expression" - language="sql" size="xs" tooltipText="Controls the color intensity (Z axis) — shows how frequently or strongly each value occurs." onSubmit={form.handleSubmit(onSubmit)} diff --git a/packages/app/src/components/KubernetesFilters.tsx b/packages/app/src/components/KubernetesFilters.tsx index c6fb19082d..8f19dd0dcb 100644 --- a/packages/app/src/components/KubernetesFilters.tsx +++ b/packages/app/src/components/KubernetesFilters.tsx @@ -341,7 +341,6 @@ export const KubernetesFilters: React.FC = ({ sourceId={metricSource.id} dateRange={dateRange} placeholder="Search your events w/ Lucene ex. column:foo" - language="lucene" name="searchQuery" control={control} size="xs" diff --git a/packages/app/src/components/PromQLEditor/PromQLEditor.tsx b/packages/app/src/components/PromQLEditor/PromQLEditor.tsx index 453769e1fc..4bfc0fbb58 100644 --- a/packages/app/src/components/PromQLEditor/PromQLEditor.tsx +++ b/packages/app/src/components/PromQLEditor/PromQLEditor.tsx @@ -18,6 +18,7 @@ import CodeMirror, { tooltips, } from '@uiw/react-codemirror'; +import { EDITOR_INPUT_HEIGHTS } from '@/components/editorInputHeights'; import { createCodeMirrorStyleTheme, DEFAULT_CODE_MIRROR_BASIC_SETUP, @@ -26,6 +27,7 @@ import { usePromqlVariableCompletions } from '@/components/SQLEditor/variableCom import { useVariableValidation, VariableIssueIndicator, + variableValidationState, } from '@/components/SQLEditor/variableValidation'; import { createVariableCompletionSource } from './variableCompletionSource'; @@ -197,36 +199,25 @@ export default function PromQLEditor({ } }, []); - const isExpanded = isFocused; - const isVariableWarningOnly = - variableIssues.errors.length === 0 && variableIssues.warnings.length > 0; - const baseHeight = 36; + const validationState = variableValidationState(variableIssues); + const baseHeight = EDITOR_INPUT_HEIGHTS.sm; return (
- {isExpanded &&