@deskpro/deskpro-ui 5.0.2 → 5.0.4
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/Button/styles.js +6 -11
- package/dist/cjs/components/Button/styles.js.map +1 -1
- package/dist/cjs/components/Drilldown/Drilldown.js +5 -1
- package/dist/cjs/components/Drilldown/Drilldown.js.map +1 -1
- package/dist/cjs/components/Dropdown/Dropdown.js +5 -1
- package/dist/cjs/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/cjs/components/Infinite/Infinite.js +59 -99
- package/dist/cjs/components/Infinite/Infinite.js.map +1 -1
- package/dist/cjs/components/Infinite/ObservedDiv.js +2 -2
- package/dist/cjs/components/Infinite/ObservedDiv.js.map +1 -1
- package/dist/cjs/components/Infinite/styles.js.map +1 -1
- package/dist/cjs/components/Tooltip/Tooltip.js +5 -7
- package/dist/cjs/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/deskpro-ui.d.ts +2 -4
- package/dist/esm/components/Button/styles.js +6 -11
- package/dist/esm/components/Button/styles.js.map +1 -1
- package/dist/esm/components/Drilldown/Drilldown.js +5 -1
- package/dist/esm/components/Drilldown/Drilldown.js.map +1 -1
- package/dist/esm/components/Dropdown/Dropdown.js +5 -1
- package/dist/esm/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/esm/components/Infinite/Infinite.js +61 -101
- package/dist/esm/components/Infinite/Infinite.js.map +1 -1
- package/dist/esm/components/Infinite/ObservedDiv.js +2 -2
- package/dist/esm/components/Infinite/ObservedDiv.js.map +1 -1
- package/dist/esm/components/Infinite/styles.js.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.js +5 -7
- package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
- package/package.json +3 -2
- package/dist/cjs/utils/useInView.js +0 -27
- package/dist/cjs/utils/useInView.js.map +0 -1
- package/dist/esm/utils/useInView.js +0 -25
- package/dist/esm/utils/useInView.js.map +0 -1
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { useCallback, useEffect, useLayoutEffect,
|
|
2
|
+
import { useCallback, useEffect, useLayoutEffect, useRef, useState, } from "react";
|
|
3
3
|
import { useDebouncedCallback } from "use-debounce";
|
|
4
4
|
import { Stack } from "../../layout";
|
|
5
|
+
import { ObservedDiv } from "./ObservedDiv";
|
|
5
6
|
import { Spinner } from "../Spinner";
|
|
6
7
|
import { Button, OverlayButton } from "../Button";
|
|
7
8
|
import { match } from "ts-pattern";
|
|
8
9
|
import { Scrollbar } from "../Scrollbar";
|
|
9
|
-
import { faAngleDoubleDown } from "@fortawesome/free-solid-svg-icons";
|
|
10
|
+
import { faAngleDoubleDown, faAngleDoubleUp } from "@fortawesome/free-solid-svg-icons";
|
|
10
11
|
import { useTheme } from "styled-components";
|
|
11
12
|
import { dpNameProp } from "../../utils/dpName";
|
|
12
|
-
import { Observed } from "./styles";
|
|
13
|
-
import useInView from "../../utils/useInView";
|
|
14
13
|
// Controls the scroll when the data changes and for user wheel events
|
|
15
|
-
function useScrollControl(
|
|
14
|
+
function useScrollControl(children, reverse, anchor, scrollSideEffect, outerRef) {
|
|
15
|
+
const innerRef = useRef(null);
|
|
16
|
+
const ref = outerRef !== null && outerRef !== void 0 ? outerRef : innerRef;
|
|
16
17
|
const firstMount = useRef(true);
|
|
17
18
|
// Used to check if the scroll should be forced to the edges on data updates
|
|
18
19
|
const shouldAttachScroll = useRef(true);
|
|
@@ -20,50 +21,39 @@ function useScrollControl(lastFetchDirection, scrollRef, reverse, anchor, scroll
|
|
|
20
21
|
const lastKnownScrollOffset = useRef();
|
|
21
22
|
// Forces the scrollbar to the top or bottom on first render
|
|
22
23
|
useEffect(() => {
|
|
23
|
-
if (
|
|
24
|
+
if (ref.current && shouldAttachScroll.current) {
|
|
24
25
|
if (reverse) {
|
|
25
|
-
|
|
26
|
-
top: (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current.scrollHeight) - (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current.clientHeight) - 4,
|
|
27
|
-
});
|
|
26
|
+
ref.current.scrollTo({ top: ref.current.scrollHeight });
|
|
28
27
|
}
|
|
29
28
|
else {
|
|
30
|
-
|
|
29
|
+
ref.current.scrollTo(0, 0);
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
|
-
}, [
|
|
34
|
-
// this will update the scroll position when a fetch has been made while scrolling up
|
|
35
|
-
// this is to stop the page jumping once a request has been made
|
|
36
|
-
const setScrollTo = useCallback(() => {
|
|
37
|
-
var _a, _b, _c;
|
|
38
|
-
if (!shouldAttachScroll.current &&
|
|
39
|
-
typeof lastKnownScrollOffset.current === "number" &&
|
|
40
|
-
lastFetchDirection === "top" &&
|
|
41
|
-
topStatus !== "end" &&
|
|
42
|
-
topStatus !== "end-with-force") {
|
|
43
|
-
// set position using saved offset
|
|
44
|
-
(_a = scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
|
|
45
|
-
top: Math.abs(lastKnownScrollOffset.current -
|
|
46
|
-
(((_b = scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current) === null || _b === void 0 ? void 0 : _b.scrollHeight) - ((_c = scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current) === null || _c === void 0 ? void 0 : _c.clientHeight))),
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
// save current position offset
|
|
50
|
-
if (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current) {
|
|
51
|
-
lastKnownScrollOffset.current = Math.abs((scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current.scrollTop) -
|
|
52
|
-
((scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current.scrollHeight) - (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current.clientHeight)));
|
|
53
|
-
}
|
|
54
|
-
}, [lastFetchDirection, scrollRef, topStatus]);
|
|
32
|
+
}, [ref, reverse]);
|
|
55
33
|
// On render will force the scroll bar to the top or bottom, unless detached
|
|
56
34
|
useLayoutEffect(() => {
|
|
57
35
|
if (firstMount.current || !anchor) {
|
|
58
36
|
firstMount.current = false;
|
|
59
37
|
return;
|
|
60
38
|
}
|
|
61
|
-
if (!
|
|
39
|
+
if (!ref.current)
|
|
62
40
|
return;
|
|
63
|
-
|
|
41
|
+
if (shouldAttachScroll.current) {
|
|
42
|
+
if (reverse) {
|
|
43
|
+
ref.current.scrollTo({ top: ref.current.scrollHeight });
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
ref.current.scrollTo({ top: 0 });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else if (typeof lastKnownScrollOffset.current === "number" && reverse) {
|
|
50
|
+
ref.current.scrollTo({
|
|
51
|
+
top: Math.abs(lastKnownScrollOffset.current - (ref.current.scrollHeight - ref.current.clientHeight)),
|
|
52
|
+
});
|
|
53
|
+
}
|
|
64
54
|
});
|
|
65
55
|
const debouncedSetIsAttached = useDebouncedCallback(() => {
|
|
66
|
-
if (typeof lastKnownScrollOffset.current === "number" &&
|
|
56
|
+
if (typeof lastKnownScrollOffset.current === "number" && ref.current) {
|
|
67
57
|
if (shouldAttachScroll.current !== isAttached && lastKnownScrollOffset.current > 300) {
|
|
68
58
|
setIsAttached(shouldAttachScroll.current);
|
|
69
59
|
}
|
|
@@ -74,20 +64,16 @@ function useScrollControl(lastFetchDirection, scrollRef, reverse, anchor, scroll
|
|
|
74
64
|
}
|
|
75
65
|
}, 100, { trailing: true, leading: true });
|
|
76
66
|
// On scroll events will attach or detach the scroll position from the top or bottom
|
|
77
|
-
const handleScroll = useCallback((
|
|
78
|
-
if (
|
|
67
|
+
const handleScroll = useCallback(() => {
|
|
68
|
+
if (ref.current &&
|
|
79
69
|
!isAttached &&
|
|
80
|
-
|
|
81
|
-
(scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current.scrollHeight) - 2) {
|
|
70
|
+
ref.current.scrollTop + ref.current.offsetHeight > ref.current.scrollHeight - 2) {
|
|
82
71
|
setIsAttached(true);
|
|
83
72
|
}
|
|
84
|
-
if (!
|
|
85
|
-
scrollSideEffect === null || scrollSideEffect === void 0 ? void 0 : scrollSideEffect(event);
|
|
73
|
+
if (!ref.current)
|
|
86
74
|
return;
|
|
87
|
-
}
|
|
88
75
|
if (reverse) {
|
|
89
|
-
if (
|
|
90
|
-
(scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current.scrollHeight) - (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current.clientHeight)) {
|
|
76
|
+
if (ref.current.scrollTop < ref.current.scrollHeight - ref.current.clientHeight) {
|
|
91
77
|
shouldAttachScroll.current = false;
|
|
92
78
|
}
|
|
93
79
|
else {
|
|
@@ -95,83 +81,48 @@ function useScrollControl(lastFetchDirection, scrollRef, reverse, anchor, scroll
|
|
|
95
81
|
}
|
|
96
82
|
}
|
|
97
83
|
else {
|
|
98
|
-
if (
|
|
84
|
+
if (ref.current.scrollTop > 0) {
|
|
99
85
|
shouldAttachScroll.current = false;
|
|
100
86
|
}
|
|
101
87
|
else {
|
|
102
88
|
shouldAttachScroll.current = true;
|
|
103
89
|
}
|
|
104
90
|
}
|
|
105
|
-
|
|
91
|
+
scrollSideEffect === null || scrollSideEffect === void 0 ? void 0 : scrollSideEffect();
|
|
92
|
+
lastKnownScrollOffset.current = Math.abs(ref.current.scrollTop - (ref.current.scrollHeight - ref.current.clientHeight));
|
|
106
93
|
debouncedSetIsAttached();
|
|
107
|
-
|
|
108
|
-
}, [scrollRef, isAttached, reverse, scrollSideEffect, setScrollTo, debouncedSetIsAttached]);
|
|
94
|
+
}, [ref, isAttached, reverse, scrollSideEffect, debouncedSetIsAttached]);
|
|
109
95
|
const reAttach = useCallback(() => {
|
|
110
96
|
shouldAttachScroll.current = true;
|
|
111
97
|
setIsAttached(true);
|
|
112
|
-
if (
|
|
98
|
+
if (ref.current) {
|
|
113
99
|
if (reverse) {
|
|
114
|
-
|
|
100
|
+
ref.current.scrollTo({ top: ref.current.scrollHeight });
|
|
115
101
|
}
|
|
116
102
|
else {
|
|
117
|
-
|
|
103
|
+
ref.current.scrollTo(0, 0);
|
|
118
104
|
}
|
|
119
105
|
}
|
|
120
|
-
}, [
|
|
106
|
+
}, [ref, reverse]);
|
|
121
107
|
return {
|
|
122
|
-
ref:
|
|
123
|
-
handleScroll,
|
|
108
|
+
ref: ref,
|
|
109
|
+
onScroll: handleScroll,
|
|
124
110
|
isAttached,
|
|
125
111
|
reAttach,
|
|
126
112
|
};
|
|
127
113
|
}
|
|
128
|
-
const EndOfScroll = ({ status, fetchMoreText, fetchMore }) => match({ status, hasFetchMore: !!fetchMore })
|
|
129
|
-
.with({ hasFetchMore: false }, () => null)
|
|
130
|
-
.with({ status: "loading" }, { status: "hasNextPage" }, () => (React.createElement(Stack, { justify: "center", align: "center", padding: 5, style: { minHeight: 60, margin: "-1px 0" } },
|
|
131
|
-
React.createElement(Spinner, null))))
|
|
132
|
-
.with({ status: "end-with-force", hasFetchMore: true }, () => (React.createElement(Stack, { justify: "center", align: "center", padding: 5 },
|
|
133
|
-
React.createElement(Button, { intent: "tertiary", onClick: fetchMore, text: fetchMoreText }))))
|
|
134
|
-
.otherwise(() => null);
|
|
135
114
|
/**
|
|
136
115
|
* Will render a scrollbar container that uses an intersection observer to watch for when
|
|
137
116
|
* the container has scrolled to the top or bottom.
|
|
138
117
|
* @public
|
|
139
118
|
*/
|
|
140
|
-
export function Infinite({ children, reverse = false, anchor = false, onFetchMore,
|
|
141
|
-
const
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
const topStatus = useMemo(() => (reverse ? status : startStatus), [reverse, startStatus, status]);
|
|
146
|
-
const bottomStatus = useMemo(() => (reverse ? startStatus : status), [reverse, startStatus, status]);
|
|
147
|
-
const { ref, isAttached, handleScroll, reAttach } = useScrollControl(lastFetchDirection, scrollRef, reverse, anchor, scrollSideEffect, topStatus);
|
|
148
|
-
const { inView: topInView, ref: topRef } = useInView();
|
|
149
|
-
const { inView: bottomInView, ref: bottomRef } = useInView();
|
|
150
|
-
useEffect(() => {
|
|
151
|
-
setLastFetchDirection("top");
|
|
152
|
-
if (topInView && topStatus !== "loading") {
|
|
153
|
-
if (topFetch && (!topStatus || topStatus !== "end")) {
|
|
154
|
-
topFetch();
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}, [onFetchMore, onFetchMoreStart, reverse, startStatus, status, topFetch, topInView, topStatus]);
|
|
158
|
-
useEffect(() => {
|
|
159
|
-
setLastFetchDirection("bottom");
|
|
160
|
-
if (bottomInView && bottomStatus !== "loading") {
|
|
161
|
-
if (bottomFetch && (!bottomStatus || bottomStatus !== "end")) {
|
|
162
|
-
bottomFetch();
|
|
163
|
-
}
|
|
119
|
+
export function Infinite({ children, reverse = false, anchor = false, onFetchMore, status, maxHeight = "100%", scrollSideEffect, width, fetchMoreText, autoscrollText, scrollRef, justify, }) {
|
|
120
|
+
const { ref, isAttached, onScroll, reAttach } = useScrollControl(children, reverse, anchor, scrollSideEffect, scrollRef);
|
|
121
|
+
const handleIntersect = useCallback(() => {
|
|
122
|
+
if (onFetchMore && (!status || status !== "end")) {
|
|
123
|
+
onFetchMore();
|
|
164
124
|
}
|
|
165
|
-
}, [
|
|
166
|
-
bottomFetch,
|
|
167
|
-
bottomInView,
|
|
168
|
-
bottomStatus,
|
|
169
|
-
onFetchMore,
|
|
170
|
-
onFetchMoreStart,
|
|
171
|
-
reverse,
|
|
172
|
-
topStatus,
|
|
173
|
-
status,
|
|
174
|
-
]);
|
|
125
|
+
}, [onFetchMore, status]);
|
|
175
126
|
const theme = useTheme().colors;
|
|
176
127
|
return (React.createElement(Stack, { ...dpNameProp("Infinite"), maxHeight: "100%", style: {
|
|
177
128
|
position: "relative",
|
|
@@ -179,12 +130,21 @@ export function Infinite({ children, reverse = false, anchor = false, onFetchMor
|
|
|
179
130
|
height: "100%",
|
|
180
131
|
width,
|
|
181
132
|
}, justify: justify, align: "stretch", vertical: true },
|
|
182
|
-
React.createElement(Scrollbar, { autoHide: true, style: { maxHeight: maxHeight }, scrollableNodeProps: { ref: ref, onScroll:
|
|
183
|
-
|
|
184
|
-
|
|
133
|
+
React.createElement(Scrollbar, { autoHide: true, style: { maxHeight: maxHeight }, scrollableNodeProps: { ref: ref, onScroll: onScroll } },
|
|
134
|
+
reverse &&
|
|
135
|
+
status &&
|
|
136
|
+
match(status)
|
|
137
|
+
.with("loading", "hasNextPage", () => (React.createElement(Stack, { justify: "center", align: "center", padding: 5, style: { minHeight: 60 } },
|
|
138
|
+
React.createElement(Spinner, null))))
|
|
139
|
+
.with("end", () => null)
|
|
140
|
+
.with("end-with-force", () => (React.createElement(Stack, { justify: "center", align: "center", padding: 5 },
|
|
141
|
+
React.createElement(Button, { intent: "tertiary", onClick: onFetchMore, text: fetchMoreText }))))
|
|
142
|
+
.exhaustive(),
|
|
143
|
+
reverse && React.createElement(ObservedDiv, { onIntersect: handleIntersect }),
|
|
185
144
|
children,
|
|
186
|
-
React.createElement(
|
|
187
|
-
|
|
188
|
-
|
|
145
|
+
!reverse && React.createElement(ObservedDiv, { onIntersect: handleIntersect }),
|
|
146
|
+
!reverse && (status === "loading" || status === "hasNextPage") && (React.createElement(Stack, { justify: "center", align: "center", padding: 5, style: { minHeight: 60 } },
|
|
147
|
+
React.createElement(Spinner, null)))),
|
|
148
|
+
anchor && !isAttached && (React.createElement(OverlayButton, { placement: reverse ? "middle-bottom" : "middle-top", text: autoscrollText, onClick: reAttach, icon: { icon: reverse ? faAngleDoubleDown : faAngleDoubleUp, size: 14 }, rightIcon: { icon: reverse ? faAngleDoubleDown : faAngleDoubleUp, size: 14 }, style: { color: theme.brandShade100 } }))));
|
|
189
149
|
}
|
|
190
150
|
//# sourceMappingURL=Infinite.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Infinite.js","sourceRoot":"","sources":["../../../../src/components/Infinite/Infinite.tsx"],"names":[],"mappings":"AAAA,OAAO,K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7 @@ import { dpNameProp } from "../../utils/dpName";
|
|
|
6
6
|
* Component that positions absolutely to the top or bottom of the container
|
|
7
7
|
* and emits an event if it intersects with the view port using `IntersectionObserver`
|
|
8
8
|
*/
|
|
9
|
-
export function ObservedDiv({ onIntersect }) {
|
|
9
|
+
export function ObservedDiv({ onIntersect, reverse = false }) {
|
|
10
10
|
const ref = useRef(null);
|
|
11
11
|
const callback = useRef(onIntersect);
|
|
12
12
|
useLayoutEffect(() => {
|
|
@@ -23,6 +23,6 @@ export function ObservedDiv({ onIntersect }) {
|
|
|
23
23
|
observer.observe(ref.current);
|
|
24
24
|
return () => observer.disconnect();
|
|
25
25
|
}, []);
|
|
26
|
-
return React.createElement(S.Observed, { ...dpNameProp("ObservedDiv"), "data-testid": "observer", ref: ref });
|
|
26
|
+
return (React.createElement(S.Observed, { ...dpNameProp("ObservedDiv"), "data-testid": "observer", position: reverse ? "top" : "bottom", ref: ref }));
|
|
27
27
|
}
|
|
28
28
|
//# sourceMappingURL=ObservedDiv.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObservedDiv.js","sourceRoot":"","sources":["../../../../src/components/Infinite/ObservedDiv.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"ObservedDiv.js","sourceRoot":"","sources":["../../../../src/components/Infinite/ObservedDiv.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,oBA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"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/components/Infinite/styles.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAgC;;;CAGjE,CAAC"}
|
|
@@ -8,10 +8,9 @@ import { dpNameProp } from "../../utils/dpName";
|
|
|
8
8
|
const getStyle = (styleType, theme) => {
|
|
9
9
|
const styles = {
|
|
10
10
|
light: {
|
|
11
|
-
backgroundColor: theme.colors.
|
|
12
|
-
color: theme.colors.
|
|
13
|
-
border:
|
|
14
|
-
borderColor: "white",
|
|
11
|
+
backgroundColor: theme.colors.grey3,
|
|
12
|
+
color: theme.colors.grey_black100,
|
|
13
|
+
border: `1px solid ${theme.colors.systemShade30}`,
|
|
15
14
|
boxShadow: "0px 4px 6px -1px rgba(0, 0, 0, 0.1), 0px 2px 4px -1px rgba(0, 0, 0, 0.06);",
|
|
16
15
|
},
|
|
17
16
|
lightBox: {
|
|
@@ -30,10 +29,9 @@ const getStyle = (styleType, theme) => {
|
|
|
30
29
|
boxShadow: "0px 4px 16px rgba(0, 0, 0, 0.3)",
|
|
31
30
|
},
|
|
32
31
|
dark: {
|
|
33
|
-
backgroundColor: theme.colors.
|
|
32
|
+
backgroundColor: theme.colors.grey_black100,
|
|
34
33
|
color: theme.colors.white,
|
|
35
34
|
border: "none",
|
|
36
|
-
borderColor: theme.colors.grey40,
|
|
37
35
|
boxShadow: "0px 4px 6px -1px rgba(0, 0, 0, 0.1), 0px 2px 4px -1px rgba(0, 0, 0, 0.06);",
|
|
38
36
|
},
|
|
39
37
|
extraDark: {
|
|
@@ -103,7 +101,7 @@ export const Tooltip = styled(({ suppressClassNameWarning, styleType, arrow = fa
|
|
|
103
101
|
`}
|
|
104
102
|
${({ arrowColor, theme, styleType = "light" }) => css `
|
|
105
103
|
.tippy-arrow {
|
|
106
|
-
color: ${getStyle(styleType, theme).
|
|
104
|
+
color: ${getStyle(styleType, theme).backgroundColor};
|
|
107
105
|
border-top-color: ${arrowColor
|
|
108
106
|
? theme.colors[arrowColor]
|
|
109
107
|
: getStyle(styleType, theme).backgroundColor} !important;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,MAAM,EAAE,EAAE,GAAG,EAAqD,MAAM,mBAAmB,CAAC;AACnG,OAAO,KAAqB,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AA6BhD,MAAM,QAAQ,GAAG,CAAC,SAA0B,EAAE,KAAmB,EAAE,EAAE;IACnE,MAAM,MAAM,GAAG;QACb,KAAK,EAAE;YACL,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK;YACnC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,MAAM,EAAE,EAAE,GAAG,EAAqD,MAAM,mBAAmB,CAAC;AACnG,OAAO,KAAqB,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AA6BhD,M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K,CAAC,MAAM,CAAC,UAAU,CAAC;IAC1B,CAAC,CAAC,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,eAAe;;;KAGnD;CACJ,CAAC;AAYF;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAChC,OAAO,EACP,SAAS,GAAG,OAAO,EACnB,SAAS,GAAG,KAAK,EACjB,QAAQ,GAAG,EAAE,GACU;IACvB,OAAO,CACL,oBAAC,OAAO,OACF,UAAU,CAAC,SAAS,CAAC,EACzB,OAAO,EAAE,OAAO,EAChB,wBAAwB,EAAE,IAAI,EAC9B,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS;QAEpB,oBAAC,KAAK,IAAC,KAAK,EAAE,QAAQ;YACpB,oBAAC,IAAI,IAAC,IAAI,EAAE,gBAAgB,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,GAAI,CAChE,CACA,CACX,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deskpro/deskpro-ui",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.4",
|
|
4
4
|
"description": "Deskpro UI components",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/deskpro/deskpro-ui/issues"
|
|
@@ -133,7 +133,8 @@
|
|
|
133
133
|
"codegen": "true",
|
|
134
134
|
"start:storybook": "start-storybook -p 6006",
|
|
135
135
|
"build": "pnpm run build:clean && pnpm run build:cjs && pnpm run build:esm && pnpm run build:api-extractor && pnpm run build:copy-assets",
|
|
136
|
-
"build:dist": "pnpm run build:clean && pnpm run build:
|
|
136
|
+
"build:dist": "pnpm run build:clean && pnpm run build:esm && pnpm run build:copy-assets",
|
|
137
|
+
"build:dist:watch": "nodemon --watch src --ext ts,tsx --exec pnpm run build:dist",
|
|
137
138
|
"build:clean": "rimraf ./dist && rimraf ./temp",
|
|
138
139
|
"build:copy-assets": "cp -r ./fonts ./dist && cp ./deskpro-ui.css ./dist && cp ./deskpro-custom-icons.css ./dist",
|
|
139
140
|
"build:esm": "tsc -p ./src/tsconfig.json --outDir ./dist/esm --module ES2022 --composite false --declarationDir ./temp",
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const react_1 = require("react");
|
|
4
|
-
// hook that detects when the provided element is within the viewport
|
|
5
|
-
const useInView = () => {
|
|
6
|
-
const [ref, setRef] = (0, react_1.useState)(null);
|
|
7
|
-
const [inView, setInView] = (0, react_1.useState)(false);
|
|
8
|
-
const visibilityOptions = (0, react_1.useMemo)(() => ({
|
|
9
|
-
root: null,
|
|
10
|
-
threshold: [0, 1],
|
|
11
|
-
}), []);
|
|
12
|
-
(0, react_1.useEffect)(() => {
|
|
13
|
-
if (!ref)
|
|
14
|
-
return;
|
|
15
|
-
const observer = new IntersectionObserver((entries) => entries.forEach((entry) => {
|
|
16
|
-
setInView(entry.isIntersecting);
|
|
17
|
-
}), visibilityOptions);
|
|
18
|
-
observer.observe(ref);
|
|
19
|
-
return () => {
|
|
20
|
-
setInView(false);
|
|
21
|
-
observer.disconnect();
|
|
22
|
-
};
|
|
23
|
-
}, [ref, visibilityOptions]);
|
|
24
|
-
return (0, react_1.useMemo)(() => ({ ref: setRef, inView }), [inView]);
|
|
25
|
-
};
|
|
26
|
-
exports.default = useInView;
|
|
27
|
-
//# sourceMappingURL=useInView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useInView.js","sourceRoot":"","sources":["../../../src/utils/useInView.ts"],"names":[],"mappings":";;AAAA,iCAAqD;AAErD,qEAAqE;AACrE,MAAM,SAAS,GAAG,GAA0B,EAAE;IAC5C,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,IAAA,gBAAQ,EAAW,IAAI,CAAC,CAAC;IAC/C,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,iBAAiB,GAA6B,IAAA,eAAO,EACzD,GAAG,EAAE,CAAC,CAAC;QACL,IAAI,EAAE,IAAI;QACV,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;KAClB,CAAC,EACF,EAAE,CACH,CAAC;IAEF,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,GAAG;YAAE,OAAO;QACjB,MAAM,QAAQ,GAAG,IAAI,oBAAoB,CACvC,CAAC,OAAO,EAAE,EAAE,CACV,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACxB,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAClC,CAAC,CAAC,EACJ,iBAAiB,CAClB,CAAC;QACF,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACtB,OAAO,GAAG,EAAE;YACV,SAAS,CAAC,KAAK,CAAC,CAAC;YACjB,QAAQ,CAAC,UAAU,EAAE,CAAC;QACxB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAE7B,OAAO,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;AAC5D,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { useEffect, useMemo, useState } from "react";
|
|
2
|
-
// hook that detects when the provided element is within the viewport
|
|
3
|
-
const useInView = () => {
|
|
4
|
-
const [ref, setRef] = useState(null);
|
|
5
|
-
const [inView, setInView] = useState(false);
|
|
6
|
-
const visibilityOptions = useMemo(() => ({
|
|
7
|
-
root: null,
|
|
8
|
-
threshold: [0, 1],
|
|
9
|
-
}), []);
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
if (!ref)
|
|
12
|
-
return;
|
|
13
|
-
const observer = new IntersectionObserver((entries) => entries.forEach((entry) => {
|
|
14
|
-
setInView(entry.isIntersecting);
|
|
15
|
-
}), visibilityOptions);
|
|
16
|
-
observer.observe(ref);
|
|
17
|
-
return () => {
|
|
18
|
-
setInView(false);
|
|
19
|
-
observer.disconnect();
|
|
20
|
-
};
|
|
21
|
-
}, [ref, visibilityOptions]);
|
|
22
|
-
return useMemo(() => ({ ref: setRef, inView }), [inView]);
|
|
23
|
-
};
|
|
24
|
-
export default useInView;
|
|
25
|
-
//# sourceMappingURL=useInView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useInView.js","sourceRoot":"","sources":["../../../src/utils/useInView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAErD,qEAAqE;AACrE,MAAM,SAAS,GAAG,GAA0B,EAAE;IAC5C,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAW,IAAI,CAAC,CAAC;IAC/C,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,iBAAiB,GAA6B,OAAO,CACzD,GAAG,EAAE,CAAC,CAAC;QACL,IAAI,EAAE,IAAI;QACV,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;KAClB,CAAC,EACF,EAAE,CACH,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,GAAG;YAAE,OAAO;QACjB,MAAM,QAAQ,GAAG,IAAI,oBAAoB,CACvC,CAAC,OAAO,EAAE,EAAE,CACV,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACxB,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAClC,CAAC,CAAC,EACJ,iBAAiB,CAClB,CAAC;QACF,QAAQ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