@patternfly/react-code-editor 5.0.0-alpha.4 → 5.0.0-alpha.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { Button, ButtonProps, PopoverPosition, Tooltip } from '@patternfly/react-core';
2
+ import { Button, ButtonProps, Tooltip } from '@patternfly/react-core';
3
3
  import { CodeEditorContext } from './CodeEditorUtils';
4
4
 
5
5
  /** Allows customizing the code editor controls by passing this sub-component into the
@@ -11,32 +11,8 @@ export interface CodeEditorControlProps extends Omit<ButtonProps, 'onClick'> {
11
11
  'aria-label'?: string;
12
12
  /** Additional classes added to the code editor control. */
13
13
  className?: string;
14
- /** @deprecated Delay in ms before the tooltip appears. */
15
- entryDelay?: number;
16
- /** @deprecated Delay in ms before the tooltip disappears. */
17
- exitDelay?: number;
18
14
  /** Icon rendered inside the code editor control. */
19
15
  icon: React.ReactNode;
20
- /** @deprecated Maximum width of the tooltip (default 150px). */
21
- maxWidth?: string;
22
- /** @deprecated Copy button popover position. */
23
- position?:
24
- | PopoverPosition
25
- | 'auto'
26
- | 'top'
27
- | 'bottom'
28
- | 'left'
29
- | 'right'
30
- | 'top-start'
31
- | 'top-end'
32
- | 'bottom-start'
33
- | 'bottom-end'
34
- | 'left-start'
35
- | 'left-end'
36
- | 'right-start'
37
- | 'right-end';
38
- /** @deprecated Text to display in the tooltip*/
39
- toolTipText?: React.ReactNode;
40
16
  /** Event handler for the click of the button */
41
17
  onClick: (code: string, event?: any) => void;
42
18
  /** Flag indicating that the button is visible above the code editor. */
@@ -49,11 +25,6 @@ export const CodeEditorControl: React.FunctionComponent<CodeEditorControlProps>
49
25
  icon,
50
26
  className,
51
27
  'aria-label': ariaLabel,
52
- toolTipText,
53
- exitDelay,
54
- entryDelay,
55
- maxWidth,
56
- position,
57
28
  onClick = () => {},
58
29
  isVisible = true,
59
30
  tooltipProps = {},
@@ -61,57 +32,12 @@ export const CodeEditorControl: React.FunctionComponent<CodeEditorControlProps>
61
32
  }: CodeEditorControlProps) => {
62
33
  const context = React.useContext(CodeEditorContext);
63
34
 
64
- if (entryDelay !== undefined) {
65
- // eslint-disable-next-line no-console
66
- console.warn(
67
- 'CodeEditorControl: entryDelay prop has been deprecated. ' +
68
- 'Pass the entryDelay via the tooltipProps prop instead.'
69
- );
70
- }
71
-
72
- if (exitDelay !== undefined) {
73
- // eslint-disable-next-line no-console
74
- console.warn(
75
- 'CodeEditorControl: exitDelay prop has been deprecated. ' +
76
- 'Pass the exitDelay via the tooltipProps prop instead.'
77
- );
78
- }
79
-
80
- if (maxWidth !== undefined) {
81
- // eslint-disable-next-line no-console
82
- console.warn(
83
- 'CodeEditorControl: maxWidth prop has been deprecated. ' + 'Pass the maxWidth via the tooltipProps prop instead.'
84
- );
85
- }
86
-
87
- if (position !== undefined) {
88
- // eslint-disable-next-line no-console
89
- console.warn(
90
- 'CodeEditorControl: position prop has been deprecated. ' + 'Pass the position via the tooltipProps prop instead.'
91
- );
92
- }
93
-
94
- if (toolTipText !== undefined) {
95
- // eslint-disable-next-line no-console
96
- console.warn(
97
- 'CodeEditorControl: toolTipText prop has been deprecated. ' +
98
- 'Pass the toolTipText by setting the content field in tooltipProps prop instead.'
99
- );
100
- }
101
-
102
35
  const onCustomClick = (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
103
36
  onClick(context.code, event);
104
37
  };
105
38
 
106
39
  return isVisible ? (
107
- <Tooltip
108
- exitDelay={exitDelay}
109
- entryDelay={entryDelay}
110
- maxWidth={maxWidth}
111
- position={position}
112
- content={<div>{toolTipText}</div>}
113
- {...tooltipProps}
114
- >
40
+ <Tooltip {...tooltipProps}>
115
41
  <Button className={className} onClick={onCustomClick} variant="control" aria-label={ariaLabel} {...props}>
116
42
  {icon}
117
43
  </Button>
@@ -40,7 +40,7 @@ export const CodeEditorBasic: React.FunctionComponent = () => {
40
40
  <Checkbox
41
41
  label="Dark theme"
42
42
  isChecked={isDarkTheme}
43
- onChange={toggleDarkTheme}
43
+ onChange={(_event, checked) => toggleDarkTheme(checked)}
44
44
  aria-label="dark theme checkbox"
45
45
  id="toggle-theme"
46
46
  name="toggle-theme"
@@ -48,7 +48,7 @@ export const CodeEditorBasic: React.FunctionComponent = () => {
48
48
  <Checkbox
49
49
  label="Line numbers"
50
50
  isChecked={isLineNumbersVisible}
51
- onChange={toggleLineNumbers}
51
+ onChange={(_event, checked) => toggleLineNumbers(checked)}
52
52
  aria-label="line numbers checkbox"
53
53
  id="toggle-line-numbers"
54
54
  name="toggle-line-numbers"
@@ -56,7 +56,7 @@ export const CodeEditorBasic: React.FunctionComponent = () => {
56
56
  <Checkbox
57
57
  label="Read only"
58
58
  isChecked={isReadOnly}
59
- onChange={toggleReadOnly}
59
+ onChange={(_event, checked) => toggleReadOnly(checked)}
60
60
  aria-label="read only checkbox"
61
61
  id="toggle-read-only"
62
62
  name="toggle-read-only"
@@ -64,7 +64,7 @@ export const CodeEditorBasic: React.FunctionComponent = () => {
64
64
  <Checkbox
65
65
  label="Minimap"
66
66
  isChecked={isMinimapVisible}
67
- onChange={toggleMinimap}
67
+ onChange={(_event, checked) => toggleMinimap(checked)}
68
68
  aria-label="display minimap checkbox"
69
69
  id="toggle-minimap"
70
70
  name="toggle-minimap"