arengibook 2.5.3 → 2.5.5

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 +51 -7
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -42656,6 +42656,8 @@ styleInject(css_248z);
42656
42656
  var Toast = function Toast(_ref) {
42657
42657
  var icon = _ref.icon,
42658
42658
  message = _ref.message,
42659
+ _ref$enableHtmlConten = _ref.enableHtmlContent,
42660
+ enableHtmlContent = _ref$enableHtmlConten === void 0 ? false : _ref$enableHtmlConten,
42659
42661
  _ref$type = _ref.type,
42660
42662
  type = _ref$type === void 0 ? "info" : _ref$type,
42661
42663
  _ref$size = _ref.size,
@@ -42764,7 +42766,8 @@ var Toast = function Toast(_ref) {
42764
42766
  className: "toast-title"
42765
42767
  }, title), /*#__PURE__*/React__default.createElement("div", {
42766
42768
  className: "toast-message"
42767
- }, datetimecreation ? /*#__PURE__*/React__default.createElement("div", {
42769
+ }, enableHtmlContent ? /*#__PURE__*/React__default.createElement("div", {
42770
+ className: "toast-html-content",
42768
42771
  dangerouslySetInnerHTML: {
42769
42772
  __html: message
42770
42773
  }
@@ -42835,14 +42838,43 @@ var Toast = function Toast(_ref) {
42835
42838
  });
42836
42839
  };
42837
42840
 
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);
42841
+ // Singleton pour l'empilement des toasts
42842
+ var toastRef = null;
42843
+ var container = null;
42844
+ var ToastContainer = function ToastContainer() {
42845
+ var ref = useRef(null);
42846
+ useEffect(function () {
42847
+ toastRef = ref.current;
42848
+ }, []);
42849
+ return /*#__PURE__*/React__default.createElement(Toast$1, {
42850
+ ref: ref,
42851
+ position: "top-right"
42852
+ });
42843
42853
  };
42844
42854
 
42845
- // Expose globalement
42855
+ // Fonction globale simple
42856
+ var showToast = function showToast(props) {
42857
+ if (!container) {
42858
+ container = document.createElement('div');
42859
+ document.body.appendChild(container);
42860
+ ReactDOM.render(/*#__PURE__*/React__default.createElement(ToastContainer, null), container);
42861
+ }
42862
+ setTimeout(function () {
42863
+ if (toastRef) {
42864
+ toastRef.show({
42865
+ severity: props.type || 'info',
42866
+ life: props.duration || 3000,
42867
+ sticky: props.sticky,
42868
+ closable: props.closable !== false,
42869
+ content: function content() {
42870
+ return /*#__PURE__*/React__default.createElement(Toast, _extends$G({}, props, {
42871
+ autoShow: false
42872
+ }));
42873
+ }
42874
+ });
42875
+ }
42876
+ }, 0);
42877
+ };
42846
42878
  if (typeof window !== 'undefined') {
42847
42879
  window.showArengibookToast = showToast;
42848
42880
  }
@@ -42982,6 +43014,7 @@ var ToastPresets = {
42982
43014
  type: "processing",
42983
43015
  size: "L",
42984
43016
  title: "Tâche en cours",
43017
+ enableHtmlContent: true,
42985
43018
  datetimecreation: "12.01.2026 à 11h18",
42986
43019
  message: "Le programme a commencé le <strong>{{datetimecreation}}</strong>.\n\n" + "Vous serez averti par mail de la fin de son exécution.\n\n" + "Vous pouvez également suivre son exécution en cliquant sur ce lien.",
42987
43020
  closable: true,
@@ -43028,6 +43061,17 @@ var ToastPresets = {
43028
43061
  reShowOnPropsChange: true,
43029
43062
  sizeSModulable: true,
43030
43063
  enablePercentage: true
43064
+ },
43065
+ BackendHtmlContent: {
43066
+ type: "success",
43067
+ size: "L",
43068
+ title: "Résultat du traitement",
43069
+ enableHtmlContent: true,
43070
+ message: "\n <div style=\"display:flex; flex-direction:column; gap:0.75rem;\">\n <strong style=\"color:#16a34a;\">\n \u2714 Traitement termin\xE9 avec succ\xE8s\n </strong>\n\n <p>\n Le fichier a \xE9t\xE9 g\xE9n\xE9r\xE9 par le backend Symfony.\n </p>\n\n <a\n href=\"https://example.com/result\"\n target=\"_blank\"\n style=\"color:#2563eb; text-decoration:underline;\"\n >\n Voir le r\xE9sultat\n </a>\n\n <button\n style=\"\n margin-top:0.5rem;\n padding:0.4rem 0.75rem;\n background:#2563eb;\n color:white;\n border:none;\n border-radius:4px;\n cursor:pointer;\n \"\n onclick=\"alert('T\xE9l\xE9chargement d\xE9clench\xE9')\"\n >\n T\xE9l\xE9charger\n </button>\n </div>\n ",
43071
+ sticky: true,
43072
+ closable: true,
43073
+ autoShow: true,
43074
+ reShowOnPropsChange: true
43031
43075
  }
43032
43076
  };
43033
43077
 
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.05",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
7
7
  "exports": {
@@ -13,7 +13,7 @@
13
13
  ],
14
14
  "scripts": {
15
15
  "dev": "vite",
16
- "build": "rollup -cCh",
16
+ "build": "rollup -c",
17
17
  "lint": "eslint .",
18
18
  "preview": "vite preview",
19
19
  "storybook": "storybook dev -p 6006",