arengibook 2.5.507 → 2.5.509

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 +82 -41
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -42653,7 +42653,6 @@ Toast$1.displayName = 'Toast';
42653
42653
  var css_248z = ".p-toast-message {\n height:auto;\n}\n.p-toast-message.heightoastlarge {\n min-height:50px;\n}\n.p-toast-message.heightoastmedium {\n max-height:100px;\n overflow: hidden;\n}\n\n.p-toast-message.toast_s--compact {\n width: 116px;\n min-width: 56px;\n padding-right: 0;\n position: relative;\n}\n\n.p-toast-message.toast_s--compact .p-toast-message-content {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0.5rem;\n}\n\n.p-toast-message.toast_s--compact .maximize-button {\n margin-right: 20px;\n}\n\n.p-toast-message.toast_s--compact .p-toast-icon-close {\n position: absolute;\n top: 4px;\n right: 4px;\n}\n\n\n.p-toast-message.toast_s--large {\n width: auto;\n min-width: auto;\n padding-right: inherit;\n}\n\n.p-toast-message.toast_s--large .p-toast-message-content {\n display: flex;\n align-items: center;\n padding: 1rem;\n gap: 0.75rem;\n}\n\n.p-toast-message .maximize-button-container {\n margin-left: auto;\n display: flex;\n align-items: center;\n}\n\n.p-toast-message.toast_s--large .p-toast-icon-close {\n position: static;\n margin-left: 0.5rem;\n}\n\n/* Title */\n\n.toast-title {\n font-weight: 600;\n font-size: 0.95rem;\n line-height: 1.3;\n color: #111827; /* gris très foncé / quasi noir */\n margin-bottom: 0.25rem;\n}\n\n\n.toast-root {\n display: flex;\n align-items: flex-start;\n width: 100%;\n gap: 0.75rem;\n}\n.toast-left {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n flex-shrink: 0;\n}\n.toast-body {\n line-height: 1.4;\n}\n.toast-action-btn {\n background: transparent;\n border: none;\n cursor: pointer;\n padding: 0;\n}\n.p-toast-message-content {\n position: relative;\n}\n.p-toast-icon-close {\n position: static;\n}\n.toast-left .p-toast-icon-close {\n order: 3;\n}\n/* Toast - Percentage */\n.toast-percentage {\n margin-top: 0.5rem;\n width: 100%;\n}\n\n.toast-percentage-label {\n font-size: 0.875rem;\n color: #6b7280;\n margin-bottom: 0.25rem;\n text-align: right;\n width: 100%;\n}\n\n.toast-percentage-bar {\n height: 6px;\n background-color: #e5e7eb;\n border-radius: 999px;\n overflow: hidden;\n width: 100%;\n}\n\n.toast-percentage-bar-fill {\n height: 100%;\n background-color: #3b82f6;\n transition: width 0.3s ease;\n}\n\n/* Link */\n\n.toast-link {\n margin-top: 0.5rem;\n}\n\n.toast-link a {\n font-size: 0.85rem;\n font-weight: 500;\n color: #2563eb;\n text-decoration: underline;\n}\n\n.toast-link a:hover {\n text-decoration: none;\n}\n\n/* Links */\n\n.toast-links {\n margin-top: 0.5rem;\n padding-left: 1rem;\n}\n\n.toast-links li {\n margin-bottom: 0.25rem;\n}\n\n.toast-links a {\n font-size: 0.85rem;\n color: #2563eb;\n text-decoration: underline;\n}\n\n.toast-links a:hover {\n text-decoration: none;\n}\n\n.toast-message {\n padding-right: 20px;\n}\n.p-toast-message {\n position: relative;\n}\n.p-toast-message .p-toast-icon-close {\n position: absolute;\n top: 0.5rem;\n right: 0.5rem;\n}\n.p-toast-message .toast-action-btn {\n position: absolute;\n top: 0.5rem;\n right: 2.5rem;\n}\n\n/* AttachedFiles */\n\n.toast-attached-files {\n margin-top: 0.75rem;\n}\n\n.toast-attached-files-title {\n font-size: 0.75rem;\n font-weight: 600;\n color: #6b7280;\n margin-bottom: 0.25rem;\n}\n\n.toast-attached-files-list {\n list-style: none;\n padding: 0;\n margin: 0;\n}\n\n.toast-attached-files-list li {\n margin-bottom: 0.25rem;\n}\n\n.toast-attached-files-list a {\n display: inline-flex;\n align-items: center;\n gap: 0.35rem;\n font-size: 0.85rem;\n color: #2563eb;\n text-decoration: underline;\n}\n\n.toast-attached-files-list a:hover {\n text-decoration: none;\n}\n\n";
42654
42654
  styleInject(css_248z);
42655
42655
 
42656
- // Toast.jsx
42657
42656
  var Toast = function Toast(_ref) {
42658
42657
  var icon = _ref.icon,
42659
42658
  message = _ref.message,
@@ -42778,7 +42777,8 @@ var toastRefs = {
42778
42777
  hasShownRef: {
42779
42778
  current: false
42780
42779
  },
42781
- container: null
42780
+ container: null,
42781
+ sizeStates: new Map()
42782
42782
  };
42783
42783
  var ToastContainer = function ToastContainer() {
42784
42784
  var ref = useRef(null);
@@ -42798,54 +42798,95 @@ var showToast = function showToast(props) {
42798
42798
  }
42799
42799
  setTimeout(function () {
42800
42800
  if (toastRefs.toastRef) {
42801
+ // Générer un ID unique pour ce toast
42802
+ var toastId = "toast-".concat(Date.now(), "-").concat(Math.random());
42803
+
42804
+ // Initialiser l'état de taille
42805
+ var initialSize = props.size || 'M';
42806
+ toastRefs.sizeStates.set(toastId, {
42807
+ currentSize: initialSize,
42808
+ isExpanded: initialSize === 'L'
42809
+ });
42801
42810
  var progressBarRef = {
42802
42811
  current: null
42803
42812
  };
42804
42813
  var percentageTextRef = {
42805
42814
  current: null
42806
42815
  };
42816
+
42817
+ // Fonction pour changer la taille
42818
+ var handleSizeChange = function handleSizeChange(newSize) {
42819
+ var state = toastRefs.sizeStates.get(toastId);
42820
+ if (!state) return;
42821
+ state.currentSize = newSize;
42822
+ state.isExpanded = newSize === 'L';
42823
+
42824
+ // Re-afficher le toast avec la nouvelle taille
42825
+ toastRefs.toastRef.current.clear();
42826
+ showToastWithState(toastId, _objectSpread2(_objectSpread2({}, props), {}, {
42827
+ size: newSize
42828
+ }));
42829
+ };
42807
42830
  var handleToggleSize = function handleToggleSize() {
42808
- if (!props.onSizeChange) return;
42809
- if (props.size === "S") {
42810
- props.onSizeChange("L");
42811
- toastRefs.toastRef.current.clear();
42812
- toastRefs.hasShownRef.current = false;
42813
- } else if (props.size === "L") {
42814
- props.onSizeChange("S");
42815
- toastRefs.toastRef.current.clear();
42816
- toastRefs.hasShownRef.current = false;
42817
- }
42831
+ var state = toastRefs.sizeStates.get(toastId);
42832
+ if (!state || !props.sizeSModulable) return;
42833
+ var newSize = state.currentSize === "S" ? "L" : "S";
42834
+ handleSizeChange(newSize);
42818
42835
  };
42819
- toastRefs.toastRef.current.show({
42820
- severity: props.type || 'info',
42821
- life: props.duration || 3000,
42822
- sticky: props.sticky,
42823
- closable: props.closable !== false,
42824
- summary: props.title || '',
42825
- content: function content() {
42826
- return /*#__PURE__*/React__default.createElement(RichMessage, {
42827
- icon: props.icon,
42828
- type: props.type,
42829
- size: props.size,
42830
- title: props.title,
42831
- message: props.message,
42832
- enableHtmlContent: props.enableHtmlContent,
42833
- currentPercentage: props.percentage || 0,
42834
- link: props.link,
42835
- links: props.links,
42836
- attachedFiles: props.attachedFiles,
42837
- enablePercentage: props.enablePercentage,
42838
- sizeSModulable: props.sizeSModulable,
42839
- isExpanded: props.isExpanded,
42840
- onSizeChange: props.onSizeChange,
42841
- toastRef: toastRefs.toastRef,
42842
- hasShownRef: toastRefs.hasShownRef,
42843
- progressBarRef: progressBarRef,
42844
- percentageTextRef: percentageTextRef,
42845
- handleToggleSize: handleToggleSize
42846
- });
42836
+ var classNameSizeS = function classNameSizeS(currentSize) {
42837
+ switch (currentSize) {
42838
+ case 'S':
42839
+ return "toast_s--compact";
42840
+ case 'L':
42841
+ if (props.sizeSModulable === true) {
42842
+ return "toast_s--large";
42843
+ } else {
42844
+ return "";
42845
+ }
42846
+ default:
42847
+ return '';
42847
42848
  }
42848
- });
42849
+ };
42850
+ var showToastWithState = function showToastWithState(id, currentProps) {
42851
+ var state = toastRefs.sizeStates.get(id);
42852
+ if (!state) return;
42853
+ toastRefs.toastRef.current.show({
42854
+ severity: currentProps.type || 'info',
42855
+ life: currentProps.duration || 3000,
42856
+ sticky: currentProps.sticky,
42857
+ closable: currentProps.closable !== false,
42858
+ summary: currentProps.title || '',
42859
+ className: "".concat(classNameSizeS(state.currentSize), " ").concat(currentProps.type === "processing" ? "toast--processing" : ""),
42860
+ content: function content() {
42861
+ return /*#__PURE__*/React__default.createElement(RichMessage, {
42862
+ icon: currentProps.icon,
42863
+ type: currentProps.type,
42864
+ size: state.currentSize,
42865
+ title: currentProps.title,
42866
+ message: currentProps.message,
42867
+ enableHtmlContent: currentProps.enableHtmlContent,
42868
+ currentPercentage: currentProps.percentage || 0,
42869
+ link: currentProps.link,
42870
+ links: currentProps.links,
42871
+ attachedFiles: currentProps.attachedFiles,
42872
+ enablePercentage: currentProps.enablePercentage,
42873
+ sizeSModulable: currentProps.sizeSModulable,
42874
+ isExpanded: state.isExpanded,
42875
+ onSizeChange: handleSizeChange,
42876
+ toastRef: toastRefs.toastRef,
42877
+ hasShownRef: toastRefs.hasShownRef,
42878
+ progressBarRef: progressBarRef,
42879
+ percentageTextRef: percentageTextRef,
42880
+ handleToggleSize: handleToggleSize
42881
+ });
42882
+ },
42883
+ onRemove: function onRemove() {
42884
+ // Nettoyer l'état quand le toast est supprimé
42885
+ toastRefs.sizeStates["delete"](id);
42886
+ }
42887
+ });
42888
+ };
42889
+ showToastWithState(toastId, props);
42849
42890
  }
42850
42891
  }, 0);
42851
42892
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "arengibook",
3
3
  "private": false,
4
- "version": "2.5.507",
4
+ "version": "2.5.509",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
7
7
  "exports": {