{"version":3,"file":"QueryInput.mjs","sources":["../../../../src/components/QueryInput/QueryInput.tsx"],"sourcesContent":["import { css } from '@emotion/css';\nimport { lazy, memo, Suspense } from 'react';\n\nimport { selectors } from '@grafana/e2e-selectors';\nimport { t } from '@grafana/i18n';\n\nimport { LoadingPlaceholder } from '../LoadingPlaceholder/LoadingPlaceholder';\n\nexport interface QueryInputProps {\n  /** Current query text. */\n  value: string;\n  /** Called whenever the query text changes. */\n  onChange: (value: string) => void;\n  /** Called when the user presses Shift+Enter or Ctrl+Enter. */\n  onRunQuery?: () => void;\n  /** Called when the input loses focus. */\n  onBlur?: () => void;\n  /** Placeholder shown while the input is empty. */\n  placeholder?: string;\n  /** Accessible label applied to the query input. */\n  'aria-label'?: string;\n  /** Accessible label reference applied to the query input. */\n  'aria-labelledby'?: string;\n}\n\nconst QueryInputImplementation = lazy(() =>\n  import(/* webpackChunkName: \"react-codemirror-query-input\" */ './QueryInputImplementation').then((module) => ({\n    default: module.QueryInputImplementation,\n  }))\n);\n\nconst styles = {\n  wrapper: css({\n    width: '100%',\n  }),\n};\n\n/**\n * A controlled query input backed by CodeMirror. Long queries wrap, plain Enter\n * inserts a newline, and Shift+Enter or Ctrl+Enter runs the query when\n * `onRunQuery` is provided.\n */\nexport const QueryInput = memo(function QueryInput(props: QueryInputProps) {\n  return (\n    <div className={styles.wrapper} data-testid={selectors.components.QueryField.container}>\n      <Suspense fallback={<LoadingPlaceholder text={t('grafana-ui.query-input.loading', 'Loading editor')} />}>\n        <QueryInputImplementation {...props} />\n      </Suspense>\n    </div>\n  );\n});\n"],"names":["QueryInput"],"mappings":";;;;;;;;AAyBA,MAAM,wBAAA,GAA2B,IAAA;AAAA,EAAK,MACpC;AAAA;AAAA,IAA8D;AAAA,GAA4B,CAAE,IAAA,CAAK,CAAC,MAAA,MAAY;AAAA,IAC5G,SAAS,MAAA,CAAO;AAAA,GAClB,CAAE;AACJ,CAAA;AAEA,MAAM,MAAA,GAAS;AAAA,EACb,SAAS,GAAA,CAAI;AAAA,IACX,KAAA,EAAO;AAAA,GACR;AACH,CAAA;AAOO,MAAM,UAAA,GAAa,IAAA,CAAK,SAASA,WAAAA,CAAW,KAAA,EAAwB;AACzE,EAAA,uBACE,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,MAAA,CAAO,OAAA,EAAS,aAAA,EAAa,SAAA,CAAU,UAAA,CAAW,UAAA,CAAW,SAAA,EAC3E,QAAA,kBAAA,GAAA,CAAC,QAAA,EAAA,EAAS,QAAA,sBAAW,kBAAA,EAAA,EAAmB,IAAA,EAAM,CAAA,CAAE,gCAAA,EAAkC,gBAAgB,CAAA,EAAG,CAAA,EACnG,QAAA,kBAAA,GAAA,CAAC,wBAAA,EAAA,EAA0B,GAAG,KAAA,EAAO,CAAA,EACvC,CAAA,EACF,CAAA;AAEJ,CAAC;;;;"}