Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

6pp

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

6pp - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

src/hooks/fetching.tsx

2

dist/bundle.js
/*! For license information please see bundle.js.LICENSE.txt */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports["6pp"]=e(require("react")):t["6pp"]=e(t.react)}(self,(t=>(()=>{"use strict";var e={156:e=>{e.exports=t}},r={};function n(t){var o=r[t];if(void 0!==o)return o.exports;var i=r[t]={exports:{}};return e[t](i,i.exports,n),i.exports}n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return(()=>{n.r(o),n.d(o,{PageStepper:()=>_,Pagination:()=>I,isDateBetween:()=>j,isIncludeCapitalLetter:()=>h,isIncludeLowercaseLetter:()=>p,isIncludeNumber:()=>s,isIncludeSpecialChar:()=>y,isValidDate:()=>b,isValidDateTime:()=>S,isValidEmail:()=>d,isValidPhoneNumber:()=>g,isValidTime:()=>w,isValidUrl:()=>m,isValidUsername:()=>v,useFetchData:()=>f,useInputValidation:()=>P,useStrongPassword:()=>x});var t=n(156),e=new Map;function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(){i=function(){return e};var t,e={},n=Object.prototype,o=n.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function y(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,i=Object.create(o.prototype),u=new _(n||[]);return a(i,"_invoke",{value:A(t,r,u)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=y;var p="suspendedStart",d="suspendedYield",v="executing",m="completed",g={};function b(){}function w(){}function S(){}var j={};s(j,c,(function(){return this}));var E=Object.getPrototypeOf,O=E&&E(E(T([])));O&&O!==n&&o.call(O,c)&&(j=O);var x=S.prototype=b.prototype=Object.create(j);function P(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function L(t,e){function n(i,a,u,c){var l=h(t[i],t,a);if("throw"!==l.type){var f=l.arg,s=f.value;return s&&"object"==r(s)&&o.call(s,"__await")?e.resolve(s.__await).then((function(t){n("next",t,u,c)}),(function(t){n("throw",t,u,c)})):e.resolve(s).then((function(t){f.value=t,u(f)}),(function(t){return n("throw",t,u,c)}))}c(l.arg)}var i;a(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function A(e,r,n){var o=p;return function(i,a){if(o===v)throw new Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=k(u,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var l=h(e,r,n);if("normal"===l.type){if(o=n.done?m:d,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=m,n.method="throw",n.arg=l.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function T(e){if(e||""===e){var n=e[c];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function r(){for(;++i<e.length;)if(o.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(r(e)+" is not iterable")}return w.prototype=S,a(x,"constructor",{value:S,configurable:!0}),a(S,"constructor",{value:w,configurable:!0}),w.displayName=s(S,f,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,S):(t.__proto__=S,s(t,f,"GeneratorFunction")),t.prototype=Object.create(x),t},e.awrap=function(t){return{__await:t}},P(L.prototype),s(L.prototype,l,(function(){return this})),e.AsyncIterator=L,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new L(y(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},P(x),s(x,f,"Generator"),s(x,c,(function(){return this})),s(x,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=T,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var c=o.call(a,"catchLoc"),l=o.call(a,"finallyLoc");if(c&&l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function a(t,e,r,n,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function u(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||c(t,e)||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 c(t,e){if(t){if("string"==typeof t)return l(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(t,e):void 0}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var f=function(r,n){var o,f=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],s=u((0,t.useState)(),2),y=s[0],h=s[1],p=u((0,t.useState)(!1),2),d=p[0],v=p[1],m=u((0,t.useState)(""),2),g=m[0],b=m[1],w=u((0,t.useState)(0),2),S=w[0],j=w[1];return(0,t.useEffect)((function(){var t=new AbortController;if(!e.has(n))return v(!0),fetch(r,{credentials:"include",signal:t.signal}).then(function(){var t,r=(t=i().mark((function t(r){var o;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.json();case 2:if(o=t.sent,r.ok){t.next=7;break}throw new Error(o.message||"Errro while fetching!");case 7:h(o),e.set(n,JSON.stringify(o));case 9:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function u(t){a(i,n,o,u,c,"next",t)}function c(t){a(i,n,o,u,c,"throw",t)}u(void 0)}))});return function(t){return r.apply(this,arguments)}}()).catch((function(t){"AbortError"!==t.name&&b(t.message||"Something went wrong!")})).finally((function(){return v(!1)})),function(){t.abort()};h(JSON.parse(e.get(n)))}),[S].concat(function(t){if(Array.isArray(t))return l(t)}(o=f)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(o)||c(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())),{data:y,loading:d,error:g,refetch:function(){e.delete(n),j((function(t){return t+1}))},clearCache:function(){e.delete(n)}}},s=function(t){return/\d/.test(t)},y=function(t){return/[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/.test(t)},h=function(t){return/[A-Z]/.test(t)},p=function(t){return/[a-z]/.test(t)},d=function(t){return/\S+@\S+\.\S+/.test(t)},v=function(t){return/^[a-zA-Z0-9]+$/.test(t)},m=function(t){try{return new URL(t),!0}catch(t){return!1}},g=function(t){return/^\d{10}$/.test(t)},b=function(t){return/^\d{4}-\d{2}-\d{2}$/.test(t)},w=function(t){return/^\d{2}:\d{2}$/.test(t)},S=function(t){return/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/.test(t)},j=function(t,e,r){var n=new Date(t),o=new Date(e),i=new Date(r);return o<=n&&n<=i};function E(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return O(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?O(t,e):void 0}}(t,e)||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 O(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var x=function(){var e=E((0,t.useState)(""),2),r=e[0],n=e[1],o=E((0,t.useState)(""),2),i=o[0],a=o[1];return{error:r,value:i,changeHandler:function(t){var e=t.target.value;a(e);var r=[];e.length<8&&r.push("at least 8 characters"),s(e)||r.push("a number"),y(e)||r.push("a special"),h(e)||r.push("a capital"),p(e)||r.push("a lowercase"),n(r.length>0?"Password must include ".concat(r.join(", ")," character"):"")}}},P=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=E((0,t.useState)(e),2),o=n[0],i=n[1],a=E((0,t.useState)(""),2),u=a[0],c=a[1];return{value:o,changeHandler:function(t){var e;e="number"==typeof o?Number(t.target.value):t.target.value,i(e);var n=r(e);c(n?n.errorMessage:"")},error:u}};function L(t){return L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},L(t)}function A(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function k(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function C(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?k(Object(r),!0).forEach((function(e){var n,o,i,a;n=t,o=e,i=r[e],a=function(t,e){if("object"!=L(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=L(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(o),(o="symbol"==L(a)?a:String(a))in n?Object.defineProperty(n,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[o]=i})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):k(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var I=function(e){var r,n,o=e.totalPages,i=void 0===o?1:o,a=e.currPage,u=e.setCurrPage,c=e.activeButtonStyle,l=void 0===c?{backgroundColor:"black",color:"white"}:c,f=e.Button,s=void 0===f?function(e){var r=e.children,n=e.onClick,o=e.style;return t.createElement("button",{style:C({padding:"0.5rem 1rem",outline:"none",border:"none",borderRadius:"0.5rem",cursor:"pointer",backgroundColor:"#e2e8f0"},o),onClick:n},r)}:f,y=e.Container,h=void 0===y?function(e){var r=e.children;return t.createElement("ul",{style:{display:"flex",gap:"1rem",listStyle:"none"}},r)}:y,p=(r=(0,t.useState)(1),n=2,function(t){if(Array.isArray(t))return t}(r)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(r,n)||function(t,e){if(t){if("string"==typeof t)return A(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?A(t,e):void 0}}(r,n)||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.")}()),d=p[0],v=p[1];return t.createElement(h,null,t.createElement(t.Fragment,null,d>1&&t.createElement("li",null,t.createElement(s,{onClick:function(){return v((function(t){return t-4}))}},"Prev")),Array.from({length:Math.min(4,i)},(function(t,e){return d+e})).map((function(e){return t.createElement("li",{key:e},t.createElement(s,{style:a===e?l:{},onClick:function(){return function(t){u(t),t>d+4-1?v(t):t<d&&v(t-4+1)}(e)}},e))})),i>d+4-1&&t.createElement("li",null,t.createElement(s,{onClick:function(){return v((function(t){return t+4}))}},"Next"))))},_=function(e){var r=e.totalPages,n=void 0===r?1:r,o=e.currPage,i=e.setCurrPage,a=e.Typography,u=void 0===a?function(e){var r=e.children;return t.createElement("code",null,r)}:a,c=e.Button,l=e.Container,f=void 0===l?function(e){var r=e.children;return t.createElement("nav",{style:{display:"flex",alignItems:"center",gap:"1rem",padding:"1rem 0"}},r)}:l,s=1===o,y=o===n;return t.createElement(f,null,t.createElement(t.Fragment,null,t.createElement(c,{disabled:s,onClick:function(){1!==o&&i((function(t){return t-1}))}},"Previous"),t.createElement(u,null,o," of ",n),t.createElement(c,{disabled:y,onClick:function(){o!==n&&i((function(t){return t+1}))}},"Next")))}})(),o})()));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports["6pp"]=e(require("react")):t["6pp"]=e(t.react)}(self,(t=>(()=>{"use strict";var e={156:e=>{e.exports=t}},r={};function n(t){var o=r[t];if(void 0!==o)return o.exports;var i=r[t]={exports:{}};return e[t](i,i.exports,n),i.exports}n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return(()=>{n.r(o),n.d(o,{PageStepper:()=>D,Pagination:()=>N,isDateBetween:()=>j,isIncludeCapitalLetter:()=>h,isIncludeLowercaseLetter:()=>p,isIncludeNumber:()=>s,isIncludeSpecialChar:()=>y,isValidDate:()=>b,isValidDateTime:()=>S,isValidEmail:()=>d,isValidPhoneNumber:()=>g,isValidTime:()=>w,isValidUrl:()=>m,isValidUsername:()=>v,useFetchData:()=>f,useFileHandler:()=>P,useInputValidation:()=>k,useStrongPassword:()=>L});var t=n(156),e=new Map;function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function i(){i=function(){return e};var t,e={},n=Object.prototype,o=n.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},u="function"==typeof Symbol?Symbol:{},l=u.iterator||"@@iterator",c=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function y(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,i=Object.create(o.prototype),u=new T(n||[]);return a(i,"_invoke",{value:L(t,r,u)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=y;var p="suspendedStart",d="suspendedYield",v="executing",m="completed",g={};function b(){}function w(){}function S(){}var j={};s(j,l,(function(){return this}));var E=Object.getPrototypeOf,O=E&&E(E(_([])));O&&O!==n&&o.call(O,l)&&(j=O);var x=S.prototype=b.prototype=Object.create(j);function A(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function n(i,a,u,l){var c=h(t[i],t,a);if("throw"!==c.type){var f=c.arg,s=f.value;return s&&"object"==r(s)&&o.call(s,"__await")?e.resolve(s.__await).then((function(t){n("next",t,u,l)}),(function(t){n("throw",t,u,l)})):e.resolve(s).then((function(t){f.value=t,u(f)}),(function(t){return n("throw",t,u,l)}))}l(c.arg)}var i;a(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function L(e,r,n){var o=p;return function(i,a){if(o===v)throw new Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var l=k(u,n);if(l){if(l===g)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var c=h(e,r,n);if("normal"===c.type){if(o=n.done?m:d,c.arg===g)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=m,n.method="throw",n.arg=c.arg)}}}function k(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function I(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function _(e){if(e||""===e){var n=e[l];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function r(){for(;++i<e.length;)if(o.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(r(e)+" is not iterable")}return w.prototype=S,a(x,"constructor",{value:S,configurable:!0}),a(S,"constructor",{value:w,configurable:!0}),w.displayName=s(S,f,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,S):(t.__proto__=S,s(t,f,"GeneratorFunction")),t.prototype=Object.create(x),t},e.awrap=function(t){return{__await:t}},A(P.prototype),s(P.prototype,c,(function(){return this})),e.AsyncIterator=P,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new P(y(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},A(x),s(x,f,"Generator"),s(x,l,(function(){return this})),s(x,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=_,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return u.type="throw",u.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var l=o.call(a,"catchLoc"),c=o.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),C(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;C(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:_(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function a(t,e,r,n,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void r(t)}u.done?e(l):Promise.resolve(l).then(n,o)}function u(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||l(t,e)||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 l(t,e){if(t){if("string"==typeof t)return c(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(t,e):void 0}}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var f=function(r,n){var o,f=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],s=u((0,t.useState)(),2),y=s[0],h=s[1],p=u((0,t.useState)(!1),2),d=p[0],v=p[1],m=u((0,t.useState)(""),2),g=m[0],b=m[1],w=u((0,t.useState)(0),2),S=w[0],j=w[1];return(0,t.useEffect)((function(){var t=new AbortController;if(!e.has(n))return v(!0),fetch(r,{credentials:"include",signal:t.signal}).then(function(){var t,r=(t=i().mark((function t(r){var o;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.json();case 2:if(o=t.sent,r.ok){t.next=7;break}throw new Error(o.message||"Errro while fetching!");case 7:h(o),e.set(n,JSON.stringify(o));case 9:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function u(t){a(i,n,o,u,l,"next",t)}function l(t){a(i,n,o,u,l,"throw",t)}u(void 0)}))});return function(t){return r.apply(this,arguments)}}()).catch((function(t){"AbortError"!==t.name&&b(t.message||"Something went wrong!")})).finally((function(){return v(!1)})),function(){t.abort()};h(JSON.parse(e.get(n)))}),[S].concat(function(t){if(Array.isArray(t))return c(t)}(o=f)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(o)||l(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())),{data:y,loading:d,error:g,refetch:function(){e.delete(n),j((function(t){return t+1}))},clearCache:function(){e.delete(n)}}},s=function(t){return/\d/.test(t)},y=function(t){return/[ `!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/.test(t)},h=function(t){return/[A-Z]/.test(t)},p=function(t){return/[a-z]/.test(t)},d=function(t){return/\S+@\S+\.\S+/.test(t)},v=function(t){return/^[a-zA-Z0-9]+$/.test(t)},m=function(t){try{return new URL(t),!0}catch(t){return!1}},g=function(t){return/^\d{10}$/.test(t)},b=function(t){return/^\d{4}-\d{2}-\d{2}$/.test(t)},w=function(t){return/^\d{2}:\d{2}$/.test(t)},S=function(t){return/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/.test(t)},j=function(t,e,r){var n=new Date(t),o=new Date(e),i=new Date(r);return o<=n&&n<=i};function E(t){return function(t){if(Array.isArray(t))return A(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||x(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(t,e)||x(t,e)||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 x(t,e){if(t){if("string"==typeof t)return A(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?A(t,e):void 0}}function A(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var P=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,o="multiple"===e?[]:null,i="multiple"===e?[]:null,a=O((0,t.useState)(null),2),u=a[0],l=a[1],c=O((0,t.useState)(o),2),f=c[0],s=c[1],y=O((0,t.useState)(i),2),h=y[0],p=y[1];return{file:f,preview:h,error:u,changeHandler:function(t){if(t.target.files){if("single"===e){var o=t.target.files[0];if(t.target.files.length>1)return l("Cannot upload more than 1 file, please select type as 'Multiple'");if(o.size>1048576*r)return l("File size too large");var i=new FileReader;i.readAsDataURL(o),i.onloadend=function(){p(i.result)},s(o)}if("multiple"===e){var a=Array.from(t.target.files);if(n&&a.length>n)return l("Maximum ".concat(n," files allowed"));for(var u,c=function(){var t=y[f];if(t.size>1048576*r)return l("File size too large"),{v:void 0};var e=new FileReader;e.readAsDataURL(t),e.onloadend=function(){p((function(t){return Array.isArray(t)?[].concat(E(t),[e.result]):[e.result]}))},s((function(e){return Array.isArray(e)?[].concat(E(e),[t]):[t]}))},f=0,y=a;f<y.length;f++)if(u=c())return u.v}}}}},L=function(){var e=O((0,t.useState)(""),2),r=e[0],n=e[1],o=O((0,t.useState)(""),2),i=o[0],a=o[1];return{error:r,value:i,changeHandler:function(t){var e=t.target.value;a(e);var r=[];e.length<8&&r.push("at least 8 characters"),s(e)||r.push("a number"),y(e)||r.push("a special"),h(e)||r.push("a capital"),p(e)||r.push("a lowercase"),n(r.length>0?"Password must include ".concat(r.join(", ")," character"):"")}}},k=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=O((0,t.useState)(e),2),o=n[0],i=n[1],a=O((0,t.useState)(""),2),u=a[0],l=a[1];return{value:o,changeHandler:function(t){var e;e="number"==typeof o?Number(t.target.value):t.target.value,i(e);var n=r(e);l(n?n.errorMessage:"")},error:u}};function I(t){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},I(t)}function C(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function T(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function _(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?T(Object(r),!0).forEach((function(e){var n,o,i,a;n=t,o=e,i=r[e],a=function(t,e){if("object"!=I(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=I(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(o),(o="symbol"==I(a)?a:String(a))in n?Object.defineProperty(n,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):n[o]=i})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var N=function(e){var r,n,o=e.totalPages,i=void 0===o?1:o,a=e.currPage,u=e.setCurrPage,l=e.activeButtonStyle,c=void 0===l?{backgroundColor:"black",color:"white"}:l,f=e.Button,s=void 0===f?function(e){var r=e.children,n=e.onClick,o=e.style;return t.createElement("button",{style:_({padding:"0.5rem 1rem",outline:"none",border:"none",borderRadius:"0.5rem",cursor:"pointer",backgroundColor:"#e2e8f0"},o),onClick:n},r)}:f,y=e.Container,h=void 0===y?function(e){var r=e.children;return t.createElement("ul",{style:{display:"flex",gap:"1rem",listStyle:"none"}},r)}:y,p=(r=(0,t.useState)(1),n=2,function(t){if(Array.isArray(t))return t}(r)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);l=!0);}catch(t){c=!0,o=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return u}}(r,n)||function(t,e){if(t){if("string"==typeof t)return C(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?C(t,e):void 0}}(r,n)||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.")}()),d=p[0],v=p[1];return t.createElement(h,null,t.createElement(t.Fragment,null,d>1&&t.createElement("li",null,t.createElement(s,{onClick:function(){return v((function(t){return t-4}))}},"Prev")),Array.from({length:Math.min(4,i)},(function(t,e){return d+e})).map((function(e){return t.createElement("li",{key:e},t.createElement(s,{style:a===e?c:{},onClick:function(){return function(t){u(t),t>d+4-1?v(t):t<d&&v(t-4+1)}(e)}},e))})),i>d+4-1&&t.createElement("li",null,t.createElement(s,{onClick:function(){return v((function(t){return t+4}))}},"Next"))))},D=function(e){var r=e.totalPages,n=void 0===r?1:r,o=e.currPage,i=e.setCurrPage,a=e.Typography,u=void 0===a?function(e){var r=e.children;return t.createElement("code",null,r)}:a,l=e.Button,c=e.Container,f=void 0===c?function(e){var r=e.children;return t.createElement("nav",{style:{display:"flex",alignItems:"center",gap:"1rem",padding:"1rem 0"}},r)}:c,s=1===o,y=o===n;return t.createElement(f,null,t.createElement(t.Fragment,null,t.createElement(l,{disabled:s,onClick:function(){1!==o&&i((function(t){return t-1}))}},"Previous"),t.createElement(u,null,o," of ",n),t.createElement(l,{disabled:y,onClick:function(){o!==n&&i((function(t){return t+1}))}},"Next")))}})(),o})()));
import { PaginationButtonType, PageStepperButtonType } from "./src/types";
import { useFetchData } from "./src/hooks/useFetchData";
import { useFetchData } from "./src/hooks/fetching";
import { Pagination } from "./src/components/PaginationWithCount";
import { PageStepper } from "./src/components/PageStepper";
import { useInputValidation, useStrongPassword } from "./src/hooks/forms";
import {
useInputValidation,
useStrongPassword,
useFileHandler,
} from "./src/hooks/forms";
import {
isIncludeNumber,

@@ -30,2 +34,3 @@ isIncludeSpecialChar,

useStrongPassword,
useFileHandler,
isIncludeNumber,

@@ -32,0 +37,0 @@ isIncludeSpecialChar,

{
"name": "6pp",
"version": "1.1.2",
"version": "1.1.3",
"description": "",

@@ -5,0 +5,0 @@ "main": "./dist/bundle.js",

@@ -1,2 +0,2 @@

export * from "./hooks/useFetchData";
export * from "./hooks/fetching";
export * from "./hooks/forms";

@@ -3,0 +3,0 @@ export * from "./components/PaginationWithCount";

@@ -1,2 +0,2 @@

export const errorMessages = {
const errorMessages = {
length: "at least 8 characters",

@@ -8,1 +8,3 @@ number: "a number",

};
export { errorMessages };
import { CSSProperties, ComponentType, ReactNode } from "react";
export type PaginationButtonType = ComponentType<{
type PaginationButtonType = ComponentType<{
children: ReactNode;

@@ -9,3 +9,3 @@ onClick: () => void;

export type PageStepperButtonType = ComponentType<{
type PageStepperButtonType = ComponentType<{
children: ReactNode;

@@ -15,1 +15,3 @@ onClick: () => void;

}>;
export { PaginationButtonType, PageStepperButtonType };

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc