@himal_bhattarai/nepali-datepicker 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -0
- package/dist/nepali-datepicker.es.js +751 -0
- package/dist/nepali-datepicker.umd.js +188 -0
- package/package.json +31 -0
package/README.md
ADDED
|
File without changes
|
|
@@ -0,0 +1,751 @@
|
|
|
1
|
+
import ye, { useState as R, useRef as le, useEffect as ie, useCallback as we } from "react";
|
|
2
|
+
var Q = { exports: {} }, B = {};
|
|
3
|
+
var ce;
|
|
4
|
+
function ke() {
|
|
5
|
+
if (ce) return B;
|
|
6
|
+
ce = 1;
|
|
7
|
+
var n = /* @__PURE__ */ Symbol.for("react.transitional.element"), c = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
8
|
+
function b(p, s, i) {
|
|
9
|
+
var d = null;
|
|
10
|
+
if (i !== void 0 && (d = "" + i), s.key !== void 0 && (d = "" + s.key), "key" in s) {
|
|
11
|
+
i = {};
|
|
12
|
+
for (var u in s)
|
|
13
|
+
u !== "key" && (i[u] = s[u]);
|
|
14
|
+
} else i = s;
|
|
15
|
+
return s = i.ref, {
|
|
16
|
+
$$typeof: n,
|
|
17
|
+
type: p,
|
|
18
|
+
key: d,
|
|
19
|
+
ref: s !== void 0 ? s : null,
|
|
20
|
+
props: i
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return B.Fragment = c, B.jsx = b, B.jsxs = b, B;
|
|
24
|
+
}
|
|
25
|
+
var I = {};
|
|
26
|
+
var pe;
|
|
27
|
+
function je() {
|
|
28
|
+
return pe || (pe = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
29
|
+
function n(e) {
|
|
30
|
+
if (e == null) return null;
|
|
31
|
+
if (typeof e == "function")
|
|
32
|
+
return e.$$typeof === C ? null : e.displayName || e.name || null;
|
|
33
|
+
if (typeof e == "string") return e;
|
|
34
|
+
switch (e) {
|
|
35
|
+
case x:
|
|
36
|
+
return "Fragment";
|
|
37
|
+
case h:
|
|
38
|
+
return "Profiler";
|
|
39
|
+
case N:
|
|
40
|
+
return "StrictMode";
|
|
41
|
+
case re:
|
|
42
|
+
return "Suspense";
|
|
43
|
+
case ne:
|
|
44
|
+
return "SuspenseList";
|
|
45
|
+
case U:
|
|
46
|
+
return "Activity";
|
|
47
|
+
}
|
|
48
|
+
if (typeof e == "object")
|
|
49
|
+
switch (typeof e.tag == "number" && console.error(
|
|
50
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
51
|
+
), e.$$typeof) {
|
|
52
|
+
case S:
|
|
53
|
+
return "Portal";
|
|
54
|
+
case A:
|
|
55
|
+
return e.displayName || "Context";
|
|
56
|
+
case k:
|
|
57
|
+
return (e._context.displayName || "Context") + ".Consumer";
|
|
58
|
+
case O:
|
|
59
|
+
var o = e.render;
|
|
60
|
+
return e = e.displayName, e || (e = o.displayName || o.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
61
|
+
case te:
|
|
62
|
+
return o = e.displayName || null, o !== null ? o : n(e.type) || "Memo";
|
|
63
|
+
case P:
|
|
64
|
+
o = e._payload, e = e._init;
|
|
65
|
+
try {
|
|
66
|
+
return n(e(o));
|
|
67
|
+
} catch {
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
function c(e) {
|
|
73
|
+
return "" + e;
|
|
74
|
+
}
|
|
75
|
+
function b(e) {
|
|
76
|
+
try {
|
|
77
|
+
c(e);
|
|
78
|
+
var o = !1;
|
|
79
|
+
} catch {
|
|
80
|
+
o = !0;
|
|
81
|
+
}
|
|
82
|
+
if (o) {
|
|
83
|
+
o = console;
|
|
84
|
+
var a = o.error, l = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
85
|
+
return a.call(
|
|
86
|
+
o,
|
|
87
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
88
|
+
l
|
|
89
|
+
), c(e);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function p(e) {
|
|
93
|
+
if (e === x) return "<>";
|
|
94
|
+
if (typeof e == "object" && e !== null && e.$$typeof === P)
|
|
95
|
+
return "<...>";
|
|
96
|
+
try {
|
|
97
|
+
var o = n(e);
|
|
98
|
+
return o ? "<" + o + ">" : "<...>";
|
|
99
|
+
} catch {
|
|
100
|
+
return "<...>";
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function s() {
|
|
104
|
+
var e = Y.A;
|
|
105
|
+
return e === null ? null : e.getOwner();
|
|
106
|
+
}
|
|
107
|
+
function i() {
|
|
108
|
+
return Error("react-stack-top-frame");
|
|
109
|
+
}
|
|
110
|
+
function d(e) {
|
|
111
|
+
if (X.call(e, "key")) {
|
|
112
|
+
var o = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
113
|
+
if (o && o.isReactWarning) return !1;
|
|
114
|
+
}
|
|
115
|
+
return e.key !== void 0;
|
|
116
|
+
}
|
|
117
|
+
function u(e, o) {
|
|
118
|
+
function a() {
|
|
119
|
+
q || (q = !0, console.error(
|
|
120
|
+
"%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)",
|
|
121
|
+
o
|
|
122
|
+
));
|
|
123
|
+
}
|
|
124
|
+
a.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
125
|
+
get: a,
|
|
126
|
+
configurable: !0
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function g() {
|
|
130
|
+
var e = n(this.type);
|
|
131
|
+
return ae[e] || (ae[e] = !0, console.error(
|
|
132
|
+
"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."
|
|
133
|
+
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
134
|
+
}
|
|
135
|
+
function j(e, o, a, l, $, L) {
|
|
136
|
+
var f = a.ref;
|
|
137
|
+
return e = {
|
|
138
|
+
$$typeof: E,
|
|
139
|
+
type: e,
|
|
140
|
+
key: o,
|
|
141
|
+
props: a,
|
|
142
|
+
_owner: l
|
|
143
|
+
}, (f !== void 0 ? f : null) !== null ? Object.defineProperty(e, "ref", {
|
|
144
|
+
enumerable: !1,
|
|
145
|
+
get: g
|
|
146
|
+
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
147
|
+
configurable: !1,
|
|
148
|
+
enumerable: !1,
|
|
149
|
+
writable: !0,
|
|
150
|
+
value: 0
|
|
151
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
152
|
+
configurable: !1,
|
|
153
|
+
enumerable: !1,
|
|
154
|
+
writable: !0,
|
|
155
|
+
value: null
|
|
156
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
157
|
+
configurable: !1,
|
|
158
|
+
enumerable: !1,
|
|
159
|
+
writable: !0,
|
|
160
|
+
value: $
|
|
161
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
162
|
+
configurable: !1,
|
|
163
|
+
enumerable: !1,
|
|
164
|
+
writable: !0,
|
|
165
|
+
value: L
|
|
166
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
167
|
+
}
|
|
168
|
+
function v(e, o, a, l, $, L) {
|
|
169
|
+
var f = o.children;
|
|
170
|
+
if (f !== void 0)
|
|
171
|
+
if (l)
|
|
172
|
+
if (oe(f)) {
|
|
173
|
+
for (l = 0; l < f.length; l++)
|
|
174
|
+
y(f[l]);
|
|
175
|
+
Object.freeze && Object.freeze(f);
|
|
176
|
+
} else
|
|
177
|
+
console.error(
|
|
178
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
179
|
+
);
|
|
180
|
+
else y(f);
|
|
181
|
+
if (X.call(o, "key")) {
|
|
182
|
+
f = n(e);
|
|
183
|
+
var _ = Object.keys(o).filter(function(se) {
|
|
184
|
+
return se !== "key";
|
|
185
|
+
});
|
|
186
|
+
l = 0 < _.length ? "{key: someKey, " + _.join(": ..., ") + ": ...}" : "{key: someKey}", Z[f + l] || (_ = 0 < _.length ? "{" + _.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
187
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
188
|
+
let props = %s;
|
|
189
|
+
<%s {...props} />
|
|
190
|
+
React keys must be passed directly to JSX without using spread:
|
|
191
|
+
let props = %s;
|
|
192
|
+
<%s key={someKey} {...props} />`,
|
|
193
|
+
l,
|
|
194
|
+
f,
|
|
195
|
+
_,
|
|
196
|
+
f
|
|
197
|
+
), Z[f + l] = !0);
|
|
198
|
+
}
|
|
199
|
+
if (f = null, a !== void 0 && (b(a), f = "" + a), d(o) && (b(o.key), f = "" + o.key), "key" in o) {
|
|
200
|
+
a = {};
|
|
201
|
+
for (var T in o)
|
|
202
|
+
T !== "key" && (a[T] = o[T]);
|
|
203
|
+
} else a = o;
|
|
204
|
+
return f && u(
|
|
205
|
+
a,
|
|
206
|
+
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
207
|
+
), j(
|
|
208
|
+
e,
|
|
209
|
+
f,
|
|
210
|
+
a,
|
|
211
|
+
s(),
|
|
212
|
+
$,
|
|
213
|
+
L
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
function y(e) {
|
|
217
|
+
D(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === P && (e._payload.status === "fulfilled" ? D(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
218
|
+
}
|
|
219
|
+
function D(e) {
|
|
220
|
+
return typeof e == "object" && e !== null && e.$$typeof === E;
|
|
221
|
+
}
|
|
222
|
+
var w = ye, E = /* @__PURE__ */ Symbol.for("react.transitional.element"), S = /* @__PURE__ */ Symbol.for("react.portal"), x = /* @__PURE__ */ Symbol.for("react.fragment"), N = /* @__PURE__ */ Symbol.for("react.strict_mode"), h = /* @__PURE__ */ Symbol.for("react.profiler"), k = /* @__PURE__ */ Symbol.for("react.consumer"), A = /* @__PURE__ */ Symbol.for("react.context"), O = /* @__PURE__ */ Symbol.for("react.forward_ref"), re = /* @__PURE__ */ Symbol.for("react.suspense"), ne = /* @__PURE__ */ Symbol.for("react.suspense_list"), te = /* @__PURE__ */ Symbol.for("react.memo"), P = /* @__PURE__ */ Symbol.for("react.lazy"), U = /* @__PURE__ */ Symbol.for("react.activity"), C = /* @__PURE__ */ Symbol.for("react.client.reference"), Y = w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, X = Object.prototype.hasOwnProperty, oe = Array.isArray, M = console.createTask ? console.createTask : function() {
|
|
223
|
+
return null;
|
|
224
|
+
};
|
|
225
|
+
w = {
|
|
226
|
+
react_stack_bottom_frame: function(e) {
|
|
227
|
+
return e();
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
var q, ae = {}, J = w.react_stack_bottom_frame.bind(
|
|
231
|
+
w,
|
|
232
|
+
i
|
|
233
|
+
)(), H = M(p(i)), Z = {};
|
|
234
|
+
I.Fragment = x, I.jsx = function(e, o, a) {
|
|
235
|
+
var l = 1e4 > Y.recentlyCreatedOwnerStacks++;
|
|
236
|
+
return v(
|
|
237
|
+
e,
|
|
238
|
+
o,
|
|
239
|
+
a,
|
|
240
|
+
!1,
|
|
241
|
+
l ? Error("react-stack-top-frame") : J,
|
|
242
|
+
l ? M(p(e)) : H
|
|
243
|
+
);
|
|
244
|
+
}, I.jsxs = function(e, o, a) {
|
|
245
|
+
var l = 1e4 > Y.recentlyCreatedOwnerStacks++;
|
|
246
|
+
return v(
|
|
247
|
+
e,
|
|
248
|
+
o,
|
|
249
|
+
a,
|
|
250
|
+
!0,
|
|
251
|
+
l ? Error("react-stack-top-frame") : J,
|
|
252
|
+
l ? M(p(e)) : H
|
|
253
|
+
);
|
|
254
|
+
};
|
|
255
|
+
})()), I;
|
|
256
|
+
}
|
|
257
|
+
var fe;
|
|
258
|
+
function _e() {
|
|
259
|
+
return fe || (fe = 1, process.env.NODE_ENV === "production" ? Q.exports = ke() : Q.exports = je()), Q.exports;
|
|
260
|
+
}
|
|
261
|
+
var r = _e();
|
|
262
|
+
const G = {
|
|
263
|
+
2e3: [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
|
|
264
|
+
2001: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
265
|
+
2002: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
|
|
266
|
+
2003: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
|
|
267
|
+
2004: [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
|
|
268
|
+
2005: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
269
|
+
2006: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
|
|
270
|
+
2007: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
|
|
271
|
+
2008: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31],
|
|
272
|
+
2009: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
273
|
+
2010: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
|
|
274
|
+
2011: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
|
|
275
|
+
2012: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30],
|
|
276
|
+
2013: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
277
|
+
2014: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
|
|
278
|
+
2015: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
|
|
279
|
+
2016: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30],
|
|
280
|
+
2017: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
281
|
+
2018: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
|
|
282
|
+
2019: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
|
|
283
|
+
2020: [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
284
|
+
2021: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
285
|
+
2022: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
|
|
286
|
+
2023: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
|
|
287
|
+
2024: [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
288
|
+
2025: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
289
|
+
2026: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
|
|
290
|
+
2027: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 32],
|
|
291
|
+
2028: [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
|
|
292
|
+
2029: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
293
|
+
2030: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
|
|
294
|
+
2031: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
|
|
295
|
+
2032: [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
|
|
296
|
+
2033: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
297
|
+
2034: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
|
|
298
|
+
2035: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
|
|
299
|
+
2036: [30, 32, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31],
|
|
300
|
+
2037: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
301
|
+
2038: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
|
|
302
|
+
2039: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
|
|
303
|
+
2040: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30],
|
|
304
|
+
2041: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
305
|
+
2042: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 31],
|
|
306
|
+
2043: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30],
|
|
307
|
+
2044: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30],
|
|
308
|
+
2045: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
309
|
+
2046: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
|
|
310
|
+
2047: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
|
|
311
|
+
2048: [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
|
|
312
|
+
2049: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
313
|
+
2050: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
|
|
314
|
+
2051: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
|
|
315
|
+
2052: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30],
|
|
316
|
+
2053: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
317
|
+
2054: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
|
|
318
|
+
2055: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
|
|
319
|
+
2056: [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
320
|
+
2057: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
321
|
+
2058: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
|
|
322
|
+
2059: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
|
|
323
|
+
2060: [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
324
|
+
2061: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
325
|
+
2062: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
|
|
326
|
+
2063: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
|
|
327
|
+
2064: [31, 31, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31],
|
|
328
|
+
2065: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
329
|
+
2066: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
|
|
330
|
+
2067: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
|
|
331
|
+
2068: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30],
|
|
332
|
+
2069: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
333
|
+
2070: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
|
|
334
|
+
2071: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
|
|
335
|
+
2072: [31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30],
|
|
336
|
+
2073: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
337
|
+
2074: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
|
|
338
|
+
2075: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
|
|
339
|
+
2076: [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
340
|
+
2077: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
341
|
+
2078: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
|
|
342
|
+
2079: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
|
|
343
|
+
2080: [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
344
|
+
2081: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
345
|
+
2082: [31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30],
|
|
346
|
+
2083: [31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
|
|
347
|
+
2084: [31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
348
|
+
2085: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
349
|
+
2086: [31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30],
|
|
350
|
+
2087: [31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31],
|
|
351
|
+
2088: [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
|
|
352
|
+
2089: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
353
|
+
2090: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30]
|
|
354
|
+
}, ee = new Date(1943, 3, 14);
|
|
355
|
+
function Ee(n, c, b) {
|
|
356
|
+
let p = 0;
|
|
357
|
+
for (let i = 2e3; i < n; i++) {
|
|
358
|
+
const d = G[i];
|
|
359
|
+
d && (p += d.reduce((u, g) => u + g, 0));
|
|
360
|
+
}
|
|
361
|
+
const s = G[n] || [];
|
|
362
|
+
for (let i = 0; i < c - 1; i++) p += s[i] || 30;
|
|
363
|
+
return p + b - 1;
|
|
364
|
+
}
|
|
365
|
+
function V(n, c, b) {
|
|
366
|
+
const p = new Date(ee);
|
|
367
|
+
return p.setDate(p.getDate() + Ee(n, c, b)), p;
|
|
368
|
+
}
|
|
369
|
+
function Ne(n) {
|
|
370
|
+
const c = new Date(n.getFullYear(), n.getMonth(), n.getDate()), b = new Date(ee.getFullYear(), ee.getMonth(), ee.getDate());
|
|
371
|
+
let p = Math.round((c - b) / 864e5), s = 2e3;
|
|
372
|
+
for (; s <= 2090; ) {
|
|
373
|
+
const u = G[s], g = u ? u.reduce((j, v) => j + v, 0) : 365;
|
|
374
|
+
if (p < g) break;
|
|
375
|
+
p -= g, s++;
|
|
376
|
+
}
|
|
377
|
+
const i = G[s] || [];
|
|
378
|
+
let d = 1;
|
|
379
|
+
for (let u = 0; u < 12; u++) {
|
|
380
|
+
const g = i[u] || 30;
|
|
381
|
+
if (p < g) {
|
|
382
|
+
d = u + 1;
|
|
383
|
+
break;
|
|
384
|
+
}
|
|
385
|
+
p -= g, u === 11 && (d = 12);
|
|
386
|
+
}
|
|
387
|
+
return { year: s, month: d, day: p + 1 };
|
|
388
|
+
}
|
|
389
|
+
function K() {
|
|
390
|
+
return Ne(/* @__PURE__ */ new Date());
|
|
391
|
+
}
|
|
392
|
+
function ue(n, c) {
|
|
393
|
+
return (G[n] || [])[c - 1] || 30;
|
|
394
|
+
}
|
|
395
|
+
function Se(n, c) {
|
|
396
|
+
return V(n, c, 1).getDay();
|
|
397
|
+
}
|
|
398
|
+
const me = ["बैशाख", "जेठ", "असार", "श्रावण", "भाद्र", "असोज", "कार्तिक", "मङ्सिर", "पुष", "माघ", "फागुन", "चैत्र"], he = ["Baisakh", "Jestha", "Ashadh", "Shrawan", "Bhadra", "Ashwin", "Kartik", "Mangsir", "Poush", "Magh", "Falgun", "Chaitra"], Te = ["आइत", "सोम", "मङ्गल", "बुध", "बिही", "शुक्र", "शनि"], Re = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], De = ["०", "१", "२", "३", "४", "५", "६", "७", "८", "९"], W = (n) => String(n).split("").map((c) => De[+c] ?? c).join(""), Ae = (n) => n ? n.toLocaleDateString("en-GB", { day: "numeric", month: "short", year: "numeric" }) : "", Oe = `
|
|
399
|
+
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;500;600;700&family=DM+Sans:wght@400;500;600;700&display=swap');
|
|
400
|
+
|
|
401
|
+
.ndp{
|
|
402
|
+
--pr:#C0392B; --prs:#fff0ee; --acs:#fffaee;
|
|
403
|
+
--sf:#fff; --tx:#1A1208; --txm:#8C7B6B; --bd:#E8DED0;
|
|
404
|
+
--r:16px; --sh:0 24px 64px rgba(0,0,0,0.13),0 4px 16px rgba(0,0,0,0.07);
|
|
405
|
+
font-family:'DM Sans',sans-serif;
|
|
406
|
+
position:relative; display:inline-block;
|
|
407
|
+
}
|
|
408
|
+
.ndp *{box-sizing:border-box;margin:0;padding:0;}
|
|
409
|
+
|
|
410
|
+
/* Input */
|
|
411
|
+
.ndp-wrap{position:relative;display:flex;align-items:center;cursor:pointer;}
|
|
412
|
+
.ndp-input{
|
|
413
|
+
width:100%; min-width:270px;
|
|
414
|
+
padding:13px 48px 13px 17px;
|
|
415
|
+
border:2px solid var(--bd); border-radius:13px;
|
|
416
|
+
background:var(--sf); color:var(--tx);
|
|
417
|
+
font-family:'DM Sans',sans-serif; font-size:15px;
|
|
418
|
+
cursor:pointer; outline:none;
|
|
419
|
+
transition:border-color .2s,box-shadow .2s;
|
|
420
|
+
caret-color:transparent;
|
|
421
|
+
}
|
|
422
|
+
.ndp-input::placeholder{color:var(--txm);}
|
|
423
|
+
.ndp-input.open{border-color:var(--pr);box-shadow:0 0 0 4px rgba(192,57,43,.11);}
|
|
424
|
+
.ndp-icon{position:absolute;right:14px;top:50%;transform:translateY(-50%);pointer-events:none;color:var(--txm);transition:color .2s;}
|
|
425
|
+
.ndp-input.open ~ .ndp-icon{color:var(--pr);}
|
|
426
|
+
|
|
427
|
+
/* Popup */
|
|
428
|
+
.ndp-popup{
|
|
429
|
+
position:absolute; top:calc(100% + 9px); left:0; z-index:9999;
|
|
430
|
+
width:336px;
|
|
431
|
+
background:var(--sf); border-radius:var(--r);
|
|
432
|
+
box-shadow:var(--sh); border:1px solid var(--bd);
|
|
433
|
+
overflow:hidden;
|
|
434
|
+
animation:ndp-pop .18s cubic-bezier(.34,1.56,.64,1);
|
|
435
|
+
transform-origin:top left;
|
|
436
|
+
}
|
|
437
|
+
@keyframes ndp-pop{from{opacity:0;transform:scale(.93) translateY(-8px);}to{opacity:1;transform:none;}}
|
|
438
|
+
@keyframes ndp-slide-left{from{opacity:0;transform:translateX(28px);}to{opacity:1;transform:translateX(0);}}
|
|
439
|
+
@keyframes ndp-slide-right{from{opacity:0;transform:translateX(-28px);}to{opacity:1;transform:translateX(0);}}
|
|
440
|
+
.ndp-slide-left{animation:ndp-slide-left .2s cubic-bezier(.25,.8,.25,1);}
|
|
441
|
+
.ndp-slide-right{animation:ndp-slide-right .2s cubic-bezier(.25,.8,.25,1);}
|
|
442
|
+
|
|
443
|
+
/* Header */
|
|
444
|
+
.ndp-hd{background:var(--pr);padding:14px;color:#fff;}
|
|
445
|
+
.ndp-hd-row{display:flex;align-items:center;justify-content:space-between;}
|
|
446
|
+
.ndp-nav{
|
|
447
|
+
width:32px;height:32px;display:flex;align-items:center;justify-content:center;
|
|
448
|
+
background:rgba(255,255,255,.18);border:none;border-radius:8px;
|
|
449
|
+
color:#fff;cursor:pointer;transition:background .15s;font-size:19px;line-height:1;flex-shrink:0;
|
|
450
|
+
}
|
|
451
|
+
.ndp-nav:hover{background:rgba(255,255,255,.3);}
|
|
452
|
+
.ndp-hd-center{flex:1;text-align:center;padding:0 8px;}
|
|
453
|
+
.ndp-hd-month{font-family:'Noto Sans Devanagari',sans-serif;font-size:18px;font-weight:700;line-height:1.2;}
|
|
454
|
+
.ndp-hd-sub{font-size:11.5px;opacity:.78;margin-top:3px;letter-spacing:.01em;}
|
|
455
|
+
|
|
456
|
+
/* Custom dropdowns */
|
|
457
|
+
.ndp-controls{
|
|
458
|
+
display:flex;gap:6px;padding:9px 12px;
|
|
459
|
+
background:var(--acs);border-bottom:1px solid var(--bd);
|
|
460
|
+
position:relative;z-index:10;
|
|
461
|
+
}
|
|
462
|
+
.ndp-dd{position:relative;flex:1;}
|
|
463
|
+
.ndp-dd-trigger{
|
|
464
|
+
width:100%;padding:6px 28px 6px 10px;
|
|
465
|
+
border:1px solid var(--bd);border-radius:8px;
|
|
466
|
+
background:#fff;color:var(--tx);
|
|
467
|
+
font-family:'Noto Sans Devanagari',sans-serif;font-size:13px;font-weight:500;
|
|
468
|
+
cursor:pointer;outline:none;
|
|
469
|
+
display:flex;align-items:center;justify-content:space-between;gap:4px;
|
|
470
|
+
transition:border-color .15s,box-shadow .15s;
|
|
471
|
+
white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
|
|
472
|
+
position:relative;
|
|
473
|
+
}
|
|
474
|
+
.ndp-dd-trigger:hover{border-color:#c8b8a8;}
|
|
475
|
+
.ndp-dd-trigger.active{border-color:var(--pr);box-shadow:0 0 0 3px rgba(192,57,43,.10);}
|
|
476
|
+
.ndp-dd-arrow{
|
|
477
|
+
position:absolute;right:8px;top:50%;transform:translateY(-50%);
|
|
478
|
+
pointer-events:none;color:var(--txm);transition:transform .18s;flex-shrink:0;
|
|
479
|
+
}
|
|
480
|
+
.ndp-dd-trigger.active .ndp-dd-arrow{transform:translateY(-50%) rotate(180deg);}
|
|
481
|
+
|
|
482
|
+
.ndp-dd-panel{
|
|
483
|
+
position:absolute;top:calc(100% + 5px);left:0;
|
|
484
|
+
min-width:100%;
|
|
485
|
+
background:#fff;border:1px solid var(--bd);border-radius:10px;
|
|
486
|
+
box-shadow:0 8px 28px rgba(0,0,0,0.13);
|
|
487
|
+
z-index:999;overflow:hidden;
|
|
488
|
+
animation:ndp-dd-in .15s cubic-bezier(.25,.8,.25,1);
|
|
489
|
+
transform-origin:top center;
|
|
490
|
+
}
|
|
491
|
+
@keyframes ndp-dd-in{from{opacity:0;transform:scaleY(.85) translateY(-4px);}to{opacity:1;transform:none;}}
|
|
492
|
+
|
|
493
|
+
/* Month panel: 3-column grid */
|
|
494
|
+
.ndp-dd-months{
|
|
495
|
+
display:grid;grid-template-columns:repeat(3,1fr);
|
|
496
|
+
padding:6px;gap:3px;
|
|
497
|
+
}
|
|
498
|
+
.ndp-dd-month-item{
|
|
499
|
+
padding:7px 4px;text-align:center;
|
|
500
|
+
border-radius:7px;cursor:pointer;border:none;background:transparent;
|
|
501
|
+
font-family:'Noto Sans Devanagari',sans-serif;font-size:12.5px;font-weight:500;color:var(--tx);
|
|
502
|
+
transition:background .12s,color .12s;
|
|
503
|
+
white-space:nowrap;
|
|
504
|
+
}
|
|
505
|
+
.ndp-dd-month-item:hover{background:var(--prs);color:var(--pr);}
|
|
506
|
+
.ndp-dd-month-item.sel{background:var(--pr);color:#fff;font-weight:700;}
|
|
507
|
+
|
|
508
|
+
/* Year panel: scrollable list */
|
|
509
|
+
.ndp-dd-years{
|
|
510
|
+
max-height:180px;overflow-y:auto;padding:5px;
|
|
511
|
+
scrollbar-width:thin;scrollbar-color:var(--bd) transparent;
|
|
512
|
+
}
|
|
513
|
+
.ndp-dd-years::-webkit-scrollbar{width:4px;}
|
|
514
|
+
.ndp-dd-years::-webkit-scrollbar-thumb{background:var(--bd);border-radius:4px;}
|
|
515
|
+
.ndp-dd-year-item{
|
|
516
|
+
padding:7px 14px;border-radius:7px;cursor:pointer;border:none;background:transparent;
|
|
517
|
+
font-family:'DM Sans',sans-serif;font-size:13px;font-weight:500;color:var(--tx);
|
|
518
|
+
width:100%;text-align:center;
|
|
519
|
+
transition:background .12s,color .12s;
|
|
520
|
+
display:block;
|
|
521
|
+
}
|
|
522
|
+
.ndp-dd-year-item:hover{background:var(--prs);color:var(--pr);}
|
|
523
|
+
.ndp-dd-year-item.sel{background:var(--pr);color:#fff;font-weight:700;}
|
|
524
|
+
|
|
525
|
+
/* Grid — FIXED 6 rows so height never changes between months */
|
|
526
|
+
.ndp-body{padding:10px 10px 6px;}
|
|
527
|
+
.ndp-wdays{display:grid;grid-template-columns:repeat(7,1fr);margin-bottom:4px;}
|
|
528
|
+
.ndp-wday{
|
|
529
|
+
text-align:center;font-size:10.5px;font-weight:600;
|
|
530
|
+
letter-spacing:.04em;color:var(--txm);padding:3px 0;
|
|
531
|
+
font-family:'Noto Sans Devanagari',sans-serif;
|
|
532
|
+
}
|
|
533
|
+
.ndp-wday:last-child{color:var(--pr);}
|
|
534
|
+
|
|
535
|
+
.ndp-grid{
|
|
536
|
+
display:grid;
|
|
537
|
+
grid-template-columns:repeat(7,1fr);
|
|
538
|
+
grid-template-rows:repeat(6,36px); /* ← always exactly 6 rows */
|
|
539
|
+
gap:2px;
|
|
540
|
+
}
|
|
541
|
+
.ndp-cell{
|
|
542
|
+
display:flex;align-items:center;justify-content:center;
|
|
543
|
+
border-radius:8px;font-size:13px;
|
|
544
|
+
font-family:'Noto Sans Devanagari',sans-serif;
|
|
545
|
+
cursor:pointer;border:none;background:transparent;color:var(--tx);
|
|
546
|
+
transition:background .12s,color .12s,transform .1s;
|
|
547
|
+
font-weight:500;width:100%;
|
|
548
|
+
}
|
|
549
|
+
.ndp-cell.blank{cursor:default;pointer-events:none;}
|
|
550
|
+
.ndp-cell.overflow{color:var(--bd);cursor:default;pointer-events:none;}
|
|
551
|
+
.ndp-cell.wknd{color:var(--pr);}
|
|
552
|
+
.ndp-cell.today:not(.picked){
|
|
553
|
+
background:#fde8e6;
|
|
554
|
+
font-weight:700;color:var(--pr);
|
|
555
|
+
}
|
|
556
|
+
.ndp-cell.picked{
|
|
557
|
+
background:var(--pr);color:#fff;font-weight:700;
|
|
558
|
+
box-shadow:0 3px 10px rgba(192,57,43,.35);
|
|
559
|
+
}
|
|
560
|
+
.ndp-cell:hover:not(.overflow):not(.picked){
|
|
561
|
+
background:var(--prs);color:var(--pr);
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/* Footer */
|
|
565
|
+
.ndp-ft{
|
|
566
|
+
padding:9px 12px 12px;
|
|
567
|
+
border-top:1px solid var(--bd);
|
|
568
|
+
display:flex;align-items:center;justify-content:space-between;gap:8px;
|
|
569
|
+
}
|
|
570
|
+
.ndp-ad{font-size:12px;color:var(--txm);}
|
|
571
|
+
.ndp-ad b{color:var(--tx);}
|
|
572
|
+
.ndp-today-btn{
|
|
573
|
+
font-size:12px;padding:5px 13px;
|
|
574
|
+
background:var(--acs);color:#9A7000;
|
|
575
|
+
border:1px solid #F0D090;border-radius:8px;
|
|
576
|
+
cursor:pointer;font-family:'DM Sans',sans-serif;font-weight:600;
|
|
577
|
+
transition:background .15s;white-space:nowrap;
|
|
578
|
+
}
|
|
579
|
+
.ndp-today-btn:hover{background:#FDEECA;}
|
|
580
|
+
`;
|
|
581
|
+
let xe = !1;
|
|
582
|
+
function Pe() {
|
|
583
|
+
if (!xe && typeof document < "u") {
|
|
584
|
+
const n = document.createElement("style");
|
|
585
|
+
n.textContent = Oe, document.head.appendChild(n), xe = !0;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
function Me({
|
|
589
|
+
value: n,
|
|
590
|
+
onChange: c,
|
|
591
|
+
language: b = "np",
|
|
592
|
+
placeholder: p,
|
|
593
|
+
minYear: s = 2060,
|
|
594
|
+
maxYear: i = 2090
|
|
595
|
+
}) {
|
|
596
|
+
Pe();
|
|
597
|
+
const d = b !== "en", u = K(), [g, j] = R(!1), [v, y] = R(null), [D, w] = R(!1), [E, S] = R(!1), [x, N] = R(() => n?.year ?? K().year), [h, k] = R(() => n?.month ?? K().month), A = le(null), O = le(null);
|
|
598
|
+
ie(() => {
|
|
599
|
+
const t = (m) => {
|
|
600
|
+
A.current && !A.current.contains(m.target) && (j(!1), w(!1), S(!1));
|
|
601
|
+
};
|
|
602
|
+
return document.addEventListener("mousedown", t), () => document.removeEventListener("mousedown", t);
|
|
603
|
+
}, []), ie(() => {
|
|
604
|
+
n && (N(n.year), k(n.month));
|
|
605
|
+
}, [n]), ie(() => {
|
|
606
|
+
if (E && O.current) {
|
|
607
|
+
const t = O.current.querySelector(".sel");
|
|
608
|
+
t && t.scrollIntoView({ block: "center" });
|
|
609
|
+
}
|
|
610
|
+
}, [E]);
|
|
611
|
+
const re = we((t) => {
|
|
612
|
+
if (!t) return;
|
|
613
|
+
c?.({ year: x, month: h, day: t }, V(x, h, t)), j(!1);
|
|
614
|
+
}, [x, h, c]), ne = () => {
|
|
615
|
+
y("right"), setTimeout(() => y(null), 200), h === 1 ? (k(12), N((t) => t - 1)) : k((t) => t - 1);
|
|
616
|
+
}, te = () => {
|
|
617
|
+
y("left"), setTimeout(() => y(null), 200), h === 12 ? (k(1), N((t) => t + 1)) : k((t) => t + 1);
|
|
618
|
+
}, P = () => {
|
|
619
|
+
const t = K();
|
|
620
|
+
N(t.year), k(t.month), c?.(t, V(t.year, t.month, t.day)), j(!1);
|
|
621
|
+
}, U = ue(x, h), C = Se(x, h), Y = h === 1 ? 12 : h - 1, X = h === 1 ? x - 1 : x, oe = ue(X, Y), M = Array.from({ length: C }, (t, m) => ({
|
|
622
|
+
day: oe - C + 1 + m,
|
|
623
|
+
overflow: "prev"
|
|
624
|
+
})), q = Array.from({ length: U }, (t, m) => ({
|
|
625
|
+
day: m + 1,
|
|
626
|
+
overflow: null
|
|
627
|
+
})), J = 42 - (C + U), H = Array.from({ length: J }, (t, m) => ({
|
|
628
|
+
day: m + 1,
|
|
629
|
+
overflow: "next"
|
|
630
|
+
})), Z = [...M, ...q, ...H], e = d ? me : he, o = d ? Te : Re, a = e[h - 1], l = d ? W(x) : String(x), L = V(x, h, 1).toLocaleDateString("en-GB", { month: "short", year: "numeric" }), f = n ? d ? `${W(n.year)} ${me[n.month - 1]} ${W(n.day)}` : `${n.year} ${he[n.month - 1]} ${n.day}` : "", _ = d ? "मिति छान्नुहोस्" : "Select BS date", T = n ? V(n.year, n.month, n.day) : null, se = Array.from({ length: i - s + 1 }, (t, m) => s + m);
|
|
631
|
+
return /* @__PURE__ */ r.jsxs("div", { className: "ndp", ref: A, children: [
|
|
632
|
+
/* @__PURE__ */ r.jsxs("div", { className: "ndp-wrap", onClick: () => j((t) => !t), children: [
|
|
633
|
+
/* @__PURE__ */ r.jsx(
|
|
634
|
+
"input",
|
|
635
|
+
{
|
|
636
|
+
readOnly: !0,
|
|
637
|
+
className: `ndp-input${g ? " open" : ""}`,
|
|
638
|
+
value: f,
|
|
639
|
+
placeholder: p ?? _
|
|
640
|
+
}
|
|
641
|
+
),
|
|
642
|
+
/* @__PURE__ */ r.jsx("span", { className: "ndp-icon", children: /* @__PURE__ */ r.jsxs("svg", { width: "17", height: "17", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
643
|
+
/* @__PURE__ */ r.jsx("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
|
|
644
|
+
/* @__PURE__ */ r.jsx("line", { x1: "16", y1: "2", x2: "16", y2: "6" }),
|
|
645
|
+
/* @__PURE__ */ r.jsx("line", { x1: "8", y1: "2", x2: "8", y2: "6" }),
|
|
646
|
+
/* @__PURE__ */ r.jsx("line", { x1: "3", y1: "10", x2: "21", y2: "10" })
|
|
647
|
+
] }) })
|
|
648
|
+
] }),
|
|
649
|
+
g && /* @__PURE__ */ r.jsxs("div", { className: "ndp-popup", children: [
|
|
650
|
+
/* @__PURE__ */ r.jsx("div", { className: "ndp-hd", children: /* @__PURE__ */ r.jsxs("div", { className: "ndp-hd-row", children: [
|
|
651
|
+
/* @__PURE__ */ r.jsx("button", { className: "ndp-nav", onClick: ne, children: /* @__PURE__ */ r.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ r.jsx("path", { d: "m15 18-6-6 6-6" }) }) }),
|
|
652
|
+
/* @__PURE__ */ r.jsxs("div", { className: `ndp-hd-center${v ? ` ndp-slide-${v}` : ""}`, children: [
|
|
653
|
+
/* @__PURE__ */ r.jsx("div", { className: "ndp-hd-month", children: a }),
|
|
654
|
+
/* @__PURE__ */ r.jsxs("div", { className: "ndp-hd-sub", children: [
|
|
655
|
+
l,
|
|
656
|
+
" BS · ",
|
|
657
|
+
L
|
|
658
|
+
] })
|
|
659
|
+
] }),
|
|
660
|
+
/* @__PURE__ */ r.jsx("button", { className: "ndp-nav", onClick: te, children: /* @__PURE__ */ r.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ r.jsx("path", { d: "m9 18 6-6-6-6" }) }) })
|
|
661
|
+
] }) }),
|
|
662
|
+
/* @__PURE__ */ r.jsxs("div", { className: "ndp-controls", children: [
|
|
663
|
+
/* @__PURE__ */ r.jsxs("div", { className: "ndp-dd", children: [
|
|
664
|
+
/* @__PURE__ */ r.jsxs(
|
|
665
|
+
"button",
|
|
666
|
+
{
|
|
667
|
+
className: `ndp-dd-trigger${D ? " active" : ""}`,
|
|
668
|
+
onClick: () => {
|
|
669
|
+
w((t) => !t), S(!1);
|
|
670
|
+
},
|
|
671
|
+
children: [
|
|
672
|
+
/* @__PURE__ */ r.jsx("span", { children: a }),
|
|
673
|
+
/* @__PURE__ */ r.jsx("span", { className: "ndp-dd-arrow", children: /* @__PURE__ */ r.jsx("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ r.jsx("path", { d: "m6 9 6 6 6-6" }) }) })
|
|
674
|
+
]
|
|
675
|
+
}
|
|
676
|
+
),
|
|
677
|
+
D && /* @__PURE__ */ r.jsx("div", { className: "ndp-dd-panel", children: /* @__PURE__ */ r.jsx("div", { className: "ndp-dd-months", children: e.map((t, m) => /* @__PURE__ */ r.jsx(
|
|
678
|
+
"button",
|
|
679
|
+
{
|
|
680
|
+
className: `ndp-dd-month-item${h === m + 1 ? " sel" : ""}`,
|
|
681
|
+
onClick: () => {
|
|
682
|
+
y(m + 1 < h ? "right" : "left"), setTimeout(() => y(null), 200), k(m + 1), w(!1);
|
|
683
|
+
},
|
|
684
|
+
children: t
|
|
685
|
+
},
|
|
686
|
+
m
|
|
687
|
+
)) }) })
|
|
688
|
+
] }),
|
|
689
|
+
/* @__PURE__ */ r.jsxs("div", { className: "ndp-dd", children: [
|
|
690
|
+
/* @__PURE__ */ r.jsxs(
|
|
691
|
+
"button",
|
|
692
|
+
{
|
|
693
|
+
className: `ndp-dd-trigger${E ? " active" : ""}`,
|
|
694
|
+
onClick: () => {
|
|
695
|
+
S((t) => !t), w(!1);
|
|
696
|
+
},
|
|
697
|
+
children: [
|
|
698
|
+
/* @__PURE__ */ r.jsx("span", { children: l }),
|
|
699
|
+
/* @__PURE__ */ r.jsx("span", { className: "ndp-dd-arrow", children: /* @__PURE__ */ r.jsx("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ r.jsx("path", { d: "m6 9 6 6 6-6" }) }) })
|
|
700
|
+
]
|
|
701
|
+
}
|
|
702
|
+
),
|
|
703
|
+
E && /* @__PURE__ */ r.jsx("div", { className: "ndp-dd-panel", children: /* @__PURE__ */ r.jsx("div", { className: "ndp-dd-years", ref: O, children: se.map((t) => /* @__PURE__ */ r.jsx(
|
|
704
|
+
"button",
|
|
705
|
+
{
|
|
706
|
+
className: `ndp-dd-year-item${x === t ? " sel" : ""}`,
|
|
707
|
+
onClick: () => {
|
|
708
|
+
N(t), S(!1);
|
|
709
|
+
},
|
|
710
|
+
children: d ? W(t) : t
|
|
711
|
+
},
|
|
712
|
+
t
|
|
713
|
+
)) }) })
|
|
714
|
+
] })
|
|
715
|
+
] }),
|
|
716
|
+
/* @__PURE__ */ r.jsxs("div", { className: "ndp-body", children: [
|
|
717
|
+
/* @__PURE__ */ r.jsx("div", { className: "ndp-wdays", children: o.map((t, m) => /* @__PURE__ */ r.jsx("div", { className: "ndp-wday", children: t }, m)) }),
|
|
718
|
+
/* @__PURE__ */ r.jsx("div", { className: `ndp-grid${v ? ` ndp-slide-${v}` : ""}`, children: Z.map(({ day: t, overflow: m }, de) => {
|
|
719
|
+
const be = de % 7 === 6, z = m !== null, ge = !z && t === u.day && h === u.month && x === u.year, ve = !z && n && t === n.day && h === n.month && x === n.year;
|
|
720
|
+
let F = "ndp-cell";
|
|
721
|
+
return z ? F += " overflow" : be && (F += " wknd"), ge && (F += " today"), ve && (F += " picked"), /* @__PURE__ */ r.jsx(
|
|
722
|
+
"button",
|
|
723
|
+
{
|
|
724
|
+
className: F,
|
|
725
|
+
disabled: z,
|
|
726
|
+
onClick: () => !z && re(t),
|
|
727
|
+
children: d ? W(t) : t
|
|
728
|
+
},
|
|
729
|
+
de
|
|
730
|
+
);
|
|
731
|
+
}) })
|
|
732
|
+
] }),
|
|
733
|
+
/* @__PURE__ */ r.jsxs("div", { className: "ndp-ft", children: [
|
|
734
|
+
/* @__PURE__ */ r.jsx("span", { className: "ndp-ad", children: T ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
735
|
+
/* @__PURE__ */ r.jsx("b", { children: "AD:" }),
|
|
736
|
+
" ",
|
|
737
|
+
Ae(T)
|
|
738
|
+
] }) : /* @__PURE__ */ r.jsx("span", { style: { color: "var(--txm)", fontSize: 12 }, children: d ? "मिति छानिएको छैन" : "No date selected" }) }),
|
|
739
|
+
/* @__PURE__ */ r.jsx("button", { className: "ndp-today-btn", onClick: P, children: d ? "आज" : "Today" })
|
|
740
|
+
] })
|
|
741
|
+
] })
|
|
742
|
+
] });
|
|
743
|
+
}
|
|
744
|
+
export {
|
|
745
|
+
Ne as adToBs,
|
|
746
|
+
V as bsToAd,
|
|
747
|
+
Me as default,
|
|
748
|
+
ue as getDaysInBSMonth,
|
|
749
|
+
Se as getFirstDayOfWeekBS,
|
|
750
|
+
K as getTodayBS
|
|
751
|
+
};
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
(function(v,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],x):(v=typeof globalThis<"u"?globalThis:v||self,x(v.NepaliDatePicker={},v.React))})(this,(function(v,x){"use strict";var H={exports:{}},O={};var le;function be(){if(le)return O;le=1;var n=Symbol.for("react.transitional.element"),c=Symbol.for("react.fragment");function b(p,s,i){var d=null;if(i!==void 0&&(d=""+i),s.key!==void 0&&(d=""+s.key),"key"in s){i={};for(var u in s)u!=="key"&&(i[u]=s[u])}else i=s;return s=i.ref,{$$typeof:n,type:p,key:d,ref:s!==void 0?s:null,props:i}}return O.Fragment=c,O.jsx=b,O.jsxs=b,O}var P={};var ce;function ve(){return ce||(ce=1,process.env.NODE_ENV!=="production"&&(function(){function n(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===I?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case g:return"Fragment";case h:return"Profiler";case T:return"StrictMode";case te:return"Suspense";case oe:return"SuspenseList";case Z: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 D:return"Portal";case L:return e.displayName||"Context";case S:return(e._context.displayName||"Context")+".Consumer";case F:var o=e.render;return e=e.displayName,e||(e=o.displayName||o.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ae:return o=e.displayName||null,o!==null?o:n(e.type)||"Memo";case z:o=e._payload,e=e._init;try{return n(e(o))}catch{}}return null}function c(e){return""+e}function b(e){try{c(e);var o=!1}catch{o=!0}if(o){o=console;var a=o.error,l=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return a.call(o,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",l),c(e)}}function p(e){if(e===g)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===z)return"<...>";try{var o=n(e);return o?"<"+o+">":"<...>"}catch{return"<...>"}}function s(){var e=W.A;return e===null?null:e.getOwner()}function i(){return Error("react-stack-top-frame")}function d(e){if(Q.call(e,"key")){var o=Object.getOwnPropertyDescriptor(e,"key").get;if(o&&o.isReactWarning)return!1}return e.key!==void 0}function u(e,o){function a(){K||(K=!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)",o))}a.isReactWarning=!0,Object.defineProperty(e,"key",{get:a,configurable:!0})}function y(){var e=n(this.type);return ie[e]||(ie[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,o,a,l,G,U){var f=a.ref;return e={$$typeof:N,type:e,key:o,props:a,_owner:l},(f!==void 0?f:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:y}):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:G}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:U}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function w(e,o,a,l,G,U){var f=o.children;if(f!==void 0)if(l)if(se(f)){for(l=0;l<f.length;l++)k(f[l]);Object.freeze&&Object.freeze(f)}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 k(f);if(Q.call(o,"key")){f=n(e);var E=Object.keys(o).filter(function(de){return de!=="key"});l=0<E.length?"{key: someKey, "+E.join(": ..., ")+": ...}":"{key: someKey}",re[f+l]||(E=0<E.length?"{"+E.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
|
+
let props = %s;
|
|
3
|
+
<%s {...props} />
|
|
4
|
+
React keys must be passed directly to JSX without using spread:
|
|
5
|
+
let props = %s;
|
|
6
|
+
<%s key={someKey} {...props} />`,l,f,E,f),re[f+l]=!0)}if(f=null,a!==void 0&&(b(a),f=""+a),d(o)&&(b(o.key),f=""+o.key),"key"in o){a={};for(var A in o)A!=="key"&&(a[A]=o[A])}else a=o;return f&&u(a,typeof e=="function"?e.displayName||e.name||"Unknown":e),_(e,f,a,s(),G,U)}function k(e){B(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===z&&(e._payload.status==="fulfilled"?B(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function B(e){return typeof e=="object"&&e!==null&&e.$$typeof===N}var j=x,N=Symbol.for("react.transitional.element"),D=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),L=Symbol.for("react.context"),F=Symbol.for("react.forward_ref"),te=Symbol.for("react.suspense"),oe=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),Z=Symbol.for("react.activity"),I=Symbol.for("react.client.reference"),W=j.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=Object.prototype.hasOwnProperty,se=Array.isArray,V=console.createTask?console.createTask:function(){return null};j={react_stack_bottom_frame:function(e){return e()}};var K,ie={},q=j.react_stack_bottom_frame.bind(j,i)(),ee=V(p(i)),re={};P.Fragment=g,P.jsx=function(e,o,a){var l=1e4>W.recentlyCreatedOwnerStacks++;return w(e,o,a,!1,l?Error("react-stack-top-frame"):q,l?V(p(e)):ee)},P.jsxs=function(e,o,a){var l=1e4>W.recentlyCreatedOwnerStacks++;return w(e,o,a,!0,l?Error("react-stack-top-frame"):q,l?V(p(e)):ee)}})()),P}var pe;function ye(){return pe||(pe=1,process.env.NODE_ENV==="production"?H.exports=be():H.exports=ve()),H.exports}var r=ye();const C={2e3:[30,32,31,32,31,30,30,30,29,30,29,31],2001:[31,31,32,31,31,31,30,29,30,29,30,30],2002:[31,31,32,32,31,30,30,29,30,29,30,30],2003:[31,32,31,32,31,30,30,30,29,29,30,31],2004:[30,32,31,32,31,30,30,30,29,30,29,31],2005:[31,31,32,31,31,31,30,29,30,29,30,30],2006:[31,31,32,32,31,30,30,29,30,29,30,30],2007:[31,32,31,32,31,30,30,30,29,29,30,31],2008:[31,31,31,32,31,31,29,30,30,29,29,31],2009:[31,31,32,31,31,31,30,29,30,29,30,30],2010:[31,31,32,32,31,30,30,29,30,29,30,30],2011:[31,32,31,32,31,30,30,30,29,29,30,31],2012:[31,31,31,32,31,31,29,30,30,29,30,30],2013:[31,31,32,31,31,31,30,29,30,29,30,30],2014:[31,31,32,32,31,30,30,29,30,29,30,30],2015:[31,32,31,32,31,30,30,30,29,29,30,31],2016:[31,31,31,32,31,31,29,30,30,29,30,30],2017:[31,31,32,31,31,31,30,29,30,29,30,30],2018:[31,31,32,32,31,30,30,29,30,29,30,30],2019:[31,32,31,32,31,30,30,30,29,29,30,31],2020:[31,31,31,32,31,31,30,29,30,29,30,30],2021:[31,31,32,31,31,31,30,29,30,29,30,30],2022:[31,31,32,32,31,30,30,29,30,29,30,30],2023:[31,32,31,32,31,30,30,30,29,29,30,31],2024:[31,31,31,32,31,31,30,29,30,29,30,30],2025:[31,31,32,31,31,31,30,29,30,29,30,30],2026:[31,31,32,32,31,30,30,29,30,29,30,30],2027:[31,32,31,32,31,30,30,30,29,29,30,32],2028:[30,32,31,32,31,30,30,30,29,30,29,31],2029:[31,31,32,31,31,31,30,29,30,29,30,30],2030:[31,31,32,32,31,30,30,29,30,29,30,30],2031:[31,32,31,32,31,30,30,30,29,29,30,31],2032:[30,32,31,32,31,30,30,30,29,30,29,31],2033:[31,31,32,31,31,31,30,29,30,29,30,30],2034:[31,31,32,32,31,30,30,29,30,29,30,30],2035:[31,32,31,32,31,30,30,30,29,29,30,31],2036:[30,32,31,32,31,31,29,30,30,29,29,31],2037:[31,31,32,31,31,31,30,29,30,29,30,30],2038:[31,31,32,32,31,30,30,29,30,29,30,30],2039:[31,32,31,32,31,30,30,30,29,29,30,31],2040:[31,31,31,32,31,31,29,30,30,29,30,30],2041:[31,31,32,31,31,31,30,29,30,29,30,30],2042:[31,31,32,32,31,30,30,29,30,29,30,31],2043:[31,32,31,32,31,30,30,30,29,29,30,30],2044:[31,31,31,32,31,31,29,30,30,29,30,30],2045:[31,31,32,31,31,31,30,29,30,29,30,30],2046:[31,31,32,32,31,30,30,29,30,29,30,30],2047:[31,32,31,32,31,30,30,30,29,29,30,31],2048:[30,32,31,32,31,30,30,30,29,30,29,31],2049:[31,31,32,31,31,31,30,29,30,29,30,30],2050:[31,31,32,32,31,30,30,29,30,29,30,30],2051:[31,32,31,32,31,30,30,30,29,29,30,31],2052:[31,31,31,32,31,31,29,30,30,29,30,30],2053:[31,31,32,31,31,31,30,29,30,29,30,30],2054:[31,31,32,32,31,30,30,29,30,29,30,30],2055:[31,32,31,32,31,30,30,30,29,29,30,31],2056:[31,31,31,32,31,31,30,29,30,29,30,30],2057:[31,31,32,31,31,31,30,29,30,29,30,30],2058:[31,31,32,32,31,30,30,29,30,29,30,30],2059:[31,32,31,32,31,30,30,30,29,29,30,31],2060:[31,31,31,32,31,31,30,29,30,29,30,30],2061:[31,31,32,31,31,31,30,29,30,29,30,30],2062:[31,31,32,32,31,30,30,29,30,29,30,30],2063:[31,32,31,32,31,30,30,30,29,29,30,31],2064:[31,31,31,32,31,31,29,30,29,30,29,31],2065:[31,31,32,31,31,31,30,29,30,29,30,30],2066:[31,31,32,32,31,30,30,29,30,29,30,30],2067:[31,32,31,32,31,30,30,30,29,29,30,31],2068:[31,31,31,32,31,31,29,30,30,29,30,30],2069:[31,31,32,31,31,31,30,29,30,29,30,30],2070:[31,31,32,32,31,30,30,29,30,29,30,30],2071:[31,32,31,32,31,30,30,30,29,29,30,31],2072:[31,31,31,32,31,31,29,30,30,29,30,30],2073:[31,31,32,31,31,31,30,29,30,29,30,30],2074:[31,31,32,32,31,30,30,29,30,29,30,30],2075:[31,32,31,32,31,30,30,30,29,29,30,31],2076:[31,31,31,32,31,31,30,29,30,29,30,30],2077:[31,31,32,31,31,31,30,29,30,29,30,30],2078:[31,31,32,32,31,30,30,29,30,29,30,30],2079:[31,32,31,32,31,30,30,30,29,29,30,31],2080:[31,31,31,32,31,31,30,29,30,29,30,30],2081:[31,31,32,31,31,31,30,29,30,29,30,30],2082:[31,32,31,32,31,30,30,29,30,29,30,30],2083:[31,32,31,32,31,30,30,30,29,30,29,31],2084:[31,31,31,32,31,31,30,29,30,29,30,30],2085:[31,31,32,31,31,31,30,29,30,29,30,30],2086:[31,32,31,32,31,30,30,29,30,29,30,30],2087:[31,32,31,32,31,30,30,30,29,29,30,31],2088:[30,32,31,32,31,30,30,30,29,30,29,31],2089:[31,31,32,31,31,31,30,29,30,29,30,30],2090:[31,31,32,32,31,30,30,29,30,29,30,30]},$=new Date(1943,3,14);function we(n,c,b){let p=0;for(let i=2e3;i<n;i++){const d=C[i];d&&(p+=d.reduce((u,y)=>u+y,0))}const s=C[n]||[];for(let i=0;i<c-1;i++)p+=s[i]||30;return p+b-1}function R(n,c,b){const p=new Date($);return p.setDate(p.getDate()+we(n,c,b)),p}function fe(n){const c=new Date(n.getFullYear(),n.getMonth(),n.getDate()),b=new Date($.getFullYear(),$.getMonth(),$.getDate());let p=Math.round((c-b)/864e5),s=2e3;for(;s<=2090;){const u=C[s],y=u?u.reduce((_,w)=>_+w,0):365;if(p<y)break;p-=y,s++}const i=C[s]||[];let d=1;for(let u=0;u<12;u++){const y=i[u]||30;if(p<y){d=u+1;break}p-=y,u===11&&(d=12)}return{year:s,month:d,day:p+1}}function M(){return fe(new Date)}function ne(n,c){return(C[n]||[])[c-1]||30}function ue(n,c){return R(n,c,1).getDay()}const me=["बैशाख","जेठ","असार","श्रावण","भाद्र","असोज","कार्तिक","मङ्सिर","पुष","माघ","फागुन","चैत्र"],he=["Baisakh","Jestha","Ashadh","Shrawan","Bhadra","Ashwin","Kartik","Mangsir","Poush","Magh","Falgun","Chaitra"],ke=["आइत","सोम","मङ्गल","बुध","बिही","शुक्र","शनि"],je=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Se=["०","१","२","३","४","५","६","७","८","९"],Y=n=>String(n).split("").map(c=>Se[+c]??c).join(""),_e=n=>n?n.toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"}):"",Ee=`
|
|
7
|
+
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;500;600;700&family=DM+Sans:wght@400;500;600;700&display=swap');
|
|
8
|
+
|
|
9
|
+
.ndp{
|
|
10
|
+
--pr:#C0392B; --prs:#fff0ee; --acs:#fffaee;
|
|
11
|
+
--sf:#fff; --tx:#1A1208; --txm:#8C7B6B; --bd:#E8DED0;
|
|
12
|
+
--r:16px; --sh:0 24px 64px rgba(0,0,0,0.13),0 4px 16px rgba(0,0,0,0.07);
|
|
13
|
+
font-family:'DM Sans',sans-serif;
|
|
14
|
+
position:relative; display:inline-block;
|
|
15
|
+
}
|
|
16
|
+
.ndp *{box-sizing:border-box;margin:0;padding:0;}
|
|
17
|
+
|
|
18
|
+
/* Input */
|
|
19
|
+
.ndp-wrap{position:relative;display:flex;align-items:center;cursor:pointer;}
|
|
20
|
+
.ndp-input{
|
|
21
|
+
width:100%; min-width:270px;
|
|
22
|
+
padding:13px 48px 13px 17px;
|
|
23
|
+
border:2px solid var(--bd); border-radius:13px;
|
|
24
|
+
background:var(--sf); color:var(--tx);
|
|
25
|
+
font-family:'DM Sans',sans-serif; font-size:15px;
|
|
26
|
+
cursor:pointer; outline:none;
|
|
27
|
+
transition:border-color .2s,box-shadow .2s;
|
|
28
|
+
caret-color:transparent;
|
|
29
|
+
}
|
|
30
|
+
.ndp-input::placeholder{color:var(--txm);}
|
|
31
|
+
.ndp-input.open{border-color:var(--pr);box-shadow:0 0 0 4px rgba(192,57,43,.11);}
|
|
32
|
+
.ndp-icon{position:absolute;right:14px;top:50%;transform:translateY(-50%);pointer-events:none;color:var(--txm);transition:color .2s;}
|
|
33
|
+
.ndp-input.open ~ .ndp-icon{color:var(--pr);}
|
|
34
|
+
|
|
35
|
+
/* Popup */
|
|
36
|
+
.ndp-popup{
|
|
37
|
+
position:absolute; top:calc(100% + 9px); left:0; z-index:9999;
|
|
38
|
+
width:336px;
|
|
39
|
+
background:var(--sf); border-radius:var(--r);
|
|
40
|
+
box-shadow:var(--sh); border:1px solid var(--bd);
|
|
41
|
+
overflow:hidden;
|
|
42
|
+
animation:ndp-pop .18s cubic-bezier(.34,1.56,.64,1);
|
|
43
|
+
transform-origin:top left;
|
|
44
|
+
}
|
|
45
|
+
@keyframes ndp-pop{from{opacity:0;transform:scale(.93) translateY(-8px);}to{opacity:1;transform:none;}}
|
|
46
|
+
@keyframes ndp-slide-left{from{opacity:0;transform:translateX(28px);}to{opacity:1;transform:translateX(0);}}
|
|
47
|
+
@keyframes ndp-slide-right{from{opacity:0;transform:translateX(-28px);}to{opacity:1;transform:translateX(0);}}
|
|
48
|
+
.ndp-slide-left{animation:ndp-slide-left .2s cubic-bezier(.25,.8,.25,1);}
|
|
49
|
+
.ndp-slide-right{animation:ndp-slide-right .2s cubic-bezier(.25,.8,.25,1);}
|
|
50
|
+
|
|
51
|
+
/* Header */
|
|
52
|
+
.ndp-hd{background:var(--pr);padding:14px;color:#fff;}
|
|
53
|
+
.ndp-hd-row{display:flex;align-items:center;justify-content:space-between;}
|
|
54
|
+
.ndp-nav{
|
|
55
|
+
width:32px;height:32px;display:flex;align-items:center;justify-content:center;
|
|
56
|
+
background:rgba(255,255,255,.18);border:none;border-radius:8px;
|
|
57
|
+
color:#fff;cursor:pointer;transition:background .15s;font-size:19px;line-height:1;flex-shrink:0;
|
|
58
|
+
}
|
|
59
|
+
.ndp-nav:hover{background:rgba(255,255,255,.3);}
|
|
60
|
+
.ndp-hd-center{flex:1;text-align:center;padding:0 8px;}
|
|
61
|
+
.ndp-hd-month{font-family:'Noto Sans Devanagari',sans-serif;font-size:18px;font-weight:700;line-height:1.2;}
|
|
62
|
+
.ndp-hd-sub{font-size:11.5px;opacity:.78;margin-top:3px;letter-spacing:.01em;}
|
|
63
|
+
|
|
64
|
+
/* Custom dropdowns */
|
|
65
|
+
.ndp-controls{
|
|
66
|
+
display:flex;gap:6px;padding:9px 12px;
|
|
67
|
+
background:var(--acs);border-bottom:1px solid var(--bd);
|
|
68
|
+
position:relative;z-index:10;
|
|
69
|
+
}
|
|
70
|
+
.ndp-dd{position:relative;flex:1;}
|
|
71
|
+
.ndp-dd-trigger{
|
|
72
|
+
width:100%;padding:6px 28px 6px 10px;
|
|
73
|
+
border:1px solid var(--bd);border-radius:8px;
|
|
74
|
+
background:#fff;color:var(--tx);
|
|
75
|
+
font-family:'Noto Sans Devanagari',sans-serif;font-size:13px;font-weight:500;
|
|
76
|
+
cursor:pointer;outline:none;
|
|
77
|
+
display:flex;align-items:center;justify-content:space-between;gap:4px;
|
|
78
|
+
transition:border-color .15s,box-shadow .15s;
|
|
79
|
+
white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
|
|
80
|
+
position:relative;
|
|
81
|
+
}
|
|
82
|
+
.ndp-dd-trigger:hover{border-color:#c8b8a8;}
|
|
83
|
+
.ndp-dd-trigger.active{border-color:var(--pr);box-shadow:0 0 0 3px rgba(192,57,43,.10);}
|
|
84
|
+
.ndp-dd-arrow{
|
|
85
|
+
position:absolute;right:8px;top:50%;transform:translateY(-50%);
|
|
86
|
+
pointer-events:none;color:var(--txm);transition:transform .18s;flex-shrink:0;
|
|
87
|
+
}
|
|
88
|
+
.ndp-dd-trigger.active .ndp-dd-arrow{transform:translateY(-50%) rotate(180deg);}
|
|
89
|
+
|
|
90
|
+
.ndp-dd-panel{
|
|
91
|
+
position:absolute;top:calc(100% + 5px);left:0;
|
|
92
|
+
min-width:100%;
|
|
93
|
+
background:#fff;border:1px solid var(--bd);border-radius:10px;
|
|
94
|
+
box-shadow:0 8px 28px rgba(0,0,0,0.13);
|
|
95
|
+
z-index:999;overflow:hidden;
|
|
96
|
+
animation:ndp-dd-in .15s cubic-bezier(.25,.8,.25,1);
|
|
97
|
+
transform-origin:top center;
|
|
98
|
+
}
|
|
99
|
+
@keyframes ndp-dd-in{from{opacity:0;transform:scaleY(.85) translateY(-4px);}to{opacity:1;transform:none;}}
|
|
100
|
+
|
|
101
|
+
/* Month panel: 3-column grid */
|
|
102
|
+
.ndp-dd-months{
|
|
103
|
+
display:grid;grid-template-columns:repeat(3,1fr);
|
|
104
|
+
padding:6px;gap:3px;
|
|
105
|
+
}
|
|
106
|
+
.ndp-dd-month-item{
|
|
107
|
+
padding:7px 4px;text-align:center;
|
|
108
|
+
border-radius:7px;cursor:pointer;border:none;background:transparent;
|
|
109
|
+
font-family:'Noto Sans Devanagari',sans-serif;font-size:12.5px;font-weight:500;color:var(--tx);
|
|
110
|
+
transition:background .12s,color .12s;
|
|
111
|
+
white-space:nowrap;
|
|
112
|
+
}
|
|
113
|
+
.ndp-dd-month-item:hover{background:var(--prs);color:var(--pr);}
|
|
114
|
+
.ndp-dd-month-item.sel{background:var(--pr);color:#fff;font-weight:700;}
|
|
115
|
+
|
|
116
|
+
/* Year panel: scrollable list */
|
|
117
|
+
.ndp-dd-years{
|
|
118
|
+
max-height:180px;overflow-y:auto;padding:5px;
|
|
119
|
+
scrollbar-width:thin;scrollbar-color:var(--bd) transparent;
|
|
120
|
+
}
|
|
121
|
+
.ndp-dd-years::-webkit-scrollbar{width:4px;}
|
|
122
|
+
.ndp-dd-years::-webkit-scrollbar-thumb{background:var(--bd);border-radius:4px;}
|
|
123
|
+
.ndp-dd-year-item{
|
|
124
|
+
padding:7px 14px;border-radius:7px;cursor:pointer;border:none;background:transparent;
|
|
125
|
+
font-family:'DM Sans',sans-serif;font-size:13px;font-weight:500;color:var(--tx);
|
|
126
|
+
width:100%;text-align:center;
|
|
127
|
+
transition:background .12s,color .12s;
|
|
128
|
+
display:block;
|
|
129
|
+
}
|
|
130
|
+
.ndp-dd-year-item:hover{background:var(--prs);color:var(--pr);}
|
|
131
|
+
.ndp-dd-year-item.sel{background:var(--pr);color:#fff;font-weight:700;}
|
|
132
|
+
|
|
133
|
+
/* Grid — FIXED 6 rows so height never changes between months */
|
|
134
|
+
.ndp-body{padding:10px 10px 6px;}
|
|
135
|
+
.ndp-wdays{display:grid;grid-template-columns:repeat(7,1fr);margin-bottom:4px;}
|
|
136
|
+
.ndp-wday{
|
|
137
|
+
text-align:center;font-size:10.5px;font-weight:600;
|
|
138
|
+
letter-spacing:.04em;color:var(--txm);padding:3px 0;
|
|
139
|
+
font-family:'Noto Sans Devanagari',sans-serif;
|
|
140
|
+
}
|
|
141
|
+
.ndp-wday:last-child{color:var(--pr);}
|
|
142
|
+
|
|
143
|
+
.ndp-grid{
|
|
144
|
+
display:grid;
|
|
145
|
+
grid-template-columns:repeat(7,1fr);
|
|
146
|
+
grid-template-rows:repeat(6,36px); /* ← always exactly 6 rows */
|
|
147
|
+
gap:2px;
|
|
148
|
+
}
|
|
149
|
+
.ndp-cell{
|
|
150
|
+
display:flex;align-items:center;justify-content:center;
|
|
151
|
+
border-radius:8px;font-size:13px;
|
|
152
|
+
font-family:'Noto Sans Devanagari',sans-serif;
|
|
153
|
+
cursor:pointer;border:none;background:transparent;color:var(--tx);
|
|
154
|
+
transition:background .12s,color .12s,transform .1s;
|
|
155
|
+
font-weight:500;width:100%;
|
|
156
|
+
}
|
|
157
|
+
.ndp-cell.blank{cursor:default;pointer-events:none;}
|
|
158
|
+
.ndp-cell.overflow{color:var(--bd);cursor:default;pointer-events:none;}
|
|
159
|
+
.ndp-cell.wknd{color:var(--pr);}
|
|
160
|
+
.ndp-cell.today:not(.picked){
|
|
161
|
+
background:#fde8e6;
|
|
162
|
+
font-weight:700;color:var(--pr);
|
|
163
|
+
}
|
|
164
|
+
.ndp-cell.picked{
|
|
165
|
+
background:var(--pr);color:#fff;font-weight:700;
|
|
166
|
+
box-shadow:0 3px 10px rgba(192,57,43,.35);
|
|
167
|
+
}
|
|
168
|
+
.ndp-cell:hover:not(.overflow):not(.picked){
|
|
169
|
+
background:var(--prs);color:var(--pr);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/* Footer */
|
|
173
|
+
.ndp-ft{
|
|
174
|
+
padding:9px 12px 12px;
|
|
175
|
+
border-top:1px solid var(--bd);
|
|
176
|
+
display:flex;align-items:center;justify-content:space-between;gap:8px;
|
|
177
|
+
}
|
|
178
|
+
.ndp-ad{font-size:12px;color:var(--txm);}
|
|
179
|
+
.ndp-ad b{color:var(--tx);}
|
|
180
|
+
.ndp-today-btn{
|
|
181
|
+
font-size:12px;padding:5px 13px;
|
|
182
|
+
background:var(--acs);color:#9A7000;
|
|
183
|
+
border:1px solid #F0D090;border-radius:8px;
|
|
184
|
+
cursor:pointer;font-family:'DM Sans',sans-serif;font-weight:600;
|
|
185
|
+
transition:background .15s;white-space:nowrap;
|
|
186
|
+
}
|
|
187
|
+
.ndp-today-btn:hover{background:#FDEECA;}
|
|
188
|
+
`;let xe=!1;function Ne(){if(!xe&&typeof document<"u"){const n=document.createElement("style");n.textContent=Ee,document.head.appendChild(n),xe=!0}}function Te({value:n,onChange:c,language:b="np",placeholder:p,minYear:s=2060,maxYear:i=2090}){Ne();const d=b!=="en",u=M(),[y,_]=x.useState(!1),[w,k]=x.useState(null),[B,j]=x.useState(!1),[N,D]=x.useState(!1),[g,T]=x.useState(()=>n?.year??M().year),[h,S]=x.useState(()=>n?.month??M().month),L=x.useRef(null),F=x.useRef(null);x.useEffect(()=>{const t=m=>{L.current&&!L.current.contains(m.target)&&(_(!1),j(!1),D(!1))};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[]),x.useEffect(()=>{n&&(T(n.year),S(n.month))},[n]),x.useEffect(()=>{if(N&&F.current){const t=F.current.querySelector(".sel");t&&t.scrollIntoView({block:"center"})}},[N]);const te=x.useCallback(t=>{if(!t)return;c?.({year:g,month:h,day:t},R(g,h,t)),_(!1)},[g,h,c]),oe=()=>{k("right"),setTimeout(()=>k(null),200),h===1?(S(12),T(t=>t-1)):S(t=>t-1)},ae=()=>{k("left"),setTimeout(()=>k(null),200),h===12?(S(1),T(t=>t+1)):S(t=>t+1)},z=()=>{const t=M();T(t.year),S(t.month),c?.(t,R(t.year,t.month,t.day)),_(!1)},Z=ne(g,h),I=ue(g,h),W=h===1?12:h-1,Q=h===1?g-1:g,se=ne(Q,W),V=Array.from({length:I},(t,m)=>({day:se-I+1+m,overflow:"prev"})),K=Array.from({length:Z},(t,m)=>({day:m+1,overflow:null})),q=42-(I+Z),ee=Array.from({length:q},(t,m)=>({day:m+1,overflow:"next"})),re=[...V,...K,...ee],e=d?me:he,o=d?ke:je,a=e[h-1],l=d?Y(g):String(g),U=R(g,h,1).toLocaleDateString("en-GB",{month:"short",year:"numeric"}),f=n?d?`${Y(n.year)} ${me[n.month-1]} ${Y(n.day)}`:`${n.year} ${he[n.month-1]} ${n.day}`:"",E=d?"मिति छान्नुहोस्":"Select BS date",A=n?R(n.year,n.month,n.day):null,de=Array.from({length:i-s+1},(t,m)=>s+m);return r.jsxs("div",{className:"ndp",ref:L,children:[r.jsxs("div",{className:"ndp-wrap",onClick:()=>_(t=>!t),children:[r.jsx("input",{readOnly:!0,className:`ndp-input${y?" open":""}`,value:f,placeholder:p??E}),r.jsx("span",{className:"ndp-icon",children:r.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2"}),r.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),r.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),r.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})})]}),y&&r.jsxs("div",{className:"ndp-popup",children:[r.jsx("div",{className:"ndp-hd",children:r.jsxs("div",{className:"ndp-hd-row",children:[r.jsx("button",{className:"ndp-nav",onClick:oe,children:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m15 18-6-6 6-6"})})}),r.jsxs("div",{className:`ndp-hd-center${w?` ndp-slide-${w}`:""}`,children:[r.jsx("div",{className:"ndp-hd-month",children:a}),r.jsxs("div",{className:"ndp-hd-sub",children:[l," BS · ",U]})]}),r.jsx("button",{className:"ndp-nav",onClick:ae,children:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m9 18 6-6-6-6"})})})]})}),r.jsxs("div",{className:"ndp-controls",children:[r.jsxs("div",{className:"ndp-dd",children:[r.jsxs("button",{className:`ndp-dd-trigger${B?" active":""}`,onClick:()=>{j(t=>!t),D(!1)},children:[r.jsx("span",{children:a}),r.jsx("span",{className:"ndp-dd-arrow",children:r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m6 9 6 6 6-6"})})})]}),B&&r.jsx("div",{className:"ndp-dd-panel",children:r.jsx("div",{className:"ndp-dd-months",children:e.map((t,m)=>r.jsx("button",{className:`ndp-dd-month-item${h===m+1?" sel":""}`,onClick:()=>{k(m+1<h?"right":"left"),setTimeout(()=>k(null),200),S(m+1),j(!1)},children:t},m))})})]}),r.jsxs("div",{className:"ndp-dd",children:[r.jsxs("button",{className:`ndp-dd-trigger${N?" active":""}`,onClick:()=>{D(t=>!t),j(!1)},children:[r.jsx("span",{children:l}),r.jsx("span",{className:"ndp-dd-arrow",children:r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("path",{d:"m6 9 6 6 6-6"})})})]}),N&&r.jsx("div",{className:"ndp-dd-panel",children:r.jsx("div",{className:"ndp-dd-years",ref:F,children:de.map(t=>r.jsx("button",{className:`ndp-dd-year-item${g===t?" sel":""}`,onClick:()=>{T(t),D(!1)},children:d?Y(t):t},t))})})]})]}),r.jsxs("div",{className:"ndp-body",children:[r.jsx("div",{className:"ndp-wdays",children:o.map((t,m)=>r.jsx("div",{className:"ndp-wday",children:t},m))}),r.jsx("div",{className:`ndp-grid${w?` ndp-slide-${w}`:""}`,children:re.map(({day:t,overflow:m},ge)=>{const Re=ge%7===6,X=m!==null,De=!X&&t===u.day&&h===u.month&&g===u.year,Ae=!X&&n&&t===n.day&&h===n.month&&g===n.year;let J="ndp-cell";return X?J+=" overflow":Re&&(J+=" wknd"),De&&(J+=" today"),Ae&&(J+=" picked"),r.jsx("button",{className:J,disabled:X,onClick:()=>!X&&te(t),children:d?Y(t):t},ge)})})]}),r.jsxs("div",{className:"ndp-ft",children:[r.jsx("span",{className:"ndp-ad",children:A?r.jsxs(r.Fragment,{children:[r.jsx("b",{children:"AD:"})," ",_e(A)]}):r.jsx("span",{style:{color:"var(--txm)",fontSize:12},children:d?"मिति छानिएको छैन":"No date selected"})}),r.jsx("button",{className:"ndp-today-btn",onClick:z,children:d?"आज":"Today"})]})]})]})}v.adToBs=fe,v.bsToAd=R,v.default=Te,v.getDaysInBSMonth=ne,v.getFirstDayOfWeekBS=ue,v.getTodayBS=M,Object.defineProperties(v,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@himal_bhattarai/nepali-datepicker",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Nepali Bikram Sambat (BS) date picker React component with BS↔AD conversion",
|
|
5
|
+
"main": "./dist/nepali-datepicker.umd.js",
|
|
6
|
+
"module": "./dist/nepali-datepicker.es.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/nepali-datepicker.es.js",
|
|
10
|
+
"require": "./dist/nepali-datepicker.umd.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": ["dist"],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "vite build",
|
|
16
|
+
"prepublishOnly": "npm run build"
|
|
17
|
+
},
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"react": ">=17",
|
|
20
|
+
"react-dom": ">=17"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@vitejs/plugin-react": "^4.0.0",
|
|
24
|
+
"vite": "^5.0.0"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"nepali", "datepicker", "bikram", "sambat",
|
|
28
|
+
"bs", "calendar", "react", "nepal", "bs-date"
|
|
29
|
+
],
|
|
30
|
+
"license": "MIT"
|
|
31
|
+
}
|