@himal_bhattarai/nepali-datepicker 1.0.0 → 1.1.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/dist/nepali-datepicker.es.js +278 -258
- package/dist/nepali-datepicker.umd.js +44 -37
- package/package.json +14 -5
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
import
|
|
2
|
-
var Q = { exports: {} },
|
|
3
|
-
var
|
|
4
|
-
function
|
|
5
|
-
if (
|
|
6
|
-
|
|
7
|
-
var n = /* @__PURE__ */ Symbol.for("react.transitional.element"),
|
|
8
|
-
function b(
|
|
9
|
-
var
|
|
10
|
-
if (i !== void 0 && (
|
|
1
|
+
import je, { useState as C, useRef as ce, useEffect as de, useCallback as _e } from "react";
|
|
2
|
+
var Q = { exports: {} }, W = {};
|
|
3
|
+
var pe;
|
|
4
|
+
function Ee() {
|
|
5
|
+
if (pe) return W;
|
|
6
|
+
pe = 1;
|
|
7
|
+
var n = /* @__PURE__ */ Symbol.for("react.transitional.element"), l = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
8
|
+
function b(c, d, i) {
|
|
9
|
+
var x = null;
|
|
10
|
+
if (i !== void 0 && (x = "" + i), d.key !== void 0 && (x = "" + d.key), "key" in d) {
|
|
11
11
|
i = {};
|
|
12
|
-
for (var
|
|
13
|
-
|
|
14
|
-
} else i =
|
|
15
|
-
return
|
|
12
|
+
for (var a in d)
|
|
13
|
+
a !== "key" && (i[a] = d[a]);
|
|
14
|
+
} else i = d;
|
|
15
|
+
return d = i.ref, {
|
|
16
16
|
$$typeof: n,
|
|
17
|
-
type:
|
|
18
|
-
key:
|
|
19
|
-
ref:
|
|
17
|
+
type: c,
|
|
18
|
+
key: x,
|
|
19
|
+
ref: d !== void 0 ? d : null,
|
|
20
20
|
props: i
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
return
|
|
23
|
+
return W.Fragment = l, W.jsx = b, W.jsxs = b, W;
|
|
24
24
|
}
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
function
|
|
28
|
-
return
|
|
25
|
+
var V = {};
|
|
26
|
+
var ue;
|
|
27
|
+
function Se() {
|
|
28
|
+
return ue || (ue = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
29
29
|
function n(e) {
|
|
30
30
|
if (e == null) return null;
|
|
31
31
|
if (typeof e == "function")
|
|
32
|
-
return e.$$typeof ===
|
|
32
|
+
return e.$$typeof === te ? null : e.displayName || e.name || null;
|
|
33
33
|
if (typeof e == "string") return e;
|
|
34
34
|
switch (e) {
|
|
35
|
-
case
|
|
35
|
+
case w:
|
|
36
36
|
return "Fragment";
|
|
37
|
-
case
|
|
37
|
+
case g:
|
|
38
38
|
return "Profiler";
|
|
39
|
-
case
|
|
39
|
+
case D:
|
|
40
40
|
return "StrictMode";
|
|
41
|
-
case
|
|
41
|
+
case Y:
|
|
42
42
|
return "Suspense";
|
|
43
|
-
case
|
|
43
|
+
case $:
|
|
44
44
|
return "SuspenseList";
|
|
45
|
-
case
|
|
45
|
+
case ne:
|
|
46
46
|
return "Activity";
|
|
47
47
|
}
|
|
48
48
|
if (typeof e == "object")
|
|
49
49
|
switch (typeof e.tag == "number" && console.error(
|
|
50
50
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
51
51
|
), e.$$typeof) {
|
|
52
|
-
case
|
|
52
|
+
case R:
|
|
53
53
|
return "Portal";
|
|
54
|
-
case
|
|
54
|
+
case h:
|
|
55
55
|
return e.displayName || "Context";
|
|
56
|
-
case
|
|
56
|
+
case N:
|
|
57
57
|
return (e._context.displayName || "Context") + ".Consumer";
|
|
58
|
-
case
|
|
58
|
+
case y:
|
|
59
59
|
var o = e.render;
|
|
60
60
|
return e = e.displayName, e || (e = o.displayName || o.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
61
|
-
case
|
|
61
|
+
case re:
|
|
62
62
|
return o = e.displayName || null, o !== null ? o : n(e.type) || "Memo";
|
|
63
|
-
case
|
|
63
|
+
case B:
|
|
64
64
|
o = e._payload, e = e._init;
|
|
65
65
|
try {
|
|
66
66
|
return n(e(o));
|
|
@@ -69,29 +69,29 @@ function je() {
|
|
|
69
69
|
}
|
|
70
70
|
return null;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function l(e) {
|
|
73
73
|
return "" + e;
|
|
74
74
|
}
|
|
75
75
|
function b(e) {
|
|
76
76
|
try {
|
|
77
|
-
|
|
77
|
+
l(e);
|
|
78
78
|
var o = !1;
|
|
79
79
|
} catch {
|
|
80
80
|
o = !0;
|
|
81
81
|
}
|
|
82
82
|
if (o) {
|
|
83
83
|
o = console;
|
|
84
|
-
var
|
|
85
|
-
return
|
|
84
|
+
var s = o.error, p = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
85
|
+
return s.call(
|
|
86
86
|
o,
|
|
87
87
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
88
|
-
|
|
89
|
-
),
|
|
88
|
+
p
|
|
89
|
+
), l(e);
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
function
|
|
93
|
-
if (e ===
|
|
94
|
-
if (typeof e == "object" && e !== null && e.$$typeof ===
|
|
92
|
+
function c(e) {
|
|
93
|
+
if (e === w) return "<>";
|
|
94
|
+
if (typeof e == "object" && e !== null && e.$$typeof === B)
|
|
95
95
|
return "<...>";
|
|
96
96
|
try {
|
|
97
97
|
var o = n(e);
|
|
@@ -100,49 +100,49 @@ function je() {
|
|
|
100
100
|
return "<...>";
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
function
|
|
104
|
-
var e =
|
|
103
|
+
function d() {
|
|
104
|
+
var e = A.A;
|
|
105
105
|
return e === null ? null : e.getOwner();
|
|
106
106
|
}
|
|
107
107
|
function i() {
|
|
108
108
|
return Error("react-stack-top-frame");
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
if (
|
|
110
|
+
function x(e) {
|
|
111
|
+
if (O.call(e, "key")) {
|
|
112
112
|
var o = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
113
113
|
if (o && o.isReactWarning) return !1;
|
|
114
114
|
}
|
|
115
115
|
return e.key !== void 0;
|
|
116
116
|
}
|
|
117
|
-
function
|
|
118
|
-
function
|
|
117
|
+
function a(e, o) {
|
|
118
|
+
function s() {
|
|
119
119
|
q || (q = !0, console.error(
|
|
120
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
121
|
o
|
|
122
122
|
));
|
|
123
123
|
}
|
|
124
|
-
|
|
125
|
-
get:
|
|
124
|
+
s.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
125
|
+
get: s,
|
|
126
126
|
configurable: !0
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function f() {
|
|
130
130
|
var e = n(this.type);
|
|
131
|
-
return
|
|
131
|
+
return J[e] || (J[e] = !0, console.error(
|
|
132
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
133
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
134
134
|
}
|
|
135
|
-
function j(e, o,
|
|
136
|
-
var
|
|
135
|
+
function j(e, o, s, p, T, P) {
|
|
136
|
+
var u = s.ref;
|
|
137
137
|
return e = {
|
|
138
|
-
$$typeof:
|
|
138
|
+
$$typeof: M,
|
|
139
139
|
type: e,
|
|
140
140
|
key: o,
|
|
141
|
-
props:
|
|
142
|
-
_owner:
|
|
143
|
-
}, (
|
|
141
|
+
props: s,
|
|
142
|
+
_owner: p
|
|
143
|
+
}, (u !== void 0 ? u : null) !== null ? Object.defineProperty(e, "ref", {
|
|
144
144
|
enumerable: !1,
|
|
145
|
-
get:
|
|
145
|
+
get: f
|
|
146
146
|
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
147
147
|
configurable: !1,
|
|
148
148
|
enumerable: !1,
|
|
@@ -157,109 +157,109 @@ function je() {
|
|
|
157
157
|
configurable: !1,
|
|
158
158
|
enumerable: !1,
|
|
159
159
|
writable: !0,
|
|
160
|
-
value:
|
|
160
|
+
value: T
|
|
161
161
|
}), Object.defineProperty(e, "_debugTask", {
|
|
162
162
|
configurable: !1,
|
|
163
163
|
enumerable: !1,
|
|
164
164
|
writable: !0,
|
|
165
|
-
value:
|
|
165
|
+
value: P
|
|
166
166
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
167
167
|
}
|
|
168
|
-
function
|
|
169
|
-
var
|
|
170
|
-
if (
|
|
171
|
-
if (
|
|
172
|
-
if (oe(
|
|
173
|
-
for (
|
|
174
|
-
|
|
175
|
-
Object.freeze && Object.freeze(
|
|
168
|
+
function _(e, o, s, p, T, P) {
|
|
169
|
+
var u = o.children;
|
|
170
|
+
if (u !== void 0)
|
|
171
|
+
if (p)
|
|
172
|
+
if (oe(u)) {
|
|
173
|
+
for (p = 0; p < u.length; p++)
|
|
174
|
+
E(u[p]);
|
|
175
|
+
Object.freeze && Object.freeze(u);
|
|
176
176
|
} else
|
|
177
177
|
console.error(
|
|
178
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
179
|
);
|
|
180
|
-
else
|
|
181
|
-
if (
|
|
182
|
-
|
|
183
|
-
var
|
|
180
|
+
else E(u);
|
|
181
|
+
if (O.call(o, "key")) {
|
|
182
|
+
u = n(e);
|
|
183
|
+
var k = Object.keys(o).filter(function(se) {
|
|
184
184
|
return se !== "key";
|
|
185
185
|
});
|
|
186
|
-
|
|
186
|
+
p = 0 < k.length ? "{key: someKey, " + k.join(": ..., ") + ": ...}" : "{key: someKey}", Z[u + p] || (k = 0 < k.length ? "{" + k.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
187
187
|
`A props object containing a "key" prop is being spread into JSX:
|
|
188
188
|
let props = %s;
|
|
189
189
|
<%s {...props} />
|
|
190
190
|
React keys must be passed directly to JSX without using spread:
|
|
191
191
|
let props = %s;
|
|
192
192
|
<%s key={someKey} {...props} />`,
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
), Z[
|
|
193
|
+
p,
|
|
194
|
+
u,
|
|
195
|
+
k,
|
|
196
|
+
u
|
|
197
|
+
), Z[u + p] = !0);
|
|
198
198
|
}
|
|
199
|
-
if (
|
|
200
|
-
|
|
201
|
-
for (var
|
|
202
|
-
|
|
203
|
-
} else
|
|
204
|
-
return
|
|
205
|
-
|
|
199
|
+
if (u = null, s !== void 0 && (b(s), u = "" + s), x(o) && (b(o.key), u = "" + o.key), "key" in o) {
|
|
200
|
+
s = {};
|
|
201
|
+
for (var z in o)
|
|
202
|
+
z !== "key" && (s[z] = o[z]);
|
|
203
|
+
} else s = o;
|
|
204
|
+
return u && a(
|
|
205
|
+
s,
|
|
206
206
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
207
207
|
), j(
|
|
208
208
|
e,
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
209
|
+
u,
|
|
210
|
+
s,
|
|
211
|
+
d(),
|
|
212
|
+
T,
|
|
213
|
+
P
|
|
214
214
|
);
|
|
215
215
|
}
|
|
216
|
-
function
|
|
217
|
-
|
|
216
|
+
function E(e) {
|
|
217
|
+
S(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === B && (e._payload.status === "fulfilled" ? S(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
218
218
|
}
|
|
219
|
-
function
|
|
220
|
-
return typeof e == "object" && e !== null && e.$$typeof ===
|
|
219
|
+
function S(e) {
|
|
220
|
+
return typeof e == "object" && e !== null && e.$$typeof === M;
|
|
221
221
|
}
|
|
222
|
-
var
|
|
222
|
+
var v = je, M = /* @__PURE__ */ Symbol.for("react.transitional.element"), R = /* @__PURE__ */ Symbol.for("react.portal"), w = /* @__PURE__ */ Symbol.for("react.fragment"), D = /* @__PURE__ */ Symbol.for("react.strict_mode"), g = /* @__PURE__ */ Symbol.for("react.profiler"), N = /* @__PURE__ */ Symbol.for("react.consumer"), h = /* @__PURE__ */ Symbol.for("react.context"), y = /* @__PURE__ */ Symbol.for("react.forward_ref"), Y = /* @__PURE__ */ Symbol.for("react.suspense"), $ = /* @__PURE__ */ Symbol.for("react.suspense_list"), re = /* @__PURE__ */ Symbol.for("react.memo"), B = /* @__PURE__ */ Symbol.for("react.lazy"), ne = /* @__PURE__ */ Symbol.for("react.activity"), te = /* @__PURE__ */ Symbol.for("react.client.reference"), A = v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, O = Object.prototype.hasOwnProperty, oe = Array.isArray, L = console.createTask ? console.createTask : function() {
|
|
223
223
|
return null;
|
|
224
224
|
};
|
|
225
|
-
|
|
225
|
+
v = {
|
|
226
226
|
react_stack_bottom_frame: function(e) {
|
|
227
227
|
return e();
|
|
228
228
|
}
|
|
229
229
|
};
|
|
230
|
-
var q,
|
|
231
|
-
|
|
230
|
+
var q, J = {}, H = v.react_stack_bottom_frame.bind(
|
|
231
|
+
v,
|
|
232
232
|
i
|
|
233
|
-
)(),
|
|
234
|
-
|
|
235
|
-
var
|
|
236
|
-
return
|
|
233
|
+
)(), ae = L(c(i)), Z = {};
|
|
234
|
+
V.Fragment = w, V.jsx = function(e, o, s) {
|
|
235
|
+
var p = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
236
|
+
return _(
|
|
237
237
|
e,
|
|
238
238
|
o,
|
|
239
|
-
|
|
239
|
+
s,
|
|
240
240
|
!1,
|
|
241
|
-
|
|
242
|
-
|
|
241
|
+
p ? Error("react-stack-top-frame") : H,
|
|
242
|
+
p ? L(c(e)) : ae
|
|
243
243
|
);
|
|
244
|
-
},
|
|
245
|
-
var
|
|
246
|
-
return
|
|
244
|
+
}, V.jsxs = function(e, o, s) {
|
|
245
|
+
var p = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
246
|
+
return _(
|
|
247
247
|
e,
|
|
248
248
|
o,
|
|
249
|
-
|
|
249
|
+
s,
|
|
250
250
|
!0,
|
|
251
|
-
|
|
252
|
-
|
|
251
|
+
p ? Error("react-stack-top-frame") : H,
|
|
252
|
+
p ? L(c(e)) : ae
|
|
253
253
|
);
|
|
254
254
|
};
|
|
255
|
-
})()),
|
|
255
|
+
})()), V;
|
|
256
256
|
}
|
|
257
257
|
var fe;
|
|
258
|
-
function
|
|
259
|
-
return fe || (fe = 1, process.env.NODE_ENV === "production" ? Q.exports =
|
|
258
|
+
function Ne() {
|
|
259
|
+
return fe || (fe = 1, process.env.NODE_ENV === "production" ? Q.exports = Ee() : Q.exports = Se()), Q.exports;
|
|
260
260
|
}
|
|
261
|
-
var r =
|
|
262
|
-
const
|
|
261
|
+
var r = Ne();
|
|
262
|
+
const X = {
|
|
263
263
|
2e3: [30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31],
|
|
264
264
|
2001: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
265
265
|
2002: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30],
|
|
@@ -352,56 +352,63 @@ const G = {
|
|
|
352
352
|
2089: [31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30],
|
|
353
353
|
2090: [31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30]
|
|
354
354
|
}, ee = new Date(1943, 3, 14);
|
|
355
|
-
function
|
|
356
|
-
let
|
|
355
|
+
function Te(n, l, b) {
|
|
356
|
+
let c = 0;
|
|
357
357
|
for (let i = 2e3; i < n; i++) {
|
|
358
|
-
const
|
|
359
|
-
|
|
358
|
+
const x = X[i];
|
|
359
|
+
x && (c += x.reduce((a, f) => a + f, 0));
|
|
360
360
|
}
|
|
361
|
-
const
|
|
362
|
-
for (let i = 0; i <
|
|
363
|
-
return
|
|
361
|
+
const d = X[n] || [];
|
|
362
|
+
for (let i = 0; i < l - 1; i++) c += d[i] || 30;
|
|
363
|
+
return c + b - 1;
|
|
364
364
|
}
|
|
365
|
-
function
|
|
366
|
-
const
|
|
367
|
-
return
|
|
365
|
+
function U(n, l, b) {
|
|
366
|
+
const c = new Date(ee);
|
|
367
|
+
return c.setDate(c.getDate() + Te(n, l, b)), c;
|
|
368
368
|
}
|
|
369
|
-
function
|
|
370
|
-
const
|
|
371
|
-
let
|
|
372
|
-
for (;
|
|
373
|
-
const
|
|
374
|
-
if (
|
|
375
|
-
|
|
369
|
+
function Re(n) {
|
|
370
|
+
const l = new Date(n.getFullYear(), n.getMonth(), n.getDate()), b = new Date(ee.getFullYear(), ee.getMonth(), ee.getDate());
|
|
371
|
+
let c = Math.round((l - b) / 864e5), d = 2e3;
|
|
372
|
+
for (; d <= 2090; ) {
|
|
373
|
+
const a = X[d], f = a ? a.reduce((j, _) => j + _, 0) : 365;
|
|
374
|
+
if (c < f) break;
|
|
375
|
+
c -= f, d++;
|
|
376
376
|
}
|
|
377
|
-
const i =
|
|
378
|
-
let
|
|
379
|
-
for (let
|
|
380
|
-
const
|
|
381
|
-
if (
|
|
382
|
-
|
|
377
|
+
const i = X[d] || [];
|
|
378
|
+
let x = 1;
|
|
379
|
+
for (let a = 0; a < 12; a++) {
|
|
380
|
+
const f = i[a] || 30;
|
|
381
|
+
if (c < f) {
|
|
382
|
+
x = a + 1;
|
|
383
383
|
break;
|
|
384
384
|
}
|
|
385
|
-
|
|
385
|
+
c -= f, a === 11 && (x = 12);
|
|
386
386
|
}
|
|
387
|
-
return { year:
|
|
387
|
+
return { year: d, month: x, day: c + 1 };
|
|
388
388
|
}
|
|
389
389
|
function K() {
|
|
390
|
-
return
|
|
390
|
+
return Re(/* @__PURE__ */ new Date());
|
|
391
391
|
}
|
|
392
|
-
function
|
|
393
|
-
return (
|
|
392
|
+
function me(n, l) {
|
|
393
|
+
return (X[n] || [])[l - 1] || 30;
|
|
394
394
|
}
|
|
395
|
-
function
|
|
396
|
-
return
|
|
395
|
+
function De(n, l) {
|
|
396
|
+
return U(n, l, 1).getDay();
|
|
397
397
|
}
|
|
398
|
-
const
|
|
398
|
+
const he = ["बैशाख", "जेठ", "असार", "श्रावण", "भाद्र", "असोज", "कार्तिक", "मङ्सिर", "पुष", "माघ", "फागुन", "चैत्र"], xe = ["Baisakh", "Jestha", "Ashadh", "Shrawan", "Bhadra", "Ashwin", "Kartik", "Mangsir", "Poush", "Magh", "Falgun", "Chaitra"], Ae = ["आइत", "सोम", "मङ्गल", "बुध", "बिही", "शुक्र", "शनि"], Oe = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], Pe = ["०", "१", "२", "३", "४", "५", "६", "७", "८", "९"], G = (n) => String(n).split("").map((l) => Pe[+l] ?? l).join(""), Ce = (n) => n ? n.toLocaleDateString("en-GB", { day: "numeric", month: "short", year: "numeric" }) : "", Me = `
|
|
399
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
400
|
|
|
401
401
|
.ndp{
|
|
402
|
-
--
|
|
403
|
-
--
|
|
404
|
-
--
|
|
402
|
+
--ndp-primary: #C0392B;
|
|
403
|
+
--ndp-primary-soft: #fff0ee;
|
|
404
|
+
--ndp-controls-bg: #fffaee;
|
|
405
|
+
--ndp-background: #fff;
|
|
406
|
+
--ndp-text: #1A1208;
|
|
407
|
+
--ndp-text-muted: #8C7B6B;
|
|
408
|
+
--ndp-border: #E8DED0;
|
|
409
|
+
--ndp-today-bg: #fde8e6;
|
|
410
|
+
--ndp-radius: 16px;
|
|
411
|
+
--ndp-shadow: 0 24px 64px rgba(0,0,0,0.13),0 4px 16px rgba(0,0,0,0.07);
|
|
405
412
|
font-family:'DM Sans',sans-serif;
|
|
406
413
|
position:relative; display:inline-block;
|
|
407
414
|
}
|
|
@@ -412,24 +419,24 @@ const me = ["बैशाख", "जेठ", "असार", "श्रावण"
|
|
|
412
419
|
.ndp-input{
|
|
413
420
|
width:100%; min-width:270px;
|
|
414
421
|
padding:13px 48px 13px 17px;
|
|
415
|
-
border:2px solid var(--
|
|
416
|
-
background:var(--
|
|
422
|
+
border:2px solid var(--ndp-border); border-radius:13px;
|
|
423
|
+
background:var(--ndp-background); color:var(--tx);
|
|
417
424
|
font-family:'DM Sans',sans-serif; font-size:15px;
|
|
418
425
|
cursor:pointer; outline:none;
|
|
419
426
|
transition:border-color .2s,box-shadow .2s;
|
|
420
427
|
caret-color:transparent;
|
|
421
428
|
}
|
|
422
|
-
.ndp-input::placeholder{color:var(--
|
|
423
|
-
.ndp-input.open{border-color:var(--
|
|
424
|
-
.ndp-icon{position:absolute;right:14px;top:50%;transform:translateY(-50%);pointer-events:none;color:var(--
|
|
425
|
-
.ndp-input.open ~ .ndp-icon{color:var(--
|
|
429
|
+
.ndp-input::placeholder{color:var(--ndp-text-muted);}
|
|
430
|
+
.ndp-input.open{border-color:var(--ndp-primary);box-shadow:0 0 0 4px rgba(192,57,43,.11);}
|
|
431
|
+
.ndp-icon{position:absolute;right:14px;top:50%;transform:translateY(-50%);pointer-events:none;color:var(--ndp-text-muted);transition:color .2s;}
|
|
432
|
+
.ndp-input.open ~ .ndp-icon{color:var(--ndp-primary);}
|
|
426
433
|
|
|
427
434
|
/* Popup */
|
|
428
435
|
.ndp-popup{
|
|
429
436
|
position:absolute; top:calc(100% + 9px); left:0; z-index:9999;
|
|
430
437
|
width:336px;
|
|
431
|
-
background:var(--
|
|
432
|
-
box-shadow:var(--sh); border:1px solid var(--
|
|
438
|
+
background:var(--ndp-background); border-radius:var(--r);
|
|
439
|
+
box-shadow:var(--sh); border:1px solid var(--ndp-border);
|
|
433
440
|
overflow:hidden;
|
|
434
441
|
animation:ndp-pop .18s cubic-bezier(.34,1.56,.64,1);
|
|
435
442
|
transform-origin:top left;
|
|
@@ -441,7 +448,7 @@ const me = ["बैशाख", "जेठ", "असार", "श्रावण"
|
|
|
441
448
|
.ndp-slide-right{animation:ndp-slide-right .2s cubic-bezier(.25,.8,.25,1);}
|
|
442
449
|
|
|
443
450
|
/* Header */
|
|
444
|
-
.ndp-hd{background:var(--
|
|
451
|
+
.ndp-hd{background:var(--ndp-primary);padding:14px;color:#fff;}
|
|
445
452
|
.ndp-hd-row{display:flex;align-items:center;justify-content:space-between;}
|
|
446
453
|
.ndp-nav{
|
|
447
454
|
width:32px;height:32px;display:flex;align-items:center;justify-content:center;
|
|
@@ -456,13 +463,13 @@ const me = ["बैशाख", "जेठ", "असार", "श्रावण"
|
|
|
456
463
|
/* Custom dropdowns */
|
|
457
464
|
.ndp-controls{
|
|
458
465
|
display:flex;gap:6px;padding:9px 12px;
|
|
459
|
-
background:var(--
|
|
466
|
+
background:var(--ndp-controls-bg);border-bottom:1px solid var(--ndp-border);
|
|
460
467
|
position:relative;z-index:10;
|
|
461
468
|
}
|
|
462
469
|
.ndp-dd{position:relative;flex:1;}
|
|
463
470
|
.ndp-dd-trigger{
|
|
464
471
|
width:100%;padding:6px 28px 6px 10px;
|
|
465
|
-
border:1px solid var(--
|
|
472
|
+
border:1px solid var(--ndp-border);border-radius:8px;
|
|
466
473
|
background:#fff;color:var(--tx);
|
|
467
474
|
font-family:'Noto Sans Devanagari',sans-serif;font-size:13px;font-weight:500;
|
|
468
475
|
cursor:pointer;outline:none;
|
|
@@ -472,17 +479,17 @@ const me = ["बैशाख", "जेठ", "असार", "श्रावण"
|
|
|
472
479
|
position:relative;
|
|
473
480
|
}
|
|
474
481
|
.ndp-dd-trigger:hover{border-color:#c8b8a8;}
|
|
475
|
-
.ndp-dd-trigger.active{border-color:var(--
|
|
482
|
+
.ndp-dd-trigger.active{border-color:var(--ndp-primary);box-shadow:0 0 0 3px rgba(192,57,43,.10);}
|
|
476
483
|
.ndp-dd-arrow{
|
|
477
484
|
position:absolute;right:8px;top:50%;transform:translateY(-50%);
|
|
478
|
-
pointer-events:none;color:var(--
|
|
485
|
+
pointer-events:none;color:var(--ndp-text-muted);transition:transform .18s;flex-shrink:0;
|
|
479
486
|
}
|
|
480
487
|
.ndp-dd-trigger.active .ndp-dd-arrow{transform:translateY(-50%) rotate(180deg);}
|
|
481
488
|
|
|
482
489
|
.ndp-dd-panel{
|
|
483
490
|
position:absolute;top:calc(100% + 5px);left:0;
|
|
484
491
|
min-width:100%;
|
|
485
|
-
background:#fff;border:1px solid var(--
|
|
492
|
+
background:#fff;border:1px solid var(--ndp-border);border-radius:10px;
|
|
486
493
|
box-shadow:0 8px 28px rgba(0,0,0,0.13);
|
|
487
494
|
z-index:999;overflow:hidden;
|
|
488
495
|
animation:ndp-dd-in .15s cubic-bezier(.25,.8,.25,1);
|
|
@@ -502,16 +509,16 @@ const me = ["बैशाख", "जेठ", "असार", "श्रावण"
|
|
|
502
509
|
transition:background .12s,color .12s;
|
|
503
510
|
white-space:nowrap;
|
|
504
511
|
}
|
|
505
|
-
.ndp-dd-month-item:hover{background:var(--
|
|
506
|
-
.ndp-dd-month-item.sel{background:var(--
|
|
512
|
+
.ndp-dd-month-item:hover{background:var(--ndp-primary-soft);color:var(--ndp-primary);}
|
|
513
|
+
.ndp-dd-month-item.sel{background:var(--ndp-primary);color:#fff;font-weight:700;}
|
|
507
514
|
|
|
508
515
|
/* Year panel: scrollable list */
|
|
509
516
|
.ndp-dd-years{
|
|
510
517
|
max-height:180px;overflow-y:auto;padding:5px;
|
|
511
|
-
scrollbar-width:thin;scrollbar-color:var(--
|
|
518
|
+
scrollbar-width:thin;scrollbar-color:var(--ndp-border) transparent;
|
|
512
519
|
}
|
|
513
520
|
.ndp-dd-years::-webkit-scrollbar{width:4px;}
|
|
514
|
-
.ndp-dd-years::-webkit-scrollbar-thumb{background:var(--
|
|
521
|
+
.ndp-dd-years::-webkit-scrollbar-thumb{background:var(--ndp-border);border-radius:4px;}
|
|
515
522
|
.ndp-dd-year-item{
|
|
516
523
|
padding:7px 14px;border-radius:7px;cursor:pointer;border:none;background:transparent;
|
|
517
524
|
font-family:'DM Sans',sans-serif;font-size:13px;font-weight:500;color:var(--tx);
|
|
@@ -519,18 +526,18 @@ const me = ["बैशाख", "जेठ", "असार", "श्रावण"
|
|
|
519
526
|
transition:background .12s,color .12s;
|
|
520
527
|
display:block;
|
|
521
528
|
}
|
|
522
|
-
.ndp-dd-year-item:hover{background:var(--
|
|
523
|
-
.ndp-dd-year-item.sel{background:var(--
|
|
529
|
+
.ndp-dd-year-item:hover{background:var(--ndp-primary-soft);color:var(--ndp-primary);}
|
|
530
|
+
.ndp-dd-year-item.sel{background:var(--ndp-primary);color:#fff;font-weight:700;}
|
|
524
531
|
|
|
525
532
|
/* Grid — FIXED 6 rows so height never changes between months */
|
|
526
533
|
.ndp-body{padding:10px 10px 6px;}
|
|
527
534
|
.ndp-wdays{display:grid;grid-template-columns:repeat(7,1fr);margin-bottom:4px;}
|
|
528
535
|
.ndp-wday{
|
|
529
536
|
text-align:center;font-size:10.5px;font-weight:600;
|
|
530
|
-
letter-spacing:.04em;color:var(--
|
|
537
|
+
letter-spacing:.04em;color:var(--ndp-text-muted);padding:3px 0;
|
|
531
538
|
font-family:'Noto Sans Devanagari',sans-serif;
|
|
532
539
|
}
|
|
533
|
-
.ndp-wday:last-child{color:var(--
|
|
540
|
+
.ndp-wday:last-child{color:var(--ndp-primary);}
|
|
534
541
|
|
|
535
542
|
.ndp-grid{
|
|
536
543
|
display:grid;
|
|
@@ -547,96 +554,109 @@ const me = ["बैशाख", "जेठ", "असार", "श्रावण"
|
|
|
547
554
|
font-weight:500;width:100%;
|
|
548
555
|
}
|
|
549
556
|
.ndp-cell.blank{cursor:default;pointer-events:none;}
|
|
550
|
-
.ndp-cell.overflow{color:var(--
|
|
551
|
-
.ndp-cell.wknd{color:var(--
|
|
557
|
+
.ndp-cell.overflow{color:var(--ndp-border);cursor:default;pointer-events:none;}
|
|
558
|
+
.ndp-cell.wknd{color:var(--ndp-primary);}
|
|
552
559
|
.ndp-cell.today:not(.picked){
|
|
553
|
-
background
|
|
554
|
-
font-weight:700;color:var(--
|
|
560
|
+
background:var(--ndp-today-bg);
|
|
561
|
+
font-weight:700;color:var(--ndp-primary);
|
|
555
562
|
}
|
|
556
563
|
.ndp-cell.picked{
|
|
557
|
-
background:var(--
|
|
564
|
+
background:var(--ndp-primary);color:#fff;font-weight:700;
|
|
558
565
|
box-shadow:0 3px 10px rgba(192,57,43,.35);
|
|
559
566
|
}
|
|
560
567
|
.ndp-cell:hover:not(.overflow):not(.picked){
|
|
561
|
-
background:var(--
|
|
568
|
+
background:var(--ndp-primary-soft);color:var(--ndp-primary);
|
|
562
569
|
}
|
|
563
570
|
|
|
564
571
|
/* Footer */
|
|
565
572
|
.ndp-ft{
|
|
566
573
|
padding:9px 12px 12px;
|
|
567
|
-
border-top:1px solid var(--
|
|
574
|
+
border-top:1px solid var(--ndp-border);
|
|
568
575
|
display:flex;align-items:center;justify-content:space-between;gap:8px;
|
|
569
576
|
}
|
|
570
|
-
.ndp-ad{font-size:12px;color:var(--
|
|
577
|
+
.ndp-ad{font-size:12px;color:var(--ndp-text-muted);}
|
|
571
578
|
.ndp-ad b{color:var(--tx);}
|
|
572
579
|
.ndp-today-btn{
|
|
573
580
|
font-size:12px;padding:5px 13px;
|
|
574
|
-
background:var(--
|
|
581
|
+
background:var(--ndp-controls-bg);color:#9A7000;
|
|
575
582
|
border:1px solid #F0D090;border-radius:8px;
|
|
576
583
|
cursor:pointer;font-family:'DM Sans',sans-serif;font-weight:600;
|
|
577
584
|
transition:background .15s;white-space:nowrap;
|
|
578
585
|
}
|
|
579
586
|
.ndp-today-btn:hover{background:#FDEECA;}
|
|
580
587
|
`;
|
|
581
|
-
let
|
|
582
|
-
function
|
|
583
|
-
if (!
|
|
588
|
+
let ge = !1;
|
|
589
|
+
function Ye() {
|
|
590
|
+
if (!ge && typeof document < "u") {
|
|
584
591
|
const n = document.createElement("style");
|
|
585
|
-
n.textContent =
|
|
592
|
+
n.textContent = Me, document.head.appendChild(n), ge = !0;
|
|
586
593
|
}
|
|
587
594
|
}
|
|
588
|
-
function
|
|
595
|
+
function Le({
|
|
589
596
|
value: n,
|
|
590
|
-
onChange:
|
|
597
|
+
onChange: l,
|
|
591
598
|
language: b = "np",
|
|
592
|
-
placeholder:
|
|
593
|
-
minYear:
|
|
594
|
-
maxYear: i = 2090
|
|
599
|
+
placeholder: c,
|
|
600
|
+
minYear: d = 2060,
|
|
601
|
+
maxYear: i = 2090,
|
|
602
|
+
className: x = "",
|
|
603
|
+
styles: a = {}
|
|
595
604
|
}) {
|
|
596
|
-
|
|
597
|
-
const
|
|
598
|
-
|
|
605
|
+
Ye();
|
|
606
|
+
const f = b !== "en", j = K(), [_, E] = C(!1), [S, v] = C(null), [M, R] = C(!1), [w, D] = C(!1), [g, N] = C(() => n?.year ?? K().year), [h, y] = C(() => n?.month ?? K().month), Y = ce(null), $ = ce(null);
|
|
607
|
+
de(() => {
|
|
599
608
|
const t = (m) => {
|
|
600
|
-
|
|
609
|
+
Y.current && !Y.current.contains(m.target) && (E(!1), R(!1), D(!1));
|
|
601
610
|
};
|
|
602
611
|
return document.addEventListener("mousedown", t), () => document.removeEventListener("mousedown", t);
|
|
603
|
-
}, []),
|
|
604
|
-
n && (N(n.year),
|
|
605
|
-
}, [n]),
|
|
606
|
-
if (
|
|
607
|
-
const t =
|
|
612
|
+
}, []), de(() => {
|
|
613
|
+
n && (N(n.year), y(n.month));
|
|
614
|
+
}, [n]), de(() => {
|
|
615
|
+
if (w && $.current) {
|
|
616
|
+
const t = $.current.querySelector(".sel");
|
|
608
617
|
t && t.scrollIntoView({ block: "center" });
|
|
609
618
|
}
|
|
610
|
-
}, [
|
|
611
|
-
const re =
|
|
619
|
+
}, [w]);
|
|
620
|
+
const re = _e((t) => {
|
|
612
621
|
if (!t) return;
|
|
613
|
-
|
|
614
|
-
}, [
|
|
615
|
-
|
|
622
|
+
l?.({ year: g, month: h, day: t }, U(g, h, t)), E(!1);
|
|
623
|
+
}, [g, h, l]), B = () => {
|
|
624
|
+
v("right"), setTimeout(() => v(null), 200), h === 1 ? (y(12), N((t) => t - 1)) : y((t) => t - 1);
|
|
625
|
+
}, ne = () => {
|
|
626
|
+
v("left"), setTimeout(() => v(null), 200), h === 12 ? (y(1), N((t) => t + 1)) : y((t) => t + 1);
|
|
616
627
|
}, te = () => {
|
|
617
|
-
y("left"), setTimeout(() => y(null), 200), h === 12 ? (k(1), N((t) => t + 1)) : k((t) => t + 1);
|
|
618
|
-
}, P = () => {
|
|
619
628
|
const t = K();
|
|
620
|
-
N(t.year),
|
|
621
|
-
},
|
|
622
|
-
day:
|
|
629
|
+
N(t.year), y(t.month), l?.(t, U(t.year, t.month, t.day)), E(!1);
|
|
630
|
+
}, A = me(g, h), O = De(g, h), oe = h === 1 ? 12 : h - 1, L = h === 1 ? g - 1 : g, q = me(L, oe), J = Array.from({ length: O }, (t, m) => ({
|
|
631
|
+
day: q - O + 1 + m,
|
|
623
632
|
overflow: "prev"
|
|
624
|
-
})),
|
|
633
|
+
})), H = Array.from({ length: A }, (t, m) => ({
|
|
625
634
|
day: m + 1,
|
|
626
635
|
overflow: null
|
|
627
|
-
})),
|
|
636
|
+
})), Z = 42 - (O + A), e = Array.from({ length: Z }, (t, m) => ({
|
|
628
637
|
day: m + 1,
|
|
629
638
|
overflow: "next"
|
|
630
|
-
})),
|
|
631
|
-
|
|
632
|
-
|
|
639
|
+
})), o = [...J, ...H, ...e], s = f ? he : xe, p = f ? Ae : Oe, T = s[h - 1], P = f ? G(g) : String(g), k = U(g, h, 1).toLocaleDateString("en-GB", { month: "short", year: "numeric" }), z = n ? f ? `${G(n.year)} ${he[n.month - 1]} ${G(n.day)}` : `${n.year} ${xe[n.month - 1]} ${n.day}` : "", se = f ? "मिति छान्नुहोस्" : "Select BS date", ie = n ? U(n.year, n.month, n.day) : null, be = Array.from({ length: i - d + 1 }, (t, m) => d + m), ve = {
|
|
640
|
+
...a.primary && { "--ndp-primary": a.primary },
|
|
641
|
+
...a.primarySoft && { "--ndp-primary-soft": a.primarySoft },
|
|
642
|
+
...a.background && { "--ndp-background": a.background },
|
|
643
|
+
...a.text && { "--ndp-text": a.text },
|
|
644
|
+
...a.textMuted && { "--ndp-text-muted": a.textMuted },
|
|
645
|
+
...a.border && { "--ndp-border": a.border },
|
|
646
|
+
...a.todayBg && { "--ndp-today-bg": a.todayBg },
|
|
647
|
+
...a.controlsBg && { "--ndp-controls-bg": a.controlsBg },
|
|
648
|
+
...a.radius && { "--ndp-radius": a.radius },
|
|
649
|
+
...a.shadow && { "--ndp-shadow": a.shadow }
|
|
650
|
+
};
|
|
651
|
+
return /* @__PURE__ */ r.jsxs("div", { className: `ndp${x ? ` ${x}` : ""}`, ref: Y, style: ve, children: [
|
|
652
|
+
/* @__PURE__ */ r.jsxs("div", { className: "ndp-wrap", onClick: () => E((t) => !t), children: [
|
|
633
653
|
/* @__PURE__ */ r.jsx(
|
|
634
654
|
"input",
|
|
635
655
|
{
|
|
636
656
|
readOnly: !0,
|
|
637
|
-
className: `ndp-input${
|
|
638
|
-
value:
|
|
639
|
-
placeholder:
|
|
657
|
+
className: `ndp-input${_ ? " open" : ""}`,
|
|
658
|
+
value: z,
|
|
659
|
+
placeholder: c ?? se
|
|
640
660
|
}
|
|
641
661
|
),
|
|
642
662
|
/* @__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: [
|
|
@@ -646,40 +666,40 @@ function Me({
|
|
|
646
666
|
/* @__PURE__ */ r.jsx("line", { x1: "3", y1: "10", x2: "21", y2: "10" })
|
|
647
667
|
] }) })
|
|
648
668
|
] }),
|
|
649
|
-
|
|
669
|
+
_ && /* @__PURE__ */ r.jsxs("div", { className: "ndp-popup", children: [
|
|
650
670
|
/* @__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:
|
|
652
|
-
/* @__PURE__ */ r.jsxs("div", { className: `ndp-hd-center${
|
|
653
|
-
/* @__PURE__ */ r.jsx("div", { className: "ndp-hd-month", children:
|
|
671
|
+
/* @__PURE__ */ r.jsx("button", { className: "ndp-nav", onClick: B, 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" }) }) }),
|
|
672
|
+
/* @__PURE__ */ r.jsxs("div", { className: `ndp-hd-center${S ? ` ndp-slide-${S}` : ""}`, children: [
|
|
673
|
+
/* @__PURE__ */ r.jsx("div", { className: "ndp-hd-month", children: T }),
|
|
654
674
|
/* @__PURE__ */ r.jsxs("div", { className: "ndp-hd-sub", children: [
|
|
655
|
-
|
|
675
|
+
P,
|
|
656
676
|
" BS · ",
|
|
657
|
-
|
|
677
|
+
k
|
|
658
678
|
] })
|
|
659
679
|
] }),
|
|
660
|
-
/* @__PURE__ */ r.jsx("button", { className: "ndp-nav", onClick:
|
|
680
|
+
/* @__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: "m9 18 6-6-6-6" }) }) })
|
|
661
681
|
] }) }),
|
|
662
682
|
/* @__PURE__ */ r.jsxs("div", { className: "ndp-controls", children: [
|
|
663
683
|
/* @__PURE__ */ r.jsxs("div", { className: "ndp-dd", children: [
|
|
664
684
|
/* @__PURE__ */ r.jsxs(
|
|
665
685
|
"button",
|
|
666
686
|
{
|
|
667
|
-
className: `ndp-dd-trigger${
|
|
687
|
+
className: `ndp-dd-trigger${M ? " active" : ""}`,
|
|
668
688
|
onClick: () => {
|
|
669
|
-
|
|
689
|
+
R((t) => !t), D(!1);
|
|
670
690
|
},
|
|
671
691
|
children: [
|
|
672
|
-
/* @__PURE__ */ r.jsx("span", { children:
|
|
692
|
+
/* @__PURE__ */ r.jsx("span", { children: T }),
|
|
673
693
|
/* @__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
694
|
]
|
|
675
695
|
}
|
|
676
696
|
),
|
|
677
|
-
|
|
697
|
+
M && /* @__PURE__ */ r.jsx("div", { className: "ndp-dd-panel", children: /* @__PURE__ */ r.jsx("div", { className: "ndp-dd-months", children: s.map((t, m) => /* @__PURE__ */ r.jsx(
|
|
678
698
|
"button",
|
|
679
699
|
{
|
|
680
700
|
className: `ndp-dd-month-item${h === m + 1 ? " sel" : ""}`,
|
|
681
701
|
onClick: () => {
|
|
682
|
-
|
|
702
|
+
v(m + 1 < h ? "right" : "left"), setTimeout(() => v(null), 200), y(m + 1), R(!1);
|
|
683
703
|
},
|
|
684
704
|
children: t
|
|
685
705
|
},
|
|
@@ -690,62 +710,62 @@ function Me({
|
|
|
690
710
|
/* @__PURE__ */ r.jsxs(
|
|
691
711
|
"button",
|
|
692
712
|
{
|
|
693
|
-
className: `ndp-dd-trigger${
|
|
713
|
+
className: `ndp-dd-trigger${w ? " active" : ""}`,
|
|
694
714
|
onClick: () => {
|
|
695
|
-
|
|
715
|
+
D((t) => !t), R(!1);
|
|
696
716
|
},
|
|
697
717
|
children: [
|
|
698
|
-
/* @__PURE__ */ r.jsx("span", { children:
|
|
718
|
+
/* @__PURE__ */ r.jsx("span", { children: P }),
|
|
699
719
|
/* @__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
720
|
]
|
|
701
721
|
}
|
|
702
722
|
),
|
|
703
|
-
|
|
723
|
+
w && /* @__PURE__ */ r.jsx("div", { className: "ndp-dd-panel", children: /* @__PURE__ */ r.jsx("div", { className: "ndp-dd-years", ref: $, children: be.map((t) => /* @__PURE__ */ r.jsx(
|
|
704
724
|
"button",
|
|
705
725
|
{
|
|
706
|
-
className: `ndp-dd-year-item${
|
|
726
|
+
className: `ndp-dd-year-item${g === t ? " sel" : ""}`,
|
|
707
727
|
onClick: () => {
|
|
708
|
-
N(t),
|
|
728
|
+
N(t), D(!1);
|
|
709
729
|
},
|
|
710
|
-
children:
|
|
730
|
+
children: f ? G(t) : t
|
|
711
731
|
},
|
|
712
732
|
t
|
|
713
733
|
)) }) })
|
|
714
734
|
] })
|
|
715
735
|
] }),
|
|
716
736
|
/* @__PURE__ */ r.jsxs("div", { className: "ndp-body", children: [
|
|
717
|
-
/* @__PURE__ */ r.jsx("div", { className: "ndp-wdays", children:
|
|
718
|
-
/* @__PURE__ */ r.jsx("div", { className: `ndp-grid${
|
|
719
|
-
const
|
|
720
|
-
let
|
|
721
|
-
return
|
|
737
|
+
/* @__PURE__ */ r.jsx("div", { className: "ndp-wdays", children: p.map((t, m) => /* @__PURE__ */ r.jsx("div", { className: "ndp-wday", children: t }, m)) }),
|
|
738
|
+
/* @__PURE__ */ r.jsx("div", { className: `ndp-grid${S ? ` ndp-slide-${S}` : ""}`, children: o.map(({ day: t, overflow: m }, le) => {
|
|
739
|
+
const ye = le % 7 === 6, F = m !== null, we = !F && t === j.day && h === j.month && g === j.year, ke = !F && n && t === n.day && h === n.month && g === n.year;
|
|
740
|
+
let I = "ndp-cell";
|
|
741
|
+
return F ? I += " overflow" : ye && (I += " wknd"), we && (I += " today"), ke && (I += " picked"), /* @__PURE__ */ r.jsx(
|
|
722
742
|
"button",
|
|
723
743
|
{
|
|
724
|
-
className:
|
|
725
|
-
disabled:
|
|
726
|
-
onClick: () => !
|
|
727
|
-
children:
|
|
744
|
+
className: I,
|
|
745
|
+
disabled: F,
|
|
746
|
+
onClick: () => !F && re(t),
|
|
747
|
+
children: f ? G(t) : t
|
|
728
748
|
},
|
|
729
|
-
|
|
749
|
+
le
|
|
730
750
|
);
|
|
731
751
|
}) })
|
|
732
752
|
] }),
|
|
733
753
|
/* @__PURE__ */ r.jsxs("div", { className: "ndp-ft", children: [
|
|
734
|
-
/* @__PURE__ */ r.jsx("span", { className: "ndp-ad", children:
|
|
754
|
+
/* @__PURE__ */ r.jsx("span", { className: "ndp-ad", children: ie ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
735
755
|
/* @__PURE__ */ r.jsx("b", { children: "AD:" }),
|
|
736
756
|
" ",
|
|
737
|
-
|
|
738
|
-
] }) : /* @__PURE__ */ r.jsx("span", { style: { color: "var(--
|
|
739
|
-
/* @__PURE__ */ r.jsx("button", { className: "ndp-today-btn", onClick:
|
|
757
|
+
Ce(ie)
|
|
758
|
+
] }) : /* @__PURE__ */ r.jsx("span", { style: { color: "var(--ndp-text-muted)", fontSize: 12 }, children: f ? "मिति छानिएको छैन" : "No date selected" }) }),
|
|
759
|
+
/* @__PURE__ */ r.jsx("button", { className: "ndp-today-btn", onClick: te, children: f ? "आज" : "Today" })
|
|
740
760
|
] })
|
|
741
761
|
] })
|
|
742
762
|
] });
|
|
743
763
|
}
|
|
744
764
|
export {
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
765
|
+
Le as NepaliDatePicker,
|
|
766
|
+
Re as adToBs,
|
|
767
|
+
U as bsToAd,
|
|
768
|
+
me as getDaysInBSMonth,
|
|
769
|
+
De as getFirstDayOfWeekBS,
|
|
750
770
|
K as getTodayBS
|
|
751
771
|
};
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(y,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],x):(y=typeof globalThis<"u"?globalThis:y||self,x(y.NepaliDatePicker={},y.React))})(this,(function(y,x){"use strict";var Z={exports:{}},B={};var ce;function ve(){if(ce)return B;ce=1;var n=Symbol.for("react.transitional.element"),c=Symbol.for("react.fragment");function v(l,d,i){var g=null;if(i!==void 0&&(g=""+i),d.key!==void 0&&(g=""+d.key),"key"in d){i={};for(var a in d)a!=="key"&&(i[a]=d[a])}else i=d;return d=i.ref,{$$typeof:n,type:l,key:g,ref:d!==void 0?d:null,props:i}}return B.Fragment=c,B.jsx=v,B.jsxs=v,B}var L={};var le;function ye(){return le||(le=1,process.env.NODE_ENV!=="production"&&(function(){function n(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ae?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case j:return"Fragment";case b:return"Profiler";case P:return"StrictMode";case V:return"Suspense";case G:return"SuspenseList";case oe: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 O:return"Portal";case h:return e.displayName||"Context";case R:return(e._context.displayName||"Context")+".Consumer";case k:var o=e.render;return e=e.displayName,e||(e=o.displayName||o.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case te:return o=e.displayName||null,o!==null?o:n(e.type)||"Memo";case U:o=e._payload,e=e._init;try{return n(e(o))}catch{}}return null}function c(e){return""+e}function v(e){try{c(e);var o=!1}catch{o=!0}if(o){o=console;var s=o.error,p=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return s.call(o,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",p),c(e)}}function l(e){if(e===j)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===U)return"<...>";try{var o=n(e);return o?"<"+o+">":"<...>"}catch{return"<...>"}}function d(){var e=C.A;return e===null?null:e.getOwner()}function i(){return Error("react-stack-top-frame")}function g(e){if(M.call(e,"key")){var o=Object.getOwnPropertyDescriptor(e,"key").get;if(o&&o.isReactWarning)return!1}return e.key!==void 0}function a(e,o){function s(){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))}s.isReactWarning=!0,Object.defineProperty(e,"key",{get:s,configurable:!0})}function u(){var e=n(this.type);return q[e]||(q[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,s,p,D,Y){var f=s.ref;return e={$$typeof:W,type:e,key:o,props:s,_owner:p},(f!==void 0?f:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:u}):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:D}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Y}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function E(e,o,s,p,D,Y){var f=o.children;if(f!==void 0)if(p)if(se(f)){for(p=0;p<f.length;p++)N(f[p]);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 N(f);if(M.call(o,"key")){f=n(e);var S=Object.keys(o).filter(function(ie){return ie!=="key"});p=0<S.length?"{key: someKey, "+S.join(": ..., ")+": ...}":"{key: someKey}",re[f+p]||(S=0<S.length?"{"+S.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,
|
|
6
|
+
<%s key={someKey} {...props} />`,p,f,S,f),re[f+p]=!0)}if(f=null,s!==void 0&&(v(s),f=""+s),g(o)&&(v(o.key),f=""+o.key),"key"in o){s={};for(var J in o)J!=="key"&&(s[J]=o[J])}else s=o;return f&&a(s,typeof e=="function"?e.displayName||e.name||"Unknown":e),_(e,f,s,d(),D,Y)}function N(e){T(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===U&&(e._payload.status==="fulfilled"?T(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function T(e){return typeof e=="object"&&e!==null&&e.$$typeof===W}var w=x,W=Symbol.for("react.transitional.element"),O=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),P=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),h=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),V=Symbol.for("react.suspense"),G=Symbol.for("react.suspense_list"),te=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),oe=Symbol.for("react.activity"),ae=Symbol.for("react.client.reference"),C=w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,M=Object.prototype.hasOwnProperty,se=Array.isArray,X=console.createTask?console.createTask:function(){return null};w={react_stack_bottom_frame:function(e){return e()}};var K,q={},ee=w.react_stack_bottom_frame.bind(w,i)(),de=X(l(i)),re={};L.Fragment=j,L.jsx=function(e,o,s){var p=1e4>C.recentlyCreatedOwnerStacks++;return E(e,o,s,!1,p?Error("react-stack-top-frame"):ee,p?X(l(e)):de)},L.jsxs=function(e,o,s){var p=1e4>C.recentlyCreatedOwnerStacks++;return E(e,o,s,!0,p?Error("react-stack-top-frame"):ee,p?X(l(e)):de)}})()),L}var pe;function we(){return pe||(pe=1,process.env.NODE_ENV==="production"?Z.exports=ve():Z.exports=ye()),Z.exports}var r=we();const F={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]},Q=new Date(1943,3,14);function ke(n,c,v){let l=0;for(let i=2e3;i<n;i++){const g=F[i];g&&(l+=g.reduce((a,u)=>a+u,0))}const d=F[n]||[];for(let i=0;i<c-1;i++)l+=d[i]||30;return l+v-1}function A(n,c,v){const l=new Date(Q);return l.setDate(l.getDate()+ke(n,c,v)),l}function fe(n){const c=new Date(n.getFullYear(),n.getMonth(),n.getDate()),v=new Date(Q.getFullYear(),Q.getMonth(),Q.getDate());let l=Math.round((c-v)/864e5),d=2e3;for(;d<=2090;){const a=F[d],u=a?a.reduce((_,E)=>_+E,0):365;if(l<u)break;l-=u,d++}const i=F[d]||[];let g=1;for(let a=0;a<12;a++){const u=i[a]||30;if(l<u){g=a+1;break}l-=u,a===11&&(g=12)}return{year:d,month:g,day:l+1}}function z(){return fe(new Date)}function ne(n,c){return(F[n]||[])[c-1]||30}function ue(n,c){return A(n,c,1).getDay()}const me=["बैशाख","जेठ","असार","श्रावण","भाद्र","असोज","कार्तिक","मङ्सिर","पुष","माघ","फागुन","चैत्र"],he=["Baisakh","Jestha","Ashadh","Shrawan","Bhadra","Ashwin","Kartik","Mangsir","Poush","Magh","Falgun","Chaitra"],je=["आइत","सोम","मङ्गल","बुध","बिही","शुक्र","शनि"],Se=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],_e=["०","१","२","३","४","५","६","७","८","९"],I=n=>String(n).split("").map(c=>_e[+c]??c).join(""),Ee=n=>n?n.toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"}):"",Ne=`
|
|
7
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
8
|
|
|
9
9
|
.ndp{
|
|
10
|
-
--
|
|
11
|
-
--
|
|
12
|
-
--
|
|
10
|
+
--ndp-primary: #C0392B;
|
|
11
|
+
--ndp-primary-soft: #fff0ee;
|
|
12
|
+
--ndp-controls-bg: #fffaee;
|
|
13
|
+
--ndp-background: #fff;
|
|
14
|
+
--ndp-text: #1A1208;
|
|
15
|
+
--ndp-text-muted: #8C7B6B;
|
|
16
|
+
--ndp-border: #E8DED0;
|
|
17
|
+
--ndp-today-bg: #fde8e6;
|
|
18
|
+
--ndp-radius: 16px;
|
|
19
|
+
--ndp-shadow: 0 24px 64px rgba(0,0,0,0.13),0 4px 16px rgba(0,0,0,0.07);
|
|
13
20
|
font-family:'DM Sans',sans-serif;
|
|
14
21
|
position:relative; display:inline-block;
|
|
15
22
|
}
|
|
@@ -20,24 +27,24 @@ React keys must be passed directly to JSX without using spread:
|
|
|
20
27
|
.ndp-input{
|
|
21
28
|
width:100%; min-width:270px;
|
|
22
29
|
padding:13px 48px 13px 17px;
|
|
23
|
-
border:2px solid var(--
|
|
24
|
-
background:var(--
|
|
30
|
+
border:2px solid var(--ndp-border); border-radius:13px;
|
|
31
|
+
background:var(--ndp-background); color:var(--tx);
|
|
25
32
|
font-family:'DM Sans',sans-serif; font-size:15px;
|
|
26
33
|
cursor:pointer; outline:none;
|
|
27
34
|
transition:border-color .2s,box-shadow .2s;
|
|
28
35
|
caret-color:transparent;
|
|
29
36
|
}
|
|
30
|
-
.ndp-input::placeholder{color:var(--
|
|
31
|
-
.ndp-input.open{border-color:var(--
|
|
32
|
-
.ndp-icon{position:absolute;right:14px;top:50%;transform:translateY(-50%);pointer-events:none;color:var(--
|
|
33
|
-
.ndp-input.open ~ .ndp-icon{color:var(--
|
|
37
|
+
.ndp-input::placeholder{color:var(--ndp-text-muted);}
|
|
38
|
+
.ndp-input.open{border-color:var(--ndp-primary);box-shadow:0 0 0 4px rgba(192,57,43,.11);}
|
|
39
|
+
.ndp-icon{position:absolute;right:14px;top:50%;transform:translateY(-50%);pointer-events:none;color:var(--ndp-text-muted);transition:color .2s;}
|
|
40
|
+
.ndp-input.open ~ .ndp-icon{color:var(--ndp-primary);}
|
|
34
41
|
|
|
35
42
|
/* Popup */
|
|
36
43
|
.ndp-popup{
|
|
37
44
|
position:absolute; top:calc(100% + 9px); left:0; z-index:9999;
|
|
38
45
|
width:336px;
|
|
39
|
-
background:var(--
|
|
40
|
-
box-shadow:var(--sh); border:1px solid var(--
|
|
46
|
+
background:var(--ndp-background); border-radius:var(--r);
|
|
47
|
+
box-shadow:var(--sh); border:1px solid var(--ndp-border);
|
|
41
48
|
overflow:hidden;
|
|
42
49
|
animation:ndp-pop .18s cubic-bezier(.34,1.56,.64,1);
|
|
43
50
|
transform-origin:top left;
|
|
@@ -49,7 +56,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
49
56
|
.ndp-slide-right{animation:ndp-slide-right .2s cubic-bezier(.25,.8,.25,1);}
|
|
50
57
|
|
|
51
58
|
/* Header */
|
|
52
|
-
.ndp-hd{background:var(--
|
|
59
|
+
.ndp-hd{background:var(--ndp-primary);padding:14px;color:#fff;}
|
|
53
60
|
.ndp-hd-row{display:flex;align-items:center;justify-content:space-between;}
|
|
54
61
|
.ndp-nav{
|
|
55
62
|
width:32px;height:32px;display:flex;align-items:center;justify-content:center;
|
|
@@ -64,13 +71,13 @@ React keys must be passed directly to JSX without using spread:
|
|
|
64
71
|
/* Custom dropdowns */
|
|
65
72
|
.ndp-controls{
|
|
66
73
|
display:flex;gap:6px;padding:9px 12px;
|
|
67
|
-
background:var(--
|
|
74
|
+
background:var(--ndp-controls-bg);border-bottom:1px solid var(--ndp-border);
|
|
68
75
|
position:relative;z-index:10;
|
|
69
76
|
}
|
|
70
77
|
.ndp-dd{position:relative;flex:1;}
|
|
71
78
|
.ndp-dd-trigger{
|
|
72
79
|
width:100%;padding:6px 28px 6px 10px;
|
|
73
|
-
border:1px solid var(--
|
|
80
|
+
border:1px solid var(--ndp-border);border-radius:8px;
|
|
74
81
|
background:#fff;color:var(--tx);
|
|
75
82
|
font-family:'Noto Sans Devanagari',sans-serif;font-size:13px;font-weight:500;
|
|
76
83
|
cursor:pointer;outline:none;
|
|
@@ -80,17 +87,17 @@ React keys must be passed directly to JSX without using spread:
|
|
|
80
87
|
position:relative;
|
|
81
88
|
}
|
|
82
89
|
.ndp-dd-trigger:hover{border-color:#c8b8a8;}
|
|
83
|
-
.ndp-dd-trigger.active{border-color:var(--
|
|
90
|
+
.ndp-dd-trigger.active{border-color:var(--ndp-primary);box-shadow:0 0 0 3px rgba(192,57,43,.10);}
|
|
84
91
|
.ndp-dd-arrow{
|
|
85
92
|
position:absolute;right:8px;top:50%;transform:translateY(-50%);
|
|
86
|
-
pointer-events:none;color:var(--
|
|
93
|
+
pointer-events:none;color:var(--ndp-text-muted);transition:transform .18s;flex-shrink:0;
|
|
87
94
|
}
|
|
88
95
|
.ndp-dd-trigger.active .ndp-dd-arrow{transform:translateY(-50%) rotate(180deg);}
|
|
89
96
|
|
|
90
97
|
.ndp-dd-panel{
|
|
91
98
|
position:absolute;top:calc(100% + 5px);left:0;
|
|
92
99
|
min-width:100%;
|
|
93
|
-
background:#fff;border:1px solid var(--
|
|
100
|
+
background:#fff;border:1px solid var(--ndp-border);border-radius:10px;
|
|
94
101
|
box-shadow:0 8px 28px rgba(0,0,0,0.13);
|
|
95
102
|
z-index:999;overflow:hidden;
|
|
96
103
|
animation:ndp-dd-in .15s cubic-bezier(.25,.8,.25,1);
|
|
@@ -110,16 +117,16 @@ React keys must be passed directly to JSX without using spread:
|
|
|
110
117
|
transition:background .12s,color .12s;
|
|
111
118
|
white-space:nowrap;
|
|
112
119
|
}
|
|
113
|
-
.ndp-dd-month-item:hover{background:var(--
|
|
114
|
-
.ndp-dd-month-item.sel{background:var(--
|
|
120
|
+
.ndp-dd-month-item:hover{background:var(--ndp-primary-soft);color:var(--ndp-primary);}
|
|
121
|
+
.ndp-dd-month-item.sel{background:var(--ndp-primary);color:#fff;font-weight:700;}
|
|
115
122
|
|
|
116
123
|
/* Year panel: scrollable list */
|
|
117
124
|
.ndp-dd-years{
|
|
118
125
|
max-height:180px;overflow-y:auto;padding:5px;
|
|
119
|
-
scrollbar-width:thin;scrollbar-color:var(--
|
|
126
|
+
scrollbar-width:thin;scrollbar-color:var(--ndp-border) transparent;
|
|
120
127
|
}
|
|
121
128
|
.ndp-dd-years::-webkit-scrollbar{width:4px;}
|
|
122
|
-
.ndp-dd-years::-webkit-scrollbar-thumb{background:var(--
|
|
129
|
+
.ndp-dd-years::-webkit-scrollbar-thumb{background:var(--ndp-border);border-radius:4px;}
|
|
123
130
|
.ndp-dd-year-item{
|
|
124
131
|
padding:7px 14px;border-radius:7px;cursor:pointer;border:none;background:transparent;
|
|
125
132
|
font-family:'DM Sans',sans-serif;font-size:13px;font-weight:500;color:var(--tx);
|
|
@@ -127,18 +134,18 @@ React keys must be passed directly to JSX without using spread:
|
|
|
127
134
|
transition:background .12s,color .12s;
|
|
128
135
|
display:block;
|
|
129
136
|
}
|
|
130
|
-
.ndp-dd-year-item:hover{background:var(--
|
|
131
|
-
.ndp-dd-year-item.sel{background:var(--
|
|
137
|
+
.ndp-dd-year-item:hover{background:var(--ndp-primary-soft);color:var(--ndp-primary);}
|
|
138
|
+
.ndp-dd-year-item.sel{background:var(--ndp-primary);color:#fff;font-weight:700;}
|
|
132
139
|
|
|
133
140
|
/* Grid — FIXED 6 rows so height never changes between months */
|
|
134
141
|
.ndp-body{padding:10px 10px 6px;}
|
|
135
142
|
.ndp-wdays{display:grid;grid-template-columns:repeat(7,1fr);margin-bottom:4px;}
|
|
136
143
|
.ndp-wday{
|
|
137
144
|
text-align:center;font-size:10.5px;font-weight:600;
|
|
138
|
-
letter-spacing:.04em;color:var(--
|
|
145
|
+
letter-spacing:.04em;color:var(--ndp-text-muted);padding:3px 0;
|
|
139
146
|
font-family:'Noto Sans Devanagari',sans-serif;
|
|
140
147
|
}
|
|
141
|
-
.ndp-wday:last-child{color:var(--
|
|
148
|
+
.ndp-wday:last-child{color:var(--ndp-primary);}
|
|
142
149
|
|
|
143
150
|
.ndp-grid{
|
|
144
151
|
display:grid;
|
|
@@ -155,34 +162,34 @@ React keys must be passed directly to JSX without using spread:
|
|
|
155
162
|
font-weight:500;width:100%;
|
|
156
163
|
}
|
|
157
164
|
.ndp-cell.blank{cursor:default;pointer-events:none;}
|
|
158
|
-
.ndp-cell.overflow{color:var(--
|
|
159
|
-
.ndp-cell.wknd{color:var(--
|
|
165
|
+
.ndp-cell.overflow{color:var(--ndp-border);cursor:default;pointer-events:none;}
|
|
166
|
+
.ndp-cell.wknd{color:var(--ndp-primary);}
|
|
160
167
|
.ndp-cell.today:not(.picked){
|
|
161
|
-
background
|
|
162
|
-
font-weight:700;color:var(--
|
|
168
|
+
background:var(--ndp-today-bg);
|
|
169
|
+
font-weight:700;color:var(--ndp-primary);
|
|
163
170
|
}
|
|
164
171
|
.ndp-cell.picked{
|
|
165
|
-
background:var(--
|
|
172
|
+
background:var(--ndp-primary);color:#fff;font-weight:700;
|
|
166
173
|
box-shadow:0 3px 10px rgba(192,57,43,.35);
|
|
167
174
|
}
|
|
168
175
|
.ndp-cell:hover:not(.overflow):not(.picked){
|
|
169
|
-
background:var(--
|
|
176
|
+
background:var(--ndp-primary-soft);color:var(--ndp-primary);
|
|
170
177
|
}
|
|
171
178
|
|
|
172
179
|
/* Footer */
|
|
173
180
|
.ndp-ft{
|
|
174
181
|
padding:9px 12px 12px;
|
|
175
|
-
border-top:1px solid var(--
|
|
182
|
+
border-top:1px solid var(--ndp-border);
|
|
176
183
|
display:flex;align-items:center;justify-content:space-between;gap:8px;
|
|
177
184
|
}
|
|
178
|
-
.ndp-ad{font-size:12px;color:var(--
|
|
185
|
+
.ndp-ad{font-size:12px;color:var(--ndp-text-muted);}
|
|
179
186
|
.ndp-ad b{color:var(--tx);}
|
|
180
187
|
.ndp-today-btn{
|
|
181
188
|
font-size:12px;padding:5px 13px;
|
|
182
|
-
background:var(--
|
|
189
|
+
background:var(--ndp-controls-bg);color:#9A7000;
|
|
183
190
|
border:1px solid #F0D090;border-radius:8px;
|
|
184
191
|
cursor:pointer;font-family:'DM Sans',sans-serif;font-weight:600;
|
|
185
192
|
transition:background .15s;white-space:nowrap;
|
|
186
193
|
}
|
|
187
194
|
.ndp-today-btn:hover{background:#FDEECA;}
|
|
188
|
-
`;let xe=!1;function
|
|
195
|
+
`;let xe=!1;function Te(){if(!xe&&typeof document<"u"){const n=document.createElement("style");n.textContent=Ne,document.head.appendChild(n),xe=!0}}function Re({value:n,onChange:c,language:v="np",placeholder:l,minYear:d=2060,maxYear:i=2090,className:g="",styles:a={}}){Te();const u=v!=="en",_=z(),[E,N]=x.useState(!1),[T,w]=x.useState(null),[W,O]=x.useState(!1),[j,P]=x.useState(!1),[b,R]=x.useState(()=>n?.year??z().year),[h,k]=x.useState(()=>n?.month??z().month),V=x.useRef(null),G=x.useRef(null);x.useEffect(()=>{const t=m=>{V.current&&!V.current.contains(m.target)&&(N(!1),O(!1),P(!1))};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[]),x.useEffect(()=>{n&&(R(n.year),k(n.month))},[n]),x.useEffect(()=>{if(j&&G.current){const t=G.current.querySelector(".sel");t&&t.scrollIntoView({block:"center"})}},[j]);const te=x.useCallback(t=>{if(!t)return;c?.({year:b,month:h,day:t},A(b,h,t)),N(!1)},[b,h,c]),U=()=>{w("right"),setTimeout(()=>w(null),200),h===1?(k(12),R(t=>t-1)):k(t=>t-1)},oe=()=>{w("left"),setTimeout(()=>w(null),200),h===12?(k(1),R(t=>t+1)):k(t=>t+1)},ae=()=>{const t=z();R(t.year),k(t.month),c?.(t,A(t.year,t.month,t.day)),N(!1)},C=ne(b,h),M=ue(b,h),se=h===1?12:h-1,X=h===1?b-1:b,K=ne(X,se),q=Array.from({length:M},(t,m)=>({day:K-M+1+m,overflow:"prev"})),ee=Array.from({length:C},(t,m)=>({day:m+1,overflow:null})),re=42-(M+C),e=Array.from({length:re},(t,m)=>({day:m+1,overflow:"next"})),o=[...q,...ee,...e],s=u?me:he,p=u?je:Se,D=s[h-1],Y=u?I(b):String(b),S=A(b,h,1).toLocaleDateString("en-GB",{month:"short",year:"numeric"}),J=n?u?`${I(n.year)} ${me[n.month-1]} ${I(n.day)}`:`${n.year} ${he[n.month-1]} ${n.day}`:"",ie=u?"मिति छान्नुहोस्":"Select BS date",ge=n?A(n.year,n.month,n.day):null,De=Array.from({length:i-d+1},(t,m)=>d+m),Ae={...a.primary&&{"--ndp-primary":a.primary},...a.primarySoft&&{"--ndp-primary-soft":a.primarySoft},...a.background&&{"--ndp-background":a.background},...a.text&&{"--ndp-text":a.text},...a.textMuted&&{"--ndp-text-muted":a.textMuted},...a.border&&{"--ndp-border":a.border},...a.todayBg&&{"--ndp-today-bg":a.todayBg},...a.controlsBg&&{"--ndp-controls-bg":a.controlsBg},...a.radius&&{"--ndp-radius":a.radius},...a.shadow&&{"--ndp-shadow":a.shadow}};return r.jsxs("div",{className:`ndp${g?` ${g}`:""}`,ref:V,style:Ae,children:[r.jsxs("div",{className:"ndp-wrap",onClick:()=>N(t=>!t),children:[r.jsx("input",{readOnly:!0,className:`ndp-input${E?" open":""}`,value:J,placeholder:l??ie}),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"})]})})]}),E&&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:U,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${T?` ndp-slide-${T}`:""}`,children:[r.jsx("div",{className:"ndp-hd-month",children:D}),r.jsxs("div",{className:"ndp-hd-sub",children:[Y," BS · ",S]})]}),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:"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${W?" active":""}`,onClick:()=>{O(t=>!t),P(!1)},children:[r.jsx("span",{children:D}),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"})})})]}),W&&r.jsx("div",{className:"ndp-dd-panel",children:r.jsx("div",{className:"ndp-dd-months",children:s.map((t,m)=>r.jsx("button",{className:`ndp-dd-month-item${h===m+1?" sel":""}`,onClick:()=>{w(m+1<h?"right":"left"),setTimeout(()=>w(null),200),k(m+1),O(!1)},children:t},m))})})]}),r.jsxs("div",{className:"ndp-dd",children:[r.jsxs("button",{className:`ndp-dd-trigger${j?" active":""}`,onClick:()=>{P(t=>!t),O(!1)},children:[r.jsx("span",{children:Y}),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"})})})]}),j&&r.jsx("div",{className:"ndp-dd-panel",children:r.jsx("div",{className:"ndp-dd-years",ref:G,children:De.map(t=>r.jsx("button",{className:`ndp-dd-year-item${b===t?" sel":""}`,onClick:()=>{R(t),P(!1)},children:u?I(t):t},t))})})]})]}),r.jsxs("div",{className:"ndp-body",children:[r.jsx("div",{className:"ndp-wdays",children:p.map((t,m)=>r.jsx("div",{className:"ndp-wday",children:t},m))}),r.jsx("div",{className:`ndp-grid${T?` ndp-slide-${T}`:""}`,children:o.map(({day:t,overflow:m},be)=>{const Oe=be%7===6,H=m!==null,Pe=!H&&t===_.day&&h===_.month&&b===_.year,Ce=!H&&n&&t===n.day&&h===n.month&&b===n.year;let $="ndp-cell";return H?$+=" overflow":Oe&&($+=" wknd"),Pe&&($+=" today"),Ce&&($+=" picked"),r.jsx("button",{className:$,disabled:H,onClick:()=>!H&&te(t),children:u?I(t):t},be)})})]}),r.jsxs("div",{className:"ndp-ft",children:[r.jsx("span",{className:"ndp-ad",children:ge?r.jsxs(r.Fragment,{children:[r.jsx("b",{children:"AD:"})," ",Ee(ge)]}):r.jsx("span",{style:{color:"var(--ndp-text-muted)",fontSize:12},children:u?"मिति छानिएको छैन":"No date selected"})}),r.jsx("button",{className:"ndp-today-btn",onClick:ae,children:u?"आज":"Today"})]})]})]})}y.NepaliDatePicker=Re,y.adToBs=fe,y.bsToAd=A,y.getDaysInBSMonth=ne,y.getFirstDayOfWeekBS=ue,y.getTodayBS=z,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@himal_bhattarai/nepali-datepicker",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Nepali Bikram Sambat (BS) date picker React component with BS↔AD conversion",
|
|
5
5
|
"main": "./dist/nepali-datepicker.umd.js",
|
|
6
6
|
"module": "./dist/nepali-datepicker.es.js",
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
"require": "./dist/nepali-datepicker.umd.js"
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
|
-
"files": [
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
14
16
|
"scripts": {
|
|
15
17
|
"build": "vite build",
|
|
16
18
|
"prepublishOnly": "npm run build"
|
|
@@ -24,8 +26,15 @@
|
|
|
24
26
|
"vite": "^5.0.0"
|
|
25
27
|
},
|
|
26
28
|
"keywords": [
|
|
27
|
-
"nepali",
|
|
28
|
-
"
|
|
29
|
+
"nepali",
|
|
30
|
+
"datepicker",
|
|
31
|
+
"bikram",
|
|
32
|
+
"sambat",
|
|
33
|
+
"bs",
|
|
34
|
+
"calendar",
|
|
35
|
+
"react",
|
|
36
|
+
"nepal",
|
|
37
|
+
"bs-date"
|
|
29
38
|
],
|
|
30
39
|
"license": "MIT"
|
|
31
|
-
}
|
|
40
|
+
}
|