@uxf/ui 11.91.0 → 11.92.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/_private-utils/get-provider-config.d.ts +1 -0
- package/_private-utils/get-provider-config.js +11 -1
- package/calendar/calendar.js +4 -7
- package/color-scheme/color-scheme-defaults.d.ts +3 -8
- package/color-scheme/color-scheme-defaults.js +8 -1
- package/context/context.d.ts +18 -10
- package/context/provider.js +7 -2
- package/context/use-ui-context-memoized-value.d.ts +15 -0
- package/context/use-ui-context-memoized-value.js +30 -0
- package/date-picker/date-picker-decade.js +7 -9
- package/date-picker/date-picker-month.js +4 -7
- package/date-picker/date-picker-year.js +7 -10
- package/date-picker/date-picker.stories.js +2 -5
- package/package.json +3 -2
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getProviderConfig = void 0;
|
|
6
|
+
exports.getProviderConfig = exports.tFunction = void 0;
|
|
7
|
+
const create_default_t_1 = require("@uxf/core-react/translations/create-default-t");
|
|
8
|
+
const cs_json_1 = __importDefault(require("@uxf/ui/translations/cs.json"));
|
|
4
9
|
const color_scheme_1 = require("../color-scheme");
|
|
5
10
|
const icons_1 = require("../config/icons");
|
|
6
11
|
const tw_screens_1 = require("../tw-tokens/tw-screens");
|
|
12
|
+
exports.tFunction = (0, create_default_t_1.createDefaultT)(cs_json_1.default);
|
|
7
13
|
const getProviderConfig = () => ({
|
|
8
14
|
colorScheme: {
|
|
9
15
|
...color_scheme_1.COLOR_SCHEME_DEFAULTS,
|
|
@@ -12,8 +18,12 @@ const getProviderConfig = () => ({
|
|
|
12
18
|
},
|
|
13
19
|
domain: "https://localhost:6006",
|
|
14
20
|
icon: { spriteFilePath: "/icons-generated/_icon-sprite.svg", iconsConfig: icons_1.ICONS },
|
|
21
|
+
localeConfig: {
|
|
22
|
+
locale: "cs",
|
|
23
|
+
},
|
|
15
24
|
rasterImage: {
|
|
16
25
|
breakpoints: tw_screens_1.twScreens,
|
|
17
26
|
},
|
|
27
|
+
translationFn: exports.tFunction,
|
|
18
28
|
});
|
|
19
29
|
exports.getProviderConfig = getProviderConfig;
|
package/calendar/calendar.js
CHANGED
|
@@ -33,25 +33,22 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
return result;
|
|
34
34
|
};
|
|
35
35
|
})();
|
|
36
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
-
};
|
|
39
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
37
|
exports.Calendar = void 0;
|
|
41
38
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
42
39
|
const use_month_1 = require("@uxf/datepicker/hooks/use-month");
|
|
43
|
-
const
|
|
40
|
+
const date_1 = require("@uxf/localize/src/date");
|
|
44
41
|
const react_1 = __importStar(require("react"));
|
|
45
42
|
const calendar_day_cell_1 = require("./calendar-day-cell");
|
|
46
43
|
exports.Calendar = (0, react_1.forwardRef)((props, ref) => {
|
|
47
44
|
var _a, _b, _c, _d, _e, _f;
|
|
48
45
|
const calendarClassName = (0, cx_1.cx)("uxf-calendar", props.className);
|
|
49
46
|
const { days, weekdayLabels } = (0, use_month_1.useMonth)({
|
|
50
|
-
dayLabelFormat: (date) => (0,
|
|
47
|
+
dayLabelFormat: (date) => (0, date_1.dayjsTz)(date).format("D"),
|
|
51
48
|
firstDayOfWeek: props.datePickerProps.firstDayOfWeek,
|
|
52
49
|
month: (_c = (_a = props.month) !== null && _a !== void 0 ? _a : (_b = props.datePickerProps.activeMonths.at(0)) === null || _b === void 0 ? void 0 : _b.month) !== null && _c !== void 0 ? _c : new Date().getMonth(),
|
|
53
|
-
monthLabelFormat: (date) => (0,
|
|
54
|
-
weekdayLabelFormat: (date) => (0,
|
|
50
|
+
monthLabelFormat: (date) => (0, date_1.dayjsTz)(date).format("MMMM YYYY"),
|
|
51
|
+
weekdayLabelFormat: (date) => (0, date_1.dayjsTz)(date).format("dd"),
|
|
55
52
|
year: (_f = (_d = props.year) !== null && _d !== void 0 ? _d : (_e = props.datePickerProps.activeMonths.at(0)) === null || _e === void 0 ? void 0 : _e.year) !== null && _f !== void 0 ? _f : new Date().getFullYear(),
|
|
56
53
|
});
|
|
57
54
|
return (react_1.default.createElement("div", { className: calendarClassName, ref: ref },
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const COLOR_SCHEME_DEFAULTS:
|
|
3
|
-
|
|
4
|
-
readonly getUserSettings: () => ColorScheme | null;
|
|
5
|
-
readonly respectSystemSetting: true;
|
|
6
|
-
readonly respectUserSettings: true;
|
|
7
|
-
readonly setUserSettings: (colorScheme: ColorScheme) => void;
|
|
8
|
-
};
|
|
1
|
+
import { type ColorSchemeOptions } from "./use-handle-color-scheme";
|
|
2
|
+
export declare const COLOR_SCHEME_DEFAULTS: Required<ColorSchemeOptions>;
|
|
3
|
+
export declare const COLOR_SCHEME_DEFAULTS_DISABLE_DARK_MODE: Required<ColorSchemeOptions>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.COLOR_SCHEME_DEFAULTS = void 0;
|
|
3
|
+
exports.COLOR_SCHEME_DEFAULTS_DISABLE_DARK_MODE = exports.COLOR_SCHEME_DEFAULTS = void 0;
|
|
4
4
|
exports.COLOR_SCHEME_DEFAULTS = {
|
|
5
5
|
defaultColorScheme: "light",
|
|
6
6
|
getUserSettings: () => localStorage.getItem("theme"),
|
|
@@ -8,3 +8,10 @@ exports.COLOR_SCHEME_DEFAULTS = {
|
|
|
8
8
|
respectUserSettings: true,
|
|
9
9
|
setUserSettings: (colorScheme) => localStorage.setItem("theme", colorScheme),
|
|
10
10
|
};
|
|
11
|
+
exports.COLOR_SCHEME_DEFAULTS_DISABLE_DARK_MODE = {
|
|
12
|
+
defaultColorScheme: "light",
|
|
13
|
+
getUserSettings: () => localStorage.getItem("theme"),
|
|
14
|
+
respectSystemSetting: false,
|
|
15
|
+
respectUserSettings: false,
|
|
16
|
+
setUserSettings: (colorScheme) => localStorage.setItem("theme", colorScheme),
|
|
17
|
+
};
|
package/context/context.d.ts
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
|
+
import { TranslationFunction } from "@uxf/core-react/translations/types";
|
|
1
2
|
import { ColorSchemeOptions } from "../color-scheme/use-handle-color-scheme";
|
|
2
3
|
import { IconName } from "../icon/types";
|
|
4
|
+
export type IconOptions = {
|
|
5
|
+
spriteFilePath: string;
|
|
6
|
+
iconsConfig: Record<IconName, {
|
|
7
|
+
w: number;
|
|
8
|
+
h: number;
|
|
9
|
+
}>;
|
|
10
|
+
};
|
|
11
|
+
export type LocaleConfig = {
|
|
12
|
+
locale: string;
|
|
13
|
+
};
|
|
14
|
+
export type RasterImageOptions = {
|
|
15
|
+
breakpoints: Partial<Record<string, string>>;
|
|
16
|
+
};
|
|
3
17
|
export type UiContextType = {
|
|
4
18
|
colorScheme: ColorSchemeOptions;
|
|
5
19
|
domain: string;
|
|
6
|
-
icon:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
h: number;
|
|
11
|
-
}>;
|
|
12
|
-
};
|
|
13
|
-
rasterImage: {
|
|
14
|
-
breakpoints: Partial<Record<string, string>>;
|
|
15
|
-
};
|
|
20
|
+
icon: IconOptions;
|
|
21
|
+
localeConfig: LocaleConfig;
|
|
22
|
+
rasterImage: RasterImageOptions;
|
|
23
|
+
translationFn: TranslationFunction<string>;
|
|
16
24
|
};
|
|
17
25
|
export declare const UiContext: import("react").Context<UiContextType | undefined>;
|
package/context/provider.js
CHANGED
|
@@ -4,17 +4,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.UiContextProvider = void 0;
|
|
7
|
+
const translations_1 = require("@uxf/core-react/translations");
|
|
8
|
+
const context_1 = require("@uxf/localize/src/context/context");
|
|
7
9
|
const dayjs_1 = require("dayjs");
|
|
8
10
|
const customParseFormat_1 = __importDefault(require("dayjs/plugin/customParseFormat"));
|
|
9
11
|
const localizedFormat_1 = __importDefault(require("dayjs/plugin/localizedFormat"));
|
|
10
12
|
const react_1 = __importDefault(require("react"));
|
|
11
13
|
const use_handle_color_scheme_1 = require("../color-scheme/use-handle-color-scheme");
|
|
12
|
-
const
|
|
14
|
+
const context_2 = require("./context");
|
|
13
15
|
(0, dayjs_1.extend)(localizedFormat_1.default);
|
|
14
16
|
(0, dayjs_1.extend)(customParseFormat_1.default);
|
|
15
17
|
const UiContextProvider = (props) => {
|
|
16
18
|
(0, use_handle_color_scheme_1.useHandleColorScheme)(props.value.colorScheme);
|
|
17
|
-
|
|
19
|
+
(0, dayjs_1.locale)(props.value.localeConfig.locale);
|
|
20
|
+
return (react_1.default.createElement(translations_1.TranslationsProvider, { value: props.value.translationFn },
|
|
21
|
+
react_1.default.createElement(context_1._LocalizeProvider, { value: props.value.localeConfig.locale },
|
|
22
|
+
react_1.default.createElement(context_2.UiContext.Provider, { value: props.value }, props.children))));
|
|
18
23
|
};
|
|
19
24
|
exports.UiContextProvider = UiContextProvider;
|
|
20
25
|
exports.UiContextProvider.displayName = "UxfUiContextProvider";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TranslationFunction } from "@uxf/core-react/translations/types";
|
|
2
|
+
import { ColorSchemeOptions } from "../color-scheme/use-handle-color-scheme";
|
|
3
|
+
import { IconOptions, LocaleConfig, RasterImageOptions, UiContextType } from "./context";
|
|
4
|
+
interface Props {
|
|
5
|
+
colorScheme?: {
|
|
6
|
+
isDarkModeDisabled: true;
|
|
7
|
+
} | ColorSchemeOptions;
|
|
8
|
+
domain: string;
|
|
9
|
+
icon: IconOptions;
|
|
10
|
+
localeConfig: LocaleConfig;
|
|
11
|
+
rasterImage: RasterImageOptions;
|
|
12
|
+
translationFn: TranslationFunction<string>;
|
|
13
|
+
}
|
|
14
|
+
export declare function useUiContextMemoizedValue(props: Props): UiContextType;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useUiContextMemoizedValue = useUiContextMemoizedValue;
|
|
4
|
+
const stable_stringify_1 = require("@uxf/core/utils/stable-stringify");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const color_scheme_1 = require("../color-scheme");
|
|
7
|
+
const color_scheme_defaults_1 = require("../color-scheme/color-scheme-defaults");
|
|
8
|
+
function useUiContextMemoizedValue(props) {
|
|
9
|
+
return (0, react_1.useMemo)(() => {
|
|
10
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
11
|
+
return ({
|
|
12
|
+
colorScheme: props.colorScheme && "isDarkModeDisabled" in props.colorScheme
|
|
13
|
+
? color_scheme_defaults_1.COLOR_SCHEME_DEFAULTS_DISABLE_DARK_MODE
|
|
14
|
+
: {
|
|
15
|
+
defaultColorScheme: (_b = (_a = props.colorScheme) === null || _a === void 0 ? void 0 : _a.defaultColorScheme) !== null && _b !== void 0 ? _b : color_scheme_1.COLOR_SCHEME_DEFAULTS.defaultColorScheme,
|
|
16
|
+
getUserSettings: (_d = (_c = props.colorScheme) === null || _c === void 0 ? void 0 : _c.getUserSettings) !== null && _d !== void 0 ? _d : color_scheme_1.COLOR_SCHEME_DEFAULTS.getUserSettings,
|
|
17
|
+
respectSystemSetting: (_f = (_e = props.colorScheme) === null || _e === void 0 ? void 0 : _e.respectSystemSetting) !== null && _f !== void 0 ? _f : color_scheme_1.COLOR_SCHEME_DEFAULTS.respectSystemSetting,
|
|
18
|
+
respectUserSettings: (_h = (_g = props.colorScheme) === null || _g === void 0 ? void 0 : _g.respectUserSettings) !== null && _h !== void 0 ? _h : color_scheme_1.COLOR_SCHEME_DEFAULTS.respectUserSettings,
|
|
19
|
+
setUserSettings: (_k = (_j = props.colorScheme) === null || _j === void 0 ? void 0 : _j.setUserSettings) !== null && _k !== void 0 ? _k : color_scheme_1.COLOR_SCHEME_DEFAULTS.setUserSettings,
|
|
20
|
+
},
|
|
21
|
+
domain: props.domain,
|
|
22
|
+
icon: props.icon,
|
|
23
|
+
localeConfig: props.localeConfig,
|
|
24
|
+
rasterImage: props.rasterImage,
|
|
25
|
+
translationFn: props.translationFn,
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
29
|
+
[(0, stable_stringify_1.stableStringify)(props)]);
|
|
30
|
+
}
|
|
@@ -32,9 +32,6 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
36
|
exports.DatePickerDecade = void 0;
|
|
40
37
|
const translations_1 = require("@uxf/core-react/translations");
|
|
@@ -43,7 +40,7 @@ const cx_1 = require("@uxf/core/utils/cx");
|
|
|
43
40
|
const date_picker_context_1 = require("@uxf/datepicker/contexts/date-picker-context");
|
|
44
41
|
const use_decade_1 = require("@uxf/datepicker/hooks/use-decade");
|
|
45
42
|
const use_month_1 = require("@uxf/datepicker/hooks/use-month");
|
|
46
|
-
const
|
|
43
|
+
const date_1 = require("@uxf/localize/src/date");
|
|
47
44
|
const react_1 = __importStar(require("react"));
|
|
48
45
|
const calendar_1 = require("../calendar");
|
|
49
46
|
exports.DatePickerDecade = (0, react_1.memo)((props) => {
|
|
@@ -56,8 +53,8 @@ exports.DatePickerDecade = (0, react_1.memo)((props) => {
|
|
|
56
53
|
const { years } = (0, use_decade_1.useDecade)({
|
|
57
54
|
year: currentYear,
|
|
58
55
|
});
|
|
59
|
-
const canGoToPrevDecade = canGoToYear((0,
|
|
60
|
-
const canGoToNextDecade = canGoToYear((0,
|
|
56
|
+
const canGoToPrevDecade = canGoToYear((0, date_1.dayjsTz)(new Date(currentYear, 0)).subtract(5, "years").toDate());
|
|
57
|
+
const canGoToNextDecade = canGoToYear((0, date_1.dayjsTz)(new Date(currentYear, 0)).add(5, "years").toDate());
|
|
61
58
|
const handleGoToPrevDecadeClick = (0, react_1.useCallback)(() => {
|
|
62
59
|
if (canGoToPrevDecade) {
|
|
63
60
|
goToPrevYear(9);
|
|
@@ -74,10 +71,10 @@ exports.DatePickerDecade = (0, react_1.memo)((props) => {
|
|
|
74
71
|
}
|
|
75
72
|
}, [canGoToYear, onYearSelect]);
|
|
76
73
|
const { monthLabel } = (0, use_month_1.useMonth)({
|
|
77
|
-
dayLabelFormat: (date) => (0,
|
|
74
|
+
dayLabelFormat: (date) => (0, date_1.dayjsTz)(date).format("D"),
|
|
78
75
|
firstDayOfWeek,
|
|
79
76
|
month: currentMonth,
|
|
80
|
-
monthLabelFormat: (date) => (0,
|
|
77
|
+
monthLabelFormat: (date) => (0, date_1.dayjsTz)(date).format("MMMM"),
|
|
81
78
|
year: currentYear,
|
|
82
79
|
});
|
|
83
80
|
const handleSetMonthViewMode = (0, react_1.useCallback)(() => props.setViewMode("year"), [props]);
|
|
@@ -96,6 +93,7 @@ exports.DatePickerDecade = (0, react_1.memo)((props) => {
|
|
|
96
93
|
children: currentYear,
|
|
97
94
|
isDisabled: true,
|
|
98
95
|
} }),
|
|
99
|
-
react_1.default.createElement("div", { className: "uxf-calendar__decade" }, years.map((year) => (react_1.default.createElement("button", { className: (0, cx_1.cx)("uxf-calendar__cell uxf-calendar__cell-year", !canGoToYear(year.date) && classes_1.CLASSES.IS_DISABLED, (0,
|
|
96
|
+
react_1.default.createElement("div", { className: "uxf-calendar__decade" }, years.map((year) => (react_1.default.createElement("button", { className: (0, cx_1.cx)("uxf-calendar__cell uxf-calendar__cell-year", !canGoToYear(year.date) && classes_1.CLASSES.IS_DISABLED, (0, date_1.dayjsTz)(year.date).year() === (0, date_1.dayjsTz)(selectedDate).year() &&
|
|
97
|
+
"uxf-calendar__cell--selected"), key: year.yearLabel, onClick: handleSelectYear(year.date), type: "button" }, year.yearLabel))))));
|
|
100
98
|
});
|
|
101
99
|
exports.DatePickerDecade.displayName = "UxfUiDatePickerDecade";
|
|
@@ -32,15 +32,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
36
|
exports.DatePickerMonth = void 0;
|
|
40
37
|
const translations_1 = require("@uxf/core-react/translations");
|
|
41
38
|
const date_picker_context_1 = require("@uxf/datepicker/contexts/date-picker-context");
|
|
42
39
|
const use_month_1 = require("@uxf/datepicker/hooks/use-month");
|
|
43
|
-
const
|
|
40
|
+
const date_1 = require("@uxf/localize/src/date");
|
|
44
41
|
const react_1 = __importStar(require("react"));
|
|
45
42
|
const calendar_1 = require("../calendar");
|
|
46
43
|
exports.DatePickerMonth = (0, react_1.memo)((props) => {
|
|
@@ -53,11 +50,11 @@ exports.DatePickerMonth = (0, react_1.memo)((props) => {
|
|
|
53
50
|
const currentMonth = (_b = (_a = activeMonths.at(0)) === null || _a === void 0 ? void 0 : _a.month) !== null && _b !== void 0 ? _b : new Date().getMonth();
|
|
54
51
|
const currentYear = (_d = (_c = activeMonths.at(0)) === null || _c === void 0 ? void 0 : _c.year) !== null && _d !== void 0 ? _d : new Date().getFullYear();
|
|
55
52
|
const { monthLabel } = (0, use_month_1.useMonth)({
|
|
56
|
-
dayLabelFormat: (date) => (0,
|
|
53
|
+
dayLabelFormat: (date) => (0, date_1.dayjsTz)(date).format("D"),
|
|
57
54
|
firstDayOfWeek,
|
|
58
55
|
month: currentMonth,
|
|
59
|
-
monthLabelFormat: (date) => (0,
|
|
60
|
-
weekdayLabelFormat: (date) => (0,
|
|
56
|
+
monthLabelFormat: (date) => (0, date_1.dayjsTz)(date).format("MMMM"),
|
|
57
|
+
weekdayLabelFormat: (date) => (0, date_1.dayjsTz)(date).format("dd"),
|
|
61
58
|
year: currentYear,
|
|
62
59
|
});
|
|
63
60
|
const handleGoToPrevMonth = (0, react_1.useCallback)(() => {
|
|
@@ -32,9 +32,6 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
36
|
exports.DatePickerYear = void 0;
|
|
40
37
|
const translations_1 = require("@uxf/core-react/translations");
|
|
@@ -43,7 +40,7 @@ const cx_1 = require("@uxf/core/utils/cx");
|
|
|
43
40
|
const date_picker_context_1 = require("@uxf/datepicker/contexts/date-picker-context");
|
|
44
41
|
const use_month_1 = require("@uxf/datepicker/hooks/use-month");
|
|
45
42
|
const use_year_1 = require("@uxf/datepicker/hooks/use-year");
|
|
46
|
-
const
|
|
43
|
+
const date_1 = require("@uxf/localize/src/date");
|
|
47
44
|
const react_1 = __importStar(require("react"));
|
|
48
45
|
const calendar_1 = require("../calendar");
|
|
49
46
|
exports.DatePickerYear = (0, react_1.memo)((props) => {
|
|
@@ -54,14 +51,14 @@ exports.DatePickerYear = (0, react_1.memo)((props) => {
|
|
|
54
51
|
const currentYear = (_d = (_c = activeMonths.at(0)) === null || _c === void 0 ? void 0 : _c.year) !== null && _d !== void 0 ? _d : new Date().getFullYear();
|
|
55
52
|
const { months, yearLabel } = (0, use_year_1.useYear)({
|
|
56
53
|
year: currentYear,
|
|
57
|
-
yearLabelFormat: (date) => (0,
|
|
58
|
-
monthLabelFormat: (date) => (0,
|
|
54
|
+
yearLabelFormat: (date) => (0, date_1.dayjsTz)(date).format("YYYY"),
|
|
55
|
+
monthLabelFormat: (date) => (0, date_1.dayjsTz)(date).format("MMMM"),
|
|
59
56
|
});
|
|
60
57
|
const { monthLabel } = (0, use_month_1.useMonth)({
|
|
61
|
-
dayLabelFormat: (date) => (0,
|
|
58
|
+
dayLabelFormat: (date) => (0, date_1.dayjsTz)(date).format("D"),
|
|
62
59
|
firstDayOfWeek,
|
|
63
60
|
month: currentMonth,
|
|
64
|
-
monthLabelFormat: (date) => (0,
|
|
61
|
+
monthLabelFormat: (date) => (0, date_1.dayjsTz)(date).format("MMMM"),
|
|
65
62
|
year: currentYear,
|
|
66
63
|
});
|
|
67
64
|
const handleGoToNextYear = (0, react_1.useCallback)(() => {
|
|
@@ -99,8 +96,8 @@ exports.DatePickerYear = (0, react_1.memo)((props) => {
|
|
|
99
96
|
onClick: handleYearClick,
|
|
100
97
|
title: (_k = (_j = props.customButtonTitles) === null || _j === void 0 ? void 0 : _j.selectYear) !== null && _k !== void 0 ? _k : t("uxf-ui-date-picker:select-year"),
|
|
101
98
|
} }),
|
|
102
|
-
react_1.default.createElement("div", { className: "uxf-calendar__year" }, months.map((month, index) => (react_1.default.createElement("button", { className: (0, cx_1.cx)("uxf-calendar__cell uxf-calendar__cell-month", !canGoToMonth(month.date) && classes_1.CLASSES.IS_DISABLED, (0,
|
|
103
|
-
(0,
|
|
99
|
+
react_1.default.createElement("div", { className: "uxf-calendar__year" }, months.map((month, index) => (react_1.default.createElement("button", { className: (0, cx_1.cx)("uxf-calendar__cell uxf-calendar__cell-month", !canGoToMonth(month.date) && classes_1.CLASSES.IS_DISABLED, (0, date_1.dayjsTz)(month.date).month() === (0, date_1.dayjsTz)(selectedDate).month() &&
|
|
100
|
+
(0, date_1.dayjsTz)(month.date).year() === (0, date_1.dayjsTz)(selectedDate).year() &&
|
|
104
101
|
"uxf-calendar__cell--selected"), key: month.monthLabel + index, onClick: handleMonthClick(month.date), type: "button" }, month.monthLabel))))));
|
|
105
102
|
});
|
|
106
103
|
exports.DatePickerYear.displayName = "UxfUiDatePickerYear";
|
|
@@ -32,16 +32,13 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
-
};
|
|
38
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
36
|
exports.Default = Default;
|
|
40
|
-
const
|
|
37
|
+
const date_1 = require("@uxf/localize/src/date");
|
|
41
38
|
const react_1 = __importStar(require("react"));
|
|
42
39
|
const action_1 = require("../utils/action");
|
|
43
40
|
const date_picker_1 = require("./date-picker");
|
|
44
|
-
const today = (0,
|
|
41
|
+
const today = (0, date_1.dayjsTz)();
|
|
45
42
|
const unavailableDates = [
|
|
46
43
|
today.toDate(),
|
|
47
44
|
today.add(5, "days").toDate(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/ui",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.92.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"@headlessui/react": "1.7.19",
|
|
26
26
|
"@uxf/core": "11.91.0",
|
|
27
27
|
"@uxf/core-react": "11.91.0",
|
|
28
|
-
"@uxf/datepicker": "11.
|
|
28
|
+
"@uxf/datepicker": "11.92.0",
|
|
29
|
+
"@uxf/localize": "11.90.0",
|
|
29
30
|
"@uxf/styles": "11.91.0",
|
|
30
31
|
"color2k": "2.0.3",
|
|
31
32
|
"dayjs": "1.11.19",
|