@micromag/element-scroll 0.3.426 → 0.3.429
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/assets/css/styles.css +1 -1
- package/es/index.js +1 -2
- package/lib/index.js +25 -34
- package/package.json +9 -3
package/assets/css/styles.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.micromag-element-scroll-container.micromag-element-scroll-withScroll .micromag-element-scroll-scrollable{scrollbar-width:none}.micromag-element-scroll-container.micromag-element-scroll-withScroll .micromag-element-scroll-scrollable::-webkit-scrollbar{display:none}.micromag-element-scroll-container{height:100%;margin:0 auto;min-height:inherit;position:relative}.micromag-element-scroll-container.micromag-element-scroll-withScroll .micromag-element-scroll-scrollable{-ms-scroll-chaining:none;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain}.micromag-element-scroll-container.micromag-element-scroll-withScroll.micromag-element-scroll-containOverscroll .micromag-element-scroll-scrollable{-ms-scroll-chaining:none;overscroll-behavior:contain}.micromag-element-scroll-container.micromag-element-scroll-top .micromag-element-scroll-scrollee{margin-bottom:auto}.micromag-element-scroll-container.micromag-element-scroll-middle .micromag-element-scroll-scrollee{margin:auto 0}.micromag-element-scroll-container.micromag-element-scroll-bottom .micromag-element-scroll-scrollee{margin-top:auto}.micromag-element-scroll-container.micromag-element-scroll-withArrow .micromag-element-scroll-arrowContainer{opacity:1}.micromag-element-scroll-scrollable{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;height:100%;min-height:inherit;width:100%}.micromag-element-scroll-arrowContainer{bottom:0;height:5rem;left:0;opacity:0;pointer-events:none;position:absolute;text-align:center;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-transition:opacity .3s ease
|
|
1
|
+
.micromag-element-scroll-container.micromag-element-scroll-withScroll .micromag-element-scroll-scrollable{scrollbar-width:none}.micromag-element-scroll-container.micromag-element-scroll-withScroll .micromag-element-scroll-scrollable::-webkit-scrollbar{display:none}.micromag-element-scroll-container{height:100%;margin:0 auto;min-height:inherit;position:relative}.micromag-element-scroll-container.micromag-element-scroll-withScroll .micromag-element-scroll-scrollable{-ms-scroll-chaining:none;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain}.micromag-element-scroll-container.micromag-element-scroll-withScroll.micromag-element-scroll-containOverscroll .micromag-element-scroll-scrollable{-ms-scroll-chaining:none;overscroll-behavior:contain}.micromag-element-scroll-container.micromag-element-scroll-top .micromag-element-scroll-scrollee{margin-bottom:auto}.micromag-element-scroll-container.micromag-element-scroll-middle .micromag-element-scroll-scrollee{margin:auto 0}.micromag-element-scroll-container.micromag-element-scroll-bottom .micromag-element-scroll-scrollee{margin-top:auto}.micromag-element-scroll-container.micromag-element-scroll-withArrow .micromag-element-scroll-arrowContainer{opacity:1}.micromag-element-scroll-scrollable{-webkit-box-orient:vertical;-webkit-box-direction:normal;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;height:100%;min-height:inherit;width:100%}.micromag-element-scroll-arrowContainer{bottom:0;height:5rem;left:0;opacity:0;pointer-events:none;position:absolute;text-align:center;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-transition:opacity .3s ease;transition:opacity .3s ease;width:100%;z-index:3}.micromag-element-scroll-withShadow .micromag-element-scroll-arrowContainer:after{background-image:-webkit-gradient(linear,left top,left bottom,from(rgba(28,28,28,0)),to(rgba(28,28,28,.85)));background-image:linear-gradient(180deg,rgba(28,28,28,0),rgba(28,28,28,.85));content:"";height:100%;left:0;position:absolute;top:0;width:100%;z-index:2}.micromag-element-scroll-arrow{-webkit-animation:micromag-element-scroll-upAndDown .75s cubic-bezier(.4,0,.6,1) infinite alternate;animation:micromag-element-scroll-upAndDown .75s cubic-bezier(.4,0,.6,1) infinite alternate;color:#fff;display:inline-block;height:auto;position:relative;top:1rem;width:1rem;z-index:3}.micromag-element-scroll-arrow path{stroke-width:20;stroke:#1c1c1c}@-webkit-keyframes micromag-element-scroll-upAndDown{0%{-webkit-transform:translateY(-30%);transform:translateY(-30%)}to{-webkit-transform:translateY(30%);transform:translateY(30%)}}@keyframes micromag-element-scroll-upAndDown{0%{-webkit-transform:translateY(-30%);transform:translateY(-30%)}to{-webkit-transform:translateY(30%);transform:translateY(30%)}}
|
package/es/index.js
CHANGED
|
@@ -42,7 +42,6 @@ var defaultProps = {
|
|
|
42
42
|
withArrow: true
|
|
43
43
|
};
|
|
44
44
|
function Scroll(_ref) {
|
|
45
|
-
var _ref3;
|
|
46
45
|
var width = _ref.width,
|
|
47
46
|
height = _ref.height,
|
|
48
47
|
disabled = _ref.disabled,
|
|
@@ -145,7 +144,7 @@ function Scroll(_ref) {
|
|
|
145
144
|
}
|
|
146
145
|
}, [scrolleeRef, scrollPosition]);
|
|
147
146
|
return /*#__PURE__*/React.createElement("div", {
|
|
148
|
-
className: classNames([styles.container, (
|
|
147
|
+
className: classNames([styles.container, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles.withScroll, !disabled), styles.containOverscroll, contain), className, className !== null), styles[verticalAlign], verticalAlign !== null), styles.withArrow, showArrow && withArrow), styles.withShadow, withShadow)]),
|
|
149
148
|
style: finalStyle
|
|
150
149
|
}, /*#__PURE__*/React.createElement("div", Object.assign({
|
|
151
150
|
className: styles.scrollable,
|
package/lib/index.js
CHANGED
|
@@ -8,32 +8,24 @@ var PropTypes = require('prop-types');
|
|
|
8
8
|
var React = require('react');
|
|
9
9
|
var hooks = require('@micromag/core/hooks');
|
|
10
10
|
|
|
11
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
|
-
|
|
13
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
14
|
-
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
15
|
-
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
16
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
17
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
18
|
-
|
|
19
11
|
var styles = {"container":"micromag-element-scroll-container","withScroll":"micromag-element-scroll-withScroll","scrollable":"micromag-element-scroll-scrollable","containOverscroll":"micromag-element-scroll-containOverscroll","top":"micromag-element-scroll-top","scrollee":"micromag-element-scroll-scrollee","middle":"micromag-element-scroll-middle","bottom":"micromag-element-scroll-bottom","withArrow":"micromag-element-scroll-withArrow","arrowContainer":"micromag-element-scroll-arrowContainer","withShadow":"micromag-element-scroll-withShadow","arrow":"micromag-element-scroll-arrow","upAndDown":"micromag-element-scroll-upAndDown"};
|
|
20
12
|
|
|
21
13
|
var propTypes = {
|
|
22
|
-
width:
|
|
23
|
-
height:
|
|
24
|
-
disabled:
|
|
25
|
-
verticalAlign:
|
|
26
|
-
className:
|
|
27
|
-
children:
|
|
28
|
-
scrollPosition:
|
|
29
|
-
onScrolledBottom:
|
|
30
|
-
onScrolledNotBottom:
|
|
31
|
-
onScrollHeightChange:
|
|
32
|
-
contain:
|
|
33
|
-
scrollContainerRef:
|
|
14
|
+
width: PropTypes.number,
|
|
15
|
+
height: PropTypes.number,
|
|
16
|
+
disabled: PropTypes.bool,
|
|
17
|
+
verticalAlign: PropTypes.oneOf(['top', 'middle', 'bottom']),
|
|
18
|
+
className: PropTypes.string,
|
|
19
|
+
children: PropTypes.node,
|
|
20
|
+
scrollPosition: PropTypes.oneOf([PropTypes.number, PropTypes.string]),
|
|
21
|
+
onScrolledBottom: PropTypes.func,
|
|
22
|
+
onScrolledNotBottom: PropTypes.func,
|
|
23
|
+
onScrollHeightChange: PropTypes.func,
|
|
24
|
+
contain: PropTypes.bool,
|
|
25
|
+
scrollContainerRef: PropTypes.any,
|
|
34
26
|
// eslint-disable-line
|
|
35
|
-
withShadow:
|
|
36
|
-
withArrow:
|
|
27
|
+
withShadow: PropTypes.bool,
|
|
28
|
+
withArrow: PropTypes.bool
|
|
37
29
|
};
|
|
38
30
|
var defaultProps = {
|
|
39
31
|
width: null,
|
|
@@ -52,7 +44,6 @@ var defaultProps = {
|
|
|
52
44
|
withArrow: true
|
|
53
45
|
};
|
|
54
46
|
function Scroll(_ref) {
|
|
55
|
-
var _ref3;
|
|
56
47
|
var width = _ref.width,
|
|
57
48
|
height = _ref.height,
|
|
58
49
|
disabled = _ref.disabled,
|
|
@@ -72,7 +63,7 @@ function Scroll(_ref) {
|
|
|
72
63
|
height: height
|
|
73
64
|
};
|
|
74
65
|
var _useState = React.useState(false),
|
|
75
|
-
_useState2 =
|
|
66
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
76
67
|
withArrow = _useState2[0],
|
|
77
68
|
setWithArrow = _useState2[1];
|
|
78
69
|
var _useDimensionObserver = hooks.useDimensionObserver(),
|
|
@@ -89,7 +80,7 @@ function Scroll(_ref) {
|
|
|
89
80
|
var scrolledNotBottomOnce = React.useRef(false);
|
|
90
81
|
var reachedBottom = React.useRef(false);
|
|
91
82
|
var bind = react.useScroll(function (_ref2) {
|
|
92
|
-
var _ref2$xy =
|
|
83
|
+
var _ref2$xy = _slicedToArray(_ref2.xy, 2),
|
|
93
84
|
scrollY = _ref2$xy[1];
|
|
94
85
|
var newWithArrow = scrollY <= 1;
|
|
95
86
|
var maxScrollAmount = scrolleeHeight - scrollableHeight;
|
|
@@ -154,25 +145,25 @@ function Scroll(_ref) {
|
|
|
154
145
|
scrollableRef.current.scrollTop = scrollPosition;
|
|
155
146
|
}
|
|
156
147
|
}, [scrolleeRef, scrollPosition]);
|
|
157
|
-
return /*#__PURE__*/
|
|
158
|
-
className:
|
|
148
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
149
|
+
className: classNames([styles.container, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles.withScroll, !disabled), styles.containOverscroll, contain), className, className !== null), styles[verticalAlign], verticalAlign !== null), styles.withArrow, showArrow && withArrow), styles.withShadow, withShadow)]),
|
|
159
150
|
style: finalStyle
|
|
160
|
-
}, /*#__PURE__*/
|
|
151
|
+
}, /*#__PURE__*/React.createElement("div", Object.assign({
|
|
161
152
|
className: styles.scrollable,
|
|
162
153
|
ref: scrollableRef
|
|
163
|
-
}, bind()), /*#__PURE__*/
|
|
154
|
+
}, bind()), /*#__PURE__*/React.createElement("div", {
|
|
164
155
|
className: styles.scrollee,
|
|
165
156
|
ref: scrolleeRef
|
|
166
|
-
}, children)), !disabled && showArrow ? /*#__PURE__*/
|
|
157
|
+
}, children)), !disabled && showArrow ? /*#__PURE__*/React.createElement("div", {
|
|
167
158
|
className: styles.arrowContainer
|
|
168
|
-
}, /*#__PURE__*/
|
|
159
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
169
160
|
xmlns: "http://www.w3.org/2000/svg",
|
|
170
161
|
width: "10",
|
|
171
162
|
height: "16",
|
|
172
163
|
viewBox: "0 0 10 16",
|
|
173
164
|
className: styles.arrow,
|
|
174
165
|
fill: "currentColor"
|
|
175
|
-
}, /*#__PURE__*/
|
|
166
|
+
}, /*#__PURE__*/React.createElement("polygon", {
|
|
176
167
|
// stroke="#000"
|
|
177
168
|
// strokeWidth="0.5"
|
|
178
169
|
points: ".38 11.38 5 16 9.62 11.38 8.56 10.32 5.75 13.13 5.75 1.61 4.25 1.61 4.25 13.13 1.44 10.32 .38 11.38"
|
|
@@ -180,8 +171,8 @@ function Scroll(_ref) {
|
|
|
180
171
|
}
|
|
181
172
|
Scroll.defaultProps = defaultProps;
|
|
182
173
|
Scroll.propTypes = propTypes;
|
|
183
|
-
var Scroll$1 = /*#__PURE__*/
|
|
184
|
-
return /*#__PURE__*/
|
|
174
|
+
var Scroll$1 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
175
|
+
return /*#__PURE__*/React.createElement(Scroll, Object.assign({
|
|
185
176
|
scrollContainerRef: ref
|
|
186
177
|
}, props));
|
|
187
178
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/element-scroll",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.429",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -32,6 +32,12 @@
|
|
|
32
32
|
"license": "ISC",
|
|
33
33
|
"main": "lib/index.js",
|
|
34
34
|
"module": "es/index.js",
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"require": "./lib/index.js",
|
|
38
|
+
"import": "./es/index.js"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
35
41
|
"files": [
|
|
36
42
|
"lib",
|
|
37
43
|
"es",
|
|
@@ -53,7 +59,7 @@
|
|
|
53
59
|
"@fortawesome/fontawesome-svg-core": "^1.2.32",
|
|
54
60
|
"@fortawesome/free-solid-svg-icons": "^5.15.1",
|
|
55
61
|
"@fortawesome/react-fontawesome": "^0.1.13",
|
|
56
|
-
"@micromag/core": "^0.3.
|
|
62
|
+
"@micromag/core": "^0.3.429",
|
|
57
63
|
"@use-gesture/react": "^10.2.4",
|
|
58
64
|
"classnames": "^2.2.6",
|
|
59
65
|
"lodash": "^4.17.21",
|
|
@@ -65,5 +71,5 @@
|
|
|
65
71
|
"access": "public",
|
|
66
72
|
"registry": "https://registry.npmjs.org/"
|
|
67
73
|
},
|
|
68
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "f15e72b88ecfda4c54b87626513149b58572c52b"
|
|
69
75
|
}
|