@snack-uikit/utils 3.5.0 → 3.5.1-preview-20b0f520.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/hooks/index.d.ts +1 -0
- package/dist/cjs/hooks/index.js +1 -0
- package/dist/cjs/hooks/useSwipe.d.ts +7 -0
- package/dist/cjs/hooks/useSwipe.js +13 -0
- package/dist/esm/hooks/index.d.ts +1 -0
- package/dist/esm/hooks/index.js +1 -0
- package/dist/esm/hooks/useSwipe.d.ts +7 -0
- package/dist/esm/hooks/useSwipe.js +5 -0
- package/package.json +3 -2
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useSwipe.ts +18 -0
package/dist/cjs/hooks/index.js
CHANGED
|
@@ -25,5 +25,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
25
25
|
__exportStar(require("./useDebounce"), exports);
|
|
26
26
|
__exportStar(require("./useEventHandler"), exports);
|
|
27
27
|
__exportStar(require("./useIsomorphicLayoutEffect"), exports);
|
|
28
|
+
__exportStar(require("./useSwipe"), exports);
|
|
28
29
|
__exportStar(require("./useThemeConfig"), exports);
|
|
29
30
|
__exportStar(require("./useValueControl"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SwipeableHandlers, SwipeableProps, SwipeCallback, SwipeDirections } from 'react-swipeable';
|
|
2
|
+
export type UseSwipeProps = SwipeableProps;
|
|
3
|
+
export type UseSwipeReturnType = SwipeableHandlers & {
|
|
4
|
+
'data-has-swipe': string;
|
|
5
|
+
};
|
|
6
|
+
export declare function useSwipe(options: UseSwipeProps): UseSwipeReturnType;
|
|
7
|
+
export type { SwipeCallback, SwipeDirections };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useSwipe = useSwipe;
|
|
7
|
+
const react_swipeable_1 = require("react-swipeable");
|
|
8
|
+
function useSwipe(options) {
|
|
9
|
+
const handlers = (0, react_swipeable_1.useSwipeable)(options);
|
|
10
|
+
return Object.assign(Object.assign({}, handlers), {
|
|
11
|
+
'data-has-swipe': 'true'
|
|
12
|
+
});
|
|
13
|
+
}
|
package/dist/esm/hooks/index.js
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SwipeableHandlers, SwipeableProps, SwipeCallback, SwipeDirections } from 'react-swipeable';
|
|
2
|
+
export type UseSwipeProps = SwipeableProps;
|
|
3
|
+
export type UseSwipeReturnType = SwipeableHandlers & {
|
|
4
|
+
'data-has-swipe': string;
|
|
5
|
+
};
|
|
6
|
+
export declare function useSwipe(options: UseSwipeProps): UseSwipeReturnType;
|
|
7
|
+
export type { SwipeCallback, SwipeDirections };
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Utils",
|
|
7
|
-
"version": "3.5.0",
|
|
7
|
+
"version": "3.5.1-preview-20b0f520.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
"license": "Apache-2.0",
|
|
37
37
|
"scripts": {},
|
|
38
38
|
"dependencies": {
|
|
39
|
+
"react-swipeable": "7.0.2",
|
|
39
40
|
"uncontrollable": "8.0.4"
|
|
40
41
|
},
|
|
41
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "3d9f58d349ce6413d2242d7a42b8ba624815dcc0"
|
|
42
43
|
}
|
package/src/hooks/index.ts
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SwipeableHandlers, SwipeableProps, SwipeCallback, SwipeDirections, useSwipeable } from 'react-swipeable';
|
|
2
|
+
|
|
3
|
+
export type UseSwipeProps = SwipeableProps;
|
|
4
|
+
|
|
5
|
+
export type UseSwipeReturnType = SwipeableHandlers & {
|
|
6
|
+
'data-has-swipe': string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export function useSwipe(options: UseSwipeProps): UseSwipeReturnType {
|
|
10
|
+
const handlers = useSwipeable(options);
|
|
11
|
+
|
|
12
|
+
return {
|
|
13
|
+
...handlers,
|
|
14
|
+
'data-has-swipe': 'true',
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type { SwipeCallback, SwipeDirections };
|