-
Notifications
You must be signed in to change notification settings - Fork 119
feat(tooltip): add keyboard shortcuts to tooltip #4161
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
53 commits
Select commit
Hold shift + click to select a range
6c1c489
feat(keyboard-key): component init
krisantrobus e8304e6
chore(tools): plopfile syntax fix
krisantrobus 461015e
chore(tools): plopfile syntax fix
krisantrobus 8edd0b4
chore(tools): plopfile syntax fix
krisantrobus 693ea4a
feat(keyboard-key): styled w/ hook unit tests
krisantrobus ca523ac
feat(keyboard-key): added variants and styles
krisantrobus 325c87d
chore(plop): update tsx dependency
krisantrobus 18d09d2
chore(keyboard-key): internal exports in core
krisantrobus 3394496
chore(keyboard-key): typedocs & build
krisantrobus c7617df
feat(keyboard-key): change to infline-flex style
krisantrobus b13cde4
chore(keyboard-key): added stroy
krisantrobus 87ab0ff
chore(keyboard-key): linting
krisantrobus c29afac
fix(keyboard-key): command logic
krisantrobus d910c26
feat(design-tokens): added new box shadows to support keyboard-keys
krisantrobus 4504056
chore(ci-cd): added chagesets
krisantrobus 6775b36
fix(keyboard-key): boxShadow stylings
krisantrobus 3cc0dff
fix(keyboard-key): remove null component wrapper
krisantrobus a9b5931
fix(keyboard-key): aria-hidden
krisantrobus bff42f7
chore(keyboard-key): refactor
krisantrobus 2994e0f
chore(keyboard-key): code cleanup
krisantrobus 720407e
Merge branch 'main' of github.com:twilio-labs/paste into create-keybo…
krisantrobus a9032d3
chore(keyboard-key): code cleanup
krisantrobus f0cb7ec
chore(keyboard-key): typedocs
krisantrobus 5c3a833
chore(keyboard-key): fix tests
krisantrobus 196a028
fix(keyboard-key): aria and diableBrowserShortcuts
krisantrobus 1ff559c
fix(keyboard-key): props fix
krisantrobus 59b0d43
chore(keyboard-key): playgorund storybook
krisantrobus a835ef0
chore(keyboard-key): formatting fix
krisantrobus 528b13b
chore(keyboard-key): stories update
krisantrobus 4fbce7b
chore(keyboard-key): formatting fix
krisantrobus c1714fb
chore(keyboard-key): typo
krisantrobus acdf2d0
Update .changeset/sweet-mugs-admire.md
krisantrobus e3d5827
Update .changeset/shaggy-sheep-confess.md
krisantrobus 781d0b0
chore(keyboard-key): address PR comments
krisantrobus 8ec377e
Merge branch 'create-keyboard-key' of github.com:twilio-labs/paste in…
krisantrobus 5ade11a
feat(keyboard-tooltip): wip
krisantrobus 774095c
chore(tooltip): update types
krisantrobus be97d29
chore(tooltip): update types
krisantrobus 77b102e
Merge branch 'main' of github.com:twilio-labs/paste into add-keyboard…
krisantrobus 4f693d2
chore(tooltip): better var naming
krisantrobus c5c4d62
chore(tooltip): fail safe check
krisantrobus c6fdc17
chore(tooltip): linting
krisantrobus 7c9e275
chore(tooltip): linting
krisantrobus c5cab1e
chore(tooltip): yarn lock
krisantrobus 4691ce4
chore(tooltip): changeset
krisantrobus f1bee12
chore(tooltip): fix spelling
krisantrobus 278e997
chore(tooltip): uppdate type name
krisantrobus 345af0f
feat(tooltip): add anonymous keybaord action to tooltip
krisantrobus 529aa0d
Update packages/paste-core/components/tooltip/src/Tooltip.tsx
krisantrobus 30e7f4e
fix(tooltip): update keyboardkey styles
krisantrobus ec8bbd6
chore(tooltip): formatting
krisantrobus 636c909
Update packages/paste-core/components/tooltip/src/Tooltip.tsx
krisantrobus 9ccfcd6
Merge branch 'main' into add-keyboard-keys-to-tooltip
kodiakhq[bot] 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,6 @@ | ||
--- | ||
"@twilio-paste/tooltip": minor | ||
"@twilio-paste/core": minor | ||
--- | ||
|
||
[Tooltip] added the ability to put keyboard combinations using the KeyboardKey in the tooltip |
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
137 changes: 137 additions & 0 deletions
137
packages/paste-core/components/tooltip/stories/keyboard-key.stories.tsx
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,137 @@ | ||
import type { StoryFn } from "@storybook/react"; | ||
import { Anchor } from "@twilio-paste/anchor"; | ||
import { Box } from "@twilio-paste/box"; | ||
import { Button } from "@twilio-paste/button"; | ||
import { CustomizationProvider } from "@twilio-paste/customization"; | ||
import { InformationIcon } from "@twilio-paste/icons/esm/InformationIcon"; | ||
import { Stack } from "@twilio-paste/stack"; | ||
import { Text } from "@twilio-paste/text"; | ||
import { Theme, useTheme } from "@twilio-paste/theme"; | ||
import * as React from "react"; | ||
|
||
import { Tooltip, useTooltipState } from "../src"; | ||
|
||
// eslint-disable-next-line import/no-default-export | ||
export default { | ||
title: "Components/Tooltip/KeyboardKey", | ||
excludeStories: ["StateHookExample"], | ||
component: Tooltip, | ||
parameters: { | ||
chromatic: { delay: 3000, diffThreshold: 0.2 }, | ||
}, | ||
}; | ||
|
||
export const Default = (): React.ReactNode => { | ||
return ( | ||
<Box as="div" minHeight="400px"> | ||
<Tooltip | ||
visible | ||
actionHeader="Search shortcuts" | ||
keyCombinationsActions={[ | ||
{ name: "Mac", eventKeyCombination: ["Command", "K"] }, | ||
{ name: "Windows", eventKeyCombination: ["Control", "K"] }, | ||
]} | ||
> | ||
<Button aria-keyshortcuts="command+k" variant="primary"> | ||
Click to search | ||
</Button> | ||
</Tooltip> | ||
</Box> | ||
); | ||
}; | ||
|
||
export const CustomizedTooltip: StoryFn = (_args, { parameters: { isTestEnvironment } }) => { | ||
const currentTheme = useTheme(); | ||
return ( | ||
<CustomizationProvider | ||
disableAnimations={isTestEnvironment} | ||
theme={currentTheme} | ||
elements={{ | ||
TOOLTIP: { | ||
backgroundColor: "colorBackgroundErrorWeakest", | ||
borderColor: "colorBorderDestructive", | ||
textAlign: "center", | ||
}, | ||
TOOLTIP_ACTION_TEXT: { | ||
color: "colorTextErrorStrong", | ||
}, | ||
TOOLTIP_HEADER: { | ||
color: "colorTextLinkDestructive", | ||
fontWeight: "fontWeightBold", | ||
}, | ||
TOOLTIP_ACTION_KEY_GROUP: { | ||
backgroundColor: "colorBackgroundStrong", | ||
padding: "space30", | ||
}, | ||
TOOLTIP_ACTION_KEY: { | ||
backgroundColor: "colorBackgroundPrimary", | ||
color: "colorTextInverse", | ||
}, | ||
CUSTOM_TOOLTIP: { | ||
backgroundColor: "colorBackgroundSuccessWeakest", | ||
borderColor: "colorBorderSuccess", | ||
textAlign: "left", | ||
}, | ||
CUSTOM_TOOLTIP_ACTION_TEXT: { | ||
color: "colorTextSuccess", | ||
}, | ||
CUSTOM_TOOLTIP_HEADER: { | ||
color: "colorTextLinkStrongest", | ||
fontWeight: "fontWeightLight", | ||
}, | ||
CUSTOM_TOOLTIP_ACTION_KEY_GROUP: { | ||
backgroundColor: "colorBackgroundInverse", | ||
padding: "space30", | ||
}, | ||
CUSTOM_TOOLTIP_ACTION_KEY: { | ||
backgroundColor: "colorBackgroundBusy", | ||
color: "colorTextInverse", | ||
fontFamily: "fontFamilyCode", | ||
}, | ||
}} | ||
> | ||
<Box as="div" display="flex" columnGap="space80"> | ||
<Box minWidth="200px"> | ||
<Tooltip | ||
visible | ||
actionHeader="Search shortcuts" | ||
keyCombinationsActions={[ | ||
{ name: "Mac", eventKeyCombination: ["Command", "K"] }, | ||
{ name: "Windows", eventKeyCombination: ["Control", "K"] }, | ||
]} | ||
> | ||
<Button aria-keyshortcuts="command+k" variant="primary"> | ||
Click to search | ||
</Button> | ||
</Tooltip> | ||
</Box> | ||
<Box minWidth="600px"> | ||
<Tooltip | ||
element="CUSTOM_TOOLTIP" | ||
visible | ||
actionHeader="Search shortcuts" | ||
keyCombinationsActions={[ | ||
{ name: "Mac", eventKeyCombination: ["Command", "K"] }, | ||
{ name: "Windows", eventKeyCombination: ["Control", "K"] }, | ||
]} | ||
> | ||
<Button aria-keyshortcuts="command+k" variant="primary"> | ||
Click to search | ||
</Button> | ||
</Tooltip> | ||
</Box> | ||
</Box> | ||
</CustomizationProvider> | ||
); | ||
}; | ||
|
||
CustomizedTooltip.storyName = "Customized Tooltip"; | ||
CustomizedTooltip.parameters = { | ||
parameters: { | ||
chromatic: { disableSnapshot: true }, | ||
}, | ||
a11y: { | ||
// no need to a11y check customization | ||
disable: true, | ||
}, | ||
}; |
Oops, something went wrong.
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.