@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
package/.npmrc
ADDED
|
@@ -4436,7 +4436,7 @@ var _default = exports["default"] = SvgFile;
|
|
|
4436
4436
|
|
|
4437
4437
|
|
|
4438
4438
|
exports.__esModule = true;
|
|
4439
|
-
exports.TIME_UNITS = exports.FORMAT_TOKENS = void 0;
|
|
4439
|
+
exports.TIME_UNITS = exports.FORMAT_TOKENS = exports.DEFAULT_TIMEZONE = void 0;
|
|
4440
4440
|
exports.dayjsToMoment = dayjsToMoment;
|
|
4441
4441
|
exports["default"] = void 0;
|
|
4442
4442
|
exports.hasMomentTimezoneSupport = hasMomentTimezoneSupport;
|
|
@@ -4444,6 +4444,7 @@ exports.isDayjsObject = isDayjsObject;
|
|
|
4444
4444
|
exports.isMomentObject = isMomentObject;
|
|
4445
4445
|
exports.momentToDayjs = momentToDayjs;
|
|
4446
4446
|
exports.normalizeDateValue = normalizeDateValue;
|
|
4447
|
+
exports.toDayjsInTimezone = toDayjsInTimezone;
|
|
4447
4448
|
var _dayjs = _interopRequireDefault(__webpack_require__(87695));
|
|
4448
4449
|
var _advancedFormat = _interopRequireDefault(__webpack_require__(96833));
|
|
4449
4450
|
var _customParseFormat = _interopRequireDefault(__webpack_require__(2825));
|
|
@@ -4555,7 +4556,23 @@ if (!tzIsCallable) {
|
|
|
4555
4556
|
if (_dayjs.default.isDayjs(date)) {
|
|
4556
4557
|
return date.tz(tzName);
|
|
4557
4558
|
}
|
|
4558
|
-
|
|
4559
|
+
// For strings/Dates: interpret the date/time values as being IN the target timezone
|
|
4560
|
+
// (matching moment.tz(string, tz) semantics). dayjs(date).tz(tz) is wrong because
|
|
4561
|
+
// dayjs(date) anchors to the system local timezone, so .tz() converts FROM local TO tz.
|
|
4562
|
+
// Instead: parse as UTC to get raw date/time values, compute the target timezone's offset,
|
|
4563
|
+
// then adjust the UTC timestamp so .tz() produces the intended local time.
|
|
4564
|
+
try {
|
|
4565
|
+
// Validate timezone is a real IANA timezone before applying the offset correction
|
|
4566
|
+
Intl.DateTimeFormat(undefined, {
|
|
4567
|
+
timeZone: tzName
|
|
4568
|
+
});
|
|
4569
|
+
} catch (_unused) {
|
|
4570
|
+
// Invalid timezone — fall back to local time
|
|
4571
|
+
return (0, _dayjs.default)(date);
|
|
4572
|
+
}
|
|
4573
|
+
const asUtc = _dayjs.default.utc(date);
|
|
4574
|
+
const tzOffset = asUtc.tz(tzName).utcOffset(); // target tz offset in minutes
|
|
4575
|
+
return _dayjs.default.utc(asUtc.valueOf() - tzOffset * 60000).tz(tzName);
|
|
4559
4576
|
} catch (error) {
|
|
4560
4577
|
// If timezone is invalid, log error and fall back to local time
|
|
4561
4578
|
logDevError("dayjs.tz: Invalid timezone \"" + tzName + "\"", error);
|
|
@@ -4632,6 +4649,8 @@ const FORMAT_TOKENS = exports.FORMAT_TOKENS = {
|
|
|
4632
4649
|
MONTH_FULL: 'MMMM',
|
|
4633
4650
|
YEAR: 'YYYY',
|
|
4634
4651
|
YEAR_SHORT: 'YY',
|
|
4652
|
+
// Cap UI datetime picker format (DD-MM-YYYY | HH:mm)
|
|
4653
|
+
DATE_TIME: 'DD-MM-YYYY | HH:mm',
|
|
4635
4654
|
// Localized formats
|
|
4636
4655
|
DATE_LOCALIZED_SHORT: 'l',
|
|
4637
4656
|
DATETIME_LOCALIZED_SHORT: 'll',
|
|
@@ -4642,6 +4661,7 @@ const FORMAT_TOKENS = exports.FORMAT_TOKENS = {
|
|
|
4642
4661
|
DATETIME_LOCALIZED_LONG_TIME: 'LLL',
|
|
4643
4662
|
DATETIME_LOCALIZED_LONG_TIME_WEEKDAY: 'LLLL'
|
|
4644
4663
|
};
|
|
4664
|
+
const DEFAULT_TIMEZONE = exports.DEFAULT_TIMEZONE = 'Asia/Kolkata';
|
|
4645
4665
|
function logDevError(message, error) {
|
|
4646
4666
|
if (false) // removed by dead control flow
|
|
4647
4667
|
{}
|
|
@@ -4722,7 +4742,10 @@ function momentToDayjs(value) {
|
|
|
4722
4742
|
const tz = value.tz();
|
|
4723
4743
|
if (tz) {
|
|
4724
4744
|
// Has a named timezone - preserve it
|
|
4725
|
-
|
|
4745
|
+
// dayjs.utc(date) is required here: dayjs(date) anchors to the system local timezone,
|
|
4746
|
+
// causing .tz() to only re-label without converting hours. dayjs.utc(date) creates a
|
|
4747
|
+
// UTC-mode dayjs, which .tz() correctly converts to the target timezone for display.
|
|
4748
|
+
dayjsObj = _dayjs.default.utc(date).tz(tz);
|
|
4726
4749
|
|
|
4727
4750
|
// WORKAROUND: dayjs-timezone-iana-plugin doesn't persist timezone name in standard way
|
|
4728
4751
|
// Store it manually in $x for round-trip conversion fidelity
|
|
@@ -4775,6 +4798,35 @@ function momentToDayjs(value) {
|
|
|
4775
4798
|
return null;
|
|
4776
4799
|
}
|
|
4777
4800
|
|
|
4801
|
+
/**
|
|
4802
|
+
* Converts any supported date value (Moment, Day.js, string, Date) to a Day.js object
|
|
4803
|
+
* in the specified timezone. This is the recommended single entry point for timezone-safe
|
|
4804
|
+
* date conversion — it handles moment-to-dayjs conversion and timezone application in one step,
|
|
4805
|
+
* avoiding the double-offset bug in dayjs-timezone-iana-plugin.
|
|
4806
|
+
*
|
|
4807
|
+
* @param value - Moment, Day.js, string, Date, or null/undefined
|
|
4808
|
+
* @param timezone - Target IANA timezone (e.g., 'Asia/Kolkata', 'America/New_York')
|
|
4809
|
+
* @returns Day.js object in the target timezone, or null if invalid
|
|
4810
|
+
*
|
|
4811
|
+
* @example
|
|
4812
|
+
* toDayjsInTimezone(moment.tz('2025-04-21 00:00', 'Asia/Kolkata'), 'Asia/Kolkata');
|
|
4813
|
+
* // Returns dayjs representing 2025-04-21 00:00 IST
|
|
4814
|
+
*
|
|
4815
|
+
* @example
|
|
4816
|
+
* toDayjsInTimezone(moment.tz('2025-04-21 00:00', 'UTC'), 'Asia/Kolkata');
|
|
4817
|
+
* // Returns dayjs representing 2025-04-21 05:30 IST
|
|
4818
|
+
*/
|
|
4819
|
+
function toDayjsInTimezone(value, timezone) {
|
|
4820
|
+
const dayjsValue = momentToDayjs(value);
|
|
4821
|
+
if (!dayjsValue) return null;
|
|
4822
|
+
|
|
4823
|
+
// Convert via UTC to avoid the double-offset bug in dayjs-timezone-iana-plugin:
|
|
4824
|
+
// calling .tz() on a dayjs that already has a non-zero utcOffset corrupts the value.
|
|
4825
|
+
// Going through .toDate() → dayjs.utc() gives us a clean UTC-mode dayjs that .tz()
|
|
4826
|
+
// correctly converts to the target timezone.
|
|
4827
|
+
return _dayjs.default.utc(dayjsValue.toDate()).tz(timezone);
|
|
4828
|
+
}
|
|
4829
|
+
|
|
4778
4830
|
/**
|
|
4779
4831
|
* Converts a Day.js object to Moment.js, preserving timezone and locale information.
|
|
4780
4832
|
*
|