@capillarytech/blaze-ui 5.1.18 → 5.1.20
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/CapCollapsibleNavbar/index.js +51 -2
- package/CapCollapsibleNavbar/index.js.map +1 -1
- package/CapCondition/index.js +51 -2
- package/CapCondition/index.js.map +1 -1
- package/CapDatePicker/index.js +51 -2
- package/CapDatePicker/index.js.map +1 -1
- package/CapDateTimePicker/index.d.ts.map +1 -1
- package/CapDateTimePicker/index.js +75 -13
- package/CapDateTimePicker/index.js.map +1 -1
- package/CapDateTimePicker/messages.d.ts +8 -0
- package/CapDateTimePicker/messages.d.ts.map +1 -1
- package/CapDateTimePicker/types.d.ts +4 -0
- package/CapDateTimePicker/types.d.ts.map +1 -1
- package/CapDateTimeRangePicker/index.js +51 -2
- package/CapDateTimeRangePicker/index.js.map +1 -1
- package/CapEventCalendar/index.js +51 -2
- package/CapEventCalendar/index.js.map +1 -1
- package/CapLanguageProvider/index.js +51 -2
- package/CapLanguageProvider/index.js.map +1 -1
- package/CapNotificationDropdown/index.js +51 -2
- package/CapNotificationDropdown/index.js.map +1 -1
- package/CapTimePicker/index.js +51 -2
- package/CapTimePicker/index.js.map +1 -1
- package/index.js +75 -13
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/utils/dayjs.d.ts +19 -0
- package/utils/dayjs.d.ts.map +1 -1
package/index.js
CHANGED
|
@@ -23454,6 +23454,7 @@ exports.isDayjsObject = isDayjsObject;
|
|
|
23454
23454
|
exports.isMomentObject = isMomentObject;
|
|
23455
23455
|
exports.momentToDayjs = momentToDayjs;
|
|
23456
23456
|
exports.normalizeDateValue = normalizeDateValue;
|
|
23457
|
+
exports.toDayjsInTimezone = toDayjsInTimezone;
|
|
23457
23458
|
var _dayjs = _interopRequireDefault(__webpack_require__(87695));
|
|
23458
23459
|
var _advancedFormat = _interopRequireDefault(__webpack_require__(96833));
|
|
23459
23460
|
var _customParseFormat = _interopRequireDefault(__webpack_require__(2825));
|
|
@@ -23565,7 +23566,23 @@ if (!tzIsCallable) {
|
|
|
23565
23566
|
if (_dayjs.default.isDayjs(date)) {
|
|
23566
23567
|
return date.tz(tzName);
|
|
23567
23568
|
}
|
|
23568
|
-
|
|
23569
|
+
// For strings/Dates: interpret the date/time values as being IN the target timezone
|
|
23570
|
+
// (matching moment.tz(string, tz) semantics). dayjs(date).tz(tz) is wrong because
|
|
23571
|
+
// dayjs(date) anchors to the system local timezone, so .tz() converts FROM local TO tz.
|
|
23572
|
+
// Instead: parse as UTC to get raw date/time values, compute the target timezone's offset,
|
|
23573
|
+
// then adjust the UTC timestamp so .tz() produces the intended local time.
|
|
23574
|
+
try {
|
|
23575
|
+
// Validate timezone is a real IANA timezone before applying the offset correction
|
|
23576
|
+
Intl.DateTimeFormat(undefined, {
|
|
23577
|
+
timeZone: tzName
|
|
23578
|
+
});
|
|
23579
|
+
} catch (_unused) {
|
|
23580
|
+
// Invalid timezone — fall back to local time
|
|
23581
|
+
return (0, _dayjs.default)(date);
|
|
23582
|
+
}
|
|
23583
|
+
const asUtc = _dayjs.default.utc(date);
|
|
23584
|
+
const tzOffset = asUtc.tz(tzName).utcOffset(); // target tz offset in minutes
|
|
23585
|
+
return _dayjs.default.utc(asUtc.valueOf() - tzOffset * 60000).tz(tzName);
|
|
23569
23586
|
} catch (error) {
|
|
23570
23587
|
// If timezone is invalid, log error and fall back to local time
|
|
23571
23588
|
logDevError("dayjs.tz: Invalid timezone \"" + tzName + "\"", error);
|
|
@@ -23735,7 +23752,10 @@ function momentToDayjs(value) {
|
|
|
23735
23752
|
const tz = value.tz();
|
|
23736
23753
|
if (tz) {
|
|
23737
23754
|
// Has a named timezone - preserve it
|
|
23738
|
-
|
|
23755
|
+
// dayjs.utc(date) is required here: dayjs(date) anchors to the system local timezone,
|
|
23756
|
+
// causing .tz() to only re-label without converting hours. dayjs.utc(date) creates a
|
|
23757
|
+
// UTC-mode dayjs, which .tz() correctly converts to the target timezone for display.
|
|
23758
|
+
dayjsObj = _dayjs.default.utc(date).tz(tz);
|
|
23739
23759
|
|
|
23740
23760
|
// WORKAROUND: dayjs-timezone-iana-plugin doesn't persist timezone name in standard way
|
|
23741
23761
|
// Store it manually in $x for round-trip conversion fidelity
|
|
@@ -23788,6 +23808,35 @@ function momentToDayjs(value) {
|
|
|
23788
23808
|
return null;
|
|
23789
23809
|
}
|
|
23790
23810
|
|
|
23811
|
+
/**
|
|
23812
|
+
* Converts any supported date value (Moment, Day.js, string, Date) to a Day.js object
|
|
23813
|
+
* in the specified timezone. This is the recommended single entry point for timezone-safe
|
|
23814
|
+
* date conversion — it handles moment-to-dayjs conversion and timezone application in one step,
|
|
23815
|
+
* avoiding the double-offset bug in dayjs-timezone-iana-plugin.
|
|
23816
|
+
*
|
|
23817
|
+
* @param value - Moment, Day.js, string, Date, or null/undefined
|
|
23818
|
+
* @param timezone - Target IANA timezone (e.g., 'Asia/Kolkata', 'America/New_York')
|
|
23819
|
+
* @returns Day.js object in the target timezone, or null if invalid
|
|
23820
|
+
*
|
|
23821
|
+
* @example
|
|
23822
|
+
* toDayjsInTimezone(moment.tz('2025-04-21 00:00', 'Asia/Kolkata'), 'Asia/Kolkata');
|
|
23823
|
+
* // Returns dayjs representing 2025-04-21 00:00 IST
|
|
23824
|
+
*
|
|
23825
|
+
* @example
|
|
23826
|
+
* toDayjsInTimezone(moment.tz('2025-04-21 00:00', 'UTC'), 'Asia/Kolkata');
|
|
23827
|
+
* // Returns dayjs representing 2025-04-21 05:30 IST
|
|
23828
|
+
*/
|
|
23829
|
+
function toDayjsInTimezone(value, timezone) {
|
|
23830
|
+
const dayjsValue = momentToDayjs(value);
|
|
23831
|
+
if (!dayjsValue) return null;
|
|
23832
|
+
|
|
23833
|
+
// Convert via UTC to avoid the double-offset bug in dayjs-timezone-iana-plugin:
|
|
23834
|
+
// calling .tz() on a dayjs that already has a non-zero utcOffset corrupts the value.
|
|
23835
|
+
// Going through .toDate() → dayjs.utc() gives us a clean UTC-mode dayjs that .tz()
|
|
23836
|
+
// correctly converts to the target timezone.
|
|
23837
|
+
return _dayjs.default.utc(dayjsValue.toDate()).tz(timezone);
|
|
23838
|
+
}
|
|
23839
|
+
|
|
23791
23840
|
/**
|
|
23792
23841
|
* Converts a Day.js object to Moment.js, preserving timezone and locale information.
|
|
23793
23842
|
*
|
|
@@ -27183,6 +27232,14 @@ var _default = exports["default"] = (0, _reactIntl.defineMessages)({
|
|
|
27183
27232
|
selectDateTimePlaceHolder: {
|
|
27184
27233
|
id: scope + ".selectDateTimePlaceHolder",
|
|
27185
27234
|
defaultMessage: 'Select date | time'
|
|
27235
|
+
},
|
|
27236
|
+
selectLabel: {
|
|
27237
|
+
id: scope + ".selectLabel",
|
|
27238
|
+
defaultMessage: 'Select'
|
|
27239
|
+
},
|
|
27240
|
+
todayLabel: {
|
|
27241
|
+
id: scope + ".todayLabel",
|
|
27242
|
+
defaultMessage: 'Today'
|
|
27186
27243
|
}
|
|
27187
27244
|
});
|
|
27188
27245
|
|
|
@@ -34891,7 +34948,7 @@ var _logDeprecationWarning = _interopRequireDefault(__webpack_require__(19224));
|
|
|
34891
34948
|
var _messages = _interopRequireDefault(__webpack_require__(32528));
|
|
34892
34949
|
var _styles = _interopRequireDefault(__webpack_require__(2580));
|
|
34893
34950
|
var _jsxRuntime = __webpack_require__(74848);
|
|
34894
|
-
const _excluded = ["intl", "className", "value", "onChange", "cellRender", "dateRender", "showTime", "format", "placeholder", "timezone", "disabledTime", "renderExtraFooter", "showToday", "onOk", "onPanelChange", "popupClassName", "dropdownClassName", "popupStyle", "dropdownStyle", "getPopupContainer", "getCalendarContainer", "popupOpen", "open", "onPopupOpenChange", "onOpenChange"];
|
|
34951
|
+
const _excluded = ["intl", "className", "value", "defaultValue", "onChange", "cellRender", "dateRender", "showTime", "format", "placeholder", "timezone", "disabledTime", "renderExtraFooter", "showToday", "onOk", "onPanelChange", "popupClassName", "dropdownClassName", "popupStyle", "dropdownStyle", "getPopupContainer", "getCalendarContainer", "popupOpen", "open", "onPopupOpenChange", "onOpenChange"];
|
|
34895
34952
|
/**
|
|
34896
34953
|
*
|
|
34897
34954
|
* CapDateTimePicker
|
|
@@ -34910,6 +34967,7 @@ const CapDateTimePicker = _ref => {
|
|
|
34910
34967
|
},
|
|
34911
34968
|
className = '',
|
|
34912
34969
|
value = null,
|
|
34970
|
+
defaultValue = null,
|
|
34913
34971
|
onChange = () => {},
|
|
34914
34972
|
cellRender,
|
|
34915
34973
|
dateRender,
|
|
@@ -34948,16 +35006,14 @@ const CapDateTimePicker = _ref => {
|
|
|
34948
35006
|
const skipNextCloseRef = (0, _react.useRef)(false);
|
|
34949
35007
|
|
|
34950
35008
|
// Detect if consumer is using moment
|
|
34951
|
-
const isConsumerUsingMoment = (0, _dayjs.isMomentObject)(value);
|
|
35009
|
+
const isConsumerUsingMoment = (0, _dayjs.isMomentObject)(value) || (0, _dayjs.isMomentObject)(defaultValue);
|
|
34952
35010
|
|
|
34953
35011
|
// Parse date in timezone
|
|
34954
35012
|
const parseDateTime = dateTime => {
|
|
34955
35013
|
if (!dateTime) return null;
|
|
34956
|
-
|
|
34957
|
-
|
|
34958
|
-
|
|
34959
|
-
if (!dayjsDateTime) return null;
|
|
34960
|
-
return dayjsDateTime.clone().tz(timezone);
|
|
35014
|
+
const dayjsDateTimeToTimezone = (0, _dayjs.toDayjsInTimezone)(dateTime, timezone);
|
|
35015
|
+
if (!dayjsDateTimeToTimezone) return null;
|
|
35016
|
+
return dayjsDateTimeToTimezone;
|
|
34961
35017
|
};
|
|
34962
35018
|
|
|
34963
35019
|
// Today's date in target timezone
|
|
@@ -34994,7 +35050,9 @@ const CapDateTimePicker = _ref => {
|
|
|
34994
35050
|
const handleOk = date => {
|
|
34995
35051
|
skipNextCloseRef.current = false;
|
|
34996
35052
|
setIsPickerOpen(false);
|
|
34997
|
-
|
|
35053
|
+
const parsedValue = parseDateTime(date);
|
|
35054
|
+
const result = (0, _dayjs.normalizeDateValue)(isConsumerUsingMoment, parsedValue);
|
|
35055
|
+
onOk == null || onOk(result != null ? result : null);
|
|
34998
35056
|
};
|
|
34999
35057
|
|
|
35000
35058
|
// Get the current value in the correct timezone
|
|
@@ -35005,14 +35063,18 @@ const CapDateTimePicker = _ref => {
|
|
|
35005
35063
|
|
|
35006
35064
|
// Backward compatibility: map deprecated props to new props
|
|
35007
35065
|
const finalPopupClassName = (0, _classnames.default)(_styles.default[clsPrefix + "__calendar-popup"], popupClassName != null ? popupClassName : dropdownClassName);
|
|
35008
|
-
const
|
|
35066
|
+
const labelVars = {
|
|
35067
|
+
'--cap-datetime-select-label': "'" + formatMessage(_messages.default.selectLabel) + "'",
|
|
35068
|
+
'--cap-datetime-today-label': "'" + formatMessage(_messages.default.todayLabel) + "'"
|
|
35069
|
+
};
|
|
35070
|
+
const finalPopupStyle = _extends({}, labelVars, popupStyle != null ? popupStyle : dropdownStyle);
|
|
35009
35071
|
const finalGetPopupContainer = getPopupContainer != null ? getPopupContainer : getCalendarContainer;
|
|
35010
35072
|
const finalOpen = (_ref2 = popupOpen != null ? popupOpen : openProp) != null ? _ref2 : isPickerOpen;
|
|
35011
35073
|
|
|
35012
35074
|
// Backward compatibility: map deprecated dateRender to cellRender
|
|
35013
35075
|
const finalCellRender = cellRender != null ? cellRender : dateRender ? current => dateRender(current, todayDate) : undefined;
|
|
35014
35076
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antdV.DatePicker, _extends({
|
|
35015
|
-
className: (0, _classnames.default)(
|
|
35077
|
+
className: (0, _classnames.default)(clsPrefix, className),
|
|
35016
35078
|
showTime: showTimeConfig,
|
|
35017
35079
|
format: format,
|
|
35018
35080
|
placeholder: placeholder || formatMessage(_messages.default.selectDateTimePlaceHolder),
|
|
@@ -35184,7 +35246,7 @@ var ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ = __webpack_require__(31601);
|
|
|
35184
35246
|
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(76314);
|
|
35185
35247
|
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);
|
|
35186
35248
|
// Module
|
|
35187
|
-
___CSS_LOADER_EXPORT___.push([module.id, `.cap-date-time-picker__calendar-icon{color:#091e42}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges{width:100%;display:flex;align-items:center;justify-content:flex-start;gap:1.142rem;padding:.571rem 1.142rem .857rem 1.142rem}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges .ant-picker-ok{order:0;margin-inline-start:0}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges .ant-picker-ok>button{background:#47af46;border:none;border-radius:.285rem;padding:0 2rem;height:2.285rem;line-height:2.285rem;font-weight:500;color:#fff;box-shadow:none}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges .ant-picker-ok>button>span{display:none}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges .ant-picker-ok>button::after{content:"Select";font-size:1rem}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges .ant-picker-ok>button:disabled{background:#a1d8a0;cursor:not-allowed}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges .ant-picker-now{order:1}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges .ant-picker-now>a{font-size:0;font-weight:500;color:#2466ea}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges .ant-picker-now>a::after{content:"Today";font-size:1rem;vertical-align:sub}`, ""]);
|
|
35249
|
+
___CSS_LOADER_EXPORT___.push([module.id, `.cap-date-time-picker__calendar-icon{color:#091e42}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges{width:100%;display:flex;align-items:center;justify-content:flex-start;gap:1.142rem;padding:.571rem 1.142rem .857rem 1.142rem}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges .ant-picker-ok{order:0;margin-inline-start:0}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges .ant-picker-ok>button{background:#47af46;border:none;border-radius:.285rem;padding:0 2rem;height:2.285rem;line-height:2.285rem;font-weight:500;color:#fff;box-shadow:none}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges .ant-picker-ok>button>span{display:none}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges .ant-picker-ok>button::after{content:var(--cap-datetime-select-label, "Select");font-size:1rem}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges .ant-picker-ok>button:disabled{background:#a1d8a0;cursor:not-allowed}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges .ant-picker-now{order:1}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges .ant-picker-now>a{font-size:0;font-weight:500;color:#2466ea}.cap-date-time-picker__calendar-popup .ant-picker-footer .ant-picker-ranges .ant-picker-now>a::after{content:var(--cap-datetime-today-label, "Today");font-size:1rem;vertical-align:sub}`, ""]);
|
|
35188
35250
|
// Exports
|
|
35189
35251
|
___CSS_LOADER_EXPORT___.locals = {
|
|
35190
35252
|
"cap-date-time-picker__calendar-icon": `cap-date-time-picker__calendar-icon`,
|