@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.
Files changed (47) hide show
  1. package/.npmrc +2 -0
  2. package/CapCollapsibleNavbar/index.js +55 -3
  3. package/CapCollapsibleNavbar/index.js.map +1 -1
  4. package/CapCondition/index.js +55 -3
  5. package/CapCondition/index.js.map +1 -1
  6. package/CapDatePicker/index.js +55 -3
  7. package/CapDatePicker/index.js.map +1 -1
  8. package/CapDateTimePicker/README.md +136 -0
  9. package/CapDateTimePicker/index.d.ts +13 -0
  10. package/CapDateTimePicker/index.d.ts.map +1 -0
  11. package/CapDateTimePicker/index.js +166 -106
  12. package/CapDateTimePicker/index.js.map +1 -1
  13. package/CapDateTimePicker/messages.d.ts +17 -0
  14. package/CapDateTimePicker/messages.d.ts.map +1 -0
  15. package/CapDateTimePicker/types.d.ts +93 -0
  16. package/CapDateTimePicker/types.d.ts.map +1 -0
  17. package/CapDateTimeRangePicker/index.js +55 -3
  18. package/CapDateTimeRangePicker/index.js.map +1 -1
  19. package/CapEventCalendar/index.js +55 -3
  20. package/CapEventCalendar/index.js.map +1 -1
  21. package/CapLanguageProvider/index.js +55 -3
  22. package/CapLanguageProvider/index.js.map +1 -1
  23. package/CapLevelGraphRenderer/CapLevelGraphRenderer-test-cases.md +50 -0
  24. package/CapLevelGraphRenderer/MIGRATION_ANALYSIS.md +138 -0
  25. package/CapLevelGraphRenderer/README.md +123 -0
  26. package/CapLevelGraphRenderer/STORYBOOK_ANALYSIS.md +96 -0
  27. package/CapLevelGraphRenderer/Tooltip.d.ts +31 -0
  28. package/CapLevelGraphRenderer/Tooltip.d.ts.map +1 -0
  29. package/CapLevelGraphRenderer/Tooltip_MIGRATION_ANALYSIS.md +120 -0
  30. package/CapLevelGraphRenderer/index.d.ts +16 -0
  31. package/CapLevelGraphRenderer/index.d.ts.map +1 -0
  32. package/CapLevelGraphRenderer/index.js +159 -135
  33. package/CapLevelGraphRenderer/index.js.map +1 -1
  34. package/CapLevelGraphRenderer/tests/TEST_COVERAGE.md +119 -0
  35. package/CapLevelGraphRenderer/types.d.ts +139 -0
  36. package/CapLevelGraphRenderer/types.d.ts.map +1 -0
  37. package/CapNotificationDropdown/index.js +55 -3
  38. package/CapNotificationDropdown/index.js.map +1 -1
  39. package/CapTimePicker/index.js +55 -3
  40. package/CapTimePicker/index.js.map +1 -1
  41. package/index.d.ts +4 -0
  42. package/index.d.ts.map +1 -1
  43. package/index.js +1053 -4
  44. package/index.js.map +1 -1
  45. package/package.json +4 -2
  46. package/utils/dayjs.d.ts +21 -0
  47. package/utils/dayjs.d.ts.map +1 -1
@@ -3815,7 +3815,7 @@ var _default = exports["default"] = SvgFile;
3815
3815
 
3816
3816
 
3817
3817
  exports.__esModule = true;
3818
- exports.TIME_UNITS = exports.FORMAT_TOKENS = void 0;
3818
+ exports.TIME_UNITS = exports.FORMAT_TOKENS = exports.DEFAULT_TIMEZONE = void 0;
3819
3819
  exports.dayjsToMoment = dayjsToMoment;
3820
3820
  exports["default"] = void 0;
3821
3821
  exports.hasMomentTimezoneSupport = hasMomentTimezoneSupport;
@@ -3823,6 +3823,7 @@ exports.isDayjsObject = isDayjsObject;
3823
3823
  exports.isMomentObject = isMomentObject;
3824
3824
  exports.momentToDayjs = momentToDayjs;
3825
3825
  exports.normalizeDateValue = normalizeDateValue;
3826
+ exports.toDayjsInTimezone = toDayjsInTimezone;
3826
3827
  var _dayjs = _interopRequireDefault(__webpack_require__(87695));
3827
3828
  var _advancedFormat = _interopRequireDefault(__webpack_require__(96833));
3828
3829
  var _customParseFormat = _interopRequireDefault(__webpack_require__(2825));
@@ -3934,7 +3935,23 @@ if (!tzIsCallable) {
3934
3935
  if (_dayjs.default.isDayjs(date)) {
3935
3936
  return date.tz(tzName);
3936
3937
  }
3937
- return (0, _dayjs.default)(date).tz(tzName);
3938
+ // For strings/Dates: interpret the date/time values as being IN the target timezone
3939
+ // (matching moment.tz(string, tz) semantics). dayjs(date).tz(tz) is wrong because
3940
+ // dayjs(date) anchors to the system local timezone, so .tz() converts FROM local TO tz.
3941
+ // Instead: parse as UTC to get raw date/time values, compute the target timezone's offset,
3942
+ // then adjust the UTC timestamp so .tz() produces the intended local time.
3943
+ try {
3944
+ // Validate timezone is a real IANA timezone before applying the offset correction
3945
+ Intl.DateTimeFormat(undefined, {
3946
+ timeZone: tzName
3947
+ });
3948
+ } catch (_unused) {
3949
+ // Invalid timezone — fall back to local time
3950
+ return (0, _dayjs.default)(date);
3951
+ }
3952
+ const asUtc = _dayjs.default.utc(date);
3953
+ const tzOffset = asUtc.tz(tzName).utcOffset(); // target tz offset in minutes
3954
+ return _dayjs.default.utc(asUtc.valueOf() - tzOffset * 60000).tz(tzName);
3938
3955
  } catch (error) {
3939
3956
  // If timezone is invalid, log error and fall back to local time
3940
3957
  logDevError("dayjs.tz: Invalid timezone \"" + tzName + "\"", error);
@@ -4011,6 +4028,8 @@ const FORMAT_TOKENS = exports.FORMAT_TOKENS = {
4011
4028
  MONTH_FULL: 'MMMM',
4012
4029
  YEAR: 'YYYY',
4013
4030
  YEAR_SHORT: 'YY',
4031
+ // Cap UI datetime picker format (DD-MM-YYYY | HH:mm)
4032
+ DATE_TIME: 'DD-MM-YYYY | HH:mm',
4014
4033
  // Localized formats
4015
4034
  DATE_LOCALIZED_SHORT: 'l',
4016
4035
  DATETIME_LOCALIZED_SHORT: 'll',
@@ -4021,6 +4040,7 @@ const FORMAT_TOKENS = exports.FORMAT_TOKENS = {
4021
4040
  DATETIME_LOCALIZED_LONG_TIME: 'LLL',
4022
4041
  DATETIME_LOCALIZED_LONG_TIME_WEEKDAY: 'LLLL'
4023
4042
  };
4043
+ const DEFAULT_TIMEZONE = exports.DEFAULT_TIMEZONE = 'Asia/Kolkata';
4024
4044
  function logDevError(message, error) {
4025
4045
  if (false) // removed by dead control flow
4026
4046
  {}
@@ -4101,7 +4121,10 @@ function momentToDayjs(value) {
4101
4121
  const tz = value.tz();
4102
4122
  if (tz) {
4103
4123
  // Has a named timezone - preserve it
4104
- dayjsObj = (0, _dayjs.default)(date).tz(tz);
4124
+ // dayjs.utc(date) is required here: dayjs(date) anchors to the system local timezone,
4125
+ // causing .tz() to only re-label without converting hours. dayjs.utc(date) creates a
4126
+ // UTC-mode dayjs, which .tz() correctly converts to the target timezone for display.
4127
+ dayjsObj = _dayjs.default.utc(date).tz(tz);
4105
4128
 
4106
4129
  // WORKAROUND: dayjs-timezone-iana-plugin doesn't persist timezone name in standard way
4107
4130
  // Store it manually in $x for round-trip conversion fidelity
@@ -4154,6 +4177,35 @@ function momentToDayjs(value) {
4154
4177
  return null;
4155
4178
  }
4156
4179
 
4180
+ /**
4181
+ * Converts any supported date value (Moment, Day.js, string, Date) to a Day.js object
4182
+ * in the specified timezone. This is the recommended single entry point for timezone-safe
4183
+ * date conversion — it handles moment-to-dayjs conversion and timezone application in one step,
4184
+ * avoiding the double-offset bug in dayjs-timezone-iana-plugin.
4185
+ *
4186
+ * @param value - Moment, Day.js, string, Date, or null/undefined
4187
+ * @param timezone - Target IANA timezone (e.g., 'Asia/Kolkata', 'America/New_York')
4188
+ * @returns Day.js object in the target timezone, or null if invalid
4189
+ *
4190
+ * @example
4191
+ * toDayjsInTimezone(moment.tz('2025-04-21 00:00', 'Asia/Kolkata'), 'Asia/Kolkata');
4192
+ * // Returns dayjs representing 2025-04-21 00:00 IST
4193
+ *
4194
+ * @example
4195
+ * toDayjsInTimezone(moment.tz('2025-04-21 00:00', 'UTC'), 'Asia/Kolkata');
4196
+ * // Returns dayjs representing 2025-04-21 05:30 IST
4197
+ */
4198
+ function toDayjsInTimezone(value, timezone) {
4199
+ const dayjsValue = momentToDayjs(value);
4200
+ if (!dayjsValue) return null;
4201
+
4202
+ // Convert via UTC to avoid the double-offset bug in dayjs-timezone-iana-plugin:
4203
+ // calling .tz() on a dayjs that already has a non-zero utcOffset corrupts the value.
4204
+ // Going through .toDate() → dayjs.utc() gives us a clean UTC-mode dayjs that .tz()
4205
+ // correctly converts to the target timezone.
4206
+ return _dayjs.default.utc(dayjsValue.toDate()).tz(timezone);
4207
+ }
4208
+
4157
4209
  /**
4158
4210
  * Converts a Day.js object to Moment.js, preserving timezone and locale information.
4159
4211
  *