@progressio_resources/gravity-design-system 1.0.6 → 1.0.8
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/esm2020/lib/components/gravity-button/gravity-button.component.mjs +22 -0
- package/esm2020/lib/components/gravity-calendar/gravity-calendar.component.mjs +90 -0
- package/esm2020/lib/components/gravity-checkbox/gravity-checkbox.component.mjs +23 -0
- package/esm2020/lib/components/gravity-dropdown-list/gravity-dropdown-list.component.mjs +43 -0
- package/esm2020/lib/components/gravity-icon/gravity-icon.component.mjs +14 -0
- package/esm2020/lib/components/gravity-radio-button/gravity-radio-button.component.mjs +30 -0
- package/esm2020/lib/components/gravity-switch/gravity-switch.component.mjs +17 -0
- package/esm2020/lib/components/gravity-text-field/gravity-text-field.component.mjs +62 -0
- package/esm2020/lib/gravity-design-system.module.mjs +81 -6
- package/esm2020/lib/vendor/gravity-tooltip/gravity-tooltip.component.mjs +205 -0
- package/esm2020/lib/vendor/gravity-tooltip/gravity-tooltip.directive.mjs +480 -0
- package/esm2020/lib/vendor/gravity-tooltip/gravity-tooltip.module.mjs +41 -0
- package/esm2020/lib/vendor/gravity-tooltip/index.mjs +4 -0
- package/esm2020/lib/vendor/gravity-tooltip/options.interface.mjs +2 -0
- package/esm2020/lib/vendor/gravity-tooltip/options.mjs +38 -0
- package/esm2020/lib/vendor/gravity-tooltip/options.service.mjs +7 -0
- package/esm2020/public-api.mjs +12 -3
- package/fesm2015/progressio_resources-gravity-design-system.mjs +1100 -28
- package/fesm2015/progressio_resources-gravity-design-system.mjs.map +1 -1
- package/fesm2020/progressio_resources-gravity-design-system.mjs +1098 -28
- package/fesm2020/progressio_resources-gravity-design-system.mjs.map +1 -1
- package/lib/components/gravity-button/gravity-button.component.d.ts +18 -0
- package/lib/components/gravity-calendar/gravity-calendar.component.d.ts +40 -0
- package/lib/components/gravity-checkbox/gravity-checkbox.component.d.ts +8 -0
- package/lib/components/gravity-dropdown-list/gravity-dropdown-list.component.d.ts +36 -0
- package/lib/components/gravity-icon/gravity-icon.component.d.ts +6 -0
- package/lib/components/gravity-radio-button/gravity-radio-button.component.d.ts +13 -0
- package/lib/components/gravity-switch/gravity-switch.component.d.ts +6 -0
- package/lib/components/gravity-text-field/gravity-text-field.component.d.ts +35 -0
- package/lib/gravity-design-system.module.d.ts +17 -2
- package/lib/vendor/gravity-tooltip/gravity-tooltip.component.d.ts +42 -0
- package/lib/vendor/gravity-tooltip/gravity-tooltip.directive.d.ts +112 -0
- package/lib/vendor/gravity-tooltip/gravity-tooltip.module.d.ts +12 -0
- package/lib/vendor/gravity-tooltip/index.d.ts +3 -0
- package/lib/vendor/gravity-tooltip/options.d.ts +24 -0
- package/lib/vendor/gravity-tooltip/options.interface.d.ts +40 -0
- package/lib/vendor/gravity-tooltip/options.service.d.ts +7 -0
- package/package.json +9 -2
- package/public-api.d.ts +9 -2
- package/src/lib/assets/icons/calendar.svg +14 -0
- package/src/lib/assets/icons/check.svg +3 -0
- package/src/lib/assets/icons/copy.svg +8 -0
- package/src/lib/assets/icons/download.svg +7 -0
- package/src/lib/assets/icons/edit.svg +8 -0
- package/src/lib/assets/icons/eye_closed.svg +8 -0
- package/src/lib/assets/icons/eye_open.svg +6 -0
- package/src/lib/assets/icons/forgot_password.svg +7 -0
- package/src/lib/assets/icons/lock.svg +6 -0
- package/src/lib/assets/icons/logout.svg +9 -0
- package/src/lib/assets/icons/mail.svg +6 -0
- package/src/lib/assets/icons/radio-off.svg +3 -0
- package/src/lib/assets/icons/radio-on.svg +3 -0
- package/src/lib/assets/icons/search.svg +8 -0
- package/src/lib/assets/icons/settings.svg +12 -0
- package/src/lib/assets/icons/show_less.svg +6 -0
- package/src/lib/assets/icons/show_more.svg +6 -0
- package/src/lib/assets/icons/uncheck.svg +3 -0
- package/src/lib/assets/icons/user.svg +6 -0
- package/src/lib/assets/icons/x.svg +6 -0
- package/src/lib/assets/json/icons.json +91 -0
- package/src/lib/styles/_card_highlight.scss +40 -0
- package/src/lib/styles/_datepicker.scss +101 -0
- package/src/lib/styles/_link.scss +25 -0
- package/src/lib/styles/_shared.scss +19 -0
- package/src/lib/styles/fundamentals/colors/themes/_hero.theme.scss +13 -10
- package/src/lib/styles/fundamentals/colors/tokens/_hero.tokens.scss +15 -13
- package/src/lib/styles/fundamentals/typography/_hero.typography.scss +0 -1
- package/src/lib/styles/gravity-design-system.scss +6 -0
- package/src/lib/styles/overwrite/pretty-checkbox/_core.scss +120 -0
- package/src/lib/styles/overwrite/pretty-checkbox/_variables.scss +39 -0
- package/src/lib/styles/overwrite/pretty-checkbox/elements/default/_outline.scss +41 -0
- package/src/lib/styles/overwrite/pretty-checkbox/elements/switch/_fill.scss +7 -0
- package/src/lib/styles/overwrite/pretty-checkbox/elements/switch/_general.scss +47 -0
- package/src/lib/styles/overwrite/pretty-checkbox/elements/switch/_mixin.scss +15 -0
- package/src/lib/styles/overwrite/pretty-checkbox/pretty-checkbox.scss +29 -0
- package/src/lib/vendor/gravity-tooltip/gravity-tooltip.component.html +9 -0
- package/src/lib/vendor/gravity-tooltip/gravity-tooltip.component.sass +134 -0
- package/src/lib/vendor/gravity-tooltip/gravity-tooltip.component.ts +215 -0
- package/src/lib/vendor/gravity-tooltip/gravity-tooltip.directive.ts +506 -0
- package/src/lib/vendor/gravity-tooltip/gravity-tooltip.module.ts +33 -0
- package/src/lib/vendor/gravity-tooltip/index.ts +3 -0
- package/src/lib/vendor/gravity-tooltip/options.interface.ts +37 -0
- package/src/lib/vendor/gravity-tooltip/options.service.ts +8 -0
- package/src/lib/vendor/gravity-tooltip/options.ts +38 -0
- package/esm2020/lib/gravity-design-system.component.mjs +0 -19
- package/esm2020/lib/gravity-design-system.service.mjs +0 -11
- package/lib/gravity-design-system.component.d.ts +0 -5
- package/lib/gravity-design-system.service.d.ts +0 -5
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
\:host
|
|
2
|
+
max-width: 200px
|
|
3
|
+
background-color: var(--bg-tooltip-primary)
|
|
4
|
+
color: var(--on-bg-tooltip-primary)
|
|
5
|
+
text-align: center
|
|
6
|
+
border-radius: 6px
|
|
7
|
+
padding: 5px 8px
|
|
8
|
+
position: absolute
|
|
9
|
+
pointer-events: none
|
|
10
|
+
z-index: 1000
|
|
11
|
+
display: block
|
|
12
|
+
opacity: 0
|
|
13
|
+
-webkit-transition: opacity 300ms
|
|
14
|
+
-moz-transition: opacity 300ms
|
|
15
|
+
-o-transition: opacity 300ms
|
|
16
|
+
transition: opacity 300ms
|
|
17
|
+
top: 0
|
|
18
|
+
left: 0
|
|
19
|
+
|
|
20
|
+
\:host.tooltip-show
|
|
21
|
+
opacity: 1
|
|
22
|
+
|
|
23
|
+
\:host.tooltip-shadow
|
|
24
|
+
box-shadow: 0 7px 15px -5px rgba(0, 0, 0, 0.4)
|
|
25
|
+
|
|
26
|
+
\:host.tooltip-light.tooltip-shadow
|
|
27
|
+
box-shadow: 0 5px 15px -5px rgba(0, 0, 0, 0.4)
|
|
28
|
+
|
|
29
|
+
\:host.tooltip::after
|
|
30
|
+
content: ""
|
|
31
|
+
position: absolute
|
|
32
|
+
border-style: solid
|
|
33
|
+
|
|
34
|
+
\:host.tooltip-top::after
|
|
35
|
+
top: 100%
|
|
36
|
+
left: 50%
|
|
37
|
+
margin-left: -5px
|
|
38
|
+
border-width: 5px
|
|
39
|
+
border-color: var(--bg-tooltip-primary) transparent transparent transparent
|
|
40
|
+
|
|
41
|
+
\:host.tooltip-bottom::after
|
|
42
|
+
bottom: 100%
|
|
43
|
+
left: 50%
|
|
44
|
+
margin-left: -5px
|
|
45
|
+
border-width: 5px
|
|
46
|
+
border-color: transparent transparent var(--bg-tooltip-primary) transparent
|
|
47
|
+
|
|
48
|
+
\:host.tooltip-left::after
|
|
49
|
+
top: 50%
|
|
50
|
+
left: 100%
|
|
51
|
+
margin-top: -5px
|
|
52
|
+
border-width: 5px
|
|
53
|
+
border-color: transparent transparent transparent var(--bg-tooltip-primary)
|
|
54
|
+
|
|
55
|
+
\:host.tooltip-right::after
|
|
56
|
+
top: 50%
|
|
57
|
+
right: 100%
|
|
58
|
+
margin-top: -5px
|
|
59
|
+
border-width: 5px
|
|
60
|
+
border-color: transparent var(--bg-tooltip-primary) transparent transparent
|
|
61
|
+
|
|
62
|
+
// Light
|
|
63
|
+
\:host.tooltip-light::after
|
|
64
|
+
display: none
|
|
65
|
+
|
|
66
|
+
\:host.tooltip-light
|
|
67
|
+
border: 1px solid rgba(0, 0, 0, .06)
|
|
68
|
+
background-color: #fff
|
|
69
|
+
color: black
|
|
70
|
+
|
|
71
|
+
.tooltip-arrow
|
|
72
|
+
position: absolute
|
|
73
|
+
width: 10px
|
|
74
|
+
height: 10px
|
|
75
|
+
transform: rotate(135deg)
|
|
76
|
+
background-color: rgba(0, 0, 0, .07)
|
|
77
|
+
|
|
78
|
+
.tooltip-arrow::after
|
|
79
|
+
background-color: #fff
|
|
80
|
+
content: ''
|
|
81
|
+
display: block
|
|
82
|
+
position: absolute
|
|
83
|
+
width: 10px
|
|
84
|
+
height: 10px
|
|
85
|
+
|
|
86
|
+
\:host.tooltip-top.tooltip-light
|
|
87
|
+
margin-top: -2px
|
|
88
|
+
|
|
89
|
+
.tooltip-arrow
|
|
90
|
+
top: 100%
|
|
91
|
+
left: 50%
|
|
92
|
+
margin-top: -4px
|
|
93
|
+
margin-left: -5px
|
|
94
|
+
background: linear-gradient(to bottom left, rgba(0, 0, 0, .07) 50%, transparent 50%)
|
|
95
|
+
|
|
96
|
+
.tooltip-arrow::after
|
|
97
|
+
top: 1px
|
|
98
|
+
right: 1px
|
|
99
|
+
|
|
100
|
+
\:host.tooltip-bottom.tooltip-light
|
|
101
|
+
.tooltip-arrow
|
|
102
|
+
bottom: 100%
|
|
103
|
+
left: 50%
|
|
104
|
+
margin-bottom: -4px
|
|
105
|
+
margin-left: -5px
|
|
106
|
+
background: linear-gradient(to top right, rgba(0, 0, 0, .1) 50%, transparent 50%)
|
|
107
|
+
|
|
108
|
+
.tooltip-arrow::after
|
|
109
|
+
top: -1px
|
|
110
|
+
right: -1px
|
|
111
|
+
|
|
112
|
+
\:host.tooltip-left.tooltip-light
|
|
113
|
+
.tooltip-arrow
|
|
114
|
+
top: 50%
|
|
115
|
+
left: 100%
|
|
116
|
+
margin-top: -5px
|
|
117
|
+
margin-left: -4px
|
|
118
|
+
background: linear-gradient(to bottom right, rgba(0, 0, 0, .07) 50%, transparent 50%)
|
|
119
|
+
|
|
120
|
+
.tooltip-arrow::after
|
|
121
|
+
top: 1px
|
|
122
|
+
right: -1px
|
|
123
|
+
|
|
124
|
+
\:host.tooltip-right.tooltip-light
|
|
125
|
+
.tooltip-arrow
|
|
126
|
+
top: 50%
|
|
127
|
+
right: 100%
|
|
128
|
+
margin-top: -5px
|
|
129
|
+
margin-right: -4px
|
|
130
|
+
background: linear-gradient(to top left, rgba(0, 0, 0, .07) 50%, transparent 50%)
|
|
131
|
+
|
|
132
|
+
.tooltip-arrow::after
|
|
133
|
+
top: -1px
|
|
134
|
+
right: 1px
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import {Component, ElementRef, EventEmitter, HostBinding, HostListener, Input, OnInit, Renderer2} from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'tooltip',
|
|
5
|
+
templateUrl: './gravity-tooltip.component.html',
|
|
6
|
+
host: {'class': 'tooltip'},
|
|
7
|
+
styleUrls: ['./gravity-tooltip.component.sass']
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
export class GravityTooltipComponent implements OnInit {
|
|
11
|
+
_show: boolean = false;
|
|
12
|
+
events = new EventEmitter();
|
|
13
|
+
|
|
14
|
+
@Input() data: any;
|
|
15
|
+
|
|
16
|
+
@HostBinding('style.top') hostStyleTop!: string;
|
|
17
|
+
@HostBinding('style.left') hostStyleLeft!: string;
|
|
18
|
+
@HostBinding('style.z-index') hostStyleZIndex!: number;
|
|
19
|
+
@HostBinding('style.transition') hostStyleTransition!: string;
|
|
20
|
+
@HostBinding('style.width') hostStyleWidth!: string;
|
|
21
|
+
@HostBinding('style.max-width') hostStyleMaxWidth!: string;
|
|
22
|
+
@HostBinding('style.pointer-events') hostStylePointerEvents!: string;
|
|
23
|
+
@HostBinding('class.tooltip-show') hostClassShow!: boolean;
|
|
24
|
+
@HostBinding('class.tooltip-shadow') hostClassShadow!: boolean;
|
|
25
|
+
@HostBinding('class.tooltip-light') hostClassLight!: boolean;
|
|
26
|
+
|
|
27
|
+
@HostListener('transitionend', ['$event'])
|
|
28
|
+
transitionEnd() {
|
|
29
|
+
if (this.show) {
|
|
30
|
+
this.events.emit({
|
|
31
|
+
type: 'shown'
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@Input() set show(value: boolean) {
|
|
37
|
+
if (value) {
|
|
38
|
+
this.setPosition();
|
|
39
|
+
}
|
|
40
|
+
this._show = this.hostClassShow = value;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
get show(): boolean {
|
|
44
|
+
return this._show;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
get placement() {
|
|
48
|
+
return this.data.options.placement;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
get autoPlacement() {
|
|
52
|
+
return this.data.options.autoPlacement;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
get element() {
|
|
56
|
+
return this.data.element;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get elementPosition() {
|
|
60
|
+
return this.data.elementPosition;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
get options() {
|
|
64
|
+
return this.data.options;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
get value() {
|
|
68
|
+
return this.data.value;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
get tooltipOffset(): number {
|
|
72
|
+
return Number(this.data.options.offset);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
get isThemeLight() {
|
|
76
|
+
return this.options['theme'] === 'light';
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
constructor(private elementRef: ElementRef, private renderer: Renderer2) {
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
ngOnInit() {
|
|
83
|
+
this.setCustomClass();
|
|
84
|
+
this.setStyles();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
setPosition(): void {
|
|
88
|
+
if (this.setHostStyle(this.placement)) {
|
|
89
|
+
this.setPlacementClass(this.placement);
|
|
90
|
+
return;
|
|
91
|
+
} else {
|
|
92
|
+
/* Is tooltip outside the visible area */
|
|
93
|
+
const placements = ['top', 'right', 'bottom', 'left'];
|
|
94
|
+
let isPlacementSet;
|
|
95
|
+
|
|
96
|
+
for (const placement of placements) {
|
|
97
|
+
if (this.setHostStyle(placement)) {
|
|
98
|
+
this.setPlacementClass(placement);
|
|
99
|
+
isPlacementSet = true;
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Set original placement */
|
|
105
|
+
if (!isPlacementSet) {
|
|
106
|
+
this.setHostStyle(this.placement, true);
|
|
107
|
+
this.setPlacementClass(this.placement);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
setPlacementClass(placement: string): void {
|
|
114
|
+
this.renderer.addClass(this.elementRef.nativeElement, 'tooltip-' + placement);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
setHostStyle(placement: string, disableAutoPlacement: boolean = false): boolean {
|
|
118
|
+
const isSvg = this.element instanceof SVGElement;
|
|
119
|
+
const tooltip = this.elementRef.nativeElement;
|
|
120
|
+
const isCustomPosition = !this.elementPosition.right;
|
|
121
|
+
|
|
122
|
+
let elementHeight = isSvg ? this.element.getBoundingClientRect().height : this.element.offsetHeight;
|
|
123
|
+
let elementWidth = isSvg ? this.element.getBoundingClientRect().width : this.element.offsetWidth;
|
|
124
|
+
const tooltipHeight = tooltip.clientHeight;
|
|
125
|
+
const tooltipWidth = tooltip.clientWidth;
|
|
126
|
+
const scrollY = window.pageYOffset;
|
|
127
|
+
|
|
128
|
+
if (isCustomPosition) {
|
|
129
|
+
elementHeight = 0;
|
|
130
|
+
elementWidth = 0;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
let topStyle;
|
|
134
|
+
let leftStyle;
|
|
135
|
+
|
|
136
|
+
if (placement === 'top') {
|
|
137
|
+
topStyle = (this.elementPosition.top + scrollY) - (tooltipHeight + this.tooltipOffset);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (placement === 'bottom') {
|
|
141
|
+
topStyle = (this.elementPosition.top + scrollY) + elementHeight + this.tooltipOffset;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
if (placement === 'top' || placement === 'bottom') {
|
|
145
|
+
leftStyle = (this.elementPosition.left + elementWidth / 2) - tooltipWidth / 2;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (placement === 'left') {
|
|
149
|
+
leftStyle = this.elementPosition.left - tooltipWidth - this.tooltipOffset;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (placement === 'right') {
|
|
153
|
+
leftStyle = this.elementPosition.left + elementWidth + this.tooltipOffset;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (placement === 'left' || placement === 'right') {
|
|
157
|
+
topStyle = (this.elementPosition.top + scrollY) + elementHeight / 2 - tooltip.clientHeight / 2;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/* Is tooltip outside the visible area */
|
|
161
|
+
if (this.autoPlacement && !disableAutoPlacement) {
|
|
162
|
+
const topEdge = topStyle;
|
|
163
|
+
const bottomEdge = topStyle + tooltipHeight;
|
|
164
|
+
const leftEdge = leftStyle;
|
|
165
|
+
const rightEdge = leftStyle + tooltipWidth;
|
|
166
|
+
const bodyHeight = window.innerHeight + scrollY;
|
|
167
|
+
const bodyWidth = document.body.clientWidth;
|
|
168
|
+
|
|
169
|
+
if (topEdge < 0 || bottomEdge > bodyHeight || leftEdge < 0 || rightEdge > bodyWidth) {
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
this.hostStyleTop = topStyle + 'px';
|
|
175
|
+
this.hostStyleLeft = leftStyle + 'px';
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
setZIndex(): void {
|
|
180
|
+
if (this.options['zIndex'] !== 0) {
|
|
181
|
+
this.hostStyleZIndex = this.options['zIndex'];
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
setPointerEvents(): void {
|
|
186
|
+
if (this.options['pointerEvents']) {
|
|
187
|
+
this.hostStylePointerEvents = this.options['pointerEvents'];
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
setCustomClass() {
|
|
192
|
+
if (this.options['tooltipClass']) {
|
|
193
|
+
this.options['tooltipClass'].split(' ').forEach((className: any) => {
|
|
194
|
+
this.renderer.addClass(this.elementRef.nativeElement, className);
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
setAnimationDuration() {
|
|
200
|
+
if (Number(this.options['animationDuration']) != this.options['animationDurationDefault']) {
|
|
201
|
+
this.hostStyleTransition = 'opacity ' + this.options['animationDuration'] + 'ms';
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
setStyles() {
|
|
206
|
+
this.setZIndex();
|
|
207
|
+
this.setPointerEvents();
|
|
208
|
+
this.setAnimationDuration();
|
|
209
|
+
|
|
210
|
+
this.hostClassShadow = this.options['shadow'];
|
|
211
|
+
this.hostClassLight = this.isThemeLight;
|
|
212
|
+
this.hostStyleMaxWidth = this.options['maxWidth'];
|
|
213
|
+
this.hostStyleWidth = this.options['width'] ? this.options['width'] : '';
|
|
214
|
+
}
|
|
215
|
+
}
|