@aurodesignsystem/auro-library 5.0.0 → 5.0.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Semantic Release Automated Changelog
2
2
 
3
+ ## [5.0.2](https://github.com/AlaskaAirlines/auro-library/compare/v5.0.1...v5.0.2) (2025-06-02)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * add optional locale to get date string from a specific locale instead of the users locale ([dc188c1](https://github.com/AlaskaAirlines/auro-library/commit/dc188c15c10bcde4bec30284838b4f2866c78b01))
9
+
10
+ ## [5.0.1](https://github.com/AlaskaAirlines/auro-library/compare/v5.0.0...v5.0.1) (2025-06-02)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * resolve issues with isMousePressed and keeping bibs open on focus loss ([3ae2c38](https://github.com/AlaskaAirlines/auro-library/commit/3ae2c38003eda3c58f1278924844bfd9f57e349f))
16
+
3
17
  # [5.0.0](https://github.com/AlaskaAirlines/auro-library/compare/v4.5.0...v5.0.0) (2025-05-29)
4
18
 
5
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aurodesignsystem/auro-library",
3
- "version": "5.0.0",
3
+ "version": "5.0.2",
4
4
  "description": "This repository holds shared scripts, utilities, and workflows utilized across repositories along the Auro Design System.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -54,9 +54,10 @@ class DateFormatter {
54
54
  /**
55
55
  * Convert a date object to string format.
56
56
  * @param {Object} date - Date to convert to string.
57
- * @returns {Object} Returns the date as a string.
57
+ * @param {String} locale - Optional locale to use for the date string. Defaults to user's locale.
58
+ * @returns {String} Returns the date as a string.
58
59
  */
59
- this.getDateAsString = (date) => date.toLocaleDateString(undefined, {
60
+ this.getDateAsString = (date, locale = undefined) => date.toLocaleDateString(locale, {
60
61
  year: "numeric",
61
62
  month: "2-digit",
62
63
  day: "2-digit",
@@ -81,7 +81,7 @@ export class AuroDateUtilities extends AuroDateUtilitiesBase {
81
81
  const dateObj = new Date(this.getFourDigitYear(dateParts.year), dateParts.month - 1, dateParts.day || 1);
82
82
 
83
83
  // Get the date string of the date object we created from the string date
84
- const actualDateStr = dateFormatter.getDateAsString(dateObj);
84
+ const actualDateStr = dateFormatter.getDateAsString(dateObj, "en-US");
85
85
 
86
86
  // Guard Clause: Generated date matches date string input
87
87
  if (expectedDateStr !== actualDateStr) {
@@ -24,8 +24,28 @@ export default class AuroFloatingUI {
24
24
  if (!AuroFloatingUI.isMousePressHandlerInitialized && window && window.addEventListener) {
25
25
  AuroFloatingUI.isMousePressHandlerInitialized = true;
26
26
 
27
+ // Track timeout for isMousePressed reset to avoid race conditions
28
+ if (!AuroFloatingUI._mousePressedTimeout) {
29
+ AuroFloatingUI._mousePressedTimeout = null;
30
+ }
27
31
  const mouseEventGlobalHandler = (event) => {
28
- AuroFloatingUI.isMousePressed = event.type === 'mousedown';
32
+ const isPressed = event.type === 'mousedown';
33
+ if (isPressed) {
34
+ // Clear any pending timeout to prevent race condition
35
+ if (AuroFloatingUI._mousePressedTimeout !== null) {
36
+ clearTimeout(AuroFloatingUI._mousePressedTimeout);
37
+ AuroFloatingUI._mousePressedTimeout = null;
38
+ }
39
+ if (!AuroFloatingUI.isMousePressed) {
40
+ AuroFloatingUI.isMousePressed = true;
41
+ }
42
+ } else if (AuroFloatingUI.isMousePressed && !isPressed) {
43
+ // Schedule reset and track timeout ID
44
+ AuroFloatingUI._mousePressedTimeout = setTimeout(() => {
45
+ AuroFloatingUI.isMousePressed = false;
46
+ AuroFloatingUI._mousePressedTimeout = null;
47
+ }, 0);
48
+ }
29
49
  };
30
50
 
31
51
  window.addEventListener('mousedown', mouseEventGlobalHandler);
@@ -287,8 +307,9 @@ export default class AuroFloatingUI {
287
307
  if (this.element.contains(activeElement) || this.element.bib?.contains(activeElement)) {
288
308
  return;
289
309
  }
290
- // if fullscreen bib is still open and the focus is missing, do not close
291
- if (this.element.bib.hasAttribute('isfullscreen') && activeElement === document.body) {
310
+
311
+ // if fullscreen bib is in fullscreen mode, do not close
312
+ if (this.element.bib.hasAttribute('isfullscreen')) {
292
313
  return;
293
314
  }
294
315