@modul/mbui 0.0.25-beta-pv-53369-bac51231 → 0.0.25-beta-pv-53369-6203ae19
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/Icon/icons/Erase.js +1 -1
- package/dist/Icon/icons/Erase.js.map +1 -1
- package/dist/Swipe2Show/Swipe2Show.d.ts +1 -1
- package/dist/Swipe2Show/Swipe2Show.js +13 -13
- package/dist/Swipe2Show/Swipe2Show.js.map +1 -1
- package/package.json +1 -1
- package/src/Icon/icons/Erase.tsx +1 -1
- package/src/Swipe2Show/Swipe2Show.tsx +52 -49
package/dist/Icon/icons/Erase.js
CHANGED
|
@@ -4,7 +4,7 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const React = (0, tslib_1.__importStar)(require("react"));
|
|
5
5
|
const SvgIcon_1 = require("../SvgIcon");
|
|
6
6
|
const SvgErase = (props) => (React.createElement(SvgIcon_1.SvgIcon, { width: 24, height: 24, fill: "none", viewBox: "0 0 24 24", ...props },
|
|
7
|
-
React.createElement("path", { d: "M9.34 5h10.43C21.01 5 22 6 22 7.2v9.6c0 1.2-.99 2.2-2.23 2.2H9.34c-.62 0-1.21-.26-1.63-.7l-5.55-5.9a.59.59 0 0 1 0-.8l5.55-5.9c.42-.44 1.01-.7 1.63-.7Z", stroke: "currentColor",
|
|
7
|
+
React.createElement("path", { d: "M9.34 5h10.43C21.01 5 22 6 22 7.2v9.6c0 1.2-.99 2.2-2.23 2.2H9.34c-.62 0-1.21-.26-1.63-.7l-5.55-5.9a.59.59 0 0 1 0-.8l5.55-5.9c.42-.44 1.01-.7 1.63-.7Z", stroke: "currentColor", strokeWidth: "2" }),
|
|
8
8
|
React.createElement("path", { fill: "currentColor", d: "M18.17 9.1c.3-.32.3-.83 0-1.14a.78.78 0 0 0-1.11 0l-2.78 2.83-2.78-2.83a.78.78 0 0 0-1.11 0c-.3.31-.3.82 0 1.13l2.78 2.83-2.78 2.83c-.3.31-.3.82 0 1.13.3.31.8.31 1.11 0l2.78-2.83 2.78 2.83c.3.31.8.31 1.1 0 .31-.31.31-.82 0-1.13l-2.77-2.83 2.78-2.83Z" })));
|
|
9
9
|
exports.default = SvgErase;
|
|
10
10
|
//# sourceMappingURL=Erase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Erase.js","sourceRoot":"","sources":["../../../src/Icon/icons/Erase.tsx"],"names":[],"mappings":";;;AAAA,0DAA8B;AAE9B,wCAAoC;AACpC,MAAM,QAAQ,GAAG,CAAC,KAA8B,EAAE,EAAE,CAAC,CACpD,oBAAC,iBAAO,IACP,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE,EACV,IAAI,EAAC,MAAM,EACX,OAAO,EAAC,WAAW,KACf,KAAK;IAET,8BAAM,CAAC,EAAC,yJAAyJ,EAAC,MAAM,EAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"Erase.js","sourceRoot":"","sources":["../../../src/Icon/icons/Erase.tsx"],"names":[],"mappings":";;;AAAA,0DAA8B;AAE9B,wCAAoC;AACpC,MAAM,QAAQ,GAAG,CAAC,KAA8B,EAAE,EAAE,CAAC,CACpD,oBAAC,iBAAO,IACP,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE,EACV,IAAI,EAAC,MAAM,EACX,OAAO,EAAC,WAAW,KACf,KAAK;IAET,8BAAM,CAAC,EAAC,yJAAyJ,EAAC,MAAM,EAAC,cAAc,EAAC,WAAW,EAAC,GAAG,GAAE;IACzM,8BAAM,IAAI,EAAC,cAAc,EAAC,CAAC,EAAC,2PAA2P,GAAE,CAChR,CACV,CAAA;AACD,kBAAe,QAAQ,CAAA"}
|
|
@@ -22,32 +22,32 @@ const Swipe2Show = ({ children, contentToShowRight }) => {
|
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
(0, react_1.useEffect)(() => {
|
|
25
|
-
document.addEventListener(
|
|
26
|
-
document.addEventListener(
|
|
25
|
+
document.addEventListener('mousedown', checkClickOutside);
|
|
26
|
+
document.addEventListener('touchstart', checkClickOutside);
|
|
27
27
|
return () => {
|
|
28
|
-
document.removeEventListener(
|
|
29
|
-
document.removeEventListener(
|
|
28
|
+
document.removeEventListener('mousedown', checkClickOutside);
|
|
29
|
+
document.removeEventListener('touchstart', checkClickOutside);
|
|
30
30
|
};
|
|
31
31
|
});
|
|
32
|
-
return (react_1.default.createElement("div", { style: { position:
|
|
32
|
+
return (react_1.default.createElement("div", { style: { position: 'relative' }, ref: wrapperRef },
|
|
33
33
|
(0, react_1.cloneElement)(children, {
|
|
34
34
|
style: {
|
|
35
35
|
position: 'relative',
|
|
36
36
|
transform: showRight && `translateX(-${translateX}px)`,
|
|
37
|
-
transition:
|
|
38
|
-
width:
|
|
39
|
-
zIndex:
|
|
37
|
+
transition: 'transform .15s ease-in-out',
|
|
38
|
+
width: '100%',
|
|
39
|
+
zIndex: '1',
|
|
40
40
|
touchAction: 'pan-x',
|
|
41
41
|
},
|
|
42
42
|
...handlers,
|
|
43
43
|
}),
|
|
44
44
|
react_1.default.createElement("div", { ref: actionRef, style: {
|
|
45
|
-
position:
|
|
46
|
-
top:
|
|
47
|
-
right:
|
|
48
|
-
bottom:
|
|
45
|
+
position: 'absolute',
|
|
46
|
+
top: '.5px',
|
|
47
|
+
right: '0',
|
|
48
|
+
bottom: '.5px',
|
|
49
49
|
opacity: `${showRight ? '1' : '0'}`,
|
|
50
|
-
transition: 'opacity .15s ease-in-out'
|
|
50
|
+
transition: 'opacity .15s ease-in-out',
|
|
51
51
|
} }, contentToShowRight)));
|
|
52
52
|
};
|
|
53
53
|
exports.Swipe2Show = Swipe2Show;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Swipe2Show.js","sourceRoot":"","sources":["../../src/Swipe2Show/Swipe2Show.tsx"],"names":[],"mappings":";;;;AAAA,4DAAyF;AACzF,qDAA8C;AAM9C,MAAM,UAAU,GAAe,CAAC,EAAE,QAAQ,EAAE,kBAAkB,EA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;YACX,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAA;YAC5D,QAAQ,CAAC,mBAAmB,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAA;QAC9D,CAAC,CAAA;IACF,CAAC,CAAC,CAAA;IAEF,OAAO,CACN,uCACC,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,EAC/B,GAAG,EAAE,UAAU;QAEd,IAAA,oBAAY,EAAC,QAAmC,EAAE;YAClD,KAAK,EAAE;gBACN,QAAQ,EAAE,UAAU;gBACpB,SAAS,EAAE,SAAS,IAAI,eAAe,UAAU,KAAK;gBACtD,UAAU,EAAE,4BAA4B;gBACxC,KAAK,EAAE,MAAM;gBACb,MAAM,EAAE,GAAG;gBACX,WAAW,EAAE,OAAO;aACpB;YACD,GAAG,QAAQ;SACX,CAAC;QACF,uCACC,GAAG,EAAE,SAAS,EACd,KAAK,EAAE;gBACN,QAAQ,EAAE,UAAU;gBACpB,GAAG,EAAE,MAAM;gBACX,KAAK,EAAE,GAAG;gBACV,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE;gBACnC,UAAU,EAAE,0BAA0B;aACtC,IAEA,kBAAkB,CACd,CACD,CACN,CAAA;AACF,CAAC,CAAA;AAEQ,gCAAU"}
|
package/package.json
CHANGED
package/src/Icon/icons/Erase.tsx
CHANGED
|
@@ -9,7 +9,7 @@ const SvgErase = (props: SVGProps<SVGSVGElement>) => (
|
|
|
9
9
|
viewBox="0 0 24 24"
|
|
10
10
|
{...props}
|
|
11
11
|
>
|
|
12
|
-
<path d="M9.34 5h10.43C21.01 5 22 6 22 7.2v9.6c0 1.2-.99 2.2-2.23 2.2H9.34c-.62 0-1.21-.26-1.63-.7l-5.55-5.9a.59.59 0 0 1 0-.8l5.55-5.9c.42-.44 1.01-.7 1.63-.7Z" stroke="currentColor"
|
|
12
|
+
<path d="M9.34 5h10.43C21.01 5 22 6 22 7.2v9.6c0 1.2-.99 2.2-2.23 2.2H9.34c-.62 0-1.21-.26-1.63-.7l-5.55-5.9a.59.59 0 0 1 0-.8l5.55-5.9c.42-.44 1.01-.7 1.63-.7Z" stroke="currentColor" strokeWidth="2"/>
|
|
13
13
|
<path fill="currentColor" d="M18.17 9.1c.3-.32.3-.83 0-1.14a.78.78 0 0 0-1.11 0l-2.78 2.83-2.78-2.83a.78.78 0 0 0-1.11 0c-.3.31-.3.82 0 1.13l2.78 2.83-2.78 2.83c-.3.31-.3.82 0 1.13.3.31.8.31 1.11 0l2.78-2.83 2.78 2.83c.3.31.8.31 1.1 0 .31-.31.31-.82 0-1.13l-2.77-2.83 2.78-2.83Z"/>
|
|
14
14
|
</SvgIcon>
|
|
15
15
|
)
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import React, { cloneElement, FC, useCallback, useEffect, useRef, useState } from
|
|
2
|
-
import { useSwipeable } from
|
|
1
|
+
import React, { cloneElement, FC, useCallback, useEffect, useRef, useState } from 'react'
|
|
2
|
+
import { useSwipeable } from 'react-swipeable'
|
|
3
3
|
|
|
4
4
|
interface IProps extends React.PropsWithChildren {
|
|
5
|
-
|
|
5
|
+
contentToShowRight: React.ReactNode
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
const Swipe2Show: FC<IProps> = ({ children, contentToShowRight }) => {
|
|
9
|
-
const wrapperRef = useRef<HTMLDivElement>(null)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const wrapperRef = useRef<HTMLDivElement>(null)
|
|
10
|
+
const actionRef = useRef<HTMLDivElement>(null)
|
|
11
|
+
const [showRight, setShowRight] = useState(false)
|
|
12
|
+
const translateX = actionRef.current?.offsetWidth
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
const handlers = useSwipeable({
|
|
15
|
+
onSwipedLeft: () => setShowRight(true),
|
|
16
|
+
onSwipedRight: () => setShowRight(false),
|
|
17
|
+
swipeDuration: 500,
|
|
18
|
+
preventScrollOnSwipe: true,
|
|
19
|
+
trackMouse: true,
|
|
20
|
+
})
|
|
21
21
|
|
|
22
22
|
const checkClickOutside = (evt) => {
|
|
23
23
|
if (showRight && wrapperRef.current && !wrapperRef.current.contains(evt.target)) {
|
|
@@ -25,44 +25,47 @@ const Swipe2Show: FC<IProps> = ({ children, contentToShowRight }) => {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
document.addEventListener('mousedown', checkClickOutside)
|
|
30
|
+
document.addEventListener('touchstart', checkClickOutside)
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
return () => {
|
|
33
|
+
document.removeEventListener('mousedown', checkClickOutside)
|
|
34
|
+
document.removeEventListener('touchstart', checkClickOutside)
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
return (
|
|
39
|
+
<div
|
|
40
|
+
style={{ position: 'relative' }}
|
|
41
|
+
ref={wrapperRef}
|
|
42
|
+
>
|
|
43
|
+
{cloneElement(children as React.ReactElement<any>, {
|
|
44
|
+
style: {
|
|
42
45
|
position: 'relative',
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
transform: showRight && `translateX(-${translateX}px)`,
|
|
47
|
+
transition: 'transform .15s ease-in-out',
|
|
48
|
+
width: '100%',
|
|
49
|
+
zIndex: '1',
|
|
47
50
|
touchAction: 'pan-x',
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
opacity: `${showRight ? '1': '0'}`,
|
|
59
|
-
transition: 'opacity .15s ease-in-out'
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
51
|
+
},
|
|
52
|
+
...handlers,
|
|
53
|
+
})}
|
|
54
|
+
<div
|
|
55
|
+
ref={actionRef}
|
|
56
|
+
style={{
|
|
57
|
+
position: 'absolute',
|
|
58
|
+
top: '.5px',
|
|
59
|
+
right: '0',
|
|
60
|
+
bottom: '.5px',
|
|
61
|
+
opacity: `${showRight ? '1' : '0'}`,
|
|
62
|
+
transition: 'opacity .15s ease-in-out',
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
{contentToShowRight}
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
)
|
|
66
69
|
}
|
|
67
70
|
|
|
68
|
-
export { Swipe2Show }
|
|
71
|
+
export { Swipe2Show }
|