@uxf/datepicker 13.0.3 → 14.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/hooks/use-date-picker-navigation.js +238 -89
- package/hooks/use-date-picker.js +246 -84
- package/hooks/use-date-range-picker.js +309 -196
- package/hooks/use-day.js +230 -68
- package/hooks/use-decade.js +53 -9
- package/hooks/use-hour.js +102 -33
- package/hooks/use-hours.js +31 -9
- package/hooks/use-minute.js +102 -33
- package/hooks/use-minutes.js +31 -9
- package/hooks/use-month.js +70 -12
- package/hooks/use-time-picker.js +249 -75
- package/hooks/use-year.js +46 -9
- package/package.json +12 -6
package/hooks/use-year.js
CHANGED
|
@@ -2,18 +2,55 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.yearLabelFormatFn = exports.monthLabelFormatFn = void 0;
|
|
4
4
|
exports.useYear = useYear;
|
|
5
|
-
const
|
|
5
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
6
6
|
const create_date_string_1 = require("../utils/create-date-string");
|
|
7
7
|
const dayjs_utils_1 = require("../utils/dayjs-utils");
|
|
8
8
|
const get_months_1 = require("../utils/get-months");
|
|
9
|
-
const monthLabelFormatFn =
|
|
9
|
+
const monthLabelFormatFn = date => (0, dayjs_utils_1.dayjsEnWithTz)(date).format("MMMM"); // localized
|
|
10
10
|
exports.monthLabelFormatFn = monthLabelFormatFn;
|
|
11
|
-
const yearLabelFormatFn =
|
|
11
|
+
const yearLabelFormatFn = date => (0, dayjs_utils_1.dayjsEnWithTz)(date).format("YYYY");
|
|
12
12
|
exports.yearLabelFormatFn = yearLabelFormatFn;
|
|
13
|
-
function useYear(
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
function useYear(t0) {
|
|
14
|
+
const $ = (0, compiler_runtime_1.c)(9);
|
|
15
|
+
const { yearLabelFormat: t1, monthLabelFormat: t2, year } = t0;
|
|
16
|
+
const yearLabelFormat = t1 === undefined ? exports.yearLabelFormatFn : t1;
|
|
17
|
+
const monthLabelFormat = t2 === undefined ? exports.monthLabelFormatFn : t2;
|
|
18
|
+
let t3;
|
|
19
|
+
if ($[0] !== monthLabelFormat || $[1] !== year) {
|
|
20
|
+
t3 = (0, get_months_1.getMonths)({
|
|
21
|
+
year,
|
|
22
|
+
monthLabelFormat
|
|
23
|
+
});
|
|
24
|
+
$[0] = monthLabelFormat;
|
|
25
|
+
$[1] = year;
|
|
26
|
+
$[2] = t3;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
t3 = $[2];
|
|
30
|
+
}
|
|
31
|
+
const months = t3;
|
|
32
|
+
let t4;
|
|
33
|
+
if ($[3] !== year || $[4] !== yearLabelFormat) {
|
|
34
|
+
t4 = yearLabelFormat(new Date((0, create_date_string_1.createDateString)(year, 0)));
|
|
35
|
+
$[3] = year;
|
|
36
|
+
$[4] = yearLabelFormat;
|
|
37
|
+
$[5] = t4;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
t4 = $[5];
|
|
41
|
+
}
|
|
42
|
+
let t5;
|
|
43
|
+
if ($[6] !== months || $[7] !== t4) {
|
|
44
|
+
t5 = {
|
|
45
|
+
months,
|
|
46
|
+
yearLabel: t4
|
|
47
|
+
};
|
|
48
|
+
$[6] = months;
|
|
49
|
+
$[7] = t4;
|
|
50
|
+
$[8] = t5;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
t5 = $[8];
|
|
54
|
+
}
|
|
55
|
+
return t5;
|
|
19
56
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/datepicker",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "14.1.0",
|
|
4
4
|
"description": "A set of React hooks to create an awesome datepicker.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"build": "tsc -P tsconfig.json",
|
|
7
|
+
"build": "tsc -P tsconfig.json && node ../../scripts/build-react-package.mjs",
|
|
8
8
|
"typecheck": "tsc --noEmit",
|
|
9
9
|
"test:tz:prague": "TZ=Europe/Prague jest --config=jest.dst.config.js --no-coverage",
|
|
10
10
|
"test:tz:ny": "TZ=America/New_York jest --config=jest.dst.config.js --no-coverage",
|
|
@@ -26,17 +26,23 @@
|
|
|
26
26
|
},
|
|
27
27
|
"homepage": "https://gitlab.com/uxf-npm/datepicker#readme",
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@uxf/core": "
|
|
30
|
-
"@uxf/core-react": "
|
|
29
|
+
"@uxf/core": "14.1.0",
|
|
30
|
+
"@uxf/core-react": "14.1.0",
|
|
31
31
|
"dayjs": "^1.11.23",
|
|
32
|
+
"next": ">=16.0.0",
|
|
32
33
|
"react": "^19.3.0",
|
|
33
34
|
"react-dom": "^19.3.0"
|
|
34
35
|
},
|
|
36
|
+
"peerDependenciesMeta": {
|
|
37
|
+
"next": {
|
|
38
|
+
"optional": true
|
|
39
|
+
}
|
|
40
|
+
},
|
|
35
41
|
"devDependencies": {
|
|
36
42
|
"@types/react": "19.3.0",
|
|
37
43
|
"@types/react-dom": "19.3.0",
|
|
38
|
-
"@uxf/core": "
|
|
39
|
-
"@uxf/core-react": "
|
|
44
|
+
"@uxf/core": "14.1.0",
|
|
45
|
+
"@uxf/core-react": "14.1.0",
|
|
40
46
|
"dayjs": "^1.11.23",
|
|
41
47
|
"react": "19.3.0",
|
|
42
48
|
"react-dom": "19.3.0"
|