@deskpro/deskpro-ui 6.10.3 → 7.0.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/cjs/components/Avatar/Avatar.js +11 -2
- package/dist/cjs/components/Avatar/Avatar.js.map +1 -1
- package/dist/cjs/components/Avatar/AvatarGroup.js +4 -1
- package/dist/cjs/components/Avatar/AvatarGroup.js.map +1 -1
- package/dist/cjs/components/Drilldown/DrilldownItem.js +1 -1
- package/dist/cjs/components/Drilldown/DrilldownItem.js.map +1 -1
- package/dist/cjs/components/Dropdown/Dropdown.js +1 -1
- package/dist/cjs/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/cjs/components/Input/Input.js +1 -1
- package/dist/cjs/components/Input/Input.js.map +1 -1
- package/dist/cjs/components/LabelTag/Tag.js +2 -2
- package/dist/cjs/components/LabelTag/Tag.js.map +1 -1
- package/dist/cjs/components/LabelTag/TagCircle.js +11 -2
- package/dist/cjs/components/LabelTag/TagCircle.js.map +1 -1
- package/dist/cjs/components/TabBar/TabBar.js +4 -7
- package/dist/cjs/components/TabBar/TabBar.js.map +1 -1
- package/dist/cjs/components/TextArea/TextArea.js +33 -31
- package/dist/cjs/components/TextArea/TextArea.js.map +1 -1
- package/dist/cjs/components/TippyTooltip/EllipsesTippyTooltip.js +18 -0
- package/dist/cjs/components/TippyTooltip/EllipsesTippyTooltip.js.map +1 -0
- package/dist/cjs/components/TippyTooltip/TippyTooltip.js +121 -0
- package/dist/cjs/components/TippyTooltip/TippyTooltip.js.map +1 -0
- package/dist/cjs/components/TippyTooltip/index.js +9 -0
- package/dist/cjs/components/TippyTooltip/index.js.map +1 -0
- package/dist/cjs/components/TippyTooltip/mergePlugins.js.map +1 -0
- package/dist/cjs/components/TippyTooltip/plugIns/disableForTouchDevicesPlugin.js.map +1 -0
- package/dist/cjs/components/TippyTooltip/plugIns/dpNamePlugin.js.map +1 -0
- package/dist/cjs/components/TippyTooltip/plugIns/escPlugin.js.map +1 -0
- package/dist/cjs/components/TippyTooltip/plugIns/index.js.map +1 -0
- package/dist/cjs/components/Tooltip/EllipsesTooltip.js +2 -3
- package/dist/cjs/components/Tooltip/EllipsesTooltip.js.map +1 -1
- package/dist/cjs/components/Tooltip/Tooltip.js +137 -101
- package/dist/cjs/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/cjs/components/Tooltip/index.js.map +1 -1
- package/dist/cjs/components/Tooltip/styles.js +201 -0
- package/dist/cjs/components/Tooltip/styles.js.map +1 -0
- package/dist/cjs/components/Tooltip/types.js +3 -0
- package/dist/cjs/components/Tooltip/types.js.map +1 -0
- package/dist/cjs/components/Tooltip/utils.js +193 -0
- package/dist/cjs/components/Tooltip/utils.js.map +1 -0
- package/dist/cjs/components/index.js +1 -0
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/hooks/useOnClickOutside.js +27 -0
- package/dist/cjs/hooks/useOnClickOutside.js.map +1 -0
- package/dist/deskpro-ui.d.ts +79 -10
- package/dist/esm/components/Avatar/Avatar.js +11 -2
- package/dist/esm/components/Avatar/Avatar.js.map +1 -1
- package/dist/esm/components/Avatar/AvatarGroup.js +4 -1
- package/dist/esm/components/Avatar/AvatarGroup.js.map +1 -1
- package/dist/esm/components/Drilldown/DrilldownItem.js +1 -1
- package/dist/esm/components/Drilldown/DrilldownItem.js.map +1 -1
- package/dist/esm/components/Dropdown/Dropdown.js +1 -1
- package/dist/esm/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/esm/components/Input/Input.js +1 -1
- package/dist/esm/components/Input/Input.js.map +1 -1
- package/dist/esm/components/LabelTag/Tag.js +3 -3
- package/dist/esm/components/LabelTag/Tag.js.map +1 -1
- package/dist/esm/components/LabelTag/TagCircle.js +11 -2
- package/dist/esm/components/LabelTag/TagCircle.js.map +1 -1
- package/dist/esm/components/TabBar/TabBar.js +4 -7
- package/dist/esm/components/TabBar/TabBar.js.map +1 -1
- package/dist/esm/components/TextArea/TextArea.js +33 -31
- package/dist/esm/components/TextArea/TextArea.js.map +1 -1
- package/dist/esm/components/TippyTooltip/EllipsesTippyTooltip.js +16 -0
- package/dist/esm/components/TippyTooltip/EllipsesTippyTooltip.js.map +1 -0
- package/dist/esm/components/TippyTooltip/TippyTooltip.js +117 -0
- package/dist/esm/components/TippyTooltip/TippyTooltip.js.map +1 -0
- package/dist/esm/components/TippyTooltip/index.js +3 -0
- package/dist/esm/components/TippyTooltip/index.js.map +1 -0
- package/dist/esm/components/TippyTooltip/mergePlugins.js.map +1 -0
- package/dist/esm/components/TippyTooltip/plugIns/disableForTouchDevicesPlugin.js.map +1 -0
- package/dist/esm/components/TippyTooltip/plugIns/dpNamePlugin.js.map +1 -0
- package/dist/esm/components/TippyTooltip/plugIns/escPlugin.js.map +1 -0
- package/dist/esm/components/TippyTooltip/plugIns/index.js.map +1 -0
- package/dist/esm/components/Tooltip/EllipsesTooltip.js +2 -3
- package/dist/esm/components/Tooltip/EllipsesTooltip.js.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.js +136 -101
- package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/components/Tooltip/index.js.map +1 -1
- package/dist/esm/components/Tooltip/styles.js +197 -0
- package/dist/esm/components/Tooltip/styles.js.map +1 -0
- package/dist/esm/components/Tooltip/types.js +2 -0
- package/dist/esm/components/Tooltip/types.js.map +1 -0
- package/dist/esm/components/Tooltip/utils.js +187 -0
- package/dist/esm/components/Tooltip/utils.js.map +1 -0
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/hooks/useOnClickOutside.js +23 -0
- package/dist/esm/hooks/useOnClickOutside.js.map +1 -0
- package/package.json +1 -1
- package/dist/cjs/components/Tooltip/mergePlugins.js.map +0 -1
- package/dist/cjs/components/Tooltip/plugIns/disableForTouchDevicesPlugin.js.map +0 -1
- package/dist/cjs/components/Tooltip/plugIns/dpNamePlugin.js.map +0 -1
- package/dist/cjs/components/Tooltip/plugIns/escPlugin.js.map +0 -1
- package/dist/cjs/components/Tooltip/plugIns/index.js.map +0 -1
- package/dist/esm/components/Tooltip/mergePlugins.js.map +0 -1
- package/dist/esm/components/Tooltip/plugIns/disableForTouchDevicesPlugin.js.map +0 -1
- package/dist/esm/components/Tooltip/plugIns/dpNamePlugin.js.map +0 -1
- package/dist/esm/components/Tooltip/plugIns/escPlugin.js.map +0 -1
- package/dist/esm/components/Tooltip/plugIns/index.js.map +0 -1
- /package/dist/cjs/components/{Tooltip → TippyTooltip}/mergePlugins.js +0 -0
- /package/dist/cjs/components/{Tooltip → TippyTooltip}/plugIns/disableForTouchDevicesPlugin.js +0 -0
- /package/dist/cjs/components/{Tooltip → TippyTooltip}/plugIns/dpNamePlugin.js +0 -0
- /package/dist/cjs/components/{Tooltip → TippyTooltip}/plugIns/escPlugin.js +0 -0
- /package/dist/cjs/components/{Tooltip → TippyTooltip}/plugIns/index.js +0 -0
- /package/dist/esm/components/{Tooltip → TippyTooltip}/mergePlugins.js +0 -0
- /package/dist/esm/components/{Tooltip → TippyTooltip}/plugIns/disableForTouchDevicesPlugin.js +0 -0
- /package/dist/esm/components/{Tooltip → TippyTooltip}/plugIns/dpNamePlugin.js +0 -0
- /package/dist/esm/components/{Tooltip → TippyTooltip}/plugIns/escPlugin.js +0 -0
- /package/dist/esm/components/{Tooltip → TippyTooltip}/plugIns/index.js +0 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getStyle = exports.Arrow = exports.Trigger = exports.Content = exports.Box = exports.Root = exports.Wrapper = void 0;
|
|
4
|
+
const styled_components_1 = require("styled-components");
|
|
5
|
+
const styled_components_2 = require("styled-components");
|
|
6
|
+
const ts_pattern_1 = require("ts-pattern");
|
|
7
|
+
const utils_1 = require("./utils");
|
|
8
|
+
const DEFAULT_OFFSET = 8;
|
|
9
|
+
exports.Wrapper = styled_components_2.default.div `
|
|
10
|
+
z-index: 9999;
|
|
11
|
+
display: ${({ isOpen }) => (isOpen ? "block" : "none")};
|
|
12
|
+
visibility: ${({ isVisible }) => (isVisible ? "visible" : "hidden")};
|
|
13
|
+
position: absolute;
|
|
14
|
+
inset: 0px 0px auto auto;
|
|
15
|
+
margin: 0px;
|
|
16
|
+
top: 0;
|
|
17
|
+
left: 0;
|
|
18
|
+
transform: ${({ position }) => `translate(${position.x}px, ${position.y}px)`};
|
|
19
|
+
width: fit-content;
|
|
20
|
+
`;
|
|
21
|
+
exports.Root = styled_components_2.default.div `
|
|
22
|
+
padding: ${({ placement }) => getPositionPadding(placement)};
|
|
23
|
+
max-width: ${({ maxWidth }) => maxWidth
|
|
24
|
+
? typeof maxWidth === "string"
|
|
25
|
+
? `${maxWidth} !important`
|
|
26
|
+
: `${maxWidth}px !important`
|
|
27
|
+
: undefined};
|
|
28
|
+
width: ${({ width }) => width};
|
|
29
|
+
${({ styledCss }) => styledCss}
|
|
30
|
+
`;
|
|
31
|
+
const getPositionPadding = (placement) => placement.includes("top")
|
|
32
|
+
? `0 0 ${DEFAULT_OFFSET}px 0`
|
|
33
|
+
: placement.includes("bottom")
|
|
34
|
+
? `${DEFAULT_OFFSET}px 0 0 0`
|
|
35
|
+
: placement.includes("left")
|
|
36
|
+
? `0 ${DEFAULT_OFFSET}px 0 0`
|
|
37
|
+
: `0 0 0 ${DEFAULT_OFFSET}px`;
|
|
38
|
+
exports.Box = styled_components_2.default.div `
|
|
39
|
+
position: relative;
|
|
40
|
+
padding: ${({ padding }) => padding !== null && padding !== void 0 ? padding : "5px 9px"};
|
|
41
|
+
z-index: 1;
|
|
42
|
+
|
|
43
|
+
background-color: ${({ theme, styleType = "light" }) => (0, exports.getStyle)(styleType, theme).backgroundColor};
|
|
44
|
+
color: ${({ theme, styleType = "light" }) => (0, exports.getStyle)(styleType, theme).color};
|
|
45
|
+
box-shadow: ${({ theme, styleType = "light" }) => (0, exports.getStyle)(styleType, theme).boxShadow};
|
|
46
|
+
border: ${({ theme, styleType = "light" }) => (0, exports.getStyle)(styleType, theme).border};
|
|
47
|
+
border-radius: ${({ borderRadius }) => (borderRadius ? borderRadius : 3)}px;
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
justify-content: center;
|
|
51
|
+
font-family: ${(props) => props.theme.fonts.primary};
|
|
52
|
+
font-style: normal;
|
|
53
|
+
font-weight: normal;
|
|
54
|
+
font-size: 11px;
|
|
55
|
+
line-height: 150%;
|
|
56
|
+
word-break: break-word;
|
|
57
|
+
${({ offset: [, offsetTop] }) => offsetTop && `top: ${offsetTop}px !important`};
|
|
58
|
+
${({ offset: [offsetLeft] }) => offsetLeft && `left: ${offsetLeft}px !important`};
|
|
59
|
+
transition-property: transform, visibility, opacity;
|
|
60
|
+
transition-duration: ${({ duration = 250 }) => duration}ms;
|
|
61
|
+
`;
|
|
62
|
+
exports.Content = styled_components_2.default.div ``;
|
|
63
|
+
exports.Trigger = styled_components_2.default.div `
|
|
64
|
+
display: contents;
|
|
65
|
+
`;
|
|
66
|
+
exports.Arrow = styled_components_2.default.div `
|
|
67
|
+
position: absolute;
|
|
68
|
+
width: ${utils_1.ARROW_WIDTH}px;
|
|
69
|
+
height: ${utils_1.ARROW_WIDTH}px;
|
|
70
|
+
transform: ${({ position }) => `translate(${position.x}px, ${position.y}px)`};
|
|
71
|
+
${({ placement, arrowColor, theme, styleType }) => getArrowCss(placement, arrowColor, theme, styleType)}
|
|
72
|
+
|
|
73
|
+
&::before {
|
|
74
|
+
content: "";
|
|
75
|
+
position: absolute;
|
|
76
|
+
${({ placement, arrowColor, theme, styleType }) => getArrowPseudoCss("before", placement, arrowColor, theme, styleType)}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&::after {
|
|
80
|
+
content: "";
|
|
81
|
+
z-index: -1;
|
|
82
|
+
position: absolute;
|
|
83
|
+
${({ placement, arrowColor, theme, styleType }) => getArrowPseudoCss("after", placement, arrowColor, theme, styleType)}
|
|
84
|
+
}
|
|
85
|
+
`;
|
|
86
|
+
const getArrowCss = (placement, arrowColor, theme, styleType = "light") => {
|
|
87
|
+
const color = arrowColor ? theme.colors[arrowColor] : (0, exports.getStyle)(styleType, theme).backgroundColor;
|
|
88
|
+
return (0, ts_pattern_1.match)(placement)
|
|
89
|
+
.when((placement) => placement.includes("bottom"), () => (0, styled_components_1.css) `
|
|
90
|
+
top: 0;
|
|
91
|
+
left: 0;
|
|
92
|
+
color: ${color};
|
|
93
|
+
border-top-color: ${color};
|
|
94
|
+
`)
|
|
95
|
+
.when((placement) => placement.includes("top"), () => (0, styled_components_1.css) `
|
|
96
|
+
bottom: 0;
|
|
97
|
+
left: 0;
|
|
98
|
+
color: ${color};
|
|
99
|
+
border-bottom-color: ${color};
|
|
100
|
+
`)
|
|
101
|
+
.when((placement) => placement.includes("left"), () => (0, styled_components_1.css) `
|
|
102
|
+
right: 0;
|
|
103
|
+
top: 0;
|
|
104
|
+
color: ${color};
|
|
105
|
+
border-left-color: ${color};
|
|
106
|
+
`)
|
|
107
|
+
.when((placement) => placement.includes("right"), () => (0, styled_components_1.css) `
|
|
108
|
+
left: 0;
|
|
109
|
+
top: 0;
|
|
110
|
+
color: ${color};
|
|
111
|
+
border-right-color: ${color};
|
|
112
|
+
`)
|
|
113
|
+
.otherwise(() => undefined);
|
|
114
|
+
};
|
|
115
|
+
const getArrowPseudoCss = (type, placement, arrowColor, theme, styleType = "light") => {
|
|
116
|
+
const borderColor = type === "before"
|
|
117
|
+
? "initial"
|
|
118
|
+
: arrowColor
|
|
119
|
+
? theme.colors[arrowColor]
|
|
120
|
+
: (0, exports.getStyle)(styleType, theme).borderColor;
|
|
121
|
+
const offset = type === "before" ? "-7px" : "-8px";
|
|
122
|
+
const halfArrowWidth = `${utils_1.ARROW_WIDTH / 2}px`;
|
|
123
|
+
return (0, ts_pattern_1.match)(placement)
|
|
124
|
+
.when((placement) => placement.includes("bottom"), () => (0, styled_components_1.css) `
|
|
125
|
+
left: 0;
|
|
126
|
+
top: ${offset};
|
|
127
|
+
border-color: transparent;
|
|
128
|
+
border-bottom-color: ${borderColor};
|
|
129
|
+
border-width: 0 ${halfArrowWidth} ${halfArrowWidth};
|
|
130
|
+
border-style: solid;
|
|
131
|
+
`)
|
|
132
|
+
.when((placement) => placement.includes("top"), () => (0, styled_components_1.css) `
|
|
133
|
+
left: 0;
|
|
134
|
+
bottom: ${offset};
|
|
135
|
+
border-color: transparent;
|
|
136
|
+
border-top-color: ${borderColor};
|
|
137
|
+
border-width: ${halfArrowWidth} ${halfArrowWidth} 0;
|
|
138
|
+
border-style: solid;
|
|
139
|
+
`)
|
|
140
|
+
.when((placement) => placement.includes("left"), () => (0, styled_components_1.css) `
|
|
141
|
+
top: 0;
|
|
142
|
+
right: ${offset};
|
|
143
|
+
border-color: transparent;
|
|
144
|
+
border-left-color: ${borderColor};
|
|
145
|
+
border-width: ${halfArrowWidth} 0 ${halfArrowWidth} ${halfArrowWidth};
|
|
146
|
+
border-style: solid;
|
|
147
|
+
`)
|
|
148
|
+
.when((placement) => placement.includes("right"), () => (0, styled_components_1.css) `
|
|
149
|
+
top: 0;
|
|
150
|
+
left: ${offset};
|
|
151
|
+
border-color: transparent;
|
|
152
|
+
border-right-color: ${borderColor};
|
|
153
|
+
border-width: ${halfArrowWidth} ${halfArrowWidth} ${halfArrowWidth} 0;
|
|
154
|
+
border-style: solid;
|
|
155
|
+
`)
|
|
156
|
+
.otherwise(() => undefined);
|
|
157
|
+
};
|
|
158
|
+
const getStyle = (styleType, theme) => {
|
|
159
|
+
const styles = {
|
|
160
|
+
light: {
|
|
161
|
+
backgroundColor: theme.colors.grey3,
|
|
162
|
+
color: theme.colors.grey_black100,
|
|
163
|
+
border: `1px solid ${theme.colors.systemShade30}`,
|
|
164
|
+
borderColor: theme.colors.systemShade30,
|
|
165
|
+
boxShadow: "0px 4px 6px -1px rgba(0, 0, 0, 0.1), 0px 2px 4px -1px rgba(0, 0, 0, 0.06);",
|
|
166
|
+
},
|
|
167
|
+
lightBox: {
|
|
168
|
+
backgroundColor: theme.colors.white,
|
|
169
|
+
color: theme.colors.grey100,
|
|
170
|
+
border: `1px solid ${theme.colors.grey20}`,
|
|
171
|
+
borderColor: theme.colors.grey20,
|
|
172
|
+
boxShadow: "0px 4px 6px -1px rgba(0, 0, 0, 0.1), 0px 2px 4px -1px rgba(0, 0, 0, 0.06);",
|
|
173
|
+
},
|
|
174
|
+
// this type is based of the same styling as the modal component
|
|
175
|
+
lightBoxModal: {
|
|
176
|
+
backgroundColor: theme.colors.white,
|
|
177
|
+
color: theme.colors.grey100,
|
|
178
|
+
border: `1px solid ${theme.colors.grey20}`,
|
|
179
|
+
borderColor: theme.colors.grey20,
|
|
180
|
+
boxShadow: "0px 4px 16px rgba(0, 0, 0, 0.3)",
|
|
181
|
+
},
|
|
182
|
+
dark: {
|
|
183
|
+
backgroundColor: theme.colors.grey_black100,
|
|
184
|
+
color: theme.colors.white,
|
|
185
|
+
border: `1px solid ${theme.colors.grey_black100}`,
|
|
186
|
+
borderColor: theme.colors.grey_black100,
|
|
187
|
+
boxShadow: "0px 4px 6px -1px rgba(0, 0, 0, 0.1), 0px 2px 4px -1px rgba(0, 0, 0, 0.06);",
|
|
188
|
+
},
|
|
189
|
+
extraDark: {
|
|
190
|
+
backgroundColor: theme.colors.grey100,
|
|
191
|
+
color: theme.colors.white,
|
|
192
|
+
border: `1px solid ${theme.colors.grey100}`,
|
|
193
|
+
borderColor: theme.colors.grey100,
|
|
194
|
+
boxShadow: "0px 4px 6px -1px rgba(0, 0, 0, 0.1), 0px 2px 4px -1px rgba(0, 0, 0, 0.06);",
|
|
195
|
+
},
|
|
196
|
+
};
|
|
197
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
198
|
+
return styles[styleType] || styles.dark;
|
|
199
|
+
};
|
|
200
|
+
exports.getStyle = getStyle;
|
|
201
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRo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../../src/components/Tooltip/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getArrowPosition = exports.getNoOverflowPosition = exports.getPositionAndPlacement = exports.placementMap = exports.ARROW_WIDTH = void 0;
|
|
4
|
+
const ts_pattern_1 = require("ts-pattern");
|
|
5
|
+
exports.ARROW_WIDTH = 16;
|
|
6
|
+
/**
|
|
7
|
+
* Calculates the postion of the tooltip relative to the top left of the viewport,
|
|
8
|
+
* based upon the position of the trigger, the size of the tooltip, and the placement.
|
|
9
|
+
*/
|
|
10
|
+
const calcPosition = (placement, triggerRect, tooltipRect) => {
|
|
11
|
+
switch (placement) {
|
|
12
|
+
case "bottom":
|
|
13
|
+
return {
|
|
14
|
+
x: triggerRect.x - (tooltipRect.width - triggerRect.width) / 2,
|
|
15
|
+
y: triggerRect.y + triggerRect.height,
|
|
16
|
+
};
|
|
17
|
+
case "top":
|
|
18
|
+
return {
|
|
19
|
+
x: triggerRect.x - (tooltipRect.width - triggerRect.width) / 2,
|
|
20
|
+
y: triggerRect.y - tooltipRect.height,
|
|
21
|
+
};
|
|
22
|
+
case "left":
|
|
23
|
+
return {
|
|
24
|
+
x: triggerRect.x - tooltipRect.width,
|
|
25
|
+
y: triggerRect.y - (tooltipRect.height - triggerRect.height) / 2,
|
|
26
|
+
};
|
|
27
|
+
case "right":
|
|
28
|
+
return {
|
|
29
|
+
x: triggerRect.x + triggerRect.width,
|
|
30
|
+
y: triggerRect.y - (tooltipRect.height - triggerRect.height) / 2,
|
|
31
|
+
};
|
|
32
|
+
case "bottom-start":
|
|
33
|
+
return {
|
|
34
|
+
x: triggerRect.x,
|
|
35
|
+
y: triggerRect.y + triggerRect.height,
|
|
36
|
+
};
|
|
37
|
+
case "bottom-end":
|
|
38
|
+
return {
|
|
39
|
+
x: triggerRect.x + triggerRect.width - tooltipRect.width,
|
|
40
|
+
y: triggerRect.y + triggerRect.height,
|
|
41
|
+
};
|
|
42
|
+
case "top-start":
|
|
43
|
+
return {
|
|
44
|
+
x: triggerRect.x,
|
|
45
|
+
y: triggerRect.y - tooltipRect.height,
|
|
46
|
+
};
|
|
47
|
+
case "top-end":
|
|
48
|
+
return {
|
|
49
|
+
x: triggerRect.x + triggerRect.width - tooltipRect.width,
|
|
50
|
+
y: triggerRect.y - tooltipRect.height,
|
|
51
|
+
};
|
|
52
|
+
case "right-start":
|
|
53
|
+
return {
|
|
54
|
+
x: triggerRect.x + triggerRect.width,
|
|
55
|
+
y: triggerRect.y,
|
|
56
|
+
};
|
|
57
|
+
case "right-end":
|
|
58
|
+
return {
|
|
59
|
+
x: triggerRect.x + triggerRect.width,
|
|
60
|
+
y: triggerRect.y + triggerRect.height - tooltipRect.height,
|
|
61
|
+
};
|
|
62
|
+
case "left-start":
|
|
63
|
+
return {
|
|
64
|
+
x: triggerRect.x - tooltipRect.width,
|
|
65
|
+
y: triggerRect.y,
|
|
66
|
+
};
|
|
67
|
+
case "left-end":
|
|
68
|
+
return {
|
|
69
|
+
x: triggerRect.x - tooltipRect.width,
|
|
70
|
+
y: triggerRect.y + triggerRect.height - tooltipRect.height,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Map the placement to its flipped equivalent, or for auto try all of them
|
|
76
|
+
*/
|
|
77
|
+
exports.placementMap = {
|
|
78
|
+
bottom: ["bottom", "top"],
|
|
79
|
+
top: ["top", "bottom"],
|
|
80
|
+
left: ["left", "right"],
|
|
81
|
+
right: ["right", "left"],
|
|
82
|
+
"bottom-start": ["bottom-start", "top-start"],
|
|
83
|
+
"bottom-end": ["bottom-end", "top-end"],
|
|
84
|
+
"top-start": ["top-start", "bottom-start"],
|
|
85
|
+
"top-end": ["top-end", "bottom-end"],
|
|
86
|
+
"right-start": ["right-start", "left-start"],
|
|
87
|
+
"right-end": ["right-end", "left-end"],
|
|
88
|
+
"left-start": ["left-start", "right-start"],
|
|
89
|
+
"left-end": ["left-end", "right-end"],
|
|
90
|
+
auto: ["top", "bottom", "left", "right"],
|
|
91
|
+
"auto-start": ["top-start", "bottom-start", "left-start", "right-start"],
|
|
92
|
+
"auto-end": ["top-end", "bottom-end", "left-end", "right-end"],
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Calculates whether the tooltip will fit in the viewport given its placement and position
|
|
96
|
+
*/
|
|
97
|
+
const fitsInViewport = (tooltipRect, position) => {
|
|
98
|
+
return (position.x >= 0 &&
|
|
99
|
+
position.x + tooltipRect.width <= window.innerWidth &&
|
|
100
|
+
position.y >= 0 &&
|
|
101
|
+
position.y + tooltipRect.height <= window.innerHeight);
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Calculates the position of the tooltip and the placement of the tooltip.
|
|
105
|
+
* If the tooltip does not fit in the viewport, then it will try to position in such that it fits in the viewport,
|
|
106
|
+
* (essentially ignoring the -start, -end or middle positioning from the placement).
|
|
107
|
+
* If it still does not fit, it will try to flip the placement and run the same logic to fit it within the viewport.
|
|
108
|
+
* If the flipped placement does not fit it uses the original placement.
|
|
109
|
+
*/
|
|
110
|
+
const getPositionAndPlacement = (placement, triggerRect, tooltipRect,
|
|
111
|
+
/** Pass down the first position calculated so we can default back to that if none of the placements fit */
|
|
112
|
+
initialPositionAndPlacement) => {
|
|
113
|
+
// We've tried all placements and none of them fit, so use the first one
|
|
114
|
+
if (placement.length === 0) {
|
|
115
|
+
if (initialPositionAndPlacement) {
|
|
116
|
+
return { ...initialPositionAndPlacement };
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
// Should never reach here
|
|
120
|
+
throw new Error("No placement found");
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const position = calcPosition(placement[0], triggerRect, tooltipRect);
|
|
124
|
+
// If it fits in the view port return the placement and position, otherwise try the next one
|
|
125
|
+
if (fitsInViewport(tooltipRect, position)) {
|
|
126
|
+
return { position, calculatedPlacement: placement[0] };
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
const noOverflowPosition = (0, exports.getNoOverflowPosition)(placement[0], triggerRect, tooltipRect, position);
|
|
130
|
+
if (noOverflowPosition && fitsInViewport(tooltipRect, noOverflowPosition)) {
|
|
131
|
+
return { position: noOverflowPosition, calculatedPlacement: placement[0] };
|
|
132
|
+
}
|
|
133
|
+
return (0, exports.getPositionAndPlacement)(placement.slice(1), triggerRect, tooltipRect, initialPositionAndPlacement !== null && initialPositionAndPlacement !== void 0 ? initialPositionAndPlacement : {
|
|
134
|
+
position,
|
|
135
|
+
calculatedPlacement: placement[0],
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
exports.getPositionAndPlacement = getPositionAndPlacement;
|
|
140
|
+
const VIEWPORT_PADDING = 5;
|
|
141
|
+
const getNoOverflowPosition = (placement, triggerRect, tooltipRect, position) => {
|
|
142
|
+
switch (placement) {
|
|
143
|
+
case "bottom":
|
|
144
|
+
case "bottom-start":
|
|
145
|
+
case "bottom-end":
|
|
146
|
+
case "top":
|
|
147
|
+
case "top-start":
|
|
148
|
+
case "top-end": {
|
|
149
|
+
const fitsWidth = tooltipRect.width + VIEWPORT_PADDING < window.innerWidth;
|
|
150
|
+
if (fitsWidth) {
|
|
151
|
+
return position.x < 0
|
|
152
|
+
? { x: VIEWPORT_PADDING, y: position.y }
|
|
153
|
+
: { x: window.innerWidth - tooltipRect.width - VIEWPORT_PADDING, y: position.y };
|
|
154
|
+
}
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
case "left":
|
|
158
|
+
case "left-start":
|
|
159
|
+
case "left-end":
|
|
160
|
+
case "right":
|
|
161
|
+
case "right-start":
|
|
162
|
+
case "right-end": {
|
|
163
|
+
const fitsHeight = tooltipRect.height + VIEWPORT_PADDING < window.innerHeight;
|
|
164
|
+
if (fitsHeight) {
|
|
165
|
+
return position.y < 0
|
|
166
|
+
? { x: position.x, y: VIEWPORT_PADDING }
|
|
167
|
+
: { x: position.x, y: window.innerHeight - tooltipRect.height - VIEWPORT_PADDING };
|
|
168
|
+
}
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
exports.getNoOverflowPosition = getNoOverflowPosition;
|
|
174
|
+
const getArrowPosition = (tooltipPlacement, triggerRect, tooltipRect) => {
|
|
175
|
+
return (0, ts_pattern_1.match)(tooltipPlacement)
|
|
176
|
+
.when((placement) => placement.includes("top") || placement.includes("bottom"), () => {
|
|
177
|
+
return {
|
|
178
|
+
x: triggerRect.x > tooltipRect.x
|
|
179
|
+
? triggerRect.x - tooltipRect.x + triggerRect.width / 2 - exports.ARROW_WIDTH / 2
|
|
180
|
+
: tooltipRect.width / 2 - exports.ARROW_WIDTH / 2,
|
|
181
|
+
y: 0,
|
|
182
|
+
};
|
|
183
|
+
})
|
|
184
|
+
.when((placement) => placement.includes("left") || placement.includes("right"), () => ({
|
|
185
|
+
x: 0,
|
|
186
|
+
y: triggerRect.y > tooltipRect.y
|
|
187
|
+
? triggerRect.y - tooltipRect.y + triggerRect.height / 2 - exports.ARROW_WIDTH / 2
|
|
188
|
+
: tooltipRect.height / 2 - exports.ARROW_WIDTH / 2,
|
|
189
|
+
}))
|
|
190
|
+
.otherwise(() => ({ x: 0, y: 0 }));
|
|
191
|
+
};
|
|
192
|
+
exports.getArrowPosition = getArrowPosition;
|
|
193
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/components/Tooltip/utils.ts"],"names":[],"mappings":";;;AAAA,2CAAmC;AAEtB,QAAA,WAAW,GAAG,EAAE,CAAC;AAE9B;;;GAGG;AACH,MAAM,YAAY,GAAG,CACnB,SAAiC,EACjC,WAAoB,EACpB,WAAoB,EACV,EAAE;IACZ,QAAQ,SAAS,EAAE;QACjB,KAAK,QAAQ;YACX,OAAO;gBACL,CAAC,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C,CAAC,GAAG,WAAW,CAAC,CAAC;gBAC3B,CAAC,CAAC,WAAW,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,GAAG,WAAW,CAAC,KAAK,GAAG,CAAC,GAAG,mBAAW,GAAG,CAAC;gBACzE,CAAC,CAAC,WAAW,CAAC,KAAK,GAAG,CAAC,GAAG,mBAAW,GAAG,CAAC;YAC7C,CAAC,EAAE,CAAC;SACL,CAAC;IACJ,CAAC,CACF;SACA,IAAI,CACH,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,EACxE,GAAG,EAAE,CAAC,CAAC;QACL,CAAC,EAAE,CAAC;QACJ,CAAC,EACC,WAAW,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC;YAC3B,CAAC,CAAC,WAAW,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,GAAG,mBAAW,GAAG,CAAC;YAC1E,CAAC,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,GAAG,mBAAW,GAAG,CAAC;KAC/C,CAAC,CACH;SACA,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,CAAC,CAAC;AA7BW,QAAA,gBAAgB,oBA6B3B"}
|
|
@@ -55,6 +55,7 @@ __exportStar(require("./Tabs"), exports);
|
|
|
55
55
|
__exportStar(require("./TextArea"), exports);
|
|
56
56
|
__exportStar(require("./TimeInput"), exports);
|
|
57
57
|
__exportStar(require("./Toggle"), exports);
|
|
58
|
+
__exportStar(require("./TippyTooltip"), exports);
|
|
58
59
|
__exportStar(require("./Tooltip"), exports);
|
|
59
60
|
__exportStar(require("./Typography"), exports);
|
|
60
61
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,gDAA8B;AAC9B,yCAAuB;AACvB,8CAA4B;AAC5B,6CAA2B;AAC3B,2CAAyB;AACzB,4CAA0B;AAC1B,8CAA4B;AAC5B,6CAA2B;AAC3B,2CAAyB;AACzB,yCAAuB;AACvB,6CAA2B;AAC3B,0CAAwB;AACxB,0CAAwB;AACxB,6CAA2B;AAC3B,yCAAuB;AACvB,iDAA+B;AAC/B,yCAAuB;AACvB,0CAAwB;AACxB,kDAAgC;AAChC,8CAA4B;AAC5B,4CAA0B;AAC1B,+CAA6B;AAC7B,yCAAuB;AACvB,4CAA0B;AAC1B,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,2CAAyB;AACzB,yCAAuB;AACvB,4CAA0B;AAC1B,4CAA0B;AAC1B,2CAAyB;AACzB,kDAAgC;AAChC,yCAAuB;AACvB,6CAA2B;AAC3B,8CAA4B;AAC5B,2CAAyB;AACzB,4CAA0B;AAC1B,+CAA6B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,gDAA8B;AAC9B,yCAAuB;AACvB,8CAA4B;AAC5B,6CAA2B;AAC3B,2CAAyB;AACzB,4CAA0B;AAC1B,8CAA4B;AAC5B,6CAA2B;AAC3B,2CAAyB;AACzB,yCAAuB;AACvB,6CAA2B;AAC3B,0CAAwB;AACxB,0CAAwB;AACxB,6CAA2B;AAC3B,yCAAuB;AACvB,iDAA+B;AAC/B,yCAAuB;AACvB,0CAAwB;AACxB,kDAAgC;AAChC,8CAA4B;AAC5B,4CAA0B;AAC1B,+CAA6B;AAC7B,yCAAuB;AACvB,4CAA0B;AAC1B,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,2CAAyB;AACzB,yCAAuB;AACvB,4CAA0B;AAC1B,4CAA0B;AAC1B,2CAAyB;AACzB,kDAAgC;AAChC,yCAAuB;AACvB,6CAA2B;AAC3B,8CAA4B;AAC5B,2CAAyB;AACzB,iDAA+B;AAC/B,4CAA0B;AAC1B,+CAA6B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useOnClickOutside = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
function useOnClickOutside(ref, handler) {
|
|
6
|
+
(0, react_1.useEffect)(() => {
|
|
7
|
+
if (!handler)
|
|
8
|
+
return;
|
|
9
|
+
const listener = (event) => {
|
|
10
|
+
const el = ref.current;
|
|
11
|
+
// Do nothing if clicking ref's element or descendent elements
|
|
12
|
+
if (!el || el.contains(event.target)) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
handler === null || handler === void 0 ? void 0 : handler(event);
|
|
16
|
+
};
|
|
17
|
+
document.addEventListener(`mousedown`, listener);
|
|
18
|
+
document.addEventListener(`touchstart`, listener);
|
|
19
|
+
return () => {
|
|
20
|
+
document.removeEventListener(`mousedown`, listener);
|
|
21
|
+
document.removeEventListener(`touchstart`, listener);
|
|
22
|
+
};
|
|
23
|
+
// Reload only if ref or handler changes
|
|
24
|
+
}, [ref, handler]);
|
|
25
|
+
}
|
|
26
|
+
exports.useOnClickOutside = useOnClickOutside;
|
|
27
|
+
//# sourceMappingURL=useOnClickOutside.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOnClickOutside.js","sourceRoot":"","sources":["../../../src/hooks/useOnClickOutside.tsx"],"names":[],"mappings":";;;AACA,iCAAkC;AAIlC,SAAgB,iBAAiB,CAC/B,GAAiB,EACjB,OAAmC;IAEnC,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO;YAAE,OAAO;QAErB,MAAM,QAAQ,GAAG,CAAC,KAAe,EAAE,EAAE;YACnC,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC;YAEvB,8DAA8D;YAC9D,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAc,CAAC,EAAE;gBAC5C,OAAO;aACR;YAED,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,KAAK,CAAC,CAAC;QACnB,CAAC,CAAC;QAEF,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QACjD,QAAQ,CAAC,gBAAgB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QAElD,OAAO,GAAG,EAAE;YACV,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;YACpD,QAAQ,CAAC,mBAAmB,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QACvD,CAAC,CAAC;QAEF,wCAAwC;IAC1C,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;AACrB,CAAC;AA5BD,8CA4BC"}
|
package/dist/deskpro-ui.d.ts
CHANGED
|
@@ -2042,7 +2042,12 @@ export declare interface DropdownValueType<OriginalValue> {
|
|
|
2042
2042
|
/**
|
|
2043
2043
|
* @public
|
|
2044
2044
|
*/
|
|
2045
|
-
export declare const
|
|
2045
|
+
export declare const EllipsesTippyTooltip: ({ disabled, ...props }: Parameters<typeof TippyTooltip>[0]) => JSX.Element;
|
|
2046
|
+
|
|
2047
|
+
/**
|
|
2048
|
+
* @public
|
|
2049
|
+
*/
|
|
2050
|
+
export declare const EllipsesTooltip: ({ disabled, ...props }: TooltipProps) => JSX.Element;
|
|
2046
2051
|
|
|
2047
2052
|
/**
|
|
2048
2053
|
* @public
|
|
@@ -5077,6 +5082,57 @@ export declare interface TimeInputProps {
|
|
|
5077
5082
|
secondsText: ReactNode;
|
|
5078
5083
|
}
|
|
5079
5084
|
|
|
5085
|
+
/**
|
|
5086
|
+
* @public
|
|
5087
|
+
*/
|
|
5088
|
+
export declare type TippyModalStyleTypes = "extraDark" | "dark" | "light" | "lightBox" | "lightBoxModal";
|
|
5089
|
+
|
|
5090
|
+
/**
|
|
5091
|
+
* @public
|
|
5092
|
+
* @deprecated Due to Tippy causing memory leaks. Use {@link Tooltip} instead.
|
|
5093
|
+
*/
|
|
5094
|
+
export declare const TippyTooltip: StyledComponent<({ suppressClassNameWarning, styleType, arrow, width, offsetTop, styledCss, customComponent, arrowColor, offsetLeft, borderRadius, onPresEsc, enableOnTouchDevices, ...props }: TippyTooltipProps) => JSX.Element, DefaultTheme, {
|
|
5095
|
+
suppressClassNameWarning: true;
|
|
5096
|
+
}, "suppressClassNameWarning">;
|
|
5097
|
+
|
|
5098
|
+
/**
|
|
5099
|
+
* @public
|
|
5100
|
+
*/
|
|
5101
|
+
export declare function TippyTooltipCommonIcon({ content, styleType, placement, iconSize, }: TippyTooltipCommonIconProps): JSX.Element;
|
|
5102
|
+
|
|
5103
|
+
/**
|
|
5104
|
+
* @public
|
|
5105
|
+
*/
|
|
5106
|
+
export declare interface TippyTooltipCommonIconProps {
|
|
5107
|
+
styleType?: "dark" | "light" | "lightBox";
|
|
5108
|
+
content: string;
|
|
5109
|
+
placement?: "top" | "bottom" | "left" | "right";
|
|
5110
|
+
iconSize?: number;
|
|
5111
|
+
}
|
|
5112
|
+
|
|
5113
|
+
/**
|
|
5114
|
+
* @public
|
|
5115
|
+
*/
|
|
5116
|
+
export declare type TippyTooltipPlacement = TippyProps["placement"];
|
|
5117
|
+
|
|
5118
|
+
/**
|
|
5119
|
+
* @public
|
|
5120
|
+
* @deprecated Due to Tippy causing memory leaks. Use {@link Tooltip} instead.
|
|
5121
|
+
*/
|
|
5122
|
+
export declare interface TippyTooltipProps extends TippyProps {
|
|
5123
|
+
styleType?: TippyModalStyleTypes;
|
|
5124
|
+
suppressClassNameWarning?: boolean;
|
|
5125
|
+
width?: number | string;
|
|
5126
|
+
offsetTop?: number | string;
|
|
5127
|
+
offsetLeft?: number;
|
|
5128
|
+
styledCss?: FlattenSimpleInterpolation | CSSProp;
|
|
5129
|
+
customComponent?: boolean;
|
|
5130
|
+
arrowColor?: ThemeColorKey;
|
|
5131
|
+
borderRadius?: number;
|
|
5132
|
+
onPresEsc?: () => void;
|
|
5133
|
+
enableOnTouchDevices?: boolean;
|
|
5134
|
+
}
|
|
5135
|
+
|
|
5080
5136
|
/**
|
|
5081
5137
|
* @public
|
|
5082
5138
|
*/
|
|
@@ -5122,9 +5178,7 @@ declare type ToolBarType = typeof ToolbarStack & {
|
|
|
5122
5178
|
/**
|
|
5123
5179
|
* @public
|
|
5124
5180
|
*/
|
|
5125
|
-
export declare const Tooltip:
|
|
5126
|
-
suppressClassNameWarning: true;
|
|
5127
|
-
}, "suppressClassNameWarning">;
|
|
5181
|
+
export declare const Tooltip: ({ styleType, width, maxWidth, offsetTop, offsetLeft, offset, visible, interactive, styledCss, customComponent, borderRadius, onPressEsc, enableOnTouchDevices, placement, disabled, content, className, delay, hideOnClick, onClickOutside, onShow, onHide, duration, arrow, arrowColor, children, }: TooltipProps) => JSX.Element;
|
|
5128
5182
|
|
|
5129
5183
|
/**
|
|
5130
5184
|
* @public
|
|
@@ -5144,23 +5198,38 @@ export declare interface TooltipCommonIconProps {
|
|
|
5144
5198
|
/**
|
|
5145
5199
|
* @public
|
|
5146
5200
|
*/
|
|
5147
|
-
export declare type TooltipPlacement =
|
|
5201
|
+
export declare type TooltipPlacement = "auto" | "auto-start" | "auto-end" | "top" | "left" | "bottom" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end";
|
|
5148
5202
|
|
|
5149
5203
|
/**
|
|
5150
5204
|
* @public
|
|
5151
5205
|
*/
|
|
5152
|
-
export declare interface TooltipProps
|
|
5206
|
+
export declare interface TooltipProps {
|
|
5153
5207
|
styleType?: ModalStyleTypes;
|
|
5154
|
-
suppressClassNameWarning?: boolean;
|
|
5155
5208
|
width?: number | string;
|
|
5156
|
-
|
|
5209
|
+
maxWidth?: number | string;
|
|
5210
|
+
offsetTop?: number;
|
|
5157
5211
|
offsetLeft?: number;
|
|
5212
|
+
offset?: [number, number];
|
|
5158
5213
|
styledCss?: FlattenSimpleInterpolation | CSSProp;
|
|
5159
5214
|
customComponent?: boolean;
|
|
5160
|
-
arrowColor?: ThemeColorKey;
|
|
5161
5215
|
borderRadius?: number;
|
|
5162
|
-
|
|
5216
|
+
onPressEsc?: () => void;
|
|
5163
5217
|
enableOnTouchDevices?: boolean;
|
|
5218
|
+
children?: React_2.ReactNode;
|
|
5219
|
+
content?: React_2.ReactNode;
|
|
5220
|
+
visible?: boolean;
|
|
5221
|
+
disabled?: boolean;
|
|
5222
|
+
className?: string;
|
|
5223
|
+
delay?: number | [number, number];
|
|
5224
|
+
duration?: number;
|
|
5225
|
+
hideOnClick?: boolean;
|
|
5226
|
+
interactive?: boolean;
|
|
5227
|
+
placement?: TooltipPlacement;
|
|
5228
|
+
onClickOutside?: () => void;
|
|
5229
|
+
onShow?: () => void;
|
|
5230
|
+
onHide?: () => void;
|
|
5231
|
+
arrow?: boolean;
|
|
5232
|
+
arrowColor?: keyof ThemeColors;
|
|
5164
5233
|
}
|
|
5165
5234
|
|
|
5166
5235
|
/**
|
|
@@ -6,6 +6,7 @@ import { getInitials } from "../../utils/getInitials";
|
|
|
6
6
|
import { Icon } from "../Icon";
|
|
7
7
|
import { GetLabelColorByChar } from "../../utils/getRandomColor";
|
|
8
8
|
import { Stack } from "../../layout";
|
|
9
|
+
import { Tooltip } from "../Tooltip";
|
|
9
10
|
import { dpNameProp } from "../../utils/dpName";
|
|
10
11
|
import { faUser } from "@fortawesome/free-solid-svg-icons";
|
|
11
12
|
const AvaImage = styled.img `
|
|
@@ -173,10 +174,18 @@ export const Avatar = memo(({ imageStyles, backupIcon = faUser, name, size = 18,
|
|
|
173
174
|
return React.createElement(Emoji, { title: name, size: size, style: props.emojiStyles, rounded: rounded });
|
|
174
175
|
}
|
|
175
176
|
if (isFaIconAvatarProps(props)) {
|
|
176
|
-
|
|
177
|
+
const Component = (React.createElement(FaIcon, { title: name, size: size, className: props.faIconClassName, style: props.iconStyles, rounded: rounded }));
|
|
178
|
+
if (showTooltip) {
|
|
179
|
+
return (React.createElement(Tooltip, { delay: [1000, 0], content: name }, Component));
|
|
180
|
+
}
|
|
181
|
+
return Component;
|
|
177
182
|
}
|
|
178
183
|
if (isImageAvatarProps(props) && !imgErrored && props.imageUrl) {
|
|
179
|
-
|
|
184
|
+
const Component = (React.createElement(AvaImage, { alt: name !== null && name !== void 0 ? name : "avatar", size: size, style: imgContainerStyle, src: props.imageUrl, loading: "lazy", rounded: rounded, onError: () => setImgErrored(true) }));
|
|
185
|
+
if (showTooltip) {
|
|
186
|
+
return (React.createElement(Tooltip, { delay: [1000, 0], content: name }, Component));
|
|
187
|
+
}
|
|
188
|
+
return Component;
|
|
180
189
|
}
|
|
181
190
|
if (rounded) {
|
|
182
191
|
if (name && initials) {
|