@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
package/.npmrc ADDED
@@ -0,0 +1,2 @@
1
+ npm config set scope capillarytech
2
+ //registry.npmjs.org/:_authToken=${NPM_TOKEN}
@@ -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
- return (0, _dayjs.default)(date).tz(tzName);
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
- dayjsObj = (0, _dayjs.default)(date).tz(tz);
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
  *