@deskpro/deskpro-ui 5.0.4 → 6.1.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/Drilldown/CreateNewOption.js +18 -0
- package/dist/cjs/components/Drilldown/CreateNewOption.js.map +1 -0
- package/dist/cjs/components/Drilldown/Drilldown.js +78 -197
- package/dist/cjs/components/Drilldown/Drilldown.js.map +1 -1
- package/dist/cjs/components/Drilldown/DrilldownItem.js +65 -0
- package/dist/cjs/components/Drilldown/DrilldownItem.js.map +1 -0
- package/dist/cjs/components/Drilldown/DrilldownList.js +133 -0
- package/dist/cjs/components/Drilldown/DrilldownList.js.map +1 -0
- package/dist/cjs/components/Drilldown/DrilldownResetButton.js +2 -2
- package/dist/cjs/components/Drilldown/DrilldownResetButton.js.map +1 -1
- package/dist/cjs/components/Drilldown/hooks/useFilteredItems.js +42 -0
- package/dist/cjs/components/Drilldown/hooks/useFilteredItems.js.map +1 -0
- package/dist/cjs/components/Drilldown/hooks/useTreeify.js +63 -0
- package/dist/cjs/components/Drilldown/hooks/useTreeify.js.map +1 -0
- package/dist/cjs/components/Drilldown/{useUpdateItems.js → hooks/useUpdateItems.js} +2 -2
- package/dist/cjs/components/Drilldown/hooks/useUpdateItems.js.map +1 -0
- package/dist/cjs/components/Drilldown/index.js +9 -7
- package/dist/cjs/components/Drilldown/index.js.map +1 -1
- package/dist/cjs/components/Drilldown/styles.js +14 -1
- package/dist/cjs/components/Drilldown/styles.js.map +1 -1
- package/dist/cjs/components/Drilldown/types.js.map +1 -1
- package/dist/cjs/components/Drilldown/utility.js +45 -22
- package/dist/cjs/components/Drilldown/utility.js.map +1 -1
- package/dist/cjs/components/Infinite/Infinite.js +116 -61
- 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/hooks/usePrevious.js +17 -0
- package/dist/cjs/hooks/usePrevious.js.map +1 -0
- package/dist/cjs/utils/useInView.js +27 -0
- package/dist/cjs/utils/useInView.js.map +1 -0
- package/dist/deskpro-ui.d.ts +40 -46
- package/dist/esm/components/Drilldown/CreateNewOption.js +14 -0
- package/dist/esm/components/Drilldown/CreateNewOption.js.map +1 -0
- package/dist/esm/components/Drilldown/Drilldown.js +78 -193
- package/dist/esm/components/Drilldown/Drilldown.js.map +1 -1
- package/dist/esm/components/Drilldown/DrilldownItem.js +61 -0
- package/dist/esm/components/Drilldown/DrilldownItem.js.map +1 -0
- package/dist/esm/components/Drilldown/DrilldownList.js +127 -0
- package/dist/esm/components/Drilldown/DrilldownList.js.map +1 -0
- package/dist/esm/components/Drilldown/DrilldownResetButton.js +1 -1
- package/dist/esm/components/Drilldown/DrilldownResetButton.js.map +1 -1
- package/dist/esm/components/Drilldown/hooks/useFilteredItems.js +38 -0
- package/dist/esm/components/Drilldown/hooks/useFilteredItems.js.map +1 -0
- package/dist/esm/components/Drilldown/hooks/useTreeify.js +54 -0
- package/dist/esm/components/Drilldown/hooks/useTreeify.js.map +1 -0
- package/dist/esm/components/Drilldown/{useUpdateItems.js → hooks/useUpdateItems.js} +2 -2
- package/dist/esm/components/Drilldown/hooks/useUpdateItems.js.map +1 -0
- package/dist/esm/components/Drilldown/index.js +5 -2
- package/dist/esm/components/Drilldown/index.js.map +1 -1
- package/dist/esm/components/Drilldown/styles.js +13 -0
- package/dist/esm/components/Drilldown/styles.js.map +1 -1
- package/dist/esm/components/Drilldown/types.js.map +1 -1
- package/dist/esm/components/Drilldown/utility.js +40 -20
- package/dist/esm/components/Drilldown/utility.js.map +1 -1
- package/dist/esm/components/Infinite/Infinite.js +117 -62
- 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/hooks/usePrevious.js +13 -0
- package/dist/esm/hooks/usePrevious.js.map +1 -0
- package/dist/esm/utils/useInView.js +25 -0
- package/dist/esm/utils/useInView.js.map +1 -0
- package/package.json +9 -4
- package/dist/cjs/components/Drilldown/useUpdateItems.js.map +0 -1
- package/dist/esm/components/Drilldown/useUpdateItems.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { useCallback, useEffect, useLayoutEffect, useRef, useState, } from "react";
|
|
2
|
+
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, } from "react";
|
|
3
3
|
import { useDebouncedCallback } from "use-debounce";
|
|
4
4
|
import { Stack } from "../../layout";
|
|
5
|
-
import {
|
|
5
|
+
import { Observed } from "./styles";
|
|
6
6
|
import { Spinner } from "../Spinner";
|
|
7
7
|
import { Button, OverlayButton } from "../Button";
|
|
8
8
|
import { match } from "ts-pattern";
|
|
@@ -10,10 +10,10 @@ import { Scrollbar } from "../Scrollbar";
|
|
|
10
10
|
import { faAngleDoubleDown, faAngleDoubleUp } from "@fortawesome/free-solid-svg-icons";
|
|
11
11
|
import { useTheme } from "styled-components";
|
|
12
12
|
import { dpNameProp } from "../../utils/dpName";
|
|
13
|
+
import useInView from "../../utils/useInView";
|
|
14
|
+
import ResizeObserver from "react-resize-observer";
|
|
13
15
|
// Controls the scroll when the data changes and for user wheel events
|
|
14
|
-
function useScrollControl(
|
|
15
|
-
const innerRef = useRef(null);
|
|
16
|
-
const ref = outerRef !== null && outerRef !== void 0 ? outerRef : innerRef;
|
|
16
|
+
function useScrollControl(lastFetchDirection, scrollRef, reverse, anchor, scrollSideEffect, topStatus) {
|
|
17
17
|
const firstMount = useRef(true);
|
|
18
18
|
// Used to check if the scroll should be forced to the edges on data updates
|
|
19
19
|
const shouldAttachScroll = useRef(true);
|
|
@@ -21,59 +21,74 @@ function useScrollControl(children, reverse, anchor, scrollSideEffect, outerRef)
|
|
|
21
21
|
const lastKnownScrollOffset = useRef();
|
|
22
22
|
// Forces the scrollbar to the top or bottom on first render
|
|
23
23
|
useEffect(() => {
|
|
24
|
-
if (
|
|
24
|
+
if ((scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current) && shouldAttachScroll.current) {
|
|
25
25
|
if (reverse) {
|
|
26
|
-
|
|
26
|
+
scrollRef.current.scrollTo({
|
|
27
|
+
top: scrollRef.current.scrollHeight - scrollRef.current.clientHeight - 4,
|
|
28
|
+
});
|
|
27
29
|
}
|
|
28
30
|
else {
|
|
29
|
-
|
|
31
|
+
scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current.scrollTo({ top: 4 });
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
|
-
}, [
|
|
34
|
+
}, [reverse, scrollRef]);
|
|
35
|
+
// this will update the scroll position when a fetch has been made while scrolling up
|
|
36
|
+
// this is to stop the page jumping once a request has been made
|
|
37
|
+
const setScrollTo = useCallback(() => {
|
|
38
|
+
var _a, _b, _c;
|
|
39
|
+
if (!shouldAttachScroll.current &&
|
|
40
|
+
typeof lastKnownScrollOffset.current === "number" &&
|
|
41
|
+
lastFetchDirection === "top" &&
|
|
42
|
+
topStatus !== "end" &&
|
|
43
|
+
topStatus !== "end-with-force") {
|
|
44
|
+
// set position using saved offset
|
|
45
|
+
(_a = scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
|
|
46
|
+
top: Math.abs(lastKnownScrollOffset.current -
|
|
47
|
+
(((_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))),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
// save current position offset
|
|
51
|
+
if (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current) {
|
|
52
|
+
lastKnownScrollOffset.current = Math.abs((scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current.scrollTop) -
|
|
53
|
+
((scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current.scrollHeight) - (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current.clientHeight)));
|
|
54
|
+
}
|
|
55
|
+
}, [lastFetchDirection, scrollRef, topStatus]);
|
|
33
56
|
// On render will force the scroll bar to the top or bottom, unless detached
|
|
34
57
|
useLayoutEffect(() => {
|
|
35
58
|
if (firstMount.current || !anchor) {
|
|
36
59
|
firstMount.current = false;
|
|
37
60
|
return;
|
|
38
61
|
}
|
|
39
|
-
if (!
|
|
62
|
+
if (!(scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current))
|
|
40
63
|
return;
|
|
41
|
-
|
|
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
|
+
setScrollTo();
|
|
54
65
|
});
|
|
55
66
|
const debouncedSetIsAttached = useDebouncedCallback(() => {
|
|
56
|
-
if (typeof lastKnownScrollOffset.current === "number" &&
|
|
67
|
+
if (typeof lastKnownScrollOffset.current === "number" && (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current)) {
|
|
57
68
|
if (shouldAttachScroll.current !== isAttached && lastKnownScrollOffset.current > 300) {
|
|
58
69
|
setIsAttached(shouldAttachScroll.current);
|
|
59
70
|
}
|
|
60
71
|
else if (shouldAttachScroll.current !== isAttached &&
|
|
61
|
-
lastKnownScrollOffset.current
|
|
72
|
+
lastKnownScrollOffset.current <= 10) {
|
|
62
73
|
setIsAttached(shouldAttachScroll.current);
|
|
63
74
|
}
|
|
64
75
|
}
|
|
65
76
|
}, 100, { trailing: true, leading: true });
|
|
66
77
|
// On scroll events will attach or detach the scroll position from the top or bottom
|
|
67
|
-
const handleScroll = useCallback(() => {
|
|
68
|
-
if (
|
|
78
|
+
const handleScroll = useCallback((event) => {
|
|
79
|
+
if ((scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current) &&
|
|
69
80
|
!isAttached &&
|
|
70
|
-
|
|
81
|
+
scrollRef.current.scrollTop + scrollRef.current.offsetHeight >
|
|
82
|
+
scrollRef.current.scrollHeight - 2) {
|
|
71
83
|
setIsAttached(true);
|
|
72
84
|
}
|
|
73
|
-
if (!
|
|
85
|
+
if (!(scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current)) {
|
|
86
|
+
scrollSideEffect === null || scrollSideEffect === void 0 ? void 0 : scrollSideEffect(event);
|
|
74
87
|
return;
|
|
88
|
+
}
|
|
75
89
|
if (reverse) {
|
|
76
|
-
if (
|
|
90
|
+
if (scrollRef.current.scrollTop <
|
|
91
|
+
scrollRef.current.scrollHeight - scrollRef.current.clientHeight) {
|
|
77
92
|
shouldAttachScroll.current = false;
|
|
78
93
|
}
|
|
79
94
|
else {
|
|
@@ -81,70 +96,110 @@ function useScrollControl(children, reverse, anchor, scrollSideEffect, outerRef)
|
|
|
81
96
|
}
|
|
82
97
|
}
|
|
83
98
|
else {
|
|
84
|
-
if (
|
|
99
|
+
if (scrollRef.current.scrollTop > 0) {
|
|
85
100
|
shouldAttachScroll.current = false;
|
|
86
101
|
}
|
|
87
102
|
else {
|
|
88
103
|
shouldAttachScroll.current = true;
|
|
89
104
|
}
|
|
90
105
|
}
|
|
91
|
-
|
|
92
|
-
|
|
106
|
+
setScrollTo();
|
|
107
|
+
scrollSideEffect === null || scrollSideEffect === void 0 ? void 0 : scrollSideEffect(event);
|
|
93
108
|
debouncedSetIsAttached();
|
|
94
|
-
}, [
|
|
109
|
+
}, [scrollRef, isAttached, reverse, setScrollTo, scrollSideEffect, debouncedSetIsAttached]);
|
|
95
110
|
const reAttach = useCallback(() => {
|
|
96
111
|
shouldAttachScroll.current = true;
|
|
97
112
|
setIsAttached(true);
|
|
98
|
-
if (
|
|
113
|
+
if (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current) {
|
|
99
114
|
if (reverse) {
|
|
100
|
-
|
|
115
|
+
scrollRef.current.scrollTo({ top: scrollRef.current.scrollHeight });
|
|
101
116
|
}
|
|
102
117
|
else {
|
|
103
|
-
|
|
118
|
+
scrollRef.current.scrollTo(0, 0);
|
|
104
119
|
}
|
|
105
120
|
}
|
|
106
|
-
}, [
|
|
121
|
+
}, [scrollRef, reverse]);
|
|
122
|
+
// if scrolled to top or bottom move so not to trigger another fetch
|
|
123
|
+
if ((scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current) &&
|
|
124
|
+
scrollRef.current.scrollTop > scrollRef.current.scrollHeight - scrollRef.current.clientHeight) {
|
|
125
|
+
scrollRef.current.scrollTo({
|
|
126
|
+
top: scrollRef.current.scrollHeight - scrollRef.current.clientHeight - 4,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
else if ((scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current) && scrollRef.current.scrollTop === 0) {
|
|
130
|
+
scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current.scrollTo({ top: 4 });
|
|
131
|
+
}
|
|
107
132
|
return {
|
|
108
|
-
ref:
|
|
109
|
-
|
|
133
|
+
ref: scrollRef,
|
|
134
|
+
handleScroll,
|
|
110
135
|
isAttached,
|
|
111
136
|
reAttach,
|
|
112
137
|
};
|
|
113
138
|
}
|
|
139
|
+
const EndOfScroll = ({ status, fetchMoreText, fetchMore }) => match({ status, hasFetchMore: !!fetchMore })
|
|
140
|
+
.with({ hasFetchMore: false }, () => null)
|
|
141
|
+
.with({ status: "loading" }, { status: "hasNextPage" }, () => (React.createElement(Stack, { justify: "center", align: "center", padding: 5, style: { minHeight: 60, margin: "-1px 0" } },
|
|
142
|
+
React.createElement(Spinner, null))))
|
|
143
|
+
.with({ status: "end-with-force", hasFetchMore: true }, () => (React.createElement(Stack, { justify: "center", align: "center", padding: 5 },
|
|
144
|
+
React.createElement(Button, { intent: "tertiary", onClick: fetchMore, text: fetchMoreText }))))
|
|
145
|
+
.otherwise(() => null);
|
|
114
146
|
/**
|
|
115
147
|
* Will render a scrollbar container that uses an intersection observer to watch for when
|
|
116
148
|
* the container has scrolled to the top or bottom.
|
|
117
149
|
* @public
|
|
118
150
|
*/
|
|
119
|
-
export function Infinite({ children, reverse = false, anchor = false, onFetchMore, status, maxHeight = "100%", scrollSideEffect, width, fetchMoreText, autoscrollText, scrollRef, justify, }) {
|
|
120
|
-
const
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
151
|
+
export function Infinite({ children, reverse = false, anchor = false, onFetchMore, onFetchMoreStart, status, startStatus, maxHeight = "100%", scrollSideEffect, width, fetchMoreText, autoscrollText, scrollRef, justify, onResize, onJumpToStart, }) {
|
|
152
|
+
const dualDirection = !!onFetchMoreStart;
|
|
153
|
+
const [lastFetchDirection, setLastFetchDirection] = useState(null);
|
|
154
|
+
const topFetch = useMemo(() => (reverse ? onFetchMore : onFetchMoreStart), [onFetchMore, onFetchMoreStart, reverse]);
|
|
155
|
+
const bottomFetch = useMemo(() => (reverse ? onFetchMoreStart : onFetchMore), [onFetchMore, onFetchMoreStart, reverse]);
|
|
156
|
+
const topStatus = useMemo(() => (reverse ? status : startStatus), [reverse, startStatus, status]);
|
|
157
|
+
const bottomStatus = useMemo(() => (reverse ? startStatus : status), [reverse, startStatus, status]);
|
|
158
|
+
const { ref, isAttached, handleScroll, reAttach } = useScrollControl(lastFetchDirection, scrollRef, reverse, anchor, scrollSideEffect, topStatus);
|
|
159
|
+
const { inView: topInView, ref: topRef } = useInView();
|
|
160
|
+
const { inView: bottomInView, ref: bottomRef } = useInView();
|
|
161
|
+
useEffect(() => {
|
|
162
|
+
setLastFetchDirection("top");
|
|
163
|
+
if (topInView && topStatus !== "loading") {
|
|
164
|
+
if (topFetch && (!topStatus || topStatus !== "end")) {
|
|
165
|
+
topFetch();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}, [onFetchMore, onFetchMoreStart, reverse, startStatus, status, topFetch, topInView, topStatus]);
|
|
169
|
+
useEffect(() => {
|
|
170
|
+
setLastFetchDirection("bottom");
|
|
171
|
+
if (bottomInView && bottomStatus !== "loading") {
|
|
172
|
+
if (bottomFetch && (!bottomStatus || bottomStatus !== "end")) {
|
|
173
|
+
bottomFetch();
|
|
174
|
+
}
|
|
124
175
|
}
|
|
125
|
-
}, [
|
|
126
|
-
|
|
176
|
+
}, [
|
|
177
|
+
bottomFetch,
|
|
178
|
+
bottomInView,
|
|
179
|
+
bottomStatus,
|
|
180
|
+
onFetchMore,
|
|
181
|
+
onFetchMoreStart,
|
|
182
|
+
reverse,
|
|
183
|
+
topStatus,
|
|
184
|
+
status,
|
|
185
|
+
]);
|
|
186
|
+
const { colors } = useTheme();
|
|
127
187
|
return (React.createElement(Stack, { ...dpNameProp("Infinite"), maxHeight: "100%", style: {
|
|
128
188
|
position: "relative",
|
|
129
189
|
overflow: "hidden",
|
|
130
190
|
height: "100%",
|
|
131
191
|
width,
|
|
132
192
|
}, justify: justify, align: "stretch", vertical: true },
|
|
133
|
-
React.createElement(Scrollbar, { autoHide: true, style: { maxHeight: maxHeight }, scrollableNodeProps: { ref: ref, onScroll:
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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 }),
|
|
193
|
+
React.createElement(Scrollbar, { autoHide: true, style: { maxHeight: maxHeight }, scrollableNodeProps: { ref: ref, onScroll: handleScroll } },
|
|
194
|
+
React.createElement(ResizeObserver, { onResize: onResize }),
|
|
195
|
+
React.createElement(Observed, { ref: reverse || dualDirection ? topRef : undefined }),
|
|
196
|
+
React.createElement(EndOfScroll, { status: reverse ? status : startStatus, fetchMoreText: fetchMoreText, fetchMore: reverse ? onFetchMore : onFetchMoreStart }),
|
|
144
197
|
children,
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
198
|
+
React.createElement(EndOfScroll, { status: reverse ? startStatus : status, fetchMoreText: fetchMoreText, fetchMore: reverse ? onFetchMoreStart : onFetchMore }),
|
|
199
|
+
React.createElement(Observed, { ref: !reverse || dualDirection ? bottomRef : undefined })),
|
|
200
|
+
anchor && !isAttached && (React.createElement(OverlayButton, { placement: reverse ? "middle-bottom" : "middle-top", text: autoscrollText, onClick: () => {
|
|
201
|
+
reAttach();
|
|
202
|
+
onJumpToStart === null || onJumpToStart === void 0 ? void 0 : onJumpToStart();
|
|
203
|
+
}, icon: { icon: reverse ? faAngleDoubleDown : faAngleDoubleUp, size: 14 }, rightIcon: { icon: reverse ? faAngleDoubleDown : faAngleDoubleUp, size: 14 }, style: { color: colors.brandShade100 } }))));
|
|
149
204
|
}
|
|
150
205
|
//# sourceMappingURL=Infinite.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Infinite.js","sourceRoot":"","sources":["../../../../src/components/Infinite/Infinite.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGL,WAAW,EACX,SAAS,EACT,eAAe,EACf,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,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AC,WAAW,EACtC,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,gBAAgB,GACnD;YACD,QAAQ;YACT,oBAAC,WAAW,IACV,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,EACtC,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,WAAW,GACnD;YACF,oBAAC,QAAQ,IAAC,GAAG,EAAE,CAAC,OAAO,IAAI,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,GAAI,CAC1D;QACX,MAAM,IAAI,CAAC,UAAU,IAAI,CACxB,oBAAC,aAAa,IACZ,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,YAAY,EACnD,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,GAAG,EAAE;gBACZ,QAAQ,EAAE,CAAC;gBACX,aAAa,aAAb,aAAa,uBAAb,aAAa,EAAI,CAAC;YACpB,CAAC,EACD,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,eAAe,EAAE,IAAI,EAAE,EAAE,EAAE,EACvE,SAAS,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,eAAe,EAAE,IAAI,EAAE,EAAE,EAAE,EAC5E,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,aAAa,EAAE,GACtC,CACH,CACK,CACT,CAAC;AACJ,CAAC"}
|
|
@@ -6,7 +6,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 }) {
|
|
10
10
|
const ref = useRef(null);
|
|
11
11
|
const callback = useRef(onIntersect);
|
|
12
12
|
useLayoutEffect(() => {
|
|
@@ -23,6 +23,6 @@ export function ObservedDiv({ onIntersect, reverse = false }) {
|
|
|
23
23
|
observer.observe(ref.current);
|
|
24
24
|
return () => observer.disconnect();
|
|
25
25
|
}, []);
|
|
26
|
-
return
|
|
26
|
+
return React.createElement(S.Observed, { ...dpNameProp("ObservedDiv"), "data-testid": "observer", 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,oBAAoB,CAAC;AAOhD;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,WAAW,EAAiB;IACxD,MAAM,GAAG,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IACzC,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;IAErC,eAAe,CAAC,GAAG,EAAE;QACnB,QAAQ,CAAC,OAAO,GAAG,WAAW,CAAC;IACjC,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,eAAe,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,GAAG,CAAC,OAAO;YAAE,OAAO;QAEzB,MAAM,QAAQ,GAAG,IAAI,oBAAoB,CAAC,CAAC,OAAO,EAAE,EAAE;YACpD,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE;gBACjD,QAAQ,CAAC,OAAO,EAAE,CAAC;aACpB;QACH,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAE9B,OAAO,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,oBAAC,CAAC,CAAC,QAAQ,OAAK,UAAU,CAAC,aAAa,CAAC,iBAAc,UAAU,EAAC,GAAG,EAAE,GAAG,GAAI,CAAC;AACxF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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,
|
|
1
|
+
{"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,CAAA;;;CAGjC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
export function usePrevious(value) {
|
|
3
|
+
// The ref object is a generic container whose current property is mutable ...
|
|
4
|
+
// ... and can hold any value, similar to an instance property on a class
|
|
5
|
+
const ref = useRef();
|
|
6
|
+
// Store current value in ref
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
ref.current = value;
|
|
9
|
+
}, [value]); // Only re-run if value changes
|
|
10
|
+
// Return previous value (happens before update in useEffect above)
|
|
11
|
+
return ref.current;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=usePrevious.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePrevious.js","sourceRoot":"","sources":["../../../src/hooks/usePrevious.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,MAAM,UAAU,WAAW,CAAI,KAAQ;IACrC,8EAA8E;IAC9E,yEAAyE;IACzE,MAAM,GAAG,GAAG,MAAM,EAAK,CAAC;IAExB,6BAA6B;IAC7B,SAAS,CAAC,GAAG,EAAE;QACb,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;IACtB,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,+BAA+B;IAE5C,mEAAmE;IACnE,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,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,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;AAC5D,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deskpro/deskpro-ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"description": "Deskpro UI components",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/deskpro/deskpro-ui/issues"
|
|
@@ -28,13 +28,14 @@
|
|
|
28
28
|
"styled-components": "^5"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@fortawesome/fontawesome-svg-core": "^6.1.
|
|
32
|
-
"@fortawesome/free-solid-svg-icons": "^6.1.
|
|
31
|
+
"@fortawesome/fontawesome-svg-core": "^6.1.2",
|
|
32
|
+
"@fortawesome/free-solid-svg-icons": "^6.1.2",
|
|
33
33
|
"@fortawesome/react-fontawesome": "^0.1.18",
|
|
34
34
|
"@heroicons/react": "^1.0.6",
|
|
35
35
|
"@popperjs/core": "^2.11.0",
|
|
36
36
|
"@tippyjs/react": "^4.2.6",
|
|
37
37
|
"csstype": "^3.0.10",
|
|
38
|
+
"d3-hierarchy": "^3.1.2",
|
|
38
39
|
"formik": "^2.2.9",
|
|
39
40
|
"framer-motion": "^6.2.8",
|
|
40
41
|
"pretty-bytes": "^6.0.0",
|
|
@@ -75,6 +76,7 @@
|
|
|
75
76
|
"@testing-library/jest-dom": "^5.16.4",
|
|
76
77
|
"@testing-library/react": "^13.4.0",
|
|
77
78
|
"@testing-library/user-event": "^14.4.2",
|
|
79
|
+
"@types/d3-hierarchy": "^3.1.0",
|
|
78
80
|
"@types/jest": "^27.5.1",
|
|
79
81
|
"@types/node": "^17.0.32",
|
|
80
82
|
"@types/react": "18.0.17",
|
|
@@ -103,10 +105,12 @@
|
|
|
103
105
|
"jest-environment-jsdom": "^28.1.0",
|
|
104
106
|
"lint-staged": "^12.4.1",
|
|
105
107
|
"modern-normalize": "^1.1.0",
|
|
108
|
+
"nodemon": "^2.0.20",
|
|
106
109
|
"prettier": "^2.7.1",
|
|
107
110
|
"prop-types": "^15.8.1",
|
|
108
111
|
"react": "^18.2.0",
|
|
109
112
|
"react-dom": "^18.2.0",
|
|
113
|
+
"react-resize-observer": "^1.1.1",
|
|
110
114
|
"rimraf": "3.0.2",
|
|
111
115
|
"storybook-addon-pseudo-states": "^1.15.1",
|
|
112
116
|
"styled-components": "^5.3.5",
|
|
@@ -133,7 +137,8 @@
|
|
|
133
137
|
"codegen": "true",
|
|
134
138
|
"start:storybook": "start-storybook -p 6006",
|
|
135
139
|
"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:
|
|
140
|
+
"build:watch": "nodemon --watch src --ext ts,tsx --exec pnpm run build",
|
|
141
|
+
"build:dist": "pnpm run build:clean && pnpm run build:cjs && pnpm run build:esm && pnpm run build:copy-assets",
|
|
137
142
|
"build:dist:watch": "nodemon --watch src --ext ts,tsx --exec pnpm run build:dist",
|
|
138
143
|
"build:clean": "rimraf ./dist && rimraf ./temp",
|
|
139
144
|
"build:copy-assets": "cp -r ./fonts ./dist && cp ./deskpro-ui.css ./dist && cp ./deskpro-custom-icons.css ./dist",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useUpdateItems.js","sourceRoot":"","sources":["../../../../src/components/Drilldown/useUpdateItems.tsx"],"names":[],"mappings":";;;AAAA,mCAQiB;AACjB,iCAAkC;AAClC,uCAA6F;AAsB7F,SAAgB,cAAc,CAAI,EAChC,IAAI,EACJ,KAAK,EACL,SAAS,EACT,YAAY,EACZ,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,qBA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CAAC,CAAC;YACxB,eAAe,CAAC,SAAS,CAAC,CAAC;YAC3B,qBAAqB,CAAC,EAAE,CAAC,CAAC;SAC3B;QACD,uDAAuD;IACzD,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AACd,CAAC;AA3ED,wCA2EC;AAED,SAAgB,WAAW,CACzB,KAA6B,EAC7B,IAAmB;IAEnB,OAAO,IAAI,KAAK,MAAM,CAAC;AACzB,CAAC;AALD,kCAKC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useUpdateItems.js","sourceRoot":"","sources":["../../../../src/components/Drilldown/useUpdateItems.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAsB7F,MAAM,UAAU,cAAc,CAAI,EAChC,IAAI,EACJ,KAAK,EACL,SAAS,EACT,YAAY,EACZ,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,qBAAqB,EACrB,YAAY,EACZ,eAAe,GACG;IAClB,6CAA6C;IAC7C,4FAA4F;IAC5F,iDAAiD;IACjD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI;YACF,oDAAoD;YACpD,IAAI,CAAC,SAAS,EAAE;gBACd,IAAI,IAAI,KAAK,MAAM,EAAE;oBACnB,eAAe,CAAC,oBAAoB,CAAC,SAAS,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC;iBAC7E;qBAAM;oBACL,MAAM,QAAQ,GAAG,oBAAoB,CAAC,SAAS,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC;oBAC5E,eAAe,CAAC,QAAQ,CAAC,CAAC;iBAC3B;aACF;iBAAM,IAAI,SAAS,KAAK,WAAW,EAAE;gBACpC,IAAI,IAAI,KAAK,MAA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