diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e807885e17294..990cfef20eae0 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -61,6 +61,7 @@ /examples/partial_results_example/ @elastic/kibana-app-services /packages/elastic-datemath/ @elastic/kibana-app-services /packages/kbn-interpreter/ @elastic/kibana-app-services +/packages/kbn-react-field/ @elastic/kibana-app-services /src/plugins/bfetch/ @elastic/kibana-app-services /src/plugins/data/ @elastic/kibana-app-services /src/plugins/data_views/ @elastic/kibana-app-services diff --git a/package.json b/package.json index e68654549a4f2..467ce7f60e0eb 100644 --- a/package.json +++ b/package.json @@ -139,6 +139,7 @@ "@kbn/logging": "link:bazel-bin/packages/kbn-logging", "@kbn/mapbox-gl": "link:bazel-bin/packages/kbn-mapbox-gl", "@kbn/monaco": "link:bazel-bin/packages/kbn-monaco", + "@kbn/react-field": "link:bazel-bin/packages/kbn-react-field", "@kbn/rule-data-utils": "link:bazel-bin/packages/kbn-rule-data-utils", "@kbn/securitysolution-autocomplete": "link:bazel-bin/packages/kbn-securitysolution-autocomplete", "@kbn/securitysolution-es-utils": "link:bazel-bin/packages/kbn-securitysolution-es-utils", diff --git a/packages/BUILD.bazel b/packages/BUILD.bazel index bda4f1b79df55..214f5f9abe5cd 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -36,6 +36,7 @@ filegroup( "//packages/kbn-optimizer:build", "//packages/kbn-plugin-generator:build", "//packages/kbn-plugin-helpers:build", + "//packages/kbn-react-field:build", "//packages/kbn-rule-data-utils:build", "//packages/kbn-securitysolution-autocomplete:build", "//packages/kbn-securitysolution-list-constants:build", diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index 99f9c04069b72..b39968f4889f5 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -104,7 +104,7 @@ pageLoadAssetSize: dataViews: 41532 expressions: 140958 fieldFormats: 65209 - kibanaReact: 84422 + kibanaReact: 74422 share: 71239 uiActions: 35121 dataEnhanced: 24980 diff --git a/packages/kbn-optimizer/src/worker/webpack.config.ts b/packages/kbn-optimizer/src/worker/webpack.config.ts index 3e46f5a768d87..58201152a2459 100644 --- a/packages/kbn-optimizer/src/worker/webpack.config.ts +++ b/packages/kbn-optimizer/src/worker/webpack.config.ts @@ -28,6 +28,14 @@ const IS_CODE_COVERAGE = !!process.env.CODE_COVERAGE; const ISTANBUL_PRESET_PATH = require.resolve('@kbn/babel-preset/istanbul_preset'); const BABEL_PRESET_PATH = require.resolve('@kbn/babel-preset/webpack_preset'); +const nodeModulesButNotKbnPackages = (path: string) => { + if (!path.includes('node_modules')) { + return false; + } + + return !path.includes(`node_modules${Path.sep}@kbn${Path.sep}`); +}; + export function getWebpackConfig(bundle: Bundle, bundleRefs: BundleRefs, worker: WorkerConfig) { const ENTRY_CREATOR = require.resolve('./entry_point_creator'); @@ -138,7 +146,7 @@ export function getWebpackConfig(bundle: Bundle, bundleRefs: BundleRefs, worker: }, { test: /\.scss$/, - exclude: /node_modules/, + exclude: nodeModulesButNotKbnPackages, oneOf: [ ...worker.themeTags.map((theme) => ({ resourceQuery: `?${theme}`, diff --git a/packages/kbn-react-field/BUILD.bazel b/packages/kbn-react-field/BUILD.bazel new file mode 100644 index 0000000000000..9cb2df76bd6c9 --- /dev/null +++ b/packages/kbn-react-field/BUILD.bazel @@ -0,0 +1,121 @@ +load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm") +load("//src/dev/bazel:index.bzl", "jsts_transpiler") + +PKG_BASE_NAME = "kbn-react-field" +PKG_REQUIRE_NAME = "@kbn/react-field" + +SOURCE_FILES = glob( + [ + "src/**/*.ts", + "src/**/*.tsx", + "src/**/*.scss", + "src/**/*.svg", + ], + exclude = [ + "**/*.test.*", + "**/__fixtures__/**", + "**/__snapshots__/**", + ], +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", + "README.md", + "field_button/package.json", + "field_icon/package.json", +] + +RUNTIME_DEPS = [ + "@npm//prop-types", + "@npm//react", + "@npm//classnames", + "@npm//@elastic/eui", + "//packages/kbn-i18n", +] + +TYPES_DEPS = [ + "//packages/kbn-babel-preset", + "//packages/kbn-i18n", + "@npm//tslib", + "@npm//@types/jest", + "@npm//@types/prop-types", + "@npm//@types/classnames", + "@npm//@types/react", + "@npm//@elastic/eui", + "@npm//resize-observer-polyfill", +] + +jsts_transpiler( + name = "target_webpack", + srcs = SRCS, + build_pkg_name = package_name(), + web = True, + additional_args = [ + "--copy-files", + "--quiet" + ], +) + +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), + additional_args = [ + "--copy-files", + "--quiet" + ], +) + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:tsconfig.base.json", + "//:tsconfig.bazel.json", + ], +) + +ts_project( + name = "tsc_types", + args = ['--pretty'], + srcs = SRCS, + deps = TYPES_DEPS, + declaration = True, + declaration_map = True, + emit_declaration_only = True, + out_dir = "target_types", + source_map = True, + root_dir = "src", + tsconfig = ":tsconfig", +) + +js_library( + name = PKG_BASE_NAME, + srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node", ":target_webpack", ":tsc_types"], + package_name = PKG_REQUIRE_NAME, + visibility = ["//visibility:public"], +) + +pkg_npm( + name = "npm_module", + deps = [ + ":%s" % PKG_BASE_NAME, + ] +) + +filegroup( + name = "build", + srcs = [ + ":npm_module", + ], + visibility = ["//visibility:public"], +) diff --git a/packages/kbn-react-field/README.md b/packages/kbn-react-field/README.md new file mode 100644 index 0000000000000..12e118cadd09d --- /dev/null +++ b/packages/kbn-react-field/README.md @@ -0,0 +1 @@ +Shareable field type related React components diff --git a/packages/kbn-react-field/field_button/package.json b/packages/kbn-react-field/field_button/package.json new file mode 100644 index 0000000000000..dd708dd5cd32d --- /dev/null +++ b/packages/kbn-react-field/field_button/package.json @@ -0,0 +1,5 @@ +{ + "main": "../target_node/field_button/index.js", + "browser": "../target_webpack/field_button/index.js", + "types": "../target_types/field_button/index.d.ts" +} \ No newline at end of file diff --git a/packages/kbn-react-field/field_icon/package.json b/packages/kbn-react-field/field_icon/package.json new file mode 100644 index 0000000000000..e7220f60e5d29 --- /dev/null +++ b/packages/kbn-react-field/field_icon/package.json @@ -0,0 +1,5 @@ +{ + "main": "../target_node/field_icon/index.js", + "browser": "../target_webpack/field_icon/index.js", + "types": "../target_types/field_icon/index.d.ts" +} \ No newline at end of file diff --git a/packages/kbn-react-field/jest.config.js b/packages/kbn-react-field/jest.config.js new file mode 100644 index 0000000000000..1549cd0071356 --- /dev/null +++ b/packages/kbn-react-field/jest.config.js @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +module.exports = { + preset: '@kbn/test', + rootDir: '../..', + roots: ['/packages/kbn-react-field'], +}; diff --git a/packages/kbn-react-field/package.json b/packages/kbn-react-field/package.json new file mode 100644 index 0000000000000..3cbfdfa010ba0 --- /dev/null +++ b/packages/kbn-react-field/package.json @@ -0,0 +1,9 @@ +{ + "name": "@kbn/react-field", + "main": "./target_node/index.js", + "browser": "./target_webpack/index.js", + "types": "./target_types/index.d.ts", + "version": "1.0.0", + "license": "SSPL-1.0 OR Elastic License 2.0", + "private": true +} \ No newline at end of file diff --git a/src/plugins/kibana_react/public/field_button/__snapshots__/field_button.test.tsx.snap b/packages/kbn-react-field/src/field_button/__snapshots__/field_button.test.tsx.snap similarity index 100% rename from src/plugins/kibana_react/public/field_button/__snapshots__/field_button.test.tsx.snap rename to packages/kbn-react-field/src/field_button/__snapshots__/field_button.test.tsx.snap diff --git a/src/plugins/kibana_react/public/field_button/field_button.scss b/packages/kbn-react-field/src/field_button/field_button.scss similarity index 100% rename from src/plugins/kibana_react/public/field_button/field_button.scss rename to packages/kbn-react-field/src/field_button/field_button.scss diff --git a/src/plugins/kibana_react/public/field_button/field_button.test.tsx b/packages/kbn-react-field/src/field_button/field_button.test.tsx similarity index 100% rename from src/plugins/kibana_react/public/field_button/field_button.test.tsx rename to packages/kbn-react-field/src/field_button/field_button.test.tsx diff --git a/src/plugins/kibana_react/public/field_button/field_button.tsx b/packages/kbn-react-field/src/field_button/field_button.tsx similarity index 100% rename from src/plugins/kibana_react/public/field_button/field_button.tsx rename to packages/kbn-react-field/src/field_button/field_button.tsx diff --git a/src/plugins/kibana_react/public/field_icon/index.ts b/packages/kbn-react-field/src/field_button/index.ts similarity index 75% rename from src/plugins/kibana_react/public/field_icon/index.ts rename to packages/kbn-react-field/src/field_button/index.ts index 1ef8f3d75ed06..15857540baefc 100644 --- a/src/plugins/kibana_react/public/field_icon/index.ts +++ b/packages/kbn-react-field/src/field_button/index.ts @@ -6,4 +6,5 @@ * Side Public License, v 1. */ -export * from './field_icon'; +export { FieldButton } from './field_button'; +export type { FieldButtonProps, ButtonSize } from './field_button'; diff --git a/src/plugins/kibana_react/public/field_icon/__snapshots__/field_icon.test.tsx.snap b/packages/kbn-react-field/src/field_icon/__snapshots__/field_icon.test.tsx.snap similarity index 100% rename from src/plugins/kibana_react/public/field_icon/__snapshots__/field_icon.test.tsx.snap rename to packages/kbn-react-field/src/field_icon/__snapshots__/field_icon.test.tsx.snap diff --git a/src/plugins/kibana_react/public/field_icon/field_icon.test.tsx b/packages/kbn-react-field/src/field_icon/field_icon.test.tsx similarity index 100% rename from src/plugins/kibana_react/public/field_icon/field_icon.test.tsx rename to packages/kbn-react-field/src/field_icon/field_icon.test.tsx diff --git a/src/plugins/kibana_react/public/field_icon/field_icon.tsx b/packages/kbn-react-field/src/field_icon/field_icon.tsx similarity index 100% rename from src/plugins/kibana_react/public/field_icon/field_icon.tsx rename to packages/kbn-react-field/src/field_icon/field_icon.tsx diff --git a/src/plugins/kibana_react/public/field_button/index.ts b/packages/kbn-react-field/src/field_icon/index.ts similarity index 79% rename from src/plugins/kibana_react/public/field_button/index.ts rename to packages/kbn-react-field/src/field_icon/index.ts index 298160652db49..fa70a445cdb24 100644 --- a/src/plugins/kibana_react/public/field_button/index.ts +++ b/packages/kbn-react-field/src/field_icon/index.ts @@ -6,4 +6,5 @@ * Side Public License, v 1. */ -export * from './field_button'; +export { FieldIcon } from './field_icon'; +export type { FieldIconProps } from './field_icon'; diff --git a/packages/kbn-react-field/src/index.ts b/packages/kbn-react-field/src/index.ts new file mode 100644 index 0000000000000..fa7a34db3e879 --- /dev/null +++ b/packages/kbn-react-field/src/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +export { FieldIcon } from './field_icon'; +export type { FieldIconProps } from './field_icon'; +export { FieldButton } from './field_button'; +export type { FieldButtonProps, ButtonSize } from './field_button'; diff --git a/packages/kbn-react-field/tsconfig.json b/packages/kbn-react-field/tsconfig.json new file mode 100644 index 0000000000000..90c8a63c746f1 --- /dev/null +++ b/packages/kbn-react-field/tsconfig.json @@ -0,0 +1,23 @@ +{ + "extends": "../../tsconfig.bazel.json", + "compilerOptions": { + "declaration": true, + "declarationMap": true, + "emitDeclarationOnly": true, + "outDir": "./target_types", + "sourceMap": true, + "sourceRoot": "../../../../../packages/kbn-react-field/src", + "types": [ + "jest", + "node", + "resize-observer-polyfill" + ] + }, + "include": [ + "src/**/*.ts", + "src/**/*.tsx", + ], + "exclude": [ + "**/__fixtures__/**/*" + ] +} diff --git a/src/plugins/discover/public/application/main/components/sidebar/discover_field.tsx b/src/plugins/discover/public/application/main/components/sidebar/discover_field.tsx index c254f5531a8f0..678eddcdf02c0 100644 --- a/src/plugins/discover/public/application/main/components/sidebar/discover_field.tsx +++ b/src/plugins/discover/public/application/main/components/sidebar/discover_field.tsx @@ -24,8 +24,9 @@ import { import { i18n } from '@kbn/i18n'; import { UiCounterMetricType } from '@kbn/analytics'; import classNames from 'classnames'; +import { FieldIcon } from '@kbn/react-field/field_icon'; +import { FieldButton } from '@kbn/react-field/field_button'; import { DiscoverFieldDetails } from './discover_field_details'; -import { FieldIcon, FieldButton } from '../../../../../../kibana_react/public'; import { FieldDetails } from './types'; import { IndexPatternField, IndexPattern } from '../../../../../../data/public'; import { getFieldTypeName } from './lib/get_field_type_name'; diff --git a/src/plugins/discover/public/components/field_name/field_name.tsx b/src/plugins/discover/public/components/field_name/field_name.tsx index b7a87875c64e3..918cf7166dce4 100644 --- a/src/plugins/discover/public/components/field_name/field_name.tsx +++ b/src/plugins/discover/public/components/field_name/field_name.tsx @@ -11,7 +11,7 @@ import './field_name.scss'; import { EuiBadge, EuiFlexGroup, EuiFlexItem, EuiToolTip } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; -import { FieldIcon, FieldIconProps } from '../../../../kibana_react/public'; +import { FieldIcon, FieldIconProps } from '@kbn/react-field/field_icon'; import { getFieldTypeName } from './field_type_name'; import { IndexPatternField } from '../../../../data/public'; import { getFieldSubtypeMulti } from '../../../../data/common'; diff --git a/src/plugins/kibana_react/public/index.ts b/src/plugins/kibana_react/public/index.ts index 03e2bb5f9c272..46f8599b996a2 100644 --- a/src/plugins/kibana_react/public/index.ts +++ b/src/plugins/kibana_react/public/index.ts @@ -16,8 +16,6 @@ export * from './context'; export * from './overview_page'; export * from './overlays'; export * from './ui_settings'; -export * from './field_icon'; -export * from './field_button'; export * from './table_list_view'; export * from './toolbar_button'; export * from './split_panel'; diff --git a/src/plugins/presentation_util/public/components/field_picker/field_picker.tsx b/src/plugins/presentation_util/public/components/field_picker/field_picker.tsx index c9be9993c3ec1..b0203e3df1d2b 100644 --- a/src/plugins/presentation_util/public/components/field_picker/field_picker.tsx +++ b/src/plugins/presentation_util/public/components/field_picker/field_picker.tsx @@ -11,10 +11,11 @@ import { sortBy, uniq } from 'lodash'; import React, { useState } from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiFlexGroup, EuiFlexItem, EuiPanel, EuiText } from '@elastic/eui'; +import { FieldIcon } from '@kbn/react-field/field_icon'; +import { FieldButton } from '@kbn/react-field/field_button'; import { FieldSearch } from './field_search'; import { DataView, DataViewField } from '../../../../data_views/common'; -import { FieldIcon, FieldButton } from '../../../../kibana_react/public'; import './field_picker.scss'; diff --git a/src/plugins/presentation_util/public/components/field_picker/field_search.tsx b/src/plugins/presentation_util/public/components/field_picker/field_search.tsx index f3988167c1317..c0c73ebafa049 100644 --- a/src/plugins/presentation_util/public/components/field_picker/field_search.tsx +++ b/src/plugins/presentation_util/public/components/field_picker/field_search.tsx @@ -21,8 +21,8 @@ import { EuiSpacer, EuiPopoverTitle, } from '@elastic/eui'; +import { FieldIcon } from '@kbn/react-field/field_icon'; import { FormattedMessage } from '@kbn/i18n/react'; -import { FieldIcon } from '../../../../kibana_react/public'; export interface Props { onSearchChange: (value: string) => void; diff --git a/x-pack/plugins/canvas/shareable_runtime/webpack.config.js b/x-pack/plugins/canvas/shareable_runtime/webpack.config.js index dee608fcf0702..610f9ee0bb197 100644 --- a/x-pack/plugins/canvas/shareable_runtime/webpack.config.js +++ b/x-pack/plugins/canvas/shareable_runtime/webpack.config.js @@ -18,6 +18,14 @@ const { const isProd = process.env.NODE_ENV === 'production'; +const nodeModulesButNotKbnPackages = (_path) => { + if (!_path.includes('node_modules')) { + return false; + } + + return !_path.includes(`node_modules${path.sep}@kbn${path.sep}`); +}; + module.exports = { context: KIBANA_ROOT, entry: { @@ -124,7 +132,7 @@ module.exports = { }, { test: /\.scss$/, - exclude: [/node_modules/, /\.module\.s(a|c)ss$/], + exclude: [nodeModulesButNotKbnPackages, /\.module\.s(a|c)ss$/], use: [ { loader: 'style-loader', diff --git a/x-pack/plugins/graph/public/components/field_manager/field_editor.tsx b/x-pack/plugins/graph/public/components/field_manager/field_editor.tsx index d4ccfe66dc7d4..138e4fe5060a4 100644 --- a/x-pack/plugins/graph/public/components/field_manager/field_editor.tsx +++ b/x-pack/plugins/graph/public/components/field_manager/field_editor.tsx @@ -25,11 +25,11 @@ import { EuiIconTip, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { FieldIcon } from '@kbn/react-field/field_icon'; import classNames from 'classnames'; import { WorkspaceField } from '../../types'; import { iconChoices } from '../../helpers/style_choices'; import { LegacyIcon } from '../legacy_icon'; -import { FieldIcon } from '../../../../../../src/plugins/kibana_react/public'; import { UpdateableFieldProperties } from './field_manager'; import { isEqual } from '../helpers'; diff --git a/x-pack/plugins/graph/public/components/field_manager/field_picker.tsx b/x-pack/plugins/graph/public/components/field_manager/field_picker.tsx index a764c0241938b..7728c67f89a82 100644 --- a/x-pack/plugins/graph/public/components/field_manager/field_picker.tsx +++ b/x-pack/plugins/graph/public/components/field_manager/field_picker.tsx @@ -9,8 +9,8 @@ import React, { useState, useEffect, ReactNode } from 'react'; import { EuiPopover, EuiSelectable, EuiBadge } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import classNames from 'classnames'; +import { FieldIcon } from '@kbn/react-field/field_icon'; import { WorkspaceField } from '../../types'; -import { FieldIcon } from '../../../../../../src/plugins/kibana_react/public'; export interface FieldPickerProps { fieldMap: Record; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx index 5d8ba778e30d1..f84650a183f31 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx @@ -36,6 +36,7 @@ import { TooltipType, } from '@elastic/charts'; import { i18n } from '@kbn/i18n'; +import { FieldButton } from '@kbn/react-field/field_button'; import type { FieldFormatsStart } from 'src/plugins/field_formats/public'; import { EuiHighlight } from '@elastic/eui'; import { @@ -45,7 +46,6 @@ import { Filter, esQuery, } from '../../../../../src/plugins/data/public'; -import { FieldButton } from '../../../../../src/plugins/kibana_react/public'; import { ChartsPluginSetup } from '../../../../../src/plugins/charts/public'; import { DragDrop, DragDropIdentifier } from '../drag_drop'; import { DatasourceDataPanelProps, DataType } from '../types'; diff --git a/x-pack/plugins/lens/public/indexpattern_datasource/lens_field_icon.tsx b/x-pack/plugins/lens/public/indexpattern_datasource/lens_field_icon.tsx index edb6957fcf0b2..fa4d3e5e1513d 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/lens_field_icon.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/lens_field_icon.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { FieldIcon, FieldIconProps } from '../../../../../src/plugins/kibana_react/public'; +import { FieldIcon, FieldIconProps } from '@kbn/react-field/field_icon'; import { DataType } from '../types'; import { normalizeOperationDataType } from './utils'; diff --git a/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/mvt_field_config_editor.tsx b/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/mvt_field_config_editor.tsx index 8924e346c94dc..3038d4b1df51f 100644 --- a/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/mvt_field_config_editor.tsx +++ b/x-pack/plugins/maps/public/classes/sources/mvt_single_layer_vector_source/mvt_field_config_editor.tsx @@ -16,9 +16,9 @@ import { EuiSpacer, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { FieldIcon } from '@kbn/react-field/field_icon'; import _ from 'lodash'; import { MVTFieldDescriptor } from '../../../../common/descriptor_types'; -import { FieldIcon } from '../../../../../../../src/plugins/kibana_react/public'; import { MVT_FIELD_TYPE } from '../../../../common/constants'; function makeOption({ diff --git a/x-pack/plugins/maps/public/classes/styles/vector/components/field_select.tsx b/x-pack/plugins/maps/public/classes/styles/vector/components/field_select.tsx index 74269f39bc36c..e90bf5b2339d0 100644 --- a/x-pack/plugins/maps/public/classes/styles/vector/components/field_select.tsx +++ b/x-pack/plugins/maps/public/classes/styles/vector/components/field_select.tsx @@ -16,8 +16,8 @@ import { EuiFlexItem, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { FieldIcon } from '@kbn/react-field/field_icon'; import { FIELD_ORIGIN, VECTOR_STYLES } from '../../../../../common/constants'; -import { FieldIcon } from '../../../../../../../../src/plugins/kibana_react/public'; import { StyleField } from '../style_fields_helper'; function renderOption( diff --git a/x-pack/plugins/maps/public/components/single_field_select.tsx b/x-pack/plugins/maps/public/components/single_field_select.tsx index 67594db11eb37..9b7f5d12725a5 100644 --- a/x-pack/plugins/maps/public/components/single_field_select.tsx +++ b/x-pack/plugins/maps/public/components/single_field_select.tsx @@ -17,8 +17,8 @@ import { EuiFlexItem, EuiToolTip, } from '@elastic/eui'; +import { FieldIcon } from '@kbn/react-field/field_icon'; import { IndexPatternField } from 'src/plugins/data/public'; -import { FieldIcon } from '../../../../../src/plugins/kibana_react/public'; function fieldsToOptions( fields?: IndexPatternField[], diff --git a/x-pack/plugins/maps/public/components/tooltip_selector/add_tooltip_field_popover.tsx b/x-pack/plugins/maps/public/components/tooltip_selector/add_tooltip_field_popover.tsx index 3804e3873b47e..3c702b1334272 100644 --- a/x-pack/plugins/maps/public/components/tooltip_selector/add_tooltip_field_popover.tsx +++ b/x-pack/plugins/maps/public/components/tooltip_selector/add_tooltip_field_popover.tsx @@ -21,7 +21,7 @@ import { } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; -import { FieldIcon } from '../../../../../../src/plugins/kibana_react/public'; +import { FieldIcon } from '@kbn/react-field/field_icon'; export type FieldProps = { label: string; diff --git a/x-pack/plugins/osquery/public/common/lib/kibana/kibana_react.ts b/x-pack/plugins/osquery/public/common/lib/kibana/kibana_react.ts index a77ddaee9f250..affefda1e61e0 100644 --- a/x-pack/plugins/osquery/public/common/lib/kibana/kibana_react.ts +++ b/x-pack/plugins/osquery/public/common/lib/kibana/kibana_react.ts @@ -7,6 +7,7 @@ import React from 'react'; import { useHistory } from 'react-router-dom'; +import { FieldIcon } from '@kbn/react-field/field_icon'; import { KibanaContextProvider, KibanaReactContextValue, @@ -15,7 +16,6 @@ import { useUiSetting$, withKibana, reactRouterNavigate, - FieldIcon, } from '../../../../../../../src/plugins/kibana_react/public'; import { StartServices } from '../../../types'; diff --git a/x-pack/plugins/security_solution/public/common/components/event_details/table/field_name_cell.tsx b/x-pack/plugins/security_solution/public/common/components/event_details/table/field_name_cell.tsx index 74b366ffc1b3e..5482288b7d279 100644 --- a/x-pack/plugins/security_solution/public/common/components/event_details/table/field_name_cell.tsx +++ b/x-pack/plugins/security_solution/public/common/components/event_details/table/field_name_cell.tsx @@ -8,8 +8,8 @@ import React from 'react'; import { EuiFlexGroup, EuiFlexItem, EuiBadge, EuiText, EuiToolTip } from '@elastic/eui'; import { isEmpty } from 'lodash'; +import { FieldIcon } from '@kbn/react-field/field_icon'; import * as i18n from '../translations'; -import { FieldIcon } from '../../../../../../../../src/plugins/kibana_react/public'; import { DataViewField } from '../../../../../../../../src/plugins/data_views/common'; import { getExampleText } from '../helpers'; import { BrowserField } from '../../../containers/source'; diff --git a/x-pack/plugins/stack_alerts/public/alert_types/geo_containment/query_builder/util_components/single_field_select.tsx b/x-pack/plugins/stack_alerts/public/alert_types/geo_containment/query_builder/util_components/single_field_select.tsx index 9c4977ca5e87b..0f8b937d14049 100644 --- a/x-pack/plugins/stack_alerts/public/alert_types/geo_containment/query_builder/util_components/single_field_select.tsx +++ b/x-pack/plugins/stack_alerts/public/alert_types/geo_containment/query_builder/util_components/single_field_select.tsx @@ -14,8 +14,8 @@ import { EuiFlexGroup, EuiFlexItem, } from '@elastic/eui'; +import { FieldIcon } from '@kbn/react-field/field_icon'; import { IFieldType } from 'src/plugins/data/public'; -import { FieldIcon } from '../../../../../../../../src/plugins/kibana_react/public'; function fieldsToOptions(fields?: IFieldType[]): Array> { if (!fields) { diff --git a/yarn.lock b/yarn.lock index 2c86be8359023..28c729ee8c94e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3867,6 +3867,10 @@ version "0.0.0" uid "" +"@kbn/react-field@link:bazel-bin/packages/kbn-react-field": + version "0.0.0" + uid "" + "@kbn/rule-data-utils@link:bazel-bin/packages/kbn-rule-data-utils": version "0.0.0" uid ""