Skip to content

Commit

Permalink
Remove control group renderer from plugin. Export lazy control group …
Browse files Browse the repository at this point in the history
…renderer from index
  • Loading branch information
ThomThomson committed Oct 13, 2022
1 parent 8622f0d commit e2dd6b4
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import uuid from 'uuid';
import { useLifecycles } from 'react-use/lib';
import useLifecycles from 'react-use/lib/useLifecycles';
import React, { useEffect, useMemo, useRef, useState } from 'react';

import { IEmbeddable } from '@kbn/embeddable-plugin/public';
Expand Down Expand Up @@ -78,3 +78,7 @@ export const ControlGroupRenderer = ({ input, onEmbeddableLoad }: ControlGroupRe

return <div ref={controlsRoot} />;
};

// required for dynamic import using React.lazy()
// eslint-disable-next-line import/no-default-export
export default ControlGroupRenderer;
5 changes: 5 additions & 0 deletions src/plugins/controls/public/control_group/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@
* Side Public License, v 1.
*/

import React from 'react';

export type { ControlGroupContainer } from './embeddable/control_group_container';
export type { ControlGroupInput, ControlGroupOutput } from './types';

export { CONTROL_GROUP_TYPE } from './types';
export { ControlGroupContainerFactory } from './embeddable/control_group_container_factory';

export { ControlGroupRendererProps } from './control_group_renderer';
export const LazyControlGroupRenderer = React.lazy(() => import('./control_group_renderer'));
1 change: 1 addition & 0 deletions src/plugins/controls/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export {
} from './range_slider';

export { LazyControlsCallout, type CalloutProps } from './controls_callout';
export { LazyControlGroupRenderer, type ControlGroupRendererProps } from './control_group';

export function plugin() {
return new ControlsPlugin();
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/controls/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
RANGE_SLIDER_CONTROL,
TIME_SLIDER_CONTROL,
} from '.';
import { ControlGroupRenderer } from './control_group/control_group_renderer';
import { OptionsListEmbeddableFactory, OptionsListEmbeddableInput } from './options_list';
import { RangeSliderEmbeddableFactory, RangeSliderEmbeddableInput } from './range_slider';
import { TimeSliderEmbeddableFactory, TimeSliderControlEmbeddableInput } from './time_slider';
Expand Down Expand Up @@ -121,7 +120,6 @@ export class ControlsPlugin
return {
getControlFactory,
getControlTypes,
ControlGroupRenderer,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,5 @@ export const getStubPluginServices = (): ControlsPluginStart => {
return {
getControlFactory: pluginServices.getServices().controls.getControlFactory,
getControlTypes: pluginServices.getServices().controls.getControlTypes,
ControlGroupRenderer: jest.fn(),
};
};
2 changes: 0 additions & 2 deletions src/plugins/controls/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { DataViewField, DataViewsPublicPluginStart } from '@kbn/data-views-plugi
import { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public';
import { ControlInput } from '../common/types';
import { ControlsServiceType } from './services/controls/types';
import { ControlGroupRendererProps } from './control_group/control_group_renderer';

export interface CommonControlOutput {
filters?: Filter[];
Expand Down Expand Up @@ -82,7 +81,6 @@ export interface ControlsPluginSetup {
export interface ControlsPluginStart {
getControlFactory: ControlsServiceType['getControlFactory'];
getControlTypes: ControlsServiceType['getControlTypes'];
ControlGroupRenderer: React.FC<ControlGroupRendererProps>;
}

export interface ControlsPluginSetupDeps {
Expand Down

0 comments on commit e2dd6b4

Please sign in to comment.