Skip to content

Commit

Permalink
fix(esl-tooltip): simplify code and remove overrides (according to es…
Browse files Browse the repository at this point in the history
…l-popup base state)
  • Loading branch information
ala-n committed Nov 14, 2024
1 parent 04d6a63 commit 699ac7f
Showing 1 changed file with 4 additions and 21 deletions.
25 changes: 4 additions & 21 deletions src/modules/esl-tooltip/core/esl-tooltip.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import {ExportNs} from '../../esl-utils/environment/export-ns';
import {ESLPopup} from '../../esl-popup/core';
import {memoize, attr, boolAttr} from '../../esl-utils/decorators';
import {memoize, boolAttr} from '../../esl-utils/decorators';

import type {ESLPopupActionParams} from '../../esl-popup/core';
import type {PositionType} from '../../esl-popup/core/esl-popup-position';
import type {FocusFlowType} from '../../esl-utils/dom/focus';

export interface ESLTooltipActionParams extends ESLPopupActionParams {
/** text to be shown */
Expand All @@ -29,26 +27,10 @@ export class ESLTooltip extends ESLPopup {
/** Default params to pass into the tooltip on show/hide actions */
public static override DEFAULT_PARAMS: ESLTooltipActionParams = {
...ESLPopup.DEFAULT_PARAMS,
autofocus: true
position: 'top',
hideDelay: 300
};

/**
* Focus behaviour. Awailable values:
* - 'none' - no focus management
* - 'chain' (default) - focus on the first focusable element first and return focus to the activator after the last focusable element
* - 'loop' - focus on the first focusable element and loop through the focusable elements
*/
@attr({defaultValue: 'chain'}) public override focusBehaviour: FocusFlowType;

/**
* Tooltip position relative to the trigger.
* Currently supported: 'top', 'bottom', 'left', 'right' position types ('top' by default)
*/
@attr({defaultValue: 'top'}) public override position: PositionType;

/** Tooltip behavior if it does not fit in the window ('fit' by default) */
@attr({defaultValue: 'fit'}) public override behavior: string;

/** Disable arrow at Tooltip */
@boolAttr() public disableArrow: boolean;

Expand Down Expand Up @@ -94,6 +76,7 @@ export class ESLTooltip extends ESLPopup {
if (params.html) {
this.innerHTML = params.html;
}

this.dir = params.dir || '';
this.lang = params.lang || '';
this.parentNode !== document.body && document.body.appendChild(this);
Expand Down

0 comments on commit 699ac7f

Please # to comment.