From eb5ac447b04b88166845bf0ef92434d95f31ca43 Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Tue, 19 Oct 2021 13:52:36 +0200 Subject: [PATCH] improve code splitting --- packages/kbn-react-field/BUILD.bazel | 4 +++- packages/kbn-react-field/field_button/package.json | 5 +++++ packages/kbn-react-field/field_icon/package.json | 5 +++++ .../apps/main/components/sidebar/discover_field.tsx | 3 ++- .../public/application/components/field_name/field_name.tsx | 2 +- .../graph/public/components/field_manager/field_editor.tsx | 2 +- .../graph/public/components/field_manager/field_picker.tsx | 2 +- .../lens/public/indexpattern_datasource/field_item.tsx | 2 +- .../lens/public/indexpattern_datasource/lens_field_icon.tsx | 2 +- .../mvt_field_config_editor.tsx | 2 +- .../public/classes/styles/vector/components/field_select.tsx | 2 +- .../plugins/maps/public/components/single_field_select.tsx | 2 +- .../tooltip_selector/add_tooltip_field_popover.tsx | 2 +- .../plugins/osquery/public/common/lib/kibana/kibana_react.ts | 2 +- .../components/event_details/table/field_name_cell.tsx | 2 +- .../query_builder/util_components/single_field_select.tsx | 2 +- 16 files changed, 27 insertions(+), 14 deletions(-) create mode 100644 packages/kbn-react-field/field_button/package.json create mode 100644 packages/kbn-react-field/field_icon/package.json diff --git a/packages/kbn-react-field/BUILD.bazel b/packages/kbn-react-field/BUILD.bazel index 15964ee748f5b..9cb2df76bd6c9 100644 --- a/packages/kbn-react-field/BUILD.bazel +++ b/packages/kbn-react-field/BUILD.bazel @@ -28,7 +28,9 @@ filegroup( NPM_MODULE_EXTRA_FILES = [ "package.json", - "README.md" + "README.md", + "field_button/package.json", + "field_icon/package.json", ] RUNTIME_DEPS = [ 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/src/plugins/discover/public/application/apps/main/components/sidebar/discover_field.tsx b/src/plugins/discover/public/application/apps/main/components/sidebar/discover_field.tsx index 71b74836ad4fc..6e51bcdadfa48 100644 --- a/src/plugins/discover/public/application/apps/main/components/sidebar/discover_field.tsx +++ b/src/plugins/discover/public/application/apps/main/components/sidebar/discover_field.tsx @@ -23,7 +23,8 @@ import { import { i18n } from '@kbn/i18n'; import { UiCounterMetricType } from '@kbn/analytics'; import classNames from 'classnames'; -import { FieldIcon, FieldButton } from '@kbn/react-field'; +import { FieldIcon } from '@kbn/react-field/field_icon'; +import { FieldButton } from '@kbn/react-field/field_button'; import { DiscoverFieldDetails } from './discover_field_details'; import { FieldDetails } from './types'; import { IndexPatternField, IndexPattern } from '../../../../../../../data/public'; diff --git a/src/plugins/discover/public/application/components/field_name/field_name.tsx b/src/plugins/discover/public/application/components/field_name/field_name.tsx index 47400ebdf0f53..a8952b0de1c07 100644 --- a/src/plugins/discover/public/application/components/field_name/field_name.tsx +++ b/src/plugins/discover/public/application/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 '@kbn/react-field'; +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/x-pack/plugins/graph/public/components/field_manager/field_editor.tsx b/x-pack/plugins/graph/public/components/field_manager/field_editor.tsx index aa032060db440..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,7 +25,7 @@ import { EuiIconTip, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { FieldIcon } from '@kbn/react-field'; +import { FieldIcon } from '@kbn/react-field/field_icon'; import classNames from 'classnames'; import { WorkspaceField } from '../../types'; import { iconChoices } from '../../helpers/style_choices'; 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 bb451211efd52..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,7 +9,7 @@ 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'; +import { FieldIcon } from '@kbn/react-field/field_icon'; import { WorkspaceField } from '../../types'; export interface FieldPickerProps { 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 db65916ad0754..fb67ab7a7991e 100644 --- a/x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx +++ b/x-pack/plugins/lens/public/indexpattern_datasource/field_item.tsx @@ -36,7 +36,7 @@ import { TooltipType, } from '@elastic/charts'; import { i18n } from '@kbn/i18n'; -import { FieldButton } from '@kbn/react-field'; +import { FieldButton } from '@kbn/react-field/field_button'; import type { FieldFormatsStart } from 'src/plugins/field_formats/public'; import { EuiHighlight } from '@elastic/eui'; import { 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 5bb52a9ba639f..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 '@kbn/react-field'; +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 9100fd8d9b5d3..e23d7ca3f255a 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,7 +16,7 @@ import { EuiSpacer, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { FieldIcon } from '@kbn/react-field'; +import { FieldIcon } from '@kbn/react-field/field_icon'; import _ from 'lodash'; import { MVTFieldDescriptor } from '../../../../common/descriptor_types'; import { MVT_FIELD_TYPE } from '../../../../common/constants'; 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 8f61bfd35be85..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,7 +16,7 @@ import { EuiFlexItem, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { FieldIcon } from '@kbn/react-field'; +import { FieldIcon } from '@kbn/react-field/field_icon'; import { FIELD_ORIGIN, VECTOR_STYLES } from '../../../../../common/constants'; import { StyleField } from '../style_fields_helper'; 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 8585ed46d3044..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,7 +17,7 @@ import { EuiFlexItem, EuiToolTip, } from '@elastic/eui'; -import { FieldIcon } from '@kbn/react-field'; +import { FieldIcon } from '@kbn/react-field/field_icon'; import { IndexPatternField } from 'src/plugins/data/public'; function fieldsToOptions( 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 28cca4b2f6716..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 '@kbn/react-field'; +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 bd72d4eb91353..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,7 +7,7 @@ import React from 'react'; import { useHistory } from 'react-router-dom'; -import { FieldIcon } from '@kbn/react-field'; +import { FieldIcon } from '@kbn/react-field/field_icon'; import { KibanaContextProvider, KibanaReactContextValue, 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 4a1cbf34990c8..72dd537cfb2bc 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,7 +8,7 @@ import React from 'react'; import { EuiFlexGroup, EuiFlexItem, EuiBadge, EuiText, EuiToolTip } from '@elastic/eui'; import { isEmpty } from 'lodash'; -import { FieldIcon } from '@kbn/react-field'; +import { FieldIcon } from '@kbn/react-field/field_icon'; import * as i18n from '../translations'; import { IndexPatternField } from '../../../../../../../../src/plugins/data/public'; import { getExampleText } from '../helpers'; 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 715246c801e5c..a3c58664555db 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,7 +14,7 @@ import { EuiFlexGroup, EuiFlexItem, } from '@elastic/eui'; -import { FieldIcon } from '@kbn/react-field'; +import { FieldIcon } from '@kbn/react-field/field_icon'; import { IFieldType } from 'src/plugins/data/public'; function fieldsToOptions(fields?: IFieldType[]): Array> {