-
- Press Enter to start editing.
-
-
- When you’re done, press Escape to stop editing.
-
-
`
- );
-
- const uiAceTextbox = element.find('textarea');
-
- function startEditing() {
- // We are not using ng-class in the element, so that we won't need to $compile it
- hint.addClass('kbnUiAceKeyboardHint-isInactive');
- uiAceTextbox.focus();
- }
-
- function enableOverlay() {
- hint.removeClass('kbnUiAceKeyboardHint-isInactive');
- }
-
- hint.keydown((ev) => {
- if (ev.key === keys.ENTER) {
- ev.preventDefault();
- startEditing();
- }
- });
-
- uiAceTextbox.blur(() => {
- enableOverlay();
- });
-
- let isAutoCompleterOpen;
-
- // We have to capture this event on the 'capture' phase, otherwise Ace will have already
- // dismissed the autocompleter when the user hits ESC.
- document.addEventListener(
- 'keydown',
- () => {
- const autoCompleter = document.querySelector('.ace_autocomplete');
-
- if (!autoCompleter) {
- isAutoCompleterOpen = false;
- return;
- }
-
- // The autoComplete is just hidden when it's closed, not removed from the DOM.
- isAutoCompleterOpen = autoCompleter.style.display !== 'none';
- },
- { capture: true }
- );
-
- uiAceTextbox.keydown((ev) => {
- if (ev.key === keys.ESCAPE) {
- // If the autocompletion context menu is open then we want to let ESC close it but
- // **not** exit out of editing mode.
- if (!isAutoCompleterOpen) {
- ev.preventDefault();
- ev.stopPropagation();
- enableOverlay();
- hint.focus();
- }
- }
- });
-
- hint.click(startEditing);
- // Prevent tabbing into the ACE textarea, we now handle all focusing for it
- uiAceTextbox.attr('tabindex', '-1');
- element.prepend(hint);
- },
- }))
- .directive('kbnUiAceKeyboardMode', (kbnUiAceKeyboardModeService) => ({
- restrict: 'A',
- link(scope, element) {
- kbnUiAceKeyboardModeService.initialize(scope, element);
- },
- }));
diff --git a/src/legacy/ui/public/accessibility/scrollto_activedescendant.js b/src/legacy/ui/public/accessibility/scrollto_activedescendant.js
deleted file mode 100644
index 1034cb1df3dda..0000000000000
--- a/src/legacy/ui/public/accessibility/scrollto_activedescendant.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * This directive can be applied to an element, that has also aria-activedescendant applied.
- * It will make sure, that whenever aria-activedescendant changes, the new element
- * referenced by it, will be scrolled into visible view, by calling its `scrollIntoView`
- * method.
- */
-
-import { uiModules } from '../modules';
-
-uiModules.get('kibana').directive('scrolltoActivedescendant', () => ({
- link(scope, element, attrs) {
- scope.$watch(
- () => attrs.ariaActivedescendant,
- (val) => {
- if (val) {
- const activeDescendant = element.find(`#${val}`);
- if (activeDescendant.length) {
- activeDescendant[0].scrollIntoView();
- }
- }
- }
- );
- },
-}));
diff --git a/src/legacy/ui/public/angular_ui_select.js b/src/legacy/ui/public/angular_ui_select.js
deleted file mode 100644
index 99f92587507c9..0000000000000
--- a/src/legacy/ui/public/angular_ui_select.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import 'jquery';
-import 'angular';
-// required for `ngSanitize` angular module
-import 'angular-sanitize';
-import 'ui-select/dist/select';
-
-import { uiModules } from 'ui/modules';
-
-uiModules.get('kibana', ['ui.select', 'ngSanitize']);
diff --git a/src/legacy/ui/public/autoload/accessibility.js b/src/legacy/ui/public/autoload/accessibility.js
deleted file mode 100644
index 1c846177eca87..0000000000000
--- a/src/legacy/ui/public/autoload/accessibility.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import '../accessibility';
diff --git a/src/legacy/ui/public/autoload/all.js b/src/legacy/ui/public/autoload/all.js
deleted file mode 100644
index be9b29aa944c9..0000000000000
--- a/src/legacy/ui/public/autoload/all.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import './accessibility';
-import './modules';
-import './settings';
diff --git a/src/legacy/ui/public/autoload/modules.js b/src/legacy/ui/public/autoload/modules.js
deleted file mode 100644
index 94929c8ca26d3..0000000000000
--- a/src/legacy/ui/public/autoload/modules.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import 'angular';
-import '../chrome';
-import '../config';
-import '../notify';
-import '../private';
-import '../promises';
-import '../state_management/app_state';
-import '../state_management/global_state';
-import '../url';
-import '../directives/watch_multi';
-import '../react_components';
-import '../i18n';
-
-import '@elastic/ui-ace';
-import { uiModules } from 'ui/modules';
-uiModules.get('kibana', ['ui.ace']);
diff --git a/src/legacy/ui/public/autoload/settings.js b/src/legacy/ui/public/autoload/settings.js
deleted file mode 100644
index 50ae67c052b93..0000000000000
--- a/src/legacy/ui/public/autoload/settings.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/** Left intentionally empty to avoid breaking plugins that import this file during the NP migration */
diff --git a/src/legacy/ui/public/binder/__tests__/binder.js b/src/legacy/ui/public/binder/__tests__/binder.js
deleted file mode 100644
index de30df36f6b2b..0000000000000
--- a/src/legacy/ui/public/binder/__tests__/binder.js
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import sinon from 'sinon';
-import expect from '@kbn/expect';
-import ngMock from 'ng_mock';
-
-import { Binder } from '..';
-import $ from 'jquery';
-
-describe('Binder class', function () {
- let $scope;
-
- beforeEach(ngMock.module('kibana'));
- beforeEach(
- ngMock.inject(function ($rootScope) {
- $scope = $rootScope.$new();
- })
- );
-
- describe('Constructing with a $scope', function () {
- it('accepts a $scope and listens for $destroy', function () {
- sinon.stub($scope, '$on');
- new Binder($scope);
- expect($scope.$on.callCount).to.be(1);
- expect($scope.$on.args[0][0]).to.be('$destroy');
- });
-
- it('unbinds when the $scope is destroyed', function () {
- const binder = new Binder($scope);
- sinon.stub(binder, 'destroy');
- $scope.$destroy();
- expect(binder.destroy.callCount).to.be(1);
- });
- });
-
- describe('Binder#on', function () {
- it('binds to normal event emitters', function () {
- const binder = new Binder();
- const emitter = {
- on: sinon.stub(),
- removeListener: sinon.stub(),
- };
- const handler = sinon.stub();
-
- binder.on(emitter, 'click', handler);
- expect(emitter.on.callCount).to.be(1);
- expect(emitter.on.args[0][0]).to.be('click');
- expect(emitter.on.args[0][1]).to.be(handler);
-
- binder.destroy();
- expect(emitter.removeListener.callCount).to.be(1);
- expect(emitter.removeListener.args[0][0]).to.be('click');
- expect(emitter.removeListener.args[0][1]).to.be(handler);
- });
- });
-
- describe('Binder#jqOn', function () {
- it('binds jquery event handlers', function () {
- const binder = new Binder();
- const el = document.createElement('div');
- const handler = sinon.stub();
-
- binder.jqOn(el, 'click', handler);
- $(el).click();
- expect(handler.callCount).to.be(1);
- binder.destroy();
- $(el).click();
- expect(handler.callCount).to.be(1);
- });
- });
-});
diff --git a/src/legacy/ui/public/binder/binder.js b/src/legacy/ui/public/binder/binder.js
deleted file mode 100644
index 0d535d3bdcb0e..0000000000000
--- a/src/legacy/ui/public/binder/binder.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import d3 from 'd3';
-import $ from 'jquery';
-
-import { BinderBase } from '../../../utils/binder';
-
-export class Binder extends BinderBase {
- constructor($scope) {
- super();
-
- // support auto-binding to $scope objects
- if ($scope) {
- $scope.$on('$destroy', () => this.destroy());
- }
- }
-
- jqOn(el, ...args) {
- const $el = $(el);
- $el.on(...args);
- this.disposal.push(() => $el.off(...args));
- }
-
- fakeD3Bind(el, event, handler) {
- this.jqOn(el, event, (e) => {
- // mimic https://github.com/mbostock/d3/blob/3abb00113662463e5c19eb87cd33f6d0ddc23bc0/src/selection/on.js#L87-L94
- const o = d3.event; // Events can be reentrant (e.g., focus).
- d3.event = e;
- try {
- handler.apply(this, [this.__data__]);
- } finally {
- d3.event = o;
- }
- });
- }
-}
diff --git a/src/legacy/ui/public/binder/index.js b/src/legacy/ui/public/binder/index.js
deleted file mode 100644
index ce91a987fa570..0000000000000
--- a/src/legacy/ui/public/binder/index.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-export { Binder } from './binder';
diff --git a/src/legacy/ui/public/bound_to_config_obj.js b/src/legacy/ui/public/bound_to_config_obj.js
deleted file mode 100644
index dc1eedebe2b77..0000000000000
--- a/src/legacy/ui/public/bound_to_config_obj.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import _ from 'lodash';
-
-export function BoundToConfigObjProvider(config) {
- /**
- * Create an object with properties that may be bound to config values.
- * The input object is basically cloned unless one of it's own properties
- * resolved to a string value that starts with an equal sign. When that is
- * found, that property is forever bound to the corresponding config key.
- *
- * example:
- *
- * // name is cloned, height is bound to the defaultHeight config key
- * { name: 'john', height: '=defaultHeight' };
- *
- * @param {Object} input
- * @return {Object}
- */
- function BoundToConfigObj(input) {
- const self = this;
-
- _.forOwn(input, function (value, prop) {
- if (!_.isString(value) || value.charAt(0) !== '=') {
- self[prop] = value;
- return;
- }
-
- const configKey = value.substr(1);
-
- config.watch(configKey, function update(value) {
- self[prop] = value;
- });
- });
- }
-
- return BoundToConfigObj;
-}
diff --git a/src/legacy/ui/public/capabilities/index.ts b/src/legacy/ui/public/capabilities/index.ts
deleted file mode 100644
index e16116f024a0f..0000000000000
--- a/src/legacy/ui/public/capabilities/index.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import { npStart } from 'ui/new_platform';
-import { Capabilities as UICapabilities } from '../../../../core/public';
-
-export { UICapabilities };
-
-export const capabilities = {
- get() {
- return npStart.core.application.capabilities;
- },
-};
diff --git a/src/legacy/ui/public/capabilities/react/index.ts b/src/legacy/ui/public/capabilities/react/index.ts
deleted file mode 100644
index 78d95a2603290..0000000000000
--- a/src/legacy/ui/public/capabilities/react/index.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-export { UICapabilitiesProvider } from './ui_capabilities_provider';
-export { injectUICapabilities } from './inject_ui_capabilities';
diff --git a/src/legacy/ui/public/capabilities/react/inject_ui_capabilities.test.tsx b/src/legacy/ui/public/capabilities/react/inject_ui_capabilities.test.tsx
deleted file mode 100644
index 10fb58783481d..0000000000000
--- a/src/legacy/ui/public/capabilities/react/inject_ui_capabilities.test.tsx
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-jest.mock('ui/capabilities', () => ({
- capabilities: {
- get: () => ({
- uiCapability1: true,
- uiCapability2: {
- nestedProp: 'nestedValue',
- },
- }),
- },
-}));
-
-import { mount } from 'enzyme';
-import React from 'react';
-import { UICapabilities } from '..';
-import { injectUICapabilities } from './inject_ui_capabilities';
-import { UICapabilitiesProvider } from './ui_capabilities_provider';
-
-describe('injectUICapabilities', () => {
- it('provides UICapabilities to FCs', () => {
- interface FCProps {
- uiCapabilities: UICapabilities;
- }
-
- const MyFC = injectUICapabilities(({ uiCapabilities }: FCProps) => {
- return