UNPKG

react-simplicity-lib

Version:

**react-simplicity-lib** is a collection of reusable React components that simplify UI development. This library includes various components like `Toggle`, `Modal`, `Tabs`, `HoverCard`, `Table`, and more, designed for easy integration and customization.

34 lines (31 loc) 22.3 kB
(function(k,E){typeof exports=="object"&&typeof module<"u"?E(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],E):(k=typeof globalThis<"u"?globalThis:k||self,E(k["react-simplicity-lib"]={},k.React))})(this,function(k,E){"use strict";var fe=document.createElement("style");fe.textContent=`.toggle{display:flex;align-items:center;gap:4px;width:max-content;padding:2px}.toggle-area{display:flex;justify-content:flex-end;width:calc(var(--ballSize) * 2 + 8px);background-color:#d3d3d3;border-radius:100000px;padding:4px;transition:all;cursor:pointer}.toggle-ball-container{transition:width}.toggle-ball{width:var(--ballSize);aspect-ratio:1/1;border-radius:50%;background-color:gray}.hover-card{border:.5px solid lightgray;border-radius:10px;transition:all .3s;transition-duration:transform .3s;box-shadow:0 0 10px #d3d3d3;perspective:1500px}.type-writer{overflow:hidden;margin:0 auto;letter-spacing:.15em;position:relative}.type-writer:after{content:"";border-right:1px solid black;height:100%;animation:blink-caret 1s step-end infinite}@keyframes blink-caret{0%,to{border-color:transparent}50%{border-color:#000}}.animated-button{background-color:#fff;box-shadow:3px 3px 10px 1px var(--color),inset 0 0 5px var(--color);border:1px solid var(--color);color:#000;padding:5px 10px;display:inline-block;font-size:1rem;text-align:center;cursor:pointer;border-radius:5px;transition:transform .3s ease}.animated-button:hover{transform:scale(1.01)}.animated-button:active{transform:scale(.95)}.animated-button:focus{outline:none}.animated-button:disabled{background-color:#d3d3d3;cursor:not-allowed}.Modal{position:fixed;top:0;right:0;bottom:0;left:0;background-color:#d3d3d399;z-index:1000000}.modal-center{display:flex;justify-content:center;align-items:center}.simplicity-table{height:max-content;max-height:100%;display:grid;grid-template-rows:1fr max-content;overflow:auto}.simplicity-table-container{height:100%;overflow:auto}.simplicity-table-container>table{background-color:#fff;font-size:.95rem;border-spacing:0;width:100%}.simplicity-table-container>table>thead{position:sticky;top:0;background-color:#cbdce1}.simplicity-table-container>table>tbody td,.simplicity-table-container>table>thead th{border:1px solid lightgray;padding:5px}.simplicity-table-container>table>thead th{border-color:#fff;color:#6a7e90}.simplicity-table-pagination{display:flex;justify-content:center;align-items:center;gap:10px;border-top:1px solid lightgray;padding:5px 10px}.simplicity-table-pagination button{background-color:#d3d3d3;border-radius:50%;padding:2px;width:24px;aspect-ratio:1/1;border:none;cursor:pointer}.simplicity-table-pagination button:disabled{cursor:not-allowed}.Tabs{height:100%;display:grid;grid-template-rows:max-content 1fr;padding:5px;background-color:#fff}.Tabs-names{display:flex;gap:5px}.Tab-name{padding:2px 12px;transition:border-radius .3s;cursor:pointer}.active-tab{border:2px solid var(--tabColor);border-bottom:none;border-radius:5px 5px 0 0;position:relative}.active-tab:after{content:"";position:absolute;width:100%;height:2px;background-color:#fff;left:0;bottom:-2px;z-index:1}.Tab-name:hover{border:2px solid var(--tabColor);border-bottom:none;border-radius:5px 5px 0 0}.Tabs-area{height:100%;position:relative;overflow:hidden;border:2px solid var(--tabColor)}.Tabs-area>div{height:100%;width:100%;display:flex;position:absolute;transition:left .3s}.Tab{width:100%;min-width:100%;height:100%} `,document.head.appendChild(fe);var Z={exports:{}},L={};/** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var de;function Ye(){if(de)return L;de=1;var f=E,c=Symbol.for("react.element"),R=Symbol.for("react.fragment"),h=Object.prototype.hasOwnProperty,b=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,g={key:!0,ref:!0,__self:!0,__source:!0};function m(y,a,_){var v,u={},o=null,C=null;_!==void 0&&(o=""+_),a.key!==void 0&&(o=""+a.key),a.ref!==void 0&&(C=a.ref);for(v in a)h.call(a,v)&&!g.hasOwnProperty(v)&&(u[v]=a[v]);if(y&&y.defaultProps)for(v in a=y.defaultProps,a)u[v]===void 0&&(u[v]=a[v]);return{$$typeof:c,type:y,key:o,ref:C,props:u,_owner:b.current}}return L.Fragment=R,L.jsx=m,L.jsxs=m,L}var V={};/** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var pe;function We(){return pe||(pe=1,process.env.NODE_ENV!=="production"&&function(){var f=E,c=Symbol.for("react.element"),R=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),b=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),m=Symbol.for("react.provider"),y=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),u=Symbol.for("react.memo"),o=Symbol.for("react.lazy"),C=Symbol.for("react.offscreen"),M=Symbol.iterator,P="@@iterator";function F(e){if(e===null||typeof e!="object")return null;var r=M&&e[M]||e[P];return typeof r=="function"?r:null}var A=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function T(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];U("error",e,t)}}function U(e,r,t){{var n=A.ReactDebugCurrentFrame,d=n.getStackAddendum();d!==""&&(r+="%s",t=t.concat([d]));var p=t.map(function(l){return String(l)});p.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,p)}}var B=!1,Q=!1,q=!1,ee=!1,re=!1,ve;ve=Symbol.for("react.module.reference");function He(e){return!!(typeof e=="string"||typeof e=="function"||e===h||e===g||re||e===b||e===_||e===v||ee||e===C||B||Q||q||typeof e=="object"&&e!==null&&(e.$$typeof===o||e.$$typeof===u||e.$$typeof===m||e.$$typeof===y||e.$$typeof===a||e.$$typeof===ve||e.getModuleId!==void 0))}function ze(e,r,t){var n=e.displayName;if(n)return n;var d=r.displayName||r.name||"";return d!==""?t+"("+d+")":t}function be(e){return e.displayName||"Context"}function D(e){if(e==null)return null;if(typeof e.tag=="number"&&T("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case h:return"Fragment";case R:return"Portal";case g:return"Profiler";case b:return"StrictMode";case _:return"Suspense";case v:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case y:var r=e;return be(r)+".Consumer";case m:var t=e;return be(t._context)+".Provider";case a:return ze(e,e.render,"ForwardRef");case u:var n=e.displayName||null;return n!==null?n:D(e.type)||"Memo";case o:{var d=e,p=d._payload,l=d._init;try{return D(l(p))}catch{return null}}}return null}var N=Object.assign,$=0,he,ge,me,ye,xe,Ee,Re;function _e(){}_e.__reactDisabledLog=!0;function Ze(){{if($===0){he=console.log,ge=console.info,me=console.warn,ye=console.error,xe=console.group,Ee=console.groupCollapsed,Re=console.groupEnd;var e={configurable:!0,enumerable:!0,value:_e,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}$++}}function Qe(){{if($--,$===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:N({},e,{value:he}),info:N({},e,{value:ge}),warn:N({},e,{value:me}),error:N({},e,{value:ye}),group:N({},e,{value:xe}),groupCollapsed:N({},e,{value:Ee}),groupEnd:N({},e,{value:Re})})}$<0&&T("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var te=A.ReactCurrentDispatcher,ne;function K(e,r,t){{if(ne===void 0)try{throw Error()}catch(d){var n=d.stack.trim().match(/\n( *(at )?)/);ne=n&&n[1]||""}return` `+ne+e}}var ae=!1,G;{var qe=typeof WeakMap=="function"?WeakMap:Map;G=new qe}function Te(e,r){if(!e||ae)return"";{var t=G.get(e);if(t!==void 0)return t}var n;ae=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var p;p=te.current,te.current=null,Ze();try{if(r){var l=function(){throw Error()};if(Object.defineProperty(l.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(l,[])}catch(S){n=S}Reflect.construct(e,[],l)}else{try{l.call()}catch(S){n=S}e.call(l.prototype)}}else{try{throw Error()}catch(S){n=S}e()}}catch(S){if(S&&n&&typeof S.stack=="string"){for(var i=S.stack.split(` `),w=n.stack.split(` `),x=i.length-1,j=w.length-1;x>=1&&j>=0&&i[x]!==w[j];)j--;for(;x>=1&&j>=0;x--,j--)if(i[x]!==w[j]){if(x!==1||j!==1)do if(x--,j--,j<0||i[x]!==w[j]){var O=` `+i[x].replace(" at new "," at ");return e.displayName&&O.includes("<anonymous>")&&(O=O.replace("<anonymous>",e.displayName)),typeof e=="function"&&G.set(e,O),O}while(x>=1&&j>=0);break}}}finally{ae=!1,te.current=p,Qe(),Error.prepareStackTrace=d}var W=e?e.displayName||e.name:"",I=W?K(W):"";return typeof e=="function"&&G.set(e,I),I}function er(e,r,t){return Te(e,!1)}function rr(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function H(e,r,t){if(e==null)return"";if(typeof e=="function")return Te(e,rr(e));if(typeof e=="string")return K(e);switch(e){case _:return K("Suspense");case v:return K("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case a:return er(e.render);case u:return H(e.type,r,t);case o:{var n=e,d=n._payload,p=n._init;try{return H(p(d),r,t)}catch{}}}return""}var X=Object.prototype.hasOwnProperty,je={},Ce=A.ReactDebugCurrentFrame;function z(e){if(e){var r=e._owner,t=H(e.type,e._source,r?r.type:null);Ce.setExtraStackFrame(t)}else Ce.setExtraStackFrame(null)}function tr(e,r,t,n,d){{var p=Function.call.bind(X);for(var l in e)if(p(e,l)){var i=void 0;try{if(typeof e[l]!="function"){var w=Error((n||"React class")+": "+t+" type `"+l+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[l]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw w.name="Invariant Violation",w}i=e[l](r,l,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(x){i=x}i&&!(i instanceof Error)&&(z(d),T("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,l,typeof i),z(null)),i instanceof Error&&!(i.message in je)&&(je[i.message]=!0,z(d),T("Failed %s type: %s",t,i.message),z(null))}}}var nr=Array.isArray;function oe(e){return nr(e)}function ar(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function or(e){try{return we(e),!1}catch{return!0}}function we(e){return""+e}function ke(e){if(or(e))return T("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ar(e)),we(e)}var J=A.ReactCurrentOwner,ir={key:!0,ref:!0,__self:!0,__source:!0},Se,Oe,ie;ie={};function sr(e){if(X.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function lr(e){if(X.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function cr(e,r){if(typeof e.ref=="string"&&J.current&&r&&J.current.stateNode!==r){var t=D(J.current.type);ie[t]||(T('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',D(J.current.type),e.ref),ie[t]=!0)}}function ur(e,r){{var t=function(){Se||(Se=!0,T("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function fr(e,r){{var t=function(){Oe||(Oe=!0,T("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var dr=function(e,r,t,n,d,p,l){var i={$$typeof:c,type:e,key:r,ref:t,props:l,_owner:p};return i._store={},Object.defineProperty(i._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(i,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(i,"_source",{configurable:!1,enumerable:!1,writable:!1,value:d}),Object.freeze&&(Object.freeze(i.props),Object.freeze(i)),i};function pr(e,r,t,n,d){{var p,l={},i=null,w=null;t!==void 0&&(ke(t),i=""+t),lr(r)&&(ke(r.key),i=""+r.key),sr(r)&&(w=r.ref,cr(r,d));for(p in r)X.call(r,p)&&!ir.hasOwnProperty(p)&&(l[p]=r[p]);if(e&&e.defaultProps){var x=e.defaultProps;for(p in x)l[p]===void 0&&(l[p]=x[p])}if(i||w){var j=typeof e=="function"?e.displayName||e.name||"Unknown":e;i&&ur(l,j),w&&fr(l,j)}return dr(e,i,w,d,n,J.current,l)}}var se=A.ReactCurrentOwner,Pe=A.ReactDebugCurrentFrame;function Y(e){if(e){var r=e._owner,t=H(e.type,e._source,r?r.type:null);Pe.setExtraStackFrame(t)}else Pe.setExtraStackFrame(null)}var le;le=!1;function ce(e){return typeof e=="object"&&e!==null&&e.$$typeof===c}function Ae(){{if(se.current){var e=D(se.current.type);if(e)return` Check the render method of \``+e+"`."}return""}}function vr(e){return""}var De={};function br(e){{var r=Ae();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=` Check the top-level render call using <`+t+">.")}return r}}function Me(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=br(r);if(De[t])return;De[t]=!0;var n="";e&&e._owner&&e._owner!==se.current&&(n=" It was passed a child from "+D(e._owner.type)+"."),Y(e),T('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),Y(null)}}function Fe(e,r){{if(typeof e!="object")return;if(oe(e))for(var t=0;t<e.length;t++){var n=e[t];ce(n)&&Me(n,r)}else if(ce(e))e._store&&(e._store.validated=!0);else if(e){var d=F(e);if(typeof d=="function"&&d!==e.entries)for(var p=d.call(e),l;!(l=p.next()).done;)ce(l.value)&&Me(l.value,r)}}}function hr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===a||r.$$typeof===u))t=r.propTypes;else return;if(t){var n=D(r);tr(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!le){le=!0;var d=D(r);T("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",d||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&T("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function gr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){Y(e),T("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),Y(null);break}}e.ref!==null&&(Y(e),T("Invalid attribute `ref` supplied to `React.Fragment`."),Y(null))}}var Ne={};function Ie(e,r,t,n,d,p){{var l=He(e);if(!l){var i="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(i+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var w=vr();w?i+=w:i+=Ae();var x;e===null?x="null":oe(e)?x="array":e!==void 0&&e.$$typeof===c?(x="<"+(D(e.type)||"Unknown")+" />",i=" Did you accidentally export a JSX literal instead of a component?"):x=typeof e,T("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",x,i)}var j=pr(e,r,t,d,p);if(j==null)return j;if(l){var O=r.children;if(O!==void 0)if(n)if(oe(O)){for(var W=0;W<O.length;W++)Fe(O[W],e);Object.freeze&&Object.freeze(O)}else T("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Fe(O,e)}if(X.call(r,"key")){var I=D(e),S=Object.keys(r).filter(function(_r){return _r!=="key"}),ue=S.length>0?"{key: someKey, "+S.join(": ..., ")+": ...}":"{key: someKey}";if(!Ne[I+ue]){var Rr=S.length>0?"{"+S.join(": ..., ")+": ...}":"{}";T(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; <%s key={someKey} {...props} />`,ue,I,Rr,I),Ne[I+ue]=!0}}return e===h?gr(j):hr(j),j}}function mr(e,r,t){return Ie(e,r,t,!0)}function yr(e,r,t){return Ie(e,r,t,!1)}var xr=yr,Er=mr;V.Fragment=h,V.jsx=xr,V.jsxs=Er}()),V}process.env.NODE_ENV==="production"?Z.exports=Ye():Z.exports=We();var s=Z.exports;const Le=({toggleState:f=void 0,onChangeToggleState:c,labelOn:R="On",labelOff:h="Off",ballSize:b=24,transitionDuration:g="300ms",backgroundColorOn:m="white",backgroundColorOff:y="lightgray",ballColorOn:a="#348dfa",ballColorOff:_="grey",style:v={},className:u=""})=>{const[o,C]=E.useState(f);E.useEffect(()=>{f!==void 0&&C(f)},[f]);const M=()=>{f!==void 0?c&&c(!o):C(!o)};return s.jsxs("div",{className:`toggle ${u}`,style:{"--ballSize":`${b}px`,...v},children:[s.jsx("div",{className:"toggle-area",onClick:()=>M(),style:{backgroundColor:o?m:y,border:`.5px solid ${y}`,boxShadow:o?`0 0 2px ${a}`:"none",transitionDuration:g},children:s.jsx("div",{className:"toggle-ball-container",style:{width:o?b:b*2,transitionDuration:g},children:s.jsx("div",{className:"toggle-ball",style:{backgroundColor:o?a:_}})})}),s.jsx("p",{className:"toggle-label",children:o?R:h})]})},Ve=({children:f,className:c="",style:R={}})=>{const h=E.useRef(null),[b,g]=E.useState(null),[m,y]=E.useState({rotationX:0,rotationY:0,rotationAngle:0}),[a,_]=E.useState(1),v=(P,F)=>Math.sqrt(P**2+F**2),u=(P,F)=>{const A=P.y/100,T=-P.x/100,U=Math.log(F)*2;return{rotationX:A,rotationY:T,rotationAngle:U}},o=P=>{if(!b)return;const F=P.clientX,A=P.clientY,T=F-b.x,U=A-b.y,B={x:T-b.width/2,y:U-b.height/2},Q=v(B.x,B.y),{rotationX:q,rotationY:ee,rotationAngle:re}=u(B,Q);y({rotationX:q,rotationY:ee,rotationAngle:re}),_(1.07)},C=()=>{const P=h.current.getBoundingClientRect();g(P)},M=()=>{h.current.style.transform="",h.current.style.backgroundImage="",_(1)};return s.jsx("div",{ref:h,className:`hover-card ${c}`,style:{transform:a!==1?` scale3d(${a}, ${a}, ${a}) rotate3d(${m.rotationX}, ${m.rotationY}, 0, ${m.rotationAngle}deg)`:"none",perspective:a!==1?"1500px":"none",...R},onMouseEnter:C,onMouseMove:o,onMouseLeave:M,children:f})},Ue=({text:f="",baseSpeed:c=500,style:R={},className:h="",onEffectComplete:b=()=>{}})=>{const[g,m]=E.useState(""),[y,a]=E.useState(0),v=(u=>{const o=c/Math.log(u+1);return Math.max(30,Math.min(o,100))})(f.length);return E.useEffect(()=>{let u;return y<f.length?u=setTimeout(()=>{m(o=>o+f[y]),a(o=>o+1)},v):b(),()=>clearTimeout(u)},[y,f,v]),E.useEffect(()=>{m(""),a(0)},[f]),s.jsx("p",{className:`type-writer ${h}`,style:R,children:g})},Be=({children:f,onClick:c,buttonColor:R="lightblue",style:h={},className:b=""})=>s.jsx("button",{className:`animated-button ${b}`,onClick:c,style:{"--color":R,...h},children:f}),$e=({children:f,isOpen:c,isCenter:R=!0,onModalClose:h=()=>{},className:b="",style:g={}})=>s.jsx("div",{className:`Modal ${R?"modal-center":""} ${b}`,style:{...g,display:Xe(c,R)},onClick:m=>m.target.classList[0]==="Modal"&&h(),children:c&&f}),Xe=(f,c)=>f?f&&c?"grid":"block":"none",Je=({columns:f=[{name:"",field:""}],rows:c=[{columnName:"value"}],className:R="",style:h={},isPagination:b=!1,pageSize:g=10,pageMenuPlacement:m="center",isSerialized:y=!1})=>{const[a,_]=E.useState([0,g-1]),v=u=>{const[o,C]=a;u==="next"&&C<c.length-1?_([o+g,C+g]):u==="previous"&&o>0&&_([o-g,C-g])};return s.jsxs("div",{className:`simplicity-table ${R}`,style:h,children:[s.jsx("div",{className:"simplicity-table-container",children:s.jsxs("table",{children:[s.jsx("thead",{children:s.jsxs("tr",{children:[y&&s.jsx("th",{children:"S.No"}),f.map((u,o)=>s.jsx("th",{children:u.name},o))]})}),s.jsx("tbody",{children:c.slice(a[0],a[1]+1).map((u,o)=>s.jsxs("tr",{children:[y&&s.jsx("td",{children:a[0]+o+1}),f.map((C,M)=>s.jsx("td",{children:u[C.field||C.name]},M))]},o))})]})}),b&&s.jsxs("div",{className:"simplicity-table-pagination",style:{justifyContent:m},children:[s.jsx("button",{onClick:()=>_([0,g-1]),disabled:a[0]===0,children:"<<"}),s.jsx("button",{onClick:()=>v("previous"),disabled:a[0]===0,children:"<"}),s.jsxs("p",{children:[a[0]+1," - ",Math.min(a[1]+1,c.length)," of"," ",c.length]}),s.jsx("button",{onClick:()=>v("next"),disabled:a[1]>=c.length-1,children:">"}),s.jsx("button",{onClick:()=>_([c.length-g,c.length-1]),disabled:a[1]>=c.length-1,children:">>"})]})]})},Ke=({Tabs:f=[],children:c,color:R="#cbdce1",style:h={},className:b="",onTabChange:g=()=>{},value:m=0,isNativeMomentDisable:y=!1})=>{const[a,_]=E.useState(m);E.useEffect(()=>{_(m)},[m]);const v=u=>{y||(_(u),g(u))};return s.jsxs("section",{className:`Tabs ${b}`,style:{"--tabColor":R,...h},children:[s.jsx("div",{className:"Tabs-names",children:f.map((u,o)=>s.jsx("span",{onClick:()=>v(o),className:`Tab-name ${a===o?"active-tab":""}`,children:u},o))}),s.jsx("div",{className:"Tabs-area",children:s.jsx("div",{style:{left:`-${a*100}%`},children:E.Children.map(c,(u,o)=>s.jsx(s.Fragment,{children:u}))})})]})},Ge=({children:f,style:c={},className:R=""})=>s.jsx("section",{className:`Tab ${R}`,style:c,children:f});k.Button=Be,k.HoverCard=Ve,k.Modal=$e,k.Tab=Ge,k.Table=Je,k.Tabs=Ke,k.Toggle=Le,k.TypeWriter=Ue,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})}); //# sourceMappingURL=react-simplicity-lib.umd.js.map