@appius-fr/apx 2.6.0 → 2.6.1
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/dist/APX.dev.mjs +263 -5
- package/dist/APX.mjs +1 -1
- package/dist/APX.prod.mjs +1 -1
- package/dist/APX.standalone.js +276 -4
- package/dist/APX.standalone.js.map +1 -1
- package/modules/toast/README.md +31 -5
- package/modules/toast/css/toast.css +85 -0
- package/modules/toast/toast.mjs +176 -3
- package/package.json +1 -1
package/dist/APX.standalone.js
CHANGED
|
@@ -247,6 +247,91 @@ ___CSS_LOADER_EXPORT___.push([module.id, `.APX-toast-container {
|
|
|
247
247
|
font-size: 16px; line-height: 1; text-align: center;
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
+
/* Progress bar (outside content, flush to toast edges) */
|
|
251
|
+
.APX-toast__progress {
|
|
252
|
+
position: absolute;
|
|
253
|
+
left: 0;
|
|
254
|
+
right: 0;
|
|
255
|
+
height: var(--apx-toast-progress-height, 4px);
|
|
256
|
+
display: flex;
|
|
257
|
+
flex-direction: row;
|
|
258
|
+
align-items: stretch;
|
|
259
|
+
flex-shrink: 0;
|
|
260
|
+
border-radius: inherit;
|
|
261
|
+
overflow: visible;
|
|
262
|
+
}
|
|
263
|
+
.APX-toast__progress--top {
|
|
264
|
+
top: 0;
|
|
265
|
+
border-radius: var(--apx-toast-radius, 6px) var(--apx-toast-radius, 6px) 0 0;
|
|
266
|
+
}
|
|
267
|
+
.APX-toast__progress--bottom {
|
|
268
|
+
bottom: 0;
|
|
269
|
+
border-radius: 0 0 var(--apx-toast-radius, 6px) var(--apx-toast-radius, 6px);
|
|
270
|
+
}
|
|
271
|
+
/* Track contains the bar; no margin (pause button is on the corner, overlapping) */
|
|
272
|
+
.APX-toast__progress-track {
|
|
273
|
+
flex: 1;
|
|
274
|
+
min-width: 0;
|
|
275
|
+
overflow: hidden;
|
|
276
|
+
}
|
|
277
|
+
.APX-toast__progress-bar {
|
|
278
|
+
height: 100%;
|
|
279
|
+
width: 100%;
|
|
280
|
+
max-width: 100%;
|
|
281
|
+
transition: width 80ms linear;
|
|
282
|
+
background: rgba(0, 0, 0, 0.25);
|
|
283
|
+
}
|
|
284
|
+
.APX-toast--info .APX-toast__progress-bar { background: rgba(5, 44, 101, 0.5); }
|
|
285
|
+
.APX-toast--success .APX-toast__progress-bar { background: rgba(0, 0, 0, 0.25); }
|
|
286
|
+
.APX-toast--warning .APX-toast__progress-bar { background: rgba(102, 77, 3, 0.5); }
|
|
287
|
+
.APX-toast--danger .APX-toast__progress-bar { background: rgba(0, 0, 0, 0.25); }
|
|
288
|
+
/* Pause/Resume button: round, center exactly on toast corner (top-left or bottom-left) */
|
|
289
|
+
.APX-toast__progress-pause {
|
|
290
|
+
position: absolute;
|
|
291
|
+
width: var(--apx-toast-progress-pause-size, 18px);
|
|
292
|
+
height: var(--apx-toast-progress-pause-size, 18px);
|
|
293
|
+
left: 0;
|
|
294
|
+
display: inline-flex;
|
|
295
|
+
align-items: center;
|
|
296
|
+
justify-content: center;
|
|
297
|
+
background: #eee;
|
|
298
|
+
color: currentColor;
|
|
299
|
+
border: 1px solid rgba(0, 0, 0, 0.35);
|
|
300
|
+
border-radius: 50%;
|
|
301
|
+
padding: 0;
|
|
302
|
+
margin: 0;
|
|
303
|
+
cursor: pointer;
|
|
304
|
+
line-height: 1;
|
|
305
|
+
opacity: 0.95;
|
|
306
|
+
transition: opacity 120ms ease;
|
|
307
|
+
flex-shrink: 0;
|
|
308
|
+
}
|
|
309
|
+
.APX-toast__progress--top .APX-toast__progress-pause {
|
|
310
|
+
top: 0;
|
|
311
|
+
transform: translate(-50%, -50%);
|
|
312
|
+
}
|
|
313
|
+
.APX-toast__progress--bottom .APX-toast__progress-pause {
|
|
314
|
+
bottom: 0;
|
|
315
|
+
transform: translate(-50%, 50%);
|
|
316
|
+
}
|
|
317
|
+
.APX-toast--info .APX-toast__progress-pause { background: var(--apx-toast-info-bg, #0dcaf0); border-color: rgba(5, 44, 101, 0.55); }
|
|
318
|
+
.APX-toast--success .APX-toast__progress-pause { background: var(--apx-toast-success-bg, #198754); border-color: rgba(0, 0, 0, 0.3); }
|
|
319
|
+
.APX-toast--warning .APX-toast__progress-pause { background: var(--apx-toast-warning-bg, #ffc107); border-color: rgba(102, 77, 3, 0.6); }
|
|
320
|
+
.APX-toast--danger .APX-toast__progress-pause { background: var(--apx-toast-danger-bg, #dc3545); border-color: rgba(0, 0, 0, 0.35); }
|
|
321
|
+
.APX-toast__progress-pause:hover { opacity: 1; }
|
|
322
|
+
.APX-toast__progress-pause:focus { outline: 2px solid rgba(0,0,0,.4); outline-offset: -2px; }
|
|
323
|
+
.APX-toast__progress-pause svg {
|
|
324
|
+
width: 10px;
|
|
325
|
+
height: 10px;
|
|
326
|
+
display: block;
|
|
327
|
+
}
|
|
328
|
+
/* Extra top/bottom padding when progress bar is present (default content padding 10px + bar height) */
|
|
329
|
+
.APX-toast--has-progress-top { padding-top: calc(10px + var(--apx-toast-progress-height, 4px)); }
|
|
330
|
+
.APX-toast--has-progress-bottom { padding-bottom: calc(10px + var(--apx-toast-progress-height, 4px)); }
|
|
331
|
+
/* Reserve space for stacking when pause button is present (button extends outside toast corner) */
|
|
332
|
+
.APX-toast--has-progress-top.APX-toast--has-progress-pause { margin-top: calc(var(--apx-toast-progress-pause-size, 18px) / 2); }
|
|
333
|
+
.APX-toast--has-progress-bottom.APX-toast--has-progress-pause { margin-bottom: calc(var(--apx-toast-progress-pause-size, 18px) / 2); }
|
|
334
|
+
|
|
250
335
|
/* Animations */
|
|
251
336
|
.APX-toast--enter { opacity: 0; transform: translateY(8px); }
|
|
252
337
|
.APX-toast--enter.APX-toast--enter-active { opacity: 1; transform: translateY(0); }
|
|
@@ -254,7 +339,7 @@ ___CSS_LOADER_EXPORT___.push([module.id, `.APX-toast-container {
|
|
|
254
339
|
.APX-toast--exit.APX-toast--exit-active { opacity: 0; transform: translateY(8px); }
|
|
255
340
|
|
|
256
341
|
|
|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AAU,EAAE,wBAAwB,EAAE;AAClF,mBAAmB,UAAU,EAAE,wBAAwB,EAAE;AACzD,0CAA0C,UAAU,EAAE,0BAA0B,EAAE","sourcesContent":[".APX-toast-container {\r\n position: fixed;\r\n display: flex;\r\n flex-direction: column;\r\n gap: var(--apx-toast-gap, 8px);\r\n z-index: var(--apx-toast-z-index, 11000);\r\n pointer-events: none;\r\n}\r\n\r\n.APX-toast-container--bottom-right { right: 12px; bottom: 12px; align-items: flex-end; }\r\n.APX-toast-container--bottom-left { left: 12px; bottom: 12px; align-items: flex-start; }\r\n.APX-toast-container--top-right { right: 12px; top: 12px; align-items: flex-end; }\r\n.APX-toast-container--top-left { left: 12px; top: 12px; align-items: flex-start; }\r\n\r\n.APX-toast {\r\n min-width: var(--apx-toast-min-width, 260px);\r\n max-width: var(--apx-toast-max-width, 420px);\r\n font-size: var(--apx-toast-font-size, 14px);\r\n border-radius: var(--apx-toast-radius, 6px);\r\n box-shadow: var(--apx-toast-shadow, 0 6px 24px rgba(0,0,0,0.2));\r\n padding: var(--apx-toast-padding, 10px 42px 10px 14px);\r\n color: #111;\r\n background: #eee;\r\n pointer-events: auto;\r\n position: relative;\r\n transition: opacity 180ms ease, transform 180ms ease;\r\n}\r\n\r\n.APX-toast--info { background: var(--apx-toast-info-bg, #0dcaf0); color: var(--apx-toast-info-fg, #052c65); }\r\n.APX-toast--success { background: var(--apx-toast-success-bg, #198754); color: var(--apx-toast-success-fg, #ffffff); }\r\n.APX-toast--warning { background: var(--apx-toast-warning-bg, #ffc107); color: var(--apx-toast-warning-fg, #664d03); }\r\n.APX-toast--danger { background: var(--apx-toast-danger-bg, #dc3545); color: var(--apx-toast-danger-fg, #ffffff); }\r\n\r\n.APX-toast__content { line-height: 1.35; }\r\n\r\n.APX-toast__close {\r\n position: absolute;\r\n top: 50%; right: 10px;\r\n width: 24px; height: 24px;\r\n transform: translateY(-50%);\r\n display: inline-flex; align-items: center; justify-content: center;\r\n background: transparent; color: currentColor;\r\n border: 0; border-radius: 4px; padding: 0; margin: 0;\r\n cursor: pointer; appearance: none; -webkit-appearance: none;\r\n opacity: .75; transition: opacity 120ms ease;\r\n}\r\n.APX-toast__close:hover { opacity: 1; }\r\n.APX-toast__close:focus { outline: 2px solid rgba(0,0,0,.2); outline-offset: 2px; }\r\n.APX-toast__close::before {\r\n content: '×';\r\n font-size: 16px; line-height: 1; text-align: center;\r\n}\r\n\r\n/* Animations */\r\n.APX-toast--enter { opacity: 0; transform: translateY(8px); }\r\n.APX-toast--enter.APX-toast--enter-active { opacity: 1; transform: translateY(0); }\r\n.APX-toast--exit { opacity: 1; transform: translateY(0); }\r\n.APX-toast--exit.APX-toast--exit-active { opacity: 0; transform: translateY(8px); }\r\n\r\n\r\n"],"sourceRoot":""}]);
|
|
342
|
+
`, "",{"version":3,"sources":["webpack://./modules/toast/css/toast.css"],"names":[],"mappings":"AAAA;IACI,eAAe;IACf,aAAa;IACb,sBAAsB;IACtB,8BAA8B;IAC9B,wCAAwC;IACxC,oBAAoB;AACxB;;AAEA,qCAAqC,WAAW,EAAE,YAAY,EAAE,qBAAqB,EAAE;AACvF,oCAAoC,UAAU,EAAE,YAAY,EAAE,uBAAuB,EAAE;AACvF,kCAAkC,WAAW,EAAE,SAAS,EAAE,qBAAqB,EAAE;AACjF,iCAAiC,UAAU,EAAE,SAAS,EAAE,uBAAuB,EAAE;;AAEjF;IACI,4CAA4C;IAC5C,4CAA4C;IAC5C,2CAA2C;IAC3C,2CAA2C;IAC3C,+DAA+D;IAC/D,sDAAsD;IACtD,WAAW;IACX,gBAAgB;IAChB,oBAAoB;IACpB,kBAAkB;IAClB,oDAAoD;AACxD;;AAEA,mBAAmB,6CAA6C,EAAE,wCAAwC,EAAE;AAC5G,sBAAsB,gDAAgD,EAAE,2CAA2C,EAAE;AACrH,sBAAsB,gDAAgD,EAAE,2CAA2C,EAAE;AACrH,qBAAqB,+CAA+C,EAAE,0CAA0C,EAAE;;AAElH,sBAAsB,iBAAiB,EAAE;;AAE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8C,6CAA6C,EAAE,oCAAoC,EAAE;AACnI,iDAAiD,gDAAgD,EAAE,gCAAgC,EAAE;AACrI,iDAAiD,gDAAgD,EAAE,mCAAmC,EAAE;AACxI,gDAAgD,+CAA+C,EAAE,iCAAiC,EAAE;AACpI,mCAAmC,UAAU,EAAE;AAC/C,mCAAmC,iCAAiC,EAAE,oBAAoB,EAAE;AAC5F;IACI,WAAW;IACX,YAAY;IACZ,cAAc;AAClB;AACA,sGAAsG;AACtG,+BAA+B,+DAA+D,EAAE;AAChG,kCAAkC,kEAAkE,EAAE;AACtG,kGAAkG;AAClG,6DAA6D,gEAAgE,EAAE;AAC/H,gEAAgE,mEAAmE,EAAE;;AAErI,eAAe;AACf,oBAAoB,UAAU,EAAE,0BAA0B,EAAE;AAC5D,4CAA4C,UAAU,EAAE,wBAAwB,EAAE;AAClF,mBAAmB,UAAU,EAAE,wBAAwB,EAAE;AACzD,0CAA0C,UAAU,EAAE,0BAA0B,EAAE","sourcesContent":[".APX-toast-container {\r\n position: fixed;\r\n display: flex;\r\n flex-direction: column;\r\n gap: var(--apx-toast-gap, 8px);\r\n z-index: var(--apx-toast-z-index, 11000);\r\n pointer-events: none;\r\n}\r\n\r\n.APX-toast-container--bottom-right { right: 12px; bottom: 12px; align-items: flex-end; }\r\n.APX-toast-container--bottom-left { left: 12px; bottom: 12px; align-items: flex-start; }\r\n.APX-toast-container--top-right { right: 12px; top: 12px; align-items: flex-end; }\r\n.APX-toast-container--top-left { left: 12px; top: 12px; align-items: flex-start; }\r\n\r\n.APX-toast {\r\n min-width: var(--apx-toast-min-width, 260px);\r\n max-width: var(--apx-toast-max-width, 420px);\r\n font-size: var(--apx-toast-font-size, 14px);\r\n border-radius: var(--apx-toast-radius, 6px);\r\n box-shadow: var(--apx-toast-shadow, 0 6px 24px rgba(0,0,0,0.2));\r\n padding: var(--apx-toast-padding, 10px 42px 10px 14px);\r\n color: #111;\r\n background: #eee;\r\n pointer-events: auto;\r\n position: relative;\r\n transition: opacity 180ms ease, transform 180ms ease;\r\n}\r\n\r\n.APX-toast--info { background: var(--apx-toast-info-bg, #0dcaf0); color: var(--apx-toast-info-fg, #052c65); }\r\n.APX-toast--success { background: var(--apx-toast-success-bg, #198754); color: var(--apx-toast-success-fg, #ffffff); }\r\n.APX-toast--warning { background: var(--apx-toast-warning-bg, #ffc107); color: var(--apx-toast-warning-fg, #664d03); }\r\n.APX-toast--danger { background: var(--apx-toast-danger-bg, #dc3545); color: var(--apx-toast-danger-fg, #ffffff); }\r\n\r\n.APX-toast__content { line-height: 1.35; }\r\n\r\n.APX-toast__close {\r\n position: absolute;\r\n top: 50%; right: 10px;\r\n width: 24px; height: 24px;\r\n transform: translateY(-50%);\r\n display: inline-flex; align-items: center; justify-content: center;\r\n background: transparent; color: currentColor;\r\n border: 0; border-radius: 4px; padding: 0; margin: 0;\r\n cursor: pointer; appearance: none; -webkit-appearance: none;\r\n opacity: .75; transition: opacity 120ms ease;\r\n}\r\n.APX-toast__close:hover { opacity: 1; }\r\n.APX-toast__close:focus { outline: 2px solid rgba(0,0,0,.2); outline-offset: 2px; }\r\n.APX-toast__close::before {\r\n content: '×';\r\n font-size: 16px; line-height: 1; text-align: center;\r\n}\r\n\r\n/* Progress bar (outside content, flush to toast edges) */\r\n.APX-toast__progress {\r\n position: absolute;\r\n left: 0;\r\n right: 0;\r\n height: var(--apx-toast-progress-height, 4px);\r\n display: flex;\r\n flex-direction: row;\r\n align-items: stretch;\r\n flex-shrink: 0;\r\n border-radius: inherit;\r\n overflow: visible;\r\n}\r\n.APX-toast__progress--top {\r\n top: 0;\r\n border-radius: var(--apx-toast-radius, 6px) var(--apx-toast-radius, 6px) 0 0;\r\n}\r\n.APX-toast__progress--bottom {\r\n bottom: 0;\r\n border-radius: 0 0 var(--apx-toast-radius, 6px) var(--apx-toast-radius, 6px);\r\n}\r\n/* Track contains the bar; no margin (pause button is on the corner, overlapping) */\r\n.APX-toast__progress-track {\r\n flex: 1;\r\n min-width: 0;\r\n overflow: hidden;\r\n}\r\n.APX-toast__progress-bar {\r\n height: 100%;\r\n width: 100%;\r\n max-width: 100%;\r\n transition: width 80ms linear;\r\n background: rgba(0, 0, 0, 0.25);\r\n}\r\n.APX-toast--info .APX-toast__progress-bar { background: rgba(5, 44, 101, 0.5); }\r\n.APX-toast--success .APX-toast__progress-bar { background: rgba(0, 0, 0, 0.25); }\r\n.APX-toast--warning .APX-toast__progress-bar { background: rgba(102, 77, 3, 0.5); }\r\n.APX-toast--danger .APX-toast__progress-bar { background: rgba(0, 0, 0, 0.25); }\r\n/* Pause/Resume button: round, center exactly on toast corner (top-left or bottom-left) */\r\n.APX-toast__progress-pause {\r\n position: absolute;\r\n width: var(--apx-toast-progress-pause-size, 18px);\r\n height: var(--apx-toast-progress-pause-size, 18px);\r\n left: 0;\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n background: #eee;\r\n color: currentColor;\r\n border: 1px solid rgba(0, 0, 0, 0.35);\r\n border-radius: 50%;\r\n padding: 0;\r\n margin: 0;\r\n cursor: pointer;\r\n line-height: 1;\r\n opacity: 0.95;\r\n transition: opacity 120ms ease;\r\n flex-shrink: 0;\r\n}\r\n.APX-toast__progress--top .APX-toast__progress-pause {\r\n top: 0;\r\n transform: translate(-50%, -50%);\r\n}\r\n.APX-toast__progress--bottom .APX-toast__progress-pause {\r\n bottom: 0;\r\n transform: translate(-50%, 50%);\r\n}\r\n.APX-toast--info .APX-toast__progress-pause { background: var(--apx-toast-info-bg, #0dcaf0); border-color: rgba(5, 44, 101, 0.55); }\r\n.APX-toast--success .APX-toast__progress-pause { background: var(--apx-toast-success-bg, #198754); border-color: rgba(0, 0, 0, 0.3); }\r\n.APX-toast--warning .APX-toast__progress-pause { background: var(--apx-toast-warning-bg, #ffc107); border-color: rgba(102, 77, 3, 0.6); }\r\n.APX-toast--danger .APX-toast__progress-pause { background: var(--apx-toast-danger-bg, #dc3545); border-color: rgba(0, 0, 0, 0.35); }\r\n.APX-toast__progress-pause:hover { opacity: 1; }\r\n.APX-toast__progress-pause:focus { outline: 2px solid rgba(0,0,0,.4); outline-offset: -2px; }\r\n.APX-toast__progress-pause svg {\r\n width: 10px;\r\n height: 10px;\r\n display: block;\r\n}\r\n/* Extra top/bottom padding when progress bar is present (default content padding 10px + bar height) */\r\n.APX-toast--has-progress-top { padding-top: calc(10px + var(--apx-toast-progress-height, 4px)); }\r\n.APX-toast--has-progress-bottom { padding-bottom: calc(10px + var(--apx-toast-progress-height, 4px)); }\r\n/* Reserve space for stacking when pause button is present (button extends outside toast corner) */\r\n.APX-toast--has-progress-top.APX-toast--has-progress-pause { margin-top: calc(var(--apx-toast-progress-pause-size, 18px) / 2); }\r\n.APX-toast--has-progress-bottom.APX-toast--has-progress-pause { margin-bottom: calc(var(--apx-toast-progress-pause-size, 18px) / 2); }\r\n\r\n/* Animations */\r\n.APX-toast--enter { opacity: 0; transform: translateY(8px); }\r\n.APX-toast--enter.APX-toast--enter-active { opacity: 1; transform: translateY(0); }\r\n.APX-toast--exit { opacity: 1; transform: translateY(0); }\r\n.APX-toast--exit.APX-toast--exit-active { opacity: 0; transform: translateY(8px); }\r\n\r\n\r\n"],"sourceRoot":""}]);
|
|
258
343
|
// Exports
|
|
259
344
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
|
|
260
345
|
|
|
@@ -1659,6 +1744,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1659
1744
|
* @property {string} [containerClass]
|
|
1660
1745
|
* @property {number} [offset]
|
|
1661
1746
|
* @property {string} [id]
|
|
1747
|
+
* @property {boolean|{enable: boolean, position: 'top'|'bottom'}} [progress] Default: false. Show progress bar when true or { enable: true, position: 'top'|'bottom' }.
|
|
1748
|
+
*/
|
|
1749
|
+
|
|
1750
|
+
/**
|
|
1751
|
+
* @typedef {{enable: boolean, position: 'top'|'bottom', pauseButton: boolean}} ProgressOpt
|
|
1662
1752
|
*/
|
|
1663
1753
|
|
|
1664
1754
|
/**
|
|
@@ -1673,6 +1763,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1673
1763
|
* @property {string} [className]
|
|
1674
1764
|
* @property {Position} [position]
|
|
1675
1765
|
* @property {'up'|'down'|'auto'} [flow] Flow direction for stacking toasts. 'auto' determines based on position. Default: 'auto'
|
|
1766
|
+
* @property {boolean|{enable: boolean, position: 'top'|'bottom', pauseButton?: boolean}} [progress] Show progress bar: true = top, or { enable, position, pauseButton } (pauseButton default false).
|
|
1676
1767
|
*/
|
|
1677
1768
|
|
|
1678
1769
|
/**
|
|
@@ -1730,7 +1821,8 @@ var DEFAULT_CONFIG = {
|
|
|
1730
1821
|
gap: 8,
|
|
1731
1822
|
dedupe: false,
|
|
1732
1823
|
containerClass: '',
|
|
1733
|
-
offset: 0
|
|
1824
|
+
offset: 0,
|
|
1825
|
+
progress: false
|
|
1734
1826
|
};
|
|
1735
1827
|
|
|
1736
1828
|
/**
|
|
@@ -1746,6 +1838,117 @@ function createEl(tag, classNames) {
|
|
|
1746
1838
|
return el;
|
|
1747
1839
|
}
|
|
1748
1840
|
|
|
1841
|
+
/** Minimal line-based pause (two bars) / resume (triangle right) icon SVG. Uses currentColor. */
|
|
1842
|
+
function getProgressPauseResumeIconSVG(paused) {
|
|
1843
|
+
if (paused) {
|
|
1844
|
+
return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\"><path d=\"M8 6L8 18L17 12Z\"/></svg>";
|
|
1845
|
+
}
|
|
1846
|
+
return "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\"><line x1=\"9\" y1=\"6\" x2=\"9\" y2=\"18\"/><line x1=\"15\" y1=\"6\" x2=\"15\" y2=\"18\"/></svg>";
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
/**
|
|
1850
|
+
* Create and insert progress block (track + bar, optional pause button) into toast. Button is fixed at left via track layout.
|
|
1851
|
+
* @param {HTMLElement} toastEl
|
|
1852
|
+
* @param {HTMLElement} contentEl
|
|
1853
|
+
* @param {HTMLElement|null} closeBtn
|
|
1854
|
+
* @param {ProgressOpt} progressOpt
|
|
1855
|
+
* @returns {{ wrap: HTMLElement, bar: HTMLElement, pauseBtn: HTMLElement|null }}
|
|
1856
|
+
*/
|
|
1857
|
+
function createProgressBlock(toastEl, contentEl, closeBtn, progressOpt) {
|
|
1858
|
+
var pos = progressOpt.position;
|
|
1859
|
+
var showPauseButton = progressOpt.pauseButton === true;
|
|
1860
|
+
var wrap = createEl('div', "APX-toast__progress APX-toast__progress--".concat(pos));
|
|
1861
|
+
var track = createEl('div', 'APX-toast__progress-track');
|
|
1862
|
+
var bar = createEl('div', 'APX-toast__progress-bar');
|
|
1863
|
+
bar.setAttribute('role', 'progressbar');
|
|
1864
|
+
bar.setAttribute('aria-valuemin', '0');
|
|
1865
|
+
bar.setAttribute('aria-valuemax', '100');
|
|
1866
|
+
bar.setAttribute('aria-label', 'Temps restant');
|
|
1867
|
+
bar.setAttribute('aria-valuenow', '100');
|
|
1868
|
+
bar.style.width = '100%';
|
|
1869
|
+
track.appendChild(bar);
|
|
1870
|
+
wrap.appendChild(track);
|
|
1871
|
+
var pauseBtn = null;
|
|
1872
|
+
if (showPauseButton) {
|
|
1873
|
+
pauseBtn = createEl('button', 'APX-toast__progress-pause');
|
|
1874
|
+
pauseBtn.type = 'button';
|
|
1875
|
+
pauseBtn.setAttribute('aria-label', 'Pause');
|
|
1876
|
+
pauseBtn.setAttribute('title', 'Pause');
|
|
1877
|
+
pauseBtn.innerHTML = getProgressPauseResumeIconSVG(false); // running = show pause icon
|
|
1878
|
+
wrap.insertBefore(pauseBtn, track);
|
|
1879
|
+
}
|
|
1880
|
+
if (pos === 'top') {
|
|
1881
|
+
toastEl.insertBefore(wrap, contentEl);
|
|
1882
|
+
toastEl.classList.add('APX-toast--has-progress-top');
|
|
1883
|
+
} else {
|
|
1884
|
+
toastEl.insertBefore(wrap, closeBtn);
|
|
1885
|
+
toastEl.classList.add('APX-toast--has-progress-bottom');
|
|
1886
|
+
}
|
|
1887
|
+
if (showPauseButton) toastEl.classList.add('APX-toast--has-progress-pause');
|
|
1888
|
+
return {
|
|
1889
|
+
wrap: wrap,
|
|
1890
|
+
bar: bar,
|
|
1891
|
+
pauseBtn: pauseBtn
|
|
1892
|
+
};
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
/**
|
|
1896
|
+
* Update progress block position (classes + DOM order)
|
|
1897
|
+
* @param {HTMLElement} toastEl
|
|
1898
|
+
* @param {HTMLElement} progressWrap
|
|
1899
|
+
* @param {HTMLElement} contentEl
|
|
1900
|
+
* @param {HTMLElement|null} closeBtn
|
|
1901
|
+
* @param {'top'|'bottom'} pos
|
|
1902
|
+
*/
|
|
1903
|
+
function applyProgressPosition(toastEl, progressWrap, contentEl, closeBtn, pos) {
|
|
1904
|
+
toastEl.classList.remove('APX-toast--has-progress-top', 'APX-toast--has-progress-bottom');
|
|
1905
|
+
toastEl.classList.add(pos === 'top' ? 'APX-toast--has-progress-top' : 'APX-toast--has-progress-bottom');
|
|
1906
|
+
progressWrap.classList.remove('APX-toast__progress--top', 'APX-toast__progress--bottom');
|
|
1907
|
+
progressWrap.classList.add("APX-toast__progress--".concat(pos));
|
|
1908
|
+
var target = pos === 'top' ? contentEl : closeBtn;
|
|
1909
|
+
if (progressWrap.nextElementSibling !== target) toastEl.insertBefore(progressWrap, target);
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
/**
|
|
1913
|
+
* Resolve progress option from per-call option and config default
|
|
1914
|
+
* @param {boolean|{enable: boolean, position: 'top'|'bottom'}|undefined} option
|
|
1915
|
+
* @param {boolean|{enable: boolean, position: 'top'|'bottom'}|undefined} configDefault
|
|
1916
|
+
* @returns {ProgressOpt}
|
|
1917
|
+
*/
|
|
1918
|
+
function resolveProgress(option, configDefault) {
|
|
1919
|
+
var fromConfig = configDefault === true ? {
|
|
1920
|
+
enable: true,
|
|
1921
|
+
position: 'top',
|
|
1922
|
+
pauseButton: false
|
|
1923
|
+
} : configDefault && _typeof(configDefault) === 'object' ? {
|
|
1924
|
+
enable: !!configDefault.enable,
|
|
1925
|
+
position: configDefault.position === 'bottom' ? 'bottom' : 'top',
|
|
1926
|
+
pauseButton: configDefault.pauseButton === true
|
|
1927
|
+
} : {
|
|
1928
|
+
enable: false,
|
|
1929
|
+
position: 'top',
|
|
1930
|
+
pauseButton: false
|
|
1931
|
+
};
|
|
1932
|
+
if (option === undefined || option === null) return fromConfig;
|
|
1933
|
+
if (option === true) return {
|
|
1934
|
+
enable: true,
|
|
1935
|
+
position: 'top',
|
|
1936
|
+
pauseButton: false
|
|
1937
|
+
};
|
|
1938
|
+
if (_typeof(option) === 'object') {
|
|
1939
|
+
return {
|
|
1940
|
+
enable: !!option.enable,
|
|
1941
|
+
position: option.position === 'bottom' ? 'bottom' : 'top',
|
|
1942
|
+
pauseButton: option.pauseButton === true
|
|
1943
|
+
};
|
|
1944
|
+
}
|
|
1945
|
+
return {
|
|
1946
|
+
enable: false,
|
|
1947
|
+
position: 'top',
|
|
1948
|
+
pauseButton: false
|
|
1949
|
+
};
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1749
1952
|
/**
|
|
1750
1953
|
* Normalize placement synonyms to CSS values
|
|
1751
1954
|
* @param {string} placement
|
|
@@ -2016,6 +2219,15 @@ var ToastManager = /*#__PURE__*/function () {
|
|
|
2016
2219
|
closeBtn.type = 'button';
|
|
2017
2220
|
toastEl.appendChild(closeBtn);
|
|
2018
2221
|
}
|
|
2222
|
+
var progressWrap = null;
|
|
2223
|
+
var progressBarEl = null;
|
|
2224
|
+
var progressPauseBtn = null;
|
|
2225
|
+
if (options.progress.enable && options.durationMs > 0) {
|
|
2226
|
+
var created = createProgressBlock(toastEl, contentEl, closeBtn, options.progress);
|
|
2227
|
+
progressWrap = created.wrap;
|
|
2228
|
+
progressBarEl = created.bar;
|
|
2229
|
+
progressPauseBtn = created.pauseBtn;
|
|
2230
|
+
}
|
|
2019
2231
|
|
|
2020
2232
|
// Get or create container for this specific position
|
|
2021
2233
|
var container = null;
|
|
@@ -2193,6 +2405,8 @@ var ToastManager = /*#__PURE__*/function () {
|
|
|
2193
2405
|
var remaining = options.durationMs;
|
|
2194
2406
|
var timerId = null;
|
|
2195
2407
|
var startTs = null;
|
|
2408
|
+
var userPaused = false;
|
|
2409
|
+
var progressRafId = null;
|
|
2196
2410
|
var handlers = {
|
|
2197
2411
|
click: new Set(),
|
|
2198
2412
|
close: new Set()
|
|
@@ -2203,6 +2417,19 @@ var ToastManager = /*#__PURE__*/function () {
|
|
|
2203
2417
|
timerId = window.setTimeout(function () {
|
|
2204
2418
|
return ref.close('timeout');
|
|
2205
2419
|
}, remaining);
|
|
2420
|
+
if (progressBarEl) {
|
|
2421
|
+
var tick = function tick() {
|
|
2422
|
+
if (timerId == null || startTs == null) return;
|
|
2423
|
+
var elapsed = Date.now() - startTs;
|
|
2424
|
+
var remainingMs = Math.max(0, remaining - elapsed);
|
|
2425
|
+
var durationMs = options.durationMs;
|
|
2426
|
+
var pct = durationMs > 0 ? Math.max(0, Math.min(100, remainingMs / durationMs * 100)) : 0;
|
|
2427
|
+
progressBarEl.style.width = "".concat(pct, "%");
|
|
2428
|
+
progressBarEl.setAttribute('aria-valuenow', String(Math.round(pct)));
|
|
2429
|
+
progressRafId = requestAnimationFrame(tick);
|
|
2430
|
+
};
|
|
2431
|
+
progressRafId = requestAnimationFrame(tick);
|
|
2432
|
+
}
|
|
2206
2433
|
};
|
|
2207
2434
|
var pauseTimer = function pauseTimer() {
|
|
2208
2435
|
if (timerId != null) {
|
|
@@ -2210,6 +2437,21 @@ var ToastManager = /*#__PURE__*/function () {
|
|
|
2210
2437
|
timerId = null;
|
|
2211
2438
|
if (startTs != null) remaining -= Date.now() - startTs;
|
|
2212
2439
|
}
|
|
2440
|
+
if (progressRafId != null) {
|
|
2441
|
+
cancelAnimationFrame(progressRafId);
|
|
2442
|
+
progressRafId = null;
|
|
2443
|
+
}
|
|
2444
|
+
};
|
|
2445
|
+
var attachProgressPauseHandler = function attachProgressPauseHandler(btn) {
|
|
2446
|
+
btn.addEventListener('click', function (ev) {
|
|
2447
|
+
ev.stopPropagation();
|
|
2448
|
+
userPaused = !userPaused;
|
|
2449
|
+
if (userPaused) pauseTimer();else startTimer();
|
|
2450
|
+
var label = userPaused ? 'Reprendre' : 'Pause';
|
|
2451
|
+
btn.setAttribute('aria-label', label);
|
|
2452
|
+
btn.setAttribute('title', label);
|
|
2453
|
+
btn.innerHTML = getProgressPauseResumeIconSVG(userPaused); // paused = resume (triangle)
|
|
2454
|
+
});
|
|
2213
2455
|
};
|
|
2214
2456
|
|
|
2215
2457
|
/** @type {ToastRef} */
|
|
@@ -2239,9 +2481,34 @@ var ToastManager = /*#__PURE__*/function () {
|
|
|
2239
2481
|
if (options.className) (_toastEl$classList = toastEl.classList).remove.apply(_toastEl$classList, _toConsumableArray(options.className.split(' ').filter(Boolean)));
|
|
2240
2482
|
if (merged.className) (_toastEl$classList2 = toastEl.classList).add.apply(_toastEl$classList2, _toConsumableArray(merged.className.split(' ').filter(Boolean)));
|
|
2241
2483
|
}
|
|
2484
|
+
// update progress visibility/position
|
|
2485
|
+
options.progress = merged.progress;
|
|
2486
|
+
if (progressWrap) {
|
|
2487
|
+
if (!merged.progress.enable || merged.durationMs <= 0) {
|
|
2488
|
+
progressWrap.style.display = 'none';
|
|
2489
|
+
} else {
|
|
2490
|
+
progressWrap.style.display = '';
|
|
2491
|
+
applyProgressPosition(toastEl, progressWrap, contentEl, closeBtn, merged.progress.position);
|
|
2492
|
+
}
|
|
2493
|
+
} else if (merged.progress.enable && merged.durationMs > 0) {
|
|
2494
|
+
var _created = createProgressBlock(toastEl, contentEl, closeBtn, merged.progress);
|
|
2495
|
+
progressWrap = _created.wrap;
|
|
2496
|
+
progressBarEl = _created.bar;
|
|
2497
|
+
progressPauseBtn = _created.pauseBtn;
|
|
2498
|
+
if (progressPauseBtn) attachProgressPauseHandler(progressPauseBtn);
|
|
2499
|
+
}
|
|
2500
|
+
if (progressWrap && progressWrap.style.display !== 'none' && merged.progress.pauseButton === true) {
|
|
2501
|
+
toastEl.classList.add('APX-toast--has-progress-pause');
|
|
2502
|
+
} else {
|
|
2503
|
+
toastEl.classList.remove('APX-toast--has-progress-pause');
|
|
2504
|
+
}
|
|
2242
2505
|
// update duration logic
|
|
2243
2506
|
options.durationMs = merged.durationMs;
|
|
2244
2507
|
remaining = merged.durationMs;
|
|
2508
|
+
if (progressBarEl) {
|
|
2509
|
+
progressBarEl.style.width = '100%';
|
|
2510
|
+
progressBarEl.setAttribute('aria-valuenow', '100');
|
|
2511
|
+
}
|
|
2245
2512
|
pauseTimer();
|
|
2246
2513
|
startTimer();
|
|
2247
2514
|
},
|
|
@@ -2278,7 +2545,10 @@ var ToastManager = /*#__PURE__*/function () {
|
|
|
2278
2545
|
var cleanup = function cleanup(reason) {
|
|
2279
2546
|
if (!toastEl) return;
|
|
2280
2547
|
pauseTimer();
|
|
2281
|
-
|
|
2548
|
+
if (progressRafId != null) {
|
|
2549
|
+
cancelAnimationFrame(progressRafId);
|
|
2550
|
+
progressRafId = null;
|
|
2551
|
+
}
|
|
2282
2552
|
// Cleanup position listeners and restore styles
|
|
2283
2553
|
if (positionCleanup) {
|
|
2284
2554
|
positionCleanup();
|
|
@@ -2333,12 +2603,13 @@ var ToastManager = /*#__PURE__*/function () {
|
|
|
2333
2603
|
// Hover pause
|
|
2334
2604
|
toastEl.addEventListener('mouseenter', pauseTimer);
|
|
2335
2605
|
toastEl.addEventListener('mouseleave', function () {
|
|
2336
|
-
|
|
2606
|
+
if (!userPaused) startTimer();
|
|
2337
2607
|
});
|
|
2338
2608
|
if (closeBtn) closeBtn.addEventListener('click', function (ev) {
|
|
2339
2609
|
ev.stopPropagation();
|
|
2340
2610
|
ref.close('close');
|
|
2341
2611
|
});
|
|
2612
|
+
if (progressPauseBtn) attachProgressPauseHandler(progressPauseBtn);
|
|
2342
2613
|
|
|
2343
2614
|
// Track
|
|
2344
2615
|
this.open.push(ref);
|
|
@@ -2410,6 +2681,7 @@ var ToastManager = /*#__PURE__*/function () {
|
|
|
2410
2681
|
if (typeof o.durationMs !== 'number') o.durationMs = this.config.defaultDurationMs;
|
|
2411
2682
|
// Use id from options if provided, otherwise use id from config, otherwise undefined (will be auto-generated)
|
|
2412
2683
|
if (!o.id && this.config.id) o.id = this.config.id;
|
|
2684
|
+
o.progress = resolveProgress(opts.progress, this.config.progress);
|
|
2413
2685
|
return o;
|
|
2414
2686
|
}
|
|
2415
2687
|
|