@momentum-design/components 0.34.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.js +258 -233
- package/dist/browser/index.js.map +4 -4
- package/dist/components/coachmark/coachmark.component.d.ts +52 -0
- package/dist/components/coachmark/coachmark.component.js +82 -0
- package/dist/components/coachmark/coachmark.constants.d.ts +9 -0
- package/dist/components/coachmark/coachmark.constants.js +11 -0
- package/dist/components/coachmark/index.d.ts +8 -0
- package/dist/components/coachmark/index.js +5 -0
- package/dist/components/popover/popover.component.js +1 -1
- package/dist/components/popover/popover.styles.js +1 -1
- package/dist/components/tooltip/index.d.ts +7 -0
- package/dist/components/tooltip/index.js +4 -0
- package/dist/components/tooltip/tooltip.component.d.ts +59 -0
- package/dist/components/tooltip/tooltip.component.js +175 -0
- package/dist/components/tooltip/tooltip.constants.d.ts +16 -0
- package/dist/components/tooltip/tooltip.constants.js +18 -0
- package/dist/components/tooltip/tooltip.styles.d.ts +2 -0
- package/dist/components/tooltip/tooltip.styles.js +28 -0
- package/dist/components/tooltip/tooltip.types.d.ts +3 -0
- package/dist/components/tooltip/tooltip.types.js +1 -0
- package/dist/custom-elements.json +9132 -5913
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/react/coachmark/index.d.ts +23 -0
- package/dist/react/coachmark/index.js +32 -0
- package/dist/react/index.d.ts +3 -1
- package/dist/react/index.js +3 -1
- package/dist/react/tooltip/index.d.ts +17 -0
- package/dist/react/tooltip/index.js +26 -0
- package/package.json +1 -1
@@ -0,0 +1,52 @@
|
|
1
|
+
import Popover from '../popover/popover.component';
|
2
|
+
import type { PopoverTrigger } from '../popover/popover.types';
|
3
|
+
/**
|
4
|
+
* Coachmark component based on top of the popover component,
|
5
|
+
* with the default value of certain properties changed.
|
6
|
+
*
|
7
|
+
* @dependency mdc-popover
|
8
|
+
*
|
9
|
+
* @tagname mdc-coachmark
|
10
|
+
*
|
11
|
+
* @cssproperty --mdc-popover-arrow-border-radius - radius of the arrow border
|
12
|
+
* @cssproperty --mdc-popover-arrow-border - border of the arrow
|
13
|
+
* @cssproperty --mdc-popover-primary-background-color - primary background color of the popover
|
14
|
+
* @cssproperty --mdc-popover-border-color - border color of the popover
|
15
|
+
* @cssproperty --mdc-popover-inverted-background-color - inverted background color of the popover
|
16
|
+
* @cssproperty --mdc-popover-inverted-border-color - inverted border color of the popover
|
17
|
+
* @cssproperty --mdc-popover-inverted-text-color - inverted text color of the popover
|
18
|
+
* @cssproperty --mdc-popover-elevation-3 - elevation of the popover
|
19
|
+
*
|
20
|
+
* @slot - Default slot for modal container
|
21
|
+
*
|
22
|
+
*/
|
23
|
+
declare class Coachmark extends Popover {
|
24
|
+
/**
|
25
|
+
* Determines the events that cause the Coachmark to show.
|
26
|
+
* Multiple event names should be separated by spaces.
|
27
|
+
* For example to allow both click and hover, use 'click mouseenter' as the trigger.
|
28
|
+
* - **click**
|
29
|
+
* - **mouseenter**
|
30
|
+
* - **focusin**
|
31
|
+
* - **manual**
|
32
|
+
* @default manual
|
33
|
+
*/
|
34
|
+
trigger: PopoverTrigger;
|
35
|
+
/**
|
36
|
+
* The arrow visibility of the Coachmark.
|
37
|
+
* @default true
|
38
|
+
*/
|
39
|
+
showArrow: boolean;
|
40
|
+
/**
|
41
|
+
* The close button visibility of the Coachmark.
|
42
|
+
* @default true
|
43
|
+
*/
|
44
|
+
closeButton: boolean;
|
45
|
+
/**
|
46
|
+
* Disable aria-expanded attribute on trigger element.
|
47
|
+
* @default true
|
48
|
+
*/
|
49
|
+
disableAriaExpanded: boolean;
|
50
|
+
constructor();
|
51
|
+
}
|
52
|
+
export default Coachmark;
|
@@ -0,0 +1,82 @@
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
9
|
+
};
|
10
|
+
import { property } from 'lit/decorators.js';
|
11
|
+
import Popover from '../popover/popover.component';
|
12
|
+
import { DEFAULTS } from './coachmark.constants';
|
13
|
+
/**
|
14
|
+
* Coachmark component based on top of the popover component,
|
15
|
+
* with the default value of certain properties changed.
|
16
|
+
*
|
17
|
+
* @dependency mdc-popover
|
18
|
+
*
|
19
|
+
* @tagname mdc-coachmark
|
20
|
+
*
|
21
|
+
* @cssproperty --mdc-popover-arrow-border-radius - radius of the arrow border
|
22
|
+
* @cssproperty --mdc-popover-arrow-border - border of the arrow
|
23
|
+
* @cssproperty --mdc-popover-primary-background-color - primary background color of the popover
|
24
|
+
* @cssproperty --mdc-popover-border-color - border color of the popover
|
25
|
+
* @cssproperty --mdc-popover-inverted-background-color - inverted background color of the popover
|
26
|
+
* @cssproperty --mdc-popover-inverted-border-color - inverted border color of the popover
|
27
|
+
* @cssproperty --mdc-popover-inverted-text-color - inverted text color of the popover
|
28
|
+
* @cssproperty --mdc-popover-elevation-3 - elevation of the popover
|
29
|
+
*
|
30
|
+
* @slot - Default slot for modal container
|
31
|
+
*
|
32
|
+
*/
|
33
|
+
class Coachmark extends Popover {
|
34
|
+
constructor() {
|
35
|
+
super();
|
36
|
+
/**
|
37
|
+
* Determines the events that cause the Coachmark to show.
|
38
|
+
* Multiple event names should be separated by spaces.
|
39
|
+
* For example to allow both click and hover, use 'click mouseenter' as the trigger.
|
40
|
+
* - **click**
|
41
|
+
* - **mouseenter**
|
42
|
+
* - **focusin**
|
43
|
+
* - **manual**
|
44
|
+
* @default manual
|
45
|
+
*/
|
46
|
+
this.trigger = DEFAULTS.TRIGGER;
|
47
|
+
/**
|
48
|
+
* The arrow visibility of the Coachmark.
|
49
|
+
* @default true
|
50
|
+
*/
|
51
|
+
this.showArrow = DEFAULTS.ARROW;
|
52
|
+
/**
|
53
|
+
* The close button visibility of the Coachmark.
|
54
|
+
* @default true
|
55
|
+
*/
|
56
|
+
this.closeButton = DEFAULTS.CLOSE_BUTTON;
|
57
|
+
/**
|
58
|
+
* Disable aria-expanded attribute on trigger element.
|
59
|
+
* @default true
|
60
|
+
*/
|
61
|
+
this.disableAriaExpanded = DEFAULTS.DISABLE_ARIA_EXPANDED;
|
62
|
+
this.color = DEFAULTS.COLOR;
|
63
|
+
this.showArrow = DEFAULTS.ARROW;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
__decorate([
|
67
|
+
property({ type: String, reflect: true }),
|
68
|
+
__metadata("design:type", String)
|
69
|
+
], Coachmark.prototype, "trigger", void 0);
|
70
|
+
__decorate([
|
71
|
+
property({ type: Boolean, attribute: 'show-arrow' }),
|
72
|
+
__metadata("design:type", Boolean)
|
73
|
+
], Coachmark.prototype, "showArrow", void 0);
|
74
|
+
__decorate([
|
75
|
+
property({ type: Boolean, reflect: true, attribute: 'close-button' }),
|
76
|
+
__metadata("design:type", Boolean)
|
77
|
+
], Coachmark.prototype, "closeButton", void 0);
|
78
|
+
__decorate([
|
79
|
+
property({ type: Boolean, reflect: true, attribute: 'disable-aria-expanded' }),
|
80
|
+
__metadata("design:type", Boolean)
|
81
|
+
], Coachmark.prototype, "disableAriaExpanded", void 0);
|
82
|
+
export default Coachmark;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import utils from '../../utils/tag-name';
|
2
|
+
import { COLOR, TRIGGER } from '../popover/popover.constants';
|
3
|
+
const TAG_NAME = utils.constructTagName('coachmark');
|
4
|
+
const DEFAULTS = {
|
5
|
+
COLOR: COLOR.CONTRAST,
|
6
|
+
TRIGGER: TRIGGER.MANUAL,
|
7
|
+
ARROW: true,
|
8
|
+
CLOSE_BUTTON: true,
|
9
|
+
DISABLE_ARIA_EXPANDED: true,
|
10
|
+
};
|
11
|
+
export { TAG_NAME, DEFAULTS };
|
@@ -614,7 +614,7 @@ __decorate([
|
|
614
614
|
__metadata("design:type", Boolean)
|
615
615
|
], Popover.prototype, "preventScroll", void 0);
|
616
616
|
__decorate([
|
617
|
-
property({ type: Boolean, attribute: 'show-arrow' }),
|
617
|
+
property({ type: Boolean, reflect: true, attribute: 'show-arrow' }),
|
618
618
|
__metadata("design:type", Boolean)
|
619
619
|
], Popover.prototype, "showArrow", void 0);
|
620
620
|
__decorate([
|
@@ -27,7 +27,7 @@ const styles = css `
|
|
27
27
|
:host([color='contrast']) {
|
28
28
|
background-color: var(--mdc-popover-inverted-background-color);
|
29
29
|
border-color: var(--mdc-popover-inverted-border-color);
|
30
|
-
color: var(--
|
30
|
+
color: var(--mdc-popover-inverted-text-color);
|
31
31
|
}
|
32
32
|
|
33
33
|
:host([color='contrast']) {
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import type { CSSResult } from 'lit';
|
2
|
+
import type { PropertyValues } from '@lit/reactive-element';
|
3
|
+
import Popover from '../popover/popover.component';
|
4
|
+
import type { TooltipType } from './tooltip.types';
|
5
|
+
/**
|
6
|
+
* A tooltip is triggered by mouse hover or by keyboard focus
|
7
|
+
* and will disappear upon mouse exit or focus change.
|
8
|
+
*
|
9
|
+
* Note: Tooltips cannot contain content that can be focused or interacted with.
|
10
|
+
*
|
11
|
+
* @tagname mdc-tooltip
|
12
|
+
*
|
13
|
+
* @cssproperty --mdc-tooltip-max-width - The maximum width of the tooltip.
|
14
|
+
* @cssproperty --mdc-tooltip-padding - The padding of the tooltip.
|
15
|
+
* @cssproperty --mdc-tooltip-text-color - The text color of the tooltip.
|
16
|
+
* @cssproperty --mdc-tooltip-text-color-contrast - The text color of the tooltip when the color is contrast.
|
17
|
+
*
|
18
|
+
*/
|
19
|
+
declare class Tooltip extends Popover {
|
20
|
+
/**
|
21
|
+
* The type of tooltip.
|
22
|
+
* - **description** sets aria-describedby on the trigger component which refers to the tooltip id.
|
23
|
+
* - **label** sets aria-labelledby on the trigger component which refers to the tooltip id.
|
24
|
+
* - **none** no aria props set on trigger component referring to the tooltip id.
|
25
|
+
* @default 'description'
|
26
|
+
*/
|
27
|
+
tooltipType: TooltipType;
|
28
|
+
private defaultSlotNodes;
|
29
|
+
constructor();
|
30
|
+
/**
|
31
|
+
* @returns The tooltip text.
|
32
|
+
*/
|
33
|
+
private getTooltipText;
|
34
|
+
/**
|
35
|
+
* Sets the type attribute for the tooltip component.
|
36
|
+
* If the provided type is not included in the TOOLTIP_TYPES,
|
37
|
+
* it defaults to the value specified in DEFAULTS.TOOLTIP_TYPE.
|
38
|
+
*
|
39
|
+
* @param type - The type to set.
|
40
|
+
*/
|
41
|
+
private setTooltipType;
|
42
|
+
/**
|
43
|
+
* Updates the tooltip id if it is empty.
|
44
|
+
*/
|
45
|
+
private onIdUpdated;
|
46
|
+
/**
|
47
|
+
* Updates the placement attribute if it is not a valid placement.
|
48
|
+
* Overriding the default from Popover
|
49
|
+
*/
|
50
|
+
private onPlacementUpdated;
|
51
|
+
/**
|
52
|
+
* Updates the tooltip type attribute and sets the appropriate aria props on the trigger component.
|
53
|
+
* @param changedProperties - The changed properties.
|
54
|
+
*/
|
55
|
+
private onTooltipTypeUpdated;
|
56
|
+
update(changedProperties: PropertyValues): void;
|
57
|
+
static styles: Array<CSSResult>;
|
58
|
+
}
|
59
|
+
export default Tooltip;
|
@@ -0,0 +1,175 @@
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
9
|
+
};
|
10
|
+
import { property, queryAssignedNodes } from 'lit/decorators.js';
|
11
|
+
import { v4 as uuidv4 } from 'uuid';
|
12
|
+
import { DEFAULTS, TOOLTIP_TYPES } from './tooltip.constants';
|
13
|
+
import Popover from '../popover/popover.component';
|
14
|
+
import styles from './tooltip.styles';
|
15
|
+
import { POPOVER_PLACEMENT } from '../popover/popover.constants';
|
16
|
+
/**
|
17
|
+
* A tooltip is triggered by mouse hover or by keyboard focus
|
18
|
+
* and will disappear upon mouse exit or focus change.
|
19
|
+
*
|
20
|
+
* Note: Tooltips cannot contain content that can be focused or interacted with.
|
21
|
+
*
|
22
|
+
* @tagname mdc-tooltip
|
23
|
+
*
|
24
|
+
* @cssproperty --mdc-tooltip-max-width - The maximum width of the tooltip.
|
25
|
+
* @cssproperty --mdc-tooltip-padding - The padding of the tooltip.
|
26
|
+
* @cssproperty --mdc-tooltip-text-color - The text color of the tooltip.
|
27
|
+
* @cssproperty --mdc-tooltip-text-color-contrast - The text color of the tooltip when the color is contrast.
|
28
|
+
*
|
29
|
+
*/
|
30
|
+
class Tooltip extends Popover {
|
31
|
+
constructor() {
|
32
|
+
super();
|
33
|
+
/**
|
34
|
+
* The type of tooltip.
|
35
|
+
* - **description** sets aria-describedby on the trigger component which refers to the tooltip id.
|
36
|
+
* - **label** sets aria-labelledby on the trigger component which refers to the tooltip id.
|
37
|
+
* - **none** no aria props set on trigger component referring to the tooltip id.
|
38
|
+
* @default 'description'
|
39
|
+
*/
|
40
|
+
this.tooltipType = DEFAULTS.TOOLTIP_TYPE;
|
41
|
+
this.backdrop = false;
|
42
|
+
this.color = DEFAULTS.COLOR;
|
43
|
+
this.delay = DEFAULTS.DELAY;
|
44
|
+
this.focusTrap = false;
|
45
|
+
this.hideOnBlur = true;
|
46
|
+
this.hideOnEscape = true;
|
47
|
+
this.interactive = false;
|
48
|
+
this.offset = DEFAULTS.OFFSET;
|
49
|
+
this.placement = DEFAULTS.PLACEMENT;
|
50
|
+
this.role = 'tooltip';
|
51
|
+
this.showArrow = true;
|
52
|
+
this.trigger = 'mouseenter focusin';
|
53
|
+
this.visible = false;
|
54
|
+
this.enabledFocusTrap = false;
|
55
|
+
this.enabledPreventScroll = false;
|
56
|
+
this.flip = true;
|
57
|
+
this.focusTrap = false;
|
58
|
+
this.preventScroll = false;
|
59
|
+
this.closeButton = false;
|
60
|
+
this.hideOnOutsideClick = false;
|
61
|
+
this.focusBackToTrigger = false;
|
62
|
+
this.size = false;
|
63
|
+
this.disableAriaExpanded = true;
|
64
|
+
}
|
65
|
+
/**
|
66
|
+
* @returns The tooltip text.
|
67
|
+
*/
|
68
|
+
getTooltipText() {
|
69
|
+
var _a, _b;
|
70
|
+
return (((_b = (_a = this.defaultSlotNodes) === null || _a === void 0 ? void 0 : _a.map((node) => node.textContent).join(' ')) === null || _b === void 0 ? void 0 : _b.trim()) || '');
|
71
|
+
}
|
72
|
+
/**
|
73
|
+
* Sets the type attribute for the tooltip component.
|
74
|
+
* If the provided type is not included in the TOOLTIP_TYPES,
|
75
|
+
* it defaults to the value specified in DEFAULTS.TOOLTIP_TYPE.
|
76
|
+
*
|
77
|
+
* @param type - The type to set.
|
78
|
+
*/
|
79
|
+
setTooltipType(type) {
|
80
|
+
this.setAttribute('tooltip-type', Object.values(TOOLTIP_TYPES).includes(type) ? type : DEFAULTS.TOOLTIP_TYPE);
|
81
|
+
}
|
82
|
+
/**
|
83
|
+
* Updates the tooltip id if it is empty.
|
84
|
+
*/
|
85
|
+
onIdUpdated() {
|
86
|
+
// Set tooltip ID if not set.
|
87
|
+
if (this.id.length === 0) {
|
88
|
+
this.id = `mdc-tooltip-${uuidv4()}`;
|
89
|
+
}
|
90
|
+
// Update the aria props on the trigger component to updated tooltip id.
|
91
|
+
const triggerElement = document.getElementById(this.triggerID);
|
92
|
+
if (triggerElement) {
|
93
|
+
switch (this.tooltipType) {
|
94
|
+
case TOOLTIP_TYPES.DESCRIPTION:
|
95
|
+
triggerElement.setAttribute('aria-describedby', this.id);
|
96
|
+
break;
|
97
|
+
case TOOLTIP_TYPES.LABEL:
|
98
|
+
triggerElement.setAttribute('aria-labelledby', this.id);
|
99
|
+
break;
|
100
|
+
default:
|
101
|
+
break;
|
102
|
+
}
|
103
|
+
}
|
104
|
+
}
|
105
|
+
/**
|
106
|
+
* Updates the placement attribute if it is not a valid placement.
|
107
|
+
* Overriding the default from Popover
|
108
|
+
*/
|
109
|
+
onPlacementUpdated() {
|
110
|
+
if (!Object.values(POPOVER_PLACEMENT).includes(this.placement)) {
|
111
|
+
this.placement = DEFAULTS.PLACEMENT;
|
112
|
+
}
|
113
|
+
}
|
114
|
+
/**
|
115
|
+
* Updates the tooltip type attribute and sets the appropriate aria props on the trigger component.
|
116
|
+
* @param changedProperties - The changed properties.
|
117
|
+
*/
|
118
|
+
onTooltipTypeUpdated(changedProperties) {
|
119
|
+
const previousTooltipType = changedProperties.get('tooltipType');
|
120
|
+
if (!Object.values(TOOLTIP_TYPES).includes(this.tooltipType)) {
|
121
|
+
this.setTooltipType(DEFAULTS.TOOLTIP_TYPE);
|
122
|
+
}
|
123
|
+
const triggerElement = document.getElementById(this.triggerID);
|
124
|
+
if (triggerElement) {
|
125
|
+
const tooltipText = this.getTooltipText();
|
126
|
+
switch (this.tooltipType) {
|
127
|
+
case TOOLTIP_TYPES.DESCRIPTION:
|
128
|
+
if (previousTooltipType === TOOLTIP_TYPES.LABEL) {
|
129
|
+
triggerElement.removeAttribute('aria-labelledby');
|
130
|
+
}
|
131
|
+
triggerElement.setAttribute('aria-describedby', this.id);
|
132
|
+
break;
|
133
|
+
case TOOLTIP_TYPES.LABEL:
|
134
|
+
if (previousTooltipType === TOOLTIP_TYPES.DESCRIPTION) {
|
135
|
+
triggerElement.removeAttribute('aria-describedby');
|
136
|
+
}
|
137
|
+
triggerElement.setAttribute('aria-labelledby', this.id);
|
138
|
+
break;
|
139
|
+
default:
|
140
|
+
if (previousTooltipType === TOOLTIP_TYPES.DESCRIPTION) {
|
141
|
+
triggerElement.removeAttribute('aria-describedby');
|
142
|
+
}
|
143
|
+
else if (previousTooltipType === TOOLTIP_TYPES.LABEL) {
|
144
|
+
triggerElement.removeAttribute('aria-labelledby');
|
145
|
+
}
|
146
|
+
break;
|
147
|
+
}
|
148
|
+
if (tooltipText.length > 0 && this.tooltipType !== TOOLTIP_TYPES.NONE && !this.ariaLabel) {
|
149
|
+
this.ariaLabel = tooltipText;
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
update(changedProperties) {
|
154
|
+
super.update(changedProperties);
|
155
|
+
if (changedProperties.has('id')) {
|
156
|
+
this.onIdUpdated();
|
157
|
+
}
|
158
|
+
if (changedProperties.has('placement')) {
|
159
|
+
this.onPlacementUpdated();
|
160
|
+
}
|
161
|
+
if (changedProperties.has('tooltipType')) {
|
162
|
+
this.onTooltipTypeUpdated(changedProperties);
|
163
|
+
}
|
164
|
+
}
|
165
|
+
}
|
166
|
+
Tooltip.styles = [...Popover.styles, ...styles];
|
167
|
+
__decorate([
|
168
|
+
property({ type: String, attribute: 'tooltip-type', reflect: true }),
|
169
|
+
__metadata("design:type", String)
|
170
|
+
], Tooltip.prototype, "tooltipType", void 0);
|
171
|
+
__decorate([
|
172
|
+
queryAssignedNodes(),
|
173
|
+
__metadata("design:type", Array)
|
174
|
+
], Tooltip.prototype, "defaultSlotNodes", void 0);
|
175
|
+
export default Tooltip;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
declare const TAG_NAME: "mdc-tooltip";
|
2
|
+
declare const TOOLTIP_TYPES: {
|
3
|
+
DESCRIPTION: string;
|
4
|
+
LABEL: string;
|
5
|
+
NONE: string;
|
6
|
+
};
|
7
|
+
declare const DEFAULTS: {
|
8
|
+
BACKDROP: boolean;
|
9
|
+
COLOR: "tonal";
|
10
|
+
DELAY: string;
|
11
|
+
OFFSET: number;
|
12
|
+
PLACEMENT: "top";
|
13
|
+
SHOW_ARROW: boolean;
|
14
|
+
TOOLTIP_TYPE: string;
|
15
|
+
};
|
16
|
+
export { DEFAULTS, TAG_NAME, TOOLTIP_TYPES };
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import utils from '../../utils/tag-name';
|
2
|
+
import { COLOR, POPOVER_PLACEMENT } from '../popover/popover.constants';
|
3
|
+
const TAG_NAME = utils.constructTagName('tooltip');
|
4
|
+
const TOOLTIP_TYPES = {
|
5
|
+
DESCRIPTION: 'description',
|
6
|
+
LABEL: 'label',
|
7
|
+
NONE: 'none',
|
8
|
+
};
|
9
|
+
const DEFAULTS = {
|
10
|
+
BACKDROP: false,
|
11
|
+
COLOR: COLOR.TONAL,
|
12
|
+
DELAY: '0,0',
|
13
|
+
OFFSET: 4,
|
14
|
+
PLACEMENT: POPOVER_PLACEMENT.TOP,
|
15
|
+
SHOW_ARROW: true,
|
16
|
+
TOOLTIP_TYPE: TOOLTIP_TYPES.DESCRIPTION,
|
17
|
+
};
|
18
|
+
export { DEFAULTS, TAG_NAME, TOOLTIP_TYPES };
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { css } from 'lit';
|
2
|
+
const styles = css `
|
3
|
+
|
4
|
+
:host {
|
5
|
+
--mdc-tooltip-max-width: 400px;
|
6
|
+
--mdc-tooltip-padding: 0.75rem;
|
7
|
+
--mdc-tooltip-text-color: var(--mds-color-theme-text-primary-normal);
|
8
|
+
--mdc-tooltip-text-color-contrast: var(--mds-color-theme-inverted-text-primary-normal);
|
9
|
+
}
|
10
|
+
|
11
|
+
:host::part(popover-content) {
|
12
|
+
padding: var(--mdc-tooltip-padding);
|
13
|
+
color: var(--mdc-tooltip-text-color);
|
14
|
+
min-width: fit-content;
|
15
|
+
max-width: var(--mdc-tooltip-max-width);
|
16
|
+
|
17
|
+
font-size: var(--mds-font-apps-body-midsize-regular-font-size);
|
18
|
+
font-weight: var(--mds-font-apps-body-midsize-regular-font-weight);
|
19
|
+
line-height: var(--mds-font-apps-body-midsize-regular-line-height);
|
20
|
+
text-decoration: var(--mds-font-apps-body-midsize-regular-text-decoration);
|
21
|
+
text-transform: var(--mds-font-apps-body-midsize-regular-text-case);
|
22
|
+
}
|
23
|
+
|
24
|
+
:host([color='contrast'])::part(popover-content) {
|
25
|
+
color: var(--mdc-tooltip-text-color-contrast);
|
26
|
+
}
|
27
|
+
`;
|
28
|
+
export default [styles];
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|