-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat(tooltip): new component (#999)
* chore(): add new component * chore(): refactor * chore(): refactor * chore(): refactor * chore(): refactor * chore(): refactor * chore(): format * chore(): refactor * chore(): refactor * chore(): format * chore(): add bem * chore(): update base images * chore(): refactor * chore(): refactor * chore(): update base images * chore(): trigger build * chore(): refactor --------- Co-authored-by: mladenplaninicic <[email protected]>
- Loading branch information
1 parent
5c58d71
commit 544f53c
Showing
23 changed files
with
880 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 +1 @@ | ||
["bal-accordion","bal-app","bal-badge","bal-button","bal-card","bal-carousel","bal-checkbox","bal-close","bal-content","bal-data","bal-datepicker","bal-divider","bal-field","bal-file-upload","bal-footer","bal-form","bal-heading","bal-hint","bal-icon","bal-input","bal-label","bal-list","bal-logo","bal-modal","bal-navbar","bal-notification","bal-number-input","bal-pagination","bal-popover","bal-progress-bar","bal-radio","bal-select","bal-shape","bal-sheet","bal-snackbar","bal-spinner","bal-stack","bal-stage","bal-step-item","bal-steps","bal-table","bal-tabs","bal-tag","bal-text","bal-time-input","bal-toast"] | ||
["bal-accordion","bal-app","bal-badge","bal-button","bal-card","bal-carousel","bal-checkbox","bal-close","bal-content","bal-data","bal-datepicker","bal-divider","bal-field","bal-file-upload","bal-footer","bal-form","bal-heading","bal-hint","bal-icon","bal-input","bal-label","bal-list","bal-logo","bal-modal","bal-navbar","bal-notification","bal-number-input","bal-pagination","bal-popover","bal-progress-bar","bal-radio","bal-select","bal-shape","bal-sheet","bal-snackbar","bal-spinner","bal-stack","bal-stage","bal-step-item","bal-steps","bal-table","bal-tabs","bal-tag","bal-text","bal-time-input","bal-toast","bal-tooltip"] |
This file contains 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,5 @@ | ||
--- | ||
'@baloise/design-system-components': minor | ||
--- | ||
|
||
add tooltip component |
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
packages/components/cypress/e2e/visual/bal-tooltip.visual.cy.ts
This file contains 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,22 @@ | ||
describe('bal-tooltip', () => { | ||
testTooltip('desktop') | ||
|
||
function testTooltip(platform: 'desktop' | 'mobile') { | ||
describe(platform, () => { | ||
beforeEach(() => | ||
cy.visit('/components/bal-tooltip/test/bal-tooltip.visual.html').platform(platform).waitForDesignSystem(), | ||
) | ||
|
||
it('basic tooltip', () => { | ||
cy.getByTestId('basic-trigger').click() | ||
cy.compareSnapshot(`tooltip-basic-${platform}`) | ||
cy.get('body').type('{esc}') | ||
}) | ||
|
||
it('with placement on the right', () => { | ||
cy.getByTestId('placement-right-trigger').invoke('show').click({ force: true }) | ||
cy.compareSnapshot(`tooltip-right-placement-${platform}`) | ||
}) | ||
}) | ||
} | ||
}) |
Binary file added
BIN
+15.3 KB
...ypress/snapshots/base/visual/bal-tooltip.visual.cy.ts/tooltip-arrow-desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13.4 KB
...ypress/snapshots/base/visual/bal-tooltip.visual.cy.ts/tooltip-basic-desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14.6 KB
...pshots/base/visual/bal-tooltip.visual.cy.ts/tooltip-right-placement-desktop.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 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 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
27 changes: 27 additions & 0 deletions
27
packages/components/src/components/bal-tooltip/bal-tooltip.interfaces.ts
This file contains 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,27 @@ | ||
/* eslint-disable no-unused-vars */ | ||
/* eslint-disable @typescript-eslint/no-unused-vars */ | ||
// eslint-disable-next-line @typescript-eslint/triple-slash-reference | ||
/// <reference path="../../interfaces.d.ts" /> | ||
|
||
namespace BalProps { | ||
export type BalTooltipTouchPosition = 'top' | 'bottom' | ||
export type BalTooltipVariant = 'popover' | 'fullscreen' | 'drawer' | ||
|
||
export type BalTooltipPlacement = 'top' | 'right' | 'bottom' | 'left' | ||
} | ||
|
||
namespace BalEvents { | ||
export interface BalTooltipCustomEvent<T> extends CustomEvent<T> { | ||
detail: T | ||
target: HTMLBalTooltipElement | ||
} | ||
|
||
export type BalTooltipChangeDetail = boolean | ||
export type BalTooltipChange = BalTooltipCustomEvent<BalTooltipChangeDetail> | ||
|
||
export type BalTooltipWillAnimateDetail = boolean | ||
export type BalTooltipWillAnimate = BalTooltipCustomEvent<BalTooltipWillAnimateDetail> | ||
|
||
export type BalTooltipDidAnimateDetail = boolean | ||
export type BalTooltipDidAnimate = BalTooltipCustomEvent<BalTooltipDidAnimateDetail> | ||
} |
54 changes: 54 additions & 0 deletions
54
packages/components/src/components/bal-tooltip/bal-tooltip.sass
This file contains 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,54 @@ | ||
@import '@baloise/design-system-css/sass/mixins' | ||
@import './bal-tooltip.vars.sass' | ||
|
||
// Tooltip | ||
// -------------------------------------------------- | ||
:host | ||
position: static | ||
display: inline | ||
z-index: var(--bal-z-index-tooltip) | ||
|
||
// Tooltip Container | ||
// -------------------------------------------------- | ||
.bal-tooltip__container | ||
background-color: var(--bal-tooltip-container-background) | ||
display: none | ||
visibility: hidden | ||
color: white | ||
padding: var(--bal-space-x-small) | ||
border-radius: var(--bal-tooltip-radius) | ||
box-shadow: var(--bal-tooltip-shadow) | ||
width: var(--bal-tooltip-max-width) | ||
position: absolute | ||
top: 0 | ||
left: 0 | ||
|
||
// Tooltip Container Inner | ||
// -------------------------------------------------- | ||
.bal-tooltip__inner | ||
overflow-y: auto | ||
max-height: calc(var(--bal-app-height, 100%) - 8rem) | ||
|
||
// Tooltip Content | ||
// -------------------------------------------------- | ||
.bal-tooltip__inner__content | ||
width: 100% | ||
font-family: var(--bal-tooltip-font-family) | ||
font-size: var(--bal-tooltip-font-size) | ||
|
||
// Tooltip Arrow | ||
// -------------------------------------------------- | ||
.bal-tooltip__arrow | ||
+unselectable | ||
position: absolute | ||
width: .5rem | ||
height: .5rem | ||
background: var(--bal-tooltip-arrow-background) | ||
transform: rotate(45deg) | ||
display: none | ||
visibility: hidden | ||
|
||
.bal-tooltip-variant-popover-trigger, | ||
.bal-tooltip-permanent-trigger | ||
z-index: calc(var(--bal-z-index-tooltip) + 1) !important | ||
position: relative !important |
Oops, something went wrong.