diff --git a/packages/nimble-components/src/theme-provider/design-token-comments.ts b/packages/nimble-components/src/theme-provider/design-token-comments.ts index 5d3c582779..c601c3da79 100644 --- a/packages/nimble-components/src/theme-provider/design-token-comments.ts +++ b/packages/nimble-components/src/theme-provider/design-token-comments.ts @@ -173,7 +173,8 @@ export const comments: { readonly [key in TokenName]: string | null } = { tooltipCaptionFontWeight: null, tooltipCaptionFontLineHeight: null, tooltipCaptionFallbackFontFamily: null, - tooltipBackgroundColor: 'Background color for tooltips- Will need to be updated for light mode- 2 background colors for light mode', + tooltipBackgroundColor: + 'Background color for tooltips- Will need to be updated for light mode- 2 background colors for light mode', errorTextFont: 'Font shorthand for the "Error_LightUi" base token', errorTextFontColor: 'Font color for "Error_LightUi" base token', errorTextDisabledFontColor: diff --git a/packages/nimble-components/src/tooltip/index.ts b/packages/nimble-components/src/tooltip/index.ts index 5b54168591..d00cbb8095 100644 --- a/packages/nimble-components/src/tooltip/index.ts +++ b/packages/nimble-components/src/tooltip/index.ts @@ -23,4 +23,4 @@ const nimbleTooltip = Tooltip.compose({ styles }); -DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTooltip()); \ No newline at end of file +DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTooltip()); diff --git a/packages/nimble-components/src/tooltip/styles.ts b/packages/nimble-components/src/tooltip/styles.ts index 0c0c8a5129..b8b8e0ad14 100644 --- a/packages/nimble-components/src/tooltip/styles.ts +++ b/packages/nimble-components/src/tooltip/styles.ts @@ -6,22 +6,24 @@ import { tooltipCaptionFontColor, borderWidth, tooltipBackgroundColor, + tooltipCaptionFontSize } from '../theme-provider/design-tokens'; // box shadow color may need to be fixed // purple color needs to be fixed export const styles = css` - ${display('inline-flex')} :host { font: ${tooltipCaptionFont}; + font-style: normal; + font-weight: normal; + letter-spacing: 0px; color: ${tooltipCaptionFontColor}; - align-items: left; - cursor: pointer; - outline: none; - user-select: none; + font-size: ${tooltipCaptionFontSize}; + font-height: 14px; + text-align: left; } .tooltip { @@ -29,12 +31,14 @@ export const styles = css` flex-shrink: 0; max-width: 440px; border: ${borderWidth} solid rgba(${borderRgbPartialColor}, 0.3); - box-shadow: 0px 3px 4px #00000029; + box-shadow: 0px 3px 4px #00000029; background-color: ${tooltipBackgroundColor}; - padding: 1px; + padding-bottom: 6px; + padding-left: 8px; + padding-right: 8px; + padding-top: 4px; display: inline-flex; align-items: center; justify-content: center; - } `; diff --git a/packages/nimble-components/src/tooltip/tests/tooltip-matrix.stories.ts b/packages/nimble-components/src/tooltip/tests/tooltip-matrix.stories.ts index 34a4043462..6eb981159d 100644 --- a/packages/nimble-components/src/tooltip/tests/tooltip-matrix.stories.ts +++ b/packages/nimble-components/src/tooltip/tests/tooltip-matrix.stories.ts @@ -12,7 +12,11 @@ import { import { backgroundStates } from '../../utilities/tests/states'; import { hiddenWrapper } from '../../utilities/tests/hidden'; import '../../all-components'; -import { bodyFont, bodyFontColor, borderColor } from '../../theme-provider/design-tokens'; +import { + bodyFont, + bodyFontColor, + borderColor +} from '../../theme-provider/design-tokens'; const metadata: Meta = { title: 'Tests/Tooltip', @@ -41,44 +45,51 @@ const verticalViewportLockStates = [ type VerticalViewportLockState = typeof verticalViewportLockStates[number]; const component = ( - [horizontalViewportLockName, horizontalViewportLock]: HorizontalViewportLockState, - [verticalViewportLockName, verticalViewportLock]: VerticalViewportLockState, + [ + horizontalViewportLockName, + horizontalViewportLock + ]: HorizontalViewportLockState, + [verticalViewportLockName, verticalViewportLock]: VerticalViewportLockState ): ViewTemplate => html` -
-
${horizontalViewportLockName} ${verticalViewportLockName}
+
+
+ ${horizontalViewportLockName} ${verticalViewportLockName} +
Tooltip -
+
`; const [ lightThemeWhiteBackground, colorThemeDarkGreenBackground, - darkThemeBlackBackground, + darkThemeBlackBackground ] = backgroundStates; export const tooltipLightThemeWhiteBackground: Story = createFixedThemeStory( @@ -106,7 +117,5 @@ export const tooltipDarkThemeBlackBackground: Story = createFixedThemeStory( ); export const hiddenTooltip: Story = createStory( - hiddenWrapper( - html`` - ) + hiddenWrapper(html``) ); diff --git a/packages/nimble-components/src/tooltip/tests/tooltip.stories.ts b/packages/nimble-components/src/tooltip/tests/tooltip.stories.ts index 6fbd34d6ef..d4324accf7 100644 --- a/packages/nimble-components/src/tooltip/tests/tooltip.stories.ts +++ b/packages/nimble-components/src/tooltip/tests/tooltip.stories.ts @@ -4,7 +4,11 @@ import { withXD } from 'storybook-addon-xd-designs'; import type { AutoUpdateMode } from '@microsoft/fast-foundation'; import { createUserSelectedThemeStory } from '../../utilities/tests/storybook'; import '../../all-components'; -import { borderColor, bodyFont, bodyFontColor } from '../../theme-provider/design-tokens'; +import { + borderColor, + bodyFont, + bodyFontColor +} from '../../theme-provider/design-tokens'; interface TooltipArgs { delay: number; @@ -34,53 +38,56 @@ const metadata: Meta = { } }, render: createUserSelectedThemeStory(html` - -
-
Text, Button, Icon, etc.
+ .anchorDiv { + border: 1px solid var(${borderColor.cssCustomProperty}); + font: var(${bodyFont.cssCustomProperty}); + color: var(${bodyFontColor.cssCustomProperty}); + } + +
+
Text, Button, Icon, etc.
- ${x => x.tooltip} - -
+ ${x => x.tooltip} + +
`), args: { tooltip: 'Tooltip label', delay: 300, horizontalViewportLock: false, - verticalViewportLock: false, + verticalViewportLock: false }, argTypes: { autoUpdateMode: { options: { anchor: 'anchor', auto: 'auto' }, control: { type: 'radio' }, - description: 'Controls when the tooltip updates its position, default is `anchor` which only updates when the anchor is resized. `auto` will update on scroll/resize events.' + description: + 'Controls when the tooltip updates its position, default is `anchor` which only updates when the anchor is resized. `auto` will update on scroll/resize events.' }, horizontalViewportLock: { - description: 'Controls if the tooltip will always remain fully in the viewport on the horizontal axis' + description: + 'Controls if the tooltip will always remain fully in the viewport on the horizontal axis' }, verticalViewportLock: { - description: 'Controls if the tooltip will always remain fully in the viewport on the vertical axis' + description: + 'Controls if the tooltip will always remain fully in the viewport on the vertical axis' } - }, + } }; export default metadata; -export const tooltip: StoryObj = {}; \ No newline at end of file +export const tooltip: StoryObj = {};