From dd7c1ad3beed3dc83f4059fe8f90b8e5afadf291 Mon Sep 17 00:00:00 2001 From: Clint Andrew Hall Date: Wed, 9 Mar 2022 23:18:35 -0600 Subject: [PATCH 1/9] [SharedUX][PoC] Move to a package architecture --- package.json | 8 + packages/BUILD.bazel | 8 + packages/kbn-sharedux-components/BUILD.bazel | 144 ++++++++++++++++++ packages/kbn-sharedux-components/README.md | 3 + .../kbn-sharedux-components/jest.config.js | 13 ++ packages/kbn-sharedux-components/package.json | 8 + .../assets/data_view_illustration.tsx | 0 .../src}/empty_state/assets/index.tsx | 3 +- .../src}/empty_state/index.tsx | 0 .../documentation_link.test.tsx.snap | 0 .../no_data_views/documentation_link.test.tsx | 0 .../no_data_views/documentation_link.tsx | 0 .../src}/empty_state/no_data_views/index.tsx | 0 .../no_data_views.component.test.tsx | 0 .../no_data_views/no_data_views.component.tsx | 0 .../no_data_views/no_data_views.mdx | 0 .../no_data_views/no_data_views.stories.tsx | 3 +- .../no_data_views/no_data_views.test.tsx | 11 +- .../no_data_views/no_data_views.tsx | 8 +- .../exit_full_screen_button.test.tsx.snap | 0 .../exit_full_screen_button.component.tsx | 0 .../exit_full_screen_button.mdx | 0 .../exit_full_screen_button.scss | 0 .../exit_full_screen_button.stories.tsx | 0 .../exit_full_screen_button.test.tsx | 11 +- .../exit_full_screen_button.tsx | 3 +- .../src}/exit_full_screen_button/index.ts | 0 .../kbn-sharedux-components/src}/index.ts | 6 +- .../kbn-sharedux-components/src}/mdx.d.ts | 0 .../src}/toolbar/index.ts | 0 .../__snapshots__/primary.test.tsx.snap | 0 .../solution_toolbar/button/primary.mdx | 0 .../button/primary.stories.tsx | 0 .../solution_toolbar/button/primary.test.tsx | 12 +- .../solution_toolbar/button/primary.tsx | 0 .../kbn-sharedux-components/tsconfig.json | 18 +++ packages/kbn-sharedux-services/BUILD.bazel | 126 +++++++++++++++ packages/kbn-sharedux-services/README.md | 3 + packages/kbn-sharedux-services/jest.config.js | 13 ++ packages/kbn-sharedux-services/package.json | 8 + packages/kbn-sharedux-services/src/index.ts | 31 ++++ .../src/services/doc_links.ts | 11 ++ .../src/services/editors.ts | 15 ++ .../src}/services/index.tsx | 30 +++- .../src}/services/mocks/doc_links.mock.ts | 4 +- .../src}/services/mocks/editors.mock.ts | 4 +- .../src}/services/mocks/index.ts | 33 +++- .../src}/services/mocks/permissions.mock.ts | 5 +- .../src}/services/mocks/platform.mock.ts | 4 +- .../src/services/permissions.ts | 11 ++ .../src/services/platform.ts | 23 +++ .../src}/services/stub/doc_links.ts | 4 +- .../src}/services/stub/editors.ts | 4 +- .../src}/services/stub/index.ts | 15 +- .../src}/services/stub/permissions.ts | 4 +- .../src}/services/stub/platform.ts | 4 +- .../src/services/types.ts | 16 ++ .../kbn-sharedux-services/src/types.ts | 4 +- packages/kbn-sharedux-services/tsconfig.json | 17 +++ .../kbn-sharedux-storybook/.storybook/main.ts | 19 +++ .../.storybook/manager.ts | 0 .../.storybook/preview.ts | 2 +- packages/kbn-sharedux-storybook/BUILD.bazel | 126 +++++++++++++++ packages/kbn-sharedux-storybook/README.md | 3 + .../kbn-sharedux-storybook/jest.config.js | 13 ++ packages/kbn-sharedux-storybook/package.json | 8 + .../src}/decorators.tsx | 7 +- packages/kbn-sharedux-storybook/src/index.ts | 17 +++ packages/kbn-sharedux-storybook/src/mdx.d.ts | 14 ++ .../src/services}/doc_links.ts | 7 +- .../src/services}/editors.ts | 9 +- .../src/services}/index.ts | 11 +- .../src/services}/permissions.ts | 6 +- .../src/services}/platform.ts | 6 +- packages/kbn-sharedux-storybook/tsconfig.json | 17 +++ packages/kbn-sharedux-utility/BUILD.bazel | 128 ++++++++++++++++ packages/kbn-sharedux-utility/README.md | 3 + packages/kbn-sharedux-utility/jest.config.js | 13 ++ packages/kbn-sharedux-utility/package.json | 8 + .../kbn-sharedux-utility/src}/fallback.tsx | 0 .../kbn-sharedux-utility/src}/index.ts | 0 .../src}/with_suspense.tsx | 0 packages/kbn-sharedux-utility/tsconfig.json | 18 +++ src/dev/storybook/aliases.ts | 2 +- src/plugins/shared_ux/kibana.json | 2 +- src/plugins/shared_ux/public/index.ts | 8 +- src/plugins/shared_ux/public/plugin.tsx | 8 +- .../shared_ux/public/services/doc_links.ts | 20 ++- .../shared_ux/public/services/editors.ts | 25 ++- .../public/services/{kibana => }/index.ts | 8 +- .../public/services/kibana/doc_links.ts | 23 --- .../public/services/kibana/editors.ts | 23 --- .../public/services/kibana/permissions.ts | 23 --- .../public/services/kibana/platform.ts | 26 ---- .../shared_ux/public/services/permissions.ts | 18 ++- .../shared_ux/public/services/platform.ts | 29 ++-- .../shared_ux/public/services/types.ts | 9 -- yarn.lock | 32 ++++ 98 files changed, 1112 insertions(+), 227 deletions(-) create mode 100644 packages/kbn-sharedux-components/BUILD.bazel create mode 100644 packages/kbn-sharedux-components/README.md create mode 100644 packages/kbn-sharedux-components/jest.config.js create mode 100644 packages/kbn-sharedux-components/package.json rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/empty_state/assets/data_view_illustration.tsx (100%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/empty_state/assets/index.tsx (93%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/empty_state/index.tsx (100%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/empty_state/no_data_views/__snapshots__/documentation_link.test.tsx.snap (100%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/empty_state/no_data_views/documentation_link.test.tsx (100%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/empty_state/no_data_views/documentation_link.tsx (100%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/empty_state/no_data_views/index.tsx (100%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/empty_state/no_data_views/no_data_views.component.test.tsx (100%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/empty_state/no_data_views/no_data_views.component.tsx (100%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/empty_state/no_data_views/no_data_views.mdx (100%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/empty_state/no_data_views/no_data_views.stories.tsx (94%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/empty_state/no_data_views/no_data_views.test.tsx (82%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/empty_state/no_data_views/no_data_views.tsx (89%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/exit_full_screen_button/__snapshots__/exit_full_screen_button.test.tsx.snap (100%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/exit_full_screen_button/exit_full_screen_button.component.tsx (100%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/exit_full_screen_button/exit_full_screen_button.mdx (100%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/exit_full_screen_button/exit_full_screen_button.scss (100%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/exit_full_screen_button/exit_full_screen_button.stories.tsx (100%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/exit_full_screen_button/exit_full_screen_button.test.tsx (89%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/exit_full_screen_button/exit_full_screen_button.tsx (97%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/exit_full_screen_button/index.ts (100%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/index.ts (92%) mode change 100644 => 100755 rename {src/plugins/shared_ux/public/types => packages/kbn-sharedux-components/src}/mdx.d.ts (100%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/toolbar/index.ts (100%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/toolbar/solution_toolbar/button/__snapshots__/primary.test.tsx.snap (100%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/toolbar/solution_toolbar/button/primary.mdx (100%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/toolbar/solution_toolbar/button/primary.stories.tsx (100%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/toolbar/solution_toolbar/button/primary.test.tsx (81%) rename {src/plugins/shared_ux/public/components => packages/kbn-sharedux-components/src}/toolbar/solution_toolbar/button/primary.tsx (100%) create mode 100644 packages/kbn-sharedux-components/tsconfig.json create mode 100755 packages/kbn-sharedux-services/BUILD.bazel create mode 100755 packages/kbn-sharedux-services/README.md create mode 100755 packages/kbn-sharedux-services/jest.config.js create mode 100755 packages/kbn-sharedux-services/package.json create mode 100755 packages/kbn-sharedux-services/src/index.ts create mode 100644 packages/kbn-sharedux-services/src/services/doc_links.ts create mode 100644 packages/kbn-sharedux-services/src/services/editors.ts rename {src/plugins/shared_ux/public => packages/kbn-sharedux-services/src}/services/index.tsx (65%) rename {src/plugins/shared_ux/public => packages/kbn-sharedux-services/src}/services/mocks/doc_links.mock.ts (82%) rename {src/plugins/shared_ux/public => packages/kbn-sharedux-services/src}/services/mocks/editors.mock.ts (82%) rename {src/plugins/shared_ux/public => packages/kbn-sharedux-services/src}/services/mocks/index.ts (57%) rename {src/plugins/shared_ux/public => packages/kbn-sharedux-services/src}/services/mocks/permissions.mock.ts (81%) rename {src/plugins/shared_ux/public => packages/kbn-sharedux-services/src}/services/mocks/platform.mock.ts (83%) create mode 100644 packages/kbn-sharedux-services/src/services/permissions.ts create mode 100644 packages/kbn-sharedux-services/src/services/platform.ts rename {src/plugins/shared_ux/public => packages/kbn-sharedux-services/src}/services/stub/doc_links.ts (82%) rename {src/plugins/shared_ux/public => packages/kbn-sharedux-services/src}/services/stub/editors.ts (84%) rename {src/plugins/shared_ux/public => packages/kbn-sharedux-services/src}/services/stub/index.ts (70%) rename {src/plugins/shared_ux/public => packages/kbn-sharedux-services/src}/services/stub/permissions.ts (83%) rename {src/plugins/shared_ux/public => packages/kbn-sharedux-services/src}/services/stub/platform.ts (84%) create mode 100644 packages/kbn-sharedux-services/src/services/types.ts rename src/plugins/shared_ux/.storybook/main.ts => packages/kbn-sharedux-services/src/types.ts (81%) mode change 100644 => 100755 create mode 100755 packages/kbn-sharedux-services/tsconfig.json create mode 100644 packages/kbn-sharedux-storybook/.storybook/main.ts rename {src/plugins/shared_ux => packages/kbn-sharedux-storybook}/.storybook/manager.ts (100%) rename {src/plugins/shared_ux => packages/kbn-sharedux-storybook}/.storybook/preview.ts (87%) create mode 100644 packages/kbn-sharedux-storybook/BUILD.bazel create mode 100644 packages/kbn-sharedux-storybook/README.md create mode 100644 packages/kbn-sharedux-storybook/jest.config.js create mode 100644 packages/kbn-sharedux-storybook/package.json rename {src/plugins/shared_ux/.storybook => packages/kbn-sharedux-storybook/src}/decorators.tsx (75%) create mode 100755 packages/kbn-sharedux-storybook/src/index.ts create mode 100644 packages/kbn-sharedux-storybook/src/mdx.d.ts rename {src/plugins/shared_ux/public/services/storybook => packages/kbn-sharedux-storybook/src/services}/doc_links.ts (66%) rename {src/plugins/shared_ux/public/services/storybook => packages/kbn-sharedux-storybook/src/services}/editors.ts (67%) rename {src/plugins/shared_ux/public/services/storybook => packages/kbn-sharedux-storybook/src/services}/index.ts (68%) rename {src/plugins/shared_ux/public/services/storybook => packages/kbn-sharedux-storybook/src/services}/permissions.ts (72%) rename {src/plugins/shared_ux/public/services/storybook => packages/kbn-sharedux-storybook/src/services}/platform.ts (79%) create mode 100644 packages/kbn-sharedux-storybook/tsconfig.json create mode 100644 packages/kbn-sharedux-utility/BUILD.bazel create mode 100644 packages/kbn-sharedux-utility/README.md create mode 100644 packages/kbn-sharedux-utility/jest.config.js create mode 100644 packages/kbn-sharedux-utility/package.json rename {src/plugins/shared_ux/public/components/utility => packages/kbn-sharedux-utility/src}/fallback.tsx (100%) rename {src/plugins/shared_ux/public/components/utility => packages/kbn-sharedux-utility/src}/index.ts (100%) rename {src/plugins/shared_ux/public/components/utility => packages/kbn-sharedux-utility/src}/with_suspense.tsx (100%) create mode 100644 packages/kbn-sharedux-utility/tsconfig.json rename src/plugins/shared_ux/public/services/{kibana => }/index.ts (84%) delete mode 100644 src/plugins/shared_ux/public/services/kibana/doc_links.ts delete mode 100644 src/plugins/shared_ux/public/services/kibana/editors.ts delete mode 100644 src/plugins/shared_ux/public/services/kibana/permissions.ts delete mode 100644 src/plugins/shared_ux/public/services/kibana/platform.ts diff --git a/package.json b/package.json index 55a33716e7614..f87c2248c3311 100644 --- a/package.json +++ b/package.json @@ -166,6 +166,10 @@ "@kbn/securitysolution-utils": "link:bazel-bin/packages/kbn-securitysolution-utils", "@kbn/server-http-tools": "link:bazel-bin/packages/kbn-server-http-tools", "@kbn/server-route-repository": "link:bazel-bin/packages/kbn-server-route-repository", + "@kbn/sharedux-components": "link:bazel-bin/packages/kbn-sharedux-components", + "@kbn/sharedux-services": "link:bazel-bin/packages/kbn-sharedux-services", + "@kbn/sharedux-storybook": "link:bazel-bin/packages/kbn-sharedux-storybook", + "@kbn/sharedux-utility": "link:bazel-bin/packages/kbn-sharedux-utility", "@kbn/std": "link:bazel-bin/packages/kbn-std", "@kbn/timelion-grammar": "link:bazel-bin/packages/kbn-timelion-grammar", "@kbn/tinymath": "link:bazel-bin/packages/kbn-tinymath", @@ -195,6 +199,10 @@ "@turf/helpers": "6.0.1", "@turf/length": "^6.0.2", "@types/jsonwebtoken": "^8.5.6", + "@types/kbn__sharedux-components": "link:bazel-bin/packages/kbn-sharedux-components/npm_module_types", + "@types/kbn__sharedux-services": "link:bazel-bin/packages/kbn-sharedux-services/npm_module_types", + "@types/kbn__sharedux-storybook": "link:bazel-bin/packages/kbn-sharedux-storybook/npm_module_types", + "@types/kbn__sharedux-utility": "link:bazel-bin/packages/kbn-sharedux-utility/npm_module_types", "@types/moment-duration-format": "^2.2.3", "JSONStream": "1.3.5", "abort-controller": "^3.0.0", diff --git a/packages/BUILD.bazel b/packages/BUILD.bazel index e73cf0a00c1d0..4003a5268ff04 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -65,6 +65,10 @@ filegroup( "//packages/kbn-securitysolution-utils:build", "//packages/kbn-server-http-tools:build", "//packages/kbn-server-route-repository:build", + "//packages/kbn-sharedux-components:build", + "//packages/kbn-sharedux-services:build", + "//packages/kbn-sharedux-storybook:build", + "//packages/kbn-sharedux-utility:build", "//packages/kbn-spec-to-console:build", "//packages/kbn-std:build", "//packages/kbn-storybook:build", @@ -138,6 +142,10 @@ filegroup( "//packages/kbn-securitysolution-utils:build_types", "//packages/kbn-server-http-tools:build_types", "//packages/kbn-server-route-repository:build_types", + "//packages/kbn-sharedux-components:build_types", + "//packages/kbn-sharedux-services:build_types", + "//packages/kbn-sharedux-storybook:build_types", + "//packages/kbn-sharedux-utility:build_types", "//packages/kbn-std:build_types", "//packages/kbn-storybook:build_types", "//packages/kbn-telemetry-tools:build_types", diff --git a/packages/kbn-sharedux-components/BUILD.bazel b/packages/kbn-sharedux-components/BUILD.bazel new file mode 100644 index 0000000000000..743f833994106 --- /dev/null +++ b/packages/kbn-sharedux-components/BUILD.bazel @@ -0,0 +1,144 @@ +load("@npm//@bazel/typescript:index.bzl", "ts_config") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") + +PKG_DIRNAME = "kbn-sharedux-components" +PKG_REQUIRE_NAME = "@kbn/sharedux-components" + +SOURCE_FILES = glob( + [ + "src/**/*.ts", + "src/**/*.tsx", + ], + exclude = [ + "**/*.test.*", + ], +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", +] + +# In this array place runtime dependencies, including other packages and NPM packages +# which must be available for this code to run. +# +# To reference other packages use: +# "//repo/relative/path/to/package" +# eg. "//packages/kbn-utils" +# +# To reference a NPM package use: +# "@npm//name-of-package" +# eg. "@npm//lodash" +RUNTIME_DEPS = [ + "@npm//react", + "@npm//@elastic/eui", + "@npm//@emotion/react", + "@npm//@emotion/css", + "@npm//classnames", + "@npm//@storybook/addon-actions", + "//packages/kbn-sharedux-services", + "//packages/kbn-sharedux-storybook", + "//packages/kbn-sharedux-utility", + "//packages/kbn-i18n", + "//packages/kbn-i18n-react", +] + +# In this array place dependencies necessary to build the types, which will include the +# :npm_module_types target of other packages and packages from NPM, including @types/* +# packages. +# +# To reference the types for another package use: +# "//repo/relative/path/to/package:npm_module_types" +# eg. "//packages/kbn-utils:npm_module_types" +# +# References to NPM packages work the same as RUNTIME_DEPS +TYPES_DEPS = [ + "@npm//@types/node", + "@npm//@types/jest", + "@npm//@types/react", + "@npm//@elastic/eui", + "@npm//@emotion/react", + "@npm//@emotion/css", + "@npm//@storybook/addon-actions", + "@npm//@types/classnames", + "//packages/kbn-sharedux-services:npm_module_types", + "//packages/kbn-sharedux-storybook:npm_module_types", + "//packages/kbn-sharedux-utility:npm_module_types", + "//packages/kbn-i18n:npm_module_types", + "//packages/kbn-i18n-react:npm_module_types", +] + +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) + +jsts_transpiler( + name = "target_web", + srcs = SRCS, + build_pkg_name = package_name(), + web = True, +) + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:tsconfig.base.json", + "//:tsconfig.bazel.json", + ], +) + +ts_project( + name = "tsc_types", + args = ['--pretty'], + srcs = SRCS, + deps = TYPES_DEPS, + declaration = True, + emit_declaration_only = True, + out_dir = "target_types", + root_dir = "src", + tsconfig = ":tsconfig", +) + +js_library( + name = PKG_DIRNAME, + srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node", ":target_web"], + package_name = PKG_REQUIRE_NAME, + visibility = ["//visibility:public"], +) + +pkg_npm( + name = "npm_module", + deps = [":" + PKG_DIRNAME], +) + +filegroup( + name = "build", + srcs = [":npm_module"], + visibility = ["//visibility:public"], +) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [":npm_module_types"], + visibility = ["//visibility:public"], +) diff --git a/packages/kbn-sharedux-components/README.md b/packages/kbn-sharedux-components/README.md new file mode 100644 index 0000000000000..54ae9efcc22f1 --- /dev/null +++ b/packages/kbn-sharedux-components/README.md @@ -0,0 +1,3 @@ +# @kbn/sharedux-components + +Empty package generated by @kbn/generate diff --git a/packages/kbn-sharedux-components/jest.config.js b/packages/kbn-sharedux-components/jest.config.js new file mode 100644 index 0000000000000..7b9210a3ab79b --- /dev/null +++ b/packages/kbn-sharedux-components/jest.config.js @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +module.exports = { + preset: '@kbn/test', + rootDir: '../..', + roots: ['/packages/kbn-sharedux-components'], +}; diff --git a/packages/kbn-sharedux-components/package.json b/packages/kbn-sharedux-components/package.json new file mode 100644 index 0000000000000..1cb3cac8c1397 --- /dev/null +++ b/packages/kbn-sharedux-components/package.json @@ -0,0 +1,8 @@ +{ + "name": "@kbn/sharedux-components", + "private": true, + "version": "1.0.0", + "main": "./target_node/index.js", + "browser": "./target_web/index.js", + "license": "SSPL-1.0 OR Elastic License 2.0" +} diff --git a/src/plugins/shared_ux/public/components/empty_state/assets/data_view_illustration.tsx b/packages/kbn-sharedux-components/src/empty_state/assets/data_view_illustration.tsx similarity index 100% rename from src/plugins/shared_ux/public/components/empty_state/assets/data_view_illustration.tsx rename to packages/kbn-sharedux-components/src/empty_state/assets/data_view_illustration.tsx diff --git a/src/plugins/shared_ux/public/components/empty_state/assets/index.tsx b/packages/kbn-sharedux-components/src/empty_state/assets/index.tsx similarity index 93% rename from src/plugins/shared_ux/public/components/empty_state/assets/index.tsx rename to packages/kbn-sharedux-components/src/empty_state/assets/index.tsx index c234cdf40055b..d0e2d224772ed 100644 --- a/src/plugins/shared_ux/public/components/empty_state/assets/index.tsx +++ b/packages/kbn-sharedux-components/src/empty_state/assets/index.tsx @@ -9,8 +9,7 @@ import React from 'react'; import { EuiLoadingSpinner } from '@elastic/eui'; - -import { withSuspense } from '../../utility'; +import { withSuspense } from '@kbn/sharedux-utility'; export const LazyDataViewIllustration = React.lazy(() => import('../assets/data_view_illustration').then(({ DataViewIllustration }) => ({ diff --git a/src/plugins/shared_ux/public/components/empty_state/index.tsx b/packages/kbn-sharedux-components/src/empty_state/index.tsx similarity index 100% rename from src/plugins/shared_ux/public/components/empty_state/index.tsx rename to packages/kbn-sharedux-components/src/empty_state/index.tsx diff --git a/src/plugins/shared_ux/public/components/empty_state/no_data_views/__snapshots__/documentation_link.test.tsx.snap b/packages/kbn-sharedux-components/src/empty_state/no_data_views/__snapshots__/documentation_link.test.tsx.snap similarity index 100% rename from src/plugins/shared_ux/public/components/empty_state/no_data_views/__snapshots__/documentation_link.test.tsx.snap rename to packages/kbn-sharedux-components/src/empty_state/no_data_views/__snapshots__/documentation_link.test.tsx.snap diff --git a/src/plugins/shared_ux/public/components/empty_state/no_data_views/documentation_link.test.tsx b/packages/kbn-sharedux-components/src/empty_state/no_data_views/documentation_link.test.tsx similarity index 100% rename from src/plugins/shared_ux/public/components/empty_state/no_data_views/documentation_link.test.tsx rename to packages/kbn-sharedux-components/src/empty_state/no_data_views/documentation_link.test.tsx diff --git a/src/plugins/shared_ux/public/components/empty_state/no_data_views/documentation_link.tsx b/packages/kbn-sharedux-components/src/empty_state/no_data_views/documentation_link.tsx similarity index 100% rename from src/plugins/shared_ux/public/components/empty_state/no_data_views/documentation_link.tsx rename to packages/kbn-sharedux-components/src/empty_state/no_data_views/documentation_link.tsx diff --git a/src/plugins/shared_ux/public/components/empty_state/no_data_views/index.tsx b/packages/kbn-sharedux-components/src/empty_state/no_data_views/index.tsx similarity index 100% rename from src/plugins/shared_ux/public/components/empty_state/no_data_views/index.tsx rename to packages/kbn-sharedux-components/src/empty_state/no_data_views/index.tsx diff --git a/src/plugins/shared_ux/public/components/empty_state/no_data_views/no_data_views.component.test.tsx b/packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.component.test.tsx similarity index 100% rename from src/plugins/shared_ux/public/components/empty_state/no_data_views/no_data_views.component.test.tsx rename to packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.component.test.tsx diff --git a/src/plugins/shared_ux/public/components/empty_state/no_data_views/no_data_views.component.tsx b/packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.component.tsx similarity index 100% rename from src/plugins/shared_ux/public/components/empty_state/no_data_views/no_data_views.component.tsx rename to packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.component.tsx diff --git a/src/plugins/shared_ux/public/components/empty_state/no_data_views/no_data_views.mdx b/packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.mdx similarity index 100% rename from src/plugins/shared_ux/public/components/empty_state/no_data_views/no_data_views.mdx rename to packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.mdx diff --git a/src/plugins/shared_ux/public/components/empty_state/no_data_views/no_data_views.stories.tsx b/packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.stories.tsx similarity index 94% rename from src/plugins/shared_ux/public/components/empty_state/no_data_views/no_data_views.stories.tsx rename to packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.stories.tsx index 3f9ae1958cad7..da656cef1d6d8 100644 --- a/src/plugins/shared_ux/public/components/empty_state/no_data_views/no_data_views.stories.tsx +++ b/packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.stories.tsx @@ -7,8 +7,7 @@ */ import React from 'react'; import { action } from '@storybook/addon-actions'; - -import { docLinksServiceFactory } from '../../../services/storybook/doc_links'; +import { docLinksServiceFactory } from '@kbn/sharedux-storybook'; import { NoDataViews as NoDataViewsComponent, Props } from './no_data_views.component'; import { NoDataViews } from './no_data_views'; diff --git a/src/plugins/shared_ux/public/components/empty_state/no_data_views/no_data_views.test.tsx b/packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.test.tsx similarity index 82% rename from src/plugins/shared_ux/public/components/empty_state/no_data_views/no_data_views.test.tsx rename to packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.test.tsx index 650d78fa64a03..22fb2620b02c0 100644 --- a/src/plugins/shared_ux/public/components/empty_state/no_data_views/no_data_views.test.tsx +++ b/packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.test.tsx @@ -11,9 +11,12 @@ import { ReactWrapper } from 'enzyme'; import { mountWithIntl } from '@kbn/test-jest-helpers'; import { EuiButton } from '@elastic/eui'; +import { + SharedUXServicesProvider, + SharedUXServices, + mockServiceFactories, +} from '@kbn/sharedux-services'; -import { ServicesProvider, SharedUXServices } from '../../../services'; -import { servicesFactory } from '../../../services/mocks'; import { NoDataViews } from './no_data_views'; describe('', () => { @@ -21,9 +24,9 @@ describe('', () => { let mount: (element: JSX.Element) => ReactWrapper; beforeEach(() => { - services = servicesFactory(); + services = mockServiceFactories.servicesFactory(); mount = (element: JSX.Element) => - mountWithIntl({element}); + mountWithIntl({element}); }); afterEach(() => { diff --git a/src/plugins/shared_ux/public/components/empty_state/no_data_views/no_data_views.tsx b/packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.tsx similarity index 89% rename from src/plugins/shared_ux/public/components/empty_state/no_data_views/no_data_views.tsx rename to packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.tsx index 01494d2c8a5b3..a41b9840605c6 100644 --- a/src/plugins/shared_ux/public/components/empty_state/no_data_views/no_data_views.tsx +++ b/packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.tsx @@ -7,15 +7,13 @@ */ import React, { useCallback, useEffect, useRef } from 'react'; - -import { DataView } from '../../../../../data_views/public'; -import { useEditors, usePermissions } from '../../../services'; -import type { SharedUXEditorsService } from '../../../services/editors'; +import { useEditors, usePermissions } from '@kbn/sharedux-services'; +import type { SharedUXEditorsService } from '@kbn/sharedux-services'; import { NoDataViews as NoDataViewsComponent } from './no_data_views.component'; export interface Props { - onDataViewCreated: (dataView: DataView) => void; + onDataViewCreated: (dataView: unknown) => void; dataViewsDocLink: string; } diff --git a/src/plugins/shared_ux/public/components/exit_full_screen_button/__snapshots__/exit_full_screen_button.test.tsx.snap b/packages/kbn-sharedux-components/src/exit_full_screen_button/__snapshots__/exit_full_screen_button.test.tsx.snap similarity index 100% rename from src/plugins/shared_ux/public/components/exit_full_screen_button/__snapshots__/exit_full_screen_button.test.tsx.snap rename to packages/kbn-sharedux-components/src/exit_full_screen_button/__snapshots__/exit_full_screen_button.test.tsx.snap diff --git a/src/plugins/shared_ux/public/components/exit_full_screen_button/exit_full_screen_button.component.tsx b/packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.component.tsx similarity index 100% rename from src/plugins/shared_ux/public/components/exit_full_screen_button/exit_full_screen_button.component.tsx rename to packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.component.tsx diff --git a/src/plugins/shared_ux/public/components/exit_full_screen_button/exit_full_screen_button.mdx b/packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.mdx similarity index 100% rename from src/plugins/shared_ux/public/components/exit_full_screen_button/exit_full_screen_button.mdx rename to packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.mdx diff --git a/src/plugins/shared_ux/public/components/exit_full_screen_button/exit_full_screen_button.scss b/packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.scss similarity index 100% rename from src/plugins/shared_ux/public/components/exit_full_screen_button/exit_full_screen_button.scss rename to packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.scss diff --git a/src/plugins/shared_ux/public/components/exit_full_screen_button/exit_full_screen_button.stories.tsx b/packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.stories.tsx similarity index 100% rename from src/plugins/shared_ux/public/components/exit_full_screen_button/exit_full_screen_button.stories.tsx rename to packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.stories.tsx diff --git a/src/plugins/shared_ux/public/components/exit_full_screen_button/exit_full_screen_button.test.tsx b/packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.test.tsx similarity index 89% rename from src/plugins/shared_ux/public/components/exit_full_screen_button/exit_full_screen_button.test.tsx rename to packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.test.tsx index dc634810a5794..02e38fc049f0c 100644 --- a/src/plugins/shared_ux/public/components/exit_full_screen_button/exit_full_screen_button.test.tsx +++ b/packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.test.tsx @@ -9,9 +9,12 @@ import React from 'react'; import { mount as enzymeMount, ReactWrapper } from 'enzyme'; import { keys } from '@elastic/eui'; +import { + SharedUXServicesProvider, + SharedUXServices, + mockServiceFactories, +} from '@kbn/sharedux-services'; -import { ServicesProvider, SharedUXServices } from '../../services'; -import { servicesFactory } from '../../services/mocks'; import { ExitFullScreenButton } from './exit_full_screen_button'; describe('', () => { @@ -19,9 +22,9 @@ describe('', () => { let mount: (element: JSX.Element) => ReactWrapper; beforeEach(() => { - services = servicesFactory(); + services = mockServiceFactories.servicesFactory(); mount = (element: JSX.Element) => - enzymeMount({element}); + enzymeMount({element}); }); afterEach(() => { diff --git a/src/plugins/shared_ux/public/components/exit_full_screen_button/exit_full_screen_button.tsx b/packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.tsx similarity index 97% rename from src/plugins/shared_ux/public/components/exit_full_screen_button/exit_full_screen_button.tsx rename to packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.tsx index 1f0b2f43a6b25..b5e8faeb710b6 100644 --- a/src/plugins/shared_ux/public/components/exit_full_screen_button/exit_full_screen_button.tsx +++ b/packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.tsx @@ -10,8 +10,9 @@ import React, { useCallback, useEffect } from 'react'; import { useEuiTheme, keys } from '@elastic/eui'; import { css } from '@emotion/react'; +import { usePlatformService } from '@kbn/sharedux-services'; + import { ExitFullScreenButton as Component } from './exit_full_screen_button.component'; -import { usePlatformService } from '../../services'; /** * Props for the service-enabled Exit Full Screen button component. diff --git a/src/plugins/shared_ux/public/components/exit_full_screen_button/index.ts b/packages/kbn-sharedux-components/src/exit_full_screen_button/index.ts similarity index 100% rename from src/plugins/shared_ux/public/components/exit_full_screen_button/index.ts rename to packages/kbn-sharedux-components/src/exit_full_screen_button/index.ts diff --git a/src/plugins/shared_ux/public/components/index.ts b/packages/kbn-sharedux-components/src/index.ts old mode 100644 new mode 100755 similarity index 92% rename from src/plugins/shared_ux/public/components/index.ts rename to packages/kbn-sharedux-components/src/index.ts index c2f835b97ebde..d70569d5ef473 --- a/src/plugins/shared_ux/public/components/index.ts +++ b/packages/kbn-sharedux-components/src/index.ts @@ -7,7 +7,7 @@ */ import React from 'react'; -import { withSuspense } from './utility'; +import { withSuspense } from '@kbn/sharedux-utility'; /** * The Lazily-loaded `ExitFullScreenButton` component. Consumers should use `React.Suspennse` or the @@ -43,7 +43,7 @@ export const SolutionToolbarButton = withSuspense(LazySolutionToolbarButton); * The Lazily-loaded `NoDataViews` component. Consumers should use `React.Suspennse` or the * `withSuspense` HOC to load this component. */ -export const LazyNoDataViewsPage = React.lazy(() => +export const LazyNoDataViews = React.lazy(() => import('./empty_state/no_data_views').then(({ NoDataViews }) => ({ default: NoDataViews, })) @@ -54,4 +54,4 @@ export const LazyNoDataViewsPage = React.lazy(() => * be used directly by consumers and will load the `LazyNoDataViewsPage` component lazily with * a predefined fallback and error boundary. */ -export const NoDataViewsPage = withSuspense(LazyNoDataViewsPage); +export const NoDataViews = withSuspense(LazyNoDataViews); diff --git a/src/plugins/shared_ux/public/types/mdx.d.ts b/packages/kbn-sharedux-components/src/mdx.d.ts similarity index 100% rename from src/plugins/shared_ux/public/types/mdx.d.ts rename to packages/kbn-sharedux-components/src/mdx.d.ts diff --git a/src/plugins/shared_ux/public/components/toolbar/index.ts b/packages/kbn-sharedux-components/src/toolbar/index.ts similarity index 100% rename from src/plugins/shared_ux/public/components/toolbar/index.ts rename to packages/kbn-sharedux-components/src/toolbar/index.ts diff --git a/src/plugins/shared_ux/public/components/toolbar/solution_toolbar/button/__snapshots__/primary.test.tsx.snap b/packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/__snapshots__/primary.test.tsx.snap similarity index 100% rename from src/plugins/shared_ux/public/components/toolbar/solution_toolbar/button/__snapshots__/primary.test.tsx.snap rename to packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/__snapshots__/primary.test.tsx.snap diff --git a/src/plugins/shared_ux/public/components/toolbar/solution_toolbar/button/primary.mdx b/packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/primary.mdx similarity index 100% rename from src/plugins/shared_ux/public/components/toolbar/solution_toolbar/button/primary.mdx rename to packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/primary.mdx diff --git a/src/plugins/shared_ux/public/components/toolbar/solution_toolbar/button/primary.stories.tsx b/packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/primary.stories.tsx similarity index 100% rename from src/plugins/shared_ux/public/components/toolbar/solution_toolbar/button/primary.stories.tsx rename to packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/primary.stories.tsx diff --git a/src/plugins/shared_ux/public/components/toolbar/solution_toolbar/button/primary.test.tsx b/packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/primary.test.tsx similarity index 81% rename from src/plugins/shared_ux/public/components/toolbar/solution_toolbar/button/primary.test.tsx rename to packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/primary.test.tsx index c2e5fd1ce7ab8..529917e30ca46 100644 --- a/src/plugins/shared_ux/public/components/toolbar/solution_toolbar/button/primary.test.tsx +++ b/packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/primary.test.tsx @@ -8,8 +8,12 @@ import { mount as enzymeMount, ReactWrapper } from 'enzyme'; import React from 'react'; -import { ServicesProvider, SharedUXServices } from '../../../../services'; -import { servicesFactory } from '../../../../services/mocks'; + +import { + SharedUXServicesProvider, + SharedUXServices, + mockServiceFactories, +} from '@kbn/sharedux-services'; import { SolutionToolbarButton } from './primary'; @@ -18,9 +22,9 @@ describe('', () => { let mount: (element: JSX.Element) => ReactWrapper; beforeEach(() => { - services = servicesFactory(); + services = mockServiceFactories.servicesFactory(); mount = (element: JSX.Element) => - enzymeMount({element}); + enzymeMount({element}); }); afterEach(() => { diff --git a/src/plugins/shared_ux/public/components/toolbar/solution_toolbar/button/primary.tsx b/packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/primary.tsx similarity index 100% rename from src/plugins/shared_ux/public/components/toolbar/solution_toolbar/button/primary.tsx rename to packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/primary.tsx diff --git a/packages/kbn-sharedux-components/tsconfig.json b/packages/kbn-sharedux-components/tsconfig.json new file mode 100644 index 0000000000000..cca91264519cc --- /dev/null +++ b/packages/kbn-sharedux-components/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "../../tsconfig.bazel.json", + "compilerOptions": { + "declaration": true, + "emitDeclarationOnly": true, + "outDir": "target_types", + "rootDir": "src", + "stripInternal": false, + "types": [ + "jest", + "node", + "@emotion/react/types/css-prop" + ] + }, + "include": [ + "src/**/*" + ] +} diff --git a/packages/kbn-sharedux-services/BUILD.bazel b/packages/kbn-sharedux-services/BUILD.bazel new file mode 100755 index 0000000000000..66dd6dea5209a --- /dev/null +++ b/packages/kbn-sharedux-services/BUILD.bazel @@ -0,0 +1,126 @@ +load("@npm//@bazel/typescript:index.bzl", "ts_config") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") + +PKG_DIRNAME = "kbn-sharedux-services" +PKG_REQUIRE_NAME = "@kbn/sharedux-services" + +SOURCE_FILES = glob( + [ + "src/**/*.ts", + "src/**/*.tsx", + ], + exclude = [ + "**/*.test.*", + ], +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", +] + +# In this array place runtime dependencies, including other packages and NPM packages +# which must be available for this code to run. +# +# To reference other packages use: +# "//repo/relative/path/to/package" +# eg. "//packages/kbn-utils" +# +# To reference a NPM package use: +# "@npm//name-of-package" +# eg. "@npm//lodash" +RUNTIME_DEPS = [ + "@npm//react", + "@npm//@storybook/addon-actions", +] + +# In this array place dependencies necessary to build the types, which will include the +# :npm_module_types target of other packages and packages from NPM, including @types/* +# packages. +# +# To reference the types for another package use: +# "//repo/relative/path/to/package:npm_module_types" +# eg. "//packages/kbn-utils:npm_module_types" +# +# References to NPM packages work the same as RUNTIME_DEPS +TYPES_DEPS = [ + "@npm//@types/node", + "@npm//@types/jest", + "@npm//@types/react", + "@npm//@storybook/addon-actions", +] + +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) + +jsts_transpiler( + name = "target_web", + srcs = SRCS, + build_pkg_name = package_name(), + web = True, +) + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:tsconfig.base.json", + "//:tsconfig.bazel.json", + ], +) + +ts_project( + name = "tsc_types", + args = ['--pretty'], + srcs = SRCS, + deps = TYPES_DEPS, + declaration = True, + emit_declaration_only = True, + out_dir = "target_types", + root_dir = "src", + tsconfig = ":tsconfig", +) + +js_library( + name = PKG_DIRNAME, + srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node", ":target_web"], + package_name = PKG_REQUIRE_NAME, + visibility = ["//visibility:public"], +) + +pkg_npm( + name = "npm_module", + deps = [":" + PKG_DIRNAME], +) + +filegroup( + name = "build", + srcs = [":npm_module"], + visibility = ["//visibility:public"], +) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [":npm_module_types"], + visibility = ["//visibility:public"], +) diff --git a/packages/kbn-sharedux-services/README.md b/packages/kbn-sharedux-services/README.md new file mode 100755 index 0000000000000..aed68c689add5 --- /dev/null +++ b/packages/kbn-sharedux-services/README.md @@ -0,0 +1,3 @@ +# @kbn/sharedux-services + +> TODO diff --git a/packages/kbn-sharedux-services/jest.config.js b/packages/kbn-sharedux-services/jest.config.js new file mode 100755 index 0000000000000..958ae147ec2b8 --- /dev/null +++ b/packages/kbn-sharedux-services/jest.config.js @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +module.exports = { + preset: '@kbn/test', + rootDir: '../..', + roots: ['/packages/kbn-sharedux-services'], +}; diff --git a/packages/kbn-sharedux-services/package.json b/packages/kbn-sharedux-services/package.json new file mode 100755 index 0000000000000..3f199b0e07c12 --- /dev/null +++ b/packages/kbn-sharedux-services/package.json @@ -0,0 +1,8 @@ +{ + "name": "@kbn/sharedux-services", + "private": true, + "version": "1.0.0", + "main": "./target_node/index.js", + "browser": "./target_web/index.js", + "license": "SSPL-1.0 OR Elastic License 2.0" +} diff --git a/packages/kbn-sharedux-services/src/index.ts b/packages/kbn-sharedux-services/src/index.ts new file mode 100755 index 0000000000000..3a1ac38e2d508 --- /dev/null +++ b/packages/kbn-sharedux-services/src/index.ts @@ -0,0 +1,31 @@ +/* + * 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 type { SharedUXServicesContext } from './types'; + +export { + SharedUXServicesProvider, + useDocLinks, + useEditors, + usePermissions, + usePlatformService, + useSharedUXServices, +} from './services'; + +export type { ServiceFactory } from './services/types'; + +export type { + SharedUXServices, + SharedUXDocLinksService, + SharedUXEditorsService, + SharedUXPlatformService, + SharedUXUserPermissionsService, +} from './services'; + +export { mockServiceFactories } from './services/mocks'; +export { stubServiceFactories } from './services/stub'; diff --git a/packages/kbn-sharedux-services/src/services/doc_links.ts b/packages/kbn-sharedux-services/src/services/doc_links.ts new file mode 100644 index 0000000000000..68fba8d9ee760 --- /dev/null +++ b/packages/kbn-sharedux-services/src/services/doc_links.ts @@ -0,0 +1,11 @@ +/* + * 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 interface SharedUXDocLinksService { + dataViewsDocsLink: string; +} diff --git a/packages/kbn-sharedux-services/src/services/editors.ts b/packages/kbn-sharedux-services/src/services/editors.ts new file mode 100644 index 0000000000000..b4a472d7699aa --- /dev/null +++ b/packages/kbn-sharedux-services/src/services/editors.ts @@ -0,0 +1,15 @@ +/* + * 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 interface DataViewEditorOptions { + onSave: (dataView: TDataView) => void; +} + +export interface SharedUXEditorsService { + openDataViewEditor: (options: DataViewEditorOptions) => () => void; +} diff --git a/src/plugins/shared_ux/public/services/index.tsx b/packages/kbn-sharedux-services/src/services/index.tsx similarity index 65% rename from src/plugins/shared_ux/public/services/index.tsx rename to packages/kbn-sharedux-services/src/services/index.tsx index bdca90c725858..7861e4dd3eb4e 100644 --- a/src/plugins/shared_ux/public/services/index.tsx +++ b/packages/kbn-sharedux-services/src/services/index.tsx @@ -8,10 +8,15 @@ import React, { FC, createContext, useContext } from 'react'; import { SharedUXPlatformService } from './platform'; -import { servicesFactory } from './stub'; import { SharedUXUserPermissionsService } from './permissions'; import { SharedUXEditorsService } from './editors'; import { SharedUXDocLinksService } from './doc_links'; +import { stubServicesFactory } from './stub'; + +export type { SharedUXPlatformService } from './platform'; +export type { SharedUXUserPermissionsService } from './permissions'; +export type { SharedUXEditorsService } from './editors'; +export type { SharedUXDocLinksService } from './doc_links'; /** * A collection of services utilized by SharedUX. This serves as a thin @@ -29,7 +34,7 @@ export interface SharedUXServices { } // The React Context used to provide the services to the SharedUX components. -const ServicesContext = createContext(servicesFactory()); +const ServicesContext = createContext(stubServicesFactory()); /** * The `React.Context` Provider component for the `SharedUXServices` context. Any @@ -39,24 +44,33 @@ const ServicesContext = createContext(servicesFactory()); * Within a plugin, you can use the `ServicesContext` provided by the SharedUX plugin start * lifeycle method. */ -export const ServicesProvider: FC = ({ children, ...services }) => ( +export const SharedUXServicesProvider: FC = ({ children, ...services }) => ( {children} ); /** * React hook for accessing the pre-wired `SharedUXServices`. */ -export function useServices() { +export function useSharedUXServices() { return useContext(ServicesContext); } /** * React hook for accessing the pre-wired `SharedUXPlatformService`. */ -export const usePlatformService = () => useServices().platform; +export const usePlatformService = () => useSharedUXServices().platform; -export const usePermissions = () => useServices().permissions; +/** + * React hook for accessing the pre-wired `SharedUXPermissionsService`. + */ +export const usePermissions = () => useSharedUXServices().permissions; -export const useEditors = () => useServices().editors; +/** + * React hook for accessing the pre-wired `SharedUXEditorsService`. + */ +export const useEditors = () => useSharedUXServices().editors; -export const useDocLinks = () => useServices().docLinks; +/** + * React hook for accessing the pre-wired `SharedUXDocLinksService`. + */ +export const useDocLinks = () => useSharedUXServices().docLinks; diff --git a/src/plugins/shared_ux/public/services/mocks/doc_links.mock.ts b/packages/kbn-sharedux-services/src/services/mocks/doc_links.mock.ts similarity index 82% rename from src/plugins/shared_ux/public/services/mocks/doc_links.mock.ts rename to packages/kbn-sharedux-services/src/services/mocks/doc_links.mock.ts index 28cfa14c50d28..f7c081fba9b2e 100644 --- a/src/plugins/shared_ux/public/services/mocks/doc_links.mock.ts +++ b/packages/kbn-sharedux-services/src/services/mocks/doc_links.mock.ts @@ -6,10 +6,10 @@ * Side Public License, v 1. */ -import { PluginServiceFactory } from '../types'; +import { ServiceFactory } from '../types'; import { SharedUXDocLinksService } from '../doc_links'; -export type MockDockLinksServiceFactory = PluginServiceFactory; +export type MockDockLinksServiceFactory = ServiceFactory; /** * A factory function for creating a Jest-based implementation of `SharedUXDocLinksService`. diff --git a/src/plugins/shared_ux/public/services/mocks/editors.mock.ts b/packages/kbn-sharedux-services/src/services/mocks/editors.mock.ts similarity index 82% rename from src/plugins/shared_ux/public/services/mocks/editors.mock.ts rename to packages/kbn-sharedux-services/src/services/mocks/editors.mock.ts index 28a89d5326d62..cd411f0d2e977 100644 --- a/src/plugins/shared_ux/public/services/mocks/editors.mock.ts +++ b/packages/kbn-sharedux-services/src/services/mocks/editors.mock.ts @@ -6,10 +6,10 @@ * Side Public License, v 1. */ -import { PluginServiceFactory } from '../types'; +import { ServiceFactory } from '../types'; import { SharedUXEditorsService } from '../editors'; -export type MockEditorsServiceFactory = PluginServiceFactory; +export type MockEditorsServiceFactory = ServiceFactory; /** * A factory function for creating a Jest-based implementation of `SharedUXEditorsService`. diff --git a/src/plugins/shared_ux/public/services/mocks/index.ts b/packages/kbn-sharedux-services/src/services/mocks/index.ts similarity index 57% rename from src/plugins/shared_ux/public/services/mocks/index.ts rename to packages/kbn-sharedux-services/src/services/mocks/index.ts index 9fce633c52539..ec369338edba0 100644 --- a/src/plugins/shared_ux/public/services/mocks/index.ts +++ b/packages/kbn-sharedux-services/src/services/mocks/index.ts @@ -5,23 +5,42 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ -import { docLinksServiceFactory } from './doc_links.mock'; - -export type { MockPlatformServiceFactory } from './platform.mock'; -export { platformServiceFactory } from './platform.mock'; import type { SharedUXServices } from '../.'; -import { PluginServiceFactory } from '../types'; +import { ServiceFactory } from '../types'; + +import { docLinksServiceFactory } from './doc_links.mock'; +import { editorsServiceFactory } from './editors.mock'; import { platformServiceFactory } from './platform.mock'; import { userPermissionsServiceFactory } from './permissions.mock'; -import { editorsServiceFactory } from './editors.mock'; + +export type { MockDockLinksServiceFactory } from './doc_links.mock'; +export type { MockEditorsServiceFactory } from './editors.mock'; +export type { MockPlatformServiceFactory } from './platform.mock'; +export type { MockUserPermissionsServiceFactory } from './permissions.mock'; + +export { docLinksServiceFactory } from './doc_links.mock'; +export { editorsServiceFactory } from './editors.mock'; +export { userPermissionsServiceFactory } from './permissions.mock'; +export { platformServiceFactory } from './platform.mock'; /** * A factory function for creating a Jest-based implementation of `SharedUXServices`. */ -export const servicesFactory: PluginServiceFactory = () => ({ +export const mockServicesFactory: ServiceFactory = () => ({ platform: platformServiceFactory(), permissions: userPermissionsServiceFactory(), editors: editorsServiceFactory(), docLinks: docLinksServiceFactory(), }); + +/** + * A collection of mock Service Factories. + */ +export const mockServiceFactories = { + servicesFactory: mockServicesFactory, + docLinksServiceFactory, + editorsServiceFactory, + platformServiceFactory, + userPermissionsServiceFactory, +}; diff --git a/src/plugins/shared_ux/public/services/mocks/permissions.mock.ts b/packages/kbn-sharedux-services/src/services/mocks/permissions.mock.ts similarity index 81% rename from src/plugins/shared_ux/public/services/mocks/permissions.mock.ts rename to packages/kbn-sharedux-services/src/services/mocks/permissions.mock.ts index ff65d2393248a..58adf3c27d6e2 100644 --- a/src/plugins/shared_ux/public/services/mocks/permissions.mock.ts +++ b/packages/kbn-sharedux-services/src/services/mocks/permissions.mock.ts @@ -6,11 +6,10 @@ * Side Public License, v 1. */ -import { PluginServiceFactory } from '../types'; +import { ServiceFactory } from '../types'; import { SharedUXUserPermissionsService } from '../permissions'; -export type MockUserPermissionsServiceFactory = - PluginServiceFactory; +export type MockUserPermissionsServiceFactory = ServiceFactory; /** * A factory function for creating a Jest-based implementation of `SharedUXUserPermissionsService`. diff --git a/src/plugins/shared_ux/public/services/mocks/platform.mock.ts b/packages/kbn-sharedux-services/src/services/mocks/platform.mock.ts similarity index 83% rename from src/plugins/shared_ux/public/services/mocks/platform.mock.ts rename to packages/kbn-sharedux-services/src/services/mocks/platform.mock.ts index c36d63cfcacbe..0c937ff686ff3 100644 --- a/src/plugins/shared_ux/public/services/mocks/platform.mock.ts +++ b/packages/kbn-sharedux-services/src/services/mocks/platform.mock.ts @@ -6,13 +6,13 @@ * Side Public License, v 1. */ -import type { PluginServiceFactory } from '../types'; +import type { ServiceFactory } from '../types'; import type { SharedUXPlatformService } from '../platform'; /** * A factory function for creating a Jest-based implementation of `SharedUXPlatformService`. */ -export type MockPlatformServiceFactory = PluginServiceFactory; +export type MockPlatformServiceFactory = ServiceFactory; /** * A factory function for creating a Jest-based implementation of `SharedUXPlatformService`. diff --git a/packages/kbn-sharedux-services/src/services/permissions.ts b/packages/kbn-sharedux-services/src/services/permissions.ts new file mode 100644 index 0000000000000..009f497e35706 --- /dev/null +++ b/packages/kbn-sharedux-services/src/services/permissions.ts @@ -0,0 +1,11 @@ +/* + * 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 interface SharedUXUserPermissionsService { + canCreateNewDataView: boolean; +} diff --git a/packages/kbn-sharedux-services/src/services/platform.ts b/packages/kbn-sharedux-services/src/services/platform.ts new file mode 100644 index 0000000000000..52f88a1133c8b --- /dev/null +++ b/packages/kbn-sharedux-services/src/services/platform.ts @@ -0,0 +1,23 @@ +/* + * 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. + */ + +/** + * A services providing methods to interact with the Platform in which this plugin is + * running, (almost always Kibana). + * + * Rather than provide the entire `CoreStart` contract to components, we provide simplified + * abstractions around a use case specific to Shared UX. This way, we know exactly how the + * `CoreStart` and other plugins are used, like specifically which methods. This makes + * mocking and refactoring easier when upstream dependencies change. + */ +export interface SharedUXPlatformService { + /** + * Sets the fullscreen state of the chrome. + */ + setIsFullscreen: (isFullscreen: boolean) => void; +} diff --git a/src/plugins/shared_ux/public/services/stub/doc_links.ts b/packages/kbn-sharedux-services/src/services/stub/doc_links.ts similarity index 82% rename from src/plugins/shared_ux/public/services/stub/doc_links.ts rename to packages/kbn-sharedux-services/src/services/stub/doc_links.ts index 424a24c578539..d6bfe3a3e03b8 100644 --- a/src/plugins/shared_ux/public/services/stub/doc_links.ts +++ b/packages/kbn-sharedux-services/src/services/stub/doc_links.ts @@ -6,10 +6,10 @@ * Side Public License, v 1. */ -import { PluginServiceFactory } from '../types'; +import { ServiceFactory } from '../types'; import { SharedUXDocLinksService } from '../doc_links'; -export type DockLinksServiceFactory = PluginServiceFactory; +export type DockLinksServiceFactory = ServiceFactory; /** * A factory function for creating a Jest-based implementation of `SharedUXDocLinksService`. diff --git a/src/plugins/shared_ux/public/services/stub/editors.ts b/packages/kbn-sharedux-services/src/services/stub/editors.ts similarity index 84% rename from src/plugins/shared_ux/public/services/stub/editors.ts rename to packages/kbn-sharedux-services/src/services/stub/editors.ts index 03fea5e6c98b5..9fc828a813d68 100644 --- a/src/plugins/shared_ux/public/services/stub/editors.ts +++ b/packages/kbn-sharedux-services/src/services/stub/editors.ts @@ -6,13 +6,13 @@ * Side Public License, v 1. */ -import { PluginServiceFactory } from '../types'; +import { ServiceFactory } from '../types'; import { SharedUXEditorsService } from '../editors'; /** * A factory function for creating a simple stubbed implementation of `SharedUXEditorsService`. */ -export type EditorsServiceFactory = PluginServiceFactory; +export type EditorsServiceFactory = ServiceFactory; /** * A factory function for creating a simple stubbed implementation of `SharedUXEditorsService`. diff --git a/src/plugins/shared_ux/public/services/stub/index.ts b/packages/kbn-sharedux-services/src/services/stub/index.ts similarity index 70% rename from src/plugins/shared_ux/public/services/stub/index.ts rename to packages/kbn-sharedux-services/src/services/stub/index.ts index 9e4fa8f03133a..70a71bce74409 100644 --- a/src/plugins/shared_ux/public/services/stub/index.ts +++ b/packages/kbn-sharedux-services/src/services/stub/index.ts @@ -7,7 +7,7 @@ */ import type { SharedUXServices } from '../.'; -import { PluginServiceFactory } from '../types'; +import { ServiceFactory } from '../types'; import { platformServiceFactory } from './platform'; import { userPermissionsServiceFactory } from './permissions'; import { editorsServiceFactory } from './editors'; @@ -16,9 +16,20 @@ import { docLinksServiceFactory } from './doc_links'; /** * A factory function for creating a simple stubbed implemetation of `SharedUXServices`. */ -export const servicesFactory: PluginServiceFactory = () => ({ +export const stubServicesFactory: ServiceFactory = () => ({ platform: platformServiceFactory(), permissions: userPermissionsServiceFactory(), editors: editorsServiceFactory(), docLinks: docLinksServiceFactory(), }); + +/** + * A collection of stubbed Service Factories. + */ +export const stubServiceFactories = { + servicesFactory: stubServicesFactory, + docLinksServiceFactory, + editorsServiceFactory, + platformServiceFactory, + userPermissionsServiceFactory, +}; diff --git a/src/plugins/shared_ux/public/services/stub/permissions.ts b/packages/kbn-sharedux-services/src/services/stub/permissions.ts similarity index 83% rename from src/plugins/shared_ux/public/services/stub/permissions.ts rename to packages/kbn-sharedux-services/src/services/stub/permissions.ts index c51abf41e2842..90dab479f4dd2 100644 --- a/src/plugins/shared_ux/public/services/stub/permissions.ts +++ b/packages/kbn-sharedux-services/src/services/stub/permissions.ts @@ -6,13 +6,13 @@ * Side Public License, v 1. */ -import { PluginServiceFactory } from '../types'; +import { ServiceFactory } from '../types'; import { SharedUXUserPermissionsService } from '../permissions'; /** * A factory function for creating a simple stubbed implementation of `SharedUXUserPermissionsService`. */ -export type UserPermissionsServiceFactory = PluginServiceFactory; +export type UserPermissionsServiceFactory = ServiceFactory; /** * A factory function for creating a simple stubbed implementation of `SharedUXUserPermissionsService`. diff --git a/src/plugins/shared_ux/public/services/stub/platform.ts b/packages/kbn-sharedux-services/src/services/stub/platform.ts similarity index 84% rename from src/plugins/shared_ux/public/services/stub/platform.ts rename to packages/kbn-sharedux-services/src/services/stub/platform.ts index 90fa8edb3e06e..a1066670ff15f 100644 --- a/src/plugins/shared_ux/public/services/stub/platform.ts +++ b/packages/kbn-sharedux-services/src/services/stub/platform.ts @@ -6,13 +6,13 @@ * Side Public License, v 1. */ -import { PluginServiceFactory } from '../types'; +import { ServiceFactory } from '../types'; import { SharedUXPlatformService } from '../platform'; /** * A factory function for creating a simple stubbed implementation of `SharedUXPlatformService`. */ -export type PlatformServiceFactory = PluginServiceFactory; +export type PlatformServiceFactory = ServiceFactory; /** * A factory function for creating a simple stubbed implementation of `SharedUXPlatformService`. diff --git a/packages/kbn-sharedux-services/src/services/types.ts b/packages/kbn-sharedux-services/src/services/types.ts new file mode 100644 index 0000000000000..1a927a6b6ef0f --- /dev/null +++ b/packages/kbn-sharedux-services/src/services/types.ts @@ -0,0 +1,16 @@ +/* + * 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. + */ + +/** + * A factory function for creating one or more services. + * + * The `S` generic determines the shape of the API being produced. + * The `Parameters` generic determines what parameters are expected to + * create the service. + */ +export type ServiceFactory = (params: Parameters) => S; diff --git a/src/plugins/shared_ux/.storybook/main.ts b/packages/kbn-sharedux-services/src/types.ts old mode 100644 new mode 100755 similarity index 81% rename from src/plugins/shared_ux/.storybook/main.ts rename to packages/kbn-sharedux-services/src/types.ts index 1261fe5a06f69..fcffd35350091 --- a/src/plugins/shared_ux/.storybook/main.ts +++ b/packages/kbn-sharedux-services/src/types.ts @@ -6,6 +6,6 @@ * Side Public License, v 1. */ -import { defaultConfig } from '@kbn/storybook'; +import { FC } from 'react'; -module.exports = defaultConfig; +export type SharedUXServicesContext = FC<{}>; diff --git a/packages/kbn-sharedux-services/tsconfig.json b/packages/kbn-sharedux-services/tsconfig.json new file mode 100755 index 0000000000000..a8cfc2cceb08b --- /dev/null +++ b/packages/kbn-sharedux-services/tsconfig.json @@ -0,0 +1,17 @@ +{ + "extends": "../../tsconfig.bazel.json", + "compilerOptions": { + "declaration": true, + "emitDeclarationOnly": true, + "outDir": "target_types", + "rootDir": "src", + "stripInternal": false, + "types": [ + "jest", + "node" + ] + }, + "include": [ + "src/**/*" + ] +} diff --git a/packages/kbn-sharedux-storybook/.storybook/main.ts b/packages/kbn-sharedux-storybook/.storybook/main.ts new file mode 100644 index 0000000000000..9ac84dffb6cbc --- /dev/null +++ b/packages/kbn-sharedux-storybook/.storybook/main.ts @@ -0,0 +1,19 @@ +/* + * 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 { defaultConfig } from '@kbn/storybook'; + +module.exports = { + ...defaultConfig, + stories: [ + '../../kbn-sharedux*/**/*.stories.tsx', + '../../kbn-sharedux*/**/*.stories.mdx', + '../../../src/plugins/shared_ux/**/*.stories.tsx', + '../../../src/plugins/shared_ux/**/*.stories.mdx', + ], +}; diff --git a/src/plugins/shared_ux/.storybook/manager.ts b/packages/kbn-sharedux-storybook/.storybook/manager.ts similarity index 100% rename from src/plugins/shared_ux/.storybook/manager.ts rename to packages/kbn-sharedux-storybook/.storybook/manager.ts diff --git a/src/plugins/shared_ux/.storybook/preview.ts b/packages/kbn-sharedux-storybook/.storybook/preview.ts similarity index 87% rename from src/plugins/shared_ux/.storybook/preview.ts rename to packages/kbn-sharedux-storybook/.storybook/preview.ts index e4be2592482f3..62667b3dcef85 100644 --- a/src/plugins/shared_ux/.storybook/preview.ts +++ b/packages/kbn-sharedux-storybook/.storybook/preview.ts @@ -7,6 +7,6 @@ */ import { addDecorator } from '@storybook/react'; -import { servicesDecorator } from './decorators'; +import { servicesDecorator } from '@kbn/sharedux-storybook'; addDecorator(servicesDecorator); diff --git a/packages/kbn-sharedux-storybook/BUILD.bazel b/packages/kbn-sharedux-storybook/BUILD.bazel new file mode 100644 index 0000000000000..1d8193966c8df --- /dev/null +++ b/packages/kbn-sharedux-storybook/BUILD.bazel @@ -0,0 +1,126 @@ +load("@npm//@bazel/typescript:index.bzl", "ts_config") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") + +PKG_DIRNAME = "kbn-sharedux-storybook" +PKG_REQUIRE_NAME = "@kbn/sharedux-storybook" + +SOURCE_FILES = glob( + [ + "src/**/*.ts", + "src/**/*.tsx", + ], + exclude = [ + "**/*.test.*", + ], +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", +] + +# In this array place runtime dependencies, including other packages and NPM packages +# which must be available for this code to run. +# +# To reference other packages use: +# "//repo/relative/path/to/package" +# eg. "//packages/kbn-utils" +# +# To reference a NPM package use: +# "@npm//name-of-package" +# eg. "@npm//lodash" +RUNTIME_DEPS = [ + "//packages/kbn-sharedux-services", + "@npm//@storybook/react", +] + +# In this array place dependencies necessary to build the types, which will include the +# :npm_module_types target of other packages and packages from NPM, including @types/* +# packages. +# +# To reference the types for another package use: +# "//repo/relative/path/to/package:npm_module_types" +# eg. "//packages/kbn-utils:npm_module_types" +# +# References to NPM packages work the same as RUNTIME_DEPS +TYPES_DEPS = [ + "@npm//@types/node", + "@npm//@types/jest", + "@npm//@storybook/react", + "//packages/kbn-sharedux-services:npm_module_types", +] + +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) + +jsts_transpiler( + name = "target_web", + srcs = SRCS, + build_pkg_name = package_name(), + web = True, +) + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:tsconfig.base.json", + "//:tsconfig.bazel.json", + ], +) + +ts_project( + name = "tsc_types", + args = ['--pretty'], + srcs = SRCS, + deps = TYPES_DEPS, + declaration = True, + emit_declaration_only = True, + out_dir = "target_types", + root_dir = "src", + tsconfig = ":tsconfig", +) + +js_library( + name = PKG_DIRNAME, + srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node", ":target_web"], + package_name = PKG_REQUIRE_NAME, + visibility = ["//visibility:public"], +) + +pkg_npm( + name = "npm_module", + deps = [":" + PKG_DIRNAME], +) + +filegroup( + name = "build", + srcs = [":npm_module"], + visibility = ["//visibility:public"], +) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [":npm_module_types"], + visibility = ["//visibility:public"], +) diff --git a/packages/kbn-sharedux-storybook/README.md b/packages/kbn-sharedux-storybook/README.md new file mode 100644 index 0000000000000..56c2831c9948d --- /dev/null +++ b/packages/kbn-sharedux-storybook/README.md @@ -0,0 +1,3 @@ +# @kbn/sharedux-storybook + +> TODO \ No newline at end of file diff --git a/packages/kbn-sharedux-storybook/jest.config.js b/packages/kbn-sharedux-storybook/jest.config.js new file mode 100644 index 0000000000000..33906ec0d74ef --- /dev/null +++ b/packages/kbn-sharedux-storybook/jest.config.js @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +module.exports = { + preset: '@kbn/test', + rootDir: '../..', + roots: ['/packages/kbn-sharedux-storybook'], +}; diff --git a/packages/kbn-sharedux-storybook/package.json b/packages/kbn-sharedux-storybook/package.json new file mode 100644 index 0000000000000..372bc054c2e1a --- /dev/null +++ b/packages/kbn-sharedux-storybook/package.json @@ -0,0 +1,8 @@ +{ + "name": "@kbn/sharedux-storybook", + "private": true, + "version": "1.0.0", + "main": "./target_node/index.js", + "browser": "./target_web/index.js", + "license": "SSPL-1.0 OR Elastic License 2.0" +} diff --git a/src/plugins/shared_ux/.storybook/decorators.tsx b/packages/kbn-sharedux-storybook/src/decorators.tsx similarity index 75% rename from src/plugins/shared_ux/.storybook/decorators.tsx rename to packages/kbn-sharedux-storybook/src/decorators.tsx index c17af2cda0406..07372ea3242be 100644 --- a/src/plugins/shared_ux/.storybook/decorators.tsx +++ b/packages/kbn-sharedux-storybook/src/decorators.tsx @@ -8,13 +8,14 @@ import React from 'react'; import { DecoratorFn } from '@storybook/react'; -import { ServicesProvider } from '../public/services'; -import { servicesFactory } from '../public/services/storybook'; + +import { SharedUXServicesProvider } from '@kbn/sharedux-services'; +import { servicesFactory } from './services'; /** * A Storybook decorator that provides the Shared UX `ServicesProvider` with Storybook-specific * implementations to stories. */ export const servicesDecorator: DecoratorFn = (storyFn) => ( - {storyFn()} + {storyFn()} ); diff --git a/packages/kbn-sharedux-storybook/src/index.ts b/packages/kbn-sharedux-storybook/src/index.ts new file mode 100755 index 0000000000000..7e29a88499c43 --- /dev/null +++ b/packages/kbn-sharedux-storybook/src/index.ts @@ -0,0 +1,17 @@ +/* + * 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 { servicesDecorator } from './decorators'; + +export { + servicesFactory, + docLinksServiceFactory, + editorsServiceFactory, + platformServiceFactory, + userPermissionsServiceFactory, +} from './services'; diff --git a/packages/kbn-sharedux-storybook/src/mdx.d.ts b/packages/kbn-sharedux-storybook/src/mdx.d.ts new file mode 100644 index 0000000000000..b4633af9cb87d --- /dev/null +++ b/packages/kbn-sharedux-storybook/src/mdx.d.ts @@ -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. + */ + +// Importing MDX files requires a type definition not currently included in the stack. +declare module '*.mdx' { + let MDXComponent: (props: any) => JSX.Element; + // eslint-disable-next-line import/no-default-export + export default MDXComponent; +} diff --git a/src/plugins/shared_ux/public/services/storybook/doc_links.ts b/packages/kbn-sharedux-storybook/src/services/doc_links.ts similarity index 66% rename from src/plugins/shared_ux/public/services/storybook/doc_links.ts rename to packages/kbn-sharedux-storybook/src/services/doc_links.ts index 548d504336108..aab2b61b5555f 100644 --- a/src/plugins/shared_ux/public/services/storybook/doc_links.ts +++ b/packages/kbn-sharedux-storybook/src/services/doc_links.ts @@ -6,14 +6,13 @@ * Side Public License, v 1. */ -import { PluginServiceFactory } from '../types'; -import { SharedUXDocLinksService } from '../doc_links'; +import { ServiceFactory, SharedUXDocLinksService } from '@kbn/sharedux-services'; -export type SharedUXDockLinksServiceFactory = PluginServiceFactory; +export type SharedUXDocLinksServiceFactory = ServiceFactory; /** * A factory function for creating a Jest-based implementation of `SharedUXDocLinksService`. */ -export const docLinksServiceFactory: SharedUXDockLinksServiceFactory = () => ({ +export const docLinksServiceFactory: SharedUXDocLinksServiceFactory = () => ({ dataViewsDocsLink: 'https://www.elastic.co/guide/en/kibana/master/data-views.html', }); diff --git a/src/plugins/shared_ux/public/services/storybook/editors.ts b/packages/kbn-sharedux-storybook/src/services/editors.ts similarity index 67% rename from src/plugins/shared_ux/public/services/storybook/editors.ts rename to packages/kbn-sharedux-storybook/src/services/editors.ts index 248699d5beb95..ad9d34e2cac11 100644 --- a/src/plugins/shared_ux/public/services/storybook/editors.ts +++ b/packages/kbn-sharedux-storybook/src/services/editors.ts @@ -7,16 +7,13 @@ */ import { action } from '@storybook/addon-actions'; -import { PluginServiceFactory } from '../types'; -import { SharedUxDataViewEditorProps, SharedUXEditorsService } from '../editors'; +import { ServiceFactory, SharedUXEditorsService } from '@kbn/sharedux-services'; -export type SharedUXEditorsServiceFactory = PluginServiceFactory; +export type SharedUXEditorsServiceFactory = ServiceFactory; /** * A factory function for creating a storybook implementation of `SharedUXEditorsService`. */ export const editorsServiceFactory: SharedUXEditorsServiceFactory = () => ({ - openDataViewEditor: action('openEditor') as SharedUXEditorsService['openDataViewEditor'] as ( - options: SharedUxDataViewEditorProps - ) => () => void, + openDataViewEditor: action('openEditor') as SharedUXEditorsService['openDataViewEditor'], }); diff --git a/src/plugins/shared_ux/public/services/storybook/index.ts b/packages/kbn-sharedux-storybook/src/services/index.ts similarity index 68% rename from src/plugins/shared_ux/public/services/storybook/index.ts rename to packages/kbn-sharedux-storybook/src/services/index.ts index c915b1a463365..ae81b19665de9 100644 --- a/src/plugins/shared_ux/public/services/storybook/index.ts +++ b/packages/kbn-sharedux-storybook/src/services/index.ts @@ -6,17 +6,22 @@ * Side Public License, v 1. */ -import type { SharedUXServices } from '../.'; -import { PluginServiceFactory } from '../types'; +import { ServiceFactory, SharedUXServices } from '@kbn/sharedux-services'; + import { platformServiceFactory } from './platform'; import { editorsServiceFactory } from './editors'; import { userPermissionsServiceFactory } from './permissions'; import { docLinksServiceFactory } from './doc_links'; +export { platformServiceFactory } from './platform'; +export { editorsServiceFactory } from './editors'; +export { userPermissionsServiceFactory } from './permissions'; +export { docLinksServiceFactory } from './doc_links'; + /** * A factory function for creating a Storybook-based implementation of `SharedUXServices`. */ -export const servicesFactory: PluginServiceFactory = (params) => ({ +export const servicesFactory: ServiceFactory = (params) => ({ platform: platformServiceFactory(params), permissions: userPermissionsServiceFactory(), editors: editorsServiceFactory(), diff --git a/src/plugins/shared_ux/public/services/storybook/permissions.ts b/packages/kbn-sharedux-storybook/src/services/permissions.ts similarity index 72% rename from src/plugins/shared_ux/public/services/storybook/permissions.ts rename to packages/kbn-sharedux-storybook/src/services/permissions.ts index c7110fccf7eea..8a49dbfaaf3a5 100644 --- a/src/plugins/shared_ux/public/services/storybook/permissions.ts +++ b/packages/kbn-sharedux-storybook/src/services/permissions.ts @@ -6,11 +6,9 @@ * Side Public License, v 1. */ -import { PluginServiceFactory } from '../types'; -import { SharedUXUserPermissionsService } from '../permissions'; +import { ServiceFactory, SharedUXUserPermissionsService } from '@kbn/sharedux-services'; -export type SharedUXUserPermissionsServiceFactory = - PluginServiceFactory; +export type SharedUXUserPermissionsServiceFactory = ServiceFactory; /** * A factory function for creating a storybook implementation of `SharedUXUserPermissionsService`. diff --git a/src/plugins/shared_ux/public/services/storybook/platform.ts b/packages/kbn-sharedux-storybook/src/services/platform.ts similarity index 79% rename from src/plugins/shared_ux/public/services/storybook/platform.ts rename to packages/kbn-sharedux-storybook/src/services/platform.ts index 8d7645ee441ca..af977d46b818e 100644 --- a/src/plugins/shared_ux/public/services/storybook/platform.ts +++ b/packages/kbn-sharedux-storybook/src/services/platform.ts @@ -7,14 +7,12 @@ */ import { action } from '@storybook/addon-actions'; - -import { PluginServiceFactory } from '../types'; -import { SharedUXPlatformService } from '../platform'; +import { ServiceFactory, SharedUXPlatformService } from '@kbn/sharedux-services'; /** * A factory function for creating a Storybook-based implementation of `SharedUXPlatformService`. */ -export type PlatformServiceFactory = PluginServiceFactory; +export type PlatformServiceFactory = ServiceFactory; /** * A factory function for creating a Storybook-based implementation of `SharedUXPlatformService`. diff --git a/packages/kbn-sharedux-storybook/tsconfig.json b/packages/kbn-sharedux-storybook/tsconfig.json new file mode 100644 index 0000000000000..a8cfc2cceb08b --- /dev/null +++ b/packages/kbn-sharedux-storybook/tsconfig.json @@ -0,0 +1,17 @@ +{ + "extends": "../../tsconfig.bazel.json", + "compilerOptions": { + "declaration": true, + "emitDeclarationOnly": true, + "outDir": "target_types", + "rootDir": "src", + "stripInternal": false, + "types": [ + "jest", + "node" + ] + }, + "include": [ + "src/**/*" + ] +} diff --git a/packages/kbn-sharedux-utility/BUILD.bazel b/packages/kbn-sharedux-utility/BUILD.bazel new file mode 100644 index 0000000000000..39ddb60397eab --- /dev/null +++ b/packages/kbn-sharedux-utility/BUILD.bazel @@ -0,0 +1,128 @@ +load("@npm//@bazel/typescript:index.bzl", "ts_config") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") +load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") + +PKG_DIRNAME = "kbn-sharedux-utility" +PKG_REQUIRE_NAME = "@kbn/sharedux-utility" + +SOURCE_FILES = glob( + [ + "src/**/*.ts", + "src/**/*.tsx", + ], + exclude = [ + "**/*.test.*", + ], +) + +SRCS = SOURCE_FILES + +filegroup( + name = "srcs", + srcs = SRCS, +) + +NPM_MODULE_EXTRA_FILES = [ + "package.json", +] + +# In this array place runtime dependencies, including other packages and NPM packages +# which must be available for this code to run. +# +# To reference other packages use: +# "//repo/relative/path/to/package" +# eg. "//packages/kbn-utils" +# +# To reference a NPM package use: +# "@npm//name-of-package" +# eg. "@npm//lodash" +RUNTIME_DEPS = [ + "@npm//react", + "@npm//@elastic/eui", + "@npm//@emotion/react", +] + +# In this array place dependencies necessary to build the types, which will include the +# :npm_module_types target of other packages and packages from NPM, including @types/* +# packages. +# +# To reference the types for another package use: +# "//repo/relative/path/to/package:npm_module_types" +# eg. "//packages/kbn-utils:npm_module_types" +# +# References to NPM packages work the same as RUNTIME_DEPS +TYPES_DEPS = [ + "@npm//@types/node", + "@npm//@types/jest", + "@npm//@types/react", + "@npm//@elastic/eui", + "@npm//@emotion/react" +] + +jsts_transpiler( + name = "target_node", + srcs = SRCS, + build_pkg_name = package_name(), +) + +jsts_transpiler( + name = "target_web", + srcs = SRCS, + build_pkg_name = package_name(), + web = True, +) + +ts_config( + name = "tsconfig", + src = "tsconfig.json", + deps = [ + "//:tsconfig.base.json", + "//:tsconfig.bazel.json", + ], +) + +ts_project( + name = "tsc_types", + args = ['--pretty'], + srcs = SRCS, + deps = TYPES_DEPS, + declaration = True, + emit_declaration_only = True, + out_dir = "target_types", + root_dir = "src", + tsconfig = ":tsconfig", +) + +js_library( + name = PKG_DIRNAME, + srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node", ":target_web"], + package_name = PKG_REQUIRE_NAME, + visibility = ["//visibility:public"], +) + +pkg_npm( + name = "npm_module", + deps = [":" + PKG_DIRNAME], +) + +filegroup( + name = "build", + srcs = [":npm_module"], + visibility = ["//visibility:public"], +) + +pkg_npm_types( + name = "npm_module_types", + srcs = SRCS, + deps = [":tsc_types"], + package_name = PKG_REQUIRE_NAME, + tsconfig = ":tsconfig", + visibility = ["//visibility:public"], +) + +filegroup( + name = "build_types", + srcs = [":npm_module_types"], + visibility = ["//visibility:public"], +) diff --git a/packages/kbn-sharedux-utility/README.md b/packages/kbn-sharedux-utility/README.md new file mode 100644 index 0000000000000..ffff4d29abc52 --- /dev/null +++ b/packages/kbn-sharedux-utility/README.md @@ -0,0 +1,3 @@ +# @kbn/sharedux-utility + +Empty package generated by @kbn/generate diff --git a/packages/kbn-sharedux-utility/jest.config.js b/packages/kbn-sharedux-utility/jest.config.js new file mode 100644 index 0000000000000..9bfda8df3b8f3 --- /dev/null +++ b/packages/kbn-sharedux-utility/jest.config.js @@ -0,0 +1,13 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +module.exports = { + preset: '@kbn/test', + rootDir: '../..', + roots: ['/packages/kbn-sharedux-utility'], +}; diff --git a/packages/kbn-sharedux-utility/package.json b/packages/kbn-sharedux-utility/package.json new file mode 100644 index 0000000000000..5342afb96bd00 --- /dev/null +++ b/packages/kbn-sharedux-utility/package.json @@ -0,0 +1,8 @@ +{ + "name": "@kbn/sharedux-utility", + "private": true, + "version": "1.0.0", + "main": "./target_node/index.js", + "browser": "./target_web/index.js", + "license": "SSPL-1.0 OR Elastic License 2.0" +} diff --git a/src/plugins/shared_ux/public/components/utility/fallback.tsx b/packages/kbn-sharedux-utility/src/fallback.tsx similarity index 100% rename from src/plugins/shared_ux/public/components/utility/fallback.tsx rename to packages/kbn-sharedux-utility/src/fallback.tsx diff --git a/src/plugins/shared_ux/public/components/utility/index.ts b/packages/kbn-sharedux-utility/src/index.ts similarity index 100% rename from src/plugins/shared_ux/public/components/utility/index.ts rename to packages/kbn-sharedux-utility/src/index.ts diff --git a/src/plugins/shared_ux/public/components/utility/with_suspense.tsx b/packages/kbn-sharedux-utility/src/with_suspense.tsx similarity index 100% rename from src/plugins/shared_ux/public/components/utility/with_suspense.tsx rename to packages/kbn-sharedux-utility/src/with_suspense.tsx diff --git a/packages/kbn-sharedux-utility/tsconfig.json b/packages/kbn-sharedux-utility/tsconfig.json new file mode 100644 index 0000000000000..cca91264519cc --- /dev/null +++ b/packages/kbn-sharedux-utility/tsconfig.json @@ -0,0 +1,18 @@ +{ + "extends": "../../tsconfig.bazel.json", + "compilerOptions": { + "declaration": true, + "emitDeclarationOnly": true, + "outDir": "target_types", + "rootDir": "src", + "stripInternal": false, + "types": [ + "jest", + "node", + "@emotion/react/types/css-prop" + ] + }, + "include": [ + "src/**/*" + ] +} diff --git a/src/dev/storybook/aliases.ts b/src/dev/storybook/aliases.ts index db0791f41b0a7..74d63b2bf7c0b 100644 --- a/src/dev/storybook/aliases.ts +++ b/src/dev/storybook/aliases.ts @@ -35,6 +35,6 @@ export const storybookAliases = { observability: 'x-pack/plugins/observability/.storybook', presentation: 'src/plugins/presentation_util/storybook', security_solution: 'x-pack/plugins/security_solution/.storybook', - shared_ux: 'src/plugins/shared_ux/.storybook', + shared_ux: 'packages/kbn-sharedux-storybook/.storybook', ui_actions_enhanced: 'x-pack/plugins/ui_actions_enhanced/.storybook', }; diff --git a/src/plugins/shared_ux/kibana.json b/src/plugins/shared_ux/kibana.json index 308a252f70b54..44aeeb9cf80fc 100755 --- a/src/plugins/shared_ux/kibana.json +++ b/src/plugins/shared_ux/kibana.json @@ -9,6 +9,6 @@ "description": "A plugin providing components and services for shared user experiences in Kibana.", "server": true, "ui": true, - "requiredPlugins": ["dataViewEditor", "dataViews"], + "requiredPlugins": [], "optionalPlugins": [] } diff --git a/src/plugins/shared_ux/public/index.ts b/src/plugins/shared_ux/public/index.ts index a196a60db847b..f02cd6511f426 100755 --- a/src/plugins/shared_ux/public/index.ts +++ b/src/plugins/shared_ux/public/index.ts @@ -16,5 +16,9 @@ export function plugin() { } export type { SharedUXPluginSetup, SharedUXPluginStart } from './types'; -export { ExitFullScreenButton, LazyExitFullScreenButton } from './components'; -export { NoDataViewsPage, LazyNoDataViewsPage } from './components'; +export { + ExitFullScreenButton, + LazyExitFullScreenButton, + NoDataViewsPage, + LazyNoDataViewsPage, +} from '@kbn/sharedux-components'; diff --git a/src/plugins/shared_ux/public/plugin.tsx b/src/plugins/shared_ux/public/plugin.tsx index 1d2840566d4d9..b20f7161eb0f9 100755 --- a/src/plugins/shared_ux/public/plugin.tsx +++ b/src/plugins/shared_ux/public/plugin.tsx @@ -7,6 +7,9 @@ */ import React from 'react'; + +import { SharedUXServicesProvider } from '@kbn/sharedux-services'; + import { CoreSetup, CoreStart, Plugin } from '../../../core/public'; import { SharedUXPluginSetup, @@ -15,8 +18,7 @@ import { SharedUXPluginSetupDeps, } from './types'; -import { ServicesProvider } from './services'; -import { servicesFactory } from './services/kibana'; +import { servicesFactory } from './services'; /** * The Kibana plugin for Shared User Experience (Shared UX). @@ -34,7 +36,7 @@ export class SharedUXPlugin implements Plugin ( - {children} + {children} ), }; } diff --git a/src/plugins/shared_ux/public/services/doc_links.ts b/src/plugins/shared_ux/public/services/doc_links.ts index 3c6d23bd33ae4..be67ee4632377 100644 --- a/src/plugins/shared_ux/public/services/doc_links.ts +++ b/src/plugins/shared_ux/public/services/doc_links.ts @@ -5,6 +5,20 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ -export interface SharedUXDocLinksService { - dataViewsDocsLink: string; -} + +import { SharedUXDocLinksService } from '@kbn/sharedux-services'; + +import { KibanaPluginServiceFactory } from './types'; +import { SharedUXPluginStartDeps } from '../types'; + +export type DocLinksServiceFactory = KibanaPluginServiceFactory< + SharedUXDocLinksService, + SharedUXPluginStartDeps +>; + +/** + * A factory function for creating a Kibana-based implementation of `SharedUXEditorsService`. + */ +export const docLinksServiceFactory: DocLinksServiceFactory = ({ coreStart }) => ({ + dataViewsDocsLink: coreStart.docLinks.links.indexPatterns?.introduction, +}); diff --git a/src/plugins/shared_ux/public/services/editors.ts b/src/plugins/shared_ux/public/services/editors.ts index 176b22a6006e1..afac6e19092e6 100644 --- a/src/plugins/shared_ux/public/services/editors.ts +++ b/src/plugins/shared_ux/public/services/editors.ts @@ -5,11 +5,20 @@ * in compliance with, at your election, the Elastic License 2.0 or the Server * Side Public License, v 1. */ -import { DataView } from '../../../data_views/common'; - -export interface SharedUxDataViewEditorProps { - onSave: (dataView: DataView) => void; -} -export interface SharedUXEditorsService { - openDataViewEditor: (options: SharedUxDataViewEditorProps) => () => void; -} + +import { SharedUXEditorsService } from '@kbn/sharedux-services'; + +import { KibanaPluginServiceFactory } from './types'; +import { SharedUXPluginStartDeps } from '../types'; + +export type EditorsServiceFactory = KibanaPluginServiceFactory< + SharedUXEditorsService, + SharedUXPluginStartDeps +>; + +/** + * A factory function for creating a Kibana-based implementation of `SharedUXEditorsService`. + */ +export const editorsServiceFactory: EditorsServiceFactory = ({ startPlugins }) => ({ + openDataViewEditor: startPlugins.dataViewEditor.openEditor, +}); diff --git a/src/plugins/shared_ux/public/services/kibana/index.ts b/src/plugins/shared_ux/public/services/index.ts similarity index 84% rename from src/plugins/shared_ux/public/services/kibana/index.ts rename to src/plugins/shared_ux/public/services/index.ts index 506176cffbc45..47d01bbb9881c 100644 --- a/src/plugins/shared_ux/public/services/kibana/index.ts +++ b/src/plugins/shared_ux/public/services/index.ts @@ -6,9 +6,11 @@ * Side Public License, v 1. */ -import type { SharedUXServices } from '..'; -import type { SharedUXPluginStartDeps } from '../../types'; -import type { KibanaPluginServiceFactory } from '../types'; +import { SharedUXServices } from '@kbn/sharedux-services'; + +import type { SharedUXPluginStartDeps } from '../types'; +import type { KibanaPluginServiceFactory } from './types'; + import { platformServiceFactory } from './platform'; import { userPermissionsServiceFactory } from './permissions'; import { editorsServiceFactory } from './editors'; diff --git a/src/plugins/shared_ux/public/services/kibana/doc_links.ts b/src/plugins/shared_ux/public/services/kibana/doc_links.ts deleted file mode 100644 index eb25114a188a2..0000000000000 --- a/src/plugins/shared_ux/public/services/kibana/doc_links.ts +++ /dev/null @@ -1,23 +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 { KibanaPluginServiceFactory } from '../types'; -import { SharedUXPluginStartDeps } from '../../types'; -import { SharedUXDocLinksService } from '../doc_links'; - -export type DocLinksServiceFactory = KibanaPluginServiceFactory< - SharedUXDocLinksService, - SharedUXPluginStartDeps ->; - -/** - * A factory function for creating a Kibana-based implementation of `SharedUXEditorsService`. - */ -export const docLinksServiceFactory: DocLinksServiceFactory = ({ coreStart }) => ({ - dataViewsDocsLink: coreStart.docLinks.links.indexPatterns?.introduction, -}); diff --git a/src/plugins/shared_ux/public/services/kibana/editors.ts b/src/plugins/shared_ux/public/services/kibana/editors.ts deleted file mode 100644 index 0f8082d7d00e2..0000000000000 --- a/src/plugins/shared_ux/public/services/kibana/editors.ts +++ /dev/null @@ -1,23 +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 { KibanaPluginServiceFactory } from '../types'; -import { SharedUXEditorsService } from '../editors'; -import { SharedUXPluginStartDeps } from '../../types'; - -export type EditorsServiceFactory = KibanaPluginServiceFactory< - SharedUXEditorsService, - SharedUXPluginStartDeps ->; - -/** - * A factory function for creating a Kibana-based implementation of `SharedUXEditorsService`. - */ -export const editorsServiceFactory: EditorsServiceFactory = ({ startPlugins }) => ({ - openDataViewEditor: startPlugins.dataViewEditor.openEditor, -}); diff --git a/src/plugins/shared_ux/public/services/kibana/permissions.ts b/src/plugins/shared_ux/public/services/kibana/permissions.ts deleted file mode 100644 index caaeccdccbccd..0000000000000 --- a/src/plugins/shared_ux/public/services/kibana/permissions.ts +++ /dev/null @@ -1,23 +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 { KibanaPluginServiceFactory } from '../types'; -import { SharedUXPluginStartDeps } from '../../types'; -import { SharedUXUserPermissionsService } from '../permissions'; - -export type UserPermissionsServiceFactory = KibanaPluginServiceFactory< - SharedUXUserPermissionsService, - SharedUXPluginStartDeps ->; - -/** - * A factory function for creating a Kibana-based implementation of `SharedUXPermissionsService`. - */ -export const userPermissionsServiceFactory: UserPermissionsServiceFactory = ({ startPlugins }) => ({ - canCreateNewDataView: startPlugins.dataViewEditor.userPermissions.editDataView(), -}); diff --git a/src/plugins/shared_ux/public/services/kibana/platform.ts b/src/plugins/shared_ux/public/services/kibana/platform.ts deleted file mode 100644 index 9872149ee02f2..0000000000000 --- a/src/plugins/shared_ux/public/services/kibana/platform.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 { SharedUXPluginStartDeps } from '../../types'; -import { KibanaPluginServiceFactory } from '../types'; -import { SharedUXPlatformService } from '../platform'; - -/** - * A factory function for creating a Kibana-based implementation of `SharedUXPlatformService`. - */ -export type PlatformServiceFactory = KibanaPluginServiceFactory< - SharedUXPlatformService, - SharedUXPluginStartDeps ->; - -/** - * A factory function for creating a Kibana-based implementation of `SharedUXPlatformService`. - */ -export const platformServiceFactory: PlatformServiceFactory = ({ coreStart }) => ({ - setIsFullscreen: (isVisible: boolean) => coreStart.chrome.setIsVisible(isVisible), -}); diff --git a/src/plugins/shared_ux/public/services/permissions.ts b/src/plugins/shared_ux/public/services/permissions.ts index 009f497e35706..2d23d8c78caa1 100644 --- a/src/plugins/shared_ux/public/services/permissions.ts +++ b/src/plugins/shared_ux/public/services/permissions.ts @@ -6,6 +6,18 @@ * Side Public License, v 1. */ -export interface SharedUXUserPermissionsService { - canCreateNewDataView: boolean; -} +import { SharedUXUserPermissionsService } from '@kbn/sharedux-services'; +import { KibanaPluginServiceFactory } from './types'; +import { SharedUXPluginStartDeps } from '../types'; + +export type UserPermissionsServiceFactory = KibanaPluginServiceFactory< + SharedUXUserPermissionsService, + SharedUXPluginStartDeps +>; + +/** + * A factory function for creating a Kibana-based implementation of `SharedUXPermissionsService`. + */ +export const userPermissionsServiceFactory: UserPermissionsServiceFactory = ({ startPlugins }) => ({ + canCreateNewDataView: startPlugins.dataViewEditor.userPermissions.editDataView(), +}); diff --git a/src/plugins/shared_ux/public/services/platform.ts b/src/plugins/shared_ux/public/services/platform.ts index 52f88a1133c8b..5db66dd7d2968 100644 --- a/src/plugins/shared_ux/public/services/platform.ts +++ b/src/plugins/shared_ux/public/services/platform.ts @@ -6,18 +6,21 @@ * Side Public License, v 1. */ +import { SharedUXPlatformService } from '@kbn/sharedux-services'; +import { SharedUXPluginStartDeps } from '../types'; +import { KibanaPluginServiceFactory } from './types'; + +/** + * A factory function for creating a Kibana-based implementation of `SharedUXPlatformService`. + */ +export type PlatformServiceFactory = KibanaPluginServiceFactory< + SharedUXPlatformService, + SharedUXPluginStartDeps +>; + /** - * A services providing methods to interact with the Platform in which this plugin is - * running, (almost always Kibana). - * - * Rather than provide the entire `CoreStart` contract to components, we provide simplified - * abstractions around a use case specific to Shared UX. This way, we know exactly how the - * `CoreStart` and other plugins are used, like specifically which methods. This makes - * mocking and refactoring easier when upstream dependencies change. + * A factory function for creating a Kibana-based implementation of `SharedUXPlatformService`. */ -export interface SharedUXPlatformService { - /** - * Sets the fullscreen state of the chrome. - */ - setIsFullscreen: (isFullscreen: boolean) => void; -} +export const platformServiceFactory: PlatformServiceFactory = ({ coreStart }) => ({ + setIsFullscreen: (isVisible: boolean) => coreStart.chrome.setIsVisible(isVisible), +}); diff --git a/src/plugins/shared_ux/public/services/types.ts b/src/plugins/shared_ux/public/services/types.ts index 2645d5303a33b..15191a493d378 100644 --- a/src/plugins/shared_ux/public/services/types.ts +++ b/src/plugins/shared_ux/public/services/types.ts @@ -9,15 +9,6 @@ import { BehaviorSubject } from 'rxjs'; import { CoreStart, AppUpdater, PluginInitializerContext } from 'src/core/public'; -/** - * A factory function for creating one or more services. - * - * The `S` generic determines the shape of the API being produced. - * The `Parameters` generic determines what parameters are expected to - * create the service. - */ -export type PluginServiceFactory = (params: Parameters) => S; - /** * Parameters necessary to create a Kibana-based service, (e.g. during Plugin * startup or setup). diff --git a/yarn.lock b/yarn.lock index 8c2b1f60503d8..35eb03e46f0a1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3117,6 +3117,22 @@ version "0.0.0" uid "" +"@kbn/sharedux-components@link:bazel-bin/packages/kbn-sharedux-components": + version "0.0.0" + uid "" + +"@kbn/sharedux-services@link:bazel-bin/packages/kbn-sharedux-services": + version "0.0.0" + uid "" + +"@kbn/sharedux-storybook@link:bazel-bin/packages/kbn-sharedux-storybook": + version "0.0.0" + uid "" + +"@kbn/sharedux-utility@link:bazel-bin/packages/kbn-sharedux-utility": + version "0.0.0" + uid "" + "@kbn/spec-to-console@link:bazel-bin/packages/kbn-spec-to-console": version "0.0.0" uid "" @@ -6086,6 +6102,22 @@ version "0.0.0" uid "" +"@types/kbn__sharedux-components@link:bazel-bin/packages/kbn-sharedux-components/npm_module_types": + version "0.0.0" + uid "" + +"@types/kbn__sharedux-services@link:bazel-bin/packages/kbn-sharedux-services/npm_module_types": + version "0.0.0" + uid "" + +"@types/kbn__sharedux-storybook@link:bazel-bin/packages/kbn-sharedux-storybook/npm_module_types": + version "0.0.0" + uid "" + +"@types/kbn__sharedux-utility@link:bazel-bin/packages/kbn-sharedux-utility/npm_module_types": + version "0.0.0" + uid "" + "@types/kbn__std@link:bazel-bin/packages/kbn-std/npm_module_types": version "0.0.0" uid "" From 9105cf0815bc0ede849047b47af421c1f92c2cae Mon Sep 17 00:00:00 2001 From: Clint Andrew Hall Date: Thu, 10 Mar 2022 08:56:29 -0600 Subject: [PATCH 2/9] Updating --- .../__snapshots__/exit_full_screen_button.test.tsx.snap | 4 ++-- .../button/__snapshots__/primary.test.tsx.snap | 4 ++-- packages/kbn-sharedux-storybook/tsconfig.json | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/kbn-sharedux-components/src/exit_full_screen_button/__snapshots__/exit_full_screen_button.test.tsx.snap b/packages/kbn-sharedux-components/src/exit_full_screen_button/__snapshots__/exit_full_screen_button.test.tsx.snap index d2609e6b3c7a6..d73139bb71580 100644 --- a/packages/kbn-sharedux-components/src/exit_full_screen_button/__snapshots__/exit_full_screen_button.test.tsx.snap +++ b/packages/kbn-sharedux-components/src/exit_full_screen_button/__snapshots__/exit_full_screen_button.test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[` is rendered 1`] = ` - is rendered 1`] = ` - + `; diff --git a/packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/__snapshots__/primary.test.tsx.snap b/packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/__snapshots__/primary.test.tsx.snap index 1d7e3acb0b762..25257f1779a2a 100644 --- a/packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/__snapshots__/primary.test.tsx.snap +++ b/packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/__snapshots__/primary.test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[` is rendered 1`] = ` - is rendered 1`] = ` - + `; diff --git a/packages/kbn-sharedux-storybook/tsconfig.json b/packages/kbn-sharedux-storybook/tsconfig.json index a8cfc2cceb08b..8cae25c90f903 100644 --- a/packages/kbn-sharedux-storybook/tsconfig.json +++ b/packages/kbn-sharedux-storybook/tsconfig.json @@ -12,6 +12,7 @@ ] }, "include": [ - "src/**/*" + "src/**/*", + ".storybook/**/*" ] } From 757a6c58c9d79b6cdb71951ea6805202e2392991 Mon Sep 17 00:00:00 2001 From: Clint Andrew Hall Date: Thu, 10 Mar 2022 08:59:57 -0600 Subject: [PATCH 3/9] Fix ts --- packages/kbn-sharedux-storybook/BUILD.bazel | 2 ++ .../{.storybook => src/storybook}/main.ts | 8 ++++---- .../{.storybook => src/storybook}/manager.ts | 0 .../{.storybook => src/storybook}/preview.ts | 2 +- packages/kbn-sharedux-storybook/tsconfig.json | 3 +-- src/dev/storybook/aliases.ts | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) rename packages/kbn-sharedux-storybook/{.storybook => src/storybook}/main.ts (68%) rename packages/kbn-sharedux-storybook/{.storybook => src/storybook}/manager.ts (100%) rename packages/kbn-sharedux-storybook/{.storybook => src/storybook}/preview.ts (87%) diff --git a/packages/kbn-sharedux-storybook/BUILD.bazel b/packages/kbn-sharedux-storybook/BUILD.bazel index 1d8193966c8df..495376e3bc895 100644 --- a/packages/kbn-sharedux-storybook/BUILD.bazel +++ b/packages/kbn-sharedux-storybook/BUILD.bazel @@ -38,6 +38,7 @@ NPM_MODULE_EXTRA_FILES = [ # eg. "@npm//lodash" RUNTIME_DEPS = [ "//packages/kbn-sharedux-services", + "//packages/kbn-storybook", "@npm//@storybook/react", ] @@ -55,6 +56,7 @@ TYPES_DEPS = [ "@npm//@types/jest", "@npm//@storybook/react", "//packages/kbn-sharedux-services:npm_module_types", + "//packages/kbn-storybook:npm_module_types", ] jsts_transpiler( diff --git a/packages/kbn-sharedux-storybook/.storybook/main.ts b/packages/kbn-sharedux-storybook/src/storybook/main.ts similarity index 68% rename from packages/kbn-sharedux-storybook/.storybook/main.ts rename to packages/kbn-sharedux-storybook/src/storybook/main.ts index 9ac84dffb6cbc..3b931b81eb0df 100644 --- a/packages/kbn-sharedux-storybook/.storybook/main.ts +++ b/packages/kbn-sharedux-storybook/src/storybook/main.ts @@ -11,9 +11,9 @@ import { defaultConfig } from '@kbn/storybook'; module.exports = { ...defaultConfig, stories: [ - '../../kbn-sharedux*/**/*.stories.tsx', - '../../kbn-sharedux*/**/*.stories.mdx', - '../../../src/plugins/shared_ux/**/*.stories.tsx', - '../../../src/plugins/shared_ux/**/*.stories.mdx', + '../../../kbn-sharedux*/**/*.stories.tsx', + '../../../kbn-sharedux*/**/*.stories.mdx', + '../../../../src/plugins/shared_ux/**/*.stories.tsx', + '../../../../src/plugins/shared_ux/**/*.stories.mdx', ], }; diff --git a/packages/kbn-sharedux-storybook/.storybook/manager.ts b/packages/kbn-sharedux-storybook/src/storybook/manager.ts similarity index 100% rename from packages/kbn-sharedux-storybook/.storybook/manager.ts rename to packages/kbn-sharedux-storybook/src/storybook/manager.ts diff --git a/packages/kbn-sharedux-storybook/.storybook/preview.ts b/packages/kbn-sharedux-storybook/src/storybook/preview.ts similarity index 87% rename from packages/kbn-sharedux-storybook/.storybook/preview.ts rename to packages/kbn-sharedux-storybook/src/storybook/preview.ts index 62667b3dcef85..194a16474af2c 100644 --- a/packages/kbn-sharedux-storybook/.storybook/preview.ts +++ b/packages/kbn-sharedux-storybook/src/storybook/preview.ts @@ -7,6 +7,6 @@ */ import { addDecorator } from '@storybook/react'; -import { servicesDecorator } from '@kbn/sharedux-storybook'; +import { servicesDecorator } from '../decorators'; addDecorator(servicesDecorator); diff --git a/packages/kbn-sharedux-storybook/tsconfig.json b/packages/kbn-sharedux-storybook/tsconfig.json index 8cae25c90f903..a8cfc2cceb08b 100644 --- a/packages/kbn-sharedux-storybook/tsconfig.json +++ b/packages/kbn-sharedux-storybook/tsconfig.json @@ -12,7 +12,6 @@ ] }, "include": [ - "src/**/*", - ".storybook/**/*" + "src/**/*" ] } diff --git a/src/dev/storybook/aliases.ts b/src/dev/storybook/aliases.ts index 74d63b2bf7c0b..04bdab6a84c70 100644 --- a/src/dev/storybook/aliases.ts +++ b/src/dev/storybook/aliases.ts @@ -35,6 +35,6 @@ export const storybookAliases = { observability: 'x-pack/plugins/observability/.storybook', presentation: 'src/plugins/presentation_util/storybook', security_solution: 'x-pack/plugins/security_solution/.storybook', - shared_ux: 'packages/kbn-sharedux-storybook/.storybook', + shared_ux: 'packages/kbn-sharedux-storybook/src/storybook', ui_actions_enhanced: 'x-pack/plugins/ui_actions_enhanced/.storybook', }; From 956a651045042e6b631ceecf3dbd6576e08be6c7 Mon Sep 17 00:00:00 2001 From: Clint Andrew Hall Date: Thu, 10 Mar 2022 10:35:21 -0600 Subject: [PATCH 4/9] Fix rename --- src/plugins/shared_ux/public/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/shared_ux/public/index.ts b/src/plugins/shared_ux/public/index.ts index f02cd6511f426..b035983b4d765 100755 --- a/src/plugins/shared_ux/public/index.ts +++ b/src/plugins/shared_ux/public/index.ts @@ -19,6 +19,6 @@ export type { SharedUXPluginSetup, SharedUXPluginStart } from './types'; export { ExitFullScreenButton, LazyExitFullScreenButton, - NoDataViewsPage, - LazyNoDataViewsPage, + NoDataViews, + LazyNoDataViews, } from '@kbn/sharedux-components'; From 8c1b0bdee4aefc74d4c35b3511635651a3014214 Mon Sep 17 00:00:00 2001 From: Clint Andrew Hall Date: Thu, 10 Mar 2022 12:54:03 -0600 Subject: [PATCH 5/9] Add external type --- .../src/file_system_cache.d.ts | 31 +++++++++++++++++++ src/plugins/shared_ux/tsconfig.json | 1 - 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 packages/kbn-sharedux-storybook/src/file_system_cache.d.ts diff --git a/packages/kbn-sharedux-storybook/src/file_system_cache.d.ts b/packages/kbn-sharedux-storybook/src/file_system_cache.d.ts new file mode 100644 index 0000000000000..7831c50f10178 --- /dev/null +++ b/packages/kbn-sharedux-storybook/src/file_system_cache.d.ts @@ -0,0 +1,31 @@ +/* + * 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. + */ + +// Storybook uses this module and its types are defined in the source but not in the type output +declare module 'file-system-cache' { + interface Options { + basePath?: string; + ns?: string | string[]; + extension?: string; + } + + class FileSystemCache { + constructor(options: Options); + path(key: string): string; + fileExists(key: string): Promise; + ensureBasePath(): Promise; + get(key: string, defaultValue?: any): Promise; + getSync(key: string, defaultValue?: any): any | typeof defaultValue; + set(key: string, value: any): Promise<{ path: string }>; + setSync(key: string, value: any): this; + remove(key: string): Promise; + clear(): Promise; + save(): Promise<{ paths: string[] }>; + load(): Promise<{ files: Array<{ path: string; value: any }> }>; + } +} diff --git a/src/plugins/shared_ux/tsconfig.json b/src/plugins/shared_ux/tsconfig.json index 069fe1d069b4a..3a287353a5341 100644 --- a/src/plugins/shared_ux/tsconfig.json +++ b/src/plugins/shared_ux/tsconfig.json @@ -10,7 +10,6 @@ "common/**/*", "public/**/*", "server/**/*", - ".storybook/**/*", "../../../typings/**/*" ], "references": [ From 5b9777e54ac6b7e3da42d8b431f01de909f2631c Mon Sep 17 00:00:00 2001 From: Clint Andrew Hall Date: Thu, 10 Mar 2022 20:49:13 -0600 Subject: [PATCH 6/9] Rename packages --- package.json | 16 ++++++++-------- packages/BUILD.bazel | 16 ++++++++-------- .../BUILD.bazel | 17 +++++++++-------- .../README.md | 2 +- .../jest.config.js | 2 +- .../package.json | 4 ++-- .../assets/data_view_illustration.tsx | 0 .../src/empty_state/assets/index.tsx | 2 +- .../src/empty_state/index.tsx | 0 .../documentation_link.test.tsx.snap | 0 .../no_data_views/documentation_link.test.tsx | 0 .../no_data_views/documentation_link.tsx | 0 .../src/empty_state/no_data_views/index.tsx | 0 .../no_data_views.component.test.tsx | 0 .../no_data_views/no_data_views.component.tsx | 0 .../empty_state/no_data_views/no_data_views.mdx | 0 .../no_data_views/no_data_views.stories.tsx | 2 +- .../no_data_views/no_data_views.test.tsx | 2 +- .../empty_state/no_data_views/no_data_views.tsx | 4 ++-- .../exit_full_screen_button.test.tsx.snap | 0 .../exit_full_screen_button.component.tsx | 0 .../exit_full_screen_button.mdx | 0 .../exit_full_screen_button.scss | 0 .../exit_full_screen_button.stories.tsx | 0 .../exit_full_screen_button.test.tsx | 2 +- .../exit_full_screen_button.tsx | 2 +- .../src/exit_full_screen_button/index.ts | 0 .../src/index.ts | 2 +- .../src/mdx.d.ts | 0 .../src/page_template/index.ts | 2 +- .../src/page_template/no_data_page/index.ts | 9 +++++++++ .../__snapshots__/no_data_card.test.tsx.snap | 0 .../no_data_page/no_data_card/index.ts | 0 .../no_data_card/no_data_card.stories.tsx | 0 .../no_data_card/no_data_card.test.tsx | 0 .../no_data_page/no_data_card/no_data_card.tsx | 0 .../no_data_page/no_data_card/types.ts | 0 .../src/toolbar/index.ts | 0 .../button/__snapshots__/primary.test.tsx.snap | 0 .../toolbar/solution_toolbar/button/primary.mdx | 0 .../solution_toolbar/button/primary.stories.tsx | 0 .../solution_toolbar/button/primary.test.tsx | 2 +- .../toolbar/solution_toolbar/button/primary.tsx | 0 .../tsconfig.json | 0 .../BUILD.bazel | 4 ++-- packages/kbn-shared-ux-services/README.md | 3 +++ .../jest.config.js | 2 +- .../package.json | 4 ++-- .../src/index.ts | 0 .../src/services/doc_links.ts | 0 .../src/services/editors.ts | 0 .../src/services/index.tsx | 0 .../src/services/mocks/doc_links.mock.ts | 0 .../src/services/mocks/editors.mock.ts | 0 .../src/services/mocks/index.ts | 2 +- .../src/services/mocks/permissions.mock.ts | 0 .../src/services/mocks/platform.mock.ts | 0 .../src/services/permissions.ts | 0 .../src/services/platform.ts | 0 .../src/services/stub/doc_links.ts | 0 .../src/services/stub/editors.ts | 0 .../src/services/stub/index.ts | 2 +- .../src/services/stub/permissions.ts | 0 .../src/services/stub/platform.ts | 0 .../src/services/types.ts | 0 .../src/types.ts | 0 .../tsconfig.json | 0 .../BUILD.bazel | 8 ++++---- packages/kbn-shared-ux-storybook/README.md | 3 +++ .../jest.config.js | 2 +- .../package.json | 4 ++-- .../src/decorators.tsx | 2 +- .../src/file_system_cache.d.ts | 0 .../src/index.ts | 0 .../src/mdx.d.ts | 0 .../src/services/doc_links.ts | 2 +- .../src/services/editors.ts | 2 +- .../src/services/index.ts | 2 +- .../src/services/permissions.ts | 2 +- .../src/services/platform.ts | 2 +- .../src/storybook/main.ts | 0 .../src/storybook/manager.ts | 0 .../src/storybook/preview.ts | 0 .../tsconfig.json | 0 .../BUILD.bazel | 4 ++-- .../README.md | 2 +- .../jest.config.js | 2 +- .../package.json | 4 ++-- .../src/fallback.tsx | 0 .../src/index.ts | 0 .../src/with_suspense.tsx | 0 .../tsconfig.json | 0 packages/kbn-sharedux-services/README.md | 3 --- packages/kbn-sharedux-storybook/README.md | 3 --- src/dev/storybook/aliases.ts | 2 +- src/plugins/shared_ux/kibana.json | 5 ++++- src/plugins/shared_ux/public/index.ts | 2 +- src/plugins/shared_ux/public/plugin.tsx | 2 +- .../shared_ux/public/services/doc_links.ts | 2 +- .../shared_ux/public/services/editors.ts | 2 +- src/plugins/shared_ux/public/services/index.ts | 2 +- .../shared_ux/public/services/permissions.ts | 2 +- .../shared_ux/public/services/platform.ts | 2 +- yarn.lock | 16 ++++++++-------- 104 files changed, 100 insertions(+), 87 deletions(-) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/BUILD.bazel (88%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/README.md (60%) rename packages/{kbn-sharedux-storybook => kbn-shared-ux-components}/jest.config.js (87%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/package.json (80%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/empty_state/assets/data_view_illustration.tsx (100%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/empty_state/assets/index.tsx (93%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/empty_state/index.tsx (100%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/empty_state/no_data_views/__snapshots__/documentation_link.test.tsx.snap (100%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/empty_state/no_data_views/documentation_link.test.tsx (100%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/empty_state/no_data_views/documentation_link.tsx (100%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/empty_state/no_data_views/index.tsx (100%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/empty_state/no_data_views/no_data_views.component.test.tsx (100%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/empty_state/no_data_views/no_data_views.component.tsx (100%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/empty_state/no_data_views/no_data_views.mdx (100%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/empty_state/no_data_views/no_data_views.stories.tsx (95%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/empty_state/no_data_views/no_data_views.test.tsx (97%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/empty_state/no_data_views/no_data_views.tsx (94%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/exit_full_screen_button/__snapshots__/exit_full_screen_button.test.tsx.snap (100%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/exit_full_screen_button/exit_full_screen_button.component.tsx (100%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/exit_full_screen_button/exit_full_screen_button.mdx (100%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/exit_full_screen_button/exit_full_screen_button.scss (100%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/exit_full_screen_button/exit_full_screen_button.stories.tsx (100%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/exit_full_screen_button/exit_full_screen_button.test.tsx (98%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/exit_full_screen_button/exit_full_screen_button.tsx (97%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/exit_full_screen_button/index.ts (100%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/index.ts (97%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/mdx.d.ts (100%) rename src/plugins/shared_ux/public/components/page_template/index.tsx => packages/kbn-shared-ux-components/src/page_template/index.ts (85%) create mode 100644 packages/kbn-shared-ux-components/src/page_template/no_data_page/index.ts rename {src/plugins/shared_ux/public/components => packages/kbn-shared-ux-components/src}/page_template/no_data_page/no_data_card/__snapshots__/no_data_card.test.tsx.snap (100%) rename {src/plugins/shared_ux/public/components => packages/kbn-shared-ux-components/src}/page_template/no_data_page/no_data_card/index.ts (100%) rename {src/plugins/shared_ux/public/components => packages/kbn-shared-ux-components/src}/page_template/no_data_page/no_data_card/no_data_card.stories.tsx (100%) rename {src/plugins/shared_ux/public/components => packages/kbn-shared-ux-components/src}/page_template/no_data_page/no_data_card/no_data_card.test.tsx (100%) rename {src/plugins/shared_ux/public/components => packages/kbn-shared-ux-components/src}/page_template/no_data_page/no_data_card/no_data_card.tsx (100%) rename {src/plugins/shared_ux/public/components => packages/kbn-shared-ux-components/src}/page_template/no_data_page/no_data_card/types.ts (100%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/toolbar/index.ts (100%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/toolbar/solution_toolbar/button/__snapshots__/primary.test.tsx.snap (100%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/toolbar/solution_toolbar/button/primary.mdx (100%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/toolbar/solution_toolbar/button/primary.stories.tsx (100%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/toolbar/solution_toolbar/button/primary.test.tsx (97%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/src/toolbar/solution_toolbar/button/primary.tsx (100%) rename packages/{kbn-sharedux-components => kbn-shared-ux-components}/tsconfig.json (100%) rename packages/{kbn-sharedux-services => kbn-shared-ux-services}/BUILD.bazel (96%) create mode 100755 packages/kbn-shared-ux-services/README.md rename packages/{kbn-sharedux-services => kbn-shared-ux-services}/jest.config.js (88%) rename packages/{kbn-sharedux-services => kbn-shared-ux-services}/package.json (81%) rename packages/{kbn-sharedux-services => kbn-shared-ux-services}/src/index.ts (100%) rename packages/{kbn-sharedux-services => kbn-shared-ux-services}/src/services/doc_links.ts (100%) rename packages/{kbn-sharedux-services => kbn-shared-ux-services}/src/services/editors.ts (100%) rename packages/{kbn-sharedux-services => kbn-shared-ux-services}/src/services/index.tsx (100%) rename packages/{kbn-sharedux-services => kbn-shared-ux-services}/src/services/mocks/doc_links.mock.ts (100%) rename packages/{kbn-sharedux-services => kbn-shared-ux-services}/src/services/mocks/editors.mock.ts (100%) rename packages/{kbn-sharedux-services => kbn-shared-ux-services}/src/services/mocks/index.ts (97%) rename packages/{kbn-sharedux-services => kbn-shared-ux-services}/src/services/mocks/permissions.mock.ts (100%) rename packages/{kbn-sharedux-services => kbn-shared-ux-services}/src/services/mocks/platform.mock.ts (100%) rename packages/{kbn-sharedux-services => kbn-shared-ux-services}/src/services/permissions.ts (100%) rename packages/{kbn-sharedux-services => kbn-shared-ux-services}/src/services/platform.ts (100%) rename packages/{kbn-sharedux-services => kbn-shared-ux-services}/src/services/stub/doc_links.ts (100%) rename packages/{kbn-sharedux-services => kbn-shared-ux-services}/src/services/stub/editors.ts (100%) rename packages/{kbn-sharedux-services => kbn-shared-ux-services}/src/services/stub/index.ts (96%) rename packages/{kbn-sharedux-services => kbn-shared-ux-services}/src/services/stub/permissions.ts (100%) rename packages/{kbn-sharedux-services => kbn-shared-ux-services}/src/services/stub/platform.ts (100%) rename packages/{kbn-sharedux-services => kbn-shared-ux-services}/src/services/types.ts (100%) rename packages/{kbn-sharedux-services => kbn-shared-ux-services}/src/types.ts (100%) rename packages/{kbn-sharedux-services => kbn-shared-ux-services}/tsconfig.json (100%) rename packages/{kbn-sharedux-storybook => kbn-shared-ux-storybook}/BUILD.bazel (93%) create mode 100644 packages/kbn-shared-ux-storybook/README.md rename packages/{kbn-sharedux-components => kbn-shared-ux-storybook}/jest.config.js (88%) rename packages/{kbn-sharedux-storybook => kbn-shared-ux-storybook}/package.json (80%) rename packages/{kbn-sharedux-storybook => kbn-shared-ux-storybook}/src/decorators.tsx (91%) rename packages/{kbn-sharedux-storybook => kbn-shared-ux-storybook}/src/file_system_cache.d.ts (100%) rename packages/{kbn-sharedux-storybook => kbn-shared-ux-storybook}/src/index.ts (100%) rename packages/{kbn-sharedux-storybook => kbn-shared-ux-storybook}/src/mdx.d.ts (100%) rename packages/{kbn-sharedux-storybook => kbn-shared-ux-storybook}/src/services/doc_links.ts (97%) rename packages/{kbn-sharedux-storybook => kbn-shared-ux-storybook}/src/services/editors.ts (97%) rename packages/{kbn-sharedux-storybook => kbn-shared-ux-storybook}/src/services/index.ts (93%) rename packages/{kbn-sharedux-storybook => kbn-shared-ux-storybook}/src/services/permissions.ts (96%) rename packages/{kbn-sharedux-storybook => kbn-shared-ux-storybook}/src/services/platform.ts (97%) rename packages/{kbn-sharedux-storybook => kbn-shared-ux-storybook}/src/storybook/main.ts (100%) rename packages/{kbn-sharedux-storybook => kbn-shared-ux-storybook}/src/storybook/manager.ts (100%) rename packages/{kbn-sharedux-storybook => kbn-shared-ux-storybook}/src/storybook/preview.ts (100%) rename packages/{kbn-sharedux-storybook => kbn-shared-ux-storybook}/tsconfig.json (100%) rename packages/{kbn-sharedux-utility => kbn-shared-ux-utility}/BUILD.bazel (96%) rename packages/{kbn-sharedux-utility => kbn-shared-ux-utility}/README.md (62%) rename packages/{kbn-sharedux-utility => kbn-shared-ux-utility}/jest.config.js (88%) rename packages/{kbn-sharedux-utility => kbn-shared-ux-utility}/package.json (81%) rename packages/{kbn-sharedux-utility => kbn-shared-ux-utility}/src/fallback.tsx (100%) rename packages/{kbn-sharedux-utility => kbn-shared-ux-utility}/src/index.ts (100%) rename packages/{kbn-sharedux-utility => kbn-shared-ux-utility}/src/with_suspense.tsx (100%) rename packages/{kbn-sharedux-utility => kbn-shared-ux-utility}/tsconfig.json (100%) delete mode 100755 packages/kbn-sharedux-services/README.md delete mode 100644 packages/kbn-sharedux-storybook/README.md diff --git a/package.json b/package.json index d2a1b71c9915c..d615eddb2838b 100644 --- a/package.json +++ b/package.json @@ -167,10 +167,10 @@ "@kbn/securitysolution-utils": "link:bazel-bin/packages/kbn-securitysolution-utils", "@kbn/server-http-tools": "link:bazel-bin/packages/kbn-server-http-tools", "@kbn/server-route-repository": "link:bazel-bin/packages/kbn-server-route-repository", - "@kbn/sharedux-components": "link:bazel-bin/packages/kbn-sharedux-components", - "@kbn/sharedux-services": "link:bazel-bin/packages/kbn-sharedux-services", - "@kbn/sharedux-storybook": "link:bazel-bin/packages/kbn-sharedux-storybook", - "@kbn/sharedux-utility": "link:bazel-bin/packages/kbn-sharedux-utility", + "@kbn/shared-ux-components": "link:bazel-bin/packages/kbn-shared-ux-components", + "@kbn/shared-ux-services": "link:bazel-bin/packages/kbn-shared-ux-services", + "@kbn/shared-ux-storybook": "link:bazel-bin/packages/kbn-shared-ux-storybook", + "@kbn/shared-ux-utility": "link:bazel-bin/packages/kbn-shared-ux-utility", "@kbn/std": "link:bazel-bin/packages/kbn-std", "@kbn/timelion-grammar": "link:bazel-bin/packages/kbn-timelion-grammar", "@kbn/tinymath": "link:bazel-bin/packages/kbn-tinymath", @@ -200,10 +200,10 @@ "@turf/helpers": "6.0.1", "@turf/length": "^6.0.2", "@types/jsonwebtoken": "^8.5.6", - "@types/kbn__sharedux-components": "link:bazel-bin/packages/kbn-sharedux-components/npm_module_types", - "@types/kbn__sharedux-services": "link:bazel-bin/packages/kbn-sharedux-services/npm_module_types", - "@types/kbn__sharedux-storybook": "link:bazel-bin/packages/kbn-sharedux-storybook/npm_module_types", - "@types/kbn__sharedux-utility": "link:bazel-bin/packages/kbn-sharedux-utility/npm_module_types", + "@types/kbn__shared-ux-components": "link:bazel-bin/packages/kbn-shared-ux-components/npm_module_types", + "@types/kbn__shared-ux-services": "link:bazel-bin/packages/kbn-shared-ux-services/npm_module_types", + "@types/kbn__shared-ux-storybook": "link:bazel-bin/packages/kbn-shared-ux-storybook/npm_module_types", + "@types/kbn__shared-ux-utility": "link:bazel-bin/packages/kbn-shared-ux-utility/npm_module_types", "@types/moment-duration-format": "^2.2.3", "JSONStream": "1.3.5", "abort-controller": "^3.0.0", diff --git a/packages/BUILD.bazel b/packages/BUILD.bazel index 736422a8beed2..77ddecc232137 100644 --- a/packages/BUILD.bazel +++ b/packages/BUILD.bazel @@ -65,10 +65,10 @@ filegroup( "//packages/kbn-securitysolution-utils:build", "//packages/kbn-server-http-tools:build", "//packages/kbn-server-route-repository:build", - "//packages/kbn-sharedux-components:build", - "//packages/kbn-sharedux-services:build", - "//packages/kbn-sharedux-storybook:build", - "//packages/kbn-sharedux-utility:build", + "//packages/kbn-shared-ux-components:build", + "//packages/kbn-shared-ux-services:build", + "//packages/kbn-shared-ux-storybook:build", + "//packages/kbn-shared-ux-utility:build", "//packages/kbn-spec-to-console:build", "//packages/kbn-std:build", "//packages/kbn-storybook:build", @@ -142,10 +142,10 @@ filegroup( "//packages/kbn-securitysolution-utils:build_types", "//packages/kbn-server-http-tools:build_types", "//packages/kbn-server-route-repository:build_types", - "//packages/kbn-sharedux-components:build_types", - "//packages/kbn-sharedux-services:build_types", - "//packages/kbn-sharedux-storybook:build_types", - "//packages/kbn-sharedux-utility:build_types", + "//packages/kbn-shared-ux-components:build_types", + "//packages/kbn-shared-ux-services:build_types", + "//packages/kbn-shared-ux-storybook:build_types", + "//packages/kbn-shared-ux-utility:build_types", "//packages/kbn-std:build_types", "//packages/kbn-storybook:build_types", "//packages/kbn-telemetry-tools:build_types", diff --git a/packages/kbn-sharedux-components/BUILD.bazel b/packages/kbn-shared-ux-components/BUILD.bazel similarity index 88% rename from packages/kbn-sharedux-components/BUILD.bazel rename to packages/kbn-shared-ux-components/BUILD.bazel index 743f833994106..4efbeefc1d7cc 100644 --- a/packages/kbn-sharedux-components/BUILD.bazel +++ b/packages/kbn-shared-ux-components/BUILD.bazel @@ -2,13 +2,14 @@ load("@npm//@bazel/typescript:index.bzl", "ts_config") load("@build_bazel_rules_nodejs//:index.bzl", "js_library") load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") -PKG_DIRNAME = "kbn-sharedux-components" -PKG_REQUIRE_NAME = "@kbn/sharedux-components" +PKG_DIRNAME = "kbn-shared-ux-components" +PKG_REQUIRE_NAME = "@kbn/shared-ux-components" SOURCE_FILES = glob( [ "src/**/*.ts", "src/**/*.tsx", + "src/**/*.scss", ], exclude = [ "**/*.test.*", @@ -43,9 +44,9 @@ RUNTIME_DEPS = [ "@npm//@emotion/css", "@npm//classnames", "@npm//@storybook/addon-actions", - "//packages/kbn-sharedux-services", - "//packages/kbn-sharedux-storybook", - "//packages/kbn-sharedux-utility", + "//packages/kbn-shared-ux-services", + "//packages/kbn-shared-ux-storybook", + "//packages/kbn-shared-ux-utility", "//packages/kbn-i18n", "//packages/kbn-i18n-react", ] @@ -68,9 +69,9 @@ TYPES_DEPS = [ "@npm//@emotion/css", "@npm//@storybook/addon-actions", "@npm//@types/classnames", - "//packages/kbn-sharedux-services:npm_module_types", - "//packages/kbn-sharedux-storybook:npm_module_types", - "//packages/kbn-sharedux-utility:npm_module_types", + "//packages/kbn-shared-ux-services:npm_module_types", + "//packages/kbn-shared-ux-storybook:npm_module_types", + "//packages/kbn-shared-ux-utility:npm_module_types", "//packages/kbn-i18n:npm_module_types", "//packages/kbn-i18n-react:npm_module_types", ] diff --git a/packages/kbn-sharedux-components/README.md b/packages/kbn-shared-ux-components/README.md similarity index 60% rename from packages/kbn-sharedux-components/README.md rename to packages/kbn-shared-ux-components/README.md index 54ae9efcc22f1..95ae0e99e7765 100644 --- a/packages/kbn-sharedux-components/README.md +++ b/packages/kbn-shared-ux-components/README.md @@ -1,3 +1,3 @@ -# @kbn/sharedux-components +# @kbn/shared-ux-components Empty package generated by @kbn/generate diff --git a/packages/kbn-sharedux-storybook/jest.config.js b/packages/kbn-shared-ux-components/jest.config.js similarity index 87% rename from packages/kbn-sharedux-storybook/jest.config.js rename to packages/kbn-shared-ux-components/jest.config.js index 33906ec0d74ef..c2ac8c3a57106 100644 --- a/packages/kbn-sharedux-storybook/jest.config.js +++ b/packages/kbn-shared-ux-components/jest.config.js @@ -9,5 +9,5 @@ module.exports = { preset: '@kbn/test', rootDir: '../..', - roots: ['/packages/kbn-sharedux-storybook'], + roots: ['/packages/kbn-shared-ux-components'], }; diff --git a/packages/kbn-sharedux-components/package.json b/packages/kbn-shared-ux-components/package.json similarity index 80% rename from packages/kbn-sharedux-components/package.json rename to packages/kbn-shared-ux-components/package.json index 1cb3cac8c1397..56ba66c7a3e0b 100644 --- a/packages/kbn-sharedux-components/package.json +++ b/packages/kbn-shared-ux-components/package.json @@ -1,8 +1,8 @@ { - "name": "@kbn/sharedux-components", + "name": "@kbn/shared-ux-components", "private": true, "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", "license": "SSPL-1.0 OR Elastic License 2.0" -} +} \ No newline at end of file diff --git a/packages/kbn-sharedux-components/src/empty_state/assets/data_view_illustration.tsx b/packages/kbn-shared-ux-components/src/empty_state/assets/data_view_illustration.tsx similarity index 100% rename from packages/kbn-sharedux-components/src/empty_state/assets/data_view_illustration.tsx rename to packages/kbn-shared-ux-components/src/empty_state/assets/data_view_illustration.tsx diff --git a/packages/kbn-sharedux-components/src/empty_state/assets/index.tsx b/packages/kbn-shared-ux-components/src/empty_state/assets/index.tsx similarity index 93% rename from packages/kbn-sharedux-components/src/empty_state/assets/index.tsx rename to packages/kbn-shared-ux-components/src/empty_state/assets/index.tsx index d0e2d224772ed..939adc8bfac66 100644 --- a/packages/kbn-sharedux-components/src/empty_state/assets/index.tsx +++ b/packages/kbn-shared-ux-components/src/empty_state/assets/index.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { EuiLoadingSpinner } from '@elastic/eui'; -import { withSuspense } from '@kbn/sharedux-utility'; +import { withSuspense } from '@kbn/shared-ux-utility'; export const LazyDataViewIllustration = React.lazy(() => import('../assets/data_view_illustration').then(({ DataViewIllustration }) => ({ diff --git a/packages/kbn-sharedux-components/src/empty_state/index.tsx b/packages/kbn-shared-ux-components/src/empty_state/index.tsx similarity index 100% rename from packages/kbn-sharedux-components/src/empty_state/index.tsx rename to packages/kbn-shared-ux-components/src/empty_state/index.tsx diff --git a/packages/kbn-sharedux-components/src/empty_state/no_data_views/__snapshots__/documentation_link.test.tsx.snap b/packages/kbn-shared-ux-components/src/empty_state/no_data_views/__snapshots__/documentation_link.test.tsx.snap similarity index 100% rename from packages/kbn-sharedux-components/src/empty_state/no_data_views/__snapshots__/documentation_link.test.tsx.snap rename to packages/kbn-shared-ux-components/src/empty_state/no_data_views/__snapshots__/documentation_link.test.tsx.snap diff --git a/packages/kbn-sharedux-components/src/empty_state/no_data_views/documentation_link.test.tsx b/packages/kbn-shared-ux-components/src/empty_state/no_data_views/documentation_link.test.tsx similarity index 100% rename from packages/kbn-sharedux-components/src/empty_state/no_data_views/documentation_link.test.tsx rename to packages/kbn-shared-ux-components/src/empty_state/no_data_views/documentation_link.test.tsx diff --git a/packages/kbn-sharedux-components/src/empty_state/no_data_views/documentation_link.tsx b/packages/kbn-shared-ux-components/src/empty_state/no_data_views/documentation_link.tsx similarity index 100% rename from packages/kbn-sharedux-components/src/empty_state/no_data_views/documentation_link.tsx rename to packages/kbn-shared-ux-components/src/empty_state/no_data_views/documentation_link.tsx diff --git a/packages/kbn-sharedux-components/src/empty_state/no_data_views/index.tsx b/packages/kbn-shared-ux-components/src/empty_state/no_data_views/index.tsx similarity index 100% rename from packages/kbn-sharedux-components/src/empty_state/no_data_views/index.tsx rename to packages/kbn-shared-ux-components/src/empty_state/no_data_views/index.tsx diff --git a/packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.component.test.tsx b/packages/kbn-shared-ux-components/src/empty_state/no_data_views/no_data_views.component.test.tsx similarity index 100% rename from packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.component.test.tsx rename to packages/kbn-shared-ux-components/src/empty_state/no_data_views/no_data_views.component.test.tsx diff --git a/packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.component.tsx b/packages/kbn-shared-ux-components/src/empty_state/no_data_views/no_data_views.component.tsx similarity index 100% rename from packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.component.tsx rename to packages/kbn-shared-ux-components/src/empty_state/no_data_views/no_data_views.component.tsx diff --git a/packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.mdx b/packages/kbn-shared-ux-components/src/empty_state/no_data_views/no_data_views.mdx similarity index 100% rename from packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.mdx rename to packages/kbn-shared-ux-components/src/empty_state/no_data_views/no_data_views.mdx diff --git a/packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.stories.tsx b/packages/kbn-shared-ux-components/src/empty_state/no_data_views/no_data_views.stories.tsx similarity index 95% rename from packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.stories.tsx rename to packages/kbn-shared-ux-components/src/empty_state/no_data_views/no_data_views.stories.tsx index da656cef1d6d8..641d8e1cd0e28 100644 --- a/packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.stories.tsx +++ b/packages/kbn-shared-ux-components/src/empty_state/no_data_views/no_data_views.stories.tsx @@ -7,7 +7,7 @@ */ import React from 'react'; import { action } from '@storybook/addon-actions'; -import { docLinksServiceFactory } from '@kbn/sharedux-storybook'; +import { docLinksServiceFactory } from '@kbn/shared-ux-storybook'; import { NoDataViews as NoDataViewsComponent, Props } from './no_data_views.component'; import { NoDataViews } from './no_data_views'; diff --git a/packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.test.tsx b/packages/kbn-shared-ux-components/src/empty_state/no_data_views/no_data_views.test.tsx similarity index 97% rename from packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.test.tsx rename to packages/kbn-shared-ux-components/src/empty_state/no_data_views/no_data_views.test.tsx index 22fb2620b02c0..e9fca952ff242 100644 --- a/packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.test.tsx +++ b/packages/kbn-shared-ux-components/src/empty_state/no_data_views/no_data_views.test.tsx @@ -15,7 +15,7 @@ import { SharedUXServicesProvider, SharedUXServices, mockServiceFactories, -} from '@kbn/sharedux-services'; +} from '@kbn/shared-ux-services'; import { NoDataViews } from './no_data_views'; diff --git a/packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.tsx b/packages/kbn-shared-ux-components/src/empty_state/no_data_views/no_data_views.tsx similarity index 94% rename from packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.tsx rename to packages/kbn-shared-ux-components/src/empty_state/no_data_views/no_data_views.tsx index a41b9840605c6..3489b98da03e8 100644 --- a/packages/kbn-sharedux-components/src/empty_state/no_data_views/no_data_views.tsx +++ b/packages/kbn-shared-ux-components/src/empty_state/no_data_views/no_data_views.tsx @@ -7,8 +7,8 @@ */ import React, { useCallback, useEffect, useRef } from 'react'; -import { useEditors, usePermissions } from '@kbn/sharedux-services'; -import type { SharedUXEditorsService } from '@kbn/sharedux-services'; +import { useEditors, usePermissions } from '@kbn/shared-ux-services'; +import type { SharedUXEditorsService } from '@kbn/shared-ux-services'; import { NoDataViews as NoDataViewsComponent } from './no_data_views.component'; diff --git a/packages/kbn-sharedux-components/src/exit_full_screen_button/__snapshots__/exit_full_screen_button.test.tsx.snap b/packages/kbn-shared-ux-components/src/exit_full_screen_button/__snapshots__/exit_full_screen_button.test.tsx.snap similarity index 100% rename from packages/kbn-sharedux-components/src/exit_full_screen_button/__snapshots__/exit_full_screen_button.test.tsx.snap rename to packages/kbn-shared-ux-components/src/exit_full_screen_button/__snapshots__/exit_full_screen_button.test.tsx.snap diff --git a/packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.component.tsx b/packages/kbn-shared-ux-components/src/exit_full_screen_button/exit_full_screen_button.component.tsx similarity index 100% rename from packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.component.tsx rename to packages/kbn-shared-ux-components/src/exit_full_screen_button/exit_full_screen_button.component.tsx diff --git a/packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.mdx b/packages/kbn-shared-ux-components/src/exit_full_screen_button/exit_full_screen_button.mdx similarity index 100% rename from packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.mdx rename to packages/kbn-shared-ux-components/src/exit_full_screen_button/exit_full_screen_button.mdx diff --git a/packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.scss b/packages/kbn-shared-ux-components/src/exit_full_screen_button/exit_full_screen_button.scss similarity index 100% rename from packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.scss rename to packages/kbn-shared-ux-components/src/exit_full_screen_button/exit_full_screen_button.scss diff --git a/packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.stories.tsx b/packages/kbn-shared-ux-components/src/exit_full_screen_button/exit_full_screen_button.stories.tsx similarity index 100% rename from packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.stories.tsx rename to packages/kbn-shared-ux-components/src/exit_full_screen_button/exit_full_screen_button.stories.tsx diff --git a/packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.test.tsx b/packages/kbn-shared-ux-components/src/exit_full_screen_button/exit_full_screen_button.test.tsx similarity index 98% rename from packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.test.tsx rename to packages/kbn-shared-ux-components/src/exit_full_screen_button/exit_full_screen_button.test.tsx index 02e38fc049f0c..a6e55ca8c759d 100644 --- a/packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.test.tsx +++ b/packages/kbn-shared-ux-components/src/exit_full_screen_button/exit_full_screen_button.test.tsx @@ -13,7 +13,7 @@ import { SharedUXServicesProvider, SharedUXServices, mockServiceFactories, -} from '@kbn/sharedux-services'; +} from '@kbn/shared-ux-services'; import { ExitFullScreenButton } from './exit_full_screen_button'; diff --git a/packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.tsx b/packages/kbn-shared-ux-components/src/exit_full_screen_button/exit_full_screen_button.tsx similarity index 97% rename from packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.tsx rename to packages/kbn-shared-ux-components/src/exit_full_screen_button/exit_full_screen_button.tsx index b5e8faeb710b6..30deaaa86f4c5 100644 --- a/packages/kbn-sharedux-components/src/exit_full_screen_button/exit_full_screen_button.tsx +++ b/packages/kbn-shared-ux-components/src/exit_full_screen_button/exit_full_screen_button.tsx @@ -10,7 +10,7 @@ import React, { useCallback, useEffect } from 'react'; import { useEuiTheme, keys } from '@elastic/eui'; import { css } from '@emotion/react'; -import { usePlatformService } from '@kbn/sharedux-services'; +import { usePlatformService } from '@kbn/shared-ux-services'; import { ExitFullScreenButton as Component } from './exit_full_screen_button.component'; diff --git a/packages/kbn-sharedux-components/src/exit_full_screen_button/index.ts b/packages/kbn-shared-ux-components/src/exit_full_screen_button/index.ts similarity index 100% rename from packages/kbn-sharedux-components/src/exit_full_screen_button/index.ts rename to packages/kbn-shared-ux-components/src/exit_full_screen_button/index.ts diff --git a/packages/kbn-sharedux-components/src/index.ts b/packages/kbn-shared-ux-components/src/index.ts similarity index 97% rename from packages/kbn-sharedux-components/src/index.ts rename to packages/kbn-shared-ux-components/src/index.ts index d70569d5ef473..b6c5742801bb8 100755 --- a/packages/kbn-sharedux-components/src/index.ts +++ b/packages/kbn-shared-ux-components/src/index.ts @@ -7,7 +7,7 @@ */ import React from 'react'; -import { withSuspense } from '@kbn/sharedux-utility'; +import { withSuspense } from '@kbn/shared-ux-utility'; /** * The Lazily-loaded `ExitFullScreenButton` component. Consumers should use `React.Suspennse` or the diff --git a/packages/kbn-sharedux-components/src/mdx.d.ts b/packages/kbn-shared-ux-components/src/mdx.d.ts similarity index 100% rename from packages/kbn-sharedux-components/src/mdx.d.ts rename to packages/kbn-shared-ux-components/src/mdx.d.ts diff --git a/src/plugins/shared_ux/public/components/page_template/index.tsx b/packages/kbn-shared-ux-components/src/page_template/index.ts similarity index 85% rename from src/plugins/shared_ux/public/components/page_template/index.tsx rename to packages/kbn-shared-ux-components/src/page_template/index.ts index 1f686183c2edb..b77bd9cafe0fb 100644 --- a/src/plugins/shared_ux/public/components/page_template/index.tsx +++ b/packages/kbn-shared-ux-components/src/page_template/index.ts @@ -6,4 +6,4 @@ * Side Public License, v 1. */ -export { NoDataCard } from './no_data_page/no_data_card'; +export { NoDataCard } from './no_data_page'; diff --git a/packages/kbn-shared-ux-components/src/page_template/no_data_page/index.ts b/packages/kbn-shared-ux-components/src/page_template/no_data_page/index.ts new file mode 100644 index 0000000000000..8f878379e8236 --- /dev/null +++ b/packages/kbn-shared-ux-components/src/page_template/no_data_page/index.ts @@ -0,0 +1,9 @@ +/* + * 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 { NoDataCard } from './no_data_card'; diff --git a/src/plugins/shared_ux/public/components/page_template/no_data_page/no_data_card/__snapshots__/no_data_card.test.tsx.snap b/packages/kbn-shared-ux-components/src/page_template/no_data_page/no_data_card/__snapshots__/no_data_card.test.tsx.snap similarity index 100% rename from src/plugins/shared_ux/public/components/page_template/no_data_page/no_data_card/__snapshots__/no_data_card.test.tsx.snap rename to packages/kbn-shared-ux-components/src/page_template/no_data_page/no_data_card/__snapshots__/no_data_card.test.tsx.snap diff --git a/src/plugins/shared_ux/public/components/page_template/no_data_page/no_data_card/index.ts b/packages/kbn-shared-ux-components/src/page_template/no_data_page/no_data_card/index.ts similarity index 100% rename from src/plugins/shared_ux/public/components/page_template/no_data_page/no_data_card/index.ts rename to packages/kbn-shared-ux-components/src/page_template/no_data_page/no_data_card/index.ts diff --git a/src/plugins/shared_ux/public/components/page_template/no_data_page/no_data_card/no_data_card.stories.tsx b/packages/kbn-shared-ux-components/src/page_template/no_data_page/no_data_card/no_data_card.stories.tsx similarity index 100% rename from src/plugins/shared_ux/public/components/page_template/no_data_page/no_data_card/no_data_card.stories.tsx rename to packages/kbn-shared-ux-components/src/page_template/no_data_page/no_data_card/no_data_card.stories.tsx diff --git a/src/plugins/shared_ux/public/components/page_template/no_data_page/no_data_card/no_data_card.test.tsx b/packages/kbn-shared-ux-components/src/page_template/no_data_page/no_data_card/no_data_card.test.tsx similarity index 100% rename from src/plugins/shared_ux/public/components/page_template/no_data_page/no_data_card/no_data_card.test.tsx rename to packages/kbn-shared-ux-components/src/page_template/no_data_page/no_data_card/no_data_card.test.tsx diff --git a/src/plugins/shared_ux/public/components/page_template/no_data_page/no_data_card/no_data_card.tsx b/packages/kbn-shared-ux-components/src/page_template/no_data_page/no_data_card/no_data_card.tsx similarity index 100% rename from src/plugins/shared_ux/public/components/page_template/no_data_page/no_data_card/no_data_card.tsx rename to packages/kbn-shared-ux-components/src/page_template/no_data_page/no_data_card/no_data_card.tsx diff --git a/src/plugins/shared_ux/public/components/page_template/no_data_page/no_data_card/types.ts b/packages/kbn-shared-ux-components/src/page_template/no_data_page/no_data_card/types.ts similarity index 100% rename from src/plugins/shared_ux/public/components/page_template/no_data_page/no_data_card/types.ts rename to packages/kbn-shared-ux-components/src/page_template/no_data_page/no_data_card/types.ts diff --git a/packages/kbn-sharedux-components/src/toolbar/index.ts b/packages/kbn-shared-ux-components/src/toolbar/index.ts similarity index 100% rename from packages/kbn-sharedux-components/src/toolbar/index.ts rename to packages/kbn-shared-ux-components/src/toolbar/index.ts diff --git a/packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/__snapshots__/primary.test.tsx.snap b/packages/kbn-shared-ux-components/src/toolbar/solution_toolbar/button/__snapshots__/primary.test.tsx.snap similarity index 100% rename from packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/__snapshots__/primary.test.tsx.snap rename to packages/kbn-shared-ux-components/src/toolbar/solution_toolbar/button/__snapshots__/primary.test.tsx.snap diff --git a/packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/primary.mdx b/packages/kbn-shared-ux-components/src/toolbar/solution_toolbar/button/primary.mdx similarity index 100% rename from packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/primary.mdx rename to packages/kbn-shared-ux-components/src/toolbar/solution_toolbar/button/primary.mdx diff --git a/packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/primary.stories.tsx b/packages/kbn-shared-ux-components/src/toolbar/solution_toolbar/button/primary.stories.tsx similarity index 100% rename from packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/primary.stories.tsx rename to packages/kbn-shared-ux-components/src/toolbar/solution_toolbar/button/primary.stories.tsx diff --git a/packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/primary.test.tsx b/packages/kbn-shared-ux-components/src/toolbar/solution_toolbar/button/primary.test.tsx similarity index 97% rename from packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/primary.test.tsx rename to packages/kbn-shared-ux-components/src/toolbar/solution_toolbar/button/primary.test.tsx index 529917e30ca46..7a24bac571321 100644 --- a/packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/primary.test.tsx +++ b/packages/kbn-shared-ux-components/src/toolbar/solution_toolbar/button/primary.test.tsx @@ -13,7 +13,7 @@ import { SharedUXServicesProvider, SharedUXServices, mockServiceFactories, -} from '@kbn/sharedux-services'; +} from '@kbn/shared-ux-services'; import { SolutionToolbarButton } from './primary'; diff --git a/packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/primary.tsx b/packages/kbn-shared-ux-components/src/toolbar/solution_toolbar/button/primary.tsx similarity index 100% rename from packages/kbn-sharedux-components/src/toolbar/solution_toolbar/button/primary.tsx rename to packages/kbn-shared-ux-components/src/toolbar/solution_toolbar/button/primary.tsx diff --git a/packages/kbn-sharedux-components/tsconfig.json b/packages/kbn-shared-ux-components/tsconfig.json similarity index 100% rename from packages/kbn-sharedux-components/tsconfig.json rename to packages/kbn-shared-ux-components/tsconfig.json diff --git a/packages/kbn-sharedux-services/BUILD.bazel b/packages/kbn-shared-ux-services/BUILD.bazel similarity index 96% rename from packages/kbn-sharedux-services/BUILD.bazel rename to packages/kbn-shared-ux-services/BUILD.bazel index 66dd6dea5209a..5435068eaf515 100755 --- a/packages/kbn-sharedux-services/BUILD.bazel +++ b/packages/kbn-shared-ux-services/BUILD.bazel @@ -2,8 +2,8 @@ load("@npm//@bazel/typescript:index.bzl", "ts_config") load("@build_bazel_rules_nodejs//:index.bzl", "js_library") load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") -PKG_DIRNAME = "kbn-sharedux-services" -PKG_REQUIRE_NAME = "@kbn/sharedux-services" +PKG_DIRNAME = "kbn-shared-ux-services" +PKG_REQUIRE_NAME = "@kbn/shared-ux-services" SOURCE_FILES = glob( [ diff --git a/packages/kbn-shared-ux-services/README.md b/packages/kbn-shared-ux-services/README.md new file mode 100755 index 0000000000000..c5b0cd7f55437 --- /dev/null +++ b/packages/kbn-shared-ux-services/README.md @@ -0,0 +1,3 @@ +# @kbn/shared-ux-services + +> TODO diff --git a/packages/kbn-sharedux-services/jest.config.js b/packages/kbn-shared-ux-services/jest.config.js similarity index 88% rename from packages/kbn-sharedux-services/jest.config.js rename to packages/kbn-shared-ux-services/jest.config.js index 958ae147ec2b8..f1ef008d0f62d 100755 --- a/packages/kbn-sharedux-services/jest.config.js +++ b/packages/kbn-shared-ux-services/jest.config.js @@ -9,5 +9,5 @@ module.exports = { preset: '@kbn/test', rootDir: '../..', - roots: ['/packages/kbn-sharedux-services'], + roots: ['/packages/kbn-shared-ux-services'], }; diff --git a/packages/kbn-sharedux-services/package.json b/packages/kbn-shared-ux-services/package.json similarity index 81% rename from packages/kbn-sharedux-services/package.json rename to packages/kbn-shared-ux-services/package.json index 3f199b0e07c12..64482ab1acfd8 100755 --- a/packages/kbn-sharedux-services/package.json +++ b/packages/kbn-shared-ux-services/package.json @@ -1,8 +1,8 @@ { - "name": "@kbn/sharedux-services", + "name": "@kbn/shared-ux-services", "private": true, "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", "license": "SSPL-1.0 OR Elastic License 2.0" -} +} \ No newline at end of file diff --git a/packages/kbn-sharedux-services/src/index.ts b/packages/kbn-shared-ux-services/src/index.ts similarity index 100% rename from packages/kbn-sharedux-services/src/index.ts rename to packages/kbn-shared-ux-services/src/index.ts diff --git a/packages/kbn-sharedux-services/src/services/doc_links.ts b/packages/kbn-shared-ux-services/src/services/doc_links.ts similarity index 100% rename from packages/kbn-sharedux-services/src/services/doc_links.ts rename to packages/kbn-shared-ux-services/src/services/doc_links.ts diff --git a/packages/kbn-sharedux-services/src/services/editors.ts b/packages/kbn-shared-ux-services/src/services/editors.ts similarity index 100% rename from packages/kbn-sharedux-services/src/services/editors.ts rename to packages/kbn-shared-ux-services/src/services/editors.ts diff --git a/packages/kbn-sharedux-services/src/services/index.tsx b/packages/kbn-shared-ux-services/src/services/index.tsx similarity index 100% rename from packages/kbn-sharedux-services/src/services/index.tsx rename to packages/kbn-shared-ux-services/src/services/index.tsx diff --git a/packages/kbn-sharedux-services/src/services/mocks/doc_links.mock.ts b/packages/kbn-shared-ux-services/src/services/mocks/doc_links.mock.ts similarity index 100% rename from packages/kbn-sharedux-services/src/services/mocks/doc_links.mock.ts rename to packages/kbn-shared-ux-services/src/services/mocks/doc_links.mock.ts diff --git a/packages/kbn-sharedux-services/src/services/mocks/editors.mock.ts b/packages/kbn-shared-ux-services/src/services/mocks/editors.mock.ts similarity index 100% rename from packages/kbn-sharedux-services/src/services/mocks/editors.mock.ts rename to packages/kbn-shared-ux-services/src/services/mocks/editors.mock.ts diff --git a/packages/kbn-sharedux-services/src/services/mocks/index.ts b/packages/kbn-shared-ux-services/src/services/mocks/index.ts similarity index 97% rename from packages/kbn-sharedux-services/src/services/mocks/index.ts rename to packages/kbn-shared-ux-services/src/services/mocks/index.ts index ec369338edba0..da7bda80f4ee4 100644 --- a/packages/kbn-sharedux-services/src/services/mocks/index.ts +++ b/packages/kbn-shared-ux-services/src/services/mocks/index.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import type { SharedUXServices } from '../.'; +import type { SharedUXServices } from '..'; import { ServiceFactory } from '../types'; import { docLinksServiceFactory } from './doc_links.mock'; diff --git a/packages/kbn-sharedux-services/src/services/mocks/permissions.mock.ts b/packages/kbn-shared-ux-services/src/services/mocks/permissions.mock.ts similarity index 100% rename from packages/kbn-sharedux-services/src/services/mocks/permissions.mock.ts rename to packages/kbn-shared-ux-services/src/services/mocks/permissions.mock.ts diff --git a/packages/kbn-sharedux-services/src/services/mocks/platform.mock.ts b/packages/kbn-shared-ux-services/src/services/mocks/platform.mock.ts similarity index 100% rename from packages/kbn-sharedux-services/src/services/mocks/platform.mock.ts rename to packages/kbn-shared-ux-services/src/services/mocks/platform.mock.ts diff --git a/packages/kbn-sharedux-services/src/services/permissions.ts b/packages/kbn-shared-ux-services/src/services/permissions.ts similarity index 100% rename from packages/kbn-sharedux-services/src/services/permissions.ts rename to packages/kbn-shared-ux-services/src/services/permissions.ts diff --git a/packages/kbn-sharedux-services/src/services/platform.ts b/packages/kbn-shared-ux-services/src/services/platform.ts similarity index 100% rename from packages/kbn-sharedux-services/src/services/platform.ts rename to packages/kbn-shared-ux-services/src/services/platform.ts diff --git a/packages/kbn-sharedux-services/src/services/stub/doc_links.ts b/packages/kbn-shared-ux-services/src/services/stub/doc_links.ts similarity index 100% rename from packages/kbn-sharedux-services/src/services/stub/doc_links.ts rename to packages/kbn-shared-ux-services/src/services/stub/doc_links.ts diff --git a/packages/kbn-sharedux-services/src/services/stub/editors.ts b/packages/kbn-shared-ux-services/src/services/stub/editors.ts similarity index 100% rename from packages/kbn-sharedux-services/src/services/stub/editors.ts rename to packages/kbn-shared-ux-services/src/services/stub/editors.ts diff --git a/packages/kbn-sharedux-services/src/services/stub/index.ts b/packages/kbn-shared-ux-services/src/services/stub/index.ts similarity index 96% rename from packages/kbn-sharedux-services/src/services/stub/index.ts rename to packages/kbn-shared-ux-services/src/services/stub/index.ts index 70a71bce74409..cfd6d73f2f775 100644 --- a/packages/kbn-sharedux-services/src/services/stub/index.ts +++ b/packages/kbn-shared-ux-services/src/services/stub/index.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import type { SharedUXServices } from '../.'; +import type { SharedUXServices } from '..'; import { ServiceFactory } from '../types'; import { platformServiceFactory } from './platform'; import { userPermissionsServiceFactory } from './permissions'; diff --git a/packages/kbn-sharedux-services/src/services/stub/permissions.ts b/packages/kbn-shared-ux-services/src/services/stub/permissions.ts similarity index 100% rename from packages/kbn-sharedux-services/src/services/stub/permissions.ts rename to packages/kbn-shared-ux-services/src/services/stub/permissions.ts diff --git a/packages/kbn-sharedux-services/src/services/stub/platform.ts b/packages/kbn-shared-ux-services/src/services/stub/platform.ts similarity index 100% rename from packages/kbn-sharedux-services/src/services/stub/platform.ts rename to packages/kbn-shared-ux-services/src/services/stub/platform.ts diff --git a/packages/kbn-sharedux-services/src/services/types.ts b/packages/kbn-shared-ux-services/src/services/types.ts similarity index 100% rename from packages/kbn-sharedux-services/src/services/types.ts rename to packages/kbn-shared-ux-services/src/services/types.ts diff --git a/packages/kbn-sharedux-services/src/types.ts b/packages/kbn-shared-ux-services/src/types.ts similarity index 100% rename from packages/kbn-sharedux-services/src/types.ts rename to packages/kbn-shared-ux-services/src/types.ts diff --git a/packages/kbn-sharedux-services/tsconfig.json b/packages/kbn-shared-ux-services/tsconfig.json similarity index 100% rename from packages/kbn-sharedux-services/tsconfig.json rename to packages/kbn-shared-ux-services/tsconfig.json diff --git a/packages/kbn-sharedux-storybook/BUILD.bazel b/packages/kbn-shared-ux-storybook/BUILD.bazel similarity index 93% rename from packages/kbn-sharedux-storybook/BUILD.bazel rename to packages/kbn-shared-ux-storybook/BUILD.bazel index 495376e3bc895..ca73cf97be376 100644 --- a/packages/kbn-sharedux-storybook/BUILD.bazel +++ b/packages/kbn-shared-ux-storybook/BUILD.bazel @@ -2,8 +2,8 @@ load("@npm//@bazel/typescript:index.bzl", "ts_config") load("@build_bazel_rules_nodejs//:index.bzl", "js_library") load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") -PKG_DIRNAME = "kbn-sharedux-storybook" -PKG_REQUIRE_NAME = "@kbn/sharedux-storybook" +PKG_DIRNAME = "kbn-shared-ux-storybook" +PKG_REQUIRE_NAME = "@kbn/shared-ux-storybook" SOURCE_FILES = glob( [ @@ -37,7 +37,7 @@ NPM_MODULE_EXTRA_FILES = [ # "@npm//name-of-package" # eg. "@npm//lodash" RUNTIME_DEPS = [ - "//packages/kbn-sharedux-services", + "//packages/kbn-shared-ux-services", "//packages/kbn-storybook", "@npm//@storybook/react", ] @@ -55,7 +55,7 @@ TYPES_DEPS = [ "@npm//@types/node", "@npm//@types/jest", "@npm//@storybook/react", - "//packages/kbn-sharedux-services:npm_module_types", + "//packages/kbn-shared-ux-services:npm_module_types", "//packages/kbn-storybook:npm_module_types", ] diff --git a/packages/kbn-shared-ux-storybook/README.md b/packages/kbn-shared-ux-storybook/README.md new file mode 100644 index 0000000000000..23e1c9e0d9a33 --- /dev/null +++ b/packages/kbn-shared-ux-storybook/README.md @@ -0,0 +1,3 @@ +# @kbn/shared-ux-storybook + +> TODO \ No newline at end of file diff --git a/packages/kbn-sharedux-components/jest.config.js b/packages/kbn-shared-ux-storybook/jest.config.js similarity index 88% rename from packages/kbn-sharedux-components/jest.config.js rename to packages/kbn-shared-ux-storybook/jest.config.js index 7b9210a3ab79b..91285e025f069 100644 --- a/packages/kbn-sharedux-components/jest.config.js +++ b/packages/kbn-shared-ux-storybook/jest.config.js @@ -9,5 +9,5 @@ module.exports = { preset: '@kbn/test', rootDir: '../..', - roots: ['/packages/kbn-sharedux-components'], + roots: ['/packages/kbn-shared-ux-storybook'], }; diff --git a/packages/kbn-sharedux-storybook/package.json b/packages/kbn-shared-ux-storybook/package.json similarity index 80% rename from packages/kbn-sharedux-storybook/package.json rename to packages/kbn-shared-ux-storybook/package.json index 372bc054c2e1a..6fd5ed95f98d0 100644 --- a/packages/kbn-sharedux-storybook/package.json +++ b/packages/kbn-shared-ux-storybook/package.json @@ -1,8 +1,8 @@ { - "name": "@kbn/sharedux-storybook", + "name": "@kbn/shared-ux-storybook", "private": true, "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", "license": "SSPL-1.0 OR Elastic License 2.0" -} +} \ No newline at end of file diff --git a/packages/kbn-sharedux-storybook/src/decorators.tsx b/packages/kbn-shared-ux-storybook/src/decorators.tsx similarity index 91% rename from packages/kbn-sharedux-storybook/src/decorators.tsx rename to packages/kbn-shared-ux-storybook/src/decorators.tsx index 07372ea3242be..542ff86db6269 100644 --- a/packages/kbn-sharedux-storybook/src/decorators.tsx +++ b/packages/kbn-shared-ux-storybook/src/decorators.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { DecoratorFn } from '@storybook/react'; -import { SharedUXServicesProvider } from '@kbn/sharedux-services'; +import { SharedUXServicesProvider } from '@kbn/shared-ux-services'; import { servicesFactory } from './services'; /** diff --git a/packages/kbn-sharedux-storybook/src/file_system_cache.d.ts b/packages/kbn-shared-ux-storybook/src/file_system_cache.d.ts similarity index 100% rename from packages/kbn-sharedux-storybook/src/file_system_cache.d.ts rename to packages/kbn-shared-ux-storybook/src/file_system_cache.d.ts diff --git a/packages/kbn-sharedux-storybook/src/index.ts b/packages/kbn-shared-ux-storybook/src/index.ts similarity index 100% rename from packages/kbn-sharedux-storybook/src/index.ts rename to packages/kbn-shared-ux-storybook/src/index.ts diff --git a/packages/kbn-sharedux-storybook/src/mdx.d.ts b/packages/kbn-shared-ux-storybook/src/mdx.d.ts similarity index 100% rename from packages/kbn-sharedux-storybook/src/mdx.d.ts rename to packages/kbn-shared-ux-storybook/src/mdx.d.ts diff --git a/packages/kbn-sharedux-storybook/src/services/doc_links.ts b/packages/kbn-shared-ux-storybook/src/services/doc_links.ts similarity index 97% rename from packages/kbn-sharedux-storybook/src/services/doc_links.ts rename to packages/kbn-shared-ux-storybook/src/services/doc_links.ts index aab2b61b5555f..2d4699e705700 100644 --- a/packages/kbn-sharedux-storybook/src/services/doc_links.ts +++ b/packages/kbn-shared-ux-storybook/src/services/doc_links.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { ServiceFactory, SharedUXDocLinksService } from '@kbn/sharedux-services'; +import { ServiceFactory, SharedUXDocLinksService } from '@kbn/shared-ux-services'; export type SharedUXDocLinksServiceFactory = ServiceFactory; diff --git a/packages/kbn-sharedux-storybook/src/services/editors.ts b/packages/kbn-shared-ux-storybook/src/services/editors.ts similarity index 97% rename from packages/kbn-sharedux-storybook/src/services/editors.ts rename to packages/kbn-shared-ux-storybook/src/services/editors.ts index ad9d34e2cac11..3da4159836c45 100644 --- a/packages/kbn-sharedux-storybook/src/services/editors.ts +++ b/packages/kbn-shared-ux-storybook/src/services/editors.ts @@ -7,7 +7,7 @@ */ import { action } from '@storybook/addon-actions'; -import { ServiceFactory, SharedUXEditorsService } from '@kbn/sharedux-services'; +import { ServiceFactory, SharedUXEditorsService } from '@kbn/shared-ux-services'; export type SharedUXEditorsServiceFactory = ServiceFactory; diff --git a/packages/kbn-sharedux-storybook/src/services/index.ts b/packages/kbn-shared-ux-storybook/src/services/index.ts similarity index 93% rename from packages/kbn-sharedux-storybook/src/services/index.ts rename to packages/kbn-shared-ux-storybook/src/services/index.ts index ae81b19665de9..6d9150496843f 100644 --- a/packages/kbn-sharedux-storybook/src/services/index.ts +++ b/packages/kbn-shared-ux-storybook/src/services/index.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { ServiceFactory, SharedUXServices } from '@kbn/sharedux-services'; +import { ServiceFactory, SharedUXServices } from '@kbn/shared-ux-services'; import { platformServiceFactory } from './platform'; import { editorsServiceFactory } from './editors'; diff --git a/packages/kbn-sharedux-storybook/src/services/permissions.ts b/packages/kbn-shared-ux-storybook/src/services/permissions.ts similarity index 96% rename from packages/kbn-sharedux-storybook/src/services/permissions.ts rename to packages/kbn-shared-ux-storybook/src/services/permissions.ts index 8a49dbfaaf3a5..9fa40c013dcd2 100644 --- a/packages/kbn-sharedux-storybook/src/services/permissions.ts +++ b/packages/kbn-shared-ux-storybook/src/services/permissions.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { ServiceFactory, SharedUXUserPermissionsService } from '@kbn/sharedux-services'; +import { ServiceFactory, SharedUXUserPermissionsService } from '@kbn/shared-ux-services'; export type SharedUXUserPermissionsServiceFactory = ServiceFactory; diff --git a/packages/kbn-sharedux-storybook/src/services/platform.ts b/packages/kbn-shared-ux-storybook/src/services/platform.ts similarity index 97% rename from packages/kbn-sharedux-storybook/src/services/platform.ts rename to packages/kbn-shared-ux-storybook/src/services/platform.ts index af977d46b818e..052037f6c4874 100644 --- a/packages/kbn-sharedux-storybook/src/services/platform.ts +++ b/packages/kbn-shared-ux-storybook/src/services/platform.ts @@ -7,7 +7,7 @@ */ import { action } from '@storybook/addon-actions'; -import { ServiceFactory, SharedUXPlatformService } from '@kbn/sharedux-services'; +import { ServiceFactory, SharedUXPlatformService } from '@kbn/shared-ux-services'; /** * A factory function for creating a Storybook-based implementation of `SharedUXPlatformService`. diff --git a/packages/kbn-sharedux-storybook/src/storybook/main.ts b/packages/kbn-shared-ux-storybook/src/storybook/main.ts similarity index 100% rename from packages/kbn-sharedux-storybook/src/storybook/main.ts rename to packages/kbn-shared-ux-storybook/src/storybook/main.ts diff --git a/packages/kbn-sharedux-storybook/src/storybook/manager.ts b/packages/kbn-shared-ux-storybook/src/storybook/manager.ts similarity index 100% rename from packages/kbn-sharedux-storybook/src/storybook/manager.ts rename to packages/kbn-shared-ux-storybook/src/storybook/manager.ts diff --git a/packages/kbn-sharedux-storybook/src/storybook/preview.ts b/packages/kbn-shared-ux-storybook/src/storybook/preview.ts similarity index 100% rename from packages/kbn-sharedux-storybook/src/storybook/preview.ts rename to packages/kbn-shared-ux-storybook/src/storybook/preview.ts diff --git a/packages/kbn-sharedux-storybook/tsconfig.json b/packages/kbn-shared-ux-storybook/tsconfig.json similarity index 100% rename from packages/kbn-sharedux-storybook/tsconfig.json rename to packages/kbn-shared-ux-storybook/tsconfig.json diff --git a/packages/kbn-sharedux-utility/BUILD.bazel b/packages/kbn-shared-ux-utility/BUILD.bazel similarity index 96% rename from packages/kbn-sharedux-utility/BUILD.bazel rename to packages/kbn-shared-ux-utility/BUILD.bazel index 39ddb60397eab..35f81e51e7d9e 100644 --- a/packages/kbn-sharedux-utility/BUILD.bazel +++ b/packages/kbn-shared-ux-utility/BUILD.bazel @@ -2,8 +2,8 @@ load("@npm//@bazel/typescript:index.bzl", "ts_config") load("@build_bazel_rules_nodejs//:index.bzl", "js_library") load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") -PKG_DIRNAME = "kbn-sharedux-utility" -PKG_REQUIRE_NAME = "@kbn/sharedux-utility" +PKG_DIRNAME = "kbn-shared-ux-utility" +PKG_REQUIRE_NAME = "@kbn/shared-ux-utility" SOURCE_FILES = glob( [ diff --git a/packages/kbn-sharedux-utility/README.md b/packages/kbn-shared-ux-utility/README.md similarity index 62% rename from packages/kbn-sharedux-utility/README.md rename to packages/kbn-shared-ux-utility/README.md index ffff4d29abc52..872a43ecbfff0 100644 --- a/packages/kbn-sharedux-utility/README.md +++ b/packages/kbn-shared-ux-utility/README.md @@ -1,3 +1,3 @@ -# @kbn/sharedux-utility +# @kbn/shared-ux-utility Empty package generated by @kbn/generate diff --git a/packages/kbn-sharedux-utility/jest.config.js b/packages/kbn-shared-ux-utility/jest.config.js similarity index 88% rename from packages/kbn-sharedux-utility/jest.config.js rename to packages/kbn-shared-ux-utility/jest.config.js index 9bfda8df3b8f3..3696855dc86b5 100644 --- a/packages/kbn-sharedux-utility/jest.config.js +++ b/packages/kbn-shared-ux-utility/jest.config.js @@ -9,5 +9,5 @@ module.exports = { preset: '@kbn/test', rootDir: '../..', - roots: ['/packages/kbn-sharedux-utility'], + roots: ['/packages/kbn-shared-ux-utility'], }; diff --git a/packages/kbn-sharedux-utility/package.json b/packages/kbn-shared-ux-utility/package.json similarity index 81% rename from packages/kbn-sharedux-utility/package.json rename to packages/kbn-shared-ux-utility/package.json index 5342afb96bd00..6bbddc369956a 100644 --- a/packages/kbn-sharedux-utility/package.json +++ b/packages/kbn-shared-ux-utility/package.json @@ -1,8 +1,8 @@ { - "name": "@kbn/sharedux-utility", + "name": "@kbn/shared-ux-utility", "private": true, "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", "license": "SSPL-1.0 OR Elastic License 2.0" -} +} \ No newline at end of file diff --git a/packages/kbn-sharedux-utility/src/fallback.tsx b/packages/kbn-shared-ux-utility/src/fallback.tsx similarity index 100% rename from packages/kbn-sharedux-utility/src/fallback.tsx rename to packages/kbn-shared-ux-utility/src/fallback.tsx diff --git a/packages/kbn-sharedux-utility/src/index.ts b/packages/kbn-shared-ux-utility/src/index.ts similarity index 100% rename from packages/kbn-sharedux-utility/src/index.ts rename to packages/kbn-shared-ux-utility/src/index.ts diff --git a/packages/kbn-sharedux-utility/src/with_suspense.tsx b/packages/kbn-shared-ux-utility/src/with_suspense.tsx similarity index 100% rename from packages/kbn-sharedux-utility/src/with_suspense.tsx rename to packages/kbn-shared-ux-utility/src/with_suspense.tsx diff --git a/packages/kbn-sharedux-utility/tsconfig.json b/packages/kbn-shared-ux-utility/tsconfig.json similarity index 100% rename from packages/kbn-sharedux-utility/tsconfig.json rename to packages/kbn-shared-ux-utility/tsconfig.json diff --git a/packages/kbn-sharedux-services/README.md b/packages/kbn-sharedux-services/README.md deleted file mode 100755 index aed68c689add5..0000000000000 --- a/packages/kbn-sharedux-services/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# @kbn/sharedux-services - -> TODO diff --git a/packages/kbn-sharedux-storybook/README.md b/packages/kbn-sharedux-storybook/README.md deleted file mode 100644 index 56c2831c9948d..0000000000000 --- a/packages/kbn-sharedux-storybook/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# @kbn/sharedux-storybook - -> TODO \ No newline at end of file diff --git a/src/dev/storybook/aliases.ts b/src/dev/storybook/aliases.ts index 04bdab6a84c70..48593db20256b 100644 --- a/src/dev/storybook/aliases.ts +++ b/src/dev/storybook/aliases.ts @@ -35,6 +35,6 @@ export const storybookAliases = { observability: 'x-pack/plugins/observability/.storybook', presentation: 'src/plugins/presentation_util/storybook', security_solution: 'x-pack/plugins/security_solution/.storybook', - shared_ux: 'packages/kbn-sharedux-storybook/src/storybook', + shared_ux: 'packages/kbn-shared-ux-storybook/src/storybook', ui_actions_enhanced: 'x-pack/plugins/ui_actions_enhanced/.storybook', }; diff --git a/src/plugins/shared_ux/kibana.json b/src/plugins/shared_ux/kibana.json index 44aeeb9cf80fc..212a99e46ebc7 100755 --- a/src/plugins/shared_ux/kibana.json +++ b/src/plugins/shared_ux/kibana.json @@ -9,6 +9,9 @@ "description": "A plugin providing components and services for shared user experiences in Kibana.", "server": true, "ui": true, - "requiredPlugins": [], + "requiredPlugins": [ + "dataViewEditor", + "dataViews" + ], "optionalPlugins": [] } diff --git a/src/plugins/shared_ux/public/index.ts b/src/plugins/shared_ux/public/index.ts index b035983b4d765..6757e6a42e43f 100755 --- a/src/plugins/shared_ux/public/index.ts +++ b/src/plugins/shared_ux/public/index.ts @@ -21,4 +21,4 @@ export { LazyExitFullScreenButton, NoDataViews, LazyNoDataViews, -} from '@kbn/sharedux-components'; +} from '@kbn/shared-ux-components'; diff --git a/src/plugins/shared_ux/public/plugin.tsx b/src/plugins/shared_ux/public/plugin.tsx index b20f7161eb0f9..fb3495342e5f0 100755 --- a/src/plugins/shared_ux/public/plugin.tsx +++ b/src/plugins/shared_ux/public/plugin.tsx @@ -8,7 +8,7 @@ import React from 'react'; -import { SharedUXServicesProvider } from '@kbn/sharedux-services'; +import { SharedUXServicesProvider } from '@kbn/shared-ux-services'; import { CoreSetup, CoreStart, Plugin } from '../../../core/public'; import { diff --git a/src/plugins/shared_ux/public/services/doc_links.ts b/src/plugins/shared_ux/public/services/doc_links.ts index be67ee4632377..21103f07464e9 100644 --- a/src/plugins/shared_ux/public/services/doc_links.ts +++ b/src/plugins/shared_ux/public/services/doc_links.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { SharedUXDocLinksService } from '@kbn/sharedux-services'; +import { SharedUXDocLinksService } from '@kbn/shared-ux-services'; import { KibanaPluginServiceFactory } from './types'; import { SharedUXPluginStartDeps } from '../types'; diff --git a/src/plugins/shared_ux/public/services/editors.ts b/src/plugins/shared_ux/public/services/editors.ts index afac6e19092e6..704aca66fc380 100644 --- a/src/plugins/shared_ux/public/services/editors.ts +++ b/src/plugins/shared_ux/public/services/editors.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { SharedUXEditorsService } from '@kbn/sharedux-services'; +import { SharedUXEditorsService } from '@kbn/shared-ux-services'; import { KibanaPluginServiceFactory } from './types'; import { SharedUXPluginStartDeps } from '../types'; diff --git a/src/plugins/shared_ux/public/services/index.ts b/src/plugins/shared_ux/public/services/index.ts index 47d01bbb9881c..2b4c19cbc57c5 100644 --- a/src/plugins/shared_ux/public/services/index.ts +++ b/src/plugins/shared_ux/public/services/index.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { SharedUXServices } from '@kbn/sharedux-services'; +import { SharedUXServices } from '@kbn/shared-ux-services'; import type { SharedUXPluginStartDeps } from '../types'; import type { KibanaPluginServiceFactory } from './types'; diff --git a/src/plugins/shared_ux/public/services/permissions.ts b/src/plugins/shared_ux/public/services/permissions.ts index 2d23d8c78caa1..7460f4aa7e883 100644 --- a/src/plugins/shared_ux/public/services/permissions.ts +++ b/src/plugins/shared_ux/public/services/permissions.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { SharedUXUserPermissionsService } from '@kbn/sharedux-services'; +import { SharedUXUserPermissionsService } from '@kbn/shared-ux-services'; import { KibanaPluginServiceFactory } from './types'; import { SharedUXPluginStartDeps } from '../types'; diff --git a/src/plugins/shared_ux/public/services/platform.ts b/src/plugins/shared_ux/public/services/platform.ts index 5db66dd7d2968..5201a038a74d5 100644 --- a/src/plugins/shared_ux/public/services/platform.ts +++ b/src/plugins/shared_ux/public/services/platform.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import { SharedUXPlatformService } from '@kbn/sharedux-services'; +import { SharedUXPlatformService } from '@kbn/shared-ux-services'; import { SharedUXPluginStartDeps } from '../types'; import { KibanaPluginServiceFactory } from './types'; diff --git a/yarn.lock b/yarn.lock index fffb810b962c6..274fd7c75558c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3117,19 +3117,19 @@ version "0.0.0" uid "" -"@kbn/sharedux-components@link:bazel-bin/packages/kbn-sharedux-components": +"@kbn/shared-ux-components@link:bazel-bin/packages/kbn-shared-ux-components": version "0.0.0" uid "" -"@kbn/sharedux-services@link:bazel-bin/packages/kbn-sharedux-services": +"@kbn/shared-ux-services@link:bazel-bin/packages/kbn-shared-ux-services": version "0.0.0" uid "" -"@kbn/sharedux-storybook@link:bazel-bin/packages/kbn-sharedux-storybook": +"@kbn/shared-ux-storybook@link:bazel-bin/packages/kbn-shared-ux-storybook": version "0.0.0" uid "" -"@kbn/sharedux-utility@link:bazel-bin/packages/kbn-sharedux-utility": +"@kbn/shared-ux-utility@link:bazel-bin/packages/kbn-shared-ux-utility": version "0.0.0" uid "" @@ -6102,19 +6102,19 @@ version "0.0.0" uid "" -"@types/kbn__sharedux-components@link:bazel-bin/packages/kbn-sharedux-components/npm_module_types": +"@types/kbn__shared-ux-components@link:bazel-bin/packages/kbn-shared-ux-components/npm_module_types": version "0.0.0" uid "" -"@types/kbn__sharedux-services@link:bazel-bin/packages/kbn-sharedux-services/npm_module_types": +"@types/kbn__shared-ux-services@link:bazel-bin/packages/kbn-shared-ux-services/npm_module_types": version "0.0.0" uid "" -"@types/kbn__sharedux-storybook@link:bazel-bin/packages/kbn-sharedux-storybook/npm_module_types": +"@types/kbn__shared-ux-storybook@link:bazel-bin/packages/kbn-shared-ux-storybook/npm_module_types": version "0.0.0" uid "" -"@types/kbn__sharedux-utility@link:bazel-bin/packages/kbn-sharedux-utility/npm_module_types": +"@types/kbn__shared-ux-utility@link:bazel-bin/packages/kbn-shared-ux-utility/npm_module_types": version "0.0.0" uid "" From 08101597bbd0249d318626f3f17333331f96a03d Mon Sep 17 00:00:00 2001 From: Clint Andrew Hall Date: Thu, 10 Mar 2022 21:15:30 -0600 Subject: [PATCH 7/9] Tweak BAZEL and service --- packages/kbn-shared-ux-components/BUILD.bazel | 4 ++++ .../kbn-shared-ux-services/src/services/editors.ts | 10 ++++++---- packages/kbn-shared-ux-storybook/src/storybook/main.ts | 6 ++---- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/packages/kbn-shared-ux-components/BUILD.bazel b/packages/kbn-shared-ux-components/BUILD.bazel index 4efbeefc1d7cc..5d404d17524c5 100644 --- a/packages/kbn-shared-ux-components/BUILD.bazel +++ b/packages/kbn-shared-ux-components/BUILD.bazel @@ -87,6 +87,10 @@ jsts_transpiler( srcs = SRCS, build_pkg_name = package_name(), web = True, + additional_args = [ + "--copy-files", + "--quiet" + ], ) ts_config( diff --git a/packages/kbn-shared-ux-services/src/services/editors.ts b/packages/kbn-shared-ux-services/src/services/editors.ts index b4a472d7699aa..969a7fc996270 100644 --- a/packages/kbn-shared-ux-services/src/services/editors.ts +++ b/packages/kbn-shared-ux-services/src/services/editors.ts @@ -6,10 +6,12 @@ * Side Public License, v 1. */ -export interface DataViewEditorOptions { - onSave: (dataView: TDataView) => void; +type DataView = unknown; + +export interface DataViewEditorOptions { + onSave: (dataView: DataView) => void; } -export interface SharedUXEditorsService { - openDataViewEditor: (options: DataViewEditorOptions) => () => void; +export interface SharedUXEditorsService { + openDataViewEditor: (options: DataViewEditorOptions) => () => void; } diff --git a/packages/kbn-shared-ux-storybook/src/storybook/main.ts b/packages/kbn-shared-ux-storybook/src/storybook/main.ts index 3b931b81eb0df..1981ff546c353 100644 --- a/packages/kbn-shared-ux-storybook/src/storybook/main.ts +++ b/packages/kbn-shared-ux-storybook/src/storybook/main.ts @@ -11,9 +11,7 @@ import { defaultConfig } from '@kbn/storybook'; module.exports = { ...defaultConfig, stories: [ - '../../../kbn-sharedux*/**/*.stories.tsx', - '../../../kbn-sharedux*/**/*.stories.mdx', - '../../../../src/plugins/shared_ux/**/*.stories.tsx', - '../../../../src/plugins/shared_ux/**/*.stories.mdx', + '../../../kbn-shared-ux*/**/*.stories.+(tsx|mdx)', + '../../../../src/plugins/shared_ux/**/*.stories.+(tsx|mdx)', ], }; From 42f3b3375df123e989f972adf36ba0c1d9aaef59 Mon Sep 17 00:00:00 2001 From: Clint Andrew Hall Date: Thu, 10 Mar 2022 22:22:21 -0600 Subject: [PATCH 8/9] i18n --- .i18nrc.json | 1 + packages/kbn-shared-ux-components/BUILD.bazel | 20 +++++++++---------- .../no_data_views/documentation_link.tsx | 4 ++-- .../no_data_views/no_data_views.component.tsx | 8 ++++---- .../exit_full_screen_button.component.tsx | 18 +++++++++++------ .../no_data_card/no_data_card.tsx | 18 +++++++++++------ .../translations/translations/ja-JP.json | 4 ++-- .../translations/translations/zh-CN.json | 4 ++-- 8 files changed, 45 insertions(+), 32 deletions(-) diff --git a/.i18nrc.json b/.i18nrc.json index eeb2578ef3472..402932902f249 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -60,6 +60,7 @@ "server": "src/legacy/server", "share": "src/plugins/share", "sharedUX": "src/plugins/shared_ux", + "sharedUXComponents": "packages/kbn-shared-ux-components/src", "statusPage": "src/legacy/core_plugins/status_page", "telemetry": ["src/plugins/telemetry", "src/plugins/telemetry_management_section"], "timelion": ["src/plugins/vis_types/timelion"], diff --git a/packages/kbn-shared-ux-components/BUILD.bazel b/packages/kbn-shared-ux-components/BUILD.bazel index 5d404d17524c5..2f49ed78f2609 100644 --- a/packages/kbn-shared-ux-components/BUILD.bazel +++ b/packages/kbn-shared-ux-components/BUILD.bazel @@ -38,17 +38,17 @@ NPM_MODULE_EXTRA_FILES = [ # "@npm//name-of-package" # eg. "@npm//lodash" RUNTIME_DEPS = [ + "//packages/kbn-i18n", + "//packages/kbn-i18n-react", + "//packages/kbn-shared-ux-services", + "//packages/kbn-shared-ux-storybook", + "//packages/kbn-shared-ux-utility", "@npm//react", "@npm//@elastic/eui", "@npm//@emotion/react", "@npm//@emotion/css", "@npm//classnames", "@npm//@storybook/addon-actions", - "//packages/kbn-shared-ux-services", - "//packages/kbn-shared-ux-storybook", - "//packages/kbn-shared-ux-utility", - "//packages/kbn-i18n", - "//packages/kbn-i18n-react", ] # In this array place dependencies necessary to build the types, which will include the @@ -61,6 +61,11 @@ RUNTIME_DEPS = [ # # References to NPM packages work the same as RUNTIME_DEPS TYPES_DEPS = [ + "//packages/kbn-i18n:npm_module_types", + "//packages/kbn-i18n-react:npm_module_types", + "//packages/kbn-shared-ux-services:npm_module_types", + "//packages/kbn-shared-ux-storybook:npm_module_types", + "//packages/kbn-shared-ux-utility:npm_module_types", "@npm//@types/node", "@npm//@types/jest", "@npm//@types/react", @@ -69,11 +74,6 @@ TYPES_DEPS = [ "@npm//@emotion/css", "@npm//@storybook/addon-actions", "@npm//@types/classnames", - "//packages/kbn-shared-ux-services:npm_module_types", - "//packages/kbn-shared-ux-storybook:npm_module_types", - "//packages/kbn-shared-ux-utility:npm_module_types", - "//packages/kbn-i18n:npm_module_types", - "//packages/kbn-i18n-react:npm_module_types", ] jsts_transpiler( diff --git a/packages/kbn-shared-ux-components/src/empty_state/no_data_views/documentation_link.tsx b/packages/kbn-shared-ux-components/src/empty_state/no_data_views/documentation_link.tsx index 4ac07899fef5f..3b3e742ea74ce 100644 --- a/packages/kbn-shared-ux-components/src/empty_state/no_data_views/documentation_link.tsx +++ b/packages/kbn-shared-ux-components/src/empty_state/no_data_views/documentation_link.tsx @@ -20,7 +20,7 @@ export function DocumentationLink({ href }: Props) {
@@ -29,7 +29,7 @@ export function DocumentationLink({ href }: Props) {
diff --git a/packages/kbn-shared-ux-components/src/empty_state/no_data_views/no_data_views.component.tsx b/packages/kbn-shared-ux-components/src/empty_state/no_data_views/no_data_views.component.tsx index bfab91ef03b26..bffa7c2a5269c 100644 --- a/packages/kbn-shared-ux-components/src/empty_state/no_data_views/no_data_views.component.tsx +++ b/packages/kbn-shared-ux-components/src/empty_state/no_data_views/no_data_views.component.tsx @@ -23,7 +23,7 @@ export interface Props { emptyPromptColor?: EuiEmptyPromptProps['color']; } -const createDataViewText = i18n.translate('sharedUX.noDataViewsPage.addDataViewText', { +const createDataViewText = i18n.translate('sharedUXComponents.noDataViewsPage.addDataViewText', { defaultMessage: 'Create Data View', }); @@ -62,12 +62,12 @@ export const NoDataViews = ({ title={


@@ -75,7 +75,7 @@ export const NoDataViews = ({ body={

Date: Thu, 10 Mar 2022 23:34:51 -0600 Subject: [PATCH 9/9] i18n snapshots --- .../__snapshots__/documentation_link.test.tsx.snap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/kbn-shared-ux-components/src/empty_state/no_data_views/__snapshots__/documentation_link.test.tsx.snap b/packages/kbn-shared-ux-components/src/empty_state/no_data_views/__snapshots__/documentation_link.test.tsx.snap index 5526b78bceb73..e84b997d8df87 100644 --- a/packages/kbn-shared-ux-components/src/empty_state/no_data_views/__snapshots__/documentation_link.test.tsx.snap +++ b/packages/kbn-shared-ux-components/src/empty_state/no_data_views/__snapshots__/documentation_link.test.tsx.snap @@ -10,7 +10,7 @@ exports[` is rendered correctly 1`] = ` > @@ -26,7 +26,7 @@ exports[` is rendered correctly 1`] = ` >