-
Notifications
You must be signed in to change notification settings - Fork 376
fix(CodeEditor): use codeEditorControls and clean up overall #7931
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 10 commits
257ff8a
71ba55a
e28609b
191f1f0
42494c2
6889d36
c6e9bd6
888aba8
95298fa
d1bc327
44ffa43
96054c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -7,19 +7,19 @@ import { CodeEditorContext } from './CodeEditorUtils'; | |||||
| */ | ||||||
|
|
||||||
| export interface CodeEditorControlProps extends Omit<ButtonProps, 'onClick'> { | ||||||
| /** Accessible label for the code editor control. */ | ||||||
| /** Accessible label for the code editor control */ | ||||||
| 'aria-label'?: string; | ||||||
| /** Additional classes added to the code editor control. */ | ||||||
| className?: string; | ||||||
| /** Delay in ms before the tooltip appears. */ | ||||||
| /** @deprecated Delay in ms before the tooltip appears. */ | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you open an issue to remove these for breaking change release please.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
| entryDelay?: number; | ||||||
| /** Delay in ms before the tooltip disappears. */ | ||||||
| /** @deprecated Delay in ms before the tooltip disappears. */ | ||||||
| exitDelay?: number; | ||||||
| /** Icon rendered inside the code editor control. */ | ||||||
| icon: React.ReactNode; | ||||||
| /** Maximum width of the tooltip (default 150px). */ | ||||||
| /** @deprecated Maximum width of the tooltip (default 150px). */ | ||||||
| maxWidth?: string; | ||||||
| /** Copy button popover position. */ | ||||||
| /** @deprecated Copy button popover position. */ | ||||||
| position?: | ||||||
| | PopoverPosition | ||||||
| | 'auto' | ||||||
|
|
@@ -35,41 +35,84 @@ export interface CodeEditorControlProps extends Omit<ButtonProps, 'onClick'> { | |||||
| | 'left-end' | ||||||
| | 'right-start' | ||||||
| | 'right-end'; | ||||||
| /** Text to display in the tooltip. */ | ||||||
| toolTipText: React.ReactNode; | ||||||
| /** Event handler for the click of the button. */ | ||||||
| /** @deprecated Text to display in the tooltip*/ | ||||||
| toolTipText?: React.ReactNode; | ||||||
| /** Event handler for the click of the button */ | ||||||
| onClick: (code: string, event?: any) => void; | ||||||
| /** Flag indicating that the button is visible above the code editor. */ | ||||||
| isVisible?: boolean; | ||||||
| /** Additional tooltip props forwarded to the Tooltip component */ | ||||||
| tooltipProps?: any; | ||||||
| } | ||||||
|
|
||||||
| export const CodeEditorControl: React.FunctionComponent<CodeEditorControlProps> = ({ | ||||||
| icon, | ||||||
| className, | ||||||
| 'aria-label': ariaLabel, | ||||||
| toolTipText, | ||||||
| exitDelay = 0, | ||||||
| entryDelay = 300, | ||||||
| maxWidth = '100px', | ||||||
| position = 'top', | ||||||
| exitDelay, | ||||||
| entryDelay, | ||||||
| maxWidth, | ||||||
| position, | ||||||
| onClick = () => {}, | ||||||
| isVisible = true, | ||||||
| tooltipProps = {}, | ||||||
| ...props | ||||||
| }: CodeEditorControlProps) => { | ||||||
| const context = React.useContext(CodeEditorContext); | ||||||
|
|
||||||
| if (entryDelay !== undefined) { | ||||||
| // eslint-disable-next-line no-console | ||||||
| console.warn( | ||||||
| 'The CodeEditorControl entryDelay prop has been deprecated. ' + | ||||||
|
||||||
| 'The CodeEditorControl entryDelay prop has been deprecated. ' + | |
| 'CodeEditorControl: entryDelay prop has been deprecated. ' + |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 'The CodeEditorControl exitDelay prop has been deprecated. ' + | |
| 'CodeEditorControl: exitDelay prop has been deprecated. ' + |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 'The CodeEditorControl maxWidth prop has been deprecated. ' + | |
| 'CodeEditorControl: maxWidth prop has been deprecated. ' + |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 'The CodeEditorControl position prop has been deprecated. ' + | |
| 'CodeEditorControl: position prop has been deprecated. ' + |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 'The CodeEditorControl toolTipText prop has been deprecated. ' + | |
| 'CodeEditorControl: toolTipText prop has been deprecated. ' + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥳