fis-component 0.0.79 → 0.0.80

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/cjs/index.js CHANGED
@@ -61835,13 +61835,139 @@ const DivTitleWrap = styled.div `
61835
61835
  `;
61836
61836
  const ToastWrapper = styled.div `
61837
61837
  position: fixed;
61838
- ${(props) => props.$position === "bottom-center" ? "bottom: 20px;" : "top: 20px;"}
61839
- left: 50%;
61840
- transform: translateX(-50%);
61841
- z-index: 1000;
61838
+ z-index: 1050; /* Cao hơn bootstrap modal (1040) các component khác */
61842
61839
  display: flex;
61843
61840
  flex-direction: column;
61844
- gap: 8px;
61841
+ gap: 12px; /* Tăng gap để toast không quá sát nhau */
61842
+ max-width: 420px; /* Tăng một chút cho nội dung dài */
61843
+ min-width: 320px; /* Tăng min-width cho đẹp hơn */
61844
+ pointer-events: none; /* Tránh chặn click vào các element phía sau */
61845
+
61846
+ /* Cho phép click vào các toast con */
61847
+ > * {
61848
+ pointer-events: auto;
61849
+ }
61850
+
61851
+ ${(props) => {
61852
+ switch (props.$position) {
61853
+ case "top-center":
61854
+ return styled.css `
61855
+ top: 24px;
61856
+ left: 50%;
61857
+ transform: translateX(-50%);
61858
+ `;
61859
+ case "bottom-center":
61860
+ return styled.css `
61861
+ bottom: 24px;
61862
+ left: 50%;
61863
+ transform: translateX(-50%);
61864
+ flex-direction: column-reverse; /* Toast mới xuất hiện từ dưới lên */
61865
+ `;
61866
+ case "top-right":
61867
+ return styled.css `
61868
+ top: 24px;
61869
+ right: 24px;
61870
+ `;
61871
+ case "bottom-right":
61872
+ return styled.css `
61873
+ bottom: 24px;
61874
+ right: 24px;
61875
+ flex-direction: column-reverse;
61876
+ `;
61877
+ case "top-left":
61878
+ return styled.css `
61879
+ top: 24px;
61880
+ left: 24px;
61881
+ `;
61882
+ case "bottom-left":
61883
+ return styled.css `
61884
+ bottom: 24px;
61885
+ left: 24px;
61886
+ flex-direction: column-reverse;
61887
+ `;
61888
+ default:
61889
+ return styled.css `
61890
+ top: 24px;
61891
+ left: 50%;
61892
+ transform: translateX(-50%);
61893
+ `;
61894
+ }
61895
+ }}
61896
+
61897
+ /* Animation cho toast xuất hiện */
61898
+ > div {
61899
+ animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
61900
+ }
61901
+
61902
+ @keyframes toastSlideIn {
61903
+ from {
61904
+ opacity: 0;
61905
+ transform: translateY(-12px) scale(0.95);
61906
+ }
61907
+ to {
61908
+ opacity: 1;
61909
+ transform: translateY(0) scale(1);
61910
+ }
61911
+ }
61912
+
61913
+ /* Animation cho bottom positions */
61914
+ ${(props) => props.$position?.includes("bottom") &&
61915
+ styled.css `
61916
+ > div {
61917
+ animation: toastSlideInBottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
61918
+ }
61919
+
61920
+ @keyframes toastSlideInBottom {
61921
+ from {
61922
+ opacity: 0;
61923
+ transform: translateY(12px) scale(0.95);
61924
+ }
61925
+ to {
61926
+ opacity: 1;
61927
+ transform: translateY(0) scale(1);
61928
+ }
61929
+ }
61930
+ `}
61931
+
61932
+ /* Responsive cho mobile */
61933
+ @media (max-width: 768px) {
61934
+ max-width: calc(100vw - 32px);
61935
+ min-width: calc(100vw - 32px);
61936
+
61937
+ ${(props) => {
61938
+ if (props.$position?.includes("center")) {
61939
+ return styled.css `
61940
+ left: 16px;
61941
+ right: 16px;
61942
+ transform: none;
61943
+ `;
61944
+ }
61945
+ else if (props.$position?.includes("left")) {
61946
+ return styled.css `
61947
+ left: 16px;
61948
+ `;
61949
+ }
61950
+ else if (props.$position?.includes("right")) {
61951
+ return styled.css `
61952
+ right: 16px;
61953
+ `;
61954
+ }
61955
+ }}
61956
+
61957
+ ${(props) => props.$position?.includes("top")
61958
+ ? styled.css `
61959
+ top: 16px;
61960
+ `
61961
+ : styled.css `
61962
+ bottom: 16px;
61963
+ `}
61964
+ }
61965
+
61966
+ /* Tablet breakpoint */
61967
+ @media (max-width: 1024px) and (min-width: 769px) {
61968
+ max-width: 380px;
61969
+ min-width: 300px;
61970
+ }
61845
61971
  `;
61846
61972
 
61847
61973
  const getPadding = (size, borderPath) => {
@@ -62567,7 +62693,7 @@ const ToastProvider = ({ children, }) => {
62567
62693
  setToasts((prev) => prev.slice(1));
62568
62694
  }, duration);
62569
62695
  }, []);
62570
- return (jsxRuntime.jsxs(ToastContext.Provider, { value: { showToast }, children: [children, toasts.length > 0 && (jsxRuntime.jsx(ToastWrapper, { "$position": toasts[0].position || "top-center", children: toasts.map((toast, index) => (jsxRuntime.jsx(FISToast, { ...toast }, index))) }))] }));
62696
+ return (jsxRuntime.jsxs(ToastContext.Provider, { value: { showToast }, children: [children, toasts.length > 0 && (jsxRuntime.jsx(ToastWrapper, { "$position": toasts[0].position || "top-right", children: toasts.map((toast, index) => (jsxRuntime.jsx(FISToast, { ...toast }, index))) }))] }));
62571
62697
  };
62572
62698
 
62573
62699
  const FISThemeProvider = ({ theme: theme$1 = theme, children, }) => (jsxRuntime.jsxs(styled.ThemeProvider, { theme: theme$1, children: [jsxRuntime.jsx(GlobalStyle, { theme: theme$1 }), jsxRuntime.jsx(NotificationProvider, { children: jsxRuntime.jsx(ToastProvider, { children: children }) })] }));