@starasia/date 2.0.1 → 3.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/dist/date.es.js +186 -186
- package/dist/date.umd.js +39 -39
- package/package.json +6 -6
package/dist/date.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as $, jsx as
|
|
1
|
+
import { jsxs as $, jsx as i, Fragment as G } from "react/jsx-runtime";
|
|
2
2
|
import { useState as F, useRef as T, useEffect as D, forwardRef as j } from "react";
|
|
3
3
|
const S = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");
|
|
4
4
|
|
|
@@ -13,10 +13,10 @@ const S = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
|
|
|
13
13
|
--sa-date-radius: var(--sa-radii-md, 0.5rem);
|
|
14
14
|
--sa-date-radius-lg: var(--sa-radii-lg, 0.75rem);
|
|
15
15
|
--sa-date-bg: var(--sa-background-primary, #ffffff);
|
|
16
|
-
--sa-date-border-color:
|
|
17
|
-
--sa-date-border-disabled:
|
|
18
|
-
--sa-date-bg-disabled:
|
|
19
|
-
--sa-date-shadow: var(--sa-shadow-md, 0 4px 6px -1px
|
|
16
|
+
--sa-date-border-color: var(--sa-color-gray-alpha-a20, #78867f33);
|
|
17
|
+
--sa-date-border-disabled: var(--sa-color-gray-alpha-a20, #78867f33);
|
|
18
|
+
--sa-date-bg-disabled: var(--sa-color-gray-alpha-a10, #78867f1a);
|
|
19
|
+
--sa-date-shadow: var(--sa-shadow-md, 0 4px 6px -1px #0000001a, 0 2px 4px -2px #0000001a);
|
|
20
20
|
--sa-date-text-primary: var(--sa-color-gray-700, #6b6e76);
|
|
21
21
|
--sa-date-text-subtle: var(--sa-color-gray-500, #8c8f97);
|
|
22
22
|
--sa-date-text-muted: var(--sa-color-gray-300, #dddee1);
|
|
@@ -27,11 +27,11 @@ const S = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
|
|
|
27
27
|
--sa-date-border-error: var(--sa-color-error-500, #ff4d6d);
|
|
28
28
|
--sa-date-border-warning: var(--sa-color-warning-400, #ed9f30);
|
|
29
29
|
}
|
|
30
|
-
.
|
|
30
|
+
.sa-calendar-wrapper {
|
|
31
31
|
position: relative;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
.
|
|
34
|
+
.sa-calendar {
|
|
35
35
|
border-radius: var(--sa-date-radius);
|
|
36
36
|
border: var(--sa-border, 1px) solid var(--sa-date-bg);
|
|
37
37
|
background: var(--sa-date-bg);
|
|
@@ -45,7 +45,7 @@ const S = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
|
|
|
45
45
|
z-index: 999;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
.
|
|
48
|
+
.sa-calendar.sa-calendar-no-input {
|
|
49
49
|
position: relative !important;
|
|
50
50
|
margin-top: 0px;
|
|
51
51
|
|
|
@@ -59,7 +59,7 @@ const S = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
|
|
|
59
59
|
border-radius: 0;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
.
|
|
62
|
+
.sa-calendar-header {
|
|
63
63
|
display: flex;
|
|
64
64
|
flex-direction: row;
|
|
65
65
|
align-items: center;
|
|
@@ -67,25 +67,25 @@ const S = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
|
|
|
67
67
|
gap: var(--sa-spacing-xs, 4px);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
.
|
|
70
|
+
.sa-calendar-days-name-preivew {
|
|
71
71
|
display: flex;
|
|
72
72
|
gap: var(--sa-spacing-sm, 8px);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
.
|
|
75
|
+
.sa-calendar-days-name-preivew p {
|
|
76
76
|
color: var(--sa-date-text-subtle);
|
|
77
77
|
font-size: var(--sa-font-size-md, 14px);
|
|
78
78
|
flex: 1;
|
|
79
79
|
display: grid;
|
|
80
80
|
place-content: center;
|
|
81
81
|
}
|
|
82
|
-
.
|
|
82
|
+
.sa-calendar-days-number-preivew {
|
|
83
83
|
display: grid;
|
|
84
84
|
grid-template-columns: repeat(7, 1fr);
|
|
85
85
|
gap: var(--sa-spacing-sm, 8px);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
.
|
|
88
|
+
.sa-calendar-days-number-preivew p {
|
|
89
89
|
font-size: var(--sa-font-size-md, 14px);
|
|
90
90
|
text-align: center;
|
|
91
91
|
width: 35px;
|
|
@@ -98,31 +98,31 @@ const S = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
|
|
|
98
98
|
border-radius: var(--sa-date-radius);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
.
|
|
101
|
+
.sa-calendar-days {
|
|
102
102
|
color: var(--sa-date-text-muted);
|
|
103
103
|
}
|
|
104
|
-
.
|
|
104
|
+
.sa-calendar-days-current {
|
|
105
105
|
color: var(--sa-date-text-primary);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
.
|
|
108
|
+
.sa-calendar-days-number-preivew p:hover {
|
|
109
109
|
background: var(--sa-date-brand-subtle);
|
|
110
110
|
color: var(--sa-date-brand-secondary);
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
.
|
|
113
|
+
.sa-calendar-days-active {
|
|
114
114
|
background: var(--sa-date-brand-secondary);
|
|
115
115
|
color: var(--sa-date-brand);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
/* MONTH STYLING */
|
|
119
|
-
.
|
|
119
|
+
.sa-calendar-months-preview {
|
|
120
120
|
display: grid;
|
|
121
121
|
grid-template-columns: repeat(3, 1fr);
|
|
122
122
|
row-gap: var(--sa-spacing-xs, 4px);
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
.
|
|
125
|
+
.sa-calendar-months-preview p {
|
|
126
126
|
width: 98px;
|
|
127
127
|
height: 48px;
|
|
128
128
|
display: grid;
|
|
@@ -131,23 +131,23 @@ const S = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
|
|
|
131
131
|
border-radius: var(--sa-date-radius);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
.
|
|
134
|
+
.sa-calendar-months-preview p:hover {
|
|
135
135
|
background: var(--sa-date-brand-subtle);
|
|
136
136
|
color: var(--sa-date-brand-secondary);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
.
|
|
139
|
+
.sa-calendar-months-active {
|
|
140
140
|
background: var(--sa-date-brand-secondary);
|
|
141
141
|
color: var(--sa-date-brand);
|
|
142
142
|
}
|
|
143
143
|
/* Year STYLING */
|
|
144
|
-
.
|
|
144
|
+
.sa-calendar-years-preview {
|
|
145
145
|
display: grid;
|
|
146
146
|
grid-template-columns: repeat(3, 1fr);
|
|
147
147
|
row-gap: var(--sa-spacing-xs, 4px);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
.
|
|
150
|
+
.sa-calendar-years-preview p {
|
|
151
151
|
width: 98px;
|
|
152
152
|
height: 48px;
|
|
153
153
|
display: grid;
|
|
@@ -156,19 +156,19 @@ const S = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
|
|
|
156
156
|
border-radius: var(--sa-date-radius);
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
.
|
|
159
|
+
.sa-calendar-years-preview p:hover {
|
|
160
160
|
background: var(--sa-date-brand-subtle);
|
|
161
161
|
color: var(--sa-date-brand-secondary);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
.
|
|
164
|
+
.sa-calendar-years-active {
|
|
165
165
|
background: var(--sa-date-brand-secondary);
|
|
166
166
|
color: var(--sa-date-brand);
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
/* INPUT */
|
|
170
170
|
|
|
171
|
-
.
|
|
171
|
+
.sa-calendar-input-container {
|
|
172
172
|
box-sizing: border-box;
|
|
173
173
|
overflow: hidden;
|
|
174
174
|
display: flex;
|
|
@@ -177,17 +177,17 @@ const S = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
|
|
|
177
177
|
cursor: pointer;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
.
|
|
180
|
+
.sa-calendar-input-container:has(input:focus) {
|
|
181
181
|
border-color: var(--sa-date-brand);
|
|
182
182
|
box-shadow: 0px 0px 0px 2px var(--sa-date-brand-subtle);
|
|
183
183
|
}
|
|
184
|
-
.
|
|
184
|
+
.sa-calendar-input-container:has(input:disabled) {
|
|
185
185
|
border-color: var(--sa-date-border-disabled);
|
|
186
186
|
background-color: var(--sa-date-bg-disabled);
|
|
187
187
|
pointer-events: none;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
-
.
|
|
190
|
+
.sa-calendar-input-outline {
|
|
191
191
|
border-color: var(--sa-date-border-color);
|
|
192
192
|
/* border-color: var(--sa-date-text-muted); */
|
|
193
193
|
background-color: transparent;
|
|
@@ -198,31 +198,31 @@ const S = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
|
|
|
198
198
|
/* padding-inline: var(--sa-spacing-3, 12px); */
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
.
|
|
201
|
+
.sa-calendar-input-container.sm {
|
|
202
202
|
height: var(--sa-h-8, 32px);
|
|
203
203
|
border-radius: var(--sa-date-radius);
|
|
204
204
|
font-size: var(--sa-font-size-sm, 12px);
|
|
205
205
|
padding-inline: var(--sa-spacing-sm, 8px);
|
|
206
206
|
}
|
|
207
|
-
.
|
|
207
|
+
.sa-calendar-input-container.md {
|
|
208
208
|
height: 38px;
|
|
209
209
|
border-radius: var(--sa-date-radius);
|
|
210
210
|
font-size: var(--sa-font-size-md, 14px);
|
|
211
211
|
padding-inline: var(--sa-spacing-3, 12px);
|
|
212
212
|
}
|
|
213
|
-
.
|
|
213
|
+
.sa-calendar-input-container.lg {
|
|
214
214
|
height: var(--sa-h-12, 48px);
|
|
215
215
|
border-radius: var(--sa-date-radius-lg);
|
|
216
216
|
font-size: var(--sa-font-size-lg, 16px);
|
|
217
217
|
padding-inline: var(--sa-spacing-3, 12px);
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
.
|
|
220
|
+
.sa-calendar-input-preview-container {
|
|
221
221
|
width: 100%;
|
|
222
222
|
position: relative;
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
.
|
|
225
|
+
.sa-calendar-input {
|
|
226
226
|
width: 100%;
|
|
227
227
|
box-sizing: border-box;
|
|
228
228
|
height: 100%;
|
|
@@ -234,24 +234,24 @@ const S = `@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wg
|
|
|
234
234
|
cursor: pointer;
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
.
|
|
237
|
+
.sa-calendar-input::placeholder {
|
|
238
238
|
color: var(--sa-date-placeholder);
|
|
239
239
|
font-weight: var(--sa-font-weight-normal, 300);
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
/* INPUT ICON */
|
|
243
|
-
.
|
|
243
|
+
.sa-calendar-input-container-icon-left {
|
|
244
244
|
display: flex;
|
|
245
245
|
}
|
|
246
|
-
.
|
|
246
|
+
.sa-calendar-input-container-icon-right {
|
|
247
247
|
display: flex;
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
.
|
|
250
|
+
.sa-calendar-input-container-error {
|
|
251
251
|
border-color: var(--sa-date-border-error) !important;
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
.
|
|
254
|
+
.sa-calendar-input-container-warning {
|
|
255
255
|
border-color: var(--sa-date-border-warning) !important;
|
|
256
256
|
}
|
|
257
257
|
`, J = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], N = [
|
|
@@ -289,7 +289,7 @@ function A(a) {
|
|
|
289
289
|
document.removeEventListener("click", o, !0);
|
|
290
290
|
}), []), { ref: s, isComponentVisible: e, setIsComponentVisible: t };
|
|
291
291
|
}
|
|
292
|
-
const z = "
|
|
292
|
+
const z = "sa-calendar-input-styles", q = (a) => {
|
|
293
293
|
if (!document.getElementById(z)) {
|
|
294
294
|
const e = document.createElement("style");
|
|
295
295
|
e.id = z, e.textContent = a, document.head.appendChild(e);
|
|
@@ -310,10 +310,10 @@ const E = (a) => {
|
|
|
310
310
|
return /* @__PURE__ */ $(
|
|
311
311
|
"div",
|
|
312
312
|
{
|
|
313
|
-
className: `
|
|
313
|
+
className: `sa-calendar-input-container sa-calendar-input-${s} sa-calendar-input-container-${t} ${e} `,
|
|
314
314
|
onClick: f,
|
|
315
315
|
children: [
|
|
316
|
-
/* @__PURE__ */
|
|
316
|
+
/* @__PURE__ */ i("div", { className: "sa-calendar-input-container-icon-left", children: /* @__PURE__ */ i(
|
|
317
317
|
"svg",
|
|
318
318
|
{
|
|
319
319
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -321,7 +321,7 @@ const E = (a) => {
|
|
|
321
321
|
height: E(e),
|
|
322
322
|
viewBox: "0 0 20 20",
|
|
323
323
|
fill: "none",
|
|
324
|
-
children: /* @__PURE__ */
|
|
324
|
+
children: /* @__PURE__ */ i(
|
|
325
325
|
"path",
|
|
326
326
|
{
|
|
327
327
|
d: "M12.5 2.08301V5.41634M7.50002 2.08301V5.41634M17.0688 9.58301H2.93113M17.0688 9.58301C16.8953 4.82698 15.1284 3.33301 10 3.33301C4.87165 3.33301 3.10469 4.82698 2.93113 9.58301M17.0688 9.58301C17.0786 9.85037 17.0834 10.128 17.0834 10.4163C17.0834 15.833 15.4167 17.4997 10 17.4997C4.58335 17.4997 2.91669 15.833 2.91669 10.4163C2.91669 10.128 2.92138 9.85037 2.93113 9.58301",
|
|
@@ -333,17 +333,17 @@ const E = (a) => {
|
|
|
333
333
|
)
|
|
334
334
|
}
|
|
335
335
|
) }),
|
|
336
|
-
/* @__PURE__ */
|
|
336
|
+
/* @__PURE__ */ i("div", { className: "sa-calendar-input-preview-container", children: /* @__PURE__ */ i(
|
|
337
337
|
"input",
|
|
338
338
|
{
|
|
339
|
-
className: "
|
|
339
|
+
className: "sa-calendar-input",
|
|
340
340
|
...o,
|
|
341
341
|
disabled: t === "disable" ? !0 : o.disabled,
|
|
342
342
|
value: o.value,
|
|
343
343
|
ref: g
|
|
344
344
|
}
|
|
345
345
|
) }),
|
|
346
|
-
/* @__PURE__ */
|
|
346
|
+
/* @__PURE__ */ i("div", { className: "sa-calendar-input-container-icon-right", children: /* @__PURE__ */ i(
|
|
347
347
|
"svg",
|
|
348
348
|
{
|
|
349
349
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -351,7 +351,7 @@ const E = (a) => {
|
|
|
351
351
|
height: E(e),
|
|
352
352
|
viewBox: "0 0 20 20",
|
|
353
353
|
fill: "none",
|
|
354
|
-
children: /* @__PURE__ */
|
|
354
|
+
children: /* @__PURE__ */ i(
|
|
355
355
|
"path",
|
|
356
356
|
{
|
|
357
357
|
d: "M3.33331 7.5L9.99998 14.1667L16.6666 7.5",
|
|
@@ -374,17 +374,17 @@ const E = (a) => {
|
|
|
374
374
|
onChange: o,
|
|
375
375
|
minDate: g,
|
|
376
376
|
maxDate: f,
|
|
377
|
-
input:
|
|
377
|
+
input: b
|
|
378
378
|
}) => {
|
|
379
379
|
var u, r, d;
|
|
380
380
|
let h = new Date(a.getFullYear(), a.getMonth(), 1), n = h.getDay(), w = [];
|
|
381
|
-
const
|
|
381
|
+
const v = a.getMonth();
|
|
382
382
|
for (let c = 0; c < 42; c++) {
|
|
383
383
|
c === 0 && n === 0 ? h.setDate(h.getDate() - 7) : c === 0 ? h.setDate(
|
|
384
384
|
h.getDate() + (c - n)
|
|
385
385
|
) : h.setDate(h.getDate() + 1);
|
|
386
386
|
let y = {
|
|
387
|
-
currentMonth: h.getMonth() ===
|
|
387
|
+
currentMonth: h.getMonth() === v,
|
|
388
388
|
date: new Date(h),
|
|
389
389
|
month: h.getMonth(),
|
|
390
390
|
number: h.getDate(),
|
|
@@ -397,31 +397,31 @@ const E = (a) => {
|
|
|
397
397
|
const x = (c) => {
|
|
398
398
|
e(c);
|
|
399
399
|
}, M = (c) => {
|
|
400
|
-
var
|
|
400
|
+
var l;
|
|
401
401
|
let y = { ...t };
|
|
402
402
|
if (y.from && y.to)
|
|
403
403
|
y = { from: c, to: null };
|
|
404
404
|
else {
|
|
405
|
-
const p = ((
|
|
405
|
+
const p = ((l = y.from) == null ? void 0 : l.getTime()) || 0;
|
|
406
406
|
c.getTime() > p ? y = { from: y.from, to: c } : y = { from: c, to: y.from };
|
|
407
407
|
}
|
|
408
408
|
s(y), o(y);
|
|
409
409
|
};
|
|
410
|
-
return /* @__PURE__ */ $("div", { className: "
|
|
411
|
-
/* @__PURE__ */
|
|
412
|
-
/* @__PURE__ */
|
|
410
|
+
return /* @__PURE__ */ $("div", { className: "sa-calendar-days-preivew", children: [
|
|
411
|
+
/* @__PURE__ */ i("div", { className: "sa-calendar-days-name-preivew", children: J.map((c, y) => /* @__PURE__ */ i("p", { children: c }, y)) }),
|
|
412
|
+
/* @__PURE__ */ i("div", { className: "sa-calendar-days-number-preivew", children: w.map((c, y) => {
|
|
413
413
|
var C;
|
|
414
|
-
const
|
|
415
|
-
return /* @__PURE__ */
|
|
414
|
+
const l = c.date.getTime() > t.from.getTime() && c.date.getTime() < (((C = t.to) == null ? void 0 : C.getTime()) || t.from.getTime()), p = c.isDisabled;
|
|
415
|
+
return /* @__PURE__ */ i(
|
|
416
416
|
"p",
|
|
417
417
|
{
|
|
418
|
-
className: `${c.currentMonth ? "
|
|
418
|
+
className: `${c.currentMonth ? "sa-calendar-days-current" : "sa-calendar-days"} ${c.selected ? "sa-calendar-days-active" : ""}`,
|
|
419
419
|
style: {
|
|
420
|
-
backgroundColor:
|
|
420
|
+
backgroundColor: l ? "var(--sa-color-info-alpha-a10, #64b5f61a)" : "",
|
|
421
421
|
pointerEvents: p ? "none" : void 0,
|
|
422
422
|
cursor: p ? "not-allowed" : "pointer",
|
|
423
|
-
color: p ? "var(--sa-color-gray-400, #b7b9be)" :
|
|
424
|
-
...
|
|
423
|
+
color: p ? "var(--sa-color-gray-400, #b7b9be)" : l ? "var(--sa-color-gray-500, #8c8f97)" : "",
|
|
424
|
+
...b ? {} : { width: "100%" }
|
|
425
425
|
},
|
|
426
426
|
onClick: () => {
|
|
427
427
|
p || (x(c.date), M(c.date));
|
|
@@ -440,11 +440,11 @@ const E = (a) => {
|
|
|
440
440
|
dateRange: o,
|
|
441
441
|
setDateRange: g,
|
|
442
442
|
onChange: f,
|
|
443
|
-
minDate:
|
|
443
|
+
minDate: b,
|
|
444
444
|
maxDate: h,
|
|
445
445
|
input: n
|
|
446
446
|
}) => {
|
|
447
|
-
const w = o.from.getFullYear(),
|
|
447
|
+
const w = o.from.getFullYear(), v = a.getFullYear(), x = (u) => {
|
|
448
448
|
t ? (M(u), e(u)) : (s("days"), e(u));
|
|
449
449
|
}, M = (u) => {
|
|
450
450
|
var d;
|
|
@@ -457,22 +457,22 @@ const E = (a) => {
|
|
|
457
457
|
}
|
|
458
458
|
g(r), f(r);
|
|
459
459
|
};
|
|
460
|
-
return /* @__PURE__ */
|
|
461
|
-
var y,
|
|
462
|
-
const d = new Date(
|
|
463
|
-
return /* @__PURE__ */
|
|
460
|
+
return /* @__PURE__ */ i("div", { className: "sa-calendar-months-preview", children: N.map((u, r) => {
|
|
461
|
+
var y, l, p;
|
|
462
|
+
const d = new Date(v, r).getTime() > o.from.getTime() && new Date(v, r).getTime() < (((y = o.to) == null ? void 0 : y.getTime()) || o.from.getTime()), c = b && new Date(v, r) < b || h && new Date(v, r) > h;
|
|
463
|
+
return /* @__PURE__ */ i(
|
|
464
464
|
"p",
|
|
465
465
|
{
|
|
466
|
-
className: w ===
|
|
466
|
+
className: w === v && (r === ((l = o.from) == null ? void 0 : l.getMonth()) || r === ((p = o.to) == null ? void 0 : p.getMonth())) ? "sa-calendar-months-active" : "",
|
|
467
467
|
style: {
|
|
468
|
-
backgroundColor: d ? "
|
|
468
|
+
backgroundColor: d ? "var(--sa-color-info-alpha-a10, #64b5f61a)" : "",
|
|
469
469
|
pointerEvents: c ? "none" : void 0,
|
|
470
470
|
cursor: c ? "not-allowed" : "pointer",
|
|
471
471
|
color: c ? "var(--sa-color-gray-400, #b7b9be)" : d ? "var(--sa-color-gray-500, #8c8f97)" : "",
|
|
472
472
|
...n ? {} : { width: "100%" }
|
|
473
473
|
},
|
|
474
474
|
onClick: () => {
|
|
475
|
-
c || x(new Date(
|
|
475
|
+
c || x(new Date(v, r));
|
|
476
476
|
},
|
|
477
477
|
children: u.slice(0, 3)
|
|
478
478
|
},
|
|
@@ -490,54 +490,54 @@ const E = (a) => {
|
|
|
490
490
|
dateRange: o,
|
|
491
491
|
setDateRange: g,
|
|
492
492
|
onChange: f,
|
|
493
|
-
minDate:
|
|
493
|
+
minDate: b,
|
|
494
494
|
maxDate: h,
|
|
495
495
|
input: n
|
|
496
496
|
}) => {
|
|
497
497
|
var y;
|
|
498
498
|
let w = [];
|
|
499
|
-
const
|
|
500
|
-
for (let
|
|
501
|
-
const p = new Date(
|
|
499
|
+
const v = a.getFullYear(), { start: x, end: M } = B(v), u = o.from.getFullYear(), r = (y = o.to) == null ? void 0 : y.getFullYear();
|
|
500
|
+
for (let l = x; l < M; l++) {
|
|
501
|
+
const p = new Date(l, 0), C = (!b || p >= b) && (!h || p <= h), k = l === u || l === r, m = p > o.from && p < o.to;
|
|
502
502
|
w.push({
|
|
503
|
-
year:
|
|
503
|
+
year: l,
|
|
504
504
|
active: k && C,
|
|
505
505
|
highlight: m && C,
|
|
506
506
|
disabled: !C
|
|
507
507
|
});
|
|
508
508
|
}
|
|
509
|
-
const d = (
|
|
510
|
-
e ? (c(
|
|
511
|
-
}, c = (
|
|
509
|
+
const d = (l) => {
|
|
510
|
+
e ? (c(l), s(l)) : (s(l), t("months"));
|
|
511
|
+
}, c = (l) => {
|
|
512
512
|
var C;
|
|
513
513
|
let p = { ...o };
|
|
514
514
|
if (p.from && p.to)
|
|
515
|
-
p = { from:
|
|
515
|
+
p = { from: l, to: null };
|
|
516
516
|
else {
|
|
517
517
|
const k = ((C = p.from) == null ? void 0 : C.getTime()) || 0;
|
|
518
|
-
|
|
518
|
+
l.getTime() > k ? p = { from: p.from, to: l } : p = { from: l, to: p.from };
|
|
519
519
|
}
|
|
520
520
|
g(p), f(p);
|
|
521
521
|
};
|
|
522
|
-
return /* @__PURE__ */
|
|
522
|
+
return /* @__PURE__ */ i("div", { className: "sa-calendar-years-preview", children: w.map((l, p) => /* @__PURE__ */ i(
|
|
523
523
|
"p",
|
|
524
524
|
{
|
|
525
|
-
className: `${
|
|
525
|
+
className: `${l.active ? "sa-calendar-months-active" : ""} ${l.highlight ? "sa-calendar-months-highlight" : ""} ${l.disabled ? "sa-calendar-disabled" : ""}`,
|
|
526
526
|
onClick: () => {
|
|
527
|
-
|
|
527
|
+
l.disabled || d(new Date(l.year, 0));
|
|
528
528
|
},
|
|
529
529
|
style: {
|
|
530
|
-
backgroundColor:
|
|
531
|
-
color:
|
|
532
|
-
cursor:
|
|
533
|
-
pointerEvents:
|
|
530
|
+
backgroundColor: l.highlight ? "var(--sa-color-info-alpha-a10, #64b5f61a)" : "",
|
|
531
|
+
color: l.highlight ? "var(--sa-color-gray-500, #8c8f97)" : l.active ? "" : l.disabled ? "var(--sa-color-gray-400, #b7b9be)" : "",
|
|
532
|
+
cursor: l.disabled ? "not-allowed" : "pointer",
|
|
533
|
+
pointerEvents: l.disbled ? "none" : "all",
|
|
534
534
|
...n ? {} : { width: "100%" }
|
|
535
535
|
},
|
|
536
|
-
children:
|
|
536
|
+
children: l.year
|
|
537
537
|
},
|
|
538
538
|
p
|
|
539
539
|
)) });
|
|
540
|
-
}, P = ({ ...a }) => /* @__PURE__ */
|
|
540
|
+
}, P = ({ ...a }) => /* @__PURE__ */ i(
|
|
541
541
|
"svg",
|
|
542
542
|
{
|
|
543
543
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -546,7 +546,7 @@ const E = (a) => {
|
|
|
546
546
|
viewBox: "0 0 20 20",
|
|
547
547
|
fill: "none",
|
|
548
548
|
...a,
|
|
549
|
-
children: /* @__PURE__ */
|
|
549
|
+
children: /* @__PURE__ */ i(
|
|
550
550
|
"path",
|
|
551
551
|
{
|
|
552
552
|
d: "M12.5 3.33334L5.83337 10L12.5 16.6667",
|
|
@@ -557,7 +557,7 @@ const E = (a) => {
|
|
|
557
557
|
}
|
|
558
558
|
)
|
|
559
559
|
}
|
|
560
|
-
), R = ({ ...a }) => /* @__PURE__ */
|
|
560
|
+
), R = ({ ...a }) => /* @__PURE__ */ i(
|
|
561
561
|
"svg",
|
|
562
562
|
{
|
|
563
563
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -566,7 +566,7 @@ const E = (a) => {
|
|
|
566
566
|
viewBox: "0 0 20 20",
|
|
567
567
|
fill: "none",
|
|
568
568
|
...a,
|
|
569
|
-
children: /* @__PURE__ */
|
|
569
|
+
children: /* @__PURE__ */ i(
|
|
570
570
|
"path",
|
|
571
571
|
{
|
|
572
572
|
d: "M7.5 16.6667L14.1667 10L7.5 3.33334",
|
|
@@ -596,7 +596,7 @@ const E = (a) => {
|
|
|
596
596
|
return;
|
|
597
597
|
}
|
|
598
598
|
o((n) => new Date(n.getFullYear(), n.getMonth() + 1));
|
|
599
|
-
},
|
|
599
|
+
}, b = () => {
|
|
600
600
|
if (e === "years") {
|
|
601
601
|
o((n) => new Date(n.getFullYear() - 10, 0));
|
|
602
602
|
return;
|
|
@@ -612,9 +612,9 @@ const E = (a) => {
|
|
|
612
612
|
)
|
|
613
613
|
);
|
|
614
614
|
};
|
|
615
|
-
return /* @__PURE__ */ $("div", { className: "
|
|
616
|
-
/* @__PURE__ */
|
|
617
|
-
/* @__PURE__ */
|
|
615
|
+
return /* @__PURE__ */ $("div", { className: "sa-calendar-header", children: [
|
|
616
|
+
/* @__PURE__ */ i(P, { onClick: () => b() }),
|
|
617
|
+
/* @__PURE__ */ i("div", { style: { cursor: "pointer" }, onClick: g, children: (() => {
|
|
618
618
|
if (e === "days")
|
|
619
619
|
return `${N[s.getMonth()]} ${s.getFullYear()}`;
|
|
620
620
|
if (e === "months")
|
|
@@ -622,14 +622,14 @@ const E = (a) => {
|
|
|
622
622
|
if (e === "years")
|
|
623
623
|
return `${B(s.getFullYear()).start} ~ ${B(s.getFullYear()).end}`;
|
|
624
624
|
})() }),
|
|
625
|
-
/* @__PURE__ */
|
|
625
|
+
/* @__PURE__ */ i(R, { onClick: () => f() })
|
|
626
626
|
] });
|
|
627
627
|
};
|
|
628
628
|
function L(a) {
|
|
629
629
|
const e = new Date(a), t = e.getFullYear(), s = e.getMonth();
|
|
630
630
|
return `${e.getDate().toString().padStart(2, "0")} ${U[s]} ${t}`;
|
|
631
631
|
}
|
|
632
|
-
const W = "
|
|
632
|
+
const W = "sa-calendar-styles", ee = (a) => {
|
|
633
633
|
if (!document.getElementById(W)) {
|
|
634
634
|
const e = document.createElement("style");
|
|
635
635
|
e.id = W, e.textContent = a, document.head.appendChild(e);
|
|
@@ -645,11 +645,11 @@ const ne = j(
|
|
|
645
645
|
disabled: o,
|
|
646
646
|
minDate: g,
|
|
647
647
|
maxDate: f,
|
|
648
|
-
placeholder:
|
|
648
|
+
placeholder: b,
|
|
649
649
|
size: h,
|
|
650
650
|
status: n
|
|
651
651
|
}, w) => {
|
|
652
|
-
const { ref:
|
|
652
|
+
const { ref: v, isComponentVisible: x, setIsComponentVisible: M } = A(!1), u = T(null), [r, d] = F("days"), [c, y] = F(/* @__PURE__ */ new Date()), [l, p] = F({
|
|
653
653
|
from: (a == null ? void 0 : a.from) || /* @__PURE__ */ new Date(),
|
|
654
654
|
to: (a == null ? void 0 : a.to) || /* @__PURE__ */ new Date()
|
|
655
655
|
});
|
|
@@ -671,22 +671,22 @@ const ne = j(
|
|
|
671
671
|
return "";
|
|
672
672
|
if (t) {
|
|
673
673
|
if (r === "days")
|
|
674
|
-
return `${L(
|
|
674
|
+
return `${L(l.from)} ~ ${L(l.to || l.from) || "-"}`;
|
|
675
675
|
if (r === "months")
|
|
676
|
-
return `${N[
|
|
676
|
+
return `${N[l.from.getMonth()]} ~ ${l.to ? N[l.to.getMonth()] : "-"}`;
|
|
677
677
|
if (r === "years")
|
|
678
|
-
return `${(m =
|
|
678
|
+
return `${(m = l.from) == null ? void 0 : m.getFullYear()} ~ ${((Y = l.to) == null ? void 0 : Y.getFullYear()) || "-"}`;
|
|
679
679
|
} else
|
|
680
|
-
return `${L(
|
|
680
|
+
return `${L(l.from)} ~ ${L(l.to || l.from) || "-"}`;
|
|
681
681
|
}, k = () => {
|
|
682
|
-
if (u.current &&
|
|
683
|
-
const m =
|
|
682
|
+
if (u.current && v.current && s) {
|
|
683
|
+
const m = v.current.getBoundingClientRect(), Y = u.current.getBoundingClientRect();
|
|
684
684
|
window.innerWidth < m.left + Y.width ? u.current.style.left = `${m.left - Y.width + m.width}px` : u.current.style.left = `${m.left}px`, m.top + Y.height > window.innerHeight ? u.current.style.top = `${m.y - (m.height + Y.height - 28)}px` : u.current.style.top = `${m.y + m.height}px`;
|
|
685
685
|
}
|
|
686
686
|
};
|
|
687
687
|
return D(() => {
|
|
688
|
-
u.current &&
|
|
689
|
-
}, [u,
|
|
688
|
+
u.current && v.current && s && k();
|
|
689
|
+
}, [u, v, x]), D(() => {
|
|
690
690
|
const m = w == null ? void 0 : w.current;
|
|
691
691
|
return m && m.addEventListener("scroll", k), window.addEventListener("scroll", k), () => {
|
|
692
692
|
m && m.removeEventListener("scroll", k), window.removeEventListener("scroll", k);
|
|
@@ -694,11 +694,11 @@ const ne = j(
|
|
|
694
694
|
}, []), /* @__PURE__ */ $(
|
|
695
695
|
"div",
|
|
696
696
|
{
|
|
697
|
-
className: "
|
|
697
|
+
className: "sa-calendar-wrapper",
|
|
698
698
|
style: { height: s ? "auto" : "100%" },
|
|
699
|
-
ref: s ?
|
|
699
|
+
ref: s ? v : null,
|
|
700
700
|
children: [
|
|
701
|
-
s ? /* @__PURE__ */
|
|
701
|
+
s ? /* @__PURE__ */ i(
|
|
702
702
|
K,
|
|
703
703
|
{
|
|
704
704
|
value: C(),
|
|
@@ -709,7 +709,7 @@ const ne = j(
|
|
|
709
709
|
onChange: () => {
|
|
710
710
|
},
|
|
711
711
|
disabled: o,
|
|
712
|
-
placeholder:
|
|
712
|
+
placeholder: b,
|
|
713
713
|
size: h,
|
|
714
714
|
status: n
|
|
715
715
|
}
|
|
@@ -717,10 +717,10 @@ const ne = j(
|
|
|
717
717
|
x ? /* @__PURE__ */ $(
|
|
718
718
|
"div",
|
|
719
719
|
{
|
|
720
|
-
className: `
|
|
720
|
+
className: `sa-calendar ${s ? "" : "sa-calendar-no-input"}`,
|
|
721
721
|
ref: u,
|
|
722
722
|
children: [
|
|
723
|
-
/* @__PURE__ */
|
|
723
|
+
/* @__PURE__ */ i(
|
|
724
724
|
_,
|
|
725
725
|
{
|
|
726
726
|
setViews: d,
|
|
@@ -730,27 +730,27 @@ const ne = j(
|
|
|
730
730
|
setDate: y
|
|
731
731
|
}
|
|
732
732
|
),
|
|
733
|
-
/* @__PURE__ */
|
|
733
|
+
/* @__PURE__ */ i("div", { className: "sa-calendar-body", children: r === "days" ? /* @__PURE__ */ i(
|
|
734
734
|
Q,
|
|
735
735
|
{
|
|
736
736
|
date: c,
|
|
737
737
|
setDate: y,
|
|
738
738
|
setIsComponentVisible: M,
|
|
739
|
-
dateRange:
|
|
739
|
+
dateRange: l,
|
|
740
740
|
setDateRange: p,
|
|
741
741
|
input: s,
|
|
742
742
|
onChange: e,
|
|
743
743
|
minDate: g,
|
|
744
744
|
maxDate: f
|
|
745
745
|
}
|
|
746
|
-
) : r === "months" ? /* @__PURE__ */
|
|
746
|
+
) : r === "months" ? /* @__PURE__ */ i(
|
|
747
747
|
X,
|
|
748
748
|
{
|
|
749
749
|
date: c,
|
|
750
750
|
setDate: y,
|
|
751
751
|
filter: t,
|
|
752
752
|
setViews: d,
|
|
753
|
-
dateRange:
|
|
753
|
+
dateRange: l,
|
|
754
754
|
setDateRange: p,
|
|
755
755
|
setIsComponentVisible: M,
|
|
756
756
|
input: s,
|
|
@@ -758,14 +758,14 @@ const ne = j(
|
|
|
758
758
|
minDate: g,
|
|
759
759
|
maxDate: f
|
|
760
760
|
}
|
|
761
|
-
) : /* @__PURE__ */
|
|
761
|
+
) : /* @__PURE__ */ i(
|
|
762
762
|
Z,
|
|
763
763
|
{
|
|
764
764
|
date: c,
|
|
765
765
|
setDate: y,
|
|
766
766
|
filter: t,
|
|
767
767
|
setViews: d,
|
|
768
|
-
dateRange:
|
|
768
|
+
dateRange: l,
|
|
769
769
|
setDateRange: p,
|
|
770
770
|
setIsComponentVisible: M,
|
|
771
771
|
input: s,
|
|
@@ -781,7 +781,7 @@ const ne = j(
|
|
|
781
781
|
}
|
|
782
782
|
);
|
|
783
783
|
}
|
|
784
|
-
), O = "
|
|
784
|
+
), O = "sa-calendar-input-styles", ae = (a) => {
|
|
785
785
|
if (!document.getElementById(O)) {
|
|
786
786
|
const e = document.createElement("style");
|
|
787
787
|
e.id = O, e.textContent = a, document.head.appendChild(e);
|
|
@@ -802,10 +802,10 @@ const I = (a) => {
|
|
|
802
802
|
return /* @__PURE__ */ $(
|
|
803
803
|
"div",
|
|
804
804
|
{
|
|
805
|
-
className: `
|
|
805
|
+
className: `sa-calendar-input-container sa-calendar-input-${s} sa-calendar-input-container-${t} ${e} `,
|
|
806
806
|
onClick: f,
|
|
807
807
|
children: [
|
|
808
|
-
/* @__PURE__ */
|
|
808
|
+
/* @__PURE__ */ i("div", { className: "sa-calendar-input-container-icon-left", children: /* @__PURE__ */ i(
|
|
809
809
|
"svg",
|
|
810
810
|
{
|
|
811
811
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -813,7 +813,7 @@ const I = (a) => {
|
|
|
813
813
|
height: I(e),
|
|
814
814
|
viewBox: "0 0 20 20",
|
|
815
815
|
fill: "none",
|
|
816
|
-
children: /* @__PURE__ */
|
|
816
|
+
children: /* @__PURE__ */ i(
|
|
817
817
|
"path",
|
|
818
818
|
{
|
|
819
819
|
d: "M12.5 2.08301V5.41634M7.50002 2.08301V5.41634M17.0688 9.58301H2.93113M17.0688 9.58301C16.8953 4.82698 15.1284 3.33301 10 3.33301C4.87165 3.33301 3.10469 4.82698 2.93113 9.58301M17.0688 9.58301C17.0786 9.85037 17.0834 10.128 17.0834 10.4163C17.0834 15.833 15.4167 17.4997 10 17.4997C4.58335 17.4997 2.91669 15.833 2.91669 10.4163C2.91669 10.128 2.92138 9.85037 2.93113 9.58301",
|
|
@@ -825,17 +825,17 @@ const I = (a) => {
|
|
|
825
825
|
)
|
|
826
826
|
}
|
|
827
827
|
) }),
|
|
828
|
-
/* @__PURE__ */
|
|
828
|
+
/* @__PURE__ */ i("div", { className: "sa-calendar-input-preview-container", children: /* @__PURE__ */ i(
|
|
829
829
|
"input",
|
|
830
830
|
{
|
|
831
|
-
className: "
|
|
831
|
+
className: "sa-calendar-input",
|
|
832
832
|
...o,
|
|
833
833
|
disabled: t === "disable" ? !0 : o.disabled,
|
|
834
834
|
value: o.value,
|
|
835
835
|
ref: g
|
|
836
836
|
}
|
|
837
837
|
) }),
|
|
838
|
-
/* @__PURE__ */
|
|
838
|
+
/* @__PURE__ */ i("div", { className: "sa-calendar-input-container-icon-right", children: /* @__PURE__ */ i(
|
|
839
839
|
"svg",
|
|
840
840
|
{
|
|
841
841
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -843,7 +843,7 @@ const I = (a) => {
|
|
|
843
843
|
height: I(e),
|
|
844
844
|
viewBox: "0 0 20 20",
|
|
845
845
|
fill: "none",
|
|
846
|
-
children: /* @__PURE__ */
|
|
846
|
+
children: /* @__PURE__ */ i(
|
|
847
847
|
"path",
|
|
848
848
|
{
|
|
849
849
|
d: "M3.33331 7.5L9.99998 14.1667L16.6666 7.5",
|
|
@@ -866,14 +866,14 @@ const I = (a) => {
|
|
|
866
866
|
setIsComponentVisible: o,
|
|
867
867
|
minDate: g,
|
|
868
868
|
maxDate: f,
|
|
869
|
-
input:
|
|
869
|
+
input: b,
|
|
870
870
|
onChange: h
|
|
871
871
|
}) => {
|
|
872
872
|
let n = new Date(
|
|
873
873
|
t.getFullYear(),
|
|
874
874
|
t.getMonth(),
|
|
875
875
|
1
|
|
876
|
-
), w = n.getDay(),
|
|
876
|
+
), w = n.getDay(), v = [];
|
|
877
877
|
const x = a.toDateString(), M = t.getMonth();
|
|
878
878
|
for (let r = 0; r < 42; r++) {
|
|
879
879
|
r === 0 && w === 0 ? n.setDate(n.getDate() - 7) : r === 0 ? n.setDate(
|
|
@@ -888,24 +888,24 @@ const I = (a) => {
|
|
|
888
888
|
year: n.getFullYear(),
|
|
889
889
|
isDisabled: g && n < g || f && n > f
|
|
890
890
|
};
|
|
891
|
-
|
|
891
|
+
v.push(d);
|
|
892
892
|
}
|
|
893
893
|
const u = (r) => {
|
|
894
|
-
(!g || r >= g) && (!f || r <= f) && (e(r), h(r), s(r),
|
|
894
|
+
(!g || r >= g) && (!f || r <= f) && (e(r), h(r), s(r), b && o(!1));
|
|
895
895
|
};
|
|
896
|
-
return /* @__PURE__ */ $("div", { className: "
|
|
897
|
-
/* @__PURE__ */
|
|
898
|
-
/* @__PURE__ */
|
|
896
|
+
return /* @__PURE__ */ $("div", { className: "sa-calendar-days-preivew", children: [
|
|
897
|
+
/* @__PURE__ */ i("div", { className: "sa-calendar-days-name-preivew", children: J.map((r, d) => /* @__PURE__ */ i("p", { children: r }, d)) }),
|
|
898
|
+
/* @__PURE__ */ i("div", { className: "sa-calendar-days-number-preivew", children: v.map((r, d) => {
|
|
899
899
|
const c = r.isDisabled;
|
|
900
|
-
return /* @__PURE__ */
|
|
900
|
+
return /* @__PURE__ */ i(
|
|
901
901
|
"p",
|
|
902
902
|
{
|
|
903
|
-
className: `${r.currentMonth ? "
|
|
903
|
+
className: `${r.currentMonth ? "sa-calendar-days-current" : "sa-calendar-days"} ${r.selected ? "sa-calendar-days-active" : ""}`,
|
|
904
904
|
style: {
|
|
905
905
|
color: c ? "#ccc" : void 0,
|
|
906
906
|
pointerEvents: c ? "none" : void 0,
|
|
907
907
|
cursor: c ? "not-allowed" : "pointer",
|
|
908
|
-
...
|
|
908
|
+
...b ? {} : { width: "100%" }
|
|
909
909
|
},
|
|
910
910
|
onClick: () => {
|
|
911
911
|
c || u(r.date);
|
|
@@ -924,19 +924,19 @@ const I = (a) => {
|
|
|
924
924
|
onChange: o,
|
|
925
925
|
previewDate: g,
|
|
926
926
|
setPreviewDate: f,
|
|
927
|
-
minDate:
|
|
927
|
+
minDate: b,
|
|
928
928
|
maxDate: h,
|
|
929
929
|
input: n
|
|
930
930
|
}) => {
|
|
931
|
-
const w = a.getMonth(),
|
|
932
|
-
(!
|
|
931
|
+
const w = a.getMonth(), v = a.getFullYear(), x = g.getFullYear(), M = (u) => {
|
|
932
|
+
(!b || u >= b) && (!h || u <= h) && (t ? (o(u), e(u), f(u)) : (s("days"), f(u)));
|
|
933
933
|
};
|
|
934
|
-
return /* @__PURE__ */
|
|
935
|
-
const d =
|
|
936
|
-
return /* @__PURE__ */
|
|
934
|
+
return /* @__PURE__ */ i("div", { className: "sa-calendar-months-preview", children: N.map((u, r) => {
|
|
935
|
+
const d = b && new Date(x, r, 1) < b || h && new Date(x, r + 1, 0) > h;
|
|
936
|
+
return /* @__PURE__ */ i(
|
|
937
937
|
"p",
|
|
938
938
|
{
|
|
939
|
-
className: r === w && x ===
|
|
939
|
+
className: r === w && x === v ? "sa-calendar-months-active" : "",
|
|
940
940
|
style: {
|
|
941
941
|
color: d ? "#ccc" : void 0,
|
|
942
942
|
pointerEvents: d ? "none" : void 0,
|
|
@@ -962,23 +962,23 @@ const I = (a) => {
|
|
|
962
962
|
onChange: o,
|
|
963
963
|
previewDate: g,
|
|
964
964
|
setPreviewDate: f,
|
|
965
|
-
minDate:
|
|
965
|
+
minDate: b,
|
|
966
966
|
maxDate: h,
|
|
967
967
|
input: n
|
|
968
968
|
}) => {
|
|
969
969
|
let w = [];
|
|
970
|
-
const
|
|
970
|
+
const v = g.getFullYear(), { start: x, end: M } = V(v), u = a.getFullYear();
|
|
971
971
|
for (let d = x; d < M; d++) {
|
|
972
|
-
let c =
|
|
972
|
+
let c = b && new Date(d, 0, 1) < b || h && new Date(d, 11, 31) > h;
|
|
973
973
|
w.push({ year: d, active: d === u, isDisabled: c });
|
|
974
974
|
}
|
|
975
975
|
const r = (d) => {
|
|
976
|
-
(!
|
|
976
|
+
(!b || d >= b) && (!h || d <= h) && (e ? (o(d), s(d), f(d)) : (t("months"), f(d)));
|
|
977
977
|
};
|
|
978
|
-
return /* @__PURE__ */
|
|
978
|
+
return /* @__PURE__ */ i("div", { className: "sa-calendar-years-preview", children: w.map((d, c) => /* @__PURE__ */ i(
|
|
979
979
|
"p",
|
|
980
980
|
{
|
|
981
|
-
className: d.active ? "
|
|
981
|
+
className: d.active ? "sa-calendar-months-active" : "",
|
|
982
982
|
style: {
|
|
983
983
|
color: d.isDisabled ? "#ccc" : void 0,
|
|
984
984
|
pointerEvents: d.isDisabled ? "none" : void 0,
|
|
@@ -992,7 +992,7 @@ const I = (a) => {
|
|
|
992
992
|
},
|
|
993
993
|
c
|
|
994
994
|
)) });
|
|
995
|
-
},
|
|
995
|
+
}, le = ({
|
|
996
996
|
setViews: a,
|
|
997
997
|
views: e,
|
|
998
998
|
filter: t,
|
|
@@ -1013,7 +1013,7 @@ const I = (a) => {
|
|
|
1013
1013
|
return;
|
|
1014
1014
|
}
|
|
1015
1015
|
o((n) => new Date(n.getFullYear(), n.getMonth() + 1));
|
|
1016
|
-
},
|
|
1016
|
+
}, b = () => {
|
|
1017
1017
|
if (e === "years") {
|
|
1018
1018
|
o((n) => new Date(n.getFullYear() - 10, 0));
|
|
1019
1019
|
return;
|
|
@@ -1031,9 +1031,9 @@ const I = (a) => {
|
|
|
1031
1031
|
)
|
|
1032
1032
|
);
|
|
1033
1033
|
};
|
|
1034
|
-
return /* @__PURE__ */ $("div", { className: "
|
|
1035
|
-
/* @__PURE__ */
|
|
1036
|
-
/* @__PURE__ */
|
|
1034
|
+
return /* @__PURE__ */ $("div", { className: "sa-calendar-header", children: [
|
|
1035
|
+
/* @__PURE__ */ i(P, { onClick: () => b() }),
|
|
1036
|
+
/* @__PURE__ */ i("div", { style: { cursor: "pointer" }, onClick: g, children: (() => {
|
|
1037
1037
|
if (e === "days")
|
|
1038
1038
|
return `${N[s.getMonth()]} ${s.getFullYear()}`;
|
|
1039
1039
|
if (e === "months")
|
|
@@ -1041,15 +1041,15 @@ const I = (a) => {
|
|
|
1041
1041
|
if (e === "years")
|
|
1042
1042
|
return `${V(s.getFullYear()).start} ~ ${V(s.getFullYear()).end}`;
|
|
1043
1043
|
})() }),
|
|
1044
|
-
/* @__PURE__ */
|
|
1044
|
+
/* @__PURE__ */ i(R, { onClick: () => f() })
|
|
1045
1045
|
] });
|
|
1046
|
-
}, H = "
|
|
1046
|
+
}, H = "sa-calendar-styles", ie = (a) => {
|
|
1047
1047
|
if (!document.getElementById(H)) {
|
|
1048
1048
|
const e = document.createElement("style");
|
|
1049
1049
|
e.id = H, e.textContent = a, document.head.appendChild(e);
|
|
1050
1050
|
}
|
|
1051
1051
|
};
|
|
1052
|
-
|
|
1052
|
+
ie(S);
|
|
1053
1053
|
const de = j(
|
|
1054
1054
|
({
|
|
1055
1055
|
value: a,
|
|
@@ -1059,11 +1059,11 @@ const de = j(
|
|
|
1059
1059
|
disabled: o,
|
|
1060
1060
|
minDate: g,
|
|
1061
1061
|
maxDate: f,
|
|
1062
|
-
placeholder:
|
|
1062
|
+
placeholder: b,
|
|
1063
1063
|
size: h,
|
|
1064
1064
|
status: n
|
|
1065
1065
|
}, w) => {
|
|
1066
|
-
const { ref:
|
|
1066
|
+
const { ref: v, isComponentVisible: x, setIsComponentVisible: M } = A(!1), u = T(null), [r, d] = F("days"), [c, y] = F(/* @__PURE__ */ new Date()), [l, p] = F(/* @__PURE__ */ new Date());
|
|
1067
1067
|
D(() => {
|
|
1068
1068
|
a ? (y(a), p(a)) : (y(/* @__PURE__ */ new Date()), p(/* @__PURE__ */ new Date()));
|
|
1069
1069
|
}, [a]), D(() => {
|
|
@@ -1074,14 +1074,14 @@ const de = j(
|
|
|
1074
1074
|
s || M(!0);
|
|
1075
1075
|
}, [s]);
|
|
1076
1076
|
const C = () => a ? t === "days" ? L(c) : t === "months" ? `${N[c.getMonth()]} ${c.getFullYear()}` : t === "years" ? c.getFullYear() : L(c) : "", k = () => {
|
|
1077
|
-
if (u.current &&
|
|
1078
|
-
const m =
|
|
1077
|
+
if (u.current && v.current && s) {
|
|
1078
|
+
const m = v.current.getBoundingClientRect(), Y = u.current.getBoundingClientRect();
|
|
1079
1079
|
window.innerWidth < m.left + Y.width ? u.current.style.left = `${m.left - Y.width + m.width}px` : u.current.style.left = `${m.left}px`, m.top + Y.height > window.innerHeight ? u.current.style.top = `${m.y - (m.height + Y.height - 28)}px` : u.current.style.top = `${m.y + m.height}px`;
|
|
1080
1080
|
}
|
|
1081
1081
|
};
|
|
1082
1082
|
return D(() => {
|
|
1083
|
-
u.current &&
|
|
1084
|
-
}, [u,
|
|
1083
|
+
u.current && v.current && s && k();
|
|
1084
|
+
}, [u, v, x]), D(() => {
|
|
1085
1085
|
const m = w == null ? void 0 : w.current;
|
|
1086
1086
|
return m && m.addEventListener("scroll", k), window.addEventListener("scroll", k), () => {
|
|
1087
1087
|
m && m.removeEventListener("scroll", k), window.removeEventListener("scroll", k);
|
|
@@ -1089,18 +1089,18 @@ const de = j(
|
|
|
1089
1089
|
}, []), /* @__PURE__ */ $(
|
|
1090
1090
|
"div",
|
|
1091
1091
|
{
|
|
1092
|
-
className: "
|
|
1092
|
+
className: "sa-calendar-wrapper",
|
|
1093
1093
|
style: { height: s ? "auto" : "100%" },
|
|
1094
|
-
ref: s ?
|
|
1094
|
+
ref: s ? v : null,
|
|
1095
1095
|
children: [
|
|
1096
|
-
s ? /* @__PURE__ */
|
|
1096
|
+
s ? /* @__PURE__ */ i(
|
|
1097
1097
|
re,
|
|
1098
1098
|
{
|
|
1099
1099
|
value: C(),
|
|
1100
1100
|
onClick: () => M(!0),
|
|
1101
1101
|
onChange: () => {
|
|
1102
1102
|
},
|
|
1103
|
-
placeholder:
|
|
1103
|
+
placeholder: b,
|
|
1104
1104
|
disabled: o,
|
|
1105
1105
|
size: h,
|
|
1106
1106
|
status: n,
|
|
@@ -1110,26 +1110,26 @@ const de = j(
|
|
|
1110
1110
|
x ? /* @__PURE__ */ $(
|
|
1111
1111
|
"div",
|
|
1112
1112
|
{
|
|
1113
|
-
className: `
|
|
1113
|
+
className: `sa-calendar ${s ? "" : "sa-calendar-no-input"}`,
|
|
1114
1114
|
ref: u,
|
|
1115
1115
|
children: [
|
|
1116
|
-
/* @__PURE__ */
|
|
1117
|
-
|
|
1116
|
+
/* @__PURE__ */ i(
|
|
1117
|
+
le,
|
|
1118
1118
|
{
|
|
1119
1119
|
setViews: d,
|
|
1120
1120
|
views: r,
|
|
1121
1121
|
filter: t,
|
|
1122
|
-
previewDate:
|
|
1122
|
+
previewDate: l,
|
|
1123
1123
|
setPreviewDate: p,
|
|
1124
1124
|
isComponentVisible: x
|
|
1125
1125
|
}
|
|
1126
1126
|
),
|
|
1127
|
-
/* @__PURE__ */
|
|
1127
|
+
/* @__PURE__ */ i("div", { className: "sa-calendar-body", children: r === "days" ? /* @__PURE__ */ i(
|
|
1128
1128
|
te,
|
|
1129
1129
|
{
|
|
1130
1130
|
date: c,
|
|
1131
1131
|
setDate: y,
|
|
1132
|
-
previewDate:
|
|
1132
|
+
previewDate: l,
|
|
1133
1133
|
setPreviewDate: p,
|
|
1134
1134
|
setIsComponentVisible: M,
|
|
1135
1135
|
input: s,
|
|
@@ -1137,12 +1137,12 @@ const de = j(
|
|
|
1137
1137
|
maxDate: f,
|
|
1138
1138
|
onChange: e
|
|
1139
1139
|
}
|
|
1140
|
-
) : r === "months" ? /* @__PURE__ */
|
|
1140
|
+
) : r === "months" ? /* @__PURE__ */ i(
|
|
1141
1141
|
se,
|
|
1142
1142
|
{
|
|
1143
1143
|
date: c,
|
|
1144
1144
|
setDate: y,
|
|
1145
|
-
previewDate:
|
|
1145
|
+
previewDate: l,
|
|
1146
1146
|
setPreviewDate: p,
|
|
1147
1147
|
filter: t,
|
|
1148
1148
|
setViews: d,
|
|
@@ -1151,12 +1151,12 @@ const de = j(
|
|
|
1151
1151
|
maxDate: f,
|
|
1152
1152
|
input: s
|
|
1153
1153
|
}
|
|
1154
|
-
) : /* @__PURE__ */
|
|
1154
|
+
) : /* @__PURE__ */ i(
|
|
1155
1155
|
oe,
|
|
1156
1156
|
{
|
|
1157
1157
|
date: c,
|
|
1158
1158
|
setDate: y,
|
|
1159
|
-
previewDate:
|
|
1159
|
+
previewDate: l,
|
|
1160
1160
|
setPreviewDate: p,
|
|
1161
1161
|
filter: t,
|
|
1162
1162
|
setViews: d,
|
|
@@ -1182,11 +1182,11 @@ const de = j(
|
|
|
1182
1182
|
rangedDate: o,
|
|
1183
1183
|
disabled: g,
|
|
1184
1184
|
minDate: f,
|
|
1185
|
-
maxDate:
|
|
1185
|
+
maxDate: b,
|
|
1186
1186
|
placeholder: h,
|
|
1187
1187
|
size: n,
|
|
1188
1188
|
status: w
|
|
1189
|
-
},
|
|
1189
|
+
}, v) => /* @__PURE__ */ i(G, { children: o ? /* @__PURE__ */ i(
|
|
1190
1190
|
ne,
|
|
1191
1191
|
{
|
|
1192
1192
|
onChange: e,
|
|
@@ -1194,14 +1194,14 @@ const de = j(
|
|
|
1194
1194
|
input: s,
|
|
1195
1195
|
filter: t,
|
|
1196
1196
|
disabled: g,
|
|
1197
|
-
ref:
|
|
1197
|
+
ref: v,
|
|
1198
1198
|
minDate: f,
|
|
1199
|
-
maxDate:
|
|
1199
|
+
maxDate: b,
|
|
1200
1200
|
placeholder: h,
|
|
1201
1201
|
size: n,
|
|
1202
1202
|
status: w
|
|
1203
1203
|
}
|
|
1204
|
-
) : /* @__PURE__ */
|
|
1204
|
+
) : /* @__PURE__ */ i(
|
|
1205
1205
|
de,
|
|
1206
1206
|
{
|
|
1207
1207
|
onChange: e,
|
|
@@ -1209,9 +1209,9 @@ const de = j(
|
|
|
1209
1209
|
input: s,
|
|
1210
1210
|
filter: t,
|
|
1211
1211
|
disabled: g,
|
|
1212
|
-
ref:
|
|
1212
|
+
ref: v,
|
|
1213
1213
|
minDate: f,
|
|
1214
|
-
maxDate:
|
|
1214
|
+
maxDate: b,
|
|
1215
1215
|
placeholder: h,
|
|
1216
1216
|
size: n,
|
|
1217
1217
|
status: w
|