arengibook 2.5.3 → 2.5.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 (2) hide show
  1. package/dist/index.js +32 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -42835,14 +42835,40 @@ var Toast = function Toast(_ref) {
42835
42835
  });
42836
42836
  };
42837
42837
 
42838
- // Fonction globale pour afficher un toast simplement
42839
- var showToast = function showToast(props) {
42840
- var container = document.createElement('div');
42841
- document.body.appendChild(container);
42842
- ReactDOM.render(/*#__PURE__*/React__default.createElement(Toast, props), container);
42838
+ // Singleton pour l'empilement des toasts
42839
+ var toastRef = null;
42840
+ var container = null;
42841
+ var ToastContainer = function ToastContainer() {
42842
+ var ref = useRef(null);
42843
+ useEffect(function () {
42844
+ toastRef = ref.current;
42845
+ }, []);
42846
+ return /*#__PURE__*/React__default.createElement(Toast$1, {
42847
+ ref: ref,
42848
+ position: "top-right"
42849
+ });
42843
42850
  };
42844
42851
 
42845
- // Expose globalement
42852
+ // Fonction globale simple
42853
+ var showToast = function showToast(props) {
42854
+ if (!container) {
42855
+ container = document.createElement('div');
42856
+ document.body.appendChild(container);
42857
+ ReactDOM.render(/*#__PURE__*/React__default.createElement(ToastContainer, null), container);
42858
+ }
42859
+ setTimeout(function () {
42860
+ if (toastRef) {
42861
+ toastRef.show({
42862
+ severity: props.type || 'info',
42863
+ summary: props.title || '',
42864
+ detail: props.message,
42865
+ life: props.duration || 3000,
42866
+ sticky: props.sticky,
42867
+ closable: props.closable !== false
42868
+ });
42869
+ }
42870
+ }, 0);
42871
+ };
42846
42872
  if (typeof window !== 'undefined') {
42847
42873
  window.showArengibookToast = showToast;
42848
42874
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "arengibook",
3
3
  "private": false,
4
- "version": "2.5.03",
4
+ "version": "2.5.04",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
7
7
  "exports": {