@capillarytech/blaze-ui 5.2.2 → 5.2.4
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/.npmrc +2 -0
- package/CapCollapsibleNavbar/index.js +55 -3
- package/CapCollapsibleNavbar/index.js.map +1 -1
- package/CapCondition/index.js +55 -3
- package/CapCondition/index.js.map +1 -1
- package/CapDatePicker/index.js +55 -3
- package/CapDatePicker/index.js.map +1 -1
- package/CapDateTimePicker/README.md +136 -0
- package/CapDateTimePicker/index.d.ts +13 -0
- package/CapDateTimePicker/index.d.ts.map +1 -0
- package/CapDateTimePicker/index.js +166 -106
- package/CapDateTimePicker/index.js.map +1 -1
- package/CapDateTimePicker/messages.d.ts +17 -0
- package/CapDateTimePicker/messages.d.ts.map +1 -0
- package/CapDateTimePicker/types.d.ts +93 -0
- package/CapDateTimePicker/types.d.ts.map +1 -0
- package/CapDateTimeRangePicker/index.js +55 -3
- package/CapDateTimeRangePicker/index.js.map +1 -1
- package/CapEventCalendar/index.js +55 -3
- package/CapEventCalendar/index.js.map +1 -1
- package/CapLanguageProvider/index.js +55 -3
- package/CapLanguageProvider/index.js.map +1 -1
- package/CapLevelGraphRenderer/CapLevelGraphRenderer-test-cases.md +50 -0
- package/CapLevelGraphRenderer/MIGRATION_ANALYSIS.md +138 -0
- package/CapLevelGraphRenderer/README.md +123 -0
- package/CapLevelGraphRenderer/STORYBOOK_ANALYSIS.md +96 -0
- package/CapLevelGraphRenderer/Tooltip.d.ts +31 -0
- package/CapLevelGraphRenderer/Tooltip.d.ts.map +1 -0
- package/CapLevelGraphRenderer/Tooltip_MIGRATION_ANALYSIS.md +120 -0
- package/CapLevelGraphRenderer/index.d.ts +16 -0
- package/CapLevelGraphRenderer/index.d.ts.map +1 -0
- package/CapLevelGraphRenderer/index.js +159 -135
- package/CapLevelGraphRenderer/index.js.map +1 -1
- package/CapLevelGraphRenderer/tests/TEST_COVERAGE.md +119 -0
- package/CapLevelGraphRenderer/types.d.ts +139 -0
- package/CapLevelGraphRenderer/types.d.ts.map +1 -0
- package/CapNotificationDropdown/index.js +55 -3
- package/CapNotificationDropdown/index.js.map +1 -1
- package/CapTimePicker/index.js +55 -3
- package/CapTimePicker/index.js.map +1 -1
- package/index.d.ts +4 -0
- package/index.d.ts.map +1 -1
- package/index.js +1053 -4
- package/index.js.map +1 -1
- package/package.json +4 -2
- package/utils/dayjs.d.ts +21 -0
- package/utils/dayjs.d.ts.map +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const scope = "app.commonUtils.capUiLibrary.capDateTimePicker";
|
|
2
|
+
declare const _default: {
|
|
3
|
+
selectDateTimePlaceHolder: {
|
|
4
|
+
id: string;
|
|
5
|
+
defaultMessage: string;
|
|
6
|
+
};
|
|
7
|
+
selectLabel: {
|
|
8
|
+
id: string;
|
|
9
|
+
defaultMessage: string;
|
|
10
|
+
};
|
|
11
|
+
todayLabel: {
|
|
12
|
+
id: string;
|
|
13
|
+
defaultMessage: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
|
17
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../components/CapDateTimePicker/messages.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,mDAAmD,CAAC;;;;;;;;;;;;;;;AAEtE,wBAaG"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { DatePickerProps } from 'antd-v5';
|
|
2
|
+
import type { Dayjs } from 'dayjs';
|
|
3
|
+
import type { Moment } from 'moment';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import type { WrappedComponentProps } from 'react-intl';
|
|
6
|
+
export interface CapDateTimePickerProps extends Omit<DatePickerProps<Dayjs>, 'value' | 'onChange' | 'cellRender' | 'popupClassName' | 'popupStyle' | 'getPopupContainer' | 'popupOpen' | 'onPopupOpenChange'> {
|
|
7
|
+
/**
|
|
8
|
+
* Selected datetime value (Dayjs, Moment, or ISO string)
|
|
9
|
+
*/
|
|
10
|
+
value?: Dayjs | Moment | string | null;
|
|
11
|
+
/**
|
|
12
|
+
* Callback when datetime changes
|
|
13
|
+
* @param value - Dayjs or Moment object (matches input type) or null
|
|
14
|
+
* @param dateString - Formatted date string
|
|
15
|
+
*/
|
|
16
|
+
onChange?: (value: Dayjs | Moment | null, dateString: string) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Custom cell renderer for calendar cells (v6 API)
|
|
19
|
+
*/
|
|
20
|
+
cellRender?: DatePickerProps<Dayjs>['cellRender'];
|
|
21
|
+
/**
|
|
22
|
+
* Timezone string (e.g., 'Asia/Kolkata')
|
|
23
|
+
* @default 'Asia/Kolkata'
|
|
24
|
+
*/
|
|
25
|
+
timezone?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Custom class name for the popup/dropdown (v6 API)
|
|
28
|
+
*/
|
|
29
|
+
popupClassName?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Custom style for the popup/dropdown (v6 API)
|
|
32
|
+
*/
|
|
33
|
+
popupStyle?: React.CSSProperties;
|
|
34
|
+
/**
|
|
35
|
+
* Container for the popup (v6 API)
|
|
36
|
+
*/
|
|
37
|
+
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the popup is open (v6 API)
|
|
40
|
+
*/
|
|
41
|
+
popupOpen?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Callback when popup open state changes (v6 API)
|
|
44
|
+
*/
|
|
45
|
+
onPopupOpenChange?: (open: boolean) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Custom cell renderer for calendar cells
|
|
48
|
+
* @deprecated Use `cellRender` instead. Will be removed in next major version.
|
|
49
|
+
*/
|
|
50
|
+
dateRender?: (currentDate: Dayjs, today: Dayjs) => React.ReactNode;
|
|
51
|
+
/**
|
|
52
|
+
* Custom class name for the popup/dropdown
|
|
53
|
+
* @deprecated Use `popupClassName` instead. Will be removed in next major version.
|
|
54
|
+
*/
|
|
55
|
+
dropdownClassName?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Custom style for the popup/dropdown
|
|
58
|
+
* @deprecated Use `popupStyle` instead. Will be removed in next major version.
|
|
59
|
+
*/
|
|
60
|
+
dropdownStyle?: React.CSSProperties;
|
|
61
|
+
/**
|
|
62
|
+
* Container for the calendar dropdown
|
|
63
|
+
* @deprecated Use `getPopupContainer` instead. Will be removed in next major version.
|
|
64
|
+
*/
|
|
65
|
+
getCalendarContainer?: (triggerNode: HTMLElement) => HTMLElement;
|
|
66
|
+
/**
|
|
67
|
+
* Whether the dropdown is open
|
|
68
|
+
* @deprecated Use `popupOpen` instead. Will be removed in next major version.
|
|
69
|
+
*/
|
|
70
|
+
open?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Callback when dropdown open state changes
|
|
73
|
+
* @deprecated Use `onPopupOpenChange` instead. Will be removed in next major version.
|
|
74
|
+
*/
|
|
75
|
+
onOpenChange?: (open: boolean) => void;
|
|
76
|
+
/**
|
|
77
|
+
* Whether to show today button
|
|
78
|
+
* @deprecated This prop is deprecated. Today button behavior is now handled internally by Ant Design.
|
|
79
|
+
*/
|
|
80
|
+
showToday?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Render extra footer in calendar panel
|
|
83
|
+
* @deprecated This prop is discouraged. Consider using custom panel components instead.
|
|
84
|
+
*/
|
|
85
|
+
renderExtraFooter?: () => React.ReactNode;
|
|
86
|
+
/**
|
|
87
|
+
* Callback when OK button is clicked
|
|
88
|
+
*/
|
|
89
|
+
onOk?: (value: Dayjs | Moment | null | Dayjs[] | Moment[]) => void;
|
|
90
|
+
}
|
|
91
|
+
/** Internal-only: adds react-intl's injected `intl` prop to the public props */
|
|
92
|
+
export type InternalProps = CapDateTimePickerProps & WrappedComponentProps;
|
|
93
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|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AE,KAAK,EAAE,KAAK,EAAE,KAAK,KAAK,KAAK,CAAC,SAAS,CAAC;IAEnE;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;OAGG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAEpC;;;OAGG;IACH,oBAAoB,CAAC,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,WAAW,CAAC;IAEjE;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAEvC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;IAE1C;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,GAAG,KAAK,EAAE,GAAG,MAAM,EAAE,KAAK,IAAI,CAAC;CACpE;AAED,gFAAgF;AAChF,MAAM,MAAM,aAAa,GAAG,sBAAsB,GAAG,qBAAqB,CAAC"}
|
|
@@ -3826,7 +3826,7 @@ var _default = exports["default"] = SvgFile;
|
|
|
3826
3826
|
|
|
3827
3827
|
|
|
3828
3828
|
exports.__esModule = true;
|
|
3829
|
-
exports.TIME_UNITS = exports.FORMAT_TOKENS = void 0;
|
|
3829
|
+
exports.TIME_UNITS = exports.FORMAT_TOKENS = exports.DEFAULT_TIMEZONE = void 0;
|
|
3830
3830
|
exports.dayjsToMoment = dayjsToMoment;
|
|
3831
3831
|
exports["default"] = void 0;
|
|
3832
3832
|
exports.hasMomentTimezoneSupport = hasMomentTimezoneSupport;
|
|
@@ -3834,6 +3834,7 @@ exports.isDayjsObject = isDayjsObject;
|
|
|
3834
3834
|
exports.isMomentObject = isMomentObject;
|
|
3835
3835
|
exports.momentToDayjs = momentToDayjs;
|
|
3836
3836
|
exports.normalizeDateValue = normalizeDateValue;
|
|
3837
|
+
exports.toDayjsInTimezone = toDayjsInTimezone;
|
|
3837
3838
|
var _dayjs = _interopRequireDefault(__webpack_require__(87695));
|
|
3838
3839
|
var _advancedFormat = _interopRequireDefault(__webpack_require__(96833));
|
|
3839
3840
|
var _customParseFormat = _interopRequireDefault(__webpack_require__(2825));
|
|
@@ -3945,7 +3946,23 @@ if (!tzIsCallable) {
|
|
|
3945
3946
|
if (_dayjs.default.isDayjs(date)) {
|
|
3946
3947
|
return date.tz(tzName);
|
|
3947
3948
|
}
|
|
3948
|
-
|
|
3949
|
+
// For strings/Dates: interpret the date/time values as being IN the target timezone
|
|
3950
|
+
// (matching moment.tz(string, tz) semantics). dayjs(date).tz(tz) is wrong because
|
|
3951
|
+
// dayjs(date) anchors to the system local timezone, so .tz() converts FROM local TO tz.
|
|
3952
|
+
// Instead: parse as UTC to get raw date/time values, compute the target timezone's offset,
|
|
3953
|
+
// then adjust the UTC timestamp so .tz() produces the intended local time.
|
|
3954
|
+
try {
|
|
3955
|
+
// Validate timezone is a real IANA timezone before applying the offset correction
|
|
3956
|
+
Intl.DateTimeFormat(undefined, {
|
|
3957
|
+
timeZone: tzName
|
|
3958
|
+
});
|
|
3959
|
+
} catch (_unused) {
|
|
3960
|
+
// Invalid timezone — fall back to local time
|
|
3961
|
+
return (0, _dayjs.default)(date);
|
|
3962
|
+
}
|
|
3963
|
+
const asUtc = _dayjs.default.utc(date);
|
|
3964
|
+
const tzOffset = asUtc.tz(tzName).utcOffset(); // target tz offset in minutes
|
|
3965
|
+
return _dayjs.default.utc(asUtc.valueOf() - tzOffset * 60000).tz(tzName);
|
|
3949
3966
|
} catch (error) {
|
|
3950
3967
|
// If timezone is invalid, log error and fall back to local time
|
|
3951
3968
|
logDevError("dayjs.tz: Invalid timezone \"" + tzName + "\"", error);
|
|
@@ -4022,6 +4039,8 @@ const FORMAT_TOKENS = exports.FORMAT_TOKENS = {
|
|
|
4022
4039
|
MONTH_FULL: 'MMMM',
|
|
4023
4040
|
YEAR: 'YYYY',
|
|
4024
4041
|
YEAR_SHORT: 'YY',
|
|
4042
|
+
// Cap UI datetime picker format (DD-MM-YYYY | HH:mm)
|
|
4043
|
+
DATE_TIME: 'DD-MM-YYYY | HH:mm',
|
|
4025
4044
|
// Localized formats
|
|
4026
4045
|
DATE_LOCALIZED_SHORT: 'l',
|
|
4027
4046
|
DATETIME_LOCALIZED_SHORT: 'll',
|
|
@@ -4032,6 +4051,7 @@ const FORMAT_TOKENS = exports.FORMAT_TOKENS = {
|
|
|
4032
4051
|
DATETIME_LOCALIZED_LONG_TIME: 'LLL',
|
|
4033
4052
|
DATETIME_LOCALIZED_LONG_TIME_WEEKDAY: 'LLLL'
|
|
4034
4053
|
};
|
|
4054
|
+
const DEFAULT_TIMEZONE = exports.DEFAULT_TIMEZONE = 'Asia/Kolkata';
|
|
4035
4055
|
function logDevError(message, error) {
|
|
4036
4056
|
if (false) // removed by dead control flow
|
|
4037
4057
|
{}
|
|
@@ -4112,7 +4132,10 @@ function momentToDayjs(value) {
|
|
|
4112
4132
|
const tz = value.tz();
|
|
4113
4133
|
if (tz) {
|
|
4114
4134
|
// Has a named timezone - preserve it
|
|
4115
|
-
|
|
4135
|
+
// dayjs.utc(date) is required here: dayjs(date) anchors to the system local timezone,
|
|
4136
|
+
// causing .tz() to only re-label without converting hours. dayjs.utc(date) creates a
|
|
4137
|
+
// UTC-mode dayjs, which .tz() correctly converts to the target timezone for display.
|
|
4138
|
+
dayjsObj = _dayjs.default.utc(date).tz(tz);
|
|
4116
4139
|
|
|
4117
4140
|
// WORKAROUND: dayjs-timezone-iana-plugin doesn't persist timezone name in standard way
|
|
4118
4141
|
// Store it manually in $x for round-trip conversion fidelity
|
|
@@ -4165,6 +4188,35 @@ function momentToDayjs(value) {
|
|
|
4165
4188
|
return null;
|
|
4166
4189
|
}
|
|
4167
4190
|
|
|
4191
|
+
/**
|
|
4192
|
+
* Converts any supported date value (Moment, Day.js, string, Date) to a Day.js object
|
|
4193
|
+
* in the specified timezone. This is the recommended single entry point for timezone-safe
|
|
4194
|
+
* date conversion — it handles moment-to-dayjs conversion and timezone application in one step,
|
|
4195
|
+
* avoiding the double-offset bug in dayjs-timezone-iana-plugin.
|
|
4196
|
+
*
|
|
4197
|
+
* @param value - Moment, Day.js, string, Date, or null/undefined
|
|
4198
|
+
* @param timezone - Target IANA timezone (e.g., 'Asia/Kolkata', 'America/New_York')
|
|
4199
|
+
* @returns Day.js object in the target timezone, or null if invalid
|
|
4200
|
+
*
|
|
4201
|
+
* @example
|
|
4202
|
+
* toDayjsInTimezone(moment.tz('2025-04-21 00:00', 'Asia/Kolkata'), 'Asia/Kolkata');
|
|
4203
|
+
* // Returns dayjs representing 2025-04-21 00:00 IST
|
|
4204
|
+
*
|
|
4205
|
+
* @example
|
|
4206
|
+
* toDayjsInTimezone(moment.tz('2025-04-21 00:00', 'UTC'), 'Asia/Kolkata');
|
|
4207
|
+
* // Returns dayjs representing 2025-04-21 05:30 IST
|
|
4208
|
+
*/
|
|
4209
|
+
function toDayjsInTimezone(value, timezone) {
|
|
4210
|
+
const dayjsValue = momentToDayjs(value);
|
|
4211
|
+
if (!dayjsValue) return null;
|
|
4212
|
+
|
|
4213
|
+
// Convert via UTC to avoid the double-offset bug in dayjs-timezone-iana-plugin:
|
|
4214
|
+
// calling .tz() on a dayjs that already has a non-zero utcOffset corrupts the value.
|
|
4215
|
+
// Going through .toDate() → dayjs.utc() gives us a clean UTC-mode dayjs that .tz()
|
|
4216
|
+
// correctly converts to the target timezone.
|
|
4217
|
+
return _dayjs.default.utc(dayjsValue.toDate()).tz(timezone);
|
|
4218
|
+
}
|
|
4219
|
+
|
|
4168
4220
|
/**
|
|
4169
4221
|
* Converts a Day.js object to Moment.js, preserving timezone and locale information.
|
|
4170
4222
|
*
|