Skip to content
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

feat(Tooltip): update TS structure #327

Merged
merged 5 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

import lng from '@lightningjs/core';
import Base from '../Base';
import type { Color, StylePartial } from '../../types/lui';
import type { TextBoxStyle } from '../TextBox';
import { Color, StylePartial } from '../../types/lui';
import TextBox, { TextBoxStyle } from '../TextBox';

export type TooltipStyle = {
type TooltipStyle = {
backgroundColor: Color;
marginBottom: number;
paddingX: number;
Expand All @@ -33,14 +33,50 @@ export type TooltipStyle = {
transition: lng.types.TransitionSettings;
};

export default class Tooltip extends Base {
declare namespace Tooltip {
export interface TemplateSpec extends Base.TemplateSpec {
/**
* Text of tooltip content
*/
title?: string;

/**
* The amount of time, in milliseconds, before the tooltip is displayed after being focused
*/
delayVisible?: number;

/**
* The amount of time, in milliseconds, the tooltip is displayed before transitioning out of the display
*/
timeVisible?: number;
}
}

declare class Tooltip<
TemplateSpec extends Tooltip.TemplateSpec = Tooltip.TemplateSpec,
TypeConfig extends lng.Component.TypeConfig = lng.Component.TypeConfig
> extends Base<TemplateSpec, TypeConfig> {
/**
* text of tooltip
*/
title?: string;

/**
* the amount of time, in milliseconds, before the tooltip is displayed after being focused
*/
delayVisible?: number;

/**
* the amount of time, in milliseconds, the tooltip is displayed before transitioning out of the display
*/
timeVisible?: number;

get style(): TooltipStyle;
set style(v: StylePartial<TooltipStyle>);

// tags
get _Background(): lng.Component;
get _Text(): lng.Component;
get _Text(): TextBox;
}

export { Tooltip as default, TooltipStyle };
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,18 @@ Tooltip is only visible on focus of the parent.
| ------------ | ------ | --------- | ----------------------------------------------------------------------------------------------------- |
| delayVisible | number | undefined | the amount of time, in milliseconds, before the tooltip is displayed after being focused |
| timeVisible | number | undefined | the amount of time, in milliseconds, the tooltip is displayed before transitioning out of the display |
| title | string | undefined | tool tip text goes here |
| title | string | undefined | text of tooltip content |

### Style Properties

| name | type | description |
| --------------- | ---------------- | ---------------------------------------------------- |
| backgroundColor | number | background color of tooltip |
| marginBottom | number | space below tooltip |
| paddingX | number | space on left and right sides of tooltip text |
| paddingY | number | space above and below tooltip text |
| pointerW | number | width of point beneath rounded rectangle of tooltip |
| pointerH | number | height of point beneath rounded rectangle of tooltip |
| radius | number \| array | radius of tooltip corners |
| textStyle | string \| object | text styles used for Tooltip's text |
| name | type | description |
| --------------- | -------------------------------- | ---------------------------------------------------- |
| backgroundColor | number | background color of tooltip |
| marginBottom | number | space below tooltip |
| paddingX | number | space on left and right sides of tooltip text |
| paddingY | number | space above and below tooltip text |
| pointerW | number | width of point beneath rounded rectangle of tooltip |
| pointerH | number | height of point beneath rounded rectangle of tooltip |
| radius | number \| array | radius of tooltip corners |
| textStyle | string \| object | text styles used for Tooltip's text |
| transition | <DocsLink id="lng.Transition" /> | transition to apply to text |
Loading