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.

45 lines (44 loc) 37.2 kB
(function(q,$){typeof exports=="object"&&typeof module<"u"?$(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],$):(q=typeof globalThis<"u"?globalThis:q||self,$(q["react-simplicity-lib"]={},q.React))})(this,(function(q,$){"use strict";var ve=document.createElement("style");ve.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;inset: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%} /*$vite$:1*/`,document.head.appendChild(ve);function De(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var oe={exports:{}},ne={};/** * @license React * react-jsx-runtime.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var be;function $e(){if(be)return ne;be=1;var t=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function p(s,c,a){var m=null;if(a!==void 0&&(m=""+a),c.key!==void 0&&(m=""+c.key),"key"in c){a={};for(var i in c)i!=="key"&&(a[i]=c[i])}else a=c;return c=a.ref,{$$typeof:t,type:s,key:m,ref:c!==void 0?c:null,props:a}}return ne.Fragment=l,ne.jsx=p,ne.jsxs=p,ne}var ae={};/** * @license React * react-jsx-runtime.development.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var he;function Fe(){return he||(he=1,process.env.NODE_ENV!=="production"&&(function(){function t(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ee?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case _:return"Fragment";case k:return"Profiler";case P:return"StrictMode";case o:return"Suspense";case z:return"SuspenseList";case K:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case M:return"Portal";case Y:return(e.displayName||"Context")+".Provider";case I:return(e._context.displayName||"Context")+".Consumer";case D:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case B:return r=e.displayName||null,r!==null?r:t(e.type)||"Memo";case V:r=e._payload,e=e._init;try{return t(e(r))}catch{}}return null}function l(e){return""+e}function p(e){try{l(e);var r=!1}catch{r=!0}if(r){r=console;var u=r.error,d=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return u.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",d),l(e)}}function s(e){if(e===_)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===V)return"<...>";try{var r=t(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function c(){var e=X.A;return e===null?null:e.getOwner()}function a(){return Error("react-stack-top-frame")}function m(e){if(Z.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function i(e,r){function u(){Q||(Q=!0,console.error("%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://react.dev/link/special-props)",r))}u.isReactWarning=!0,Object.defineProperty(e,"key",{get:u,configurable:!0})}function h(){var e=t(this.type);return L[e]||(L[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function E(e,r,u,d,g,R,w,S){return u=R.ref,e={$$typeof:C,type:e,key:r,props:R,_owner:g},(u!==void 0?u:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:h}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:w}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:S}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function x(e,r,u,d,g,R,w,S){var T=r.children;if(T!==void 0)if(d)if(te(T)){for(d=0;d<T.length;d++)v(T[d]);Object.freeze&&Object.freeze(T)}else console.error("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 v(T);if(Z.call(r,"key")){T=t(e);var j=Object.keys(r).filter(function(F){return F!=="key"});d=0<j.length?"{key: someKey, "+j.join(": ..., ")+": ...}":"{key: someKey}",H[T+d]||(j=0<j.length?"{"+j.join(": ..., ")+": ...}":"{}",console.error(`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} />`,d,T,j,T),H[T+d]=!0)}if(T=null,u!==void 0&&(p(u),T=""+u),m(r)&&(p(r.key),T=""+r.key),"key"in r){u={};for(var O in r)O!=="key"&&(u[O]=r[O])}else u=r;return T&&i(u,typeof e=="function"?e.displayName||e.name||"Unknown":e),E(e,T,R,g,c(),u,w,S)}function v(e){typeof e=="object"&&e!==null&&e.$$typeof===C&&e._store&&(e._store.validated=1)}var y=$,C=Symbol.for("react.transitional.element"),M=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),Y=Symbol.for("react.context"),D=Symbol.for("react.forward_ref"),o=Symbol.for("react.suspense"),z=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),K=Symbol.for("react.activity"),ee=Symbol.for("react.client.reference"),X=y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=Object.prototype.hasOwnProperty,te=Array.isArray,J=console.createTask?console.createTask:function(){return null};y={react_stack_bottom_frame:function(e){return e()}};var Q,L={},U=y.react_stack_bottom_frame.bind(y,a)(),G=J(s(a)),H={};ae.Fragment=_,ae.jsx=function(e,r,u,d,g){var R=1e4>X.recentlyCreatedOwnerStacks++;return x(e,r,u,!1,d,g,R?Error("react-stack-top-frame"):U,R?J(s(e)):G)},ae.jsxs=function(e,r,u,d,g){var R=1e4>X.recentlyCreatedOwnerStacks++;return x(e,r,u,!0,d,g,R?Error("react-stack-top-frame"):U,R?J(s(e)):G)}})()),ae}var ge;function We(){return ge||(ge=1,process.env.NODE_ENV==="production"?oe.exports=$e():oe.exports=Fe()),oe.exports}var f=We();const qe=({toggleState:t=void 0,onChangeToggleState:l,labelOn:p="On",labelOff:s="Off",ballSize:c=24,transitionDuration:a="300ms",backgroundColorOn:m="white",backgroundColorOff:i="lightgray",ballColorOn:h="#348dfa",ballColorOff:E="grey",style:x={},className:v=""})=>{const[y,C]=$.useState(t);$.useEffect(()=>{t!==void 0&&C(t)},[t]);const M=()=>{t!==void 0?l&&l(!y):C(!y)};return f.jsxs("div",{className:`toggle ${v}`,style:{"--ballSize":`${c}px`,...x},children:[f.jsx("div",{className:"toggle-area",onClick:()=>M(),style:{backgroundColor:y?m:i,border:`.5px solid ${i}`,boxShadow:y?`0 0 2px ${h}`:"none",transitionDuration:a},children:f.jsx("div",{className:"toggle-ball-container",style:{width:y?c:c*2,transitionDuration:a},children:f.jsx("div",{className:"toggle-ball",style:{backgroundColor:y?h:E}})})}),f.jsx("p",{className:"toggle-label",children:y?p:s})]})},Le=({children:t,className:l="",style:p={}})=>{const s=$.useRef(null),[c,a]=$.useState(null),[m,i]=$.useState({rotationX:0,rotationY:0,rotationAngle:0}),[h,E]=$.useState(1),x=(_,P)=>Math.sqrt(_**2+P**2),v=(_,P)=>{const k=_.y/100,I=-_.x/100,Y=Math.log(P)*2;return{rotationX:k,rotationY:I,rotationAngle:Y}},y=_=>{if(!c)return;const P=_.clientX,k=_.clientY,I=P-c.x,Y=k-c.y,D={x:I-c.width/2,y:Y-c.height/2},o=x(D.x,D.y),{rotationX:z,rotationY:B,rotationAngle:V}=v(D,o);i({rotationX:z,rotationY:B,rotationAngle:V}),E(1.07)},C=()=>{const _=s.current.getBoundingClientRect();a(_)},M=()=>{s.current.style.transform="",s.current.style.backgroundImage="",E(1)};return f.jsx("div",{ref:s,className:`hover-card ${l}`,style:{transform:h!==1?` scale3d(${h}, ${h}, ${h}) rotate3d(${m.rotationX}, ${m.rotationY}, 0, ${m.rotationAngle}deg)`:"none",perspective:h!==1?"1500px":"none",...p},onMouseEnter:C,onMouseMove:y,onMouseLeave:M,children:t})},Ue=({text:t="",baseSpeed:l=500,style:p={},className:s="",onEffectComplete:c=()=>{}})=>{const[a,m]=$.useState(""),[i,h]=$.useState(0),x=(v=>{const y=l/Math.log(v+1);return Math.max(30,Math.min(y,100))})(t.length);return $.useEffect(()=>{let v;return i<t.length?v=setTimeout(()=>{m(y=>y+t[i]),h(y=>y+1)},x):c(),()=>clearTimeout(v)},[i,t,x]),$.useEffect(()=>{m(""),h(0)},[t]),f.jsx("p",{className:`type-writer ${s}`,style:p,children:a})},ze=({children:t,onClick:l,buttonColor:p="lightblue",style:s={},className:c=""})=>f.jsx("button",{className:`animated-button ${c}`,onClick:l,style:{"--color":p,...s},children:t}),Je=({children:t,isOpen:l,isCenter:p=!0,onModalClose:s=()=>{},className:c="",style:a={}})=>f.jsx("div",{className:`Modal ${p?"modal-center":""} ${c}`,style:{...a,display:Ve(l,p)},onClick:m=>m.target.classList[0]==="Modal"&&s(),children:l&&t}),Ve=(t,l)=>t?t&&l?"grid":"block":"none",Xe=({columns:t=[{name:"",field:""}],rows:l=[{columnName:"value"}],className:p="",style:s={},isPagination:c=!1,pageSize:a=10,pageMenuPlacement:m="center",isSerialized:i=!1})=>{const[h,E]=$.useState([0,a-1]),x=v=>{const[y,C]=h;v==="next"&&C<l.length-1?E([y+a,C+a]):v==="previous"&&y>0&&E([y-a,C-a])};return f.jsxs("div",{className:`simplicity-table ${p}`,style:s,children:[f.jsx("div",{className:"simplicity-table-container",children:f.jsxs("table",{children:[f.jsx("thead",{children:f.jsxs("tr",{children:[i&&f.jsx("th",{children:"S.No"}),t.map((v,y)=>f.jsx("th",{children:v.name},y))]})}),f.jsx("tbody",{children:l.slice(h[0],h[1]+1).map((v,y)=>f.jsxs("tr",{children:[i&&f.jsx("td",{children:h[0]+y+1}),t.map((C,M)=>f.jsx("td",{children:v[C.field||C.name]},M))]},y))})]})}),c&&f.jsxs("div",{className:"simplicity-table-pagination",style:{justifyContent:m},children:[f.jsx("button",{onClick:()=>E([0,a-1]),disabled:h[0]===0,children:"<<"}),f.jsx("button",{onClick:()=>x("previous"),disabled:h[0]===0,children:"<"}),f.jsxs("p",{children:[h[0]+1," - ",Math.min(h[1]+1,l.length)," of"," ",l.length]}),f.jsx("button",{onClick:()=>x("next"),disabled:h[1]>=l.length-1,children:">"}),f.jsx("button",{onClick:()=>E([l.length-a,l.length-1]),disabled:h[1]>=l.length-1,children:">>"})]})]})},Be=({Tabs:t=[],children:l,color:p="#cbdce1",style:s={},className:c="",onTabChange:a=()=>{},value:m=0,isNativeMomentDisable:i=!1})=>{const[h,E]=$.useState(m);$.useEffect(()=>{E(m)},[m]);const x=v=>{i||(E(v),a(v))};return f.jsxs("section",{className:`Tabs ${c}`,style:{"--tabColor":p,...s},children:[f.jsx("div",{className:"Tabs-names",children:t.map((v,y)=>f.jsx("span",{onClick:()=>x(y),className:`Tab-name ${h===y?"active-tab":""}`,children:v},y))}),f.jsx("div",{className:"Tabs-area",children:f.jsx("div",{style:{left:`-${h*100}%`},children:$.Children.map(l,(v,y)=>f.jsx(f.Fragment,{children:v}))})})]})},Ge=({children:t,style:l={},className:p=""})=>f.jsx("section",{className:`Tab ${p}`,style:l,children:t});var ie={exports:{}},se={exports:{}},A={};/** @license React v16.13.1 * react-is.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 xe;function He(){if(xe)return A;xe=1;var t=typeof Symbol=="function"&&Symbol.for,l=t?Symbol.for("react.element"):60103,p=t?Symbol.for("react.portal"):60106,s=t?Symbol.for("react.fragment"):60107,c=t?Symbol.for("react.strict_mode"):60108,a=t?Symbol.for("react.profiler"):60114,m=t?Symbol.for("react.provider"):60109,i=t?Symbol.for("react.context"):60110,h=t?Symbol.for("react.async_mode"):60111,E=t?Symbol.for("react.concurrent_mode"):60111,x=t?Symbol.for("react.forward_ref"):60112,v=t?Symbol.for("react.suspense"):60113,y=t?Symbol.for("react.suspense_list"):60120,C=t?Symbol.for("react.memo"):60115,M=t?Symbol.for("react.lazy"):60116,_=t?Symbol.for("react.block"):60121,P=t?Symbol.for("react.fundamental"):60117,k=t?Symbol.for("react.responder"):60118,I=t?Symbol.for("react.scope"):60119;function Y(o){if(typeof o=="object"&&o!==null){var z=o.$$typeof;switch(z){case l:switch(o=o.type,o){case h:case E:case s:case a:case c:case v:return o;default:switch(o=o&&o.$$typeof,o){case i:case x:case M:case C:case m:return o;default:return z}}case p:return z}}}function D(o){return Y(o)===E}return A.AsyncMode=h,A.ConcurrentMode=E,A.ContextConsumer=i,A.ContextProvider=m,A.Element=l,A.ForwardRef=x,A.Fragment=s,A.Lazy=M,A.Memo=C,A.Portal=p,A.Profiler=a,A.StrictMode=c,A.Suspense=v,A.isAsyncMode=function(o){return D(o)||Y(o)===h},A.isConcurrentMode=D,A.isContextConsumer=function(o){return Y(o)===i},A.isContextProvider=function(o){return Y(o)===m},A.isElement=function(o){return typeof o=="object"&&o!==null&&o.$$typeof===l},A.isForwardRef=function(o){return Y(o)===x},A.isFragment=function(o){return Y(o)===s},A.isLazy=function(o){return Y(o)===M},A.isMemo=function(o){return Y(o)===C},A.isPortal=function(o){return Y(o)===p},A.isProfiler=function(o){return Y(o)===a},A.isStrictMode=function(o){return Y(o)===c},A.isSuspense=function(o){return Y(o)===v},A.isValidElementType=function(o){return typeof o=="string"||typeof o=="function"||o===s||o===E||o===a||o===c||o===v||o===y||typeof o=="object"&&o!==null&&(o.$$typeof===M||o.$$typeof===C||o.$$typeof===m||o.$$typeof===i||o.$$typeof===x||o.$$typeof===P||o.$$typeof===k||o.$$typeof===I||o.$$typeof===_)},A.typeOf=Y,A}var N={};/** @license React v16.13.1 * react-is.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 Te;function Ze(){return Te||(Te=1,process.env.NODE_ENV!=="production"&&(function(){var t=typeof Symbol=="function"&&Symbol.for,l=t?Symbol.for("react.element"):60103,p=t?Symbol.for("react.portal"):60106,s=t?Symbol.for("react.fragment"):60107,c=t?Symbol.for("react.strict_mode"):60108,a=t?Symbol.for("react.profiler"):60114,m=t?Symbol.for("react.provider"):60109,i=t?Symbol.for("react.context"):60110,h=t?Symbol.for("react.async_mode"):60111,E=t?Symbol.for("react.concurrent_mode"):60111,x=t?Symbol.for("react.forward_ref"):60112,v=t?Symbol.for("react.suspense"):60113,y=t?Symbol.for("react.suspense_list"):60120,C=t?Symbol.for("react.memo"):60115,M=t?Symbol.for("react.lazy"):60116,_=t?Symbol.for("react.block"):60121,P=t?Symbol.for("react.fundamental"):60117,k=t?Symbol.for("react.responder"):60118,I=t?Symbol.for("react.scope"):60119;function Y(n){return typeof n=="string"||typeof n=="function"||n===s||n===E||n===a||n===c||n===v||n===y||typeof n=="object"&&n!==null&&(n.$$typeof===M||n.$$typeof===C||n.$$typeof===m||n.$$typeof===i||n.$$typeof===x||n.$$typeof===P||n.$$typeof===k||n.$$typeof===I||n.$$typeof===_)}function D(n){if(typeof n=="object"&&n!==null){var W=n.$$typeof;switch(W){case l:var re=n.type;switch(re){case h:case E:case s:case a:case c:case v:return re;default:var ce=re&&re.$$typeof;switch(ce){case i:case x:case M:case C:case m:return ce;default:return W}}case p:return W}}}var o=h,z=E,B=i,V=m,K=l,ee=x,X=s,Z=M,te=C,J=p,Q=a,L=c,U=v,G=!1;function H(n){return G||(G=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),e(n)||D(n)===h}function e(n){return D(n)===E}function r(n){return D(n)===i}function u(n){return D(n)===m}function d(n){return typeof n=="object"&&n!==null&&n.$$typeof===l}function g(n){return D(n)===x}function R(n){return D(n)===s}function w(n){return D(n)===M}function S(n){return D(n)===C}function T(n){return D(n)===p}function j(n){return D(n)===a}function O(n){return D(n)===c}function F(n){return D(n)===v}N.AsyncMode=o,N.ConcurrentMode=z,N.ContextConsumer=B,N.ContextProvider=V,N.Element=K,N.ForwardRef=ee,N.Fragment=X,N.Lazy=Z,N.Memo=te,N.Portal=J,N.Profiler=Q,N.StrictMode=L,N.Suspense=U,N.isAsyncMode=H,N.isConcurrentMode=e,N.isContextConsumer=r,N.isContextProvider=u,N.isElement=d,N.isForwardRef=g,N.isFragment=R,N.isLazy=w,N.isMemo=S,N.isPortal=T,N.isProfiler=j,N.isStrictMode=O,N.isSuspense=F,N.isValidElementType=Y,N.typeOf=D})()),N}var Ee;function Re(){return Ee||(Ee=1,process.env.NODE_ENV==="production"?se.exports=He():se.exports=Ze()),se.exports}/* object-assign (c) Sindre Sorhus @license MIT */var le,_e;function Qe(){if(_e)return le;_e=1;var t=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable;function s(a){if(a==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(a)}function c(){try{if(!Object.assign)return!1;var a=new String("abc");if(a[5]="de",Object.getOwnPropertyNames(a)[0]==="5")return!1;for(var m={},i=0;i<10;i++)m["_"+String.fromCharCode(i)]=i;var h=Object.getOwnPropertyNames(m).map(function(x){return m[x]});if(h.join("")!=="0123456789")return!1;var E={};return"abcdefghijklmnopqrst".split("").forEach(function(x){E[x]=x}),Object.keys(Object.assign({},E)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return le=c()?Object.assign:function(a,m){for(var i,h=s(a),E,x=1;x<arguments.length;x++){i=Object(arguments[x]);for(var v in i)l.call(i,v)&&(h[v]=i[v]);if(t){E=t(i);for(var y=0;y<E.length;y++)p.call(i,E[y])&&(h[E[y]]=i[E[y]])}}return h},le}var ue,we;function fe(){if(we)return ue;we=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ue=t,ue}var de,Se;function Ce(){return Se||(Se=1,de=Function.call.bind(Object.prototype.hasOwnProperty)),de}var pe,je;function Ke(){if(je)return pe;je=1;var t=function(){};if(process.env.NODE_ENV!=="production"){var l=fe(),p={},s=Ce();t=function(a){var m="Warning: "+a;typeof console<"u"&&console.error(m);try{throw new Error(m)}catch{}}}function c(a,m,i,h,E){if(process.env.NODE_ENV!=="production"){for(var x in a)if(s(a,x)){var v;try{if(typeof a[x]!="function"){var y=Error((h||"React class")+": "+i+" type `"+x+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof a[x]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw y.name="Invariant Violation",y}v=a[x](m,x,h,i,null,l)}catch(M){v=M}if(v&&!(v instanceof Error)&&t((h||"React class")+": type specification of "+i+" `"+x+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof v+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),v instanceof Error&&!(v.message in p)){p[v.message]=!0;var C=E?E():"";t("Failed "+i+" type: "+v.message+(C??""))}}}}return c.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(p={})},pe=c,pe}var ye,Oe;function et(){if(Oe)return ye;Oe=1;var t=Re(),l=Qe(),p=fe(),s=Ce(),c=Ke(),a=function(){};process.env.NODE_ENV!=="production"&&(a=function(i){var h="Warning: "+i;typeof console<"u"&&console.error(h);try{throw new Error(h)}catch{}});function m(){return null}return ye=function(i,h){var E=typeof Symbol=="function"&&Symbol.iterator,x="@@iterator";function v(e){var r=e&&(E&&e[E]||e[x]);if(typeof r=="function")return r}var y="<<anonymous>>",C={array:k("array"),bigint:k("bigint"),bool:k("boolean"),func:k("function"),number:k("number"),object:k("object"),string:k("string"),symbol:k("symbol"),any:I(),arrayOf:Y,element:D(),elementType:o(),instanceOf:z,node:ee(),objectOf:V,oneOf:B,oneOfType:K,shape:Z,exact:te};function M(e,r){return e===r?e!==0||1/e===1/r:e!==e&&r!==r}function _(e,r){this.message=e,this.data=r&&typeof r=="object"?r:{},this.stack=""}_.prototype=Error.prototype;function P(e){if(process.env.NODE_ENV!=="production")var r={},u=0;function d(R,w,S,T,j,O,F){if(T=T||y,O=O||S,F!==p){if(h){var n=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw n.name="Invariant Violation",n}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var W=T+":"+S;!r[W]&&u<3&&(a("You are manually calling a React.PropTypes validation function for the `"+O+"` prop on `"+T+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),r[W]=!0,u++)}}return w[S]==null?R?w[S]===null?new _("The "+j+" `"+O+"` is marked as required "+("in `"+T+"`, but its value is `null`.")):new _("The "+j+" `"+O+"` is marked as required in "+("`"+T+"`, but its value is `undefined`.")):null:e(w,S,T,j,O)}var g=d.bind(null,!1);return g.isRequired=d.bind(null,!0),g}function k(e){function r(u,d,g,R,w,S){var T=u[d],j=L(T);if(j!==e){var O=U(T);return new _("Invalid "+R+" `"+w+"` of type "+("`"+O+"` supplied to `"+g+"`, expected ")+("`"+e+"`."),{expectedType:e})}return null}return P(r)}function I(){return P(m)}function Y(e){function r(u,d,g,R,w){if(typeof e!="function")return new _("Property `"+w+"` of component `"+g+"` has invalid PropType notation inside arrayOf.");var S=u[d];if(!Array.isArray(S)){var T=L(S);return new _("Invalid "+R+" `"+w+"` of type "+("`"+T+"` supplied to `"+g+"`, expected an array."))}for(var j=0;j<S.length;j++){var O=e(S,j,g,R,w+"["+j+"]",p);if(O instanceof Error)return O}return null}return P(r)}function D(){function e(r,u,d,g,R){var w=r[u];if(!i(w)){var S=L(w);return new _("Invalid "+g+" `"+R+"` of type "+("`"+S+"` supplied to `"+d+"`, expected a single ReactElement."))}return null}return P(e)}function o(){function e(r,u,d,g,R){var w=r[u];if(!t.isValidElementType(w)){var S=L(w);return new _("Invalid "+g+" `"+R+"` of type "+("`"+S+"` supplied to `"+d+"`, expected a single ReactElement type."))}return null}return P(e)}function z(e){function r(u,d,g,R,w){if(!(u[d]instanceof e)){var S=e.name||y,T=H(u[d]);return new _("Invalid "+R+" `"+w+"` of type "+("`"+T+"` supplied to `"+g+"`, expected ")+("instance of `"+S+"`."))}return null}return P(r)}function B(e){if(!Array.isArray(e))return process.env.NODE_ENV!=="production"&&(arguments.length>1?a("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):a("Invalid argument supplied to oneOf, expected an array.")),m;function r(u,d,g,R,w){for(var S=u[d],T=0;T<e.length;T++)if(M(S,e[T]))return null;var j=JSON.stringify(e,function(F,n){var W=U(n);return W==="symbol"?String(n):n});return new _("Invalid "+R+" `"+w+"` of value `"+String(S)+"` "+("supplied to `"+g+"`, expected one of "+j+"."))}return P(r)}function V(e){function r(u,d,g,R,w){if(typeof e!="function")return new _("Property `"+w+"` of component `"+g+"` has invalid PropType notation inside objectOf.");var S=u[d],T=L(S);if(T!=="object")return new _("Invalid "+R+" `"+w+"` of type "+("`"+T+"` supplied to `"+g+"`, expected an object."));for(var j in S)if(s(S,j)){var O=e(S,j,g,R,w+"."+j,p);if(O instanceof Error)return O}return null}return P(r)}function K(e){if(!Array.isArray(e))return process.env.NODE_ENV!=="production"&&a("Invalid argument supplied to oneOfType, expected an instance of array."),m;for(var r=0;r<e.length;r++){var u=e[r];if(typeof u!="function")return a("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+G(u)+" at index "+r+"."),m}function d(g,R,w,S,T){for(var j=[],O=0;O<e.length;O++){var F=e[O],n=F(g,R,w,S,T,p);if(n==null)return null;n.data&&s(n.data,"expectedType")&&j.push(n.data.expectedType)}var W=j.length>0?", expected one of type ["+j.join(", ")+"]":"";return new _("Invalid "+S+" `"+T+"` supplied to "+("`"+w+"`"+W+"."))}return P(d)}function ee(){function e(r,u,d,g,R){return J(r[u])?null:new _("Invalid "+g+" `"+R+"` supplied to "+("`"+d+"`, expected a ReactNode."))}return P(e)}function X(e,r,u,d,g){return new _((e||"React class")+": "+r+" type `"+u+"."+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+g+"`.")}function Z(e){function r(u,d,g,R,w){var S=u[d],T=L(S);if(T!=="object")return new _("Invalid "+R+" `"+w+"` of type `"+T+"` "+("supplied to `"+g+"`, expected `object`."));for(var j in e){var O=e[j];if(typeof O!="function")return X(g,R,w,j,U(O));var F=O(S,j,g,R,w+"."+j,p);if(F)return F}return null}return P(r)}function te(e){function r(u,d,g,R,w){var S=u[d],T=L(S);if(T!=="object")return new _("Invalid "+R+" `"+w+"` of type `"+T+"` "+("supplied to `"+g+"`, expected `object`."));var j=l({},u[d],e);for(var O in j){var F=e[O];if(s(e,O)&&typeof F!="function")return X(g,R,w,O,U(F));if(!F)return new _("Invalid "+R+" `"+w+"` key `"+O+"` supplied to `"+g+"`.\nBad object: "+JSON.stringify(u[d],null," ")+` Valid keys: `+JSON.stringify(Object.keys(e),null," "));var n=F(S,O,g,R,w+"."+O,p);if(n)return n}return null}return P(r)}function J(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(J);if(e===null||i(e))return!0;var r=v(e);if(r){var u=r.call(e),d;if(r!==e.entries){for(;!(d=u.next()).done;)if(!J(d.value))return!1}else for(;!(d=u.next()).done;){var g=d.value;if(g&&!J(g[1]))return!1}}else return!1;return!0;default:return!1}}function Q(e,r){return e==="symbol"?!0:r?r["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&r instanceof Symbol:!1}function L(e){var r=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":Q(r,e)?"symbol":r}function U(e){if(typeof e>"u"||e===null)return""+e;var r=L(e);if(r==="object"){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return r}function G(e){var r=U(e);switch(r){case"array":case"object":return"an "+r;case"boolean":case"date":case"regexp":return"a "+r;default:return r}}function H(e){return!e.constructor||!e.constructor.name?y:e.constructor.name}return C.checkPropTypes=c,C.resetWarningCache=c.resetWarningCache,C.PropTypes=C,C},ye}var me,Pe;function tt(){if(Pe)return me;Pe=1;var t=fe();function l(){}function p(){}return p.resetWarningCache=l,me=function(){function s(m,i,h,E,x,v){if(v!==t){var y=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw y.name="Invariant Violation",y}}s.isRequired=s;function c(){return s}var a={array:s,bigint:s,bool:s,func:s,number:s,object:s,string:s,symbol:s,any:s,arrayOf:c,element:s,elementType:s,instanceOf:c,node:s,objectOf:c,oneOf:c,oneOfType:c,shape:c,exact:c,checkPropTypes:p,resetWarningCache:l};return a.PropTypes=a,a},me}var ke;function rt(){if(ke)return ie.exports;if(ke=1,process.env.NODE_ENV!=="production"){var t=Re(),l=!0;ie.exports=et()(t.isElement,l)}else ie.exports=tt()();return ie.exports}var nt=rt();const b=De(nt),Ae=({day:t,isSelected:l,isToday:p,onClick:s,dayClassName:c,selectedDayClassName:a,todayClassName:m})=>f.jsx("td",{className:`cursor-pointer p-2 text-center transition-all duration-200 text-gray-700 w-10 h-10 hover:bg-gray-100 hover:rounded-md ${l?a||"bg-blue-500 text-white font-semibold rounded-md":""} ${p?m||"bg-blue-100 text-blue-800 font-semibold rounded-md":""} ${c||""}`,onClick:()=>s(t),children:t});Ae.propTypes={day:b.number.isRequired,isSelected:b.bool.isRequired,isToday:b.bool.isRequired,onClick:b.func.isRequired,dayClassName:b.string,selectedDayClassName:b.string,todayClassName:b.string};const Ne=({children:t,weekClassName:l})=>f.jsx("tr",{className:l,children:t});Ne.propTypes={children:b.node.isRequired,weekClassName:b.string};const Me=({month:t,year:l,onPrevious:p,onNext:s,headerClassName:c,monthYearClassName:a,navigationClassName:m,weekdayClassName:i})=>f.jsxs("thead",{className:c,children:[f.jsxs("tr",{children:[f.jsx("th",{className:m||"cursor-pointer transition-all duration-200 p-2 text-lg text-gray-600 select-none hover:bg-gray-100 hover:text-gray-800 hover:rounded-md",onClick:p,children:"‹"}),f.jsxs("th",{className:a||"text-base font-semibold text-center text-gray-800 p-3",colSpan:"5",children:[t," ",l]}),f.jsx("th",{className:m||"cursor-pointer transition-all duration-200 p-2 text-lg text-gray-600 select-none hover:bg-gray-100 hover:text-gray-800 hover:rounded-md",onClick:s,children:"›"})]}),f.jsxs("tr",{children:[f.jsx("th",{className:i||"p-2 font-medium text-gray-600 text-xs uppercase tracking-wide",children:"Sun"}),f.jsx("th",{className:i||"p-2 font-medium text-gray-600 text-xs uppercase tracking-wide",children:"Mon"}),f.jsx("th",{className:i||"p-2 font-medium text-gray-600 text-xs uppercase tracking-wide",children:"Tue"}),f.jsx("th",{className:i||"p-2 font-medium text-gray-600 text-xs uppercase tracking-wide",children:"Wed"}),f.jsx("th",{className:i||"p-2 font-medium text-gray-600 text-xs uppercase tracking-wide",children:"Thu"}),f.jsx("th",{className:i||"p-2 font-medium text-gray-600 text-xs uppercase tracking-wide",children:"Fri"}),f.jsx("th",{className:i||"p-2 font-medium text-gray-600 text-xs uppercase tracking-wide",children:"Sat"})]})]});Me.propTypes={month:b.string.isRequired,year:b.number.isRequired,onPrevious:b.func.isRequired,onNext:b.func.isRequired,headerClassName:b.string,monthYearClassName:b.string,navigationClassName:b.string,weekdayClassName:b.string};const Ye=({month:t,year:l,selectedDate:p,onDateClick:s,gridClassName:c,dayClassName:a,selectedDayClassName:m,todayClassName:i,weekClassName:h})=>{const E=(k,I)=>new Date(I,k+1,0).getDate(),x=(k,I)=>new Date(I,k,1).getDay(),v=k=>{const I=new Date;return k===I.getDate()&&t===I.getMonth()&&l===I.getFullYear()},y=k=>p&&k===p.getDate()&&t===p.getMonth()&&l===p.getFullYear(),C=E(t,l),M=x(t,l),_=[];let P=1;for(let k=0;k<6;k++){const I=[];for(let Y=0;Y<7;Y++)k===0&&Y<M?I.push(f.jsx("td",{},`empty-${Y}`)):P<=C&&(I.push(f.jsx(Ae,{day:P,isSelected:y(P),isToday:v(P),onClick:s,dayClassName:a,selectedDayClassName:m,todayClassName:i},P)),P++);if(I.length>0&&_.push(f.jsx(Ne,{weekClassName:h,children:I},k)),P>C)break}return f.jsx("tbody",{className:c,children:_})};Ye.propTypes={month:b.number.isRequired,year:b.number.isRequired,selectedDate:b.instanceOf(Date),onDateClick:b.func.isRequired,gridClassName:b.string,dayClassName:b.string,selectedDayClassName:b.string,todayClassName:b.string,weekClassName:b.string};const Ie=({onDateSelect:t,onDateChange:l,onMonthChange:p,onYearChange:s,onOpen:c,onClose:a,defaultDate:m=new Date,dateFormat:i="DD-MM-YYYY",placeholder:h="Select Date",disabled:E=!1,isOpen:x,onToggle:v,hideInput:y=!1,selectedDate:C,displayMonth:M,displayYear:_,containerClassName:P,inputClassName:k,iconClassName:I,dropdownClassName:Y,tableClassName:D,headerClassName:o,monthYearClassName:z,navigationClassName:B,weekdayClassName:V,gridClassName:K,weekClassName:ee,dayClassName:X,selectedDayClassName:Z,todayClassName:te})=>{const[J,Q]=$.useState(m),[L,U]=$.useState(m.getMonth()),[G,H]=$.useState(m.getFullYear()),[e,r]=$.useState(!1),u=C!==void 0?C:J,d=M!==void 0?M:L,g=_!==void 0?_:G,R=x!==void 0?x:e,w=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],S=n=>{const W=n.getDate().toString().padStart(2,"0"),re=(n.getMonth()+1).toString().padStart(2,"0"),ce=n.getFullYear();return i.replace("DD",W).replace("MM",re).replace("YYYY",ce)},T=n=>{if(E)return;const W=new Date(g,d,n);C===void 0&&Q(W),t?.(W),l?.(W),x===void 0&&r(!1),v?.(!1),a?.()},j=()=>{if(d===0){const n=g-1;M===void 0&&U(11),_===void 0&&H(n),p?.(11),s?.(n)}else{const n=d-1;M===void 0&&U(n),p?.(n)}},O=()=>{if(d===11){const n=g+1;M===void 0&&U(0),_===void 0&&H(n),p?.(0),s?.(n)}else{const n=d+1;M===void 0&&U(n),p?.(n)}},F=()=>{if(E)return;const n=!R;x===void 0&&r(n),v?.(n),n?c?.():a?.()};return f.jsxs("div",{className:P||`relative w-max font-sans ${E?"opacity-60 pointer-events-none":""}`,children:[!y&&f.jsxs("div",{className:k||"flex items-center justify-between gap-3 border-2 border-gray-300 rounded-lg px-4 py-3 bg-white cursor-pointer transition-all duration-200 min-w-52 hover:border-blue-500 hover:shadow-sm hover:shadow-blue-100",onClick:F,children:[f.jsx("div",{className:"text-sm text-gray-700 flex-1",children:u?S(u):h}),f.jsx("span",{className:I||"text-lg text-gray-600",children:"📅"})]}),R&&!E&&f.jsx("div",{className:Y||`absolute ${y?"top-0":"top-full"} left-0 z-50 ${y?"":"mt-1"} bg-white border border-gray-300 rounded-lg shadow-lg animate-in fade-in duration-200 slide-in-from-top-2`,children:f.jsxs("table",{className:D||"text-sm border-collapse w-full",children:[f.jsx(Me,{month:w[d],year:g,onPrevious:j,onNext:O,headerClassName:o,monthYearClassName:z,navigationClassName:B,weekdayClassName:V}),f.jsx(Ye,{month:d,year:g,selectedDate:u,onDateClick:T,gridClassName:K,dayClassName:X,selectedDayClassName:Z,todayClassName:te,weekClassName:ee})]})})]})};Ie.propTypes={onDateSelect:b.func,onDateChange:b.func,onMonthChange:b.func,onYearChange:b.func,onOpen:b.func,onClose:b.func,onToggle:b.func,defaultDate:b.instanceOf(Date),dateFormat:b.string,placeholder:b.string,disabled:b.bool,isOpen:b.bool,hideInput:b.bool,selectedDate:b.instanceOf(Date),displayMonth:b.number,displayYear:b.number,containerClassName:b.string,inputClassName:b.string,iconClassName:b.string,dropdownClassName:b.string,tableClassName:b.string,headerClassName:b.string,monthYearClassName:b.string,navigationClassName:b.string,weekdayClassName:b.string,gridClassName:b.string,weekClassName:b.string,dayClassName:b.string,selectedDayClassName:b.string,todayClassName:b.string},q.Button=ze,q.Calender=Ie,q.HoverCard=Le,q.Modal=Je,q.Tab=Ge,q.Table=Xe,q.Tabs=Be,q.Toggle=qe,q.TypeWriter=Ue,Object.defineProperty(q,Symbol.toStringTag,{value:"Module"})})); //# sourceMappingURL=react-simplicity-lib.umd.js.map