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.

1,553 lines 50.6 kB
import $e, { useState as J, useEffect as ce, useRef as Ye, Children as Ie } from "react"; import './index.css';function De(r) { return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r; } var oe = { exports: {} }, te = {}; /** * @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 me; function qe() { if (me) return te; me = 1; var r = Symbol.for("react.transitional.element"), u = Symbol.for("react.fragment"); function p(i, c, a) { var v = null; if (a !== void 0 && (v = "" + a), c.key !== void 0 && (v = "" + c.key), "key" in c) { a = {}; for (var s in c) s !== "key" && (a[s] = c[s]); } else a = c; return c = a.ref, { $$typeof: r, type: i, key: v, ref: c !== void 0 ? c : null, props: a }; } return te.Fragment = u, te.jsx = p, te.jsxs = p, te; } var ne = {}; /** * @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 r(e) { if (e == null) return null; if (typeof e == "function") return e.$$typeof === K ? null : e.displayName || e.name || null; if (typeof e == "string") return e; switch (e) { case _: return "Fragment"; case A: return "Profiler"; case P: return "StrictMode"; case o: return "Suspense"; case L: return "SuspenseList"; case Q: 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 k: return "Portal"; case N: return (e.displayName || "Context") + ".Provider"; case Y: return (e._context.displayName || "Context") + ".Consumer"; case I: var t = e.render; return e = e.displayName, e || (e = t.displayName || t.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e; case z: return t = e.displayName || null, t !== null ? t : r(e.type) || "Memo"; case V: t = e._payload, e = e._init; try { return r(e(t)); } catch { } } return null; } function u(e) { return "" + e; } function p(e) { try { u(e); var t = !1; } catch { t = !0; } if (t) { t = console; var l = t.error, f = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object"; return l.call( t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", f ), u(e); } } function i(e) { if (e === _) return "<>"; if (typeof e == "object" && e !== null && e.$$typeof === V) return "<...>"; try { var t = r(e); return t ? "<" + t + ">" : "<...>"; } catch { return "<...>"; } } function c() { var e = X.A; return e === null ? null : e.getOwner(); } function a() { return Error("react-stack-top-frame"); } function v(e) { if (H.call(e, "key")) { var t = Object.getOwnPropertyDescriptor(e, "key").get; if (t && t.isReactWarning) return !1; } return e.key !== void 0; } function s(e, t) { function l() { Z || (Z = !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)", t )); } l.isReactWarning = !0, Object.defineProperty(e, "key", { get: l, configurable: !0 }); } function b() { var e = r(this.type); return F[e] || (F[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, t, l, f, g, R, C, j) { return l = R.ref, e = { $$typeof: S, type: e, key: t, props: R, _owner: g }, (l !== void 0 ? l : null) !== null ? Object.defineProperty(e, "ref", { enumerable: !1, get: b }) : 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: C }), Object.defineProperty(e, "_debugTask", { configurable: !1, enumerable: !1, writable: !0, value: j }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e; } function x(e, t, l, f, g, R, C, j) { var T = t.children; if (T !== void 0) if (f) if (ee(T)) { for (f = 0; f < T.length; f++) m(T[f]); 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 m(T); if (H.call(t, "key")) { T = r(e); var O = Object.keys(t).filter(function(D) { return D !== "key"; }); f = 0 < O.length ? "{key: someKey, " + O.join(": ..., ") + ": ...}" : "{key: someKey}", G[T + f] || (O = 0 < O.length ? "{" + O.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} />`, f, T, O, T ), G[T + f] = !0); } if (T = null, l !== void 0 && (p(l), T = "" + l), v(t) && (p(t.key), T = "" + t.key), "key" in t) { l = {}; for (var w in t) w !== "key" && (l[w] = t[w]); } else l = t; return T && s( l, typeof e == "function" ? e.displayName || e.name || "Unknown" : e ), E( e, T, R, g, c(), l, C, j ); } function m(e) { typeof e == "object" && e !== null && e.$$typeof === S && e._store && (e._store.validated = 1); } var y = $e, S = Symbol.for("react.transitional.element"), k = Symbol.for("react.portal"), _ = Symbol.for("react.fragment"), P = Symbol.for("react.strict_mode"), A = Symbol.for("react.profiler"), Y = Symbol.for("react.consumer"), N = Symbol.for("react.context"), I = Symbol.for("react.forward_ref"), o = Symbol.for("react.suspense"), L = Symbol.for("react.suspense_list"), z = Symbol.for("react.memo"), V = Symbol.for("react.lazy"), Q = Symbol.for("react.activity"), K = Symbol.for("react.client.reference"), X = y.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, H = Object.prototype.hasOwnProperty, ee = Array.isArray, U = console.createTask ? console.createTask : function() { return null; }; y = { react_stack_bottom_frame: function(e) { return e(); } }; var Z, F = {}, W = y.react_stack_bottom_frame.bind( y, a )(), B = U(i(a)), G = {}; ne.Fragment = _, ne.jsx = function(e, t, l, f, g) { var R = 1e4 > X.recentlyCreatedOwnerStacks++; return x( e, t, l, !1, f, g, R ? Error("react-stack-top-frame") : W, R ? U(i(e)) : B ); }, ne.jsxs = function(e, t, l, f, g) { var R = 1e4 > X.recentlyCreatedOwnerStacks++; return x( e, t, l, !0, f, g, R ? Error("react-stack-top-frame") : W, R ? U(i(e)) : B ); }; })()), ne; } var be; function We() { return be || (be = 1, process.env.NODE_ENV === "production" ? oe.exports = qe() : oe.exports = Fe()), oe.exports; } var d = We(); const Ke = ({ toggleState: r = void 0, onChangeToggleState: u, labelOn: p = "On", labelOff: i = "Off", ballSize: c = 24, transitionDuration: a = "300ms", backgroundColorOn: v = "white", backgroundColorOff: s = "lightgray", ballColorOn: b = "#348dfa", ballColorOff: E = "grey", style: x = {}, className: m = "" }) => { const [y, S] = J(r); ce(() => { r !== void 0 && S(r); }, [r]); const k = () => { r !== void 0 ? u && u(!y) : S(!y); }; return /* @__PURE__ */ d.jsxs( "div", { className: `toggle ${m}`, style: { "--ballSize": `${c}px`, ...x }, children: [ /* @__PURE__ */ d.jsx( "div", { className: "toggle-area", onClick: () => k(), style: { backgroundColor: y ? v : s, border: `.5px solid ${s}`, boxShadow: y ? `0 0 2px ${b}` : "none", transitionDuration: a }, children: /* @__PURE__ */ d.jsx( "div", { className: "toggle-ball-container", style: { width: y ? c : c * 2, transitionDuration: a }, children: /* @__PURE__ */ d.jsx( "div", { className: "toggle-ball", style: { backgroundColor: y ? b : E } } ) } ) } ), /* @__PURE__ */ d.jsx("p", { className: "toggle-label", children: y ? p : i }) ] } ); }, er = ({ children: r, className: u = "", style: p = {} }) => { const i = Ye(null), [c, a] = J(null), [v, s] = J({ rotationX: 0, rotationY: 0, rotationAngle: 0 }), [b, E] = J(1), x = (_, P) => Math.sqrt(_ ** 2 + P ** 2), m = (_, P) => { const A = _.y / 100, Y = -_.x / 100, N = Math.log(P) * 2; return { rotationX: A, rotationY: Y, rotationAngle: N }; }, y = (_) => { if (!c) return; const P = _.clientX, A = _.clientY, Y = P - c.x, N = A - c.y, I = { x: Y - c.width / 2, y: N - c.height / 2 }, o = x(I.x, I.y), { rotationX: L, rotationY: z, rotationAngle: V } = m( I, o ); s({ rotationX: L, rotationY: z, rotationAngle: V }), E(1.07); }, S = () => { const _ = i.current.getBoundingClientRect(); a(_); }, k = () => { i.current.style.transform = "", i.current.style.backgroundImage = "", E(1); }; return /* @__PURE__ */ d.jsx( "div", { ref: i, className: `hover-card ${u}`, style: { transform: b !== 1 ? ` scale3d(${b}, ${b}, ${b}) rotate3d(${v.rotationX}, ${v.rotationY}, 0, ${v.rotationAngle}deg)` : "none", perspective: b !== 1 ? "1500px" : "none", ...p }, onMouseEnter: S, onMouseMove: y, onMouseLeave: k, children: r } ); }, rr = ({ text: r = "", baseSpeed: u = 500, // Base speed for very short texts. style: p = {}, className: i = "", onEffectComplete: c = () => { } }) => { const [a, v] = J(""), [s, b] = J(0), x = ((m) => { const y = u / Math.log(m + 1); return Math.max(30, Math.min(y, 100)); })(r.length); return ce(() => { let m; return s < r.length ? m = setTimeout(() => { v((y) => y + r[s]), b((y) => y + 1); }, x) : c(), () => clearTimeout(m); }, [s, r, x]), ce(() => { v(""), b(0); }, [r]), /* @__PURE__ */ d.jsx("p", { className: `type-writer ${i}`, style: p, children: a }); }, tr = ({ children: r, onClick: u, buttonColor: p = "lightblue", style: i = {}, className: c = "" }) => /* @__PURE__ */ d.jsx( "button", { className: `animated-button ${c}`, onClick: u, style: { "--color": p, ...i }, children: r } ), nr = ({ children: r, isOpen: u, isCenter: p = !0, onModalClose: i = () => { }, className: c = "", style: a = {} }) => /* @__PURE__ */ d.jsx( "div", { className: `Modal ${p ? "modal-center" : ""} ${c}`, style: { ...a, display: Le(u, p) }, onClick: (v) => v.target.classList[0] === "Modal" && i(), children: u && r } ), Le = (r, u) => r ? r && u ? "grid" : "block" : "none", ar = ({ columns: r = [{ name: "", field: "" }], rows: u = [{ columnName: "value" }], className: p = "", style: i = {}, isPagination: c = !1, pageSize: a = 10, pageMenuPlacement: v = "center", isSerialized: s = !1 }) => { const [b, E] = J([0, a - 1]), x = (m) => { const [y, S] = b; m === "next" && S < u.length - 1 ? E([y + a, S + a]) : m === "previous" && y > 0 && E([y - a, S - a]); }; return /* @__PURE__ */ d.jsxs("div", { className: `simplicity-table ${p}`, style: i, children: [ /* @__PURE__ */ d.jsx("div", { className: "simplicity-table-container", children: /* @__PURE__ */ d.jsxs("table", { children: [ /* @__PURE__ */ d.jsx("thead", { children: /* @__PURE__ */ d.jsxs("tr", { children: [ s && /* @__PURE__ */ d.jsx("th", { children: "S.No" }), r.map((m, y) => /* @__PURE__ */ d.jsx("th", { children: m.name }, y)) ] }) }), /* @__PURE__ */ d.jsx("tbody", { children: u.slice(b[0], b[1] + 1).map((m, y) => /* @__PURE__ */ d.jsxs("tr", { children: [ s && /* @__PURE__ */ d.jsx("td", { children: b[0] + y + 1 }), r.map((S, k) => /* @__PURE__ */ d.jsx("td", { children: m[S.field || S.name] }, k)) ] }, y)) }) ] }) }), c && /* @__PURE__ */ d.jsxs( "div", { className: "simplicity-table-pagination", style: { justifyContent: v }, children: [ /* @__PURE__ */ d.jsx( "button", { onClick: () => E([0, a - 1]), disabled: b[0] === 0, children: "<<" } ), /* @__PURE__ */ d.jsx( "button", { onClick: () => x("previous"), disabled: b[0] === 0, children: "<" } ), /* @__PURE__ */ d.jsxs("p", { children: [ b[0] + 1, " - ", Math.min(b[1] + 1, u.length), " of", " ", u.length ] }), /* @__PURE__ */ d.jsx( "button", { onClick: () => x("next"), disabled: b[1] >= u.length - 1, children: ">" } ), /* @__PURE__ */ d.jsx( "button", { onClick: () => E([u.length - a, u.length - 1]), disabled: b[1] >= u.length - 1, children: ">>" } ) ] } ) ] }); }, or = ({ Tabs: r = [], children: u, color: p = "#cbdce1", style: i = {}, className: c = "", onTabChange: a = () => { }, value: v = 0, isNativeMomentDisable: s = !1 }) => { const [b, E] = J(v); ce(() => { E(v); }, [v]); const x = (m) => { s || (E(m), a(m)); }; return /* @__PURE__ */ d.jsxs( "section", { className: `Tabs ${c}`, style: { "--tabColor": p, ...i }, children: [ /* @__PURE__ */ d.jsx("div", { className: "Tabs-names", children: r.map((m, y) => /* @__PURE__ */ d.jsx( "span", { onClick: () => x(y), className: `Tab-name ${b === y ? "active-tab" : ""}`, children: m }, y )) }), /* @__PURE__ */ d.jsx("div", { className: "Tabs-area", children: /* @__PURE__ */ d.jsx("div", { style: { left: `-${b * 100}%` }, children: Ie.map(u, (m, y) => /* @__PURE__ */ d.jsx(d.Fragment, { children: m })) }) }) ] } ); }, sr = ({ children: r, style: u = {}, className: p = "" }) => /* @__PURE__ */ d.jsx("section", { className: `Tab ${p}`, style: u, children: r }); var se = { exports: {} }, ie = { exports: {} }, M = {}; /** @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 ge; function Ue() { if (ge) return M; ge = 1; var r = typeof Symbol == "function" && Symbol.for, u = r ? Symbol.for("react.element") : 60103, p = r ? Symbol.for("react.portal") : 60106, i = r ? Symbol.for("react.fragment") : 60107, c = r ? Symbol.for("react.strict_mode") : 60108, a = r ? Symbol.for("react.profiler") : 60114, v = r ? Symbol.for("react.provider") : 60109, s = r ? Symbol.for("react.context") : 60110, b = r ? Symbol.for("react.async_mode") : 60111, E = r ? Symbol.for("react.concurrent_mode") : 60111, x = r ? Symbol.for("react.forward_ref") : 60112, m = r ? Symbol.for("react.suspense") : 60113, y = r ? Symbol.for("react.suspense_list") : 60120, S = r ? Symbol.for("react.memo") : 60115, k = r ? Symbol.for("react.lazy") : 60116, _ = r ? Symbol.for("react.block") : 60121, P = r ? Symbol.for("react.fundamental") : 60117, A = r ? Symbol.for("react.responder") : 60118, Y = r ? Symbol.for("react.scope") : 60119; function N(o) { if (typeof o == "object" && o !== null) { var L = o.$$typeof; switch (L) { case u: switch (o = o.type, o) { case b: case E: case i: case a: case c: case m: return o; default: switch (o = o && o.$$typeof, o) { case s: case x: case k: case S: case v: return o; default: return L; } } case p: return L; } } } function I(o) { return N(o) === E; } return M.AsyncMode = b, M.ConcurrentMode = E, M.ContextConsumer = s, M.ContextProvider = v, M.Element = u, M.ForwardRef = x, M.Fragment = i, M.Lazy = k, M.Memo = S, M.Portal = p, M.Profiler = a, M.StrictMode = c, M.Suspense = m, M.isAsyncMode = function(o) { return I(o) || N(o) === b; }, M.isConcurrentMode = I, M.isContextConsumer = function(o) { return N(o) === s; }, M.isContextProvider = function(o) { return N(o) === v; }, M.isElement = function(o) { return typeof o == "object" && o !== null && o.$$typeof === u; }, M.isForwardRef = function(o) { return N(o) === x; }, M.isFragment = function(o) { return N(o) === i; }, M.isLazy = function(o) { return N(o) === k; }, M.isMemo = function(o) { return N(o) === S; }, M.isPortal = function(o) { return N(o) === p; }, M.isProfiler = function(o) { return N(o) === a; }, M.isStrictMode = function(o) { return N(o) === c; }, M.isSuspense = function(o) { return N(o) === m; }, M.isValidElementType = function(o) { return typeof o == "string" || typeof o == "function" || o === i || o === E || o === a || o === c || o === m || o === y || typeof o == "object" && o !== null && (o.$$typeof === k || o.$$typeof === S || o.$$typeof === v || o.$$typeof === s || o.$$typeof === x || o.$$typeof === P || o.$$typeof === A || o.$$typeof === Y || o.$$typeof === _); }, M.typeOf = N, M; } var $ = {}; /** @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 xe; function Je() { return xe || (xe = 1, process.env.NODE_ENV !== "production" && (function() { var r = typeof Symbol == "function" && Symbol.for, u = r ? Symbol.for("react.element") : 60103, p = r ? Symbol.for("react.portal") : 60106, i = r ? Symbol.for("react.fragment") : 60107, c = r ? Symbol.for("react.strict_mode") : 60108, a = r ? Symbol.for("react.profiler") : 60114, v = r ? Symbol.for("react.provider") : 60109, s = r ? Symbol.for("react.context") : 60110, b = r ? Symbol.for("react.async_mode") : 60111, E = r ? Symbol.for("react.concurrent_mode") : 60111, x = r ? Symbol.for("react.forward_ref") : 60112, m = r ? Symbol.for("react.suspense") : 60113, y = r ? Symbol.for("react.suspense_list") : 60120, S = r ? Symbol.for("react.memo") : 60115, k = r ? Symbol.for("react.lazy") : 60116, _ = r ? Symbol.for("react.block") : 60121, P = r ? Symbol.for("react.fundamental") : 60117, A = r ? Symbol.for("react.responder") : 60118, Y = r ? Symbol.for("react.scope") : 60119; function N(n) { return typeof n == "string" || typeof n == "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. n === i || n === E || n === a || n === c || n === m || n === y || typeof n == "object" && n !== null && (n.$$typeof === k || n.$$typeof === S || n.$$typeof === v || n.$$typeof === s || n.$$typeof === x || n.$$typeof === P || n.$$typeof === A || n.$$typeof === Y || n.$$typeof === _); } function I(n) { if (typeof n == "object" && n !== null) { var q = n.$$typeof; switch (q) { case u: var re = n.type; switch (re) { case b: case E: case i: case a: case c: case m: return re; default: var ae = re && re.$$typeof; switch (ae) { case s: case x: case k: case S: case v: return ae; default: return q; } } case p: return q; } } } var o = b, L = E, z = s, V = v, Q = u, K = x, X = i, H = k, ee = S, U = p, Z = a, F = c, W = m, B = !1; function G(n) { return B || (B = !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) || I(n) === b; } function e(n) { return I(n) === E; } function t(n) { return I(n) === s; } function l(n) { return I(n) === v; } function f(n) { return typeof n == "object" && n !== null && n.$$typeof === u; } function g(n) { return I(n) === x; } function R(n) { return I(n) === i; } function C(n) { return I(n) === k; } function j(n) { return I(n) === S; } function T(n) { return I(n) === p; } function O(n) { return I(n) === a; } function w(n) { return I(n) === c; } function D(n) { return I(n) === m; } $.AsyncMode = o, $.ConcurrentMode = L, $.ContextConsumer = z, $.ContextProvider = V, $.Element = Q, $.ForwardRef = K, $.Fragment = X, $.Lazy = H, $.Memo = ee, $.Portal = U, $.Profiler = Z, $.StrictMode = F, $.Suspense = W, $.isAsyncMode = G, $.isConcurrentMode = e, $.isContextConsumer = t, $.isContextProvider = l, $.isElement = f, $.isForwardRef = g, $.isFragment = R, $.isLazy = C, $.isMemo = j, $.isPortal = T, $.isProfiler = O, $.isStrictMode = w, $.isSuspense = D, $.isValidElementType = N, $.typeOf = I; })()), $; } var Te; function we() { return Te || (Te = 1, process.env.NODE_ENV === "production" ? ie.exports = Ue() : ie.exports = Je()), ie.exports; } /* object-assign (c) Sindre Sorhus @license MIT */ var ue, Ee; function Ve() { if (Ee) return ue; Ee = 1; var r = Object.getOwnPropertySymbols, u = Object.prototype.hasOwnProperty, p = Object.prototype.propertyIsEnumerable; function i(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 v = {}, s = 0; s < 10; s++) v["_" + String.fromCharCode(s)] = s; var b = Object.getOwnPropertyNames(v).map(function(x) { return v[x]; }); if (b.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 ue = c() ? Object.assign : function(a, v) { for (var s, b = i(a), E, x = 1; x < arguments.length; x++) { s = Object(arguments[x]); for (var m in s) u.call(s, m) && (b[m] = s[m]); if (r) { E = r(s); for (var y = 0; y < E.length; y++) p.call(s, E[y]) && (b[E[y]] = s[E[y]]); } } return b; }, ue; } var le, Re; function ve() { if (Re) return le; Re = 1; var r = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"; return le = r, le; } var fe, _e; function Pe() { return _e || (_e = 1, fe = Function.call.bind(Object.prototype.hasOwnProperty)), fe; } var de, Ce; function Xe() { if (Ce) return de; Ce = 1; var r = function() { }; if (process.env.NODE_ENV !== "production") { var u = /* @__PURE__ */ ve(), p = {}, i = /* @__PURE__ */ Pe(); r = function(a) { var v = "Warning: " + a; typeof console < "u" && console.error(v); try { throw new Error(v); } catch { } }; } function c(a, v, s, b, E) { if (process.env.NODE_ENV !== "production") { for (var x in a) if (i(a, x)) { var m; try { if (typeof a[x] != "function") { var y = Error( (b || "React class") + ": " + s + " 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; } m = a[x](v, x, b, s, null, u); } catch (k) { m = k; } if (m && !(m instanceof Error) && r( (b || "React class") + ": type specification of " + s + " `" + x + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof m + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)." ), m instanceof Error && !(m.message in p)) { p[m.message] = !0; var S = E ? E() : ""; r( "Failed " + s + " type: " + m.message + (S ?? "") ); } } } } return c.resetWarningCache = function() { process.env.NODE_ENV !== "production" && (p = {}); }, de = c, de; } var pe, je; function ze() { if (je) return pe; je = 1; var r = we(), u = Ve(), p = /* @__PURE__ */ ve(), i = /* @__PURE__ */ Pe(), c = /* @__PURE__ */ Xe(), a = function() { }; process.env.NODE_ENV !== "production" && (a = function(s) { var b = "Warning: " + s; typeof console < "u" && console.error(b); try { throw new Error(b); } catch { } }); function v() { return null; } return pe = function(s, b) { var E = typeof Symbol == "function" && Symbol.iterator, x = "@@iterator"; function m(e) { var t = e && (E && e[E] || e[x]); if (typeof t == "function") return t; } var y = "<<anonymous>>", S = { array: A("array"), bigint: A("bigint"), bool: A("boolean"), func: A("function"), number: A("number"), object: A("object"), string: A("string"), symbol: A("symbol"), any: Y(), arrayOf: N, element: I(), elementType: o(), instanceOf: L, node: K(), objectOf: V, oneOf: z, oneOfType: Q, shape: H, exact: ee }; function k(e, t) { return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t; } function _(e, t) { this.message = e, this.data = t && typeof t == "object" ? t : {}, this.stack = ""; } _.prototype = Error.prototype; function P(e) { if (process.env.NODE_ENV !== "production") var t = {}, l = 0; function f(R, C, j, T, O, w, D) { if (T = T || y, w = w || j, D !== p) { if (b) { 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 q = T + ":" + j; !t[q] && // Avoid spamming the console because they are often not actionable except for lib authors l < 3 && (a( "You are manually calling a React.PropTypes validation function for the `" + w + "` 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." ), t[q] = !0, l++); } } return C[j] == null ? R ? C[j] === null ? new _("The " + O + " `" + w + "` is marked as required " + ("in `" + T + "`, but its value is `null`.")) : new _("The " + O + " `" + w + "` is marked as required in " + ("`" + T + "`, but its value is `undefined`.")) : null : e(C, j, T, O, w); } var g = f.bind(null, !1); return g.isRequired = f.bind(null, !0), g; } function A(e) { function t(l, f, g, R, C, j) { var T = l[f], O = F(T); if (O !== e) { var w = W(T); return new _( "Invalid " + R + " `" + C + "` of type " + ("`" + w + "` supplied to `" + g + "`, expected ") + ("`" + e + "`."), { expectedType: e } ); } return null; } return P(t); } function Y() { return P(v); } function N(e) { function t(l, f, g, R, C) { if (typeof e != "function") return new _("Property `" + C + "` of component `" + g + "` has invalid PropType notation inside arrayOf."); var j = l[f]; if (!Array.isArray(j)) { var T = F(j); return new _("Invalid " + R + " `" + C + "` of type " + ("`" + T + "` supplied to `" + g + "`, expected an array.")); } for (var O = 0; O < j.length; O++) { var w = e(j, O, g, R, C + "[" + O + "]", p); if (w instanceof Error) return w; } return null; } return P(t); } function I() { function e(t, l, f, g, R) { var C = t[l]; if (!s(C)) { var j = F(C); return new _("Invalid " + g + " `" + R + "` of type " + ("`" + j + "` supplied to `" + f + "`, expected a single ReactElement.")); } return null; } return P(e); } function o() { function e(t, l, f, g, R) { var C = t[l]; if (!r.isValidElementType(C)) { var j = F(C); return new _("Invalid " + g + " `" + R + "` of type " + ("`" + j + "` supplied to `" + f + "`, expected a single ReactElement type.")); } return null; } return P(e); } function L(e) { function t(l, f, g, R, C) { if (!(l[f] instanceof e)) { var j = e.name || y, T = G(l[f]); return new _("Invalid " + R + " `" + C + "` of type " + ("`" + T + "` supplied to `" + g + "`, expected ") + ("instance of `" + j + "`.")); } return null; } return P(t); } function z(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.")), v; function t(l, f, g, R, C) { for (var j = l[f], T = 0; T < e.length; T++) if (k(j, e[T])) return null; var O = JSON.stringify(e, function(D, n) { var q = W(n); return q === "symbol" ? String(n) : n; }); return new _("Invalid " + R + " `" + C + "` of value `" + String(j) + "` " + ("supplied to `" + g + "`, expected one of " + O + ".")); } return P(t); } function V(e) { function t(l, f, g, R, C) { if (typeof e != "function") return new _("Property `" + C + "` of component `" + g + "` has invalid PropType notation inside objectOf."); var j = l[f], T = F(j); if (T !== "object") return new _("Invalid " + R + " `" + C + "` of type " + ("`" + T + "` supplied to `" + g + "`, expected an object.")); for (var O in j) if (i(j, O)) { var w = e(j, O, g, R, C + "." + O, p); if (w instanceof Error) return w; } return null; } return P(t); } function Q(e) { if (!Array.isArray(e)) return process.env.NODE_ENV !== "production" && a("Invalid argument supplied to oneOfType, expected an instance of array."), v; for (var t = 0; t < e.length; t++) { var l = e[t]; if (typeof l != "function") return a( "Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + B(l) + " at index " + t + "." ), v; } function f(g, R, C, j, T) { for (var O = [], w = 0; w < e.length; w++) { var D = e[w], n = D(g, R, C, j, T, p); if (n == null) return null; n.data && i(n.data, "expectedType") && O.push(n.data.expectedType); } var q = O.length > 0 ? ", expected one of type [" + O.join(", ") + "]" : ""; return new _("Invalid " + j + " `" + T + "` supplied to " + ("`" + C + "`" + q + ".")); } return P(f); } function K() { function e(t, l, f, g, R) { return U(t[l]) ? null : new _("Invalid " + g + " `" + R + "` supplied to " + ("`" + f + "`, expected a ReactNode.")); } return P(e); } function X(e, t, l, f, g) { return new _( (e || "React class") + ": " + t + " type `" + l + "." + f + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + g + "`." ); } function H(e) { function t(l, f, g, R, C) { var j = l[f], T = F(j); if (T !== "object") return new _("Invalid " + R + " `" + C + "` of type `" + T + "` " + ("supplied to `" + g + "`, expected `object`.")); for (var O in e) { var w = e[O]; if (typeof w != "function") return X(g, R, C, O, W(w)); var D = w(j, O, g, R, C + "." + O, p); if (D) return D; } return null; } return P(t); } function ee(e) { function t(l, f, g, R, C) { var j = l[f], T = F(j); if (T !== "object") return new _("Invalid " + R + " `" + C + "` of type `" + T + "` " + ("supplied to `" + g + "`, expected `object`.")); var O = u({}, l[f], e); for (var w in O) { var D = e[w]; if (i(e, w) && typeof D != "function") return X(g, R, C, w, W(D)); if (!D) return new _( "Invalid " + R + " `" + C + "` key `" + w + "` supplied to `" + g + "`.\nBad object: " + JSON.stringify(l[f], null, " ") + ` Valid keys: ` + JSON.stringify(Object.keys(e), null, " ") ); var n = D(j, w, g, R, C + "." + w, p); if (n) return n; } return null; } return P(t); } function U(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(U); if (e === null || s(e)) return !0; var t = m(e); if (t) { var l = t.call(e), f; if (t !== e.entries) { for (; !(f = l.next()).done; ) if (!U(f.value)) return !1; } else for (; !(f = l.next()).done; ) { var g = f.value; if (g && !U(g[1])) return !1; } } else return !1; return !0; default: return !1; } } function Z(e, t) { return e === "symbol" ? !0 : t ? t["@@toStringTag"] === "Symbol" || typeof Symbol == "function" && t instanceof Symbol : !1; } function F(e) { var t = typeof e; return Array.isArray(e) ? "array" : e instanceof RegExp ? "object" : Z(t, e) ? "symbol" : t; } function W(e) { if (typeof e > "u" || e === null) return "" + e; var t = F(e); if (t === "object") { if (e instanceof Date) return "date"; if (e instanceof RegExp) return "regexp"; } return t; } function B(e) { var t = W(e); switch (t) { case "array": case "object": return "an " + t; case "boolean": case "date": case "regexp": return "a " + t; default: return t; } } function G(e) { return !e.constructor || !e.constructor.name ? y : e.constructor.name; } return S.checkPropTypes = c, S.resetWarningCache = c.resetWarningCache, S.PropTypes = S, S; }, pe; } var ye, Se; function Be() { if (Se) return ye; Se = 1; var r = /* @__PURE__ */ ve(); function u() { } function p() { } return p.resetWarningCache = u, ye = function() { function i(v, s, b, E, x, m) { if (m !== r) { 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; } } i.isRequired = i; function c() { return i; } var a = { array: i, bigint: i, bool: i, func: i, number: i, object: i, string: i, symbol: i, any: i, arrayOf: c, element: i, elementType: i, instanceOf: c, node: i, objectOf: c, oneOf: c, oneOfType: c, shape: c, exact: c, checkPropTypes: p, resetWarningCache: u }; return a.PropTypes = a, a; }, ye; } var Oe; function Ge() { if (Oe) return se.exports; if (Oe = 1, process.env.NODE_ENV !== "production") { var r = we(), u = !0; se.exports = /* @__PURE__ */ ze()(r.isElement, u); } else se.exports = /* @__PURE__ */ Be()(); return se.exports; } var He = /* @__PURE__ */ Ge(); const h = /* @__PURE__ */ De(He), Ae = ({ day: r, isSelected: u, isToday: p, onClick: i, dayClassName: c, selectedDayClassName: a, todayClassName: v }) => /* @__PURE__ */ d.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 ${u ? a || "bg-blue-500 text-white font-semibold rounded-md" : ""} ${p ? v || "bg-blue-100 text-blue-800 font-semibold rounded-md" : ""} ${c || ""}`, onClick: () => i(r), children: r } ); Ae.propTypes = { day: h.number.isRequired, isSelected: h.bool.isRequired, isToday: h.bool.isRequired, onClick: h.func.isRequired, dayClassName: h.string, selectedDayClassName: h.string, todayClassName: h.string }; const ke = ({ children: r, weekClassName: u }) => /* @__PURE__ */ d.jsx("tr", { className: u, children: r }); ke.propTypes = { children: h.node.isRequired, weekClassName: h.string }; const Ne = ({ month: r, year: u, onPrevious: p, onNext: i, headerClassName: c, monthYearClassName: a, navigationClassName: v, weekdayClassName: s }) => /* @__PURE__ */ d.jsxs("thead", { className: c, children: [ /* @__PURE__ */ d.jsxs("tr", { children: [ /* @__PURE__ */ d.jsx( "th", { className: v || "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: "‹" } ), /* @__PURE__ */ d.jsxs( "th", { className: a || "text-base font-semibold text-center text-gray-800 p-3", colSpan: "5", children: [ r, " ", u ] } ), /* @__PURE__ */ d.jsx( "th", { className: v || "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: i, children: "›" } ) ] }), /* @__PURE__ */ d.jsxs("tr", { children: [ /* @__PURE__ */ d.jsx( "th", { className: s || "p-2 font-medium text-gray-600 text-xs uppercase tracking-wide", children: "Sun" } ), /* @__PURE__ */ d.jsx( "th", { className: s || "p-2 font-medium text-gray-600 text-xs uppercase tracking-wide", children: "Mon" } ), /* @__PURE__ */ d.jsx( "th", { className: s || "p-2 font-medium text-gray-600 text-xs uppercase tracking-wide", children: "Tue" } ), /* @__PURE__ */ d.jsx( "th", { className: s || "p-2 font-medium text-gray-600 text-xs uppercase tracking-wide", children: "Wed" } ), /* @__PURE__ */ d.jsx( "th", { className: s || "p-2 font-medium text-gray-600 text-xs uppercase tracking-wide", children: "Thu" } ), /* @__PURE__ */ d.jsx( "th", { className: s || "p-2 font-medium text-gray-600 text-xs uppercase tracking-wide", children: "Fri" } ), /* @__PURE__ */ d.jsx( "th", { className: s || "p-2 font-medium text-gray-600 text-xs uppercase tracking-wide", children: "Sat" } ) ] }) ] }); Ne.propTypes = { month: h.string.isRequired, year: h.number.isRequired, onPrevious: h.func.isRequired, onNext: h.func.isRequired, headerClassName: h.string, monthYearClassName: h.string, navigationClassName: h.string, weekdayClassName: h.string }; const Me = ({ month: r, year: u, selectedDate: p, onDateClick: i, gridClassName: c, dayClassName: a, selectedDayClassName: v, todayClassName: s, weekClassName: b }) => { const E = (A, Y) => new Date(Y, A + 1, 0).getDate(), x = (A, Y) => new Date(Y, A, 1).getDay(), m = (A) => { const Y = /* @__PURE__ */ new Date(); return A === Y.getDate() && r === Y.getMonth() && u === Y.getFullYear(); }, y = (A) => p && A === p.getDate() && r === p.getMonth() && u === p.getFullYear(), S = E(r, u), k = x(r, u), _ = []; let P = 1; for (let A = 0; A < 6; A++) { const Y = []; for (let N = 0; N < 7; N++) A === 0 && N < k ? Y.push(/* @__PURE__ */ d.jsx("td", {}, `empty-${N}`)) : P <= S && (Y.push( /* @__PURE__ */ d.jsx( Ae, { day: P, isSelected: y(P), isToday: m(P), onClick: i, dayClassName: a, selectedDayClassName: v, todayClassName: s }, P ) ), P++); if (Y.length > 0 && _.push( /* @__PURE__ */ d.jsx(ke, { weekClassName: b, children: Y }, A) ), P > S) break; } return /* @__PURE__ */ d.jsx("tbody", { className: c, children: _ }); }; Me.propTypes = { month: h.number.isRequired, year: h.number.isRequired, selectedDate: h.instanceOf(Date), onDateClick: h.func.isRequired, gridClassName: h.string, dayClassName: h.string, selectedDayClassName: h.string, todayClassName: h.string, weekClassName: h.string }; const Ze = ({ onDateSelect: r, onDateChange: u, onMonthChange: p, onYearChange: i, onOpen: c, onClose: a, defaultDate: v = /* @__PURE__ */ new Date(), dateFormat: s = "DD-MM-YYYY", placeholder: b = "Select Date", disabled: E = !1, // Control Props isOpen: x, onToggle: m, hideInput: y = !1, // Date Control Props selectedDate: S, displayMonth: k, displayYear: _, // CSS Customization Props containerClassName: P, inputClassName: A, iconClassName: Y, dropdownClassName: N, tableClassName: I, headerClassName: o, monthYearClassName: L, navigationClassName: z, weekdayClassName: V, gridClassName: Q, weekClassName: K, dayClassName: X, selectedDayClassName: H, todayClassName: ee }) => { const [U, Z] = J(v), [F, W] = J( v.getMonth() ), [B, G] = J( v.getFullYear() ), [e, t] = J(!1), l = S !== void 0 ? S : U, f = k !== void 0 ? k : F, g = _ !== void 0 ? _ : B, R = x !== void 0 ? x : e, C = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], j = (n) => { const q = n.getDate().toString().padStart(2, "0"), re = (n.getMonth() + 1).toString().padStart(2, "0"), ae = n.getFullYear(); return s.replace("DD", q).replace("MM", re).replace("YYYY", ae); }, T = (n) => { if (E) return; const q = new Date(g, f, n); S === void 0 && Z(q), r?.(q), u?.(q), x === void 0 && t(!1), m?.(!1), a?.(); }, O = () => { if (f === 0) { const n = g - 1; k === void 0 && W(11), _ === void 0 && G(n), p?.(11), i?.(n); } else { const n = f - 1; k === void 0 && W(n), p?.(n); } }, w = () => { if (f === 11) { const n = g + 1; k === void 0 && W(0), _ === void 0 && G(n), p?.(0), i?.(n); } else { const n = f + 1; k === void 0 && W(n), p?.(n); } }, D = () => { if (E) return; const n = !R; x === void 0 && t(n), m?.(n), n ? c?.() : a?.(); }; return /* @__PURE__ */ d.jsxs( "div", { className: P || `relative w-max font-sans ${E ? "opacity-60 pointer-events-none" : ""}`, children: [ !y && /* @__PURE__ */ d.jsxs( "div", { className: A || "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: D, children: [ /* @__PURE__ */ d.jsx("div", { className: "text-sm text-gray-700 flex-1", children: l ? j(l) : b }), /* @__PURE__ */ d.jsx("span", { className: Y || "text-lg text-gray-600", children: "📅" }) ] } ), R && !E && /* @__PURE__ */ d.jsx( "div", { className: N || `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: /* @__PURE__ */ d.jsxs("table", { className: I || "text-sm border-collapse w-full", children: [ /* @__PURE__ */ d.jsx( Ne, { month: C[f], year: g, onPrevious: O, onNext: w, headerClassName: o, monthYearClassName: L, navigationClassName: z, weekdayClassName: V } ), /* @__PURE__ */ d.jsx( Me, { month: f, year: g, selectedDate: l, onDateClick: T, gridClassName: Q, dayClassName: X, selectedDayClassName: H, todayClassName: ee, weekClassName: K } ) ] }) } ) ] } ); }; Ze.propTypes = { // Event Handlers onDateSelect: h.func, onDateChange: h.func, onMonthChange: h.func, onYearChange: h.func, onOpen: h.func, onClose: h.func, onToggle: h.func, // Configuration defaultDate: h.instanceOf(Date), dateFormat: h.string, placeholder: h.string, disabled: h.bool, // Control Props isOpen: h.bool, hideInput: h.bool, // Date Control Props selectedDate: h.instanceOf(Date), displayMonth: h.number, displayYear: h.number, // CSS Customi