@uxf/datepicker 14.0.0 → 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-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 react_1 = require("react");
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 = (date) => (0, dayjs_utils_1.dayjsEnWithTz)(date).format("MMMM"); // localized
9
+ const monthLabelFormatFn = date => (0, dayjs_utils_1.dayjsEnWithTz)(date).format("MMMM"); // localized
10
10
  exports.monthLabelFormatFn = monthLabelFormatFn;
11
- const yearLabelFormatFn = (date) => (0, dayjs_utils_1.dayjsEnWithTz)(date).format("YYYY");
11
+ const yearLabelFormatFn = date => (0, dayjs_utils_1.dayjsEnWithTz)(date).format("YYYY");
12
12
  exports.yearLabelFormatFn = yearLabelFormatFn;
13
- function useYear({ yearLabelFormat = exports.yearLabelFormatFn, monthLabelFormat = exports.monthLabelFormatFn, year, }) {
14
- const months = (0, react_1.useMemo)(() => (0, get_months_1.getMonths)({ year, monthLabelFormat }), [year, monthLabelFormat]);
15
- return {
16
- months,
17
- yearLabel: yearLabelFormat(new Date((0, create_date_string_1.createDateString)(year, 0))),
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": "14.0.0",
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,8 +26,8 @@
26
26
  },
27
27
  "homepage": "https://gitlab.com/uxf-npm/datepicker#readme",
28
28
  "peerDependencies": {
29
- "@uxf/core": "14.0.0",
30
- "@uxf/core-react": "14.0.0",
29
+ "@uxf/core": "14.1.0",
30
+ "@uxf/core-react": "14.1.0",
31
31
  "dayjs": "^1.11.23",
32
32
  "next": ">=16.0.0",
33
33
  "react": "^19.3.0",
@@ -41,8 +41,8 @@
41
41
  "devDependencies": {
42
42
  "@types/react": "19.3.0",
43
43
  "@types/react-dom": "19.3.0",
44
- "@uxf/core": "14.0.0",
45
- "@uxf/core-react": "14.0.0",
44
+ "@uxf/core": "14.1.0",
45
+ "@uxf/core-react": "14.1.0",
46
46
  "dayjs": "^1.11.23",
47
47
  "react": "19.3.0",
48
48
  "react-dom": "19.3.0"