From a6fdda76de7bc6ada8919eff7e88ca1909d87ff5 Mon Sep 17 00:00:00 2001 From: Drew Tate Date: Wed, 19 Jul 2023 09:46:57 -0500 Subject: [PATCH] [Lens][Event annotations] Move logic into packages (#161500) --- .github/CODEOWNERS | 4 +- .i18nrc.json | 10 +- docs/developer/plugin-list.asciidoc | 4 - package.json | 4 +- packages/kbn-coloring/package.json | 5 +- .../kbn-event-annotation-common/README.md | 3 + packages/kbn-event-annotation-common/index.ts | 52 +++++++ .../jest.config.js | 13 ++ .../kbn-event-annotation-common/kibana.jsonc | 5 + .../kbn-event-annotation-common/package.json | 7 + .../kbn-event-annotation-common/tsconfig.json | 23 +++ packages/kbn-event-annotation-common/types.ts | 89 ++++++++++++ .../kbn-event-annotation-common/util.ts | 58 +++++++- .../kbn-event-annotation-components/README.md | 3 + .../group_editor_flyout.test.tsx.snap | 0 .../annotation_editor_controls.tsx | 47 +++--- .../annotation_editor_controls/helpers.ts | 8 +- .../annotation_editor_controls/icon_set.ts | 34 ++--- .../annotation_editor_controls/index.scss | 0 .../annotation_editor_controls/index.test.tsx | 7 +- .../annotation_editor_controls/index.tsx | 0 .../manual_annotation_panel.tsx | 8 +- .../query_annotation_panel.tsx | 10 +- .../range_annotation_panel.tsx | 7 +- .../tooltip_annotation_panel.tsx | 12 +- .../annotation_editor_controls/types.ts | 5 +- ...t_annotation_group_saved_object_finder.tsx | 135 ++++++++++++++++++ .../components/get_annotation_accessor.ts | 6 +- .../group_editor_controls/annotation_list.tsx | 9 +- .../group_editor_controls.test.tsx | 5 +- .../group_editor_controls.tsx | 28 ++-- .../components/group_editor_controls/index.ts | 0 .../components/group_editor_flyout.test.tsx | 5 +- .../components/group_editor_flyout.tsx | 20 ++- .../components/index.ts | 3 + .../components/table_list.test.tsx | 9 +- .../components/table_list.tsx | 28 ++-- .../constants.ts | 2 +- .../kbn-event-annotation-components/index.ts | 24 ++++ .../jest.config.js | 6 +- .../kibana.jsonc | 5 + .../package.json | 9 ++ .../tsconfig.json | 41 ++++++ .../kbn-event-annotation-components}/types.ts | 11 +- packages/kbn-optimizer/limits.yml | 1 - .../kbn-visualization-ui-components/README.md | 3 + .../components/color_picker.tsx | 0 .../components/debounced_input.test.tsx | 0 .../components/debounced_input.tsx | 0 .../components/debounced_value.test.ts | 0 .../components/debounced_value.ts | 0 .../components/dimension_buttons/constants.ts | 0 .../dimension_button.test.tsx | 1 - .../dimension_buttons/dimension_button.tsx | 0 .../dimension_button_icon.tsx | 0 .../dimension_buttons/empty_button.tsx | 0 .../components/dimension_buttons/index.ts | 0 .../dimension_buttons/palette_indicator.tsx | 0 .../dimension_buttons/trigger.test.tsx | 1 - .../components/dimension_buttons/trigger.tsx | 0 .../components/dimension_buttons/types.ts | 0 .../components/dimension_editor_section.scss | 0 .../components/dimension_editor_section.tsx | 0 .../drag_drop_bucket/buckets.test.tsx | 0 .../components/drag_drop_bucket/buckets.tsx | 0 .../default_bucket_container.tsx | 0 .../fields_bucket_container.tsx | 0 .../components/drag_drop_bucket/index.tsx | 0 .../drag_drop_bucket/new_bucket_button.tsx | 0 .../components/drag_drop_bucket/types.ts | 0 .../components/field_picker/field_picker.scss | 0 .../components/field_picker/field_picker.tsx | 0 .../components/field_picker/index.ts | 0 .../field_picker/truncated_label.test.tsx | 0 .../field_picker/truncated_label.tsx | 0 .../components/field_picker/types.ts | 0 .../components/icon_select.tsx | 0 .../components/index.ts | 0 .../components/line_style_settings.tsx | 2 +- .../components/name_input.tsx | 0 .../query_input/filter_query_input.scss | 0 .../query_input/filter_query_input.tsx | 0 .../components/query_input/helpers.ts | 0 .../components/query_input/index.ts | 0 .../components/query_input/query_input.tsx | 6 +- .../components/text_decoration_setting.tsx | 0 .../components/tooltip_wrapper.tsx | 0 .../kbn-visualization-ui-components}/index.ts | 8 +- .../jest.config.js | 14 ++ .../kibana.jsonc | 5 + .../package.json | 5 +- .../tsconfig.json | 23 +-- .../kbn-visualization-ui-components}/types.ts | 2 + .../kbn-visualization-ui-components}/util.ts | 0 .../common/types/expression_renderers.ts | 6 +- .../public/components/annotations.tsx | 5 +- .../expression_xy/tsconfig.json | 1 + .../event_annotation/common/constants.ts | 21 +-- .../common/content_management/v1/types.ts | 2 +- .../common/create_copied_annotation.ts | 24 ---- .../common/fetch_event_annotations/utils.ts | 10 +- src/plugins/event_annotation/common/index.ts | 26 +--- .../common/manual_event_annotation/index.ts | 24 +--- .../common/manual_event_annotation/types.ts | 2 +- .../query_point_event_annotation/index.ts | 22 +-- .../query_point_event_annotation/types.ts | 2 +- src/plugins/event_annotation/common/types.ts | 83 ----------- src/plugins/event_annotation/kibana.jsonc | 2 - ...t_annotation_group_saved_object_finder.tsx | 2 +- .../get_annotation_accessor.ts | 32 ----- .../public/event_annotation_service/index.tsx | 3 +- .../event_annotation_service/service.test.ts | 16 ++- .../event_annotation_service/service.tsx | 11 +- .../public/get_table_list.tsx | 6 +- src/plugins/event_annotation/public/index.ts | 17 +-- .../event_annotation_group_storage.ts | 2 +- .../event_annotation/server/saved_objects.ts | 3 +- src/plugins/event_annotation/tsconfig.json | 27 ++-- .../public/query_string_input/index.tsx | 1 + .../visualization_ui_components/.i18nrc.json | 6 - .../visualization_ui_components/README.md | 3 - .../jest.config.js | 20 --- .../visualization_ui_components/kibana.jsonc | 17 --- .../public/plugin.ts | 26 ---- tsconfig.base.json | 8 +- x-pack/plugins/lens/common/types.ts | 2 +- x-pack/plugins/lens/kibana.jsonc | 1 - .../lens/public/data_views_service/loader.ts | 2 +- .../dimension_panel/dimension_editor.tsx | 2 +- .../dimension_panel/field_select.tsx | 6 +- .../form_based/dimension_panel/filtering.tsx | 2 +- .../dimension_panel/format_selector.tsx | 2 +- .../datasources/form_based/form_based.tsx | 2 +- .../operations/definitions/date_histogram.tsx | 2 +- .../filters/filter_popover.test.tsx | 2 +- .../definitions/filters/filter_popover.tsx | 2 +- .../definitions/filters/filters.tsx | 2 +- .../operations/definitions/percentile.tsx | 2 +- .../definitions/percentile_ranks.tsx | 2 +- .../definitions/ranges/advanced_editor.tsx | 2 +- .../definitions/ranges/ranges.test.tsx | 2 +- .../shared_components/label_input.tsx | 2 +- .../operations/definitions/static_value.tsx | 2 +- .../definitions/terms/field_inputs.tsx | 2 +- .../terms/include_exclude_options.tsx | 2 +- .../public/datasources/form_based/utils.tsx | 2 +- .../text_based/field_select.test.tsx | 2 +- .../datasources/text_based/field_select.tsx | 6 +- .../text_based/text_based_languages.tsx | 2 +- .../buttons/empty_dimension_button.tsx | 2 +- .../config_panel/layer_panel.test.tsx | 2 +- .../editor_frame/config_panel/layer_panel.tsx | 2 +- .../editor_frame/state_helpers.ts | 4 +- .../axis/title/axis_title_settings.tsx | 2 +- .../legend/layout/columns_number_setting.tsx | 2 +- .../legend/legend_settings_popover.tsx | 2 +- .../public/state_management/lens_slice.ts | 2 +- x-pack/plugins/lens/public/types.ts | 4 +- x-pack/plugins/lens/public/utils.ts | 2 +- .../dimension_editor_addtional_section.tsx | 2 +- .../visualizations/gauge/dimension_editor.tsx | 2 +- .../gauge/toolbar_component/index.tsx | 2 +- .../heatmap/toolbar_component.tsx | 2 +- .../appearance_options_popover.tsx | 2 +- .../metric/dimension_editor.test.tsx | 2 +- .../metric/dimension_editor.tsx | 6 +- .../public/visualizations/metric/icon_set.ts | 2 +- .../public/visualizations/metric/toolbar.tsx | 2 +- .../visualizations/metric/visualization.tsx | 2 +- .../partition/dimension_editor.tsx | 2 +- .../visualizations/partition/toolbar.tsx | 2 +- .../partition/visualization.tsx | 2 +- .../actions/revert_changes_action.test.tsx | 2 +- .../annotations/actions/save_action.test.tsx | 2 +- .../xy/annotations/actions/save_action.tsx | 2 +- .../annotations/actions/unlink_action.test.ts | 2 +- .../visualizations/xy/annotations/helpers.tsx | 10 +- .../visualizations/xy/color_assignment.ts | 4 +- .../xy/reference_line_helpers.tsx | 2 +- .../public/visualizations/xy/state_helpers.ts | 6 +- .../public/visualizations/xy/to_expression.ts | 6 +- .../lens/public/visualizations/xy/types.ts | 5 +- .../visualizations/xy/visualization.test.tsx | 2 +- .../visualizations/xy/visualization.tsx | 10 +- .../annotations_panel.tsx | 6 +- .../xy_config_panel/axis_settings_popover.tsx | 2 +- .../xy/xy_config_panel/dimension_editor.tsx | 4 +- .../xy/xy_config_panel/index.tsx | 2 +- .../reference_line_config_panel/icon_set.ts | 2 +- .../reference_line_panel.tsx | 2 +- .../shared/marker_decoration_settings.tsx | 2 +- .../fill_opacity_option.tsx | 2 +- .../visual_options_popover/index.tsx | 2 +- x-pack/plugins/lens/tsconfig.json | 4 +- .../translations/translations/fr-FR.json | 1 - .../translations/translations/ja-JP.json | 1 - .../translations/translations/zh-CN.json | 1 - yarn.lock | 10 +- 198 files changed, 840 insertions(+), 628 deletions(-) create mode 100644 packages/kbn-event-annotation-common/README.md create mode 100644 packages/kbn-event-annotation-common/index.ts create mode 100644 packages/kbn-event-annotation-common/jest.config.js create mode 100644 packages/kbn-event-annotation-common/kibana.jsonc create mode 100644 packages/kbn-event-annotation-common/package.json create mode 100644 packages/kbn-event-annotation-common/tsconfig.json create mode 100644 packages/kbn-event-annotation-common/types.ts rename src/plugins/event_annotation/public/event_annotation_service/helpers.ts => packages/kbn-event-annotation-common/util.ts (56%) create mode 100644 packages/kbn-event-annotation-components/README.md rename {src/plugins/event_annotation/public => packages/kbn-event-annotation-components}/components/__snapshots__/group_editor_flyout.test.tsx.snap (100%) rename {src/plugins/event_annotation/public => packages/kbn-event-annotation-components}/components/annotation_editor_controls/annotation_editor_controls.tsx (89%) rename {src/plugins/event_annotation/public => packages/kbn-event-annotation-components}/components/annotation_editor_controls/helpers.ts (93%) rename {src/plugins/event_annotation/public => packages/kbn-event-annotation-components}/components/annotation_editor_controls/icon_set.ts (52%) rename {src/plugins/event_annotation/public => packages/kbn-event-annotation-components}/components/annotation_editor_controls/index.scss (100%) rename {src/plugins/event_annotation/public => packages/kbn-event-annotation-components}/components/annotation_editor_controls/index.test.tsx (99%) rename {src/plugins/event_annotation/public => packages/kbn-event-annotation-components}/components/annotation_editor_controls/index.tsx (100%) rename {src/plugins/event_annotation/public => packages/kbn-event-annotation-components}/components/annotation_editor_controls/manual_annotation_panel.tsx (92%) rename {src/plugins/event_annotation/public => packages/kbn-event-annotation-components}/components/annotation_editor_controls/query_annotation_panel.tsx (90%) rename {src/plugins/event_annotation/public => packages/kbn-event-annotation-components}/components/annotation_editor_controls/range_annotation_panel.tsx (95%) rename {src/plugins/event_annotation/public => packages/kbn-event-annotation-components}/components/annotation_editor_controls/tooltip_annotation_panel.tsx (93%) rename {src/plugins/event_annotation/public => packages/kbn-event-annotation-components}/components/annotation_editor_controls/types.ts (79%) create mode 100644 packages/kbn-event-annotation-components/components/event_annotation_group_saved_object_finder.tsx rename {src/plugins/event_annotation/public => packages/kbn-event-annotation-components}/components/get_annotation_accessor.ts (91%) rename {src/plugins/event_annotation/public => packages/kbn-event-annotation-components}/components/group_editor_controls/annotation_list.tsx (93%) rename {src/plugins/event_annotation/public => packages/kbn-event-annotation-components}/components/group_editor_controls/group_editor_controls.test.tsx (97%) rename {src/plugins/event_annotation/public => packages/kbn-event-annotation-components}/components/group_editor_controls/group_editor_controls.tsx (87%) rename {src/plugins/event_annotation/public => packages/kbn-event-annotation-components}/components/group_editor_controls/index.ts (100%) rename {src/plugins/event_annotation/public => packages/kbn-event-annotation-components}/components/group_editor_flyout.test.tsx (96%) rename {src/plugins/event_annotation/public => packages/kbn-event-annotation-components}/components/group_editor_flyout.tsx (88%) rename {src/plugins/event_annotation/public => packages/kbn-event-annotation-components}/components/index.ts (89%) rename {src/plugins/event_annotation/public => packages/kbn-event-annotation-components}/components/table_list.test.tsx (97%) rename {src/plugins/event_annotation/public => packages/kbn-event-annotation-components}/components/table_list.tsx (86%) rename src/plugins/visualization_ui_components/common/types.ts => packages/kbn-event-annotation-components/constants.ts (85%) create mode 100644 packages/kbn-event-annotation-components/index.ts rename src/plugins/visualization_ui_components/common/index.ts => packages/kbn-event-annotation-components/jest.config.js (73%) create mode 100644 packages/kbn-event-annotation-components/kibana.jsonc create mode 100644 packages/kbn-event-annotation-components/package.json create mode 100644 packages/kbn-event-annotation-components/tsconfig.json rename {src/plugins/event_annotation/public/event_annotation_service => packages/kbn-event-annotation-components}/types.ts (87%) create mode 100644 packages/kbn-visualization-ui-components/README.md rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/color_picker.tsx (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/debounced_input.test.tsx (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/debounced_input.tsx (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/debounced_value.test.ts (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/debounced_value.ts (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/dimension_buttons/constants.ts (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/dimension_buttons/dimension_button.test.tsx (97%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/dimension_buttons/dimension_button.tsx (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/dimension_buttons/dimension_button_icon.tsx (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/dimension_buttons/empty_button.tsx (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/dimension_buttons/index.ts (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/dimension_buttons/palette_indicator.tsx (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/dimension_buttons/trigger.test.tsx (96%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/dimension_buttons/trigger.tsx (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/dimension_buttons/types.ts (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/dimension_editor_section.scss (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/dimension_editor_section.tsx (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/drag_drop_bucket/buckets.test.tsx (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/drag_drop_bucket/buckets.tsx (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/drag_drop_bucket/default_bucket_container.tsx (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/drag_drop_bucket/fields_bucket_container.tsx (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/drag_drop_bucket/index.tsx (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/drag_drop_bucket/new_bucket_button.tsx (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/drag_drop_bucket/types.ts (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/field_picker/field_picker.scss (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/field_picker/field_picker.tsx (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/field_picker/index.ts (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/field_picker/truncated_label.test.tsx (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/field_picker/truncated_label.tsx (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/field_picker/types.ts (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/icon_select.tsx (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/index.ts (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/line_style_settings.tsx (98%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/name_input.tsx (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/query_input/filter_query_input.scss (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/query_input/filter_query_input.tsx (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/query_input/helpers.ts (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/query_input/index.ts (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/query_input/query_input.tsx (95%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/text_decoration_setting.tsx (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/components/tooltip_wrapper.tsx (100%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/index.ts (84%) create mode 100644 packages/kbn-visualization-ui-components/jest.config.js create mode 100644 packages/kbn-visualization-ui-components/kibana.jsonc rename {src/plugins/visualization_ui_components => packages/kbn-visualization-ui-components}/package.json (52%) rename {src/plugins/visualization_ui_components => packages/kbn-visualization-ui-components}/tsconfig.json (69%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/types.ts (90%) rename {src/plugins/visualization_ui_components/public => packages/kbn-visualization-ui-components}/util.ts (100%) delete mode 100644 src/plugins/event_annotation/common/create_copied_annotation.ts delete mode 100644 src/plugins/event_annotation/public/components/group_editor_controls/get_annotation_accessor.ts delete mode 100755 src/plugins/visualization_ui_components/.i18nrc.json delete mode 100644 src/plugins/visualization_ui_components/README.md delete mode 100644 src/plugins/visualization_ui_components/jest.config.js delete mode 100644 src/plugins/visualization_ui_components/kibana.jsonc delete mode 100755 src/plugins/visualization_ui_components/public/plugin.ts diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 0d246e1992d24..ecca6d3ad332b 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -360,6 +360,8 @@ packages/kbn-eslint-plugin-eslint @elastic/kibana-operations packages/kbn-eslint-plugin-imports @elastic/kibana-operations packages/kbn-eslint-plugin-telemetry @elastic/actionable-observability x-pack/test/encrypted_saved_objects_api_integration/plugins/api_consumer_plugin @elastic/kibana-security +packages/kbn-event-annotation-common @elastic/kibana-visualizations +packages/kbn-event-annotation-components @elastic/kibana-visualizations src/plugins/event_annotation @elastic/kibana-visualizations x-pack/test/plugin_api_integration/plugins/event_log @elastic/response-ops x-pack/plugins/event_log @elastic/response-ops @@ -762,7 +764,7 @@ src/plugins/vis_types/timeseries @elastic/kibana-visualizations src/plugins/vis_types/vega @elastic/kibana-visualizations src/plugins/vis_types/vislib @elastic/kibana-visualizations src/plugins/vis_types/xy @elastic/kibana-visualizations -src/plugins/visualization_ui_components @elastic/kibana-visualizations +packages/kbn-visualization-ui-components @elastic/kibana-visualizations src/plugins/visualizations @elastic/kibana-visualizations x-pack/plugins/watcher @elastic/platform-deployment-management packages/kbn-web-worker-stub @elastic/kibana-operations diff --git a/.i18nrc.json b/.i18nrc.json index cffc81dd6fc48..694397503bf97 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -44,6 +44,8 @@ "expressionShape": "src/plugins/expression_shape", "expressionTagcloud": "src/plugins/chart_expressions/expression_tagcloud", "eventAnnotation": "src/plugins/event_annotation", + "eventAnnotationCommon": "packages/kbn-event-annotation-common", + "eventAnnotationComponents": "packages/kbn-event-annotation-components", "fieldFormats": "src/plugins/field_formats", "files": "src/plugins/files", "filesManagement": "src/plugins/files_management", @@ -72,7 +74,11 @@ "kibanaOverview": "src/plugins/kibana_overview", "lists": "packages/kbn-securitysolution-list-utils/src", "exceptionList-components": "packages/kbn-securitysolution-exception-list-components/src", - "management": ["src/legacy/core_plugins/management", "src/plugins/management", "packages/kbn-management"], + "management": [ + "src/legacy/core_plugins/management", + "src/plugins/management", + "packages/kbn-management" + ], "monaco": "packages/kbn-monaco/src", "navigation": "src/plugins/navigation", "newsfeed": "src/plugins/newsfeed", @@ -113,7 +119,7 @@ "visTypeVislib": "src/plugins/vis_types/vislib", "visTypeXy": "src/plugins/vis_types/xy", "visualizations": "src/plugins/visualizations", - "visualizationUiComponents": "src/plugins/visualization_ui_components", + "visualizationUiComponents": "packages/kbn-visualization-ui-components", "unifiedSearch": "src/plugins/unified_search", "unifiedFieldList": "packages/kbn-unified-field-list", "unifiedHistogram": "src/plugins/unified_histogram" diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index 60d841d390feb..08101e8eacef8 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -407,10 +407,6 @@ The plugin exposes the static DefaultEditorController class to consume. |WARNING: Missing README. -|{kib-repo}blob/{branch}/src/plugins/visualization_ui_components/README.md[visualizationUiComponents] -|A series of UI components pulled out of Lens to make them available outside Lens. - - |=== [discrete] diff --git a/package.json b/package.json index 6a3f61d15abe0..c07524b52c996 100644 --- a/package.json +++ b/package.json @@ -394,6 +394,8 @@ "@kbn/es-types": "link:packages/kbn-es-types", "@kbn/es-ui-shared-plugin": "link:src/plugins/es_ui_shared", "@kbn/eso-plugin": "link:x-pack/test/encrypted_saved_objects_api_integration/plugins/api_consumer_plugin", + "@kbn/event-annotation-common": "link:packages/kbn-event-annotation-common", + "@kbn/event-annotation-components": "link:packages/kbn-event-annotation-components", "@kbn/event-annotation-plugin": "link:src/plugins/event_annotation", "@kbn/event-log-fixture-plugin": "link:x-pack/test/plugin_api_integration/plugins/event_log", "@kbn/event-log-plugin": "link:x-pack/plugins/event_log", @@ -750,7 +752,7 @@ "@kbn/vis-type-vega-plugin": "link:src/plugins/vis_types/vega", "@kbn/vis-type-vislib-plugin": "link:src/plugins/vis_types/vislib", "@kbn/vis-type-xy-plugin": "link:src/plugins/vis_types/xy", - "@kbn/visualization-ui-components": "link:src/plugins/visualization_ui_components", + "@kbn/visualization-ui-components": "link:packages/kbn-visualization-ui-components", "@kbn/visualizations-plugin": "link:src/plugins/visualizations", "@kbn/watcher-plugin": "link:x-pack/plugins/watcher", "@loaders.gl/core": "^2.3.1", diff --git a/packages/kbn-coloring/package.json b/packages/kbn-coloring/package.json index ec8092b3c6130..6b68e62a9d220 100644 --- a/packages/kbn-coloring/package.json +++ b/packages/kbn-coloring/package.json @@ -2,5 +2,6 @@ "name": "@kbn/coloring", "private": true, "version": "1.0.0", - "license": "SSPL-1.0 OR Elastic License 2.0" -} \ No newline at end of file + "license": "SSPL-1.0 OR Elastic License 2.0", + "sideEffects": false +} diff --git a/packages/kbn-event-annotation-common/README.md b/packages/kbn-event-annotation-common/README.md new file mode 100644 index 0000000000000..afeed89bbcfee --- /dev/null +++ b/packages/kbn-event-annotation-common/README.md @@ -0,0 +1,3 @@ +# @kbn/event-annotation-common + +A few core annotation-related types and utilities that are available in both server and browser contexts. diff --git a/packages/kbn-event-annotation-common/index.ts b/packages/kbn-event-annotation-common/index.ts new file mode 100644 index 0000000000000..f6df6a02171d1 --- /dev/null +++ b/packages/kbn-event-annotation-common/index.ts @@ -0,0 +1,52 @@ +/* + * 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 const AvailableAnnotationIcons = { + ASTERISK: 'asterisk', + ALERT: 'alert', + BELL: 'bell', + BOLT: 'bolt', + BUG: 'bug', + CIRCLE: 'circle', + EDITOR_COMMENT: 'editorComment', + FLAG: 'flag', + HEART: 'heart', + MAP_MARKER: 'mapMarker', + PIN_FILLED: 'pinFilled', + STAR_EMPTY: 'starEmpty', + STAR_FILLED: 'starFilled', + TAG: 'tag', + TRIANGLE: 'triangle', +} as const; + +export const EVENT_ANNOTATION_GROUP_TYPE = 'event-annotation-group'; + +export { + defaultAnnotationColor, + defaultAnnotationRangeColor, + defaultAnnotationLabel, + getDefaultManualAnnotation, + getDefaultQueryAnnotation, + createCopiedAnnotation, + isRangeAnnotationConfig, + isManualPointAnnotationConfig, + isQueryAnnotationConfig, +} from './util'; + +export type { + EventAnnotationGroupContent, + AvailableAnnotationIcon, + PointStyleProps, + EventAnnotationConfig, + EventAnnotationGroupConfig, + RangeStyleProps, + ManualAnnotationType, + PointInTimeEventAnnotationConfig, + RangeEventAnnotationConfig, + QueryPointEventAnnotationConfig, +} from './types'; diff --git a/packages/kbn-event-annotation-common/jest.config.js b/packages/kbn-event-annotation-common/jest.config.js new file mode 100644 index 0000000000000..07c7e2e2142da --- /dev/null +++ b/packages/kbn-event-annotation-common/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/jest_node', + rootDir: '../..', + roots: ['/packages/kbn-event-annotation-common'], +}; diff --git a/packages/kbn-event-annotation-common/kibana.jsonc b/packages/kbn-event-annotation-common/kibana.jsonc new file mode 100644 index 0000000000000..cdf2a346730ee --- /dev/null +++ b/packages/kbn-event-annotation-common/kibana.jsonc @@ -0,0 +1,5 @@ +{ + "type": "shared-common", + "id": "@kbn/event-annotation-common", + "owner": "@elastic/kibana-visualizations" +} diff --git a/packages/kbn-event-annotation-common/package.json b/packages/kbn-event-annotation-common/package.json new file mode 100644 index 0000000000000..b5b8c70f4f85a --- /dev/null +++ b/packages/kbn-event-annotation-common/package.json @@ -0,0 +1,7 @@ +{ + "name": "@kbn/event-annotation-common", + "private": true, + "version": "1.0.0", + "license": "SSPL-1.0 OR Elastic License 2.0", + "sideEffects": false +} diff --git a/packages/kbn-event-annotation-common/tsconfig.json b/packages/kbn-event-annotation-common/tsconfig.json new file mode 100644 index 0000000000000..c146bae7d9efa --- /dev/null +++ b/packages/kbn-event-annotation-common/tsconfig.json @@ -0,0 +1,23 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "target/types", + "types": [ + "jest", + "node" + ] + }, + "include": [ + "**/*.ts", + ], + "exclude": [ + "target/**/*" + ], + "kbn_references": [ + "@kbn/data-plugin", + "@kbn/content-management-table-list-view-table", + "@kbn/visualization-ui-components", + "@kbn/ui-theme", + "@kbn/i18n", + ] +} diff --git a/packages/kbn-event-annotation-common/types.ts b/packages/kbn-event-annotation-common/types.ts new file mode 100644 index 0000000000000..3c1c12bca8c80 --- /dev/null +++ b/packages/kbn-event-annotation-common/types.ts @@ -0,0 +1,89 @@ +/* + * 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. + */ + +import { $Values } from 'utility-types'; +import { DataViewSpec, KibanaQueryOutput } from '@kbn/data-plugin/common'; +import { UserContentCommonSchema } from '@kbn/content-management-table-list-view-table'; +import type { LineStyle } from '@kbn/visualization-ui-components'; +import { AvailableAnnotationIcons } from '.'; + +export type AvailableAnnotationIcon = $Values; + +export type PointStyleProps = StyleSharedProps & { + icon?: AvailableAnnotationIcon; + lineWidth?: number; + lineStyle?: LineStyle; + textVisibility?: boolean; +}; + +export type PointInTimeEventAnnotationConfig = { + id: string; + type: ManualAnnotationType; + key: { + type: 'point_in_time'; + timestamp: string; + }; +} & PointStyleProps; + +export type Fill = 'inside' | 'outside' | 'none'; +export type ManualAnnotationType = 'manual'; +export type QueryAnnotationType = 'query'; +export type KeyType = 'point_in_time' | 'range'; + +interface StyleSharedProps { + label: string; + color?: string; + isHidden?: boolean; +} + +export type RangeStyleProps = StyleSharedProps & { + outside?: boolean; +}; + +export type RangeEventAnnotationConfig = { + type: ManualAnnotationType; + id: string; + key: { + type: 'range'; + timestamp: string; + endTimestamp: string; + }; +} & RangeStyleProps; + +export type StyleProps = PointStyleProps & RangeStyleProps; + +export type QueryPointEventAnnotationConfig = { + id: string; + type: QueryAnnotationType; + filter: KibanaQueryOutput; + timeField?: string; + textField?: string; + extraFields?: string[]; + key: { + type: 'point_in_time'; + }; +} & PointStyleProps; + +export type EventAnnotationConfig = + | PointInTimeEventAnnotationConfig + | RangeEventAnnotationConfig + | QueryPointEventAnnotationConfig; + +export interface EventAnnotationGroupConfig { + annotations: EventAnnotationConfig[]; + indexPatternId: string; + ignoreGlobalFilters: boolean; + title: string; + description: string; + tags: string[]; + dataViewSpec?: DataViewSpec; +} + +export type EventAnnotationGroupContent = UserContentCommonSchema & { + attributes: { indexPatternId: string; dataViewSpec?: DataViewSpec }; +}; diff --git a/src/plugins/event_annotation/public/event_annotation_service/helpers.ts b/packages/kbn-event-annotation-common/util.ts similarity index 56% rename from src/plugins/event_annotation/public/event_annotation_service/helpers.ts rename to packages/kbn-event-annotation-common/util.ts index 31dabb34cdc09..40c7a07e626c1 100644 --- a/src/plugins/event_annotation/public/event_annotation_service/helpers.ts +++ b/packages/kbn-event-annotation-common/util.ts @@ -6,12 +6,14 @@ * Side Public License, v 1. */ import { euiLightVars } from '@kbn/ui-theme'; +import { i18n } from '@kbn/i18n'; import { EventAnnotationConfig, RangeEventAnnotationConfig, PointInTimeEventAnnotationConfig, QueryPointEventAnnotationConfig, -} from '../../common'; +} from './types'; + export const defaultAnnotationColor = euiLightVars.euiColorAccent; // Do not compute it live as dependencies will add tens of Kbs to the plugin export const defaultAnnotationRangeColor = `#F04E981A`; // defaultAnnotationColor with opacity 0.1 @@ -33,3 +35,57 @@ export const isQueryAnnotationConfig = ( ): annotation is QueryPointEventAnnotationConfig => { return Boolean(annotation && annotation.type === 'query'); }; + +export const createCopiedAnnotation = ( + newId: string, + timestamp: string, + source?: EventAnnotationConfig +): EventAnnotationConfig => { + if (!source) { + return getDefaultManualAnnotation(newId, timestamp); + } + return { + ...source, + id: newId, + }; +}; + +export const defaultAnnotationLabel = i18n.translate( + 'eventAnnotationCommon.manualAnnotation.defaultAnnotationLabel', + { + defaultMessage: 'Event', + } +); + +export const getDefaultManualAnnotation = ( + id: string, + timestamp: string +): EventAnnotationConfig => ({ + label: defaultAnnotationLabel, + type: 'manual', + key: { + type: 'point_in_time', + timestamp, + }, + icon: 'triangle', + id, +}); + +export const getDefaultQueryAnnotation = ( + id: string, + fieldName: string, + timeField: string +): EventAnnotationConfig => ({ + filter: { + type: 'kibana_query', + query: `${fieldName}: *`, + language: 'kuery', + }, + timeField, + type: 'query', + key: { + type: 'point_in_time', + }, + id, + label: `${fieldName}: *`, +}); diff --git a/packages/kbn-event-annotation-components/README.md b/packages/kbn-event-annotation-components/README.md new file mode 100644 index 0000000000000..4c3283fa6714e --- /dev/null +++ b/packages/kbn-event-annotation-components/README.md @@ -0,0 +1,3 @@ +# @kbn/event-annotation-components + +A collection of static components used for interacting with event annotations. diff --git a/src/plugins/event_annotation/public/components/__snapshots__/group_editor_flyout.test.tsx.snap b/packages/kbn-event-annotation-components/components/__snapshots__/group_editor_flyout.test.tsx.snap similarity index 100% rename from src/plugins/event_annotation/public/components/__snapshots__/group_editor_flyout.test.tsx.snap rename to packages/kbn-event-annotation-components/components/__snapshots__/group_editor_flyout.test.tsx.snap diff --git a/src/plugins/event_annotation/public/components/annotation_editor_controls/annotation_editor_controls.tsx b/packages/kbn-event-annotation-components/components/annotation_editor_controls/annotation_editor_controls.tsx similarity index 89% rename from src/plugins/event_annotation/public/components/annotation_editor_controls/annotation_editor_controls.tsx rename to packages/kbn-event-annotation-components/components/annotation_editor_controls/annotation_editor_controls.tsx index 01116e3806a5a..21b7870db45db 100644 --- a/src/plugins/event_annotation/public/components/annotation_editor_controls/annotation_editor_controls.tsx +++ b/packages/kbn-event-annotation-components/components/annotation_editor_controls/annotation_editor_controls.tsx @@ -7,7 +7,7 @@ */ import './index.scss'; -import { isFieldLensCompatible } from '@kbn/visualization-ui-components/public'; +import { isFieldLensCompatible } from '@kbn/visualization-ui-components'; import React, { useCallback, useEffect } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiFormRow, EuiSwitch, EuiSwitchEvent, EuiButtonGroup, EuiSpacer } from '@elastic/eui'; @@ -21,19 +21,19 @@ import { FieldPicker, FieldOption, type QueryInputServices, -} from '@kbn/visualization-ui-components/public'; -import type { FieldOptionValue } from '@kbn/visualization-ui-components/public'; +} from '@kbn/visualization-ui-components'; +import type { FieldOptionValue } from '@kbn/visualization-ui-components'; import { DataView } from '@kbn/data-views-plugin/common'; import { useExistingFieldsReader } from '@kbn/unified-field-list/src/hooks/use_existing_fields'; import moment from 'moment'; import { htmlIdGenerator } from '@elastic/eui'; -import { isQueryAnnotationConfig, isRangeAnnotationConfig } from '../..'; -import { +import type { AvailableAnnotationIcon, EventAnnotationConfig, PointInTimeEventAnnotationConfig, QueryPointEventAnnotationConfig, -} from '../../../common'; +} from '@kbn/event-annotation-common'; +import { isQueryAnnotationConfig, isRangeAnnotationConfig } from '../..'; import { defaultAnnotationColor, defaultAnnotationLabel, @@ -88,35 +88,38 @@ const AnnotationEditorControls = ({ return ( <> @@ -276,14 +279,14 @@ const AnnotationEditorControls = ({ )} {isRange && ( {isQueryBased && currentAnnotation && ( @@ -347,7 +350,7 @@ const AnnotationEditorControls = ({ display="rowCompressed" className="lnsRowCompressedMargin" fullWidth - label={i18n.translate('eventAnnotation.xyChart.annotation.tooltip', { + label={i18n.translate('eventAnnotationComponents.xyChart.annotation.tooltip', { defaultMessage: 'Show additional fields', })} > diff --git a/src/plugins/event_annotation/public/components/annotation_editor_controls/helpers.ts b/packages/kbn-event-annotation-components/components/annotation_editor_controls/helpers.ts similarity index 93% rename from src/plugins/event_annotation/public/components/annotation_editor_controls/helpers.ts rename to packages/kbn-event-annotation-components/components/annotation_editor_controls/helpers.ts index f823dab7e7357..ce40c8a71ed48 100644 --- a/src/plugins/event_annotation/public/components/annotation_editor_controls/helpers.ts +++ b/packages/kbn-event-annotation-components/components/annotation_editor_controls/helpers.ts @@ -11,27 +11,27 @@ import { pick } from 'lodash'; import { euiLightVars } from '@kbn/ui-theme'; import { i18n } from '@kbn/i18n'; import chroma from 'chroma-js'; -import { isQueryAnnotationConfig, isRangeAnnotationConfig } from '../..'; import type { EventAnnotationConfig, RangeEventAnnotationConfig, PointInTimeEventAnnotationConfig, QueryPointEventAnnotationConfig, -} from '../../../common'; +} from '@kbn/event-annotation-common'; +import { isQueryAnnotationConfig, isRangeAnnotationConfig } from '../..'; export const defaultAnnotationColor = euiLightVars.euiColorAccent; // Do not compute it live as dependencies will add tens of Kbs to the plugin export const defaultAnnotationRangeColor = `#F04E981A`; // defaultAnnotationColor with opacity 0.1 export const defaultAnnotationLabel = i18n.translate( - 'eventAnnotation.xyChart.defaultAnnotationLabel', + 'eventAnnotationComponents.xyChart.defaultAnnotationLabel', { defaultMessage: 'Event', } ); export const defaultRangeAnnotationLabel = i18n.translate( - 'eventAnnotation.xyChart.defaultRangeAnnotationLabel', + 'eventAnnotationComponents.xyChart.defaultRangeAnnotationLabel', { defaultMessage: 'Event range', } diff --git a/src/plugins/event_annotation/public/components/annotation_editor_controls/icon_set.ts b/packages/kbn-event-annotation-components/components/annotation_editor_controls/icon_set.ts similarity index 52% rename from src/plugins/event_annotation/public/components/annotation_editor_controls/icon_set.ts rename to packages/kbn-event-annotation-components/components/annotation_editor_controls/icon_set.ts index 36f8d4de9e7d4..fc221c598ef20 100644 --- a/src/plugins/event_annotation/public/components/annotation_editor_controls/icon_set.ts +++ b/packages/kbn-event-annotation-components/components/annotation_editor_controls/icon_set.ts @@ -8,43 +8,43 @@ import { i18n } from '@kbn/i18n'; import { IconTriangle, IconCircle } from '@kbn/chart-icons'; -import type { IconSet } from '@kbn/visualization-ui-components/public'; -import { AvailableAnnotationIcon } from '../../../common'; +import type { IconSet } from '@kbn/visualization-ui-components'; +import type { AvailableAnnotationIcon } from '@kbn/event-annotation-common'; export const annotationsIconSet: IconSet = [ { value: 'asterisk', - label: i18n.translate('eventAnnotation.xyChart.iconSelect.asteriskIconLabel', { + label: i18n.translate('eventAnnotationComponents.xyChart.iconSelect.asteriskIconLabel', { defaultMessage: 'Asterisk', }), }, { value: 'alert', - label: i18n.translate('eventAnnotation.xyChart.iconSelect.alertIconLabel', { + label: i18n.translate('eventAnnotationComponents.xyChart.iconSelect.alertIconLabel', { defaultMessage: 'Alert', }), }, { value: 'bell', - label: i18n.translate('eventAnnotation.xyChart.iconSelect.bellIconLabel', { + label: i18n.translate('eventAnnotationComponents.xyChart.iconSelect.bellIconLabel', { defaultMessage: 'Bell', }), }, { value: 'bolt', - label: i18n.translate('eventAnnotation.xyChart.iconSelect.boltIconLabel', { + label: i18n.translate('eventAnnotationComponents.xyChart.iconSelect.boltIconLabel', { defaultMessage: 'Bolt', }), }, { value: 'bug', - label: i18n.translate('eventAnnotation.xyChart.iconSelect.bugIconLabel', { + label: i18n.translate('eventAnnotationComponents.xyChart.iconSelect.bugIconLabel', { defaultMessage: 'Bug', }), }, { value: 'circle', - label: i18n.translate('eventAnnotation.xyChart.iconSelect.circleIconLabel', { + label: i18n.translate('eventAnnotationComponents.xyChart.iconSelect.circleIconLabel', { defaultMessage: 'Circle', }), icon: IconCircle, @@ -52,55 +52,55 @@ export const annotationsIconSet: IconSet = [ { value: 'editorComment', - label: i18n.translate('eventAnnotation.xyChart.iconSelect.commentIconLabel', { + label: i18n.translate('eventAnnotationComponents.xyChart.iconSelect.commentIconLabel', { defaultMessage: 'Comment', }), }, { value: 'flag', - label: i18n.translate('eventAnnotation.xyChart.iconSelect.flagIconLabel', { + label: i18n.translate('eventAnnotationComponents.xyChart.iconSelect.flagIconLabel', { defaultMessage: 'Flag', }), }, { value: 'heart', - label: i18n.translate('eventAnnotation.xyChart.iconSelect.heartLabel', { + label: i18n.translate('eventAnnotationComponents.xyChart.iconSelect.heartLabel', { defaultMessage: 'Heart', }), }, { value: 'mapMarker', - label: i18n.translate('eventAnnotation.xyChart.iconSelect.mapMarkerLabel', { + label: i18n.translate('eventAnnotationComponents.xyChart.iconSelect.mapMarkerLabel', { defaultMessage: 'Map Marker', }), }, { value: 'pinFilled', - label: i18n.translate('eventAnnotation.xyChart.iconSelect.mapPinLabel', { + label: i18n.translate('eventAnnotationComponents.xyChart.iconSelect.mapPinLabel', { defaultMessage: 'Map Pin', }), }, { value: 'starEmpty', - label: i18n.translate('eventAnnotation.xyChart.iconSelect.starLabel', { + label: i18n.translate('eventAnnotationComponents.xyChart.iconSelect.starLabel', { defaultMessage: 'Star', }), }, { value: 'starFilled', - label: i18n.translate('eventAnnotation.xyChart.iconSelect.starFilledLabel', { + label: i18n.translate('eventAnnotationComponents.xyChart.iconSelect.starFilledLabel', { defaultMessage: 'Star filled', }), }, { value: 'tag', - label: i18n.translate('eventAnnotation.xyChart.iconSelect.tagIconLabel', { + label: i18n.translate('eventAnnotationComponents.xyChart.iconSelect.tagIconLabel', { defaultMessage: 'Tag', }), }, { value: 'triangle', - label: i18n.translate('eventAnnotation.xyChart.iconSelect.triangleIconLabel', { + label: i18n.translate('eventAnnotationComponents.xyChart.iconSelect.triangleIconLabel', { defaultMessage: 'Triangle', }), icon: IconTriangle, diff --git a/src/plugins/event_annotation/public/components/annotation_editor_controls/index.scss b/packages/kbn-event-annotation-components/components/annotation_editor_controls/index.scss similarity index 100% rename from src/plugins/event_annotation/public/components/annotation_editor_controls/index.scss rename to packages/kbn-event-annotation-components/components/annotation_editor_controls/index.scss diff --git a/src/plugins/event_annotation/public/components/annotation_editor_controls/index.test.tsx b/packages/kbn-event-annotation-components/components/annotation_editor_controls/index.test.tsx similarity index 99% rename from src/plugins/event_annotation/public/components/annotation_editor_controls/index.test.tsx rename to packages/kbn-event-annotation-components/components/annotation_editor_controls/index.test.tsx index bfbd8a5d65b44..3aaa034bdcc99 100644 --- a/src/plugins/event_annotation/public/components/annotation_editor_controls/index.test.tsx +++ b/packages/kbn-event-annotation-components/components/annotation_editor_controls/index.test.tsx @@ -11,8 +11,11 @@ import AnnotationEditorControls from './annotation_editor_controls'; import React from 'react'; import { mount } from 'enzyme'; -import { EventAnnotationConfig, RangeEventAnnotationConfig } from '../../../common'; -import { QueryInputServices } from '@kbn/visualization-ui-components/public'; +import type { + EventAnnotationConfig, + RangeEventAnnotationConfig, +} from '@kbn/event-annotation-common'; +import { QueryInputServices } from '@kbn/visualization-ui-components'; import moment from 'moment'; import { act } from 'react-dom/test-utils'; import { EuiButtonGroup } from '@elastic/eui'; diff --git a/src/plugins/event_annotation/public/components/annotation_editor_controls/index.tsx b/packages/kbn-event-annotation-components/components/annotation_editor_controls/index.tsx similarity index 100% rename from src/plugins/event_annotation/public/components/annotation_editor_controls/index.tsx rename to packages/kbn-event-annotation-components/components/annotation_editor_controls/index.tsx diff --git a/src/plugins/event_annotation/public/components/annotation_editor_controls/manual_annotation_panel.tsx b/packages/kbn-event-annotation-components/components/annotation_editor_controls/manual_annotation_panel.tsx similarity index 92% rename from src/plugins/event_annotation/public/components/annotation_editor_controls/manual_annotation_panel.tsx rename to packages/kbn-event-annotation-components/components/annotation_editor_controls/manual_annotation_panel.tsx index 8ddac6c6173c4..df03c451bca14 100644 --- a/src/plugins/event_annotation/public/components/annotation_editor_controls/manual_annotation_panel.tsx +++ b/packages/kbn-event-annotation-components/components/annotation_editor_controls/manual_annotation_panel.tsx @@ -35,7 +35,7 @@ export const ConfigPanelManualAnnotation = ({ @@ -92,7 +92,7 @@ export const ConfigPanelQueryAnnotation = ({ diff --git a/src/plugins/event_annotation/public/components/annotation_editor_controls/range_annotation_panel.tsx b/packages/kbn-event-annotation-components/components/annotation_editor_controls/range_annotation_panel.tsx similarity index 95% rename from src/plugins/event_annotation/public/components/annotation_editor_controls/range_annotation_panel.tsx rename to packages/kbn-event-annotation-components/components/annotation_editor_controls/range_annotation_panel.tsx index 0418994677947..4db4a1fbe9784 100644 --- a/src/plugins/event_annotation/public/components/annotation_editor_controls/range_annotation_panel.tsx +++ b/packages/kbn-event-annotation-components/components/annotation_editor_controls/range_annotation_panel.tsx @@ -17,8 +17,11 @@ import { EuiDatePicker, } from '@elastic/eui'; import moment from 'moment'; +import type { + PointInTimeEventAnnotationConfig, + RangeEventAnnotationConfig, +} from '@kbn/event-annotation-common'; import { isRangeAnnotationConfig } from '../..'; -import type { PointInTimeEventAnnotationConfig, RangeEventAnnotationConfig } from '../../../common'; import { defaultRangeAnnotationLabel, defaultAnnotationLabel } from './helpers'; import { toLineAnnotationColor, toRangeAnnotationColor } from './helpers'; import type { ManualEventAnnotationType } from './types'; @@ -39,7 +42,7 @@ export const ConfigPanelApplyAsRangeSwitch = ({ data-test-subj="lns-xyAnnotation-rangeSwitch" label={ - {i18n.translate('eventAnnotation.xyChart.applyAsRange', { + {i18n.translate('eventAnnotationComponents.xyChart.applyAsRange', { defaultMessage: 'Apply as range', })} diff --git a/src/plugins/event_annotation/public/components/annotation_editor_controls/tooltip_annotation_panel.tsx b/packages/kbn-event-annotation-components/components/annotation_editor_controls/tooltip_annotation_panel.tsx similarity index 93% rename from src/plugins/event_annotation/public/components/annotation_editor_controls/tooltip_annotation_panel.tsx rename to packages/kbn-event-annotation-components/components/annotation_editor_controls/tooltip_annotation_panel.tsx index b44868b440071..f1ed8ccc7ccb2 100644 --- a/src/plugins/event_annotation/public/components/annotation_editor_controls/tooltip_annotation_panel.tsx +++ b/packages/kbn-event-annotation-components/components/annotation_editor_controls/tooltip_annotation_panel.tsx @@ -19,10 +19,10 @@ import { DragDropBuckets, DraggableBucketContainer, FieldsBucketContainer, -} from '@kbn/visualization-ui-components/public'; + isFieldLensCompatible, +} from '@kbn/visualization-ui-components'; import { DataView } from '@kbn/data-views-plugin/common'; -import { isFieldLensCompatible } from '@kbn/visualization-ui-components/public'; -import { QueryPointEventAnnotationConfig } from '../../../common'; +import type { QueryPointEventAnnotationConfig } from '@kbn/event-annotation-common'; export const MAX_TOOLTIP_FIELDS_SIZE = 2; @@ -98,7 +98,7 @@ export function TooltipSection({ onClick={() => { handleInputChange([...localValues, { id: generateId(), value: undefined, isNew: true }]); }} - label={i18n.translate('eventAnnotation.xyChart.annotation.tooltip.addField', { + label={i18n.translate('eventAnnotationComponents.xyChart.annotation.tooltip.addField', { defaultMessage: 'Add field', })} isDisabled={localValues.length > MAX_TOOLTIP_FIELDS_SIZE} @@ -115,7 +115,7 @@ export function TooltipSection({ className="lnsConfigPanelAnnotations__noFieldsPrompt" > - {i18n.translate('eventAnnotation.xyChart.annotation.tooltip.noFields', { + {i18n.translate('eventAnnotationComponents.xyChart.annotation.tooltip.noFields', { defaultMessage: 'None selected', })} @@ -170,7 +170,7 @@ export function TooltipSection({ handleInputChange(arrayRef.filter((_, i) => i !== index)); }} removeTitle={i18n.translate( - 'eventAnnotation.xyChart.annotation.tooltip.deleteButtonLabel', + 'eventAnnotationComponents.xyChart.annotation.tooltip.deleteButtonLabel', { defaultMessage: 'Delete', } diff --git a/src/plugins/event_annotation/public/components/annotation_editor_controls/types.ts b/packages/kbn-event-annotation-components/components/annotation_editor_controls/types.ts similarity index 79% rename from src/plugins/event_annotation/public/components/annotation_editor_controls/types.ts rename to packages/kbn-event-annotation-components/components/annotation_editor_controls/types.ts index 094543e4f71d8..137cefb6407d7 100644 --- a/src/plugins/event_annotation/public/components/annotation_editor_controls/types.ts +++ b/packages/kbn-event-annotation-components/components/annotation_editor_controls/types.ts @@ -6,7 +6,10 @@ * Side Public License, v 1. */ -import type { PointInTimeEventAnnotationConfig, RangeEventAnnotationConfig } from '../../../common'; +import type { + PointInTimeEventAnnotationConfig, + RangeEventAnnotationConfig, +} from '@kbn/event-annotation-common'; export type ManualEventAnnotationType = | PointInTimeEventAnnotationConfig diff --git a/packages/kbn-event-annotation-components/components/event_annotation_group_saved_object_finder.tsx b/packages/kbn-event-annotation-components/components/event_annotation_group_saved_object_finder.tsx new file mode 100644 index 0000000000000..4ccdb6164a5a6 --- /dev/null +++ b/packages/kbn-event-annotation-components/components/event_annotation_group_saved_object_finder.tsx @@ -0,0 +1,135 @@ +/* + * 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. + */ + +import React, { useEffect, useState } from 'react'; +import { i18n } from '@kbn/i18n'; +import type { CoreStart } from '@kbn/core/public'; +import { FormattedMessage } from '@kbn/i18n-react'; +import type { IUiSettingsClient } from '@kbn/core-ui-settings-browser'; +import type { SavedObjectCommon } from '@kbn/saved-objects-finder-plugin/common'; +import { SavedObjectFinder } from '@kbn/saved-objects-finder-plugin/public'; +import type { SavedObjectsManagementPluginStart } from '@kbn/saved-objects-management-plugin/public'; +import { + EuiButton, + EuiEmptyPrompt, + EuiFlexGroup, + EuiFlexItem, + EuiLoadingSpinner, + EuiText, +} from '@elastic/eui'; +import { css } from '@emotion/react'; +import { EVENT_ANNOTATION_GROUP_TYPE } from '@kbn/event-annotation-common'; + +export const EventAnnotationGroupSavedObjectFinder = ({ + uiSettings, + http, + savedObjectsManagement, + fixedPageSize = 10, + checkHasAnnotationGroups, + onChoose, + onCreateNew, +}: { + uiSettings: IUiSettingsClient; + http: CoreStart['http']; + savedObjectsManagement: SavedObjectsManagementPluginStart; + fixedPageSize?: number; + checkHasAnnotationGroups: () => Promise; + onChoose: (value: { + id: string; + type: string; + fullName: string; + savedObject: SavedObjectCommon; + }) => void; + onCreateNew: () => void; +}) => { + const [hasAnnotationGroups, setHasAnnotationGroups] = useState(); + + useEffect(() => { + checkHasAnnotationGroups().then(setHasAnnotationGroups); + }, [checkHasAnnotationGroups]); + + return hasAnnotationGroups === undefined ? ( + + + + + + ) : hasAnnotationGroups === false ? ( + + + + + + } + body={ + +

+ +

+
+ } + actions={ + onCreateNew()} size="s"> + + + } + /> +
+
+ ) : ( + { + onChoose({ id, type, fullName, savedObject }); + }} + showFilter={false} + noItemsMessage={ + + } + savedObjectMetaData={savedObjectMetaData} + services={{ + uiSettings, + http, + savedObjectsManagement, + }} + /> + ); +}; + +const savedObjectMetaData = [ + { + type: EVENT_ANNOTATION_GROUP_TYPE, + getIconForSavedObject: () => 'annotation', + name: i18n.translate('eventAnnotationComponents.eventAnnotationGroup.metadata.name', { + defaultMessage: 'Annotations Groups', + }), + includeFields: ['*'], + }, +]; diff --git a/src/plugins/event_annotation/public/components/get_annotation_accessor.ts b/packages/kbn-event-annotation-components/components/get_annotation_accessor.ts similarity index 91% rename from src/plugins/event_annotation/public/components/get_annotation_accessor.ts rename to packages/kbn-event-annotation-components/components/get_annotation_accessor.ts index 1ece7164f2557..16cdc0175338e 100644 --- a/src/plugins/event_annotation/public/components/get_annotation_accessor.ts +++ b/packages/kbn-event-annotation-components/components/get_annotation_accessor.ts @@ -6,13 +6,13 @@ * Side Public License, v 1. */ -import type { AccessorConfig } from '@kbn/visualization-ui-components/public'; -import { EventAnnotationConfig } from '../../common'; +import type { AccessorConfig } from '@kbn/visualization-ui-components'; +import type { EventAnnotationConfig } from '@kbn/event-annotation-common'; import { defaultAnnotationColor, defaultAnnotationRangeColor, isRangeAnnotationConfig, -} from '../event_annotation_service/helpers'; +} from '@kbn/event-annotation-common'; import { annotationsIconSet } from './annotation_editor_controls/icon_set'; export const getAnnotationAccessor = (annotation: EventAnnotationConfig): AccessorConfig => { diff --git a/src/plugins/event_annotation/public/components/group_editor_controls/annotation_list.tsx b/packages/kbn-event-annotation-components/components/group_editor_controls/annotation_list.tsx similarity index 93% rename from src/plugins/event_annotation/public/components/group_editor_controls/annotation_list.tsx rename to packages/kbn-event-annotation-components/components/group_editor_controls/annotation_list.tsx index c81552100ccc6..72a4546659420 100644 --- a/src/plugins/event_annotation/public/components/group_editor_controls/annotation_list.tsx +++ b/packages/kbn-event-annotation-components/components/group_editor_controls/annotation_list.tsx @@ -17,12 +17,13 @@ import { DimensionButton, DimensionTrigger, EmptyDimensionButton, -} from '@kbn/visualization-ui-components/public'; +} from '@kbn/visualization-ui-components'; import React, { useCallback, useEffect, useState } from 'react'; import { v4 as uuidv4 } from 'uuid'; import { euiThemeVars } from '@kbn/ui-theme'; import { i18n } from '@kbn/i18n'; -import { createCopiedAnnotation, EventAnnotationConfig } from '../../../common'; +import type { EventAnnotationConfig } from '@kbn/event-annotation-common'; +import { createCopiedAnnotation } from '@kbn/event-annotation-common'; import { getAnnotationAccessor } from '..'; export const AnnotationList = ({ @@ -39,7 +40,7 @@ export const AnnotationList = ({ setNewAnnotationId(uuidv4()); }, [annotations.length]); - const addAnnotationText = i18n.translate('eventAnnotation.annotationList.add', { + const addAnnotationText = i18n.translate('eventAnnotationComponents.annotationList.add', { defaultMessage: 'Add annotation', }); @@ -118,7 +119,7 @@ export const AnnotationList = ({ }} > selectAnnotation(annotation)} diff --git a/src/plugins/event_annotation/public/components/group_editor_controls/group_editor_controls.test.tsx b/packages/kbn-event-annotation-components/components/group_editor_controls/group_editor_controls.test.tsx similarity index 97% rename from src/plugins/event_annotation/public/components/group_editor_controls/group_editor_controls.test.tsx rename to packages/kbn-event-annotation-components/components/group_editor_controls/group_editor_controls.test.tsx index d3b9f384a185f..5af119599ca6b 100644 --- a/src/plugins/event_annotation/public/components/group_editor_controls/group_editor_controls.test.tsx +++ b/packages/kbn-event-annotation-components/components/group_editor_controls/group_editor_controls.test.tsx @@ -7,14 +7,15 @@ */ import React, { ChangeEvent, FormEvent } from 'react'; -import { EventAnnotationGroupConfig, getDefaultManualAnnotation } from '../../../common'; +import type { EventAnnotationGroupConfig } from '@kbn/event-annotation-common'; +import { getDefaultManualAnnotation } from '@kbn/event-annotation-common'; import { ReactWrapper } from 'enzyme'; import { mountWithIntl } from '@kbn/test-jest-helpers'; import { GroupEditorControls } from './group_editor_controls'; import { EuiTextAreaProps, EuiTextProps } from '@elastic/eui'; import type { DataView } from '@kbn/data-views-plugin/common'; import { act } from 'react-dom/test-utils'; -import type { QueryInputServices } from '@kbn/visualization-ui-components/public'; +import type { QueryInputServices } from '@kbn/visualization-ui-components'; import { AnnotationEditorControls, ENABLE_INDIVIDUAL_ANNOTATION_EDITING } from '..'; jest.mock('@elastic/eui', () => { diff --git a/src/plugins/event_annotation/public/components/group_editor_controls/group_editor_controls.tsx b/packages/kbn-event-annotation-components/components/group_editor_controls/group_editor_controls.tsx similarity index 87% rename from src/plugins/event_annotation/public/components/group_editor_controls/group_editor_controls.tsx rename to packages/kbn-event-annotation-components/components/group_editor_controls/group_editor_controls.tsx index c0a07a6fcb72b..eb5a0dc7ad2fb 100644 --- a/src/plugins/event_annotation/public/components/group_editor_controls/group_editor_controls.tsx +++ b/packages/kbn-event-annotation-components/components/group_editor_controls/group_editor_controls.tsx @@ -19,12 +19,15 @@ import { css } from '@emotion/react'; import type { DataView, DataViewSpec } from '@kbn/data-views-plugin/common'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; -import { SavedObjectsTaggingApiUiComponent } from '@kbn/saved-objects-tagging-oss-plugin/public'; +import type { SavedObjectsTaggingApiUiComponent } from '@kbn/saved-objects-tagging-oss-plugin/public'; import { euiThemeVars } from '@kbn/ui-theme'; -import { QueryInputServices } from '@kbn/visualization-ui-components/public'; +import { QueryInputServices } from '@kbn/visualization-ui-components'; import React, { useCallback, useEffect, useMemo, useState } from 'react'; -import { EVENT_ANNOTATION_APP_NAME } from '../../../common/constants'; -import { EventAnnotationConfig, EventAnnotationGroupConfig } from '../../../common'; +import type { + EventAnnotationConfig, + EventAnnotationGroupConfig, +} from '@kbn/event-annotation-common'; +import { EVENT_ANNOTATION_APP_NAME } from '../../constants'; import { AnnotationEditorControls } from '../annotation_editor_controls'; import { AnnotationList } from './annotation_list'; @@ -99,16 +102,19 @@ export const GroupEditorControls = ({ `} >

- +

@@ -125,13 +131,13 @@ export const GroupEditorControls = ({ /> @@ -163,7 +169,7 @@ export const GroupEditorControls = ({ {ENABLE_INDIVIDUAL_ANNOTATION_EDITING && ( <> @@ -185,7 +191,7 @@ export const GroupEditorControls = ({ /> diff --git a/src/plugins/event_annotation/public/components/group_editor_controls/index.ts b/packages/kbn-event-annotation-components/components/group_editor_controls/index.ts similarity index 100% rename from src/plugins/event_annotation/public/components/group_editor_controls/index.ts rename to packages/kbn-event-annotation-components/components/group_editor_controls/index.ts diff --git a/src/plugins/event_annotation/public/components/group_editor_flyout.test.tsx b/packages/kbn-event-annotation-components/components/group_editor_flyout.test.tsx similarity index 96% rename from src/plugins/event_annotation/public/components/group_editor_flyout.test.tsx rename to packages/kbn-event-annotation-components/components/group_editor_flyout.test.tsx index 7f732aa882ffb..72ba259e1ad49 100644 --- a/src/plugins/event_annotation/public/components/group_editor_flyout.test.tsx +++ b/packages/kbn-event-annotation-components/components/group_editor_flyout.test.tsx @@ -7,14 +7,15 @@ */ import { EuiButton, EuiFlyout } from '@elastic/eui'; -import { EventAnnotationGroupConfig, getDefaultManualAnnotation } from '../../common'; +import { getDefaultManualAnnotation } from '@kbn/event-annotation-common'; +import type { EventAnnotationGroupConfig } from '@kbn/event-annotation-common'; import { taggingApiMock } from '@kbn/saved-objects-tagging-oss-plugin/public/api.mock'; import { shallow, ShallowWrapper } from 'enzyme'; import React from 'react'; import { GroupEditorControls } from './group_editor_controls'; import { GroupEditorFlyout } from './group_editor_flyout'; import { DataView } from '@kbn/data-views-plugin/common'; -import type { QueryInputServices } from '@kbn/visualization-ui-components/public'; +import type { QueryInputServices } from '@kbn/visualization-ui-components'; const simulateButtonClick = (component: ShallowWrapper, selector: string) => { (component.find(selector) as ShallowWrapper[0]>).prop('onClick')!( diff --git a/src/plugins/event_annotation/public/components/group_editor_flyout.tsx b/packages/kbn-event-annotation-components/components/group_editor_flyout.tsx similarity index 88% rename from src/plugins/event_annotation/public/components/group_editor_flyout.tsx rename to packages/kbn-event-annotation-components/components/group_editor_flyout.tsx index 3e296951542a8..9403a69a5d8b4 100644 --- a/src/plugins/event_annotation/public/components/group_editor_flyout.tsx +++ b/packages/kbn-event-annotation-components/components/group_editor_flyout.tsx @@ -20,10 +20,13 @@ import { } from '@elastic/eui'; import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; -import { SavedObjectsTaggingApi } from '@kbn/saved-objects-tagging-oss-plugin/public'; +import type { SavedObjectsTaggingApi } from '@kbn/saved-objects-tagging-oss-plugin/public'; import { DataView, DataViewSpec } from '@kbn/data-views-plugin/common'; -import type { QueryInputServices } from '@kbn/visualization-ui-components/public'; -import { EventAnnotationConfig, EventAnnotationGroupConfig } from '../../common'; +import type { QueryInputServices } from '@kbn/visualization-ui-components'; +import type { + EventAnnotationConfig, + EventAnnotationGroupConfig, +} from '@kbn/event-annotation-common'; import { GroupEditorControls, isGroupValid } from './group_editor_controls'; export const GroupEditorFlyout = ({ @@ -78,7 +81,7 @@ export const GroupEditorFlyout = ({

@@ -108,14 +111,17 @@ export const GroupEditorFlyout = ({ data-test-subj="backToGroupSettings" onClick={() => setSelectedAnnotation(undefined)} > - + ) : ( <> - + @@ -132,7 +138,7 @@ export const GroupEditorFlyout = ({ }} > diff --git a/src/plugins/event_annotation/public/components/index.ts b/packages/kbn-event-annotation-components/components/index.ts similarity index 89% rename from src/plugins/event_annotation/public/components/index.ts rename to packages/kbn-event-annotation-components/components/index.ts index 5433625c6344b..d2a46bce9ef8c 100644 --- a/src/plugins/event_annotation/public/components/index.ts +++ b/packages/kbn-event-annotation-components/components/index.ts @@ -6,8 +6,11 @@ * Side Public License, v 1. */ +// TODO - is this file needed? export { AnnotationEditorControls, annotationsIconSet } from './annotation_editor_controls'; export * from './group_editor_controls'; export * from './get_annotation_accessor'; + +export * from './table_list'; diff --git a/src/plugins/event_annotation/public/components/table_list.test.tsx b/packages/kbn-event-annotation-components/components/table_list.test.tsx similarity index 97% rename from src/plugins/event_annotation/public/components/table_list.test.tsx rename to packages/kbn-event-annotation-components/components/table_list.test.tsx index 66f3a7eedb397..d8e124e37ef6e 100644 --- a/src/plugins/event_annotation/public/components/table_list.test.tsx +++ b/packages/kbn-event-annotation-components/components/table_list.test.tsx @@ -16,16 +16,19 @@ import { TableListViewTable, type UserContentCommonSchema, } from '@kbn/content-management-table-list-view-table'; -import { EventAnnotationServiceType } from '../event_annotation_service/types'; +import type { EventAnnotationServiceType } from '../types'; import { IUiSettingsClient } from '@kbn/core-ui-settings-browser'; import { shallow, ShallowWrapper } from 'enzyme'; -import { EventAnnotationGroupConfig, EVENT_ANNOTATION_GROUP_TYPE } from '../../common'; +import { + EventAnnotationGroupConfig, + EVENT_ANNOTATION_GROUP_TYPE, +} from '@kbn/event-annotation-common'; import { taggingApiMock } from '@kbn/saved-objects-tagging-oss-plugin/public/mocks'; import { act } from 'react-dom/test-utils'; import { GroupEditorFlyout } from './group_editor_flyout'; import { DataView } from '@kbn/data-views-plugin/common'; -import { QueryInputServices } from '@kbn/visualization-ui-components/public'; +import { QueryInputServices } from '@kbn/visualization-ui-components'; import { toastsServiceMock } from '@kbn/core-notifications-browser-mocks/src/toasts_service.mock'; import { IToasts } from '@kbn/core-notifications-browser'; diff --git a/src/plugins/event_annotation/public/components/table_list.tsx b/packages/kbn-event-annotation-components/components/table_list.tsx similarity index 86% rename from src/plugins/event_annotation/public/components/table_list.tsx rename to packages/kbn-event-annotation-components/components/table_list.tsx index 2e172c4a9daed..0085678cbd786 100644 --- a/src/plugins/event_annotation/public/components/table_list.tsx +++ b/packages/kbn-event-annotation-components/components/table_list.tsx @@ -11,16 +11,18 @@ import { TableListViewTable } from '@kbn/content-management-table-list-view-tabl import type { TableListTabParentProps } from '@kbn/content-management-tabbed-table-list-view'; import { i18n } from '@kbn/i18n'; import type { IUiSettingsClient } from '@kbn/core-ui-settings-browser'; -import { SavedObjectsFindOptionsReference } from '@kbn/core-saved-objects-api-browser'; -import { SavedObjectsTaggingApi } from '@kbn/saved-objects-tagging-oss-plugin/public'; +import type { SavedObjectsFindOptionsReference } from '@kbn/core-saved-objects-api-browser'; +import type { SavedObjectsTaggingApi } from '@kbn/saved-objects-tagging-oss-plugin/public'; import { DataView, DataViewSpec } from '@kbn/data-views-plugin/common'; -import type { QueryInputServices } from '@kbn/visualization-ui-components/public'; +import type { QueryInputServices } from '@kbn/visualization-ui-components'; import { IToasts } from '@kbn/core-notifications-browser'; import { EuiButton, EuiEmptyPrompt, EuiTitle } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; -import { EventAnnotationGroupConfig } from '../../common'; -import type { EventAnnotationServiceType } from '../event_annotation_service/types'; -import { EventAnnotationGroupContent } from '../../common/types'; +import type { + EventAnnotationGroupConfig, + EventAnnotationGroupContent, +} from '@kbn/event-annotation-common'; +import type { EventAnnotationServiceType } from '../types'; import { GroupEditorFlyout } from './group_editor_flyout'; export const SAVED_OBJECTS_LIMIT_SETTING = 'savedObjects:listingLimit'; @@ -33,7 +35,7 @@ const getCustomColumn = (dataViews: DataView[]) => { return { field: 'dataView', - name: i18n.translate('eventAnnotation.tableList.dataView', { + name: i18n.translate('eventAnnotationComponents.tableList.dataView', { defaultMessage: 'Data view', }), sortable: false, @@ -144,7 +146,7 @@ export const EventAnnotationGroupTableList = ({ <> refreshListBouncer={refreshListBouncer} - tableCaption={i18n.translate('eventAnnotation.tableList.listTitle', { + tableCaption={i18n.translate('eventAnnotationComponents.tableList.listTitle', { defaultMessage: 'Annotation Library', })} findItems={fetchItems} @@ -164,7 +166,7 @@ export const EventAnnotationGroupTableList = ({

@@ -173,7 +175,7 @@ export const EventAnnotationGroupTableList = ({ body={

@@ -182,7 +184,7 @@ export const EventAnnotationGroupTableList = ({ actions={ @@ -190,10 +192,10 @@ export const EventAnnotationGroupTableList = ({ iconType="flag" /> } - entityName={i18n.translate('eventAnnotation.tableList.entityName', { + entityName={i18n.translate('eventAnnotationComponents.tableList.entityName', { defaultMessage: 'annotation group', })} - entityNamePlural={i18n.translate('eventAnnotation.tableList.entityNamePlural', { + entityNamePlural={i18n.translate('eventAnnotationComponents.tableList.entityNamePlural', { defaultMessage: 'annotation groups', })} onClickTitle={editItem} diff --git a/src/plugins/visualization_ui_components/common/types.ts b/packages/kbn-event-annotation-components/constants.ts similarity index 85% rename from src/plugins/visualization_ui_components/common/types.ts rename to packages/kbn-event-annotation-components/constants.ts index 7da9f13aced8d..7e057b92c5b4c 100644 --- a/src/plugins/visualization_ui_components/common/types.ts +++ b/packages/kbn-event-annotation-components/constants.ts @@ -6,4 +6,4 @@ * Side Public License, v 1. */ -export type LineStyle = 'solid' | 'dashed' | 'dotted'; +export const EVENT_ANNOTATION_APP_NAME = 'event-annotations'; diff --git a/packages/kbn-event-annotation-components/index.ts b/packages/kbn-event-annotation-components/index.ts new file mode 100644 index 0000000000000..5364609ab7e1e --- /dev/null +++ b/packages/kbn-event-annotation-components/index.ts @@ -0,0 +1,24 @@ +/* + * 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 { + AnnotationEditorControls, + annotationsIconSet, +} from './components/annotation_editor_controls'; +export { EventAnnotationGroupTableList, getAnnotationAccessor } from './components'; +export { + defaultAnnotationColor, + defaultAnnotationRangeColor, + defaultAnnotationLabel, + createCopiedAnnotation, + isRangeAnnotationConfig, + isManualPointAnnotationConfig, + isQueryAnnotationConfig, +} from '@kbn/event-annotation-common'; +export { EVENT_ANNOTATION_APP_NAME } from './constants'; +export type { EventAnnotationServiceType } from './types'; diff --git a/src/plugins/visualization_ui_components/common/index.ts b/packages/kbn-event-annotation-components/jest.config.js similarity index 73% rename from src/plugins/visualization_ui_components/common/index.ts rename to packages/kbn-event-annotation-components/jest.config.js index 3f66f3b659d8a..542264f8faaa4 100644 --- a/src/plugins/visualization_ui_components/common/index.ts +++ b/packages/kbn-event-annotation-components/jest.config.js @@ -6,4 +6,8 @@ * Side Public License, v 1. */ -export {}; +module.exports = { + preset: '@kbn/test', + rootDir: '../..', + roots: ['/packages/kbn-event-annotation-components'], +}; diff --git a/packages/kbn-event-annotation-components/kibana.jsonc b/packages/kbn-event-annotation-components/kibana.jsonc new file mode 100644 index 0000000000000..af30ffe6d3277 --- /dev/null +++ b/packages/kbn-event-annotation-components/kibana.jsonc @@ -0,0 +1,5 @@ +{ + "type": "shared-browser", + "id": "@kbn/event-annotation-components", + "owner": "@elastic/kibana-visualizations" +} diff --git a/packages/kbn-event-annotation-components/package.json b/packages/kbn-event-annotation-components/package.json new file mode 100644 index 0000000000000..763ddeaaaf949 --- /dev/null +++ b/packages/kbn-event-annotation-components/package.json @@ -0,0 +1,9 @@ +{ + "name": "@kbn/event-annotation-components", + "private": true, + "version": "1.0.0", + "license": "SSPL-1.0 OR Elastic License 2.0", + "sideEffects": [ + "*.scss" + ] +} diff --git a/packages/kbn-event-annotation-components/tsconfig.json b/packages/kbn-event-annotation-components/tsconfig.json new file mode 100644 index 0000000000000..09fa401ec12c7 --- /dev/null +++ b/packages/kbn-event-annotation-components/tsconfig.json @@ -0,0 +1,41 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "target/types", + "types": [ + "jest", + "node", + "@emotion/react/types/css-prop", + ] + }, + "include": [ + "**/*", + ], + "exclude": [ + "target/**/*" + ], + "kbn_references": [ + "@kbn/i18n", + "@kbn/visualization-ui-components", + "@kbn/ui-theme", + "@kbn/chart-icons", + "@kbn/unified-field-list", + "@kbn/data-views-plugin", + "@kbn/data-plugin", + "@kbn/test-jest-helpers", + "@kbn/saved-objects-tagging-oss-plugin", + "@kbn/core-ui-settings-browser", + "@kbn/dom-drag-drop", + "@kbn/content-management-table-list-view-table", + "@kbn/content-management-tabbed-table-list-view", + "@kbn/event-annotation-common", + "@kbn/core", + "@kbn/i18n-react", + "@kbn/saved-objects-finder-plugin", + "@kbn/saved-objects-management-plugin", + "@kbn/core-notifications-browser-mocks", + "@kbn/core-notifications-browser", + "@kbn/core-saved-objects-api-browser", + "@kbn/expressions-plugin", + ] +} diff --git a/src/plugins/event_annotation/public/event_annotation_service/types.ts b/packages/kbn-event-annotation-components/types.ts similarity index 87% rename from src/plugins/event_annotation/public/event_annotation_service/types.ts rename to packages/kbn-event-annotation-components/types.ts index 35b4ae910ad7b..495e204c1f4aa 100644 --- a/src/plugins/event_annotation/public/event_annotation_service/types.ts +++ b/packages/kbn-event-annotation-components/types.ts @@ -6,10 +6,13 @@ * Side Public License, v 1. */ -import { ExpressionAstExpression } from '@kbn/expressions-plugin/common/ast'; -import type { SavedObjectCommon } from '@kbn/saved-objects-finder-plugin/common'; -import { EventAnnotationGroupContent } from '../../common/types'; -import { EventAnnotationConfig, EventAnnotationGroupConfig } from '../../common'; +import { ExpressionAstExpression } from '@kbn/expressions-plugin/common'; +import { SavedObjectCommon } from '@kbn/saved-objects-finder-plugin/common'; +import type { + EventAnnotationConfig, + EventAnnotationGroupConfig, + EventAnnotationGroupContent, +} from '@kbn/event-annotation-common'; export interface EventAnnotationServiceType { loadAnnotationGroup: (savedObjectId: string) => Promise; diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index ac968b0d84dcc..aa52cb20178f1 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -161,5 +161,4 @@ pageLoadAssetSize: visTypeVislib: 242838 visTypeXy: 46868 visualizations: 90000 - visualizationUiComponents: 76424 watcher: 43598 diff --git a/packages/kbn-visualization-ui-components/README.md b/packages/kbn-visualization-ui-components/README.md new file mode 100644 index 0000000000000..180a8f38302d5 --- /dev/null +++ b/packages/kbn-visualization-ui-components/README.md @@ -0,0 +1,3 @@ +# @kbn/visualization-ui-components + +A set of components for interacting with visualizations. In practice, this is a place to put Lens components we want available outside of Lens. diff --git a/src/plugins/visualization_ui_components/public/components/color_picker.tsx b/packages/kbn-visualization-ui-components/components/color_picker.tsx similarity index 100% rename from src/plugins/visualization_ui_components/public/components/color_picker.tsx rename to packages/kbn-visualization-ui-components/components/color_picker.tsx diff --git a/src/plugins/visualization_ui_components/public/components/debounced_input.test.tsx b/packages/kbn-visualization-ui-components/components/debounced_input.test.tsx similarity index 100% rename from src/plugins/visualization_ui_components/public/components/debounced_input.test.tsx rename to packages/kbn-visualization-ui-components/components/debounced_input.test.tsx diff --git a/src/plugins/visualization_ui_components/public/components/debounced_input.tsx b/packages/kbn-visualization-ui-components/components/debounced_input.tsx similarity index 100% rename from src/plugins/visualization_ui_components/public/components/debounced_input.tsx rename to packages/kbn-visualization-ui-components/components/debounced_input.tsx diff --git a/src/plugins/visualization_ui_components/public/components/debounced_value.test.ts b/packages/kbn-visualization-ui-components/components/debounced_value.test.ts similarity index 100% rename from src/plugins/visualization_ui_components/public/components/debounced_value.test.ts rename to packages/kbn-visualization-ui-components/components/debounced_value.test.ts diff --git a/src/plugins/visualization_ui_components/public/components/debounced_value.ts b/packages/kbn-visualization-ui-components/components/debounced_value.ts similarity index 100% rename from src/plugins/visualization_ui_components/public/components/debounced_value.ts rename to packages/kbn-visualization-ui-components/components/debounced_value.ts diff --git a/src/plugins/visualization_ui_components/public/components/dimension_buttons/constants.ts b/packages/kbn-visualization-ui-components/components/dimension_buttons/constants.ts similarity index 100% rename from src/plugins/visualization_ui_components/public/components/dimension_buttons/constants.ts rename to packages/kbn-visualization-ui-components/components/dimension_buttons/constants.ts diff --git a/src/plugins/visualization_ui_components/public/components/dimension_buttons/dimension_button.test.tsx b/packages/kbn-visualization-ui-components/components/dimension_buttons/dimension_button.test.tsx similarity index 97% rename from src/plugins/visualization_ui_components/public/components/dimension_buttons/dimension_button.test.tsx rename to packages/kbn-visualization-ui-components/components/dimension_buttons/dimension_button.test.tsx index 0f83694f06d8d..235089d6f2a1c 100644 --- a/src/plugins/visualization_ui_components/public/components/dimension_buttons/dimension_button.test.tsx +++ b/packages/kbn-visualization-ui-components/components/dimension_buttons/dimension_button.test.tsx @@ -7,7 +7,6 @@ */ import { render, screen } from '@testing-library/react'; -import '@testing-library/jest-dom/extend-expect'; import React from 'react'; import { DimensionButton, DimensionButtonProps } from './dimension_button'; diff --git a/src/plugins/visualization_ui_components/public/components/dimension_buttons/dimension_button.tsx b/packages/kbn-visualization-ui-components/components/dimension_buttons/dimension_button.tsx similarity index 100% rename from src/plugins/visualization_ui_components/public/components/dimension_buttons/dimension_button.tsx rename to packages/kbn-visualization-ui-components/components/dimension_buttons/dimension_button.tsx diff --git a/src/plugins/visualization_ui_components/public/components/dimension_buttons/dimension_button_icon.tsx b/packages/kbn-visualization-ui-components/components/dimension_buttons/dimension_button_icon.tsx similarity index 100% rename from src/plugins/visualization_ui_components/public/components/dimension_buttons/dimension_button_icon.tsx rename to packages/kbn-visualization-ui-components/components/dimension_buttons/dimension_button_icon.tsx diff --git a/src/plugins/visualization_ui_components/public/components/dimension_buttons/empty_button.tsx b/packages/kbn-visualization-ui-components/components/dimension_buttons/empty_button.tsx similarity index 100% rename from src/plugins/visualization_ui_components/public/components/dimension_buttons/empty_button.tsx rename to packages/kbn-visualization-ui-components/components/dimension_buttons/empty_button.tsx diff --git a/src/plugins/visualization_ui_components/public/components/dimension_buttons/index.ts b/packages/kbn-visualization-ui-components/components/dimension_buttons/index.ts similarity index 100% rename from src/plugins/visualization_ui_components/public/components/dimension_buttons/index.ts rename to packages/kbn-visualization-ui-components/components/dimension_buttons/index.ts diff --git a/src/plugins/visualization_ui_components/public/components/dimension_buttons/palette_indicator.tsx b/packages/kbn-visualization-ui-components/components/dimension_buttons/palette_indicator.tsx similarity index 100% rename from src/plugins/visualization_ui_components/public/components/dimension_buttons/palette_indicator.tsx rename to packages/kbn-visualization-ui-components/components/dimension_buttons/palette_indicator.tsx diff --git a/src/plugins/visualization_ui_components/public/components/dimension_buttons/trigger.test.tsx b/packages/kbn-visualization-ui-components/components/dimension_buttons/trigger.test.tsx similarity index 96% rename from src/plugins/visualization_ui_components/public/components/dimension_buttons/trigger.test.tsx rename to packages/kbn-visualization-ui-components/components/dimension_buttons/trigger.test.tsx index a4c8c9e488aa8..1c09ffd6c9176 100644 --- a/src/plugins/visualization_ui_components/public/components/dimension_buttons/trigger.test.tsx +++ b/packages/kbn-visualization-ui-components/components/dimension_buttons/trigger.test.tsx @@ -7,7 +7,6 @@ */ import { render, screen } from '@testing-library/react'; -import '@testing-library/jest-dom/extend-expect'; import React from 'react'; import { DimensionTrigger } from './trigger'; diff --git a/src/plugins/visualization_ui_components/public/components/dimension_buttons/trigger.tsx b/packages/kbn-visualization-ui-components/components/dimension_buttons/trigger.tsx similarity index 100% rename from src/plugins/visualization_ui_components/public/components/dimension_buttons/trigger.tsx rename to packages/kbn-visualization-ui-components/components/dimension_buttons/trigger.tsx diff --git a/src/plugins/visualization_ui_components/public/components/dimension_buttons/types.ts b/packages/kbn-visualization-ui-components/components/dimension_buttons/types.ts similarity index 100% rename from src/plugins/visualization_ui_components/public/components/dimension_buttons/types.ts rename to packages/kbn-visualization-ui-components/components/dimension_buttons/types.ts diff --git a/src/plugins/visualization_ui_components/public/components/dimension_editor_section.scss b/packages/kbn-visualization-ui-components/components/dimension_editor_section.scss similarity index 100% rename from src/plugins/visualization_ui_components/public/components/dimension_editor_section.scss rename to packages/kbn-visualization-ui-components/components/dimension_editor_section.scss diff --git a/src/plugins/visualization_ui_components/public/components/dimension_editor_section.tsx b/packages/kbn-visualization-ui-components/components/dimension_editor_section.tsx similarity index 100% rename from src/plugins/visualization_ui_components/public/components/dimension_editor_section.tsx rename to packages/kbn-visualization-ui-components/components/dimension_editor_section.tsx diff --git a/src/plugins/visualization_ui_components/public/components/drag_drop_bucket/buckets.test.tsx b/packages/kbn-visualization-ui-components/components/drag_drop_bucket/buckets.test.tsx similarity index 100% rename from src/plugins/visualization_ui_components/public/components/drag_drop_bucket/buckets.test.tsx rename to packages/kbn-visualization-ui-components/components/drag_drop_bucket/buckets.test.tsx diff --git a/src/plugins/visualization_ui_components/public/components/drag_drop_bucket/buckets.tsx b/packages/kbn-visualization-ui-components/components/drag_drop_bucket/buckets.tsx similarity index 100% rename from src/plugins/visualization_ui_components/public/components/drag_drop_bucket/buckets.tsx rename to packages/kbn-visualization-ui-components/components/drag_drop_bucket/buckets.tsx diff --git a/src/plugins/visualization_ui_components/public/components/drag_drop_bucket/default_bucket_container.tsx b/packages/kbn-visualization-ui-components/components/drag_drop_bucket/default_bucket_container.tsx similarity index 100% rename from src/plugins/visualization_ui_components/public/components/drag_drop_bucket/default_bucket_container.tsx rename to packages/kbn-visualization-ui-components/components/drag_drop_bucket/default_bucket_container.tsx diff --git a/src/plugins/visualization_ui_components/public/components/drag_drop_bucket/fields_bucket_container.tsx b/packages/kbn-visualization-ui-components/components/drag_drop_bucket/fields_bucket_container.tsx similarity index 100% rename from src/plugins/visualization_ui_components/public/components/drag_drop_bucket/fields_bucket_container.tsx rename to packages/kbn-visualization-ui-components/components/drag_drop_bucket/fields_bucket_container.tsx diff --git a/src/plugins/visualization_ui_components/public/components/drag_drop_bucket/index.tsx b/packages/kbn-visualization-ui-components/components/drag_drop_bucket/index.tsx similarity index 100% rename from src/plugins/visualization_ui_components/public/components/drag_drop_bucket/index.tsx rename to packages/kbn-visualization-ui-components/components/drag_drop_bucket/index.tsx diff --git a/src/plugins/visualization_ui_components/public/components/drag_drop_bucket/new_bucket_button.tsx b/packages/kbn-visualization-ui-components/components/drag_drop_bucket/new_bucket_button.tsx similarity index 100% rename from src/plugins/visualization_ui_components/public/components/drag_drop_bucket/new_bucket_button.tsx rename to packages/kbn-visualization-ui-components/components/drag_drop_bucket/new_bucket_button.tsx diff --git a/src/plugins/visualization_ui_components/public/components/drag_drop_bucket/types.ts b/packages/kbn-visualization-ui-components/components/drag_drop_bucket/types.ts similarity index 100% rename from src/plugins/visualization_ui_components/public/components/drag_drop_bucket/types.ts rename to packages/kbn-visualization-ui-components/components/drag_drop_bucket/types.ts diff --git a/src/plugins/visualization_ui_components/public/components/field_picker/field_picker.scss b/packages/kbn-visualization-ui-components/components/field_picker/field_picker.scss similarity index 100% rename from src/plugins/visualization_ui_components/public/components/field_picker/field_picker.scss rename to packages/kbn-visualization-ui-components/components/field_picker/field_picker.scss diff --git a/src/plugins/visualization_ui_components/public/components/field_picker/field_picker.tsx b/packages/kbn-visualization-ui-components/components/field_picker/field_picker.tsx similarity index 100% rename from src/plugins/visualization_ui_components/public/components/field_picker/field_picker.tsx rename to packages/kbn-visualization-ui-components/components/field_picker/field_picker.tsx diff --git a/src/plugins/visualization_ui_components/public/components/field_picker/index.ts b/packages/kbn-visualization-ui-components/components/field_picker/index.ts similarity index 100% rename from src/plugins/visualization_ui_components/public/components/field_picker/index.ts rename to packages/kbn-visualization-ui-components/components/field_picker/index.ts diff --git a/src/plugins/visualization_ui_components/public/components/field_picker/truncated_label.test.tsx b/packages/kbn-visualization-ui-components/components/field_picker/truncated_label.test.tsx similarity index 100% rename from src/plugins/visualization_ui_components/public/components/field_picker/truncated_label.test.tsx rename to packages/kbn-visualization-ui-components/components/field_picker/truncated_label.test.tsx diff --git a/src/plugins/visualization_ui_components/public/components/field_picker/truncated_label.tsx b/packages/kbn-visualization-ui-components/components/field_picker/truncated_label.tsx similarity index 100% rename from src/plugins/visualization_ui_components/public/components/field_picker/truncated_label.tsx rename to packages/kbn-visualization-ui-components/components/field_picker/truncated_label.tsx diff --git a/src/plugins/visualization_ui_components/public/components/field_picker/types.ts b/packages/kbn-visualization-ui-components/components/field_picker/types.ts similarity index 100% rename from src/plugins/visualization_ui_components/public/components/field_picker/types.ts rename to packages/kbn-visualization-ui-components/components/field_picker/types.ts diff --git a/src/plugins/visualization_ui_components/public/components/icon_select.tsx b/packages/kbn-visualization-ui-components/components/icon_select.tsx similarity index 100% rename from src/plugins/visualization_ui_components/public/components/icon_select.tsx rename to packages/kbn-visualization-ui-components/components/icon_select.tsx diff --git a/src/plugins/visualization_ui_components/public/components/index.ts b/packages/kbn-visualization-ui-components/components/index.ts similarity index 100% rename from src/plugins/visualization_ui_components/public/components/index.ts rename to packages/kbn-visualization-ui-components/components/index.ts diff --git a/src/plugins/visualization_ui_components/public/components/line_style_settings.tsx b/packages/kbn-visualization-ui-components/components/line_style_settings.tsx similarity index 98% rename from src/plugins/visualization_ui_components/public/components/line_style_settings.tsx rename to packages/kbn-visualization-ui-components/components/line_style_settings.tsx index 0b7f09b6a7444..83315113648b4 100644 --- a/src/plugins/visualization_ui_components/public/components/line_style_settings.tsx +++ b/packages/kbn-visualization-ui-components/components/line_style_settings.tsx @@ -15,7 +15,7 @@ import { EuiFlexItem, EuiFormRow, } from '@elastic/eui'; -import { LineStyle } from '../../common/types'; +import { LineStyle } from '../types'; interface LineStyleConfig { lineStyle?: LineStyle; diff --git a/src/plugins/visualization_ui_components/public/components/name_input.tsx b/packages/kbn-visualization-ui-components/components/name_input.tsx similarity index 100% rename from src/plugins/visualization_ui_components/public/components/name_input.tsx rename to packages/kbn-visualization-ui-components/components/name_input.tsx diff --git a/src/plugins/visualization_ui_components/public/components/query_input/filter_query_input.scss b/packages/kbn-visualization-ui-components/components/query_input/filter_query_input.scss similarity index 100% rename from src/plugins/visualization_ui_components/public/components/query_input/filter_query_input.scss rename to packages/kbn-visualization-ui-components/components/query_input/filter_query_input.scss diff --git a/src/plugins/visualization_ui_components/public/components/query_input/filter_query_input.tsx b/packages/kbn-visualization-ui-components/components/query_input/filter_query_input.tsx similarity index 100% rename from src/plugins/visualization_ui_components/public/components/query_input/filter_query_input.tsx rename to packages/kbn-visualization-ui-components/components/query_input/filter_query_input.tsx diff --git a/src/plugins/visualization_ui_components/public/components/query_input/helpers.ts b/packages/kbn-visualization-ui-components/components/query_input/helpers.ts similarity index 100% rename from src/plugins/visualization_ui_components/public/components/query_input/helpers.ts rename to packages/kbn-visualization-ui-components/components/query_input/helpers.ts diff --git a/src/plugins/visualization_ui_components/public/components/query_input/index.ts b/packages/kbn-visualization-ui-components/components/query_input/index.ts similarity index 100% rename from src/plugins/visualization_ui_components/public/components/query_input/index.ts rename to packages/kbn-visualization-ui-components/components/query_input/index.ts diff --git a/src/plugins/visualization_ui_components/public/components/query_input/query_input.tsx b/packages/kbn-visualization-ui-components/components/query_input/query_input.tsx similarity index 95% rename from src/plugins/visualization_ui_components/public/components/query_input/query_input.tsx rename to packages/kbn-visualization-ui-components/components/query_input/query_input.tsx index 4a6c4c4ecb3ba..72acfe40b5a64 100644 --- a/src/plugins/visualization_ui_components/public/components/query_input/query_input.tsx +++ b/packages/kbn-visualization-ui-components/components/query_input/query_input.tsx @@ -10,8 +10,10 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { isEqual } from 'lodash'; import type { Query } from '@kbn/es-query'; -import { QueryStringInput } from '@kbn/unified-search-plugin/public'; -import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; +import { + type UnifiedSearchPublicPluginStart, + QueryStringInput, +} from '@kbn/unified-search-plugin/public'; import type { HttpStart } from '@kbn/core-http-browser'; import type { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import type { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; diff --git a/src/plugins/visualization_ui_components/public/components/text_decoration_setting.tsx b/packages/kbn-visualization-ui-components/components/text_decoration_setting.tsx similarity index 100% rename from src/plugins/visualization_ui_components/public/components/text_decoration_setting.tsx rename to packages/kbn-visualization-ui-components/components/text_decoration_setting.tsx diff --git a/src/plugins/visualization_ui_components/public/components/tooltip_wrapper.tsx b/packages/kbn-visualization-ui-components/components/tooltip_wrapper.tsx similarity index 100% rename from src/plugins/visualization_ui_components/public/components/tooltip_wrapper.tsx rename to packages/kbn-visualization-ui-components/components/tooltip_wrapper.tsx diff --git a/src/plugins/visualization_ui_components/public/index.ts b/packages/kbn-visualization-ui-components/index.ts similarity index 84% rename from src/plugins/visualization_ui_components/public/index.ts rename to packages/kbn-visualization-ui-components/index.ts index c56b6cb2c3d12..8b9f29fec31a1 100644 --- a/src/plugins/visualization_ui_components/public/index.ts +++ b/packages/kbn-visualization-ui-components/index.ts @@ -6,8 +6,6 @@ * Side Public License, v 1. */ -import { VisualizationUiComponentsPlugin } from './plugin'; - export { FieldPicker, TruncatedLabel, @@ -46,8 +44,4 @@ export type { QueryInputServices, } from './components'; -export type { FormatFactory } from './types'; - -export function plugin() { - return new VisualizationUiComponentsPlugin(); -} +export type { FormatFactory, LineStyle } from './types'; diff --git a/packages/kbn-visualization-ui-components/jest.config.js b/packages/kbn-visualization-ui-components/jest.config.js new file mode 100644 index 0000000000000..2ab4eb50cb01c --- /dev/null +++ b/packages/kbn-visualization-ui-components/jest.config.js @@ -0,0 +1,14 @@ +/* + * 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-visualization-ui-components'], + setupFiles: ['jest-canvas-mock'], +}; diff --git a/packages/kbn-visualization-ui-components/kibana.jsonc b/packages/kbn-visualization-ui-components/kibana.jsonc new file mode 100644 index 0000000000000..c17c88cb88ad8 --- /dev/null +++ b/packages/kbn-visualization-ui-components/kibana.jsonc @@ -0,0 +1,5 @@ +{ + "type": "shared-browser", + "id": "@kbn/visualization-ui-components", + "owner": "@elastic/kibana-visualizations" +} diff --git a/src/plugins/visualization_ui_components/package.json b/packages/kbn-visualization-ui-components/package.json similarity index 52% rename from src/plugins/visualization_ui_components/package.json rename to packages/kbn-visualization-ui-components/package.json index 4df9dbe5d1ee0..0f3943fd70d4b 100644 --- a/src/plugins/visualization_ui_components/package.json +++ b/packages/kbn-visualization-ui-components/package.json @@ -2,5 +2,8 @@ "name": "@kbn/visualization-ui-components", "private": true, "version": "1.0.0", - "license": "SSPL-1.0 OR Elastic License 2.0" + "license": "SSPL-1.0 OR Elastic License 2.0", + "sideEffects": [ + "*.scss" + ] } diff --git a/src/plugins/visualization_ui_components/tsconfig.json b/packages/kbn-visualization-ui-components/tsconfig.json similarity index 69% rename from src/plugins/visualization_ui_components/tsconfig.json rename to packages/kbn-visualization-ui-components/tsconfig.json index 564edd2ada1cf..69de29b5eed5e 100644 --- a/src/plugins/visualization_ui_components/tsconfig.json +++ b/packages/kbn-visualization-ui-components/tsconfig.json @@ -1,13 +1,19 @@ { - "extends": "../../../tsconfig.base.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "outDir": "target/types", + "types": [ + "jest", + "node", + "@emotion/react/types/css-prop", + "@testing-library/jest-dom" + ] }, "include": [ - "../../typings/**/*", - "common/**/*", - "public/**/*", - "server/**/*", + "**/*", + ], + "exclude": [ + "target/**/*" ], "kbn_references": [ "@kbn/i18n", @@ -21,14 +27,9 @@ "@kbn/core-ui-settings-browser", "@kbn/core-notifications-browser", "@kbn/core-doc-links-browser", - "@kbn/core", "@kbn/ui-theme", "@kbn/coloring", "@kbn/field-formats-plugin", - "@kbn/unified-field-list" + "@kbn/unified-field-list", ], - "exclude": [ - "target/**/*", - ] } - diff --git a/src/plugins/visualization_ui_components/public/types.ts b/packages/kbn-visualization-ui-components/types.ts similarity index 90% rename from src/plugins/visualization_ui_components/public/types.ts rename to packages/kbn-visualization-ui-components/types.ts index 8d259c3b90f90..2e72eb9a305cf 100644 --- a/src/plugins/visualization_ui_components/public/types.ts +++ b/packages/kbn-visualization-ui-components/types.ts @@ -9,3 +9,5 @@ import type { IFieldFormat, SerializedFieldFormat } from '@kbn/field-formats-plugin/common'; export type FormatFactory = (mapping?: SerializedFieldFormat) => IFieldFormat; + +export type LineStyle = 'solid' | 'dashed' | 'dotted'; diff --git a/src/plugins/visualization_ui_components/public/util.ts b/packages/kbn-visualization-ui-components/util.ts similarity index 100% rename from src/plugins/visualization_ui_components/public/util.ts rename to packages/kbn-visualization-ui-components/util.ts diff --git a/src/plugins/chart_expressions/expression_xy/common/types/expression_renderers.ts b/src/plugins/chart_expressions/expression_xy/common/types/expression_renderers.ts index 4615a77b9e1e1..00f9d944f3d28 100644 --- a/src/plugins/chart_expressions/expression_xy/common/types/expression_renderers.ts +++ b/src/plugins/chart_expressions/expression_xy/common/types/expression_renderers.ts @@ -8,10 +8,8 @@ import { CustomAnnotationTooltip } from '@elastic/charts'; import type { AllowedChartOverrides, AllowedSettingsOverrides } from '@kbn/charts-plugin/common'; -import { - AvailableAnnotationIcon, - ManualPointEventAnnotationArgs, -} from '@kbn/event-annotation-plugin/common'; +import { ManualPointEventAnnotationArgs } from '@kbn/event-annotation-plugin/common'; +import type { AvailableAnnotationIcon } from '@kbn/event-annotation-common'; import { XY_VIS_RENDERER } from '../constants'; import type { AllowedXYOverrides, XYProps } from './expression_functions'; diff --git a/src/plugins/chart_expressions/expression_xy/public/components/annotations.tsx b/src/plugins/chart_expressions/expression_xy/public/components/annotations.tsx index 7b8117e438cd3..04147dacfba6f 100644 --- a/src/plugins/chart_expressions/expression_xy/public/components/annotations.tsx +++ b/src/plugins/chart_expressions/expression_xy/public/components/annotations.tsx @@ -34,10 +34,7 @@ import type { ManualRangeEventAnnotationRow, } from '@kbn/event-annotation-plugin/common'; import type { FieldFormat, FormatFactory } from '@kbn/field-formats-plugin/common'; -import { - defaultAnnotationColor, - defaultAnnotationRangeColor, -} from '@kbn/event-annotation-plugin/public'; +import { defaultAnnotationColor, defaultAnnotationRangeColor } from '@kbn/event-annotation-common'; import { Datatable, DatatableColumn, DatatableRow } from '@kbn/expressions-plugin/common'; import { PointEventAnnotationRow } from '@kbn/event-annotation-plugin/common/manual_event_annotation/types'; import { FormattedMessage } from '@kbn/i18n-react'; diff --git a/src/plugins/chart_expressions/expression_xy/tsconfig.json b/src/plugins/chart_expressions/expression_xy/tsconfig.json index eccb9aaf5b9e3..7f2af7005070d 100644 --- a/src/plugins/chart_expressions/expression_xy/tsconfig.json +++ b/src/plugins/chart_expressions/expression_xy/tsconfig.json @@ -31,6 +31,7 @@ "@kbn/analytics", "@kbn/kibana-react-plugin", "@kbn/chart-expressions-common", + "@kbn/event-annotation-common", ], "exclude": [ "target/**/*", diff --git a/src/plugins/event_annotation/common/constants.ts b/src/plugins/event_annotation/common/constants.ts index 08398d53119cc..65e16b9b36110 100644 --- a/src/plugins/event_annotation/common/constants.ts +++ b/src/plugins/event_annotation/common/constants.ts @@ -6,26 +6,7 @@ * Side Public License, v 1. */ -export const AvailableAnnotationIcons = { - ASTERISK: 'asterisk', - ALERT: 'alert', - BELL: 'bell', - BOLT: 'bolt', - BUG: 'bug', - CIRCLE: 'circle', - EDITOR_COMMENT: 'editorComment', - FLAG: 'flag', - HEART: 'heart', - MAP_MARKER: 'mapMarker', - PIN_FILLED: 'pinFilled', - STAR_EMPTY: 'starEmpty', - STAR_FILLED: 'starFilled', - TAG: 'tag', - TRIANGLE: 'triangle', -} as const; - -export const EVENT_ANNOTATION_GROUP_TYPE = 'event-annotation-group'; - +// TODO - deduplicate with event_annotation_application export const ANNOTATIONS_LISTING_VIEW_ID = 'annotations'; export const EVENT_ANNOTATION_APP_NAME = 'event-annotations'; diff --git a/src/plugins/event_annotation/common/content_management/v1/types.ts b/src/plugins/event_annotation/common/content_management/v1/types.ts index d3370b9ff28bf..e12a0bc813174 100644 --- a/src/plugins/event_annotation/common/content_management/v1/types.ts +++ b/src/plugins/event_annotation/common/content_management/v1/types.ts @@ -20,8 +20,8 @@ import { } from '@kbn/content-management-plugin/common'; import type { DataViewSpec } from '@kbn/data-views-plugin/common'; +import type { EventAnnotationConfig } from '@kbn/event-annotation-common'; import { EventAnnotationGroupContentType } from '../types'; -import { EventAnnotationConfig } from '../../types'; export interface Reference { type: string; diff --git a/src/plugins/event_annotation/common/create_copied_annotation.ts b/src/plugins/event_annotation/common/create_copied_annotation.ts deleted file mode 100644 index caab8923c855e..0000000000000 --- a/src/plugins/event_annotation/common/create_copied_annotation.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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. - */ - -import { getDefaultManualAnnotation } from './manual_event_annotation'; -import { EventAnnotationConfig } from './types'; - -export const createCopiedAnnotation = ( - newId: string, - timestamp: string, - source?: EventAnnotationConfig -): EventAnnotationConfig => { - if (!source) { - return getDefaultManualAnnotation(newId, timestamp); - } - return { - ...source, - id: newId, - }; -}; diff --git a/src/plugins/event_annotation/common/fetch_event_annotations/utils.ts b/src/plugins/event_annotation/common/fetch_event_annotations/utils.ts index 88979fce32002..9dfe4199d887d 100644 --- a/src/plugins/event_annotation/common/fetch_event_annotations/utils.ts +++ b/src/plugins/event_annotation/common/fetch_event_annotations/utils.ts @@ -12,19 +12,15 @@ import { omit, pick } from 'lodash'; import dateMath from '@kbn/datemath'; import moment from 'moment'; import { IUiSettingsClient } from '@kbn/core-ui-settings-browser'; -import { LineStyle } from '@kbn/visualization-ui-components/common/types'; +import type { LineStyle } from '@kbn/visualization-ui-components'; +import type { AvailableAnnotationIcon, PointStyleProps } from '@kbn/event-annotation-common'; import { ManualEventAnnotationOutput, ManualPointEventAnnotationOutput, ManualRangeEventAnnotationOutput, } from '../manual_event_annotation/types'; import { QueryPointEventAnnotationOutput } from '../query_point_event_annotation/types'; -import { - annotationColumns, - AvailableAnnotationIcon, - EventAnnotationOutput, - PointStyleProps, -} from '../types'; +import { annotationColumns, EventAnnotationOutput } from '../types'; export const isRangeAnnotation = ( annotation: EventAnnotationOutput diff --git a/src/plugins/event_annotation/common/index.ts b/src/plugins/event_annotation/common/index.ts index e0d773b4c996e..e4648d82fb765 100644 --- a/src/plugins/event_annotation/common/index.ts +++ b/src/plugins/event_annotation/common/index.ts @@ -18,31 +18,13 @@ export type { QueryPointEventAnnotationArgs, QueryPointEventAnnotationOutput, } from './query_point_event_annotation/types'; -export { - manualPointEventAnnotation, - manualRangeEventAnnotation, - getDefaultManualAnnotation, -} from './manual_event_annotation'; -export { - queryPointEventAnnotation, - getDefaultQueryAnnotation, -} from './query_point_event_annotation'; -export { createCopiedAnnotation } from './create_copied_annotation'; +export { manualPointEventAnnotation, manualRangeEventAnnotation } from './manual_event_annotation'; +export { queryPointEventAnnotation } from './query_point_event_annotation'; export { eventAnnotationGroup } from './event_annotation_group'; export type { EventAnnotationGroupArgs } from './event_annotation_group'; export type { FetchEventAnnotationsArgs } from './fetch_event_annotations/types'; -export type { - EventAnnotationConfig, - EventAnnotationGroupConfig, - EventAnnotationArgs, - RangeEventAnnotationConfig, - PointInTimeEventAnnotationConfig, - QueryPointEventAnnotationConfig, - AvailableAnnotationIcon, - EventAnnotationOutput, - EventAnnotationGroupAttributes, -} from './types'; +export type { EventAnnotationArgs, EventAnnotationOutput } from './types'; export type { EventAnnotationGroupSavedObjectAttributes } from './content_management'; -export { EVENT_ANNOTATION_GROUP_TYPE, ANNOTATIONS_LISTING_VIEW_ID } from './constants'; +export { ANNOTATIONS_LISTING_VIEW_ID } from './constants'; diff --git a/src/plugins/event_annotation/common/manual_event_annotation/index.ts b/src/plugins/event_annotation/common/manual_event_annotation/index.ts index 12d00cefc75b4..7a44809ec5622 100644 --- a/src/plugins/event_annotation/common/manual_event_annotation/index.ts +++ b/src/plugins/event_annotation/common/manual_event_annotation/index.ts @@ -8,8 +8,7 @@ import type { ExpressionFunctionDefinition } from '@kbn/expressions-plugin/common'; import { i18n } from '@kbn/i18n'; -import { AvailableAnnotationIcons } from '../constants'; -import { EventAnnotationConfig } from '../types'; +import { AvailableAnnotationIcons } from '@kbn/event-annotation-common'; import type { ManualRangeEventAnnotationArgs, @@ -164,24 +163,3 @@ export const manualRangeEventAnnotation: ExpressionFunctionDefinition< }; }, }; - -export const defaultAnnotationLabel = i18n.translate( - 'eventAnnotation.manualAnnotation.defaultAnnotationLabel', - { - defaultMessage: 'Event', - } -); - -export const getDefaultManualAnnotation = ( - id: string, - timestamp: string -): EventAnnotationConfig => ({ - label: defaultAnnotationLabel, - type: 'manual', - key: { - type: 'point_in_time', - timestamp, - }, - icon: 'triangle', - id, -}); diff --git a/src/plugins/event_annotation/common/manual_event_annotation/types.ts b/src/plugins/event_annotation/common/manual_event_annotation/types.ts index a74ba5723b61e..3158459c19ff5 100644 --- a/src/plugins/event_annotation/common/manual_event_annotation/types.ts +++ b/src/plugins/event_annotation/common/manual_event_annotation/types.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { PointStyleProps, RangeStyleProps } from '../types'; +import type { PointStyleProps, RangeStyleProps } from '@kbn/event-annotation-common'; export type ManualPointEventAnnotationArgs = { id: string; diff --git a/src/plugins/event_annotation/common/query_point_event_annotation/index.ts b/src/plugins/event_annotation/common/query_point_event_annotation/index.ts index 6c0ee0bd62eb7..f559a795d407b 100644 --- a/src/plugins/event_annotation/common/query_point_event_annotation/index.ts +++ b/src/plugins/event_annotation/common/query_point_event_annotation/index.ts @@ -8,8 +8,7 @@ import type { ExpressionFunctionDefinition } from '@kbn/expressions-plugin/common'; import { i18n } from '@kbn/i18n'; -import { AvailableAnnotationIcons } from '../constants'; -import { EventAnnotationConfig } from '../types'; +import { AvailableAnnotationIcons } from '@kbn/event-annotation-common'; import type { QueryPointEventAnnotationArgs, QueryPointEventAnnotationOutput } from './types'; @@ -112,22 +111,3 @@ export const queryPointEventAnnotation: ExpressionFunctionDefinition< }; }, }; - -export const getDefaultQueryAnnotation = ( - id: string, - fieldName: string, - timeField: string -): EventAnnotationConfig => ({ - filter: { - type: 'kibana_query', - query: `${fieldName}: *`, - language: 'kuery', - }, - timeField, - type: 'query', - key: { - type: 'point_in_time', - }, - id, - label: `${fieldName}: *`, -}); diff --git a/src/plugins/event_annotation/common/query_point_event_annotation/types.ts b/src/plugins/event_annotation/common/query_point_event_annotation/types.ts index 592c50a0621ce..7edf491504a91 100644 --- a/src/plugins/event_annotation/common/query_point_event_annotation/types.ts +++ b/src/plugins/event_annotation/common/query_point_event_annotation/types.ts @@ -7,7 +7,7 @@ */ import { KibanaQueryOutput } from '@kbn/data-plugin/common'; -import { PointStyleProps } from '../types'; +import type { PointStyleProps } from '@kbn/event-annotation-common'; export type QueryPointEventAnnotationArgs = { id: string; diff --git a/src/plugins/event_annotation/common/types.ts b/src/plugins/event_annotation/common/types.ts index 9bdd4cd283523..01078582d7578 100644 --- a/src/plugins/event_annotation/common/types.ts +++ b/src/plugins/event_annotation/common/types.ts @@ -6,12 +6,7 @@ * Side Public License, v 1. */ -import type { UserContentCommonSchema } from '@kbn/content-management-table-list-view'; -import { DataViewSpec, KibanaQueryOutput } from '@kbn/data-plugin/common'; import { DatatableColumn } from '@kbn/expressions-plugin/common'; -import { $Values } from '@kbn/utility-types'; -import { LineStyle } from '@kbn/visualization-ui-components/common/types'; -import { AvailableAnnotationIcons } from './constants'; import { ManualEventAnnotationOutput, ManualPointEventAnnotationArgs, @@ -26,84 +21,6 @@ export type Fill = 'inside' | 'outside' | 'none'; export type ManualAnnotationType = 'manual'; export type QueryAnnotationType = 'query'; export type KeyType = 'point_in_time' | 'range'; -export type AvailableAnnotationIcon = $Values; - -interface StyleSharedProps { - label: string; - color?: string; - isHidden?: boolean; -} - -export type PointStyleProps = StyleSharedProps & { - icon?: AvailableAnnotationIcon; - lineWidth?: number; - lineStyle?: LineStyle; - textVisibility?: boolean; -}; - -export type PointInTimeEventAnnotationConfig = { - id: string; - type: ManualAnnotationType; - key: { - type: 'point_in_time'; - timestamp: string; - }; -} & PointStyleProps; - -export type RangeStyleProps = StyleSharedProps & { - outside?: boolean; -}; - -export type RangeEventAnnotationConfig = { - type: ManualAnnotationType; - id: string; - key: { - type: 'range'; - timestamp: string; - endTimestamp: string; - }; -} & RangeStyleProps; - -export type StyleProps = PointStyleProps & RangeStyleProps; - -export type QueryPointEventAnnotationConfig = { - id: string; - type: QueryAnnotationType; - filter: KibanaQueryOutput; - timeField?: string; - textField?: string; - extraFields?: string[]; - key: { - type: 'point_in_time'; - }; -} & PointStyleProps; - -export type EventAnnotationConfig = - | PointInTimeEventAnnotationConfig - | RangeEventAnnotationConfig - | QueryPointEventAnnotationConfig; - -export interface EventAnnotationGroupAttributes { - title: string; - description: string; - ignoreGlobalFilters: boolean; - annotations: EventAnnotationConfig[]; - dataViewSpec?: DataViewSpec | null; -} - -export interface EventAnnotationGroupConfig { - annotations: EventAnnotationConfig[]; - indexPatternId: string; - ignoreGlobalFilters: boolean; - title: string; - description: string; - tags: string[]; - dataViewSpec?: DataViewSpec; -} - -export type EventAnnotationGroupContent = UserContentCommonSchema & { - attributes: { indexPatternId: string; dataViewSpec?: DataViewSpec }; -}; export type EventAnnotationArgs = | ManualPointEventAnnotationArgs diff --git a/src/plugins/event_annotation/kibana.jsonc b/src/plugins/event_annotation/kibana.jsonc index 601aef0970911..d343ecd76b4dc 100644 --- a/src/plugins/event_annotation/kibana.jsonc +++ b/src/plugins/event_annotation/kibana.jsonc @@ -16,7 +16,6 @@ "dataViews", "unifiedSearch", "kibanaUtils", - "visualizationUiComponents", "contentManagement" ], "optionalPlugins": [ @@ -27,7 +26,6 @@ "savedObjectsFinder", "dataViews", "kibanaReact", - "visualizationUiComponents" ], "extraPublicDirs": [ "common" diff --git a/src/plugins/event_annotation/public/components/event_annotation_group_saved_object_finder.tsx b/src/plugins/event_annotation/public/components/event_annotation_group_saved_object_finder.tsx index 72f931797d3c4..4a969b210ef82 100644 --- a/src/plugins/event_annotation/public/components/event_annotation_group_saved_object_finder.tsx +++ b/src/plugins/event_annotation/public/components/event_annotation_group_saved_object_finder.tsx @@ -23,7 +23,7 @@ import { EuiText, } from '@elastic/eui'; import { css } from '@emotion/react'; -import { EVENT_ANNOTATION_GROUP_TYPE } from '../../common'; +import { EVENT_ANNOTATION_GROUP_TYPE } from '@kbn/event-annotation-common'; export const EventAnnotationGroupSavedObjectFinder = ({ uiSettings, diff --git a/src/plugins/event_annotation/public/components/group_editor_controls/get_annotation_accessor.ts b/src/plugins/event_annotation/public/components/group_editor_controls/get_annotation_accessor.ts deleted file mode 100644 index 59cdfe15d0814..0000000000000 --- a/src/plugins/event_annotation/public/components/group_editor_controls/get_annotation_accessor.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ - -import type { AccessorConfig } from '@kbn/visualization-ui-components/public'; -import type { EventAnnotationConfig } from '../../../common'; -import { - defaultAnnotationColor, - defaultAnnotationRangeColor, - isRangeAnnotationConfig, -} from '../../event_annotation_service/helpers'; -import { annotationsIconSet } from '../annotation_editor_controls'; - -export const getAnnotationAccessor = (annotation: EventAnnotationConfig): AccessorConfig => { - const annotationIcon = !isRangeAnnotationConfig(annotation) - ? annotationsIconSet.find((option) => option.value === annotation?.icon) || - annotationsIconSet.find((option) => option.value === 'triangle') - : undefined; - const icon = annotationIcon?.icon ?? annotationIcon?.value; - return { - columnId: annotation.id, - triggerIconType: annotation.isHidden ? 'invisible' : icon ? 'custom' : 'color', - customIcon: icon, - color: - annotation?.color || - (isRangeAnnotationConfig(annotation) ? defaultAnnotationRangeColor : defaultAnnotationColor), - }; -}; diff --git a/src/plugins/event_annotation/public/event_annotation_service/index.tsx b/src/plugins/event_annotation/public/event_annotation_service/index.tsx index 5e509ac857218..0bc2f9e918038 100644 --- a/src/plugins/event_annotation/public/event_annotation_service/index.tsx +++ b/src/plugins/event_annotation/public/event_annotation_service/index.tsx @@ -9,7 +9,8 @@ import { CoreStart } from '@kbn/core/public'; import { SavedObjectsManagementPluginStart } from '@kbn/saved-objects-management-plugin/public'; import { ContentManagementPublicStart } from '@kbn/content-management-plugin/public'; -import { EventAnnotationServiceType } from './types'; +import { EventAnnotationServiceType } from '@kbn/event-annotation-components'; +export type { EventAnnotationServiceType }; export class EventAnnotationService { private eventAnnotationService?: EventAnnotationServiceType; diff --git a/src/plugins/event_annotation/public/event_annotation_service/service.test.ts b/src/plugins/event_annotation/public/event_annotation_service/service.test.ts index 5cf069d57aaa5..6463f14441995 100644 --- a/src/plugins/event_annotation/public/event_annotation_service/service.test.ts +++ b/src/plugins/event_annotation/public/event_annotation_service/service.test.ts @@ -10,15 +10,19 @@ import { CoreStart, SimpleSavedObject } from '@kbn/core/public'; import { ContentClient, ContentManagementPublicStart } from '@kbn/content-management-plugin/public'; import { coreMock } from '@kbn/core/public/mocks'; import { SavedObjectsManagementPluginStart } from '@kbn/saved-objects-management-plugin/public'; -import { EventAnnotationConfig, EventAnnotationGroupAttributes } from '../../common'; +import { EventAnnotationConfig } from '@kbn/event-annotation-common'; import { getEventAnnotationService } from './service'; -import { EventAnnotationServiceType } from './types'; +import { EventAnnotationServiceType } from '@kbn/event-annotation-components'; +import { EventAnnotationGroupSavedObjectAttributes } from '../../common'; -type AnnotationGroupSavedObject = SimpleSavedObject; +// TODO - I think applying this saved object type is no longer correct - since we migrated to content management, +// there is no longer a single interchange format. Instead, the tests should use the operation-specific +// CM types such as EventAnnotationGroupUpdateOut and EventAnnotationGroupCreateOut. +type AnnotationGroupSavedObject = SimpleSavedObject; const annotationGroupResolveMocks: Record = { nonExistingGroup: { - attributes: {} as EventAnnotationGroupAttributes, + attributes: {} as EventAnnotationGroupSavedObjectAttributes, references: [], id: 'nonExistingGroup', error: { @@ -69,7 +73,7 @@ const annotationGroupResolveMocks: Record = dataViewSpec: { id: 'my-id', }, - } as Partial, + } as Partial, id: 'multiAnnotations', type: 'event-annotation-group', references: [], @@ -625,7 +629,7 @@ describe('Event Annotation Service', () => { annotations: [], dataViewSpec: undefined, ignoreGlobalFilters: false, - } as EventAnnotationGroupAttributes, + } as EventAnnotationGroupSavedObjectAttributes, options: { references: [ { diff --git a/src/plugins/event_annotation/public/event_annotation_service/service.tsx b/src/plugins/event_annotation/public/event_annotation_service/service.tsx index 6511999b2c109..c520f02d37dbd 100644 --- a/src/plugins/event_annotation/public/event_annotation_service/service.tsx +++ b/src/plugins/event_annotation/public/event_annotation_service/service.tsx @@ -14,16 +14,17 @@ import type { CoreStart, SavedObjectReference } from '@kbn/core/public'; import { SavedObjectsManagementPluginStart } from '@kbn/saved-objects-management-plugin/public'; import { DataViewPersistableStateService } from '@kbn/data-views-plugin/common'; import { ContentManagementPublicStart } from '@kbn/content-management-plugin/public'; -import { defaultAnnotationLabel } from '../../common/manual_event_annotation'; -import { EventAnnotationGroupContent } from '../../common/types'; -import { EventAnnotationConfig, EventAnnotationGroupConfig } from '../../common'; -import { EventAnnotationServiceType } from './types'; +import { type EventAnnotationServiceType } from '@kbn/event-annotation-components'; import { defaultAnnotationColor, defaultAnnotationRangeColor, isRangeAnnotationConfig, isQueryAnnotationConfig, -} from './helpers'; + defaultAnnotationLabel, + type EventAnnotationGroupContent, + type EventAnnotationConfig, + type EventAnnotationGroupConfig, +} from '@kbn/event-annotation-common'; import { EventAnnotationGroupSavedObjectFinder } from '../components/event_annotation_group_saved_object_finder'; import { CONTENT_ID } from '../../common/content_management'; import type { diff --git a/src/plugins/event_annotation/public/get_table_list.tsx b/src/plugins/event_annotation/public/get_table_list.tsx index 5226d31894d15..d05eba6a0ecc8 100644 --- a/src/plugins/event_annotation/public/get_table_list.tsx +++ b/src/plugins/event_annotation/public/get_table_list.tsx @@ -14,10 +14,10 @@ import { type TableListTabParentProps } from '@kbn/content-management-tabbed-tab import type { CoreStart } from '@kbn/core-lifecycle-browser'; import type { SavedObjectsTaggingApi } from '@kbn/saved-objects-tagging-oss-plugin/public'; import type { DataView, DataViewSpec } from '@kbn/data-views-plugin/common'; -import type { QueryInputServices } from '@kbn/visualization-ui-components/public'; +import type { QueryInputServices } from '@kbn/visualization-ui-components'; import { RootDragDropProvider } from '@kbn/dom-drag-drop'; -import type { EventAnnotationServiceType } from './event_annotation_service/types'; -import { EventAnnotationGroupTableList } from './components/table_list'; +import { EventAnnotationGroupTableList } from '@kbn/event-annotation-components'; +import type { EventAnnotationServiceType } from '.'; export interface EventAnnotationListingPageServices { core: CoreStart; diff --git a/src/plugins/event_annotation/public/index.ts b/src/plugins/event_annotation/public/index.ts index 1b96e39546bcb..f9419fec7e3b8 100644 --- a/src/plugins/event_annotation/public/index.ts +++ b/src/plugins/event_annotation/public/index.ts @@ -6,23 +6,8 @@ * Side Public License, v 1. */ -// TODO: https://github.com/elastic/kibana/issues/110891 -/* eslint-disable @kbn/eslint/no_export_all */ - import { EventAnnotationPlugin } from './plugin'; export const plugin = () => new EventAnnotationPlugin(); export type { EventAnnotationPluginSetup, EventAnnotationPluginStart } from './plugin'; -export * from './event_annotation_service/types'; export { EventAnnotationService } from './event_annotation_service'; -export { - defaultAnnotationColor, - defaultAnnotationRangeColor, - isRangeAnnotationConfig, - isManualPointAnnotationConfig, - isQueryAnnotationConfig, -} from './event_annotation_service/helpers'; -export { - AnnotationEditorControls, - annotationsIconSet, -} from './components/annotation_editor_controls'; -export { getAnnotationAccessor } from './components/get_annotation_accessor'; +export type { EventAnnotationServiceType } from './event_annotation_service'; diff --git a/src/plugins/event_annotation/server/content_management/event_annotation_group_storage.ts b/src/plugins/event_annotation/server/content_management/event_annotation_group_storage.ts index 5755a7efe998f..890b9f9d5bec6 100644 --- a/src/plugins/event_annotation/server/content_management/event_annotation_group_storage.ts +++ b/src/plugins/event_annotation/server/content_management/event_annotation_group_storage.ts @@ -15,7 +15,7 @@ import type { SavedObjectsFindOptions, } from '@kbn/core-saved-objects-api-server'; -import { EVENT_ANNOTATION_GROUP_TYPE } from '../../common'; +import { EVENT_ANNOTATION_GROUP_TYPE } from '@kbn/event-annotation-common'; import { cmServicesDefinition } from '../../common/content_management/cm_services'; import type { EventAnnotationGroupSavedObjectAttributes, diff --git a/src/plugins/event_annotation/server/saved_objects.ts b/src/plugins/event_annotation/server/saved_objects.ts index f5b23b0bdd598..950f286465e1b 100644 --- a/src/plugins/event_annotation/server/saved_objects.ts +++ b/src/plugins/event_annotation/server/saved_objects.ts @@ -15,7 +15,8 @@ import { import { DataViewPersistableStateService } from '@kbn/data-views-plugin/common'; import { VISUALIZE_APP_NAME } from '@kbn/visualizations-plugin/common/constants'; -import { ANNOTATIONS_LISTING_VIEW_ID, EVENT_ANNOTATION_GROUP_TYPE } from '../common/constants'; +import { EVENT_ANNOTATION_GROUP_TYPE } from '@kbn/event-annotation-common'; +import { ANNOTATIONS_LISTING_VIEW_ID } from '../common/constants'; import { EventAnnotationGroupSavedObjectAttributes } from '../common'; export function setupSavedObjects(coreSetup: CoreSetup) { diff --git a/src/plugins/event_annotation/tsconfig.json b/src/plugins/event_annotation/tsconfig.json index 29df480e3a4a1..e65a50d3f75e2 100644 --- a/src/plugins/event_annotation/tsconfig.json +++ b/src/plugins/event_annotation/tsconfig.json @@ -18,37 +18,30 @@ "@kbn/inspector-plugin", "@kbn/core-ui-settings-browser", "@kbn/datemath", - "@kbn/ui-theme", "@kbn/saved-objects-finder-plugin", "@kbn/saved-objects-management-plugin", "@kbn/saved-objects-tagging-plugin", "@kbn/presentation-util-plugin", - "@kbn/content-management-table-list-view", "@kbn/visualizations-plugin", "@kbn/data-views-plugin", "@kbn/visualization-ui-components", - "@kbn/chart-icons", - "@kbn/dom-drag-drop", "@kbn/i18n-react", "@kbn/core-saved-objects-server", - "@kbn/test-jest-helpers", - "@kbn/saved-objects-tagging-oss-plugin", - "@kbn/core-saved-objects-api-browser", - "@kbn/kibana-react-plugin", - "@kbn/core-lifecycle-browser", - "@kbn/kibana-utils-plugin", "@kbn/unified-search-plugin", - "@kbn/content-management-table-list-view", - "@kbn/content-management-table-list-view-table", - "@kbn/content-management-tabbed-table-list-view", - "@kbn/core-notifications-browser", - "@kbn/core-notifications-browser-mocks", - "@kbn/unified-field-list", "@kbn/core-saved-objects-server", "@kbn/object-versioning", "@kbn/config-schema", "@kbn/content-management-plugin", - "@kbn/core-saved-objects-api-server" + "@kbn/core-saved-objects-api-server", + "@kbn/event-annotation-components", + "@kbn/event-annotation-common", + "@kbn/kibana-react-plugin", + "@kbn/content-management-table-list-view-table", + "@kbn/content-management-tabbed-table-list-view", + "@kbn/core-lifecycle-browser", + "@kbn/saved-objects-tagging-oss-plugin", + "@kbn/dom-drag-drop", + "@kbn/kibana-utils-plugin" ], "exclude": [ "target/**/*", diff --git a/src/plugins/unified_search/public/query_string_input/index.tsx b/src/plugins/unified_search/public/query_string_input/index.tsx index a92295b646535..eb29ab5eecb77 100644 --- a/src/plugins/unified_search/public/query_string_input/index.tsx +++ b/src/plugins/unified_search/public/query_string_input/index.tsx @@ -30,4 +30,5 @@ export const QueryStringInput = (props: QueryStringInputProps) => ( ); + export type { QueryStringInputProps }; diff --git a/src/plugins/visualization_ui_components/.i18nrc.json b/src/plugins/visualization_ui_components/.i18nrc.json deleted file mode 100755 index 8ec382bca5a93..0000000000000 --- a/src/plugins/visualization_ui_components/.i18nrc.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "prefix": "visualizationUiComponents", - "paths": { - "visualizationUiComponents": "." - } -} diff --git a/src/plugins/visualization_ui_components/README.md b/src/plugins/visualization_ui_components/README.md deleted file mode 100644 index dc50b4ede1e20..0000000000000 --- a/src/plugins/visualization_ui_components/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# @kbn/visualization-ui-components - -A series of UI components pulled out of Lens to make them available outside Lens. diff --git a/src/plugins/visualization_ui_components/jest.config.js b/src/plugins/visualization_ui_components/jest.config.js deleted file mode 100644 index bd0b14b660033..0000000000000 --- a/src/plugins/visualization_ui_components/jest.config.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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: ['/src/plugins/visualization_ui_components'], - coverageDirectory: - '/target/kibana-coverage/jest/src/plugins/visualization_ui_components', - coverageReporters: ['text', 'html'], - collectCoverageFrom: [ - '/src/plugins/visualization_ui_components/{common,public,server}/**/*.{js,ts,tsx}', - ], - setupFiles: ['jest-canvas-mock'], -}; diff --git a/src/plugins/visualization_ui_components/kibana.jsonc b/src/plugins/visualization_ui_components/kibana.jsonc deleted file mode 100644 index 9ac9f13c90424..0000000000000 --- a/src/plugins/visualization_ui_components/kibana.jsonc +++ /dev/null @@ -1,17 +0,0 @@ -{ - "type": "plugin", - "id": "@kbn/visualization-ui-components", - "owner": "@elastic/kibana-visualizations", - "plugin": { - "id": "visualizationUiComponents", - "server": false, - "browser": true, - "requiredBundles": [ - "unifiedSearch", - "dataViews" - ], - "extraPublicDirs": [ - "common" - ] - } -} diff --git a/src/plugins/visualization_ui_components/public/plugin.ts b/src/plugins/visualization_ui_components/public/plugin.ts deleted file mode 100755 index 1ed621a3cfdf5..0000000000000 --- a/src/plugins/visualization_ui_components/public/plugin.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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. - */ - -import { Plugin } from '@kbn/core/public'; - -// This plugin should really be a package, but we have to currently have to put the components in a "public" -// directory to avoid violating the @kbn/imports/no_boundary_crossing rules. -// -// Moving the dependencies of this plugin (unified search, unified field list) to static packages will -// make it possible to convert this to a package as well. -export class VisualizationUiComponentsPlugin implements Plugin<{}, {}> { - public setup() { - return {}; - } - - public start() { - return {}; - } - - public stop() {} -} diff --git a/tsconfig.base.json b/tsconfig.base.json index d184f337e5248..e5c496811ef2f 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -714,6 +714,10 @@ "@kbn/eslint-plugin-telemetry/*": ["packages/kbn-eslint-plugin-telemetry/*"], "@kbn/eso-plugin": ["x-pack/test/encrypted_saved_objects_api_integration/plugins/api_consumer_plugin"], "@kbn/eso-plugin/*": ["x-pack/test/encrypted_saved_objects_api_integration/plugins/api_consumer_plugin/*"], + "@kbn/event-annotation-common": ["packages/kbn-event-annotation-common"], + "@kbn/event-annotation-common/*": ["packages/kbn-event-annotation-common/*"], + "@kbn/event-annotation-components": ["packages/kbn-event-annotation-components"], + "@kbn/event-annotation-components/*": ["packages/kbn-event-annotation-components/*"], "@kbn/event-annotation-plugin": ["src/plugins/event_annotation"], "@kbn/event-annotation-plugin/*": ["src/plugins/event_annotation/*"], "@kbn/event-log-fixture-plugin": ["x-pack/test/plugin_api_integration/plugins/event_log"], @@ -1518,8 +1522,8 @@ "@kbn/vis-type-vislib-plugin/*": ["src/plugins/vis_types/vislib/*"], "@kbn/vis-type-xy-plugin": ["src/plugins/vis_types/xy"], "@kbn/vis-type-xy-plugin/*": ["src/plugins/vis_types/xy/*"], - "@kbn/visualization-ui-components": ["src/plugins/visualization_ui_components"], - "@kbn/visualization-ui-components/*": ["src/plugins/visualization_ui_components/*"], + "@kbn/visualization-ui-components": ["packages/kbn-visualization-ui-components"], + "@kbn/visualization-ui-components/*": ["packages/kbn-visualization-ui-components/*"], "@kbn/visualizations-plugin": ["src/plugins/visualizations"], "@kbn/visualizations-plugin/*": ["src/plugins/visualizations/*"], "@kbn/watcher-plugin": ["x-pack/plugins/watcher"], diff --git a/x-pack/plugins/lens/common/types.ts b/x-pack/plugins/lens/common/types.ts index 3c0519ec16551..ff269070a18c2 100644 --- a/x-pack/plugins/lens/common/types.ts +++ b/x-pack/plugins/lens/common/types.ts @@ -20,7 +20,7 @@ export type { AllowedPartitionOverrides } from '@kbn/expression-partition-vis-pl export type { AllowedSettingsOverrides, AllowedChartOverrides } from '@kbn/charts-plugin/common'; export type { AllowedGaugeOverrides } from '@kbn/expression-gauge-plugin/common'; export type { AllowedXYOverrides } from '@kbn/expression-xy-plugin/common'; -export type { FormatFactory } from '@kbn/visualization-ui-components/public'; +export type { FormatFactory } from '@kbn/visualization-ui-components'; export interface DateRange { fromDate: string; diff --git a/x-pack/plugins/lens/kibana.jsonc b/x-pack/plugins/lens/kibana.jsonc index 462531a3c947d..d7e32fba863fe 100644 --- a/x-pack/plugins/lens/kibana.jsonc +++ b/x-pack/plugins/lens/kibana.jsonc @@ -55,7 +55,6 @@ "embeddable", "fieldFormats", "charts", - "visualizationUiComponents" ], "extraPublicDirs": [ "common/constants" diff --git a/x-pack/plugins/lens/public/data_views_service/loader.ts b/x-pack/plugins/lens/public/data_views_service/loader.ts index ef48761d39a6e..f38a84cc60b48 100644 --- a/x-pack/plugins/lens/public/data_views_service/loader.ts +++ b/x-pack/plugins/lens/public/data_views_service/loader.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { isFieldLensCompatible } from '@kbn/visualization-ui-components/public'; +import { isFieldLensCompatible } from '@kbn/visualization-ui-components'; import type { DataViewsContract, DataView, DataViewSpec } from '@kbn/data-views-plugin/public'; import { keyBy } from 'lodash'; import { IndexPattern, IndexPatternField, IndexPatternMap, IndexPatternRef } from '../types'; diff --git a/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/dimension_editor.tsx b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/dimension_editor.tsx index 380b5060924c5..0801465b5d89d 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/dimension_editor.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/dimension_editor.tsx @@ -27,7 +27,7 @@ import { EuiButtonIcon, } from '@elastic/eui'; import ReactDOM from 'react-dom'; -import { NameInput } from '@kbn/visualization-ui-components/public'; +import { NameInput } from '@kbn/visualization-ui-components'; import type { FormBasedDimensionEditorProps } from './dimension_panel'; import type { OperationSupportMatrix } from './operation_support'; import { deleteColumn, GenericIndexPatternColumn } from '../form_based'; diff --git a/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/field_select.tsx b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/field_select.tsx index 2130b7f1fae26..cbfafbfbfd2c9 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/field_select.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/field_select.tsx @@ -11,11 +11,7 @@ import React, { useMemo } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiComboBoxOptionOption, EuiComboBoxProps } from '@elastic/eui'; import { useExistingFieldsReader } from '@kbn/unified-field-list/src/hooks/use_existing_fields'; -import { - FieldOption, - FieldOptionValue, - FieldPicker, -} from '@kbn/visualization-ui-components/public'; +import { FieldOption, FieldOptionValue, FieldPicker } from '@kbn/visualization-ui-components'; import type { OperationType } from '../form_based'; import type { OperationSupportMatrix } from './operation_support'; import { fieldContainsData } from '../../../shared_components'; diff --git a/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/filtering.tsx b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/filtering.tsx index 31caf495ecaa4..e79ead1e5536a 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/filtering.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/filtering.tsx @@ -7,7 +7,7 @@ import React, { useCallback } from 'react'; import { isEqual } from 'lodash'; import type { Query } from '@kbn/es-query'; -import { validateQuery, FilterQueryInput } from '@kbn/visualization-ui-components/public'; +import { validateQuery, FilterQueryInput } from '@kbn/visualization-ui-components'; import { useKibana } from '@kbn/kibana-react-plugin/public'; import { LENS_APP_NAME } from '../../../../common/constants'; import { GenericIndexPatternColumn, operationDefinitionMap } from '../operations'; diff --git a/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/format_selector.tsx b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/format_selector.tsx index 5bc877ba1e081..af0645a0c4c29 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/format_selector.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/dimension_panel/format_selector.tsx @@ -16,7 +16,7 @@ import { EuiSwitch, EuiCode, } from '@elastic/eui'; -import { useDebouncedValue } from '@kbn/visualization-ui-components/public'; +import { useDebouncedValue } from '@kbn/visualization-ui-components'; import { useKibana } from '@kbn/kibana-react-plugin/public'; import { FORMATS_UI_SETTINGS } from '@kbn/field-formats-plugin/common'; import { FormattedMessage } from '@kbn/i18n-react'; diff --git a/x-pack/plugins/lens/public/datasources/form_based/form_based.tsx b/x-pack/plugins/lens/public/datasources/form_based/form_based.tsx index e79cb00d900cc..101b41ed97bbf 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/form_based.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/form_based.tsx @@ -23,7 +23,7 @@ import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/ import { EuiButton } from '@elastic/eui'; import type { SharePluginStart } from '@kbn/share-plugin/public'; import { type DraggingIdentifier } from '@kbn/dom-drag-drop'; -import { DimensionTrigger } from '@kbn/visualization-ui-components/public'; +import { DimensionTrigger } from '@kbn/visualization-ui-components'; import memoizeOne from 'memoize-one'; import type { DatasourceDimensionEditorProps, diff --git a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/date_histogram.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/date_histogram.tsx index 6682221808547..67e4f39d44868 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/date_histogram.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/date_histogram.tsx @@ -29,7 +29,7 @@ import { } from '@kbn/data-plugin/public'; import { extendedBoundsToAst, intervalOptions } from '@kbn/data-plugin/common'; import { buildExpressionFunction } from '@kbn/expressions-plugin/public'; -import { TooltipWrapper } from '@kbn/visualization-ui-components/public'; +import { TooltipWrapper } from '@kbn/visualization-ui-components'; import { updateColumnParam } from '../layer_helpers'; import { OperationDefinition, ParamEditorProps } from '.'; import { FieldBasedIndexPatternColumn } from './column_types'; diff --git a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filter_popover.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filter_popover.test.tsx index b2ea1c81e2cab..8e7fb9e310f66 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filter_popover.test.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filter_popover.test.tsx @@ -13,7 +13,7 @@ import { createMockedIndexPattern } from '../../../mocks'; import { FilterPopover } from './filter_popover'; import { LabelInput } from '../shared_components'; import { QueryStringInput } from '@kbn/unified-search-plugin/public'; -import { QueryInput } from '@kbn/visualization-ui-components/public'; +import { QueryInput } from '@kbn/visualization-ui-components'; jest.mock('.', () => ({ isQueryValid: () => true, diff --git a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filter_popover.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filter_popover.tsx index d38a09714e7d3..4e3fe6336be9e 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filter_popover.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filter_popover.tsx @@ -12,7 +12,7 @@ import { EuiPopover, EuiSpacer } from '@elastic/eui'; import type { Query } from '@kbn/es-query'; // Need to keep it separate to make it work Jest mocks in dimension_panel tests // import { QueryInput } from '../../../../shared_components/query_input'; -import { isQueryValid, QueryInput } from '@kbn/visualization-ui-components/public'; +import { isQueryValid, QueryInput } from '@kbn/visualization-ui-components'; import { useKibana } from '@kbn/kibana-react-plugin/public'; import { LENS_APP_NAME } from '../../../../../../common/constants'; import { IndexPattern } from '../../../../../types'; diff --git a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filters.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filters.tsx index d26b8808a47c9..f84e023b493e1 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filters.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/filters/filters.tsx @@ -19,7 +19,7 @@ import { DragDropBuckets, DraggableBucketContainer, isQueryValid, -} from '@kbn/visualization-ui-components/public'; +} from '@kbn/visualization-ui-components'; import { IndexPattern } from '../../../../../types'; import { updateColumnParam } from '../../layer_helpers'; import type { OperationDefinition } from '..'; diff --git a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile.tsx index c7eedacd86216..1b98b7bc9b2ae 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile.tsx @@ -15,7 +15,7 @@ import { ExpressionAstExpressionBuilder, ExpressionAstFunctionBuilder, } from '@kbn/expressions-plugin/public'; -import { useDebouncedValue } from '@kbn/visualization-ui-components/public'; +import { useDebouncedValue } from '@kbn/visualization-ui-components'; import { OperationDefinition } from '.'; import { getFormatFromPreviousColumn, diff --git a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile_ranks.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile_ranks.tsx index daf15d06b0c64..7e071f8ddbd98 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile_ranks.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile_ranks.tsx @@ -10,7 +10,7 @@ import React, { useCallback } from 'react'; import { i18n } from '@kbn/i18n'; import { AggFunctionsMapping } from '@kbn/data-plugin/public'; import { buildExpressionFunction } from '@kbn/expressions-plugin/public'; -import { useDebouncedValue } from '@kbn/visualization-ui-components/public'; +import { useDebouncedValue } from '@kbn/visualization-ui-components'; import { OperationDefinition } from '.'; import { getFormatFromPreviousColumn, diff --git a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/advanced_editor.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/advanced_editor.tsx index f9366bdbd780f..c196c3191bae3 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/advanced_editor.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/advanced_editor.tsx @@ -27,7 +27,7 @@ import { DragDropBuckets, DraggableBucketContainer, NewBucketButton, -} from '@kbn/visualization-ui-components/public'; +} from '@kbn/visualization-ui-components'; import { useDebounceWithOptions } from '../../../../../shared_components'; import { RangeTypeLens, isValidRange } from './ranges'; import { FROM_PLACEHOLDER, TO_PLACEHOLDER, TYPING_DEBOUNCE_TIME } from './constants'; diff --git a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/ranges.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/ranges.test.tsx index f707197490e04..00a69eee1f2c0 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/ranges.test.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/ranges/ranges.test.tsx @@ -26,7 +26,7 @@ import { SLICES, } from './constants'; import { RangePopover } from './advanced_editor'; -import { DragDropBuckets } from '@kbn/visualization-ui-components/public'; +import { DragDropBuckets } from '@kbn/visualization-ui-components'; import { getFieldByNameFactory } from '../../../pure_helpers'; import { IndexPattern } from '../../../../../types'; diff --git a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/shared_components/label_input.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/shared_components/label_input.tsx index c1ae44ba26063..34cbd2398eab2 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/shared_components/label_input.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/shared_components/label_input.tsx @@ -8,7 +8,7 @@ import React, { useRef } from 'react'; import { EuiFieldText, keys } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { useDebouncedValue } from '@kbn/visualization-ui-components/public'; +import { useDebouncedValue } from '@kbn/visualization-ui-components'; export const LabelInput = ({ value, diff --git a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/static_value.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/static_value.tsx index d491b084f811d..fbcfaf3c36b9f 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/static_value.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/static_value.tsx @@ -7,7 +7,7 @@ import React, { useCallback } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiFieldNumber, EuiFormRow } from '@elastic/eui'; -import { useDebouncedValue } from '@kbn/visualization-ui-components/public'; +import { useDebouncedValue } from '@kbn/visualization-ui-components'; import { OperationDefinition } from '.'; import { ReferenceBasedIndexPatternColumn, diff --git a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/field_inputs.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/field_inputs.tsx index 0eaa0b08e62e8..72941739b24ed 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/field_inputs.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/field_inputs.tsx @@ -14,7 +14,7 @@ import { FieldsBucketContainer, NewBucketButton, DraggableBucketContainer, -} from '@kbn/visualization-ui-components/public'; +} from '@kbn/visualization-ui-components'; import { IndexPattern } from '../../../../../types'; import { FieldSelect } from '../../../dimension_panel/field_select'; import type { TermsIndexPatternColumn } from './types'; diff --git a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/include_exclude_options.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/include_exclude_options.tsx index dc9e76a931b21..3c61d0aae580a 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/include_exclude_options.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/terms/include_exclude_options.tsx @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n'; import { uniq } from 'lodash'; import { EuiComboBox, EuiFormRow, EuiSpacer, EuiSwitch, EuiFieldText, EuiText } from '@elastic/eui'; import type { DatatableRow } from '@kbn/expressions-plugin/common'; -import { useDebouncedValue } from '@kbn/visualization-ui-components/public'; +import { useDebouncedValue } from '@kbn/visualization-ui-components'; export interface IncludeExcludeOptions { label: string; diff --git a/x-pack/plugins/lens/public/datasources/form_based/utils.tsx b/x-pack/plugins/lens/public/datasources/form_based/utils.tsx index 8d6720c9f744a..50c4b0f78e61b 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/utils.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/utils.tsx @@ -25,7 +25,7 @@ import { } from '@kbn/data-plugin/public'; import { estypes } from '@elastic/elasticsearch'; -import { isQueryValid } from '@kbn/visualization-ui-components/public'; +import { isQueryValid } from '@kbn/visualization-ui-components'; import type { DateRange } from '../../../common/types'; import type { FramePublicAPI, diff --git a/x-pack/plugins/lens/public/datasources/text_based/field_select.test.tsx b/x-pack/plugins/lens/public/datasources/text_based/field_select.test.tsx index bd84ce529ea6d..831e5dcd68046 100644 --- a/x-pack/plugins/lens/public/datasources/text_based/field_select.test.tsx +++ b/x-pack/plugins/lens/public/datasources/text_based/field_select.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { FieldPicker, FieldOptionValue } from '@kbn/visualization-ui-components/public'; +import { FieldPicker, FieldOptionValue } from '@kbn/visualization-ui-components'; import { type FieldOptionCompatible, FieldSelect, FieldSelectProps } from './field_select'; import { shallowWithIntl as shallow } from '@kbn/test-jest-helpers'; diff --git a/x-pack/plugins/lens/public/datasources/text_based/field_select.tsx b/x-pack/plugins/lens/public/datasources/text_based/field_select.tsx index 9dc2d5115c03d..3561697900bb4 100644 --- a/x-pack/plugins/lens/public/datasources/text_based/field_select.tsx +++ b/x-pack/plugins/lens/public/datasources/text_based/field_select.tsx @@ -9,11 +9,7 @@ import React, { useMemo } from 'react'; import { EuiComboBoxOptionOption, EuiComboBoxProps } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import type { DatatableColumn } from '@kbn/expressions-plugin/public'; -import { - FieldPicker, - FieldOptionValue, - FieldOption, -} from '@kbn/visualization-ui-components/public'; +import { FieldPicker, FieldOptionValue, FieldOption } from '@kbn/visualization-ui-components'; import type { TextBasedLayerColumn } from './types'; import type { DataType } from '../../types'; diff --git a/x-pack/plugins/lens/public/datasources/text_based/text_based_languages.tsx b/x-pack/plugins/lens/public/datasources/text_based/text_based_languages.tsx index a670846cc816d..354e7d28d95cd 100644 --- a/x-pack/plugins/lens/public/datasources/text_based/text_based_languages.tsx +++ b/x-pack/plugins/lens/public/datasources/text_based/text_based_languages.tsx @@ -16,7 +16,7 @@ import type { ExpressionsStart, DatatableColumnType } from '@kbn/expressions-plu import type { DataViewsPublicPluginStart, DataView } from '@kbn/data-views-plugin/public'; import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; import { euiThemeVars } from '@kbn/ui-theme'; -import { DimensionTrigger } from '@kbn/visualization-ui-components/public'; +import { DimensionTrigger } from '@kbn/visualization-ui-components'; import memoizeOne from 'memoize-one'; import { isEqual } from 'lodash'; import { diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/buttons/empty_dimension_button.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/buttons/empty_dimension_button.tsx index 051ba4876eb35..0c6195d51cfe4 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/buttons/empty_dimension_button.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/buttons/empty_dimension_button.tsx @@ -15,7 +15,7 @@ import { DropType, DropTargetSwapDuplicateCombine, } from '@kbn/dom-drag-drop'; -import { EmptyDimensionButton as EmptyDimensionButtonInner } from '@kbn/visualization-ui-components/public'; +import { EmptyDimensionButton as EmptyDimensionButtonInner } from '@kbn/visualization-ui-components'; import { css } from '@emotion/react'; import { euiThemeVars } from '@kbn/ui-theme'; import { isDraggedField } from '../../../../utils'; diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.test.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.test.tsx index bb258c4bd690f..89ed36f182392 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.test.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.test.tsx @@ -23,7 +23,7 @@ import { createMockedDragDropContext, } from '../../../mocks'; import { createIndexPatternServiceMock } from '../../../mocks/data_views_service_mock'; -import { DimensionButton } from '@kbn/visualization-ui-components/public'; +import { DimensionButton } from '@kbn/visualization-ui-components'; jest.mock('../../../id_generator'); diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.tsx index 02d970236e98d..e7a55ac3e1418 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.tsx @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n'; import { css } from '@emotion/react'; import { euiThemeVars } from '@kbn/ui-theme'; import { DragDropIdentifier, ReorderProvider, DropType } from '@kbn/dom-drag-drop'; -import { DimensionButton, DimensionTrigger } from '@kbn/visualization-ui-components/public'; +import { DimensionButton, DimensionTrigger } from '@kbn/visualization-ui-components'; import { LayerActions } from './layer_actions'; import { IndexPatternServiceAPI } from '../../../data_views_service/service'; import { diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/state_helpers.ts b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/state_helpers.ts index 97611b62694d1..0e677804d5f16 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/state_helpers.ts +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/state_helpers.ts @@ -15,9 +15,9 @@ import { DataViewPersistableStateService } from '@kbn/data-views-plugin/common'; import type { DataPublicPluginStart, TimefilterContract } from '@kbn/data-plugin/public'; import { EventAnnotationServiceType } from '@kbn/event-annotation-plugin/public'; import { - EventAnnotationGroupConfig, + type EventAnnotationGroupConfig, EVENT_ANNOTATION_GROUP_TYPE, -} from '@kbn/event-annotation-plugin/common'; +} from '@kbn/event-annotation-common'; import type { Datasource, DatasourceMap, diff --git a/x-pack/plugins/lens/public/shared_components/axis/title/axis_title_settings.tsx b/x-pack/plugins/lens/public/shared_components/axis/title/axis_title_settings.tsx index 5b88455a28e5c..a65425d07d7a0 100644 --- a/x-pack/plugins/lens/public/shared_components/axis/title/axis_title_settings.tsx +++ b/x-pack/plugins/lens/public/shared_components/axis/title/axis_title_settings.tsx @@ -8,7 +8,7 @@ import React, { useCallback, useMemo } from 'react'; import { EuiSpacer, EuiFormRow } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { useDebouncedValue } from '@kbn/visualization-ui-components/public'; +import { useDebouncedValue } from '@kbn/visualization-ui-components'; import type { AxesSettingsConfig } from '../../../visualizations/xy/types'; import { type LabelMode, VisLabel } from '../..'; diff --git a/x-pack/plugins/lens/public/shared_components/legend/layout/columns_number_setting.tsx b/x-pack/plugins/lens/public/shared_components/legend/layout/columns_number_setting.tsx index 4ffc7c4066115..1f21c9004043e 100644 --- a/x-pack/plugins/lens/public/shared_components/legend/layout/columns_number_setting.tsx +++ b/x-pack/plugins/lens/public/shared_components/legend/layout/columns_number_setting.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { EuiFieldNumber, EuiFormRow } from '@elastic/eui'; -import { useDebouncedValue } from '@kbn/visualization-ui-components/public'; +import { useDebouncedValue } from '@kbn/visualization-ui-components'; export const DEFAULT_FLOATING_COLUMNS = 1; diff --git a/x-pack/plugins/lens/public/shared_components/legend/legend_settings_popover.tsx b/x-pack/plugins/lens/public/shared_components/legend/legend_settings_popover.tsx index cfd42ed41c7cd..34cdcfe2e18b1 100644 --- a/x-pack/plugins/lens/public/shared_components/legend/legend_settings_popover.tsx +++ b/x-pack/plugins/lens/public/shared_components/legend/legend_settings_popover.tsx @@ -17,7 +17,7 @@ import { import { Position, VerticalAlignment, HorizontalAlignment } from '@elastic/charts'; import { ToolbarButtonProps } from '@kbn/kibana-react-plugin/public'; import { LegendSize } from '@kbn/visualizations-plugin/public'; -import { useDebouncedValue } from '@kbn/visualization-ui-components/public'; +import { useDebouncedValue } from '@kbn/visualization-ui-components'; import { ToolbarPopover } from '../toolbar_popover'; import { LegendLocationSettings } from './location/legend_location_settings'; import { ColumnsNumberSetting } from './layout/columns_number_setting'; diff --git a/x-pack/plugins/lens/public/state_management/lens_slice.ts b/x-pack/plugins/lens/public/state_management/lens_slice.ts index 3b41672e12338..5ef37be8527a5 100644 --- a/x-pack/plugins/lens/public/state_management/lens_slice.ts +++ b/x-pack/plugins/lens/public/state_management/lens_slice.ts @@ -11,7 +11,7 @@ import { mapValues, uniq } from 'lodash'; import { Query } from '@kbn/es-query'; import { History } from 'history'; import { LayerTypes } from '@kbn/expression-xy-plugin/public'; -import { EventAnnotationGroupConfig } from '@kbn/event-annotation-plugin/common'; +import { EventAnnotationGroupConfig } from '@kbn/event-annotation-common'; import { LensEmbeddableInput } from '..'; import { TableInspectorAdapter } from '../editor_frame_service/types'; import type { diff --git a/x-pack/plugins/lens/public/types.ts b/x-pack/plugins/lens/public/types.ts index 94c8ff09b4561..56a035f241b8d 100644 --- a/x-pack/plugins/lens/public/types.ts +++ b/x-pack/plugins/lens/public/types.ts @@ -39,9 +39,9 @@ import { SearchRequest } from '@kbn/data-plugin/public'; import { estypes } from '@elastic/elasticsearch'; import React from 'react'; import { CellValueContext } from '@kbn/embeddable-plugin/public'; -import { EventAnnotationGroupConfig } from '@kbn/event-annotation-plugin/common'; +import { EventAnnotationGroupConfig } from '@kbn/event-annotation-common'; import type { DraggingIdentifier, DragDropIdentifier, DropType } from '@kbn/dom-drag-drop'; -import type { AccessorConfig } from '@kbn/visualization-ui-components/public'; +import type { AccessorConfig } from '@kbn/visualization-ui-components'; import type { DateRange, LayerType, SortingHint } from '../common/types'; import type { LensSortActionData, diff --git a/x-pack/plugins/lens/public/utils.ts b/x-pack/plugins/lens/public/utils.ts index 518b6c43ea08d..eb52c2ca90ad3 100644 --- a/x-pack/plugins/lens/public/utils.ts +++ b/x-pack/plugins/lens/public/utils.ts @@ -19,7 +19,7 @@ import { ClickTriggerEvent, MultiClickTriggerEvent, } from '@kbn/charts-plugin/public'; -import { emptyTitleText } from '@kbn/visualization-ui-components/public'; +import { emptyTitleText } from '@kbn/visualization-ui-components'; import { RequestAdapter } from '@kbn/inspector-plugin/common'; import { ISearchStart } from '@kbn/data-plugin/public'; import type { DraggingIdentifier } from '@kbn/dom-drag-drop'; diff --git a/x-pack/plugins/lens/public/visualizations/datatable/components/dimension_editor_addtional_section.tsx b/x-pack/plugins/lens/public/visualizations/datatable/components/dimension_editor_addtional_section.tsx index 0ab29526c939a..62cd0a6252923 100644 --- a/x-pack/plugins/lens/public/visualizations/datatable/components/dimension_editor_addtional_section.tsx +++ b/x-pack/plugins/lens/public/visualizations/datatable/components/dimension_editor_addtional_section.tsx @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n'; import { css } from '@emotion/react'; import { EuiFormRow, EuiFieldText, EuiText, useEuiTheme, EuiComboBox } from '@elastic/eui'; import { PaletteRegistry } from '@kbn/coloring'; -import { useDebouncedValue } from '@kbn/visualization-ui-components/public'; +import { useDebouncedValue } from '@kbn/visualization-ui-components'; import type { VisualizationDimensionEditorProps } from '../../../types'; import type { DatatableVisualizationState } from '../visualization'; diff --git a/x-pack/plugins/lens/public/visualizations/gauge/dimension_editor.tsx b/x-pack/plugins/lens/public/visualizations/gauge/dimension_editor.tsx index 4406cea21b274..83d6a7d532443 100644 --- a/x-pack/plugins/lens/public/visualizations/gauge/dimension_editor.tsx +++ b/x-pack/plugins/lens/public/visualizations/gauge/dimension_editor.tsx @@ -25,7 +25,7 @@ import { } from '@kbn/coloring'; import { GaugeTicksPositions, GaugeColorModes } from '@kbn/expression-gauge-plugin/common'; import { getMaxValue, getMinValue } from '@kbn/expression-gauge-plugin/public'; -import { TooltipWrapper } from '@kbn/visualization-ui-components/public'; +import { TooltipWrapper } from '@kbn/visualization-ui-components'; import { isNumericFieldForDatatable } from '../../../common/expressions/datatable/utils'; import { applyPaletteParams, PalettePanelContainer } from '../../shared_components'; import type { VisualizationDimensionEditorProps } from '../../types'; diff --git a/x-pack/plugins/lens/public/visualizations/gauge/toolbar_component/index.tsx b/x-pack/plugins/lens/public/visualizations/gauge/toolbar_component/index.tsx index f9b9b01d3d72b..67756002f3e56 100644 --- a/x-pack/plugins/lens/public/visualizations/gauge/toolbar_component/index.tsx +++ b/x-pack/plugins/lens/public/visualizations/gauge/toolbar_component/index.tsx @@ -9,7 +9,7 @@ import React, { memo, useState } from 'react'; import { EuiFlexGroup, EuiFlexItem, EuiFormRow } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import type { GaugeLabelMajorMode } from '@kbn/expression-gauge-plugin/common'; -import { useDebouncedValue } from '@kbn/visualization-ui-components/public'; +import { useDebouncedValue } from '@kbn/visualization-ui-components'; import type { VisualizationToolbarProps } from '../../../types'; import { ToolbarPopover, VisLabel } from '../../../shared_components'; import './gauge_config_panel.scss'; diff --git a/x-pack/plugins/lens/public/visualizations/heatmap/toolbar_component.tsx b/x-pack/plugins/lens/public/visualizations/heatmap/toolbar_component.tsx index 2ccf66520d24e..ebc0b1040623f 100644 --- a/x-pack/plugins/lens/public/visualizations/heatmap/toolbar_component.tsx +++ b/x-pack/plugins/lens/public/visualizations/heatmap/toolbar_component.tsx @@ -11,7 +11,7 @@ import { Position } from '@elastic/charts'; import { i18n } from '@kbn/i18n'; import { LegendSize } from '@kbn/visualizations-plugin/public'; import { EuiIconAxisLeft, EuiIconAxisBottom } from '@kbn/chart-icons'; -import { TooltipWrapper } from '@kbn/visualization-ui-components/public'; +import { TooltipWrapper } from '@kbn/visualization-ui-components'; import type { VisualizationToolbarProps } from '../../types'; import { LegendSettingsPopover, diff --git a/x-pack/plugins/lens/public/visualizations/legacy_metric/metric_config_panel/appearance_options_popover.tsx b/x-pack/plugins/lens/public/visualizations/legacy_metric/metric_config_panel/appearance_options_popover.tsx index 3d92f9cee9428..fe070e50449d6 100644 --- a/x-pack/plugins/lens/public/visualizations/legacy_metric/metric_config_panel/appearance_options_popover.tsx +++ b/x-pack/plugins/lens/public/visualizations/legacy_metric/metric_config_panel/appearance_options_popover.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; -import { TooltipWrapper } from '@kbn/visualization-ui-components/public'; +import { TooltipWrapper } from '@kbn/visualization-ui-components'; import { ToolbarPopover } from '../../../shared_components'; import { TitlePositionOptions } from './title_position_option'; import { FramePublicAPI } from '../../../types'; diff --git a/x-pack/plugins/lens/public/visualizations/metric/dimension_editor.test.tsx b/x-pack/plugins/lens/public/visualizations/metric/dimension_editor.test.tsx index 0442505da8c0d..de0d59ef1bc4b 100644 --- a/x-pack/plugins/lens/public/visualizations/metric/dimension_editor.test.tsx +++ b/x-pack/plugins/lens/public/visualizations/metric/dimension_editor.test.tsx @@ -27,7 +27,7 @@ import { EuiColorPickerOutput } from '@elastic/eui/src/components/color_picker/c import { createMockFramePublicAPI } from '../../mocks'; import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; import { euiLightVars } from '@kbn/ui-theme'; -import { DebouncedInput } from '@kbn/visualization-ui-components/public'; +import { DebouncedInput } from '@kbn/visualization-ui-components'; import { DatasourcePublicAPI } from '../..'; import { CollapseFunction } from '../../../common/expressions'; diff --git a/x-pack/plugins/lens/public/visualizations/metric/dimension_editor.tsx b/x-pack/plugins/lens/public/visualizations/metric/dimension_editor.tsx index f0903af010889..8db31f39c72de 100644 --- a/x-pack/plugins/lens/public/visualizations/metric/dimension_editor.tsx +++ b/x-pack/plugins/lens/public/visualizations/metric/dimension_editor.tsx @@ -33,11 +33,7 @@ import { import { getDataBoundsForPalette } from '@kbn/expression-metric-vis-plugin/public'; import { getColumnByAccessor } from '@kbn/visualizations-plugin/common/utils'; import { css } from '@emotion/react'; -import { - DebouncedInput, - useDebouncedValue, - IconSelect, -} from '@kbn/visualization-ui-components/public'; +import { DebouncedInput, useDebouncedValue, IconSelect } from '@kbn/visualization-ui-components'; import { isNumericFieldForDatatable } from '../../../common/expressions/datatable/utils'; import { applyPaletteParams, PalettePanelContainer } from '../../shared_components'; import type { VisualizationDimensionEditorProps } from '../../types'; diff --git a/x-pack/plugins/lens/public/visualizations/metric/icon_set.ts b/x-pack/plugins/lens/public/visualizations/metric/icon_set.ts index 9626979e64966..704c802f4826d 100644 --- a/x-pack/plugins/lens/public/visualizations/metric/icon_set.ts +++ b/x-pack/plugins/lens/public/visualizations/metric/icon_set.ts @@ -7,7 +7,7 @@ import { i18n } from '@kbn/i18n'; import { AvailableMetricIcon } from '@kbn/expression-metric-vis-plugin/common'; -import { type IconSet } from '@kbn/visualization-ui-components/public'; +import { type IconSet } from '@kbn/visualization-ui-components'; export const iconsSet: IconSet = [ { diff --git a/x-pack/plugins/lens/public/visualizations/metric/toolbar.tsx b/x-pack/plugins/lens/public/visualizations/metric/toolbar.tsx index 1ee4ee0be28c3..8cd949381cf3d 100644 --- a/x-pack/plugins/lens/public/visualizations/metric/toolbar.tsx +++ b/x-pack/plugins/lens/public/visualizations/metric/toolbar.tsx @@ -8,7 +8,7 @@ import React, { useCallback } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiFlexGroup, EuiFormRow, EuiFieldText } from '@elastic/eui'; -import { useDebouncedValue } from '@kbn/visualization-ui-components/public'; +import { useDebouncedValue } from '@kbn/visualization-ui-components'; import { VisualizationToolbarProps } from '../../types'; import { ToolbarPopover } from '../../shared_components'; import { MetricVisualizationState } from './visualization'; diff --git a/x-pack/plugins/lens/public/visualizations/metric/visualization.tsx b/x-pack/plugins/lens/public/visualizations/metric/visualization.tsx index b003174232125..29831347b4954 100644 --- a/x-pack/plugins/lens/public/visualizations/metric/visualization.tsx +++ b/x-pack/plugins/lens/public/visualizations/metric/visualization.tsx @@ -13,7 +13,7 @@ import { VIS_EVENT_TO_TRIGGER } from '@kbn/visualizations-plugin/public'; import { LayoutDirection } from '@elastic/charts'; import { euiLightVars, euiThemeVars } from '@kbn/ui-theme'; import { IconChartMetric } from '@kbn/chart-icons'; -import { AccessorConfig } from '@kbn/visualization-ui-components/public'; +import { AccessorConfig } from '@kbn/visualization-ui-components'; import { CollapseFunction } from '../../../common/expressions'; import type { LayerType } from '../../../common/types'; import { layerTypes } from '../../../common/layer_types'; diff --git a/x-pack/plugins/lens/public/visualizations/partition/dimension_editor.tsx b/x-pack/plugins/lens/public/visualizations/partition/dimension_editor.tsx index b2223eccc2451..bea5c7668e9fe 100644 --- a/x-pack/plugins/lens/public/visualizations/partition/dimension_editor.tsx +++ b/x-pack/plugins/lens/public/visualizations/partition/dimension_editor.tsx @@ -9,7 +9,7 @@ import './toolbar.scss'; import React from 'react'; import { i18n } from '@kbn/i18n'; import type { PaletteRegistry } from '@kbn/coloring'; -import { ColorPicker, useDebouncedValue } from '@kbn/visualization-ui-components/public'; +import { ColorPicker, useDebouncedValue } from '@kbn/visualization-ui-components'; import { PieVisualizationState } from '../../../common/types'; import { VisualizationDimensionEditorProps } from '../../types'; import { PalettePicker } from '../../shared_components'; diff --git a/x-pack/plugins/lens/public/visualizations/partition/toolbar.tsx b/x-pack/plugins/lens/public/visualizations/partition/toolbar.tsx index 2596f28d8c801..fddf0280b9539 100644 --- a/x-pack/plugins/lens/public/visualizations/partition/toolbar.tsx +++ b/x-pack/plugins/lens/public/visualizations/partition/toolbar.tsx @@ -18,7 +18,7 @@ import { } from '@elastic/eui'; import type { Position } from '@elastic/charts'; import { LegendSize } from '@kbn/visualizations-plugin/public'; -import { useDebouncedValue } from '@kbn/visualization-ui-components/public'; +import { useDebouncedValue } from '@kbn/visualization-ui-components'; import { DEFAULT_PERCENT_DECIMALS } from './constants'; import { PartitionChartsMeta } from './partition_charts_meta'; import { PieVisualizationState, SharedPieLayerState } from '../../../common/types'; diff --git a/x-pack/plugins/lens/public/visualizations/partition/visualization.tsx b/x-pack/plugins/lens/public/visualizations/partition/visualization.tsx index 444342f08b723..371c9aca63452 100644 --- a/x-pack/plugins/lens/public/visualizations/partition/visualization.tsx +++ b/x-pack/plugins/lens/public/visualizations/partition/visualization.tsx @@ -14,7 +14,7 @@ import { VIS_EVENT_TO_TRIGGER } from '@kbn/visualizations-plugin/public'; import { EuiSpacer } from '@elastic/eui'; import { PartitionVisConfiguration } from '@kbn/visualizations-plugin/common/convert_to_lens'; import { LayerTypes } from '@kbn/expression-xy-plugin/public'; -import { AccessorConfig } from '@kbn/visualization-ui-components/public'; +import { AccessorConfig } from '@kbn/visualization-ui-components'; import type { FormBasedPersistedState } from '../../datasources/form_based/types'; import type { Visualization, diff --git a/x-pack/plugins/lens/public/visualizations/xy/annotations/actions/revert_changes_action.test.tsx b/x-pack/plugins/lens/public/visualizations/xy/annotations/actions/revert_changes_action.test.tsx index 0e3e3f472c8d2..0571d339698ea 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/annotations/actions/revert_changes_action.test.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/annotations/actions/revert_changes_action.test.tsx @@ -7,7 +7,7 @@ import { OverlayRef } from '@kbn/core-mount-utils-browser'; import { IToasts } from '@kbn/core-notifications-browser'; -import { PointInTimeEventAnnotationConfig } from '@kbn/event-annotation-plugin/common'; +import { PointInTimeEventAnnotationConfig } from '@kbn/event-annotation-common'; import { cloneDeep } from 'lodash'; import { XYByReferenceAnnotationLayerConfig, diff --git a/x-pack/plugins/lens/public/visualizations/xy/annotations/actions/save_action.test.tsx b/x-pack/plugins/lens/public/visualizations/xy/annotations/actions/save_action.test.tsx index 3480411f890eb..325d540bbcc54 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/annotations/actions/save_action.test.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/annotations/actions/save_action.test.tsx @@ -19,7 +19,7 @@ import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { EventAnnotationGroupConfig, PointInTimeEventAnnotationConfig, -} from '@kbn/event-annotation-plugin/common'; +} from '@kbn/event-annotation-common'; import { SavedObjectSaveModal } from '@kbn/saved-objects-plugin/public'; import { taggingApiMock } from '@kbn/saved-objects-tagging-plugin/public/mocks'; import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; diff --git a/x-pack/plugins/lens/public/visualizations/xy/annotations/actions/save_action.tsx b/x-pack/plugins/lens/public/visualizations/xy/annotations/actions/save_action.tsx index 78eec2ee99837..a86cf9617d082 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/annotations/actions/save_action.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/annotations/actions/save_action.tsx @@ -18,7 +18,7 @@ import { SavedObjectSaveModal, } from '@kbn/saved-objects-plugin/public'; import { KibanaThemeProvider } from '@kbn/kibana-react-plugin/public'; -import { EventAnnotationGroupConfig } from '@kbn/event-annotation-plugin/common'; +import type { EventAnnotationGroupConfig } from '@kbn/event-annotation-common'; import { EuiIcon, EuiLink } from '@elastic/eui'; import { type SavedObjectTaggingPluginStart } from '@kbn/saved-objects-tagging-plugin/public'; import { DataViewsContract } from '@kbn/data-views-plugin/public'; diff --git a/x-pack/plugins/lens/public/visualizations/xy/annotations/actions/unlink_action.test.ts b/x-pack/plugins/lens/public/visualizations/xy/annotations/actions/unlink_action.test.ts index 8fc27c6e5f6d3..a0ca610404c90 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/annotations/actions/unlink_action.test.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/annotations/actions/unlink_action.test.ts @@ -11,7 +11,7 @@ import { XYState, } from '../../types'; import { toastsServiceMock } from '@kbn/core-notifications-browser-mocks/src/toasts_service.mock'; -import { PointInTimeEventAnnotationConfig } from '@kbn/event-annotation-plugin/common'; +import { PointInTimeEventAnnotationConfig } from '@kbn/event-annotation-common'; import { cloneDeep } from 'lodash'; import { getUnlinkLayerAction } from './unlink_action'; diff --git a/x-pack/plugins/lens/public/visualizations/xy/annotations/helpers.tsx b/x-pack/plugins/lens/public/visualizations/xy/annotations/helpers.tsx index b9b29a981c2da..461062b6e2308 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/annotations/helpers.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/annotations/helpers.tsx @@ -8,14 +8,12 @@ import { i18n } from '@kbn/i18n'; import moment from 'moment'; import { - getAnnotationAccessor, isQueryAnnotationConfig, -} from '@kbn/event-annotation-plugin/public'; -import { + getAnnotationAccessor, createCopiedAnnotation, - EventAnnotationConfig, - getDefaultQueryAnnotation, -} from '@kbn/event-annotation-plugin/common'; +} from '@kbn/event-annotation-components'; +import type { EventAnnotationConfig } from '@kbn/event-annotation-common'; +import { getDefaultQueryAnnotation } from '@kbn/event-annotation-common'; import { IconChartBarAnnotations } from '@kbn/chart-icons'; import { LayerTypes } from '@kbn/expression-xy-plugin/public'; import { getUniqueLabelGenerator, isDraggedDataViewField } from '../../../utils'; diff --git a/x-pack/plugins/lens/public/visualizations/xy/color_assignment.ts b/x-pack/plugins/lens/public/visualizations/xy/color_assignment.ts index 9fefea76a9d30..cd0a2f0ecdbea 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/color_assignment.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/color_assignment.ts @@ -13,8 +13,8 @@ import { defaultAnnotationColor, defaultAnnotationRangeColor, isRangeAnnotationConfig, -} from '@kbn/event-annotation-plugin/public'; -import type { AccessorConfig } from '@kbn/visualization-ui-components/public'; +} from '@kbn/event-annotation-common'; +import type { AccessorConfig } from '@kbn/visualization-ui-components'; import type { FramePublicAPI } from '../../types'; import { getColumnToLabelMap } from './state_helpers'; import { FormatFactory } from '../../../common/types'; diff --git a/x-pack/plugins/lens/public/visualizations/xy/reference_line_helpers.tsx b/x-pack/plugins/lens/public/visualizations/xy/reference_line_helpers.tsx index d850925261ae2..e23a407bc26c6 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/reference_line_helpers.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/reference_line_helpers.tsx @@ -10,7 +10,7 @@ import { i18n } from '@kbn/i18n'; import { Datatable } from '@kbn/expressions-plugin/public'; import { IconChartBarReferenceLine } from '@kbn/chart-icons'; import { LayerTypes } from '@kbn/expression-xy-plugin/public'; -import type { AccessorConfig } from '@kbn/visualization-ui-components/public'; +import type { AccessorConfig } from '@kbn/visualization-ui-components'; import type { DatasourceLayers, FramePublicAPI, Visualization } from '../../types'; import { groupAxesByType } from './axes_configuration'; import { isHorizontalChart, isPercentageSeries, isStackedChart } from './state_helpers'; diff --git a/x-pack/plugins/lens/public/visualizations/xy/state_helpers.ts b/x-pack/plugins/lens/public/visualizations/xy/state_helpers.ts index 0ac7392c274ac..0385a34a57102 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/state_helpers.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/state_helpers.ts @@ -10,13 +10,13 @@ import type { SavedObjectReference } from '@kbn/core/public'; import { EventAnnotationGroupConfig, EVENT_ANNOTATION_GROUP_TYPE, -} from '@kbn/event-annotation-plugin/common'; +} from '@kbn/event-annotation-common'; import { v4 as uuidv4 } from 'uuid'; -import { isQueryAnnotationConfig } from '@kbn/event-annotation-plugin/public'; +import { isQueryAnnotationConfig } from '@kbn/event-annotation-components'; import { i18n } from '@kbn/i18n'; import fastIsEqual from 'fast-deep-equal'; import { cloneDeep } from 'lodash'; -import { validateQuery } from '@kbn/visualization-ui-components/public'; +import { validateQuery } from '@kbn/visualization-ui-components'; import { DataViewsState } from '../../state_management'; import { FramePublicAPI, DatasourcePublicAPI, AnnotationGroups } from '../../types'; import { diff --git a/x-pack/plugins/lens/public/visualizations/xy/to_expression.ts b/x-pack/plugins/lens/public/visualizations/xy/to_expression.ts index 9ee6e10884022..4e8264a733398 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/to_expression.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/to_expression.ts @@ -13,11 +13,11 @@ import { buildExpressionFunction, ExpressionFunctionTheme, } from '@kbn/expressions-plugin/common'; +import { EventAnnotationServiceType } from '@kbn/event-annotation-plugin/public'; import { - EventAnnotationServiceType, isManualPointAnnotationConfig, isRangeAnnotationConfig, -} from '@kbn/event-annotation-plugin/public'; +} from '@kbn/event-annotation-common'; import { LegendSize } from '@kbn/visualizations-plugin/public'; import { AvailableReferenceLineIcon, @@ -35,7 +35,7 @@ import { XYCurveType, YAxisConfigFn, } from '@kbn/expression-xy-plugin/common'; -import { EventAnnotationConfig } from '@kbn/event-annotation-plugin/common'; +import type { EventAnnotationConfig } from '@kbn/event-annotation-common'; import { LayerTypes } from '@kbn/expression-xy-plugin/public'; import { SystemPaletteExpressionFunctionDefinition } from '@kbn/charts-plugin/common'; import type { diff --git a/x-pack/plugins/lens/public/visualizations/xy/types.ts b/x-pack/plugins/lens/public/visualizations/xy/types.ts index 5333d03fb12dd..e863f04bcdc05 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/types.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/types.ts @@ -21,10 +21,7 @@ import type { FillStyle, YAxisConfig, } from '@kbn/expression-xy-plugin/common'; -import { - EventAnnotationConfig, - EventAnnotationGroupConfig, -} from '@kbn/event-annotation-plugin/common'; +import { EventAnnotationConfig, EventAnnotationGroupConfig } from '@kbn/event-annotation-common'; import { IconChartArea, IconChartLine, diff --git a/x-pack/plugins/lens/public/visualizations/xy/visualization.test.tsx b/x-pack/plugins/lens/public/visualizations/xy/visualization.test.tsx index 79a5753c47e0e..e89b3a843e8ac 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/visualization.test.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/visualization.test.tsx @@ -40,7 +40,7 @@ import { eventAnnotationServiceMock } from '@kbn/event-annotation-plugin/public/ import { EventAnnotationConfig, PointInTimeEventAnnotationConfig, -} from '@kbn/event-annotation-plugin/common'; +} from '@kbn/event-annotation-common'; import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import { DataViewsState } from '../../state_management'; diff --git a/x-pack/plugins/lens/public/visualizations/xy/visualization.tsx b/x-pack/plugins/lens/public/visualizations/xy/visualization.tsx index d9f48f7b4d41b..0d000db6e5206 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/visualization.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/visualization.tsx @@ -13,19 +13,17 @@ import type { PaletteRegistry } from '@kbn/coloring'; import { IconChartBarReferenceLine, IconChartBarAnnotations } from '@kbn/chart-icons'; import { FieldFormatsStart } from '@kbn/field-formats-plugin/public'; import { CoreStart, SavedObjectReference, ThemeServiceStart } from '@kbn/core/public'; -import { - EventAnnotationServiceType, - getAnnotationAccessor, -} from '@kbn/event-annotation-plugin/public'; +import { EventAnnotationServiceType } from '@kbn/event-annotation-plugin/public'; +import { getAnnotationAccessor } from '@kbn/event-annotation-components'; import { VIS_EVENT_TO_TRIGGER } from '@kbn/visualizations-plugin/public'; import type { DataPublicPluginStart } from '@kbn/data-plugin/public'; import type { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; import { LayerTypes } from '@kbn/expression-xy-plugin/public'; import { SavedObjectTaggingPluginStart } from '@kbn/saved-objects-tagging-plugin/public'; -import { EventAnnotationGroupConfig } from '@kbn/event-annotation-plugin/common'; +import type { EventAnnotationGroupConfig } from '@kbn/event-annotation-common'; import { isEqual } from 'lodash'; -import { type AccessorConfig, DimensionTrigger } from '@kbn/visualization-ui-components/public'; +import { type AccessorConfig, DimensionTrigger } from '@kbn/visualization-ui-components'; import { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public'; import { generateId } from '../../id_generator'; import { diff --git a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/annotations_panel.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/annotations_panel.tsx index 19bbcc7f4bfc8..08781448be439 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/annotations_panel.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/annotations_config_panel/annotations_panel.tsx @@ -7,10 +7,10 @@ import React, { useCallback, useEffect, useState } from 'react'; import type { DatatableUtilitiesService } from '@kbn/data-plugin/common'; -import { AnnotationEditorControls } from '@kbn/event-annotation-plugin/public'; -import { EventAnnotationConfig } from '@kbn/event-annotation-plugin/common'; +import { AnnotationEditorControls } from '@kbn/event-annotation-components'; +import type { EventAnnotationConfig } from '@kbn/event-annotation-common'; import { useKibana } from '@kbn/kibana-react-plugin/public'; -import { useDebouncedValue } from '@kbn/visualization-ui-components/public'; +import { useDebouncedValue } from '@kbn/visualization-ui-components'; import { DataViewsPublicPluginStart, DataView } from '@kbn/data-views-plugin/public'; import moment from 'moment'; import { search } from '@kbn/data-plugin/public'; diff --git a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/axis_settings_popover.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/axis_settings_popover.tsx index e83899cdbf926..11077414e25b8 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/axis_settings_popover.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/axis_settings_popover.tsx @@ -17,7 +17,7 @@ import { EuiIconAxisRight, EuiIconAxisTop, } from '@kbn/chart-icons'; -import { useDebouncedValue } from '@kbn/visualization-ui-components/public'; +import { useDebouncedValue } from '@kbn/visualization-ui-components'; import { isHorizontalChart } from '../state_helpers'; import { ToolbarPopover, diff --git a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/dimension_editor.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/dimension_editor.tsx index 97ac10d4824f0..94c7a326ccbb4 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/dimension_editor.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/dimension_editor.tsx @@ -9,8 +9,8 @@ import React, { useCallback, useMemo } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiButtonGroup, EuiFormRow, htmlIdGenerator } from '@elastic/eui'; import type { PaletteRegistry } from '@kbn/coloring'; -import { useDebouncedValue } from '@kbn/visualization-ui-components/public'; -import { ColorPicker } from '@kbn/visualization-ui-components/public'; +import { useDebouncedValue } from '@kbn/visualization-ui-components'; +import { ColorPicker } from '@kbn/visualization-ui-components'; import type { VisualizationDimensionEditorProps } from '../../../types'; import { State, XYState, XYDataLayerConfig, YConfig, YAxisMode } from '../types'; import { FormatFactory } from '../../../../common/types'; diff --git a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/index.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/index.tsx index e0b4ab1ae1669..3697ce988efb5 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/index.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/index.tsx @@ -11,7 +11,7 @@ import { Position, ScaleType } from '@elastic/charts'; import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { AxisExtentConfig } from '@kbn/expression-xy-plugin/common'; import { LegendSize } from '@kbn/visualizations-plugin/public'; -import { TooltipWrapper } from '@kbn/visualization-ui-components/public'; +import { TooltipWrapper } from '@kbn/visualization-ui-components'; import type { LegendSettingsPopoverProps } from '../../../shared_components/legend/legend_settings_popover'; import type { VisualizationToolbarProps, FramePublicAPI } from '../../../types'; import { State, XYState, AxesSettingsConfig } from '../types'; diff --git a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/reference_line_config_panel/icon_set.ts b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/reference_line_config_panel/icon_set.ts index 73d53b566002d..623e474d0d10b 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/reference_line_config_panel/icon_set.ts +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/reference_line_config_panel/icon_set.ts @@ -7,7 +7,7 @@ import { i18n } from '@kbn/i18n'; import { AvailableReferenceLineIcon } from '@kbn/expression-xy-plugin/common'; -import { type IconSet } from '@kbn/visualization-ui-components/public'; +import { type IconSet } from '@kbn/visualization-ui-components'; export const referenceLineIconsSet: IconSet = [ { diff --git a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/reference_line_config_panel/reference_line_panel.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/reference_line_config_panel/reference_line_panel.tsx index 6f6b4807b6f96..411d3049699ad 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/reference_line_config_panel/reference_line_panel.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/reference_line_config_panel/reference_line_panel.tsx @@ -16,7 +16,7 @@ import { ColorPicker, LineStyleSettings, TextDecorationSetting, -} from '@kbn/visualization-ui-components/public'; +} from '@kbn/visualization-ui-components'; import type { VisualizationDimensionEditorProps } from '../../../../types'; import { State, XYState, XYReferenceLineLayerConfig, YConfig } from '../../types'; import { FormatFactory } from '../../../../../common/types'; diff --git a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/shared/marker_decoration_settings.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/shared/marker_decoration_settings.tsx index 87528f2789d28..3f620a9379538 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/shared/marker_decoration_settings.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/shared/marker_decoration_settings.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { EuiButtonGroup, EuiFormRow } from '@elastic/eui'; import { IconPosition } from '@kbn/expression-xy-plugin/common'; -import { TooltipWrapper } from '@kbn/visualization-ui-components/public'; +import { TooltipWrapper } from '@kbn/visualization-ui-components'; import { YAxisMode } from '../../types'; import { idPrefix } from '../dimension_editor'; diff --git a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/fill_opacity_option.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/fill_opacity_option.tsx index fa991c9fbc292..1eca01672964e 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/fill_opacity_option.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/fill_opacity_option.tsx @@ -8,7 +8,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { EuiFormRow, EuiRange } from '@elastic/eui'; -import { useDebouncedValue } from '@kbn/visualization-ui-components/public'; +import { useDebouncedValue } from '@kbn/visualization-ui-components'; export interface FillOpacityOptionProps { /** diff --git a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/index.tsx b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/index.tsx index 4749ede2b4e99..bd147779fed8d 100644 --- a/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/index.tsx +++ b/x-pack/plugins/lens/public/visualizations/xy/xy_config_panel/visual_options_popover/index.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; -import { TooltipWrapper } from '@kbn/visualization-ui-components/public'; +import { TooltipWrapper } from '@kbn/visualization-ui-components'; import { ToolbarPopover, ValueLabelsSettings } from '../../../../shared_components'; import { MissingValuesOptions } from './missing_values_option'; import { LineCurveOption } from './line_curve_option'; diff --git a/x-pack/plugins/lens/tsconfig.json b/x-pack/plugins/lens/tsconfig.json index 9cb461d1f1491..541f3e98277b9 100644 --- a/x-pack/plugins/lens/tsconfig.json +++ b/x-pack/plugins/lens/tsconfig.json @@ -79,8 +79,10 @@ "@kbn/core-saved-objects-utils-server", "@kbn/core-lifecycle-browser-mocks", "@kbn/unified-field-list", + "@kbn/event-annotation-common", "@kbn/core-overlays-browser-mocks", - "@kbn/core-theme-browser-mocks" + "@kbn/core-theme-browser-mocks", + "@kbn/event-annotation-components", ], "exclude": [ "target/**/*", diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 21c8dc84f816a..191ee0ed2d32e 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -40169,7 +40169,6 @@ "eventAnnotation.manualAnnotation.args.lineWidth": "Largeur de la ligne d'annotation", "eventAnnotation.manualAnnotation.args.textVisibility": "Visibilité de l'étiquette sur la ligne d'annotation", "eventAnnotation.manualAnnotation.args.time": "Horodatage de l'annotation", - "eventAnnotation.manualAnnotation.defaultAnnotationLabel": "Événement", "eventAnnotation.manualAnnotation.description": "Configurer l'annotation manuelle", "eventAnnotation.queryAnnotation.args.color": "Couleur de la ligne", "eventAnnotation.queryAnnotation.args.field": "Champs supplémentaires de l'annotation", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 5e0a2252942fb..a77fbd6682844 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -40159,7 +40159,6 @@ "eventAnnotation.manualAnnotation.args.lineWidth": "注釈行の幅", "eventAnnotation.manualAnnotation.args.textVisibility": "注釈行のラベルの表示", "eventAnnotation.manualAnnotation.args.time": "注釈のタイムスタンプ", - "eventAnnotation.manualAnnotation.defaultAnnotationLabel": "イベント", "eventAnnotation.manualAnnotation.description": "手動注釈の構成", "eventAnnotation.queryAnnotation.args.color": "行の色", "eventAnnotation.queryAnnotation.args.field": "注釈の追加フィールド", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 1b13f2302f176..84aaacd84c427 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -40153,7 +40153,6 @@ "eventAnnotation.manualAnnotation.args.lineWidth": "标注线条的宽度", "eventAnnotation.manualAnnotation.args.textVisibility": "标注线条上标签的可见性", "eventAnnotation.manualAnnotation.args.time": "标注的时间戳", - "eventAnnotation.manualAnnotation.defaultAnnotationLabel": "事件", "eventAnnotation.manualAnnotation.description": "配置手动标注", "eventAnnotation.queryAnnotation.args.color": "线条的颜色", "eventAnnotation.queryAnnotation.args.field": "标注的附加字段", diff --git a/yarn.lock b/yarn.lock index 91a7de87818a1..66513c9fd9b5f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4162,6 +4162,14 @@ version "0.0.0" uid "" +"@kbn/event-annotation-common@link:packages/kbn-event-annotation-common": + version "0.0.0" + uid "" + +"@kbn/event-annotation-components@link:packages/kbn-event-annotation-components": + version "0.0.0" + uid "" + "@kbn/event-annotation-plugin@link:src/plugins/event_annotation": version "0.0.0" uid "" @@ -5770,7 +5778,7 @@ version "0.0.0" uid "" -"@kbn/visualization-ui-components@link:src/plugins/visualization_ui_components": +"@kbn/visualization-ui-components@link:packages/kbn-visualization-ui-components": version "0.0.0" uid ""