-
Notifications
You must be signed in to change notification settings - Fork 208
chore: Exposes internal dependencies for chart components #3333
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 all commits
b1cb40e
dd397d5
a245a50
56f8616
494627e
dbc9028
8648782
6990fe7
555a3d5
f0d4abf
50a847c
5c309c4
600a60f
f3cda3c
4e65e04
24f250e
932b555
60c59fe
ca36fc9
53b6d89
a63602c
4ac1271
5858cdb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,13 +14,15 @@ import { nodeBelongs } from '../../utils/node-belongs'; | |
|
|
||
| import popoverStyles from '../../../popover/styles.css.js'; | ||
| import styles from './styles.css.js'; | ||
| import testClasses from './test-classes/styles.css.js'; | ||
|
|
||
| interface ChartPopoverProps extends PopoverProps { | ||
| export interface ChartPopoverProps extends PopoverProps { | ||
| /** Title of the popover */ | ||
| title?: React.ReactNode; | ||
|
|
||
| /** References the element the container is positioned against. */ | ||
| trackRef: React.RefObject<HTMLElement | SVGElement>; | ||
| trackRef?: React.RefObject<HTMLElement | SVGElement>; | ||
| getTrack?: () => null | HTMLElement | SVGElement; | ||
|
Member
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. getTrack is an alternative for trackRef. The difference is that it is called every time the track element is requested, whilst the trackRef can get stale. |
||
| /** | ||
| Used to update the container position in case track or track position changes: | ||
|
|
||
|
|
@@ -31,6 +33,7 @@ interface ChartPopoverProps extends PopoverProps { | |
| </>) | ||
| */ | ||
| trackKey?: string | number; | ||
| minVisibleBlockSize?: number; | ||
|
|
||
| /** Optional container element that prevents any clicks in there from dismissing the popover */ | ||
| container: Element | null; | ||
|
|
@@ -48,6 +51,9 @@ interface ChartPopoverProps extends PopoverProps { | |
|
|
||
| /** Popover content */ | ||
| children?: React.ReactNode; | ||
|
|
||
| /** Popover footer */ | ||
| footer?: React.ReactNode; | ||
|
Member
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. The footer is now a property, so no need to duplicate or expose the separate chart-popover-footer component. |
||
| } | ||
|
|
||
| export default React.forwardRef(ChartPopover); | ||
|
|
@@ -61,12 +67,15 @@ function ChartPopover( | |
| dismissAriaLabel, | ||
|
|
||
| children, | ||
| footer, | ||
|
|
||
| title, | ||
| trackRef, | ||
| getTrack, | ||
| trackKey, | ||
| onDismiss, | ||
| container, | ||
| minVisibleBlockSize, | ||
|
|
||
| onMouseEnter, | ||
| onMouseLeave, | ||
|
|
@@ -118,7 +127,9 @@ function ChartPopover( | |
| fixedWidth={fixedWidth} | ||
| position={position} | ||
| trackRef={trackRef} | ||
| getTrack={getTrack} | ||
| trackKey={trackKey} | ||
| minVisibleBlockSize={minVisibleBlockSize} | ||
| arrow={position => ( | ||
| <div className={clsx(popoverStyles.arrow, popoverStyles[`arrow-position-${position}`])}> | ||
| <div className={popoverStyles['arrow-outer']} /> | ||
|
|
@@ -128,19 +139,20 @@ function ChartPopover( | |
| keepPosition={true} | ||
| allowVerticalOverflow={true} | ||
| allowScrollToFit={isPinned} | ||
| hoverArea={true} | ||
jperals marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| > | ||
| <div className={styles['hover-area']}> | ||
| <PopoverBody | ||
| dismissButton={dismissButton} | ||
| dismissAriaLabel={dismissAriaLabel} | ||
| header={title} | ||
| onDismiss={onDismiss} | ||
| overflowVisible="content" | ||
| className={styles['popover-body']} | ||
| > | ||
| {children} | ||
| </PopoverBody> | ||
| </div> | ||
| <PopoverBody | ||
| dismissButton={dismissButton} | ||
| dismissAriaLabel={dismissAriaLabel} | ||
| header={<span className={testClasses.header}>{title}</span>} | ||
| onDismiss={onDismiss} | ||
| overflowVisible="content" | ||
| className={styles['popover-body']} | ||
| variant="chart" | ||
| > | ||
| <div className={testClasses.body}>{children}</div> | ||
| {footer && <div className={clsx(testClasses.footer, styles.footer)}>{footer}</div>} | ||
| </PopoverBody> | ||
| </PopoverContainer> | ||
| </div> | ||
| ); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| /* | ||
| Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| .header, | ||
| .body, | ||
| .footer { | ||
| /* used in test-utils */ | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.