@snack-uikit/utils 3.5.0 → 3.5.1-preview-53bd8747.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 +8 -0
- package/dist/cjs/hooks/useSwipe.js +15 -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 +8 -0
- package/dist/esm/hooks/useSwipe.js +6 -0
- package/package.json +3 -2
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useSwipe.ts +27 -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,8 @@
|
|
|
1
|
+
import { SwipeableHandlers, SwipeableProps, SwipeCallback, SwipeDirections, SwipeEventData } from 'react-swipeable';
|
|
2
|
+
export declare const DATA_SWIPE_ATTRIBUTE = "data-has-swipe";
|
|
3
|
+
export type UseSwipeProps = SwipeableProps;
|
|
4
|
+
export type UseSwipeReturnType = SwipeableHandlers & {
|
|
5
|
+
[DATA_SWIPE_ATTRIBUTE]: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function useSwipeable(options: UseSwipeProps): UseSwipeReturnType;
|
|
8
|
+
export type { SwipeCallback, SwipeDirections, SwipeEventData };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DATA_SWIPE_ATTRIBUTE = void 0;
|
|
7
|
+
exports.useSwipeable = useSwipeable;
|
|
8
|
+
const react_swipeable_1 = require("react-swipeable");
|
|
9
|
+
exports.DATA_SWIPE_ATTRIBUTE = 'data-has-swipe';
|
|
10
|
+
function useSwipeable(options) {
|
|
11
|
+
const handlers = (0, react_swipeable_1.useSwipeable)(options);
|
|
12
|
+
return Object.assign(Object.assign({}, handlers), {
|
|
13
|
+
[exports.DATA_SWIPE_ATTRIBUTE]: 'true'
|
|
14
|
+
});
|
|
15
|
+
}
|
package/dist/esm/hooks/index.js
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SwipeableHandlers, SwipeableProps, SwipeCallback, SwipeDirections, SwipeEventData } from 'react-swipeable';
|
|
2
|
+
export declare const DATA_SWIPE_ATTRIBUTE = "data-has-swipe";
|
|
3
|
+
export type UseSwipeProps = SwipeableProps;
|
|
4
|
+
export type UseSwipeReturnType = SwipeableHandlers & {
|
|
5
|
+
[DATA_SWIPE_ATTRIBUTE]: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function useSwipeable(options: UseSwipeProps): UseSwipeReturnType;
|
|
8
|
+
export type { SwipeCallback, SwipeDirections, SwipeEventData };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { useSwipeable as useSwipeableInternal, } from 'react-swipeable';
|
|
2
|
+
export const DATA_SWIPE_ATTRIBUTE = 'data-has-swipe';
|
|
3
|
+
export function useSwipeable(options) {
|
|
4
|
+
const handlers = useSwipeableInternal(options);
|
|
5
|
+
return Object.assign(Object.assign({}, handlers), { [DATA_SWIPE_ATTRIBUTE]: 'true' });
|
|
6
|
+
}
|
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-53bd8747.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": "527ea8e5660cbf949a1e84bc833f876a0802d10e"
|
|
42
43
|
}
|
package/src/hooks/index.ts
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SwipeableHandlers,
|
|
3
|
+
SwipeableProps,
|
|
4
|
+
SwipeCallback,
|
|
5
|
+
SwipeDirections,
|
|
6
|
+
SwipeEventData,
|
|
7
|
+
useSwipeable as useSwipeableInternal,
|
|
8
|
+
} from 'react-swipeable';
|
|
9
|
+
|
|
10
|
+
export const DATA_SWIPE_ATTRIBUTE = 'data-has-swipe';
|
|
11
|
+
|
|
12
|
+
export type UseSwipeProps = SwipeableProps;
|
|
13
|
+
|
|
14
|
+
export type UseSwipeReturnType = SwipeableHandlers & {
|
|
15
|
+
[DATA_SWIPE_ATTRIBUTE]: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export function useSwipeable(options: UseSwipeProps): UseSwipeReturnType {
|
|
19
|
+
const handlers = useSwipeableInternal(options);
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
...handlers,
|
|
23
|
+
[DATA_SWIPE_ATTRIBUTE]: 'true',
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type { SwipeCallback, SwipeDirections, SwipeEventData };
|