@kolserdav/swiper 4.2.2 → 4.3.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/.eslintrc.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "env": {
3
+ "es2021": true,
4
+ "node": true,
5
+ "browser": true
6
+ },
7
+ "root": true,
8
+ "extends": ["next/typescript"],
9
+ "rules": {
10
+ "@typescript-eslint/no-explicit-any": 1,
11
+ "@typescript-eslint/camelcase": 0,
12
+ "react/jsx-filename-extension": 0,
13
+ "react/jsx-props-no-spreading": 0,
14
+ "react/jsx-fragments": 0,
15
+ "import/extensions": 0,
16
+ "react/jsx-boolean-value": 0,
17
+ "no-underscore-dangle": 0,
18
+ "arrow-body-style": 1,
19
+ "no-nested-ternary": 0,
20
+ "spaced-comment": 0,
21
+ "@typescript-eslint/ban-ts-comment": 1,
22
+ "no-plusplus": 1
23
+ }
24
+ }
package/.prettierrc ADDED
@@ -0,0 +1,9 @@
1
+
2
+ {
3
+ "printWidth": 100,
4
+ "tabWidth": 2,
5
+ "singleQuote": true,
6
+ "trailingComma": "es5",
7
+ "endOfLine": "auto",
8
+ "useTabs": false
9
+ }
package/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: node_js
2
+ node_js:
3
+ - 20
4
+ - 18
@@ -0,0 +1,7 @@
1
+ {
2
+ "recommendations": [
3
+ "dbaeumer.vscode-eslint",
4
+ "esbenp.prettier-vscode",
5
+ "stylelint.vscode-stylelint",
6
+ ]
7
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "eslint.validate": ["javascript", "typescript"],
3
+ "eslint.workingDirectories": ["./"],
4
+ "eslint.format.enable": true,
5
+ "editor.codeActionsOnSave": {
6
+ "source.fixAll.eslint": "explicit",
7
+ "source.fixAll.stylelint": "explicit"
8
+ },
9
+ "editor.formatOnSave": true,
10
+ "stylelint.enable": true,
11
+ "stylelint.validate": ["css", "scss"],
12
+ "[javascript]": {
13
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
14
+ },
15
+ "[typescript]": {
16
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
17
+ },
18
+ "[css]": {
19
+ "editor.defaultFormatter": "stylelint.vscode-stylelint",
20
+ }
21
+ }
@@ -0,0 +1,40 @@
1
+ This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2
+
3
+ ## Getting Started
4
+
5
+ First, run the development server:
6
+
7
+ ```bash
8
+ npm run dev
9
+ # or
10
+ yarn dev
11
+ # or
12
+ pnpm dev
13
+ # or
14
+ bun dev
15
+ ```
16
+
17
+ Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18
+
19
+ You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
20
+
21
+ [API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.
22
+
23
+ The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
24
+
25
+ This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
26
+
27
+ ## Learn More
28
+
29
+ To learn more about Next.js, take a look at the following resources:
30
+
31
+ - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
32
+ - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
33
+
34
+ You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
35
+
36
+ ## Deploy on Vercel
37
+
38
+ The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
39
+
40
+ Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
@@ -1,11 +1,12 @@
1
1
  /******************************************************************************************
2
- * Repository: https://github.com/kolserdav/swiper.git
2
+ * Repository: https://github.com/kolserdav/react-swiper.git
3
+ * File name: Swiper.d.ts
3
4
  * Author: Sergey Kolmiller
4
- * Email: <serega12101983@gmail.com>
5
+ * Email: <kolserdav@conhos.ru>
5
6
  * 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
+ * License text: The code is distributed as is. There are no guarantees regarding the functionality of the code or parts of it.
7
8
  * Copyright: kolserdav, All rights reserved (c)
8
- * Create date: Mon Nov 29 2021 16:18:08 GMT+0700 (Krasnoyarsk Standard Time)
9
+ * Create Date: Fri Sep 06 2024 18:44:44 GMT+0700 (Krasnoyarsk Standard Time)
9
10
  ******************************************************************************************/
10
11
  import React, { RefObject } from 'react';
11
12
  /**
@@ -76,10 +77,5 @@ interface SwiperProps {
76
77
  /**
77
78
  * Swiper component
78
79
  */
79
- export declare const Swiper: {
80
- (props: SwiperProps): React.ReactElement;
81
- defaultProps: {
82
- className: string;
83
- };
84
- };
80
+ export declare const Swiper: (props: SwiperProps) => React.ReactElement;
85
81
  export {};
package/dist/Swiper.js ADDED
@@ -0,0 +1,2 @@
1
+ /*! For license information please see Swiper.js.LICENSE.txt */
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports["React Swiper"]=t(require("react")):e["React Swiper"]=t(e.react)}(this,(e=>(()=>{"use strict";var t={324:(e,t,n)=>{n.d(t,{Ay:()=>u});var r=n(601),o=n.n(r),i=n(314),a=n.n(i)()(o());a.push([e.id,".iYsMDZwYoSyzozPjEz5J {\n position: relative;\n overflow: hidden;\n min-width: 320px;\n width: 100%;\n height: 100%;\n min-height: 20vh;\n max-width: 100vw;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.pqKG7OPYfDyQqVLqU9XB {\n background-color: #fff;\n border-radius: 1rem;\n}\n\n.eLNE2IZaVxAthGkzoysU {\n position: relative;\n width: 100%;\n height: 100%;\n}\n\n.HROHJaN0RPwx5AAjEGrH {\n position: absolute;\n max-width: inherit;\n top: 0;\n left: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-direction: column;\n}\n.fjkZBkJ7DRA58T6wJLwI {\n left: -100%;\n}\n.KD5jXJ7nuM20VA1IDPkY {\n left: 100%;\n}\n.omd2aHIJEIptucY7mx6y {\n transition: left 0.4s ease-in 0s;\n}\n.z3V7MHLxGPgzoAclF6WC {\n transition: left 0.4s ease-out 0s;\n}\n\n.XofRheLHw9Ng7TOhyHjk {\n width: 100%;\n height: 100%;\n position: relative;\n}\n\n.N0DK67z7b9n1uZhV4XBd {\n border-radius: 2px;\n position: relative;\n width: calc(100% - 48px);\n height: calc(100% - 48px);\n -webkit-box-shadow: 0px 0px 5px 1px rgba(34, 60, 80, 0.14);\n -moz-box-shadow: 0px 0px 5px 1px rgba(34, 60, 80, 0.14);\n box-shadow: 0px 0px 5px 1px rgba(34, 60, 80, 0.14);\n}\n\n._y51GMhoRcds9oqSwCnH {\n cursor: pointer;\n position: absolute;\n width: auto;\n height: auto;\n display: flex;\n align-items: center;\n z-index: 12;\n}\n\n.IWpO6LYjiJSfWSEh9X_l {\n right: 0;\n}\n\n.o1hoKJ6OSu3zOjkDLiJH {\n left: 0;\n transform: rotate(180deg);\n}\n\n.pWqHBVewaJNmAfi96NlO {\n display: -webkit-inline-box;\n display: -webkit-inline-flex;\n display: -ms-inline-flexbox;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n position: relative;\n box-sizing: border-box;\n background-color: transparent;\n outline: 0;\n border: 0;\n margin: 0;\n border-radius: 0;\n padding: 0;\n cursor: pointer;\n user-select: none;\n vertical-align: middle;\n text-decoration: none;\n color: inherit;\n text-align: center;\n flex: 0 0 auto;\n font-size: 1.5rem;\n padding: 8px;\n border-radius: 50%;\n overflow: visible;\n color: rgba(0, 0, 0, 0.54);\n transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;\n}\n.pWqHBVewaJNmAfi96NlO:hover {\n background-color: rgba(0, 0, 0, 0.054);\n}\n.pWqHBVewaJNmAfi96NlO:active {\n background-color: rgba(0, 0, 0, 0.007);\n}\n\n.JEvfD7_cycab43UB7lC1 {\n position: absolute;\n display: flex;\n flex-direction: row;\n bottom: 0;\n}\n\n.QDEdEYsr59gcip7aNmnF {\n cursor: pointer;\n position: relative;\n width: 8px;\n height: 8px;\n margin: 2px;\n border: 1px solid gray;\n border-radius: 50%;\n}\n\n.QDEdEYsr59gcip7aNmnF.cHM1daB82vtAGSVhkiF8 {\n cursor: default;\n background-color: gray;\n}",""]);const u=a},314:e=>{e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,r,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var a={};if(r)for(var u=0;u<this.length;u++){var c=this[u][0];null!=c&&(a[c]=!0)}for(var l=0;l<e.length;l++){var s=[].concat(e[l]);r&&a[s[0]]||(void 0!==i&&(void 0===s[5]||(s[1]="@layer".concat(s[5].length>0?" ".concat(s[5]):""," {").concat(s[1],"}")),s[5]=i),n&&(s[2]?(s[1]="@media ".concat(s[2]," {").concat(s[1],"}"),s[2]=n):s[2]=n),o&&(s[4]?(s[1]="@supports (".concat(s[4],") {").concat(s[1],"}"),s[4]=o):s[4]="".concat(o)),t.push(s))}},t}},601:e=>{e.exports=function(e){return e[1]}},72:e=>{var t=[];function n(e){for(var n=-1,r=0;r<t.length;r++)if(t[r].identifier===e){n=r;break}return n}function r(e,r){for(var i={},a=[],u=0;u<e.length;u++){var c=e[u],l=r.base?c[0]+r.base:c[0],s=i[l]||0,d="".concat(l," ").concat(s);i[l]=s+1;var f=n(d),v={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==f)t[f].references++,t[f].updater(v);else{var p=o(v,r);r.byIndex=u,t.splice(u,0,{identifier:d,updater:p,references:1})}a.push(d)}return a}function o(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,o){var i=r(e=e||[],o=o||{});return function(e){e=e||[];for(var a=0;a<i.length;a++){var u=n(i[a]);t[u].references--}for(var c=r(e,o),l=0;l<i.length;l++){var s=n(i[l]);0===t[s].references&&(t[s].updater(),t.splice(s,1))}i=c}}},659:e=>{var t={};e.exports=function(e,n){var r=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},540:e=>{e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},56:(e,t,n)=>{e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},825:e=>{e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},113:e=>{e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},155:t=>{t.exports=e}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={id:e,exports:{}};return t[e](i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nc=void 0;var o={};r.r(o),r.d(o,{SWIPE_ON_EVENT_SPEED:()=>D,SWIPE_TRANSITION_TIMEOUT:()=>R,Swiper:()=>F});var i=r(155),a=r.n(i);function u(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=u(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}const c=function(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=u(e))&&(r&&(r+=" "),r+=t);return r};var l=r(72),s=r.n(l),d=r(825),f=r.n(d),v=r(659),p=r.n(v),h=r(56),m=r.n(h),y=r(540),b=r.n(y),g=r(113),x=r.n(g),w=r(324),E={};E.styleTagTransform=x(),E.setAttributes=m(),E.insert=p().bind(null,"head"),E.domAPI=f(),E.insertStyleElement=b(),s()(w.Ay,E);const k=w.Ay&&w.Ay.locals?w.Ay.locals:void 0;function L(e){return L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},L(e)}function S(){S=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var i=t&&t.prototype instanceof y?t:y,a=Object.create(i.prototype),u=new T(r||[]);return o(a,"_invoke",{value:_(e,n,u)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=s;var f="suspendedStart",v="suspendedYield",p="executing",h="completed",m={};function y(){}function b(){}function g(){}var x={};l(x,a,(function(){return this}));var w=Object.getPrototypeOf,E=w&&w(w(A([])));E&&E!==n&&r.call(E,a)&&(x=E);var k=g.prototype=y.prototype=Object.create(x);function O(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function j(e,t){function n(o,i,a,u){var c=d(e[o],e,i);if("throw"!==c.type){var l=c.arg,s=l.value;return s&&"object"==L(s)&&r.call(s,"__await")?t.resolve(s.__await).then((function(e){n("next",e,a,u)}),(function(e){n("throw",e,a,u)})):t.resolve(s).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,u)}))}u(c.arg)}var i;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return i=i?i.then(o,o):o()}})}function _(t,n,r){var o=f;return function(i,a){if(o===p)throw Error("Generator is already running");if(o===h){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var u=r.delegate;if(u){var c=M(u,r);if(c){if(c===m)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===f)throw o=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=p;var l=d(t,n,r);if("normal"===l.type){if(o=r.done?h:v,l.arg===m)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(o=h,r.method="throw",r.arg=l.arg)}}}function M(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,M(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var i=d(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,m;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function A(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(L(t)+" is not iterable")}return b.prototype=g,o(k,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:b,configurable:!0}),b.displayName=l(g,c,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,l(e,c,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},O(j.prototype),l(j.prototype,u,(function(){return this})),t.AsyncIterator=j,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new j(s(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},O(k),l(k,c,"Generator"),l(k,a,(function(){return this})),l(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=A,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(P),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return u.type="throw",u.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var c=r.call(a,"catchLoc"),l=r.call(a,"finallyLoc");if(c&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),P(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;P(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:A(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}function O(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function j(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){O(i,r,o,a,u,"next",e)}function u(e){O(i,r,o,a,u,"throw",e)}a(void 0)}))}}function _(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,l=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return M(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?M(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function N(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?N(Object(n),!0).forEach((function(t){T(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function T(e,t,n){return(t=function(e){var t=function(e){if("object"!=L(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=L(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==L(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var A,I,C,z,R=400,D=.7,H=function(){return{id:Math.ceil(1e3*Math.random()),children:a().createElement("div",null)}},B={},G=!1,J=[],V=(new Date).getTime(),F=function(e){var t=e.defaultCurrent,n=e.getNext,r=e.getPrev,o=e.onSwipe,u=e.className,l=e.invitationAnimation,s=e.durationAnimation,d=e.blockSwipe,f=e.dots,v=_((0,i.useState)(),2),p=v[0],h=v[1],m=_((0,i.useState)(),2),y=m[0],b=m[1],g=_((0,i.useState)(),2),x=g[0],w=g[1],E=_((0,i.useState)(),2),L=E[0],O=E[1],M=_((0,i.useState)(),2),N=M[0],T=M[1],F=_((0,i.useState)(0),2),W=F[0],Y=F[1],q=_((0,i.useState)(0),2),U=q[0],X=q[1],K=_((0,i.useState)(0),2),Z=K[0],Q=K[1],$=_((0,i.useState)(0),2),ee=$[0],te=$[1],ne=_((0,i.useState)(0),2),re=ne[0],oe=ne[1],ie=_((0,i.useState)(),2),ae=ie[0],ue=ie[1],ce=_((0,i.useState)(!1),2),le=ce[0],se=ce[1],de=(0,i.useRef)(null);void 0===z&&(z=t);var fe=(0,i.useMemo)((function(){return function(e,t,n,r){return(null==e?void 0:e.id)!==(null==t?void 0:t.id)&&(null==t?void 0:t.id)!==(null==n?void 0:n.id)&&(null==n?void 0:n.id)!==(null==e?void 0:e.id)||!r.length?[1,2,3].map((function(r){var o=1===r?P({},e):2===r?t:P({},n);return o.type=1===r?"prev":2===r?"current":"next",o})):r}(y||H(),p||t,x||H(),J)}),[x,y,p]);J=fe;var ve=function(e){return B[e]=B[e]?B[e]:(0,i.createRef)(),B[e]},pe=(0,i.useMemo)((function(){return function(e,t){var n,r,o;null===(n=ve((null==e?void 0:e.id)||(null==x?void 0:x.id)||0).current)||void 0===n||n.classList.add(k.go),null===(r=ve((null==t?void 0:t.id)||(null==y?void 0:y.id)||0).current)||void 0===r||r.classList.add(k.go),null===(o=ve((null==p?void 0:p.id)||0).current)||void 0===o||o.classList.add(k.go),setTimeout((function(){var n,r,o;null===(n=ve((null==e?void 0:e.id)||(null==x?void 0:x.id)||0).current)||void 0===n||n.classList.remove(k.go),null===(r=ve((null==t?void 0:t.id)||(null==y?void 0:y.id)||0).current)||void 0===r||r.classList.remove(k.go),null===(o=ve((null==p?void 0:p.id)||0).current)||void 0===o||o.classList.remove(k.go)}),R)}}),[null==p?void 0:p.id,null==x?void 0:x.id,null==y?void 0:y.id]),he=(0,i.useMemo)((function(){return function(){var e,t,n;null===(e=ve((null==x?void 0:x.id)||0).current)||void 0===e||e.classList.add(k.back),null===(t=ve((null==y?void 0:y.id)||0).current)||void 0===t||t.classList.add(k.back),null===(n=ve((null==p?void 0:p.id)||0).current)||void 0===n||n.classList.add(k.back),setTimeout((function(){var e,t,n;null===(e=ve((null==x?void 0:x.id)||0).current)||void 0===e||e.classList.remove(k.back),null===(t=ve((null==y?void 0:y.id)||0).current)||void 0===t||t.classList.remove(k.back),null===(n=ve((null==p?void 0:p.id)||0).current)||void 0===n||n.classList.remove(k.back)}),R)}}),[null==p?void 0:p.id,null==x?void 0:x.id,null==y?void 0:y.id]),me=function(){var e=j(S().mark((function e(t){return S().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e){setTimeout((function(){e(0)}),t)}));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ye=(0,i.useMemo)((function(){return function(e,t){e&&r((null==e?void 0:e.id)||0).then((function(e){O(e)})),t&&n((null==t?void 0:t.id)||0).then((function(e){T(e)}))}}),[n,r]),be=(0,i.useMemo)((function(){return function(){he(),oe(0),se(!1)}}),[he,oe,se]),ge=(0,i.useMemo)((function(){return function(e,t,n){pe(e,t),oe(n)}}),[pe]),xe=(0,i.useMemo)((function(){return function(e){var t=e._prev,n=e._current,r=e._next;oe(0),b(t),h(n),w(r)}}),[]),we=(0,i.useMemo)((function(){return function(){var e=j(S().mark((function e(t,n,r){var i,a,u;return S().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=t.newNext,a=t.newPrev,u=t.coeff,null!==(null==n?void 0:n.id)&&null!==(null==r?void 0:r.id)){e.next=4;break}return be(),e.abrupt("return",1);case 4:return void 0!==o&&o((null==n?void 0:n.id)||(null==r?void 0:r.id)),ge(n,r,W*u),e.next=8,me(R);case 8:return xe({_prev:a,_current:n||r,_next:i}),e.abrupt("return",0);case 10:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}()}),[xe,be,o,ge,W]),Ee=(0,i.useMemo)((function(){return function(){var e=j(S().mark((function e(t){var n,r,o,i;return S().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t._lastLeft,r=t._next,o=t._prev,i=t.speed,se(!0),!(Math.abs(n)>Z/3||void 0!==i&&i>D)){e.next=12;break}if(!(n<0)){e.next=8;break}return e.next=6,we({newPrev:p,newNext:N,coeff:-1},r,void 0);case 6:e.next=10;break;case 8:return e.next=10,we({newPrev:L,newNext:p,coeff:1},void 0,o);case 10:e.next=13;break;case 12:be();case 13:return se(!1),e.abrupt("return",0);case 15:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}),[p,be,Z,L,N,we]),ke=(0,i.useMemo)((function(){return function(){var e=j(S().mark((function e(t,n){var r,o,i,a,u,c;return S().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=n.touches,a=null===(r=i[0])||void 0===r?void 0:r.clientX,u=null===(o=i[0])||void 0===o?void 0:o.clientY,A=A||0,I=I||0,c=0,e.t0=t,e.next="onTouchStart"===e.t0?10:"onTouchMove"===e.t0?15:"onTouchEnd"===e.t0?17:21;break;case 10:return A=a,I=u,C=ee,V=(new Date).getTime(),e.abrupt("break",21);case 15:return d||(c=Math.abs(I-u),Math.abs(A-a)>c&&oe(C=ee-(A-a))),e.abrupt("break",21);case 17:if(d){e.next=20;break}return e.next=20,Ee({_lastLeft:C,speed:Math.abs(C/((new Date).getTime()-V)),_next:x,_prev:y});case 20:return e.abrupt("break",21);case 21:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()}),[ee,d,Ee,x,y]),Le=function(e){return function(t){ke(e,t)}},Se=(0,i.useMemo)((function(){return function(e){var t="next"===e;return j(S().mark((function e(){var n;return S().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Z*(t?-1:1),t?pe():he(),e.next=5,me(R);case 5:return e.next=7,Ee({_lastLeft:n,_next:x,_prev:y});case 7:return e.abrupt("return",0);case 8:case"end":return e.stop()}}),e)})))}}),[he,pe,Ee,Z,x,y]),Oe=Se("next"),je=Se("prev"),_e=(0,i.useMemo)((function(){return function(){var e=j(S().mark((function e(t){return S().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t<0?pe():he(),oe(t),e.next=4,me(R);case 4:return t<0?he():pe(),oe(0),e.next=8,me(R);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}),[he,pe]),Me=(0,i.useMemo)((function(){return j(S().mark((function e(){var o,i;return S().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n(t.id||0);case 2:return o=e.sent,e.next=5,r(t.id||0);case 5:i=e.sent,h(t),b(i),w(o),z=t,se(!1);case 11:case"end":return e.stop()}}),e)})))}),[t,n,r]),Ne=(0,i.useMemo)((function(){return function(){var e=j(S().mark((function e(t,n){return S().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.id){e.next=3;break}return e.next=3,_e(W/5.5);case 3:if(!n.id){e.next=6;break}return e.next=6,_e(W/5.5*-1);case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()}),[_e,W]),Pe=(0,i.useMemo)((function(){return function(){var e=j(S().mark((function e(t){var o,i,a,u,c,l,s,d,f;return S().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=t.target,i=null==o?void 0:o.getAttribute("tabindex"),a=parseInt(i,10),(u=(null==p?void 0:p.id)||0)!==(null==x?void 0:x.id)){e.next=10;break}c=x,s=N,l=p,e.next=41;break;case 10:if(u!==(null==y?void 0:y.id)){e.next=16;break}c=y,s=p,l=L,e.next=41;break;case 16:if(u!==(null==L?void 0:L.id)){e.next=24;break}return c=L,s=y,e.next=21,r(null==L?void 0:L.id);case 21:l=e.sent,e.next=41;break;case 24:if(u!==(null==N?void 0:N.id)){e.next=32;break}return c=N,l=x,e.next=29,r(null==N?void 0:N.id);case 29:s=e.sent,e.next=41;break;case 32:return e.next=34,n(a-1);case 34:return c=e.sent,e.next=37,n((null===(d=c)||void 0===d?void 0:d.id)||0);case 37:return s=e.sent,e.next=40,r((null===(f=c)||void 0===f?void 0:f.id)||0);case 40:l=e.sent;case 41:if(!(u<a)){e.next=46;break}return e.next=44,we({newPrev:l,newNext:s,coeff:-1},c,void 0);case 44:e.next=48;break;case 46:return e.next=48,we({newPrev:l,newNext:s,coeff:1},void 0,c);case 48:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}),[n,r,we,p,x,N,L,y]);return(0,i.useEffect)((function(){var e,t,n=null==p||null===(e=p.nextRef)||void 0===e?void 0:e.current,r=null==p||null===(t=p.closeRef)||void 0===t?void 0:t.current;return null==n||n.addEventListener("click",Oe),null==r||r.addEventListener("click",Oe),function(){null==n||n.removeEventListener("click",Oe),null==r||r.removeEventListener("click",Oe)}}),[Oe,p]),(0,i.useEffect)((function(){var e,t,n=null==de||null===(e=de.current)||void 0===e||null===(e=e.parentElement)||void 0===e||null===(e=e.getBoundingClientRect())||void 0===e?void 0:e.width,r=null==de||null===(t=de.current)||void 0===t||null===(t=t.parentElement)||void 0===t||null===(t=t.getBoundingClientRect())||void 0===t?void 0:t.height;n&&!Z&&r&&!U&&(Q(n),X(r))}),[de,Z,U]),(0,i.useEffect)((function(){var e,t=null==de||null===(e=de.current)||void 0===e||null===(e=e.parentElement)||void 0===e||null===(e=e.getBoundingClientRect())||void 0===e?void 0:e.left;t&&!re&&te(t)}),[de,re]),(0,i.useEffect)((function(){var e;return s&&(e=setInterval((function(){Oe()}),s)),function(){e&&clearInterval(e)}}),[s,Oe]),(0,i.useEffect)((function(){p&&y&&x&&z===t||Me()}),[p,x,y,t,Me]),(0,i.useEffect)((function(){var e=document.body.clientWidth;!W&&e&&Y(e)}),[W]),(0,i.useEffect)((function(){l&&Z&&!G&&y&&x&&(G=!0,Ne(y,x))}),[l,x,y,Ne,Z]),(0,i.useEffect)((function(){var e=function(){var e,t,n,r=null==de||null===(e=de.current)||void 0===e||null===(e=e.parentElement)||void 0===e||null===(e=e.getBoundingClientRect())||void 0===e?void 0:e.width,o=null==de||null===(t=de.current)||void 0===t||null===(t=t.parentElement)||void 0===t||null===(t=t.getBoundingClientRect())||void 0===t?void 0:t.height,i=null==de||null===(n=de.current)||void 0===n||null===(n=n.parentElement)||void 0===n||null===(n=n.getBoundingClientRect())||void 0===n?void 0:n.left,a=document.body.clientWidth;r&&o&&(Q(r),X(o)),i&&oe(i),a&&Y(a)};return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]),(0,i.useEffect)((function(){var e;void 0===ae&&ue("ontouchstart"in window||void 0!==(null===(e=navigator)||void 0===e?void 0:e.msMaxTouchPoints))}),[ae]),(0,i.useEffect)((function(){ye(y,x)}),[y,x,ye]),a().createElement("div",{className:k.container,ref:de},fe.map((function(e){var t;return a().createElement(i.Fragment,{key:e.id},null!==e.id&&null!==e.children&&Z&&a().createElement("div",{onTouchMove:Le("onTouchMove"),onTouchStart:Le("onTouchStart"),onTouchEnd:Le("onTouchEnd"),id:null===(t=e.id)||void 0===t?void 0:t.toString(),style:"current"===e.type?{width:Z,height:U,left:re}:"prev"===e.type?{width:Z,height:U,left:re-window.innerWidth}:{width:Z,height:U,left:re+window.innerWidth},className:c(k.card,"prev"===e.type?k.prev:"next"===e.type?k.next:""),ref:ve(e.id)},a().createElement("div",{className:c(k.content,u)},e.children)),null===e.id&&a().createElement("div",{style:"current"===e.type?{width:Z,height:U,left:re}:"prev"===e.type?{width:Z,height:U,left:re-W}:{width:Z,height:U,left:re+W},className:c(k.card,"prev"===e.type?k.prev:"next"===e.type?k.next:"")},a().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#000000"},a().createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),a().createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12zm8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8z"}))))})),void 0!==ae&&!ae&&null!==(null==y?void 0:y.id)&&a().createElement("div",{className:c(k.button,k.button__prev)},a().createElement("button",{className:k.icon__button,type:"button",disabled:le||ae,onClick:je},a().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#000000"},a().createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),a().createElement("path",{d:"M10.02 6L8.61 7.41 13.19 12l-4.58 4.59L10.02 18l6-6-6-6z"})))),void 0!==ae&&!ae&&null!==(null==x?void 0:x.id)&&a().createElement("div",{className:c(k.button,k.button__next)},a().createElement("button",{className:k.icon__button,type:"button",disabled:le||ae,onClick:Oe},a().createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:"24px",viewBox:"0 0 24 24",width:"24px",fill:"#000000"},a().createElement("path",{d:"M0 0h24v24H0V0z",fill:"none"}),a().createElement("path",{d:"M10.02 6L8.61 7.41 13.19 12l-4.58 4.59L10.02 18l6-6-6-6z"})))),f&&a().createElement("div",{className:k.dots},f.list.map((function(e){return a().createElement("div",{role:"button",onClick:Pe,tabIndex:e,key:e,className:c(k.dot,(null==p?void 0:p.id)===e?k.active:"")})}))))};return o})()));
@@ -0,0 +1 @@
1
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ **3.0.0-25.03.2022**
4
+
5
+ - Remove matetial ui library. Use custom css, required import `swiper/dist/index.css`.
@@ -0,0 +1,6 @@
1
+ /** @type {import('next').NextConfig} */
2
+ const nextConfig = {
3
+ reactStrictMode: true,
4
+ };
5
+
6
+ export default nextConfig;
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@kolserdav/swiper",
3
- "version": "4.2.2",
3
+ "version": "4.3.0",
4
4
  "description": "Simple and powerfull react swiper component",
5
5
  "author": "kolserdav",
6
6
  "license": "MIT",
7
7
  "repository": "https://github.com/kolserdav/react-swiper",
8
- "main": "dist/index.js",
9
- "source": "src/package/index.tsx",
8
+ "main": "dist/Swiper.js",
9
+ "source": "src/components",
10
10
  "engines": {
11
- "node": ">=10"
11
+ "node": ">=18"
12
12
  },
13
13
  "keywords": [
14
14
  "react",
@@ -17,61 +17,44 @@
17
17
  "event",
18
18
  "slider"
19
19
  ],
20
+ "type": "module",
20
21
  "scripts": {
21
- "start": "react-scripts start",
22
- "dev": "npm run start",
23
- "compile": "webpack --env NODE_ENV=production",
24
- "build": "npm run compile && react-scripts build",
25
- "test:lint": "eslint .",
26
- "test:unit": "cross-env CI=1 react-scripts test --env=jsdom ",
27
- "test:watch": "react-scripts test --env=jsdom",
28
- "deploy": "gh-pages -d build"
22
+ "dev": "next dev",
23
+ "compile": "rimraf dist && webpack --mode production && npm run types",
24
+ "build": "next build",
25
+ "start": "next start",
26
+ "lint": "next lint",
27
+ "types": "tsc --noEmit false --declaration --emitDeclarationOnly --outDir ./dist -p .",
28
+ "fhead": "fhead"
29
+ },
30
+ "dependencies": {
31
+ "clsx": "^2.1.1",
32
+ "next": "14.2.8",
33
+ "react": "^18",
34
+ "react-dom": "^18",
35
+ "save-dev": "^0.0.1-security"
29
36
  },
30
37
  "devDependencies": {
31
- "@testing-library/jest-dom": "^4.2.4",
32
- "@testing-library/react": "^9.5.0",
33
- "@testing-library/user-event": "^7.2.1",
34
- "@types/jest": "^25.1.4",
35
- "@types/node": "^16.18.8",
36
- "@types/react": "^18.0.26",
37
- "@types/react-dom": "^18.0.9",
38
- "@typescript-eslint/parser": "^5.46.1",
39
- "babel-eslint": "^10.0.3",
40
- "clean-webpack-plugin": "^4.0.0",
41
- "cross-env": "^7.0.2",
42
- "css-loader": "^6.7.2",
43
- "eslint": "^8.29.0",
44
- "eslint-config-prettier": "^8.5.0",
45
- "eslint-config-standard": "^17.0.0",
46
- "eslint-config-standard-react": "^12.0.0",
47
- "eslint-plugin-eslint-plugin": "^5.0.6",
48
- "eslint-plugin-import": "^2.26.0",
49
- "eslint-plugin-node": "^11.1.0",
50
- "eslint-plugin-prettier": "^4.2.1",
51
- "eslint-plugin-promise": "^6.1.1",
52
- "eslint-plugin-react": "^7.31.11",
53
- "eslint-plugin-standard": "^5.0.0",
54
- "gh-pages": "^2.2.0",
55
- "mini-css-extract-plugin": "^2.7.2",
56
- "postcss-loader": "^7.0.2",
57
- "prettier": "^2.0.4",
58
- "react": "^18.2.0",
59
- "react-dom": "^18.2.0",
60
- "react-scripts": "^5.0.1",
61
- "sass": "^1.64.1",
62
- "sass-loader": "^13.3.2",
63
- "source-map-loader": "^4.0.1",
64
- "ts-loader": "^9.4.2",
65
- "typescript": "^4.9.4",
38
+ "@babel/preset-env": "^7.25.4",
39
+ "@babel/preset-flow": "^7.24.7",
40
+ "@babel/preset-react": "^7.24.7",
41
+ "@babel/preset-typescript": "^7.24.7",
42
+ "@types/node": "^20.16.5",
43
+ "@types/react": "^18",
44
+ "@types/react-dom": "^18",
45
+ "@types/webpack": "^5.28.5",
46
+ "@types/webpack-env": "^1.18.5",
47
+ "babel-loader": "^9.1.3",
48
+ "css-loader": "^7.1.2",
49
+ "eslint": "^8",
50
+ "eslint-config-next": "14.2.8",
51
+ "fhead": "^3.2.8",
52
+ "rimraf": "^6.0.1",
53
+ "style-loader": "^4.0.0",
54
+ "ts-loader": "^9.5.1",
55
+ "typescript": "^5",
66
56
  "webpack-cli": "^5.1.4"
67
57
  },
68
- "files": [
69
- "dist"
70
- ],
71
- "dependencies": {
72
- "clsx": "^1.1.1",
73
- "uuid": "^8.3.2"
74
- },
75
58
  "fhead": {
76
59
  "root": ".",
77
60
  "repository": "https://github.com/kolserdav/react-swiper.git",
@@ -84,22 +67,10 @@
84
67
  ".next"
85
68
  ],
86
69
  "name": "Sergey Kolmiller",
87
- "email": "serega12101983@gmail.com",
70
+ "email": "kolserdav@conhos.ru",
88
71
  "license": "MIT",
89
72
  "licenseText": "The code is distributed as is. There are no guarantees regarding the functionality of the code or parts of it.",
90
73
  "copyright": "kolserdav, All rights reserved (c)",
91
74
  "renewAll": false
92
- },
93
- "browserslist": {
94
- "production": [
95
- ">0.2%",
96
- "not dead",
97
- "not op_mini all"
98
- ],
99
- "development": [
100
- "last 1 chrome version",
101
- "last 1 firefox version",
102
- "last 1 safari version"
103
- ]
104
75
  }
105
76
  }
package/pages/_app.tsx ADDED
@@ -0,0 +1,16 @@
1
+ /******************************************************************************************
2
+ * Repository: https://github.com/kolserdav/react-swiper.git
3
+ * File name: _app.tsx
4
+ * Author: Sergey Kolmiller
5
+ * Email: <kolserdav@conhos.ru>
6
+ * License: MIT
7
+ * License text: The code is distributed as is. There are no guarantees regarding the functionality of the code or parts of it.
8
+ * Copyright: kolserdav, All rights reserved (c)
9
+ * Create Date: Fri Sep 06 2024 18:44:44 GMT+0700 (Krasnoyarsk Standard Time)
10
+ ******************************************************************************************/
11
+ import "@/styles/globals.css";
12
+ import type { AppProps } from "next/app";
13
+
14
+ export default function App({ Component, pageProps }: AppProps) {
15
+ return <Component {...pageProps} />;
16
+ }
@@ -0,0 +1,23 @@
1
+ /******************************************************************************************
2
+ * Repository: https://github.com/kolserdav/react-swiper.git
3
+ * File name: _document.tsx
4
+ * Author: Sergey Kolmiller
5
+ * Email: <kolserdav@conhos.ru>
6
+ * License: MIT
7
+ * License text: The code is distributed as is. There are no guarantees regarding the functionality of the code or parts of it.
8
+ * Copyright: kolserdav, All rights reserved (c)
9
+ * Create Date: Fri Sep 06 2024 18:44:44 GMT+0700 (Krasnoyarsk Standard Time)
10
+ ******************************************************************************************/
11
+ import { Html, Head, Main, NextScript } from "next/document";
12
+
13
+ export default function Document() {
14
+ return (
15
+ <Html lang="en">
16
+ <Head />
17
+ <body>
18
+ <Main />
19
+ <NextScript />
20
+ </body>
21
+ </Html>
22
+ );
23
+ }
@@ -0,0 +1,23 @@
1
+ /******************************************************************************************
2
+ * Repository: https://github.com/kolserdav/react-swiper.git
3
+ * File name: hello.ts
4
+ * Author: Sergey Kolmiller
5
+ * Email: <kolserdav@conhos.ru>
6
+ * License: MIT
7
+ * License text: The code is distributed as is. There are no guarantees regarding the functionality of the code or parts of it.
8
+ * Copyright: kolserdav, All rights reserved (c)
9
+ * Create Date: Fri Sep 06 2024 18:44:44 GMT+0700 (Krasnoyarsk Standard Time)
10
+ ******************************************************************************************/
11
+ // Next.js API route support: https://nextjs.org/docs/api-routes/introduction
12
+ import type { NextApiRequest, NextApiResponse } from "next";
13
+
14
+ type Data = {
15
+ name: string;
16
+ };
17
+
18
+ export default function handler(
19
+ req: NextApiRequest,
20
+ res: NextApiResponse<Data>,
21
+ ) {
22
+ res.status(200).json({ name: "John Doe" });
23
+ }
Binary file
Binary file
@@ -0,0 +1,74 @@
1
+ /******************************************************************************************
2
+ * Repository: https://github.com/kolserdav/react-swiper.git
3
+ * File name: index.tsx
4
+ * Author: Sergey Kolmiller
5
+ * Email: <kolserdav@conhos.ru>
6
+ * License: MIT
7
+ * License text: The code is distributed as is. There are no guarantees regarding the functionality of the code or parts of it.
8
+ * Copyright: kolserdav, All rights reserved (c)
9
+ * Create Date: Fri Sep 06 2024 18:44:44 GMT+0700 (Krasnoyarsk Standard Time)
10
+ ******************************************************************************************/
11
+ import s from "@/styles/Home.module.css";
12
+ import { GetSwipeHandler, Swipe, Swiper } from "@/src/components/Swiper";
13
+ import { useEffect, useState } from "react";
14
+
15
+ const COUNT = 6;
16
+ const LAG = 25;
17
+
18
+ const getNext: GetSwipeHandler = async (old) => {
19
+ let id: any = old + 1;
20
+ id = id <= COUNT ? id : 0;
21
+ return new Promise((resolve) => {
22
+ setTimeout(() => {
23
+ resolve({
24
+ id,
25
+ children: <h1>Test {id}</h1>,
26
+ });
27
+ }, LAG);
28
+ });
29
+ };
30
+
31
+ const getPrevios: GetSwipeHandler = async (old) => {
32
+ let id = old - 1;
33
+ id = id >= 0 ? id : COUNT;
34
+ return new Promise((resolve) => {
35
+ setTimeout(() => {
36
+ resolve({
37
+ id,
38
+ children: <h1>Test {id}</h1>,
39
+ });
40
+ }, LAG);
41
+ });
42
+ };
43
+
44
+ const App = (): React.ReactElement => {
45
+ const [current, setCurrent] = useState<Swipe>();
46
+ useEffect(() => {
47
+ if (!current) {
48
+ (async () => {
49
+ setCurrent(await getNext(-1));
50
+ })();
51
+ }
52
+ }, [current]);
53
+
54
+ return (
55
+ <div className={s.container}>
56
+ {current && (
57
+ <Swiper
58
+ blockSwipe={false}
59
+ defaultCurrent={current}
60
+ getNext={getNext}
61
+ getPrev={getPrevios}
62
+ invitationAnimation={true}
63
+ className="card__content"
64
+ dots={{
65
+ list: [0, 1, 2, 3, 4, 5, 6],
66
+ active: current.id || 1,
67
+ }}
68
+ />
69
+ )}
70
+ </div>
71
+ );
72
+ };
73
+
74
+ export default App;
Binary file