@kolserdav/swiper 4.1.5 → 4.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Sergey Kolmiller
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -15,7 +15,7 @@ npm install --save @kolserdav/swiper
15
15
  ```tsx
16
16
  import React, { useState, useEffect } from 'react';
17
17
  import { Swiper, GetSwipeHandler, Swipe } from '@kolserdav/swiper';
18
- import '@kolserdav/swiper/dist/index.css'; // From version 3.0.0 is required
18
+ import '@kolserdav/swiper/dist/index.css';
19
19
 
20
20
  const COUNT = 4;
21
21
 
@@ -99,7 +99,7 @@ interface SwiperProps {
99
99
  */
100
100
  onSwipe?: (currentId: number) => void;
101
101
 
102
- /**
102
+ /**
103
103
  * Auto slide if provieded
104
104
  */
105
105
  durationAnimation?: number;
package/dist/index.d.ts CHANGED
@@ -1,85 +1,85 @@
1
- /******************************************************************************************
2
- * Repository: https://github.com/kolserdav/swiper.git
3
- * Author: Sergey Kolmiller
4
- * Email: <serega12101983@gmail.com>
5
- * License: MIT
6
- * License Text: The code is distributed as is. There are no guarantees regarding the functionality of the code or parts of it.
7
- * Copyright: kolserdav, All rights reserved (c)
8
- * Create date: Mon Nov 29 2021 16:18:08 GMT+0700 (Krasnoyarsk Standard Time)
9
- ******************************************************************************************/
10
- import React, { RefObject } from 'react';
11
- /**
12
- * Time to miliseconds of change animation by card left value
13
- */
14
- export declare const SWIPE_TRANSITION_TIMEOUT = 400;
15
- /**
16
- * Minimum swipe speed regardless of distance
17
- */
18
- export declare const SWIPE_ON_EVENT_SPEED = 0.7;
19
- /**
20
- * One of swipe card
21
- */
22
- export interface Swipe {
23
- id: number | null;
24
- nextRef?: RefObject<HTMLButtonElement | HTMLDivElement | undefined>;
25
- closeRef?: RefObject<HTMLButtonElement | HTMLDivElement | undefined>;
26
- children: React.ReactElement | React.ReactElement[];
27
- }
28
- /**
29
- * Callback for get next or previous card content
30
- */
31
- export declare type GetSwipeHandler = (oldId: number) => Promise<Swipe>;
32
- /**
33
- * Props of Swiper component
34
- */
35
- interface SwiperProps {
36
- /**
37
- * Current card content
38
- */
39
- defaultCurrent: Swipe;
40
- /**
41
- * Get next card handler
42
- */
43
- getNext: GetSwipeHandler;
44
- /**
45
- * Get previous card handler
46
- */
47
- getPrev: GetSwipeHandler;
48
- /**
49
- * Class name for content block
50
- */
51
- className?: string;
52
- /**
53
- * invitation animation
54
- */
55
- invitationAnimation?: boolean;
56
- /**
57
- * On swipe callback
58
- */
59
- onSwipe?: (currentId: number | null | undefined) => void;
60
- /**
61
- * Auto slide if provieded
62
- */
63
- durationAnimation?: number;
64
- /**
65
- * Blocked swipe event
66
- */
67
- blockSwipe?: boolean;
68
- /**
69
- * Show dots
70
- */
71
- dots?: {
72
- list: number[];
73
- active: number;
74
- };
75
- }
76
- /**
77
- * Swiper component
78
- */
79
- export declare const Swiper: {
80
- (props: SwiperProps): React.ReactElement;
81
- defaultProps: {
82
- className: string;
83
- };
84
- };
85
- export {};
1
+ /******************************************************************************************
2
+ * Repository: https://github.com/kolserdav/swiper.git
3
+ * Author: Sergey Kolmiller
4
+ * Email: <serega12101983@gmail.com>
5
+ * License: MIT
6
+ * License Text: The code is distributed as is. There are no guarantees regarding the functionality of the code or parts of it.
7
+ * Copyright: kolserdav, All rights reserved (c)
8
+ * Create date: Mon Nov 29 2021 16:18:08 GMT+0700 (Krasnoyarsk Standard Time)
9
+ ******************************************************************************************/
10
+ import React, { RefObject } from 'react';
11
+ /**
12
+ * Time to miliseconds of change animation by card left value
13
+ */
14
+ export declare const SWIPE_TRANSITION_TIMEOUT = 400;
15
+ /**
16
+ * Minimum swipe speed regardless of distance
17
+ */
18
+ export declare const SWIPE_ON_EVENT_SPEED = 0.7;
19
+ /**
20
+ * One of swipe card
21
+ */
22
+ export interface Swipe {
23
+ id: number | null;
24
+ nextRef?: RefObject<HTMLButtonElement | HTMLDivElement | undefined>;
25
+ closeRef?: RefObject<HTMLButtonElement | HTMLDivElement | undefined>;
26
+ children: React.ReactElement | React.ReactElement[];
27
+ }
28
+ /**
29
+ * Callback for get next or previous card content
30
+ */
31
+ export type GetSwipeHandler = (oldId: number) => Promise<Swipe>;
32
+ /**
33
+ * Props of Swiper component
34
+ */
35
+ interface SwiperProps {
36
+ /**
37
+ * Current card content
38
+ */
39
+ defaultCurrent: Swipe;
40
+ /**
41
+ * Get next card handler
42
+ */
43
+ getNext: GetSwipeHandler;
44
+ /**
45
+ * Get previous card handler
46
+ */
47
+ getPrev: GetSwipeHandler;
48
+ /**
49
+ * Class name for content block
50
+ */
51
+ className?: string;
52
+ /**
53
+ * invitation animation
54
+ */
55
+ invitationAnimation?: boolean;
56
+ /**
57
+ * On swipe callback
58
+ */
59
+ onSwipe?: (currentId: number | null | undefined) => void;
60
+ /**
61
+ * Auto slide if provieded
62
+ */
63
+ durationAnimation?: number;
64
+ /**
65
+ * Blocked swipe event
66
+ */
67
+ blockSwipe?: boolean;
68
+ /**
69
+ * Show dots
70
+ */
71
+ dots?: {
72
+ list: number[];
73
+ active: number;
74
+ };
75
+ }
76
+ /**
77
+ * Swiper component
78
+ */
79
+ export declare const Swiper: {
80
+ (props: SwiperProps): React.ReactElement;
81
+ defaultProps: {
82
+ className: string;
83
+ };
84
+ };
85
+ export {};