arengibook 2.5.504 → 2.5.505
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/index.js +24 -27
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -42773,12 +42773,18 @@ var Toast = function Toast(_ref) {
|
|
|
42773
42773
|
};
|
|
42774
42774
|
|
|
42775
42775
|
// Singleton pour l'empilement des toasts
|
|
42776
|
-
var
|
|
42777
|
-
|
|
42776
|
+
var toastRefs = {
|
|
42777
|
+
toastRef: null,
|
|
42778
|
+
hasShownRef: {
|
|
42779
|
+
current: false
|
|
42780
|
+
},
|
|
42781
|
+
// Initialise comme un ref React
|
|
42782
|
+
container: null
|
|
42783
|
+
};
|
|
42778
42784
|
var ToastContainer = function ToastContainer() {
|
|
42779
42785
|
var ref = useRef(null);
|
|
42780
42786
|
useEffect(function () {
|
|
42781
|
-
toastRef = ref
|
|
42787
|
+
toastRefs.toastRef = ref;
|
|
42782
42788
|
}, []);
|
|
42783
42789
|
return /*#__PURE__*/React__default.createElement(Toast$1, {
|
|
42784
42790
|
ref: ref,
|
|
@@ -42786,40 +42792,31 @@ var ToastContainer = function ToastContainer() {
|
|
|
42786
42792
|
});
|
|
42787
42793
|
};
|
|
42788
42794
|
var showToast = function showToast(props) {
|
|
42789
|
-
if (!container) {
|
|
42790
|
-
container = document.createElement('div');
|
|
42791
|
-
document.body.appendChild(container);
|
|
42792
|
-
ReactDOM.render(/*#__PURE__*/React__default.createElement(ToastContainer, null), container);
|
|
42795
|
+
if (!toastRefs.container) {
|
|
42796
|
+
toastRefs.container = document.createElement('div');
|
|
42797
|
+
document.body.appendChild(toastRefs.container);
|
|
42798
|
+
ReactDOM.render(/*#__PURE__*/React__default.createElement(ToastContainer, null), toastRefs.container);
|
|
42793
42799
|
}
|
|
42794
42800
|
setTimeout(function () {
|
|
42795
|
-
if (toastRef) {
|
|
42796
|
-
var progressBarRef = {
|
|
42797
|
-
current: null
|
|
42798
|
-
};
|
|
42799
|
-
var percentageTextRef = {
|
|
42800
|
-
current: null
|
|
42801
|
-
};
|
|
42801
|
+
if (toastRefs.toastRef) {
|
|
42802
42802
|
var handleToggleSize = function handleToggleSize() {
|
|
42803
|
-
if (props.onSizeChange)
|
|
42804
|
-
|
|
42805
|
-
|
|
42806
|
-
|
|
42807
|
-
|
|
42808
|
-
|
|
42803
|
+
if (!props.onSizeChange) return;
|
|
42804
|
+
if (props.size === "S") {
|
|
42805
|
+
props.onSizeChange("L");
|
|
42806
|
+
toastRefs.toastRef.current.clear();
|
|
42807
|
+
toastRefs.hasShownRef.current = false;
|
|
42808
|
+
} else if (props.size === "L") {
|
|
42809
|
+
props.onSizeChange("S");
|
|
42810
|
+
toastRefs.toastRef.current.clear();
|
|
42811
|
+
toastRefs.hasShownRef.current = false;
|
|
42809
42812
|
}
|
|
42810
42813
|
};
|
|
42811
|
-
toastRef.show({
|
|
42814
|
+
toastRefs.toastRef.current.show({
|
|
42812
42815
|
severity: props.type || 'info',
|
|
42813
42816
|
life: props.duration || 3000,
|
|
42814
42817
|
sticky: props.sticky,
|
|
42815
42818
|
closable: props.closable !== false,
|
|
42816
42819
|
summary: props.title || '',
|
|
42817
|
-
// content: (
|
|
42818
|
-
// <div className="p-toast-message-content">
|
|
42819
|
-
// {props.title && <span className="p-toast-summary">{props.title}</span>}
|
|
42820
|
-
// <div className="p-toast-detail" dangerouslySetInnerHTML={{ __html: props.message }} />
|
|
42821
|
-
// </div>
|
|
42822
|
-
// )
|
|
42823
42820
|
content: function content() {
|
|
42824
42821
|
return /*#__PURE__*/React__default.createElement(RichMessage, {
|
|
42825
42822
|
icon: props.icon,
|