@integreat-app/react-sticky-headroom 1.2.1 → 1.2.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/README.md +5 -2
- package/index.js +25 -71
- package/index.js.flow +29 -10
- package/package.json +48 -46
package/README.md
CHANGED
|
@@ -27,9 +27,9 @@ render () {
|
|
|
27
27
|
|
|
28
28
|
## Demo
|
|
29
29
|
|
|
30
|
-
Go to [https://
|
|
30
|
+
Go to [https://digitalfabrik.github.io/react-sticky-headroom/](https://digitalfabrik.github.io/react-sticky-headroom/) to view a demo:
|
|
31
31
|
|
|
32
|
-
[](https://digitalfabrik.github.io/react-sticky-headroom/)
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
## API
|
|
@@ -59,4 +59,7 @@ You can read about the browser support for that on [caniuse.com](https://caniuse
|
|
|
59
59
|
|
|
60
60
|
ReactStickyHeadroom offers types for both TypeScript and FlowJS which should work out of the box.
|
|
61
61
|
|
|
62
|
+
ReactStickyHeadroom is a client-side library and hence does not support Server Side Rendering (SSR) a priori.
|
|
63
|
+
For NextJS you can find more information on how to embed this library [here](https://nextjs.org/docs/advanced-features/dynamic-import#with-no-ssr).
|
|
64
|
+
|
|
62
65
|
If there are any problems, please don't hesitate to open an issue on GitHub.
|
package/index.js
CHANGED
|
@@ -1,42 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
4
|
-
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
13
|
-
|
|
14
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
-
|
|
16
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
|
-
|
|
18
12
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
19
|
-
|
|
20
13
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
21
|
-
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
25
|
-
|
|
26
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
27
|
-
|
|
14
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
15
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
16
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
28
17
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
29
|
-
|
|
30
18
|
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
31
|
-
|
|
32
19
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
33
|
-
|
|
34
20
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
35
|
-
|
|
36
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
37
|
-
|
|
21
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
38
22
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
39
|
-
|
|
40
23
|
var UPWARDS = 'up';
|
|
41
24
|
var DOWNWARDS = 'down';
|
|
42
25
|
var UNPINNED = 'unpinned';
|
|
@@ -45,7 +28,6 @@ var STATIC = 'static';
|
|
|
45
28
|
var NO_TRANSITION = 'none';
|
|
46
29
|
var NORMAL_TRANSITION = 'normal';
|
|
47
30
|
var PINNED_TO_STATIC = 'pinned-to-static';
|
|
48
|
-
|
|
49
31
|
var HeaderWrapper = _styledComponents.default.div.withConfig({
|
|
50
32
|
displayName: "Headroom__HeaderWrapper",
|
|
51
33
|
componentId: "sc-16d3zk-0"
|
|
@@ -64,74 +46,54 @@ var HeaderWrapper = _styledComponents.default.div.withConfig({
|
|
|
64
46
|
}, function (props) {
|
|
65
47
|
return props.static ? 'transition: none;' : '';
|
|
66
48
|
});
|
|
67
|
-
|
|
68
49
|
var keyframesMoveUpFrom = function keyframesMoveUpFrom(from) {
|
|
69
50
|
return (0, _styledComponents.keyframes)(["from{transform:translateY(", "px)}to{transform:translateY(0)}"], Math.max(from, 0));
|
|
70
51
|
};
|
|
71
|
-
|
|
72
52
|
var Headroom = /*#__PURE__*/function (_React$PureComponent) {
|
|
73
53
|
_inherits(Headroom, _React$PureComponent);
|
|
74
|
-
|
|
75
54
|
var _super = _createSuper(Headroom);
|
|
76
|
-
|
|
77
55
|
function Headroom() {
|
|
78
56
|
var _this;
|
|
79
|
-
|
|
80
57
|
_classCallCheck(this, Headroom);
|
|
81
|
-
|
|
82
58
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
83
59
|
args[_key] = arguments[_key];
|
|
84
60
|
}
|
|
85
|
-
|
|
86
61
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
87
|
-
|
|
88
62
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
89
63
|
mode: STATIC,
|
|
90
64
|
transition: NO_TRANSITION,
|
|
91
65
|
animateUpFrom: null
|
|
92
66
|
});
|
|
93
|
-
|
|
94
67
|
_defineProperty(_assertThisInitialized(_this), "lastKnownScrollTop", 0);
|
|
95
|
-
|
|
96
68
|
_defineProperty(_assertThisInitialized(_this), "update", function () {
|
|
97
69
|
var currentScrollTop = _this.getScrollTop();
|
|
98
|
-
|
|
99
70
|
var newState = {};
|
|
100
|
-
|
|
101
71
|
if (currentScrollTop === _this.lastKnownScrollTop) {
|
|
102
72
|
return;
|
|
103
73
|
}
|
|
104
|
-
|
|
105
74
|
var direction = _this.lastKnownScrollTop < currentScrollTop ? DOWNWARDS : UPWARDS;
|
|
106
75
|
newState.mode = _this.determineMode(currentScrollTop, direction);
|
|
107
76
|
newState.transition = _this.determineTransition(newState.mode, direction);
|
|
108
77
|
var _this$props = _this.props,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
78
|
+
onStickyTopChanged = _this$props.onStickyTopChanged,
|
|
79
|
+
height = _this$props.height,
|
|
80
|
+
scrollHeight = _this$props.scrollHeight,
|
|
81
|
+
pinStart = _this$props.pinStart;
|
|
114
82
|
if (_this.state.mode === PINNED && newState.mode === STATIC) {
|
|
115
83
|
// animation in the special case from pinned to static
|
|
116
84
|
newState.animateUpFrom = currentScrollTop - pinStart;
|
|
117
85
|
}
|
|
118
|
-
|
|
119
86
|
if (onStickyTopChanged && newState.mode !== _this.state.mode && height) {
|
|
120
87
|
onStickyTopChanged(Headroom.calcStickyTop(newState.mode, height, scrollHeight));
|
|
121
88
|
}
|
|
122
|
-
|
|
123
89
|
_this.setState(newState);
|
|
124
|
-
|
|
125
90
|
_this.lastKnownScrollTop = currentScrollTop;
|
|
126
91
|
});
|
|
127
|
-
|
|
128
92
|
_defineProperty(_assertThisInitialized(_this), "handleEvent", function () {
|
|
129
93
|
window.requestAnimationFrame(_this.update);
|
|
130
94
|
});
|
|
131
|
-
|
|
132
95
|
return _this;
|
|
133
96
|
}
|
|
134
|
-
|
|
135
97
|
_createClass(Headroom, [{
|
|
136
98
|
key: "getScrollTop",
|
|
137
99
|
value:
|
|
@@ -140,15 +102,12 @@ var Headroom = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
140
102
|
*/
|
|
141
103
|
function getScrollTop() {
|
|
142
104
|
var parent = this.props.parent;
|
|
143
|
-
|
|
144
105
|
if (parent && parent.scrollTop !== undefined && parent !== document.documentElement) {
|
|
145
106
|
return parent.scrollTop;
|
|
146
107
|
}
|
|
147
|
-
|
|
148
108
|
if (parent !== document.documentElement) {
|
|
149
109
|
console.warn('Could not find parent for StickyHeadroom. Defaulting to window, documentElement or body.');
|
|
150
110
|
}
|
|
151
|
-
|
|
152
111
|
if (window.pageYOffset !== undefined) {
|
|
153
112
|
return window.pageYOffset;
|
|
154
113
|
} else if (window.scrollTop !== undefined) {
|
|
@@ -199,6 +158,7 @@ var Headroom = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
199
158
|
value: function componentWillUnmount() {
|
|
200
159
|
this.removeScrollListener(this.props.parent);
|
|
201
160
|
}
|
|
161
|
+
|
|
202
162
|
/**
|
|
203
163
|
* If we're already static and pinStart + scrollHeight >= scrollTop, then we should stay static.
|
|
204
164
|
* If we're not already static, then we should set the header static, only when pinStart >= scrollTop (regardless of
|
|
@@ -208,7 +168,6 @@ var Headroom = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
208
168
|
* @param direction the current direction
|
|
209
169
|
* @returns {boolean} if we should set the header static
|
|
210
170
|
*/
|
|
211
|
-
|
|
212
171
|
}, {
|
|
213
172
|
key: "shouldSetStatic",
|
|
214
173
|
value: function shouldSetStatic(scrollTop, direction) {
|
|
@@ -218,13 +177,13 @@ var Headroom = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
218
177
|
return this.props.pinStart >= scrollTop;
|
|
219
178
|
}
|
|
220
179
|
}
|
|
180
|
+
|
|
221
181
|
/**
|
|
222
182
|
* Determines the mode depending on the scrollTop position and the current direction
|
|
223
183
|
* @param {number} scrollTop
|
|
224
184
|
* @param {string} direction
|
|
225
185
|
* @returns {string} the next mode of Headroom
|
|
226
186
|
*/
|
|
227
|
-
|
|
228
187
|
}, {
|
|
229
188
|
key: "determineMode",
|
|
230
189
|
value: function determineMode(scrollTop, direction) {
|
|
@@ -234,44 +193,42 @@ var Headroom = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
234
193
|
return direction === UPWARDS ? PINNED : UNPINNED;
|
|
235
194
|
}
|
|
236
195
|
}
|
|
196
|
+
|
|
237
197
|
/**
|
|
238
198
|
* @returns {TransitionType} determines the kind of transition
|
|
239
199
|
*/
|
|
240
|
-
|
|
241
200
|
}, {
|
|
242
201
|
key: "determineTransition",
|
|
243
202
|
value: function determineTransition(mode, direction) {
|
|
244
203
|
// Handle special case: If we're pinned and going to static, we need a special transition using css animation
|
|
245
204
|
if (this.state.mode === PINNED && mode === STATIC) {
|
|
246
205
|
return PINNED_TO_STATIC;
|
|
247
|
-
}
|
|
206
|
+
}
|
|
207
|
+
// If mode is static, then no transition, because we're already in the right spot
|
|
248
208
|
// (and want to change transform and top properties seamlessly)
|
|
249
|
-
|
|
250
|
-
|
|
251
209
|
if (mode === STATIC) {
|
|
252
210
|
return this.state.transition === NO_TRANSITION ? NO_TRANSITION : PINNED_TO_STATIC;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
|
|
211
|
+
}
|
|
212
|
+
// mode is not static, transition when moving upwards or when we've lastly did the transition
|
|
256
213
|
return direction === UPWARDS || this.state.transition === NORMAL_TRANSITION ? NORMAL_TRANSITION : NO_TRANSITION;
|
|
257
214
|
}
|
|
215
|
+
|
|
258
216
|
/**
|
|
259
217
|
* Checks the current scrollTop position and updates the state accordingly
|
|
260
218
|
*/
|
|
261
|
-
|
|
262
219
|
}, {
|
|
263
220
|
key: "render",
|
|
264
221
|
value: function render() {
|
|
265
222
|
var _this$props2 = this.props,
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
223
|
+
children = _this$props2.children,
|
|
224
|
+
scrollHeight = _this$props2.scrollHeight,
|
|
225
|
+
positionStickyDisabled = _this$props2.positionStickyDisabled,
|
|
226
|
+
zIndex = _this$props2.zIndex,
|
|
227
|
+
className = _this$props2.className;
|
|
271
228
|
var _this$state = this.state,
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
229
|
+
mode = _this$state.mode,
|
|
230
|
+
transition = _this$state.transition,
|
|
231
|
+
animateUpFrom = _this$state.animateUpFrom;
|
|
275
232
|
var transform = mode === UNPINNED ? -scrollHeight : 0;
|
|
276
233
|
var ownStickyTop = mode === STATIC ? -scrollHeight : 0;
|
|
277
234
|
return /*#__PURE__*/React.createElement(HeaderWrapper, {
|
|
@@ -291,15 +248,12 @@ var Headroom = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
291
248
|
return mode === PINNED ? height : height - scrollHeight;
|
|
292
249
|
}
|
|
293
250
|
}]);
|
|
294
|
-
|
|
295
251
|
return Headroom;
|
|
296
252
|
}(React.PureComponent);
|
|
297
|
-
|
|
298
253
|
_defineProperty(Headroom, "defaultProps", {
|
|
299
254
|
pinStart: 0,
|
|
300
255
|
zIndex: 1,
|
|
301
256
|
parent: window.document.documentElement
|
|
302
257
|
});
|
|
303
|
-
|
|
304
258
|
var _default = Headroom;
|
|
305
259
|
exports.default = _default;
|
package/index.js.flow
CHANGED
|
@@ -61,10 +61,13 @@ const HeaderWrapper: StyledComponent<{|
|
|
|
61
61
|
animation-duration: 0.2s;
|
|
62
62
|
animation-timing-function: ease-out;
|
|
63
63
|
${props => props.transition === NORMAL_TRANSITION && !props.static
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
? 'transition: transform 0.2s ease-out;'
|
|
65
|
+
: ''}
|
|
66
|
+
${props => props.transition === PINNED_TO_STATIC
|
|
67
|
+
? css`
|
|
66
68
|
animation-name: ${keyframesMoveUpFrom(props.animateUpFrom)};
|
|
67
|
-
`
|
|
69
|
+
`
|
|
70
|
+
: ''}
|
|
68
71
|
${props => props.static ? 'transition: none;' : ''}
|
|
69
72
|
`
|
|
70
73
|
|
|
@@ -85,7 +88,11 @@ class Headroom extends React.PureComponent<PropsType, StateType> {
|
|
|
85
88
|
parent: window.document.documentElement
|
|
86
89
|
}
|
|
87
90
|
|
|
88
|
-
state: StateType = {
|
|
91
|
+
state: StateType = {
|
|
92
|
+
mode: STATIC,
|
|
93
|
+
transition: NO_TRANSITION,
|
|
94
|
+
animateUpFrom: null
|
|
95
|
+
}
|
|
89
96
|
|
|
90
97
|
/** the very last scrollTop which we know about (to determine direction changes) */
|
|
91
98
|
lastKnownScrollTop: number = 0
|
|
@@ -158,7 +165,7 @@ class Headroom extends React.PureComponent<PropsType, StateType> {
|
|
|
158
165
|
*/
|
|
159
166
|
shouldSetStatic (scrollTop: number, direction: DirectionType): boolean {
|
|
160
167
|
if (this.state.mode === STATIC || (this.state.mode === PINNED && direction ===
|
|
161
|
-
|
|
168
|
+
DOWNWARDS)) {
|
|
162
169
|
return this.props.pinStart + this.props.scrollHeight >= scrollTop
|
|
163
170
|
} else {
|
|
164
171
|
return this.props.pinStart >= scrollTop
|
|
@@ -190,12 +197,14 @@ class Headroom extends React.PureComponent<PropsType, StateType> {
|
|
|
190
197
|
// If mode is static, then no transition, because we're already in the right spot
|
|
191
198
|
// (and want to change transform and top properties seamlessly)
|
|
192
199
|
if (mode === STATIC) {
|
|
193
|
-
return this.state.transition === NO_TRANSITION
|
|
200
|
+
return this.state.transition === NO_TRANSITION
|
|
201
|
+
? NO_TRANSITION
|
|
194
202
|
: PINNED_TO_STATIC
|
|
195
203
|
}
|
|
196
204
|
// mode is not static, transition when moving upwards or when we've lastly did the transition
|
|
197
205
|
return direction === UPWARDS || this.state.transition === NORMAL_TRANSITION
|
|
198
|
-
? NORMAL_TRANSITION
|
|
206
|
+
? NORMAL_TRANSITION
|
|
207
|
+
: NO_TRANSITION
|
|
199
208
|
}
|
|
200
209
|
|
|
201
210
|
/**
|
|
@@ -207,12 +216,18 @@ class Headroom extends React.PureComponent<PropsType, StateType> {
|
|
|
207
216
|
if (currentScrollTop === this.lastKnownScrollTop) {
|
|
208
217
|
return
|
|
209
218
|
}
|
|
210
|
-
const direction = this.lastKnownScrollTop < currentScrollTop
|
|
219
|
+
const direction = this.lastKnownScrollTop < currentScrollTop
|
|
220
|
+
? DOWNWARDS
|
|
211
221
|
: UPWARDS
|
|
212
222
|
newState.mode = this.determineMode(currentScrollTop, direction)
|
|
213
223
|
newState.transition = this.determineTransition(newState.mode, direction)
|
|
214
224
|
|
|
215
|
-
const {
|
|
225
|
+
const {
|
|
226
|
+
onStickyTopChanged,
|
|
227
|
+
height,
|
|
228
|
+
scrollHeight,
|
|
229
|
+
pinStart
|
|
230
|
+
} = this.props
|
|
216
231
|
if (this.state.mode === PINNED && newState.mode === STATIC) {
|
|
217
232
|
// animation in the special case from pinned to static
|
|
218
233
|
newState.animateUpFrom = currentScrollTop - pinStart
|
|
@@ -244,7 +259,11 @@ class Headroom extends React.PureComponent<PropsType, StateType> {
|
|
|
244
259
|
zIndex,
|
|
245
260
|
className
|
|
246
261
|
} = this.props
|
|
247
|
-
const {
|
|
262
|
+
const {
|
|
263
|
+
mode,
|
|
264
|
+
transition,
|
|
265
|
+
animateUpFrom
|
|
266
|
+
} = this.state
|
|
248
267
|
const transform = mode === UNPINNED ? -scrollHeight : 0
|
|
249
268
|
const ownStickyTop = mode === STATIC ? -scrollHeight : 0
|
|
250
269
|
return <HeaderWrapper
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@integreat-app/react-sticky-headroom",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=6.9",
|
|
6
6
|
"npm": ">=3.8"
|
|
@@ -42,69 +42,71 @@
|
|
|
42
42
|
"test:coverage": "jest --config jest.config.json --coverage",
|
|
43
43
|
"test:watch": "jest --config jest.config.json --watchAll",
|
|
44
44
|
"test:update": "jest --config jest.config.json -u",
|
|
45
|
-
"lint": "
|
|
46
|
-
"lint:fix": "
|
|
45
|
+
"lint": "npm run eslint && npm run stylelint",
|
|
46
|
+
"lint:fix": "npm run eslint --fix && npm run stylelint",
|
|
47
47
|
"eslint": "eslint .",
|
|
48
48
|
"stylelint": "stylelint './src/**/*.js'",
|
|
49
49
|
"flow:check-now": "flow check",
|
|
50
50
|
"flow:install-types": "flow-typed install --skip",
|
|
51
|
-
"prepublishOnly": "
|
|
51
|
+
"prepublishOnly": "npm run build && npm run build:demo && npm run test && npm run lint && npm run flow:check-now"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"react": "16.x.x || 17.x.x",
|
|
54
|
+
"react": "16.x.x || 17.x.x || 18.x.x",
|
|
55
55
|
"styled-components": "4.x.x || 5.x.x"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@babel/cli": "^7.
|
|
59
|
-
"@babel/core": "^7.
|
|
60
|
-
"@babel/
|
|
61
|
-
"@babel/plugin-proposal-
|
|
62
|
-
"@babel/plugin-proposal-
|
|
63
|
-
"@babel/plugin-proposal-export-
|
|
64
|
-
"@babel/plugin-proposal-
|
|
65
|
-
"@babel/plugin-proposal-
|
|
66
|
-
"@babel/plugin-proposal-
|
|
67
|
-
"@babel/plugin-proposal-
|
|
68
|
-
"@babel/plugin-proposal-
|
|
69
|
-
"@babel/plugin-proposal-
|
|
70
|
-
"@babel/plugin-proposal-
|
|
58
|
+
"@babel/cli": "^7.17.6",
|
|
59
|
+
"@babel/core": "^7.17.8",
|
|
60
|
+
"@babel/eslint-parser": "^7.17.0",
|
|
61
|
+
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
62
|
+
"@babel/plugin-proposal-do-expressions": "^7.16.7",
|
|
63
|
+
"@babel/plugin-proposal-export-default-from": "^7.16.7",
|
|
64
|
+
"@babel/plugin-proposal-export-namespace-from": "^7.16.7",
|
|
65
|
+
"@babel/plugin-proposal-json-strings": "^7.16.7",
|
|
66
|
+
"@babel/plugin-proposal-logical-assignment-operators": "^7.16.7",
|
|
67
|
+
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
|
|
68
|
+
"@babel/plugin-proposal-numeric-separator": "^7.16.7",
|
|
69
|
+
"@babel/plugin-proposal-optional-chaining": "^7.16.7",
|
|
70
|
+
"@babel/plugin-proposal-pipeline-operator": "^7.17.6",
|
|
71
|
+
"@babel/plugin-proposal-throw-expressions": "^7.16.7",
|
|
71
72
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
72
73
|
"@babel/plugin-syntax-import-meta": "^7.10.4",
|
|
73
|
-
"@babel/plugin-transform-react-jsx": "^7.
|
|
74
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
75
|
-
"@babel/preset-env": "^7.
|
|
76
|
-
"@babel/preset-flow": "^7.
|
|
77
|
-
"@babel/preset-react": "^7.
|
|
78
|
-
"@babel/runtime": "^7.
|
|
79
|
-
"@
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"babel-eslint": "^10.1.0",
|
|
85
|
-
"babel-jest": "^27.2.2",
|
|
86
|
-
"babel-loader": "^8.2.2",
|
|
87
|
-
"babel-plugin-styled-components": "^1.13.2",
|
|
74
|
+
"@babel/plugin-transform-react-jsx": "^7.17.3",
|
|
75
|
+
"@babel/plugin-transform-runtime": "^7.17.0",
|
|
76
|
+
"@babel/preset-env": "^7.16.11",
|
|
77
|
+
"@babel/preset-flow": "^7.16.7",
|
|
78
|
+
"@babel/preset-react": "^7.16.7",
|
|
79
|
+
"@babel/runtime": "^7.17.8",
|
|
80
|
+
"@stylelint/postcss-css-in-js": "^0.38.0",
|
|
81
|
+
"babel-jest": "^27.5.1",
|
|
82
|
+
"babel-loader": "^8.2.4",
|
|
83
|
+
"babel-plugin-styled-components": "^2.0.6",
|
|
84
|
+
"browserslist": "^4.20.2",
|
|
88
85
|
"enzyme": "^3.11.0",
|
|
89
86
|
"enzyme-adapter-react-16": "^1.15.6",
|
|
90
87
|
"enzyme-to-json": "^3.6.2",
|
|
91
|
-
"eslint": "^
|
|
92
|
-
"
|
|
88
|
+
"eslint": "^8.25.0",
|
|
89
|
+
"eslint-config-standard": "^17.0.0",
|
|
90
|
+
"eslint-plugin-flowtype": "^8.0.3",
|
|
91
|
+
"eslint-plugin-import": "^2.25.4",
|
|
92
|
+
"eslint-plugin-jest": "^26.1.3",
|
|
93
|
+
"eslint-plugin-node": "^11.1.0",
|
|
94
|
+
"eslint-plugin-promise": "^6.0.0",
|
|
95
|
+
"eslint-plugin-react": "^7.29.4",
|
|
96
|
+
"flow-bin": "~0.174.1",
|
|
93
97
|
"flow-copy-source": "^2.0.9",
|
|
94
|
-
"flow-typed": "^3.
|
|
95
|
-
"jest": "^27.
|
|
96
|
-
"jest-junit": "^
|
|
97
|
-
"jest-styled-components": "^7.0.
|
|
98
|
+
"flow-typed": "^3.8.0",
|
|
99
|
+
"jest": "^27.5.1",
|
|
100
|
+
"jest-junit": "^13.0.0",
|
|
101
|
+
"jest-styled-components": "^7.0.8",
|
|
98
102
|
"raf": "^3.4.1",
|
|
99
103
|
"react": "^16.14.0",
|
|
100
104
|
"react-dom": "^16.14.0",
|
|
101
105
|
"rimraf": "^3.0.2",
|
|
102
|
-
"styled-components": "^5.3.
|
|
103
|
-
"stylelint": "^
|
|
104
|
-
"stylelint-config-recommended": "^
|
|
106
|
+
"styled-components": "^5.3.3",
|
|
107
|
+
"stylelint": "^14.13.0",
|
|
108
|
+
"stylelint-config-recommended": "^7.0.0",
|
|
105
109
|
"stylelint-config-styled-components": "^0.1.1",
|
|
106
|
-
"
|
|
107
|
-
|
|
108
|
-
},
|
|
109
|
-
"dependencies": {}
|
|
110
|
+
"webpack": "^5.70.0"
|
|
111
|
+
}
|
|
110
112
|
}
|