sweetalert2 11.26.2 → 11.26.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/src/types.js CHANGED
@@ -26,6 +26,7 @@
26
26
  * @property {boolean} [keydownHandlerAdded]
27
27
  * @property {boolean} [keydownListenerCapture]
28
28
  * @property {() => void} [swalCloseEventFinishedCallback]
29
+ * @property {boolean} [isRTL]
29
30
  */
30
31
 
31
32
  /**
@@ -118,6 +118,7 @@ const setupAccessibility = (params) => {
118
118
  const setupRTL = (targetElement) => {
119
119
  if (window.getComputedStyle(targetElement).direction === 'rtl') {
120
120
  addClass(getContainer(), swalClasses.rtl)
121
+ globalState.isRTL = true
121
122
  }
122
123
  }
123
124
 
@@ -1,3 +1,4 @@
1
+ import globalState from '../globalState.js'
1
2
  import * as dom from './dom/index.js'
2
3
 
3
4
  let dragging = false
@@ -57,7 +58,9 @@ const move = (event) => {
57
58
 
58
59
  if (dragging) {
59
60
  let { clientX, clientY } = getClientXY(event)
60
- popup.style.insetInlineStart = `${initialX + (clientX - mousedownX)}px`
61
+ const deltaX = clientX - mousedownX
62
+ // In RTL mode, negate the horizontal delta since insetInlineStart refers to the right edge
63
+ popup.style.insetInlineStart = `${initialX + (globalState.isRTL ? -deltaX : deltaX)}px`
61
64
  popup.style.insetBlockStart = `${initialY + (clientY - mousedownY)}px`
62
65
  }
63
66
  }
package/sweetalert2.d.ts CHANGED
@@ -322,14 +322,14 @@ declare module 'sweetalert2' {
322
322
  function argsToParams(params: SweetAlertArrayOptions | readonly [SweetAlertOptions]): SweetAlertOptions
323
323
 
324
324
  /**
325
- * An enum of possible reasons that can explain an alert dismissal.
326
- */
327
- enum DismissReason {
328
- cancel,
329
- backdrop,
330
- close,
331
- esc,
332
- timer,
325
+ * An object of possible reasons that can explain an alert dismissal.
326
+ */
327
+ const DismissReason: {
328
+ readonly cancel: 'cancel'
329
+ readonly backdrop: 'backdrop'
330
+ readonly close: 'close'
331
+ readonly esc: 'esc'
332
+ readonly timer: 'timer'
333
333
  }
334
334
 
335
335
  /**