@deskpro/deskpro-ui 5.0.1 → 5.0.3
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/Dialog/Dialog.js +1 -0
- package/dist/cjs/components/Dialog/Dialog.js.map +1 -1
- package/dist/cjs/components/Infinite/Infinite.js +58 -98
- 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/Modal/Modal.js +9 -0
- package/dist/cjs/components/Modal/Modal.js.map +1 -1
- package/dist/cjs/layout/ResponsiveLayout/index.js +18 -0
- package/dist/cjs/layout/ResponsiveLayout/index.js.map +1 -0
- package/dist/cjs/layout/ResponsiveLayout/responsiveLayout.js +33 -0
- package/dist/cjs/layout/ResponsiveLayout/responsiveLayout.js.map +1 -0
- package/dist/cjs/layout/ResponsiveLayout/types.js +11 -0
- package/dist/cjs/layout/ResponsiveLayout/types.js.map +1 -0
- package/dist/deskpro-ui.d.ts +4 -6
- package/dist/esm/components/Dialog/Dialog.js +1 -0
- package/dist/esm/components/Dialog/Dialog.js.map +1 -1
- package/dist/esm/components/Infinite/Infinite.js +59 -99
- 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/Modal/Modal.js +9 -0
- package/dist/esm/components/Modal/Modal.js.map +1 -1
- package/dist/esm/layout/ResponsiveLayout/index.js +2 -0
- package/dist/esm/layout/ResponsiveLayout/index.js.map +1 -0
- package/dist/esm/layout/ResponsiveLayout/responsiveLayout.js +28 -0
- package/dist/esm/layout/ResponsiveLayout/responsiveLayout.js.map +1 -0
- package/dist/esm/layout/ResponsiveLayout/types.js +8 -0
- package/dist/esm/layout/ResponsiveLayout/types.js.map +1 -0
- package/package.json +1 -1
- 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":";;;AACA,+BAA+B;AAG/B,wCAAmD;AACnD,2CAAmC;AACnC,iDAAuC;AACvC,yDAAuC;AAEvC,0CAA4C;AAC5C,yCAAqC;AACrC,8CAAoD;AAEpD,+CAAgD;AAahD,MAAM,sBAAsB,GAAG,IAAA,2BAAM,EAAC,sBAAM,CAAC,GAAG,CAAC,CAAsB;iBACtD,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;;;;;;;CAOnE,CAAC;AAEW,QAAA,aAAa,GAAG,2BAAM,CAAC,GAAG,CAAkD;;MAEnF,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CACb,IAAA,kBAAK,EAAC,IAAI,CAAC;KACR,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC;KAC3B,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC;KAC5B,SAAS,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC;IAC5B,qBAAQ,CAAC,cAAc;WAChB,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO;;gBAE9B,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK;CACnC,CAAC;AAEF,MAAM,eAAe,GAAG,2BAAM,CAAC,GAAG,CAAiD;gBACnE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK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,MAAM,iBAAiB,GAAG,IAAA,2BAAM,EAAC,kBAAK,CAAC,CAAA;;CAEtC,CAAC;AAEF;;GAEG;AACH,SAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,GAAG,MAAM,EAAqB;IAC7E,OAAO,CACL,oBAAC,qBAAqB,OAChB,IAAA,mBAAU,EAAC,cAAc,CAAC,EAC9B,EAAE,EAAC,QAAQ,EACX,OAAO,EAAC,QAAQ,EAChB,KAAK,EAAC,QAAQ,EACd,UAAU,EAAE,KAAK;QAEjB,oBAAC,eAAE;YACD,oBAAC,cAAK,IAAC,GAAG,EAAE,EAAE,EAAE,OAAO,EAAC,QAAQ,EAAC,KAAK,EAAC,QAAQ;gBAC5C,IAAI,IAAI,oBAAC,wBAAa,IAAC,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,GAAI;gBAC9D,oBAAC,iBAAiB,IAAC,IAAI,EAAC,IAAI,IAAE,KAAK,CAAqB,CAClD,CACL,CACiB,CACzB,CAAC;AACJ,CAAC;AAjBD,oCAiBC"}
|
|
@@ -5,6 +5,7 @@ const React = require("react");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const use_debounce_1 = require("use-debounce");
|
|
7
7
|
const layout_1 = require("../../layout");
|
|
8
|
+
const ObservedDiv_1 = require("./ObservedDiv");
|
|
8
9
|
const Spinner_1 = require("../Spinner");
|
|
9
10
|
const Button_1 = require("../Button");
|
|
10
11
|
const ts_pattern_1 = require("ts-pattern");
|
|
@@ -12,10 +13,10 @@ const Scrollbar_1 = require("../Scrollbar");
|
|
|
12
13
|
const free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
|
|
13
14
|
const styled_components_1 = require("styled-components");
|
|
14
15
|
const dpName_1 = require("../../utils/dpName");
|
|
15
|
-
const styles_1 = require("./styles");
|
|
16
|
-
const useInView_1 = require("../../utils/useInView");
|
|
17
16
|
// Controls the scroll when the data changes and for user wheel events
|
|
18
|
-
function useScrollControl(
|
|
17
|
+
function useScrollControl(children, reverse, anchor, scrollSideEffect, outerRef) {
|
|
18
|
+
const innerRef = (0, react_1.useRef)(null);
|
|
19
|
+
const ref = outerRef !== null && outerRef !== void 0 ? outerRef : innerRef;
|
|
19
20
|
const firstMount = (0, react_1.useRef)(true);
|
|
20
21
|
// Used to check if the scroll should be forced to the edges on data updates
|
|
21
22
|
const shouldAttachScroll = (0, react_1.useRef)(true);
|
|
@@ -23,50 +24,39 @@ function useScrollControl(lastFetchDirection, scrollRef, reverse, anchor, scroll
|
|
|
23
24
|
const lastKnownScrollOffset = (0, react_1.useRef)();
|
|
24
25
|
// Forces the scrollbar to the top or bottom on first render
|
|
25
26
|
(0, react_1.useEffect)(() => {
|
|
26
|
-
if (
|
|
27
|
+
if (ref.current && shouldAttachScroll.current) {
|
|
27
28
|
if (reverse) {
|
|
28
|
-
|
|
29
|
-
top: (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current.scrollHeight) - (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current.clientHeight) - 4,
|
|
30
|
-
});
|
|
29
|
+
ref.current.scrollTo({ top: ref.current.scrollHeight });
|
|
31
30
|
}
|
|
32
31
|
else {
|
|
33
|
-
|
|
32
|
+
ref.current.scrollTo(0, 0);
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
|
-
}, [
|
|
37
|
-
// this will update the scroll position when a fetch has been made while scrolling up
|
|
38
|
-
// this is to stop the page jumping once a request has been made
|
|
39
|
-
const setScrollTo = (0, react_1.useCallback)(() => {
|
|
40
|
-
var _a, _b, _c;
|
|
41
|
-
if (!shouldAttachScroll.current &&
|
|
42
|
-
typeof lastKnownScrollOffset.current === "number" &&
|
|
43
|
-
lastFetchDirection === "top" &&
|
|
44
|
-
topStatus !== "end" &&
|
|
45
|
-
topStatus !== "end-with-force") {
|
|
46
|
-
// set position using saved offset
|
|
47
|
-
(_a = scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
|
|
48
|
-
top: Math.abs(lastKnownScrollOffset.current -
|
|
49
|
-
(((_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))),
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
// save current position offset
|
|
53
|
-
if (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current) {
|
|
54
|
-
lastKnownScrollOffset.current = Math.abs((scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current.scrollTop) -
|
|
55
|
-
((scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current.scrollHeight) - (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current.clientHeight)));
|
|
56
|
-
}
|
|
57
|
-
}, [lastFetchDirection, scrollRef, topStatus]);
|
|
35
|
+
}, [ref, reverse]);
|
|
58
36
|
// On render will force the scroll bar to the top or bottom, unless detached
|
|
59
37
|
(0, react_1.useLayoutEffect)(() => {
|
|
60
38
|
if (firstMount.current || !anchor) {
|
|
61
39
|
firstMount.current = false;
|
|
62
40
|
return;
|
|
63
41
|
}
|
|
64
|
-
if (!
|
|
42
|
+
if (!ref.current)
|
|
65
43
|
return;
|
|
66
|
-
|
|
44
|
+
if (shouldAttachScroll.current) {
|
|
45
|
+
if (reverse) {
|
|
46
|
+
ref.current.scrollTo({ top: ref.current.scrollHeight });
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
ref.current.scrollTo({ top: 0 });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else if (typeof lastKnownScrollOffset.current === "number" && reverse) {
|
|
53
|
+
ref.current.scrollTo({
|
|
54
|
+
top: Math.abs(lastKnownScrollOffset.current - (ref.current.scrollHeight - ref.current.clientHeight)),
|
|
55
|
+
});
|
|
56
|
+
}
|
|
67
57
|
});
|
|
68
58
|
const debouncedSetIsAttached = (0, use_debounce_1.useDebouncedCallback)(() => {
|
|
69
|
-
if (typeof lastKnownScrollOffset.current === "number" &&
|
|
59
|
+
if (typeof lastKnownScrollOffset.current === "number" && ref.current) {
|
|
70
60
|
if (shouldAttachScroll.current !== isAttached && lastKnownScrollOffset.current > 300) {
|
|
71
61
|
setIsAttached(shouldAttachScroll.current);
|
|
72
62
|
}
|
|
@@ -77,20 +67,16 @@ function useScrollControl(lastFetchDirection, scrollRef, reverse, anchor, scroll
|
|
|
77
67
|
}
|
|
78
68
|
}, 100, { trailing: true, leading: true });
|
|
79
69
|
// On scroll events will attach or detach the scroll position from the top or bottom
|
|
80
|
-
const handleScroll = (0, react_1.useCallback)((
|
|
81
|
-
if (
|
|
70
|
+
const handleScroll = (0, react_1.useCallback)(() => {
|
|
71
|
+
if (ref.current &&
|
|
82
72
|
!isAttached &&
|
|
83
|
-
|
|
84
|
-
(scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current.scrollHeight) - 2) {
|
|
73
|
+
ref.current.scrollTop + ref.current.offsetHeight > ref.current.scrollHeight - 2) {
|
|
85
74
|
setIsAttached(true);
|
|
86
75
|
}
|
|
87
|
-
if (!
|
|
88
|
-
scrollSideEffect === null || scrollSideEffect === void 0 ? void 0 : scrollSideEffect(event);
|
|
76
|
+
if (!ref.current)
|
|
89
77
|
return;
|
|
90
|
-
}
|
|
91
78
|
if (reverse) {
|
|
92
|
-
if (
|
|
93
|
-
(scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current.scrollHeight) - (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current.clientHeight)) {
|
|
79
|
+
if (ref.current.scrollTop < ref.current.scrollHeight - ref.current.clientHeight) {
|
|
94
80
|
shouldAttachScroll.current = false;
|
|
95
81
|
}
|
|
96
82
|
else {
|
|
@@ -98,83 +84,48 @@ function useScrollControl(lastFetchDirection, scrollRef, reverse, anchor, scroll
|
|
|
98
84
|
}
|
|
99
85
|
}
|
|
100
86
|
else {
|
|
101
|
-
if (
|
|
87
|
+
if (ref.current.scrollTop > 0) {
|
|
102
88
|
shouldAttachScroll.current = false;
|
|
103
89
|
}
|
|
104
90
|
else {
|
|
105
91
|
shouldAttachScroll.current = true;
|
|
106
92
|
}
|
|
107
93
|
}
|
|
108
|
-
|
|
94
|
+
scrollSideEffect === null || scrollSideEffect === void 0 ? void 0 : scrollSideEffect();
|
|
95
|
+
lastKnownScrollOffset.current = Math.abs(ref.current.scrollTop - (ref.current.scrollHeight - ref.current.clientHeight));
|
|
109
96
|
debouncedSetIsAttached();
|
|
110
|
-
|
|
111
|
-
}, [scrollRef, isAttached, reverse, scrollSideEffect, setScrollTo, debouncedSetIsAttached]);
|
|
97
|
+
}, [ref, isAttached, reverse, scrollSideEffect, debouncedSetIsAttached]);
|
|
112
98
|
const reAttach = (0, react_1.useCallback)(() => {
|
|
113
99
|
shouldAttachScroll.current = true;
|
|
114
100
|
setIsAttached(true);
|
|
115
|
-
if (
|
|
101
|
+
if (ref.current) {
|
|
116
102
|
if (reverse) {
|
|
117
|
-
|
|
103
|
+
ref.current.scrollTo({ top: ref.current.scrollHeight });
|
|
118
104
|
}
|
|
119
105
|
else {
|
|
120
|
-
|
|
106
|
+
ref.current.scrollTo(0, 0);
|
|
121
107
|
}
|
|
122
108
|
}
|
|
123
|
-
}, [
|
|
109
|
+
}, [ref, reverse]);
|
|
124
110
|
return {
|
|
125
|
-
ref:
|
|
126
|
-
handleScroll,
|
|
111
|
+
ref: ref,
|
|
112
|
+
onScroll: handleScroll,
|
|
127
113
|
isAttached,
|
|
128
114
|
reAttach,
|
|
129
115
|
};
|
|
130
116
|
}
|
|
131
|
-
const EndOfScroll = ({ status, fetchMoreText, fetchMore }) => (0, ts_pattern_1.match)({ status, hasFetchMore: !!fetchMore })
|
|
132
|
-
.with({ hasFetchMore: false }, () => null)
|
|
133
|
-
.with({ status: "loading" }, { status: "hasNextPage" }, () => (React.createElement(layout_1.Stack, { justify: "center", align: "center", padding: 5, style: { minHeight: 60, margin: "-1px 0" } },
|
|
134
|
-
React.createElement(Spinner_1.Spinner, null))))
|
|
135
|
-
.with({ status: "end-with-force", hasFetchMore: true }, () => (React.createElement(layout_1.Stack, { justify: "center", align: "center", padding: 5 },
|
|
136
|
-
React.createElement(Button_1.Button, { intent: "tertiary", onClick: fetchMore, text: fetchMoreText }))))
|
|
137
|
-
.otherwise(() => null);
|
|
138
117
|
/**
|
|
139
118
|
* Will render a scrollbar container that uses an intersection observer to watch for when
|
|
140
119
|
* the container has scrolled to the top or bottom.
|
|
141
120
|
* @public
|
|
142
121
|
*/
|
|
143
|
-
function Infinite({ children, reverse = false, anchor = false, onFetchMore,
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
const topStatus = (0, react_1.useMemo)(() => (reverse ? status : startStatus), [reverse, startStatus, status]);
|
|
149
|
-
const bottomStatus = (0, react_1.useMemo)(() => (reverse ? startStatus : status), [reverse, startStatus, status]);
|
|
150
|
-
const { ref, isAttached, handleScroll, reAttach } = useScrollControl(lastFetchDirection, scrollRef, reverse, anchor, scrollSideEffect, topStatus);
|
|
151
|
-
const { inView: topInView, ref: topRef } = (0, useInView_1.default)();
|
|
152
|
-
const { inView: bottomInView, ref: bottomRef } = (0, useInView_1.default)();
|
|
153
|
-
(0, react_1.useEffect)(() => {
|
|
154
|
-
setLastFetchDirection("top");
|
|
155
|
-
if (topInView && topStatus !== "loading") {
|
|
156
|
-
if (topFetch && (!topStatus || topStatus !== "end")) {
|
|
157
|
-
topFetch();
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}, [onFetchMore, onFetchMoreStart, reverse, startStatus, status, topFetch, topInView, topStatus]);
|
|
161
|
-
(0, react_1.useEffect)(() => {
|
|
162
|
-
setLastFetchDirection("bottom");
|
|
163
|
-
if (bottomInView && bottomStatus !== "loading") {
|
|
164
|
-
if (bottomFetch && (!bottomStatus || bottomStatus !== "end")) {
|
|
165
|
-
bottomFetch();
|
|
166
|
-
}
|
|
122
|
+
function Infinite({ children, reverse = false, anchor = false, onFetchMore, status, maxHeight = "100%", scrollSideEffect, width, fetchMoreText, autoscrollText, scrollRef, justify, }) {
|
|
123
|
+
const { ref, isAttached, onScroll, reAttach } = useScrollControl(children, reverse, anchor, scrollSideEffect, scrollRef);
|
|
124
|
+
const handleIntersect = (0, react_1.useCallback)(() => {
|
|
125
|
+
if (onFetchMore && (!status || status !== "end")) {
|
|
126
|
+
onFetchMore();
|
|
167
127
|
}
|
|
168
|
-
}, [
|
|
169
|
-
bottomFetch,
|
|
170
|
-
bottomInView,
|
|
171
|
-
bottomStatus,
|
|
172
|
-
onFetchMore,
|
|
173
|
-
onFetchMoreStart,
|
|
174
|
-
reverse,
|
|
175
|
-
topStatus,
|
|
176
|
-
status,
|
|
177
|
-
]);
|
|
128
|
+
}, [onFetchMore, status]);
|
|
178
129
|
const theme = (0, styled_components_1.useTheme)().colors;
|
|
179
130
|
return (React.createElement(layout_1.Stack, { ...(0, dpName_1.dpNameProp)("Infinite"), maxHeight: "100%", style: {
|
|
180
131
|
position: "relative",
|
|
@@ -182,12 +133,21 @@ function Infinite({ children, reverse = false, anchor = false, onFetchMore, onFe
|
|
|
182
133
|
height: "100%",
|
|
183
134
|
width,
|
|
184
135
|
}, justify: justify, align: "stretch", vertical: true },
|
|
185
|
-
React.createElement(Scrollbar_1.Scrollbar, { autoHide: true, style: { maxHeight: maxHeight }, scrollableNodeProps: { ref: ref, onScroll:
|
|
186
|
-
|
|
187
|
-
|
|
136
|
+
React.createElement(Scrollbar_1.Scrollbar, { autoHide: true, style: { maxHeight: maxHeight }, scrollableNodeProps: { ref: ref, onScroll: onScroll } },
|
|
137
|
+
reverse &&
|
|
138
|
+
status &&
|
|
139
|
+
(0, ts_pattern_1.match)(status)
|
|
140
|
+
.with("loading", "hasNextPage", () => (React.createElement(layout_1.Stack, { justify: "center", align: "center", padding: 5, style: { minHeight: 60 } },
|
|
141
|
+
React.createElement(Spinner_1.Spinner, null))))
|
|
142
|
+
.with("end", () => null)
|
|
143
|
+
.with("end-with-force", () => (React.createElement(layout_1.Stack, { justify: "center", align: "center", padding: 5 },
|
|
144
|
+
React.createElement(Button_1.Button, { intent: "tertiary", onClick: onFetchMore, text: fetchMoreText }))))
|
|
145
|
+
.exhaustive(),
|
|
146
|
+
reverse && React.createElement(ObservedDiv_1.ObservedDiv, { onIntersect: handleIntersect }),
|
|
188
147
|
children,
|
|
189
|
-
React.createElement(
|
|
190
|
-
|
|
148
|
+
!reverse && React.createElement(ObservedDiv_1.ObservedDiv, { onIntersect: handleIntersect }),
|
|
149
|
+
!reverse && (status === "loading" || status === "hasNextPage") && (React.createElement(layout_1.Stack, { justify: "center", align: "center", padding: 5, style: { minHeight: 60 } },
|
|
150
|
+
React.createElement(Spinner_1.Spinner, null)))),
|
|
191
151
|
anchor && !isAttached && (React.createElement(Button_1.OverlayButton, { placement: reverse ? "middle-bottom" : "middle-top", text: autoscrollText, onClick: reAttach, icon: { icon: free_solid_svg_icons_1.faAngleDoubleDown, size: 14 }, rightIcon: { icon: free_solid_svg_icons_1.faAngleDoubleDown, size: 14 }, style: { color: theme.brandShade100 } }))));
|
|
192
152
|
}
|
|
193
153
|
exports.Infinite = Infinite;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Infinite.js","sourceRoot":"","sources":["../../../../src/components/Infinite/Infinite.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,
|
|
1
|
+
{"version":3,"file":"Infinite.js","sourceRoot":"","sources":["../../../../src/components/Infinite/Infinite.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,iCAQe;AACf,+CAAoD;AACpD,yCAAiD;AAEjD,+CAA4C;AAC5C,wCAAqC;AACrC,sCAAkD;AAClD,2CAAmC;AACnC,4CAAyC;AAEzC,4EAAsE;AACtE,yDAA6C;AAC7C,+CAAgD;AAyBhD,sEAAsE;AACtE,SAAS,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AE,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,YAAY,EACnD,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,EAAE,IAAI,EAAE,wCAAiB,EAAE,IAAI,EAAE,EAAE,EAAE,EAC3C,SAAS,EAAE,EAAE,IAAI,EAAE,wCAAiB,EAAE,IAAI,EAAE,EAAE,EAAE,EAChD,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,aAAa,EAAE,GACrC,CACH,CACK,CACT,CAAC;AACJ,CAAC;AAxFD,4BAwFC"}
|
|
@@ -9,7 +9,7 @@ const dpName_1 = require("../../utils/dpName");
|
|
|
9
9
|
* Component that positions absolutely to the top or bottom of the container
|
|
10
10
|
* and emits an event if it intersects with the view port using `IntersectionObserver`
|
|
11
11
|
*/
|
|
12
|
-
function ObservedDiv({ onIntersect }) {
|
|
12
|
+
function ObservedDiv({ onIntersect, reverse = false }) {
|
|
13
13
|
const ref = (0, react_1.useRef)(null);
|
|
14
14
|
const callback = (0, react_1.useRef)(onIntersect);
|
|
15
15
|
(0, react_1.useLayoutEffect)(() => {
|
|
@@ -26,7 +26,7 @@ function ObservedDiv({ onIntersect }) {
|
|
|
26
26
|
observer.observe(ref.current);
|
|
27
27
|
return () => observer.disconnect();
|
|
28
28
|
}, []);
|
|
29
|
-
return React.createElement(S.Observed, { ...(0, dpName_1.dpNameProp)("ObservedDiv"), "data-testid": "observer", ref: ref });
|
|
29
|
+
return (React.createElement(S.Observed, { ...(0, dpName_1.dpNameProp)("ObservedDiv"), "data-testid": "observer", position: reverse ? "top" : "bottom", ref: ref }));
|
|
30
30
|
}
|
|
31
31
|
exports.ObservedDiv = ObservedDiv;
|
|
32
32
|
//# sourceMappingURL=ObservedDiv.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObservedDiv.js","sourceRoot":"","sources":["../../../../src/components/Infinite/ObservedDiv.tsx"],"names":[],"mappings":";;;AA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CAAC;AACJ,CAAC;AA9BD,kCA8BC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/components/Infinite/styles.tsx"],"names":[],"mappings":";;;AAAA,yDAAuC;AAE1B,QAAA,QAAQ,GAAG,2BAAM,CAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../src/components/Infinite/styles.tsx"],"names":[],"mappings":";;;AAAA,yDAAuC;AAE1B,QAAA,QAAQ,GAAG,2BAAM,CAAC,GAAG,CAAgC;;;CAGjE,CAAC"}
|
|
@@ -10,6 +10,7 @@ const Typography_1 = require("../Typography");
|
|
|
10
10
|
const Button_1 = require("../Button");
|
|
11
11
|
const dpName_1 = require("../../utils/dpName");
|
|
12
12
|
const ts_pattern_1 = require("ts-pattern");
|
|
13
|
+
const ResponsiveLayout_1 = require("../../layout/ResponsiveLayout");
|
|
13
14
|
const ModalPositonContainer = styled_components_1.default.div `
|
|
14
15
|
position: absolute;
|
|
15
16
|
${({ top }) => (top ? "top: " + top : "")};
|
|
@@ -49,10 +50,18 @@ const ModalContainer = styled_components_1.default.div `
|
|
|
49
50
|
overflow: hidden;
|
|
50
51
|
z-index: 20;
|
|
51
52
|
filter: drop-shadow(0px 8px 20px rgba(0, 0, 0, 0.15));
|
|
53
|
+
|
|
54
|
+
${(0, ResponsiveLayout_1.maxWidthMq)("sm")} {
|
|
55
|
+
width: calc(100vw - 63px);
|
|
56
|
+
}
|
|
52
57
|
`;
|
|
53
58
|
const ModalCloseContainer = styled_components_1.default.div `
|
|
54
59
|
padding: 0 38px;
|
|
55
60
|
position: relative;
|
|
61
|
+
|
|
62
|
+
${(0, ResponsiveLayout_1.maxWidthMq)("sm")} {
|
|
63
|
+
padding: 0 30px;
|
|
64
|
+
}
|
|
56
65
|
`;
|
|
57
66
|
const ModalClose = styled_components_1.default.div `
|
|
58
67
|
position: absolute;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":";;;AAAA,wCAAmD;AACnD,iDAAuC;AACvC,yDAAgD;AAChD,+BAA+B;AAE/B,yCAAqC;AACrC,8CAAyD;AACzD,sCAAuC;AAEvC,+CAAgD;AAEhD,2CAAmC;
|
|
1
|
+
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":";;;AAAA,wCAAmD;AACnD,iDAAuC;AACvC,yDAAgD;AAChD,+BAA+B;AAE/B,yCAAqC;AACrC,8CAAyD;AACzD,sCAAuC;AAEvC,+CAAgD;AAEhD,2CAAmC;AACnC,oEAA2D;AAQ3D,MAAM,qBAAqB,GAAG,2BAAM,CAAC,GAAG,CAA4B;;IAEhE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACvC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACnD,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3C,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;CAClD,CAAC;AAEF,MAAM,qBAAqB,GAAG,IAAA,2BAAM,EAAC,sBAAM,CAAC,GAAG,CAAC,CAAA;;;;;;;;CAQ/C,CAAC;AAcF,MAAM,cAAc,GAAG,2BAAM,CAAC,GAAG,CAAqB;sBAChC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,C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,EAAE,IAAA,kBAAK,EAAiC,IAAI,CAAC;aAC9C,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC;aAC3B,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC;aACrC,SAAS,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,EAC1B,EAAE,EAAC,IAAI,IAEN,KAAK,CACA,CACT,CACoB,CACxB,CAAC;AACJ,CAAC;AAxBD,kCAwBC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./responsiveLayout"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/layout/ResponsiveLayout/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useMediaQuery = exports.maxWidthMq = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const types_1 = require("./types");
|
|
6
|
+
const widthMediaQuery = (size, type) => `(${type}-width: ${types_1.sizes[size]}px)`;
|
|
7
|
+
const maxWidthMq = (size) => `@media only screen and ${widthMediaQuery(size, "max")}`;
|
|
8
|
+
exports.maxWidthMq = maxWidthMq;
|
|
9
|
+
const useMediaQuery = (size) => {
|
|
10
|
+
const maxMediaQueryList = (0, react_1.useMemo)(() => window.matchMedia(widthMediaQuery(size, "max")), [size]);
|
|
11
|
+
const [isMaxWidth, setIsMaxWidth] = (0, react_1.useState)(maxMediaQueryList.matches);
|
|
12
|
+
(0, react_1.useEffect)(() => {
|
|
13
|
+
const maxWidthListener = () => setIsMaxWidth(maxMediaQueryList.matches);
|
|
14
|
+
try {
|
|
15
|
+
maxMediaQueryList.addEventListener("change", maxWidthListener);
|
|
16
|
+
return () => {
|
|
17
|
+
maxMediaQueryList.removeEventListener("change", maxWidthListener);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
catch (_a) {
|
|
21
|
+
// iphone 6s Safari doesn't support addEventListener
|
|
22
|
+
maxMediaQueryList.addListener(maxWidthListener);
|
|
23
|
+
return () => {
|
|
24
|
+
maxMediaQueryList.removeListener(maxWidthListener);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}, [maxMediaQueryList]);
|
|
28
|
+
return {
|
|
29
|
+
isMaxWidth,
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
exports.useMediaQuery = useMediaQuery;
|
|
33
|
+
//# sourceMappingURL=responsiveLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responsiveLayout.js","sourceRoot":"","sources":["../../../../src/layout/ResponsiveLayout/responsiveLayout.ts"],"names":[],"mappings":";;;AAAA,iCAAqD;AAErD,mCAAgC;AAEhC,MAAM,eAAe,GAAG,CAAC,IAAU,E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"","sources":["../../../../src/layout/ResponsiveLayout/types.ts"],"names":[],"mappings":";;;AAEa,QAAA,KAAK,GAAU;IAC1B,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;CACT,CAAC"}
|
package/dist/deskpro-ui.d.ts
CHANGED
|
@@ -3471,7 +3471,7 @@ export declare interface ImageAvatarProps {
|
|
|
3471
3471
|
* the container has scrolled to the top or bottom.
|
|
3472
3472
|
* @public
|
|
3473
3473
|
*/
|
|
3474
|
-
export declare function Infinite({ children, reverse, anchor, onFetchMore,
|
|
3474
|
+
export declare function Infinite({ children, reverse, anchor, onFetchMore, status, maxHeight, scrollSideEffect, width, fetchMoreText, autoscrollText, scrollRef, justify, }: InfiniteProps): JSX.Element;
|
|
3475
3475
|
|
|
3476
3476
|
/**
|
|
3477
3477
|
* @public
|
|
@@ -3483,12 +3483,10 @@ export declare interface InfiniteProps {
|
|
|
3483
3483
|
/** Whether to render the Scroll To Start button */
|
|
3484
3484
|
anchor?: boolean;
|
|
3485
3485
|
onFetchMore?: () => void;
|
|
3486
|
-
onFetchMoreStart?: () => void;
|
|
3487
3486
|
status?: "loading" | "hasNextPage" | "end" | "end-with-force";
|
|
3488
|
-
startStatus?: "loading" | "hasNextPage" | "end" | "end-with-force";
|
|
3489
3487
|
maxHeight?: Property.MaxHeight;
|
|
3490
3488
|
/** Used in <Dropdown /> to hide suboptions on scroll */
|
|
3491
|
-
scrollSideEffect?: (
|
|
3489
|
+
scrollSideEffect?: () => void;
|
|
3492
3490
|
width?: string;
|
|
3493
3491
|
/** Align the list, you probably want flex-end if the list is reversed so it aligns to the bottom of the viewport */
|
|
3494
3492
|
justify?: StackProps["justify"];
|
|
@@ -3900,9 +3898,9 @@ export declare interface ModalHeaderProps {
|
|
|
3900
3898
|
* @public
|
|
3901
3899
|
*/
|
|
3902
3900
|
export declare interface ModalProps extends Omit<OverlayProps, "scrollable"> {
|
|
3903
|
-
/** @deprecated */
|
|
3901
|
+
/** @deprecated Use the size prop to choose a size for the modal */
|
|
3904
3902
|
width?: string;
|
|
3905
|
-
/** @deprecated */
|
|
3903
|
+
/** @deprecated Use the size prop to choose a size for the modal */
|
|
3906
3904
|
height?: string;
|
|
3907
3905
|
hideClose?: boolean;
|
|
3908
3906
|
top?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,OAAO,EAAgB,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAahD,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAsB;iBACtD,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;;;;;;;CAOnE,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAkD;;MAEnF,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CACb,KAAK,CAAC,IAAI,CAAC;KACR,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC;KAC3B,IAAI,CAAC,QAAQ,E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,CAAqB,CAClD,CACL,CACiB,CACzB,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
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";
|
|
@@ -9,10 +10,10 @@ import { Scrollbar } from "../Scrollbar";
|
|
|
9
10
|
import { faAngleDoubleDown } 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
|
-
|
|
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)))),
|
|
188
148
|
anchor && !isAttached && (React.createElement(OverlayButton, { placement: reverse ? "middle-bottom" : "middle-top", text: autoscrollText, onClick: reAttach, icon: { icon: faAngleDoubleDown, size: 14 }, rightIcon: { icon: faAngleDoubleDown, 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,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OA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C,CAC5B,oBAAC,KAAK,IAAC,OAAO,EAAC,QAAQ,EAAC,KAAK,EAAC,QAAQ,EAAC,OAAO,EAAE,CAAC;oBAC/C,oBAAC,MAAM,IAAC,MAAM,EAAC,UAAU,EAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,aAAa,GAAI,CACjE,CACT,CAAC;qBACD,UAAU,EAAE;YAChB,OAAO,IAAI,oBAAC,WAAW,IAAC,WAAW,EAAE,eAAe,GAAI;YACxD,QAAQ;YACR,CAAC,OAAO,IAAI,oBAAC,WAAW,IAAC,WAAW,EAAE,eAAe,GAAI;YACzD,CAAC,OAAO,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,aAAa,CAAC,IAAI,CACjE,oBAAC,KAAK,IAAC,OAAO,EAAC,QAAQ,EAAC,KAAK,EAAC,QAAQ,EAAC,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;gBACzE,oBAAC,OAAO,OAAG,CACL,CACT,CACS;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,QAAQ,EACjB,IAAI,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,EAAE,EAAE,EAC3C,SAAS,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,EAAE,EAAE,EAChD,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,aAAa,EAAE,GACrC,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, 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,oBAAoB,CAAC;AAShD;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,EAAE,WAAW,EAAE,OAAO,GAAG,KAAK,EAAiB;IACzE,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,CACL,oBAAC,CAAC,CAAC,QAAQ,OACL,UAAU,CAAC,aAAa,CAAC,iBACjB,UAAU,EACtB,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,EACpC,GAAG,EAAE,GAAG,GACR,CACH,CAAC;AACJ,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,CAAgC;;;CAGjE,CAAC"}
|
|
@@ -7,6 +7,7 @@ import { TSpan, v2Styles } from "../Typography";
|
|
|
7
7
|
import { IconButton } from "../Button";
|
|
8
8
|
import { dpNameProp } from "../../utils/dpName";
|
|
9
9
|
import { match } from "ts-pattern";
|
|
10
|
+
import { maxWidthMq } from "../../layout/ResponsiveLayout";
|
|
10
11
|
const ModalPositonContainer = styled.div `
|
|
11
12
|
position: absolute;
|
|
12
13
|
${({ top }) => (top ? "top: " + top : "")};
|
|
@@ -46,10 +47,18 @@ const ModalContainer = styled.div `
|
|
|
46
47
|
overflow: hidden;
|
|
47
48
|
z-index: 20;
|
|
48
49
|
filter: drop-shadow(0px 8px 20px rgba(0, 0, 0, 0.15));
|
|
50
|
+
|
|
51
|
+
${maxWidthMq("sm")} {
|
|
52
|
+
width: calc(100vw - 63px);
|
|
53
|
+
}
|
|
49
54
|
`;
|
|
50
55
|
const ModalCloseContainer = styled.div `
|
|
51
56
|
padding: 0 38px;
|
|
52
57
|
position: relative;
|
|
58
|
+
|
|
59
|
+
${maxWidthMq("sm")} {
|
|
60
|
+
padding: 0 30px;
|
|
61
|
+
}
|
|
53
62
|
`;
|
|
54
63
|
const ModalClose = styled.div `
|
|
55
64
|
position: absolute;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAgB,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,KAAK,EAAW,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,U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X,OAAO,EAAC,OAAO,EACf,KAAK,EAAC,QAAQ,EACd,eAAe,EAAE,eAAe,EAChC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,CAAC,EACT,IAAI,EAAE,IAAI,IAET,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,CACX,oBAAC,KAAK,IACJ,IAAI,EAAE,KAAK,CAAiC,IAAI,CAAC;aAC9C,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC;aAC3B,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC;aACrC,SAAS,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,EAC1B,EAAE,EAAC,IAAI,IAEN,KAAK,CACA,CACT,CACoB,CACxB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/layout/ResponsiveLayout/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { sizes } from "./types";
|
|
3
|
+
const widthMediaQuery = (size, type) => `(${type}-width: ${sizes[size]}px)`;
|
|
4
|
+
export const maxWidthMq = (size) => `@media only screen and ${widthMediaQuery(size, "max")}`;
|
|
5
|
+
export const useMediaQuery = (size) => {
|
|
6
|
+
const maxMediaQueryList = useMemo(() => window.matchMedia(widthMediaQuery(size, "max")), [size]);
|
|
7
|
+
const [isMaxWidth, setIsMaxWidth] = useState(maxMediaQueryList.matches);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const maxWidthListener = () => setIsMaxWidth(maxMediaQueryList.matches);
|
|
10
|
+
try {
|
|
11
|
+
maxMediaQueryList.addEventListener("change", maxWidthListener);
|
|
12
|
+
return () => {
|
|
13
|
+
maxMediaQueryList.removeEventListener("change", maxWidthListener);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
catch (_a) {
|
|
17
|
+
// iphone 6s Safari doesn't support addEventListener
|
|
18
|
+
maxMediaQueryList.addListener(maxWidthListener);
|
|
19
|
+
return () => {
|
|
20
|
+
maxMediaQueryList.removeListener(maxWidthListener);
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}, [maxMediaQueryList]);
|
|
24
|
+
return {
|
|
25
|
+
isMaxWidth,
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=responsiveLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responsiveLayout.js","sourceRoot":"","sources":["../../../../src/layout/ResponsiveLayout/responsiveLayout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,eAAe,GAAG,CAAC,IAAU,EAAE,IAAY,EAAE,EAAE,CAAC,IAAI,IAAI,WAAW,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;AAE1F,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAU,EAAE,EAAE,CAAC,0BAA0B,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;AAEnG,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAU,EAAE,EAAE;IAC1C,MAAM,iBAAiB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IACjG,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAExE,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,aAAa,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACxE,IAAI;YACF,iBAAiB,CAAC,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;YAE/D,OAAO,GAAG,EAAE;gBACV,iBAAiB,CAAC,mBAAmB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;YACpE,CAAC,CAAC;SACH;QAAC,WAAM;YACN,oDAAoD;YACpD,iBAAiB,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC;YAEhD,OAAO,GAAG,EAAE;gBACV,iBAAiB,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;YACrD,CAAC,CAAC;SACH;IACH,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAExB,OAAO;QACL,UAAU;KACX,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/layout/ResponsiveLayout/types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,KAAK,GAAU;IAC1B,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;CACT,CAAC"}
|
package/package.json
CHANGED
|
@@ -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,M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