-
Notifications
You must be signed in to change notification settings - Fork 616
IconButton: introduce tooltips on icon buttons behind the unsafeDisableTooltip
prop for an incremental rollout
#4224
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
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
8a507be
IconButton: introduce tooltip behaviuor behind a prop
broccolinisoup 3169fe4
changeset add
broccolinisoup 71c9b6f
add comment
broccolinisoup d6f26f1
Merge branch 'main' into icon-button-tooltip-feature
broccolinisoup 7ca980a
Merge branch 'main' into icon-button-tooltip-feature
broccolinisoup bb3c92a
rename the tooltip prop
broccolinisoup 2c75e8c
rename the prop again 🙃
broccolinisoup b30e480
remove redundant stories
broccolinisoup 841c517
clean up the mess
broccolinisoup 20a0c4f
test(vrt): update snapshots
broccolinisoup ed6759d
Merge branch 'main' into icon-button-tooltip-feature
broccolinisoup 8c5a010
toolbar button disable tooltip
broccolinisoup 9604383
Merge branch 'main' into icon-button-tooltip-feature
broccolinisoup 6841b54
icon button as menu anchor & external tooltip & tooltipDirection
broccolinisoup ce78708
update snaps
broccolinisoup 12132a2
Merge branch 'main' into icon-button-tooltip-feature
broccolinisoup 480b6aa
Merge branch 'main' into icon-button-tooltip-feature
broccolinisoup 290e33e
code review comments
broccolinisoup f8ad63a
show tooltip only on focus-visible
broccolinisoup 7be1721
Merge branch 'main' into icon-button-tooltip-feature
broccolinisoup c20bb37
catch focus-visible for jestdom
siddharthkp 11e60b4
rename the prop and update the default version to be true
broccolinisoup 8c48b2f
fix tests
broccolinisoup bb428b7
already default true
broccolinisoup 579cab5
test(vrt): update snapshots
broccolinisoup b3f4f26
improve test and example
broccolinisoup c990fc9
Merge branch 'main' into icon-button-tooltip-feature
broccolinisoup 2a8d931
Merge branch 'main' into icon-button-tooltip-feature
broccolinisoup 414c662
test(vrt): update snapshots
broccolinisoup 8ba386f
Merge branch 'main' into icon-button-tooltip-feature
broccolinisoup 5b5fa94
fix linting
broccolinisoup a44ab67
Merge branch 'main' into icon-button-tooltip-feature
broccolinisoup a4cef3b
pass the id down and add test
broccolinisoup File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@primer/react': minor | ||
--- | ||
|
||
IconButton: introduce tooltips on icon buttons behind the `unsafeDisableTooltip` prop for an incremental rollout. | ||
|
||
In the next release, we plan to update the default value of `unsafeDisableTooltip` to `false` so that the tooltip behaviour becomes the default. |
Binary file modified
BIN
-1 Byte
(100%)
...onents/Dialogv1.test.ts-snapshots/Dialogv1-Default-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,90 @@ | ||
import {HeartIcon} from '@primer/octicons-react' | ||
import {HeartIcon, InboxIcon, ChevronDownIcon} from '@primer/octicons-react' | ||
import React from 'react' | ||
import {IconButton} from '.' | ||
import {ActionMenu} from '../ActionMenu' | ||
import {ActionList} from '../ActionList' | ||
import {Tooltip} from '../TooltipV2' | ||
import {default as TooltipV1} from '../Tooltip' | ||
|
||
export default { | ||
title: 'Components/IconButton/Features', | ||
} | ||
|
||
export const Primary = () => <IconButton icon={HeartIcon} variant="primary" aria-label="Favorite" /> | ||
export const Primary = () => ( | ||
<IconButton icon={HeartIcon} variant="primary" aria-label="Favorite" unsafeDisableTooltip={false} /> | ||
) | ||
|
||
export const Danger = () => <IconButton icon={HeartIcon} variant="danger" aria-label="Favorite" /> | ||
export const Danger = () => ( | ||
<IconButton icon={HeartIcon} variant="danger" aria-label="Favorite" unsafeDisableTooltip={false} /> | ||
) | ||
|
||
export const Invisible = () => <IconButton icon={HeartIcon} variant="invisible" aria-label="Favorite" /> | ||
export const Invisible = () => ( | ||
<IconButton icon={HeartIcon} variant="invisible" aria-label="Favorite" unsafeDisableTooltip={false} /> | ||
) | ||
|
||
export const Disabled = () => <IconButton disabled icon={HeartIcon} aria-label="Favorite" /> | ||
export const Disabled = () => ( | ||
<IconButton disabled icon={HeartIcon} aria-label="Favorite" unsafeDisableTooltip={false} /> | ||
) | ||
|
||
export const Small = () => <IconButton size="small" icon={HeartIcon} aria-label="Favorite" /> | ||
export const Small = () => ( | ||
<IconButton size="small" icon={HeartIcon} aria-label="Favorite" unsafeDisableTooltip={false} /> | ||
) | ||
|
||
export const Medium = () => <IconButton size="medium" icon={HeartIcon} aria-label="Favorite" /> | ||
export const Medium = () => ( | ||
<IconButton size="medium" icon={HeartIcon} aria-label="Favorite" unsafeDisableTooltip={false} /> | ||
) | ||
|
||
export const Large = () => <IconButton size="large" icon={HeartIcon} aria-label="Favorite" /> | ||
export const Large = () => ( | ||
<IconButton size="large" icon={HeartIcon} aria-label="Favorite" unsafeDisableTooltip={false} /> | ||
) | ||
|
||
export const WithDescription = () => ( | ||
<IconButton | ||
icon={InboxIcon} | ||
aria-label="Notifications" | ||
description="You have no unread notifications." | ||
unsafeDisableTooltip={false} | ||
/> | ||
) | ||
|
||
export const ExternalTooltip = () => ( | ||
<Tooltip text="this is a supportive description for icon button" direction="se"> | ||
<IconButton icon={HeartIcon} aria-label="HeartIcon" /> | ||
</Tooltip> | ||
) | ||
|
||
export const ExternalTooltipVersion1 = () => ( | ||
<TooltipV1 text="this is a supportive description for icon button" direction="se"> | ||
<IconButton icon={HeartIcon} aria-label="HeartIcon" /> | ||
</TooltipV1> | ||
) | ||
|
||
export const AsAMenuAnchor = () => ( | ||
<ActionMenu> | ||
<ActionMenu.Anchor> | ||
<IconButton icon={ChevronDownIcon} aria-label="Something" unsafeDisableTooltip={false} /> | ||
</ActionMenu.Anchor> | ||
|
||
<ActionMenu.Overlay width="medium"> | ||
<ActionList> | ||
<ActionList.Item onSelect={() => alert('Copy link clicked')}> | ||
Copy link | ||
<ActionList.TrailingVisual>⌘C</ActionList.TrailingVisual> | ||
</ActionList.Item> | ||
<ActionList.Item onSelect={() => alert('Quote reply clicked')}> | ||
Quote reply | ||
<ActionList.TrailingVisual>⌘Q</ActionList.TrailingVisual> | ||
</ActionList.Item> | ||
<ActionList.Item onSelect={() => alert('Edit comment clicked')}> | ||
Edit comment | ||
<ActionList.TrailingVisual>⌘E</ActionList.TrailingVisual> | ||
</ActionList.Item> | ||
<ActionList.Divider /> | ||
<ActionList.Item variant="danger" onSelect={() => alert('Delete file clicked')}> | ||
Delete file | ||
<ActionList.TrailingVisual>⌘D</ActionList.TrailingVisual> | ||
</ActionList.Item> | ||
</ActionList> | ||
</ActionMenu.Overlay> | ||
</ActionMenu> | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.