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 +132 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/src/components/Toast/index.d.ts +1 -1
- package/dist/cjs/types/src/components/Toast/styles.d.ts +1 -1
- package/dist/esm/index.js +132 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/src/components/Toast/index.d.ts +1 -1
- package/dist/esm/types/src/components/Toast/styles.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
export type ThemeType = "neutral" | "info" | "positive" | "caution" | "negative";
|
|
3
3
|
export type ToastType = "link" | "button" | "no-action";
|
|
4
4
|
export type PositionType = "inline" | "bottom";
|
|
5
|
-
export type ToastPositionType = "top-center" | "bottom-center";
|
|
5
|
+
export type ToastPositionType = "top-center" | "bottom-center" | "top-right" | "bottom-right" | "top-left" | "bottom-left";
|
|
6
6
|
export type ToastProps = {
|
|
7
7
|
className?: string;
|
|
8
8
|
theme?: ThemeType;
|
|
@@ -10,6 +10,6 @@ export declare const PTitleSC: import("styled-components/dist/types").IStyledCom
|
|
|
10
10
|
export declare const LinkSC: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, never>> & string;
|
|
11
11
|
export declare const DivTitleWrap: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, ToastProps>> & string;
|
|
12
12
|
export declare const ToastWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
13
|
-
$position?: "top-center" | "bottom-center";
|
|
13
|
+
$position?: "top-center" | "bottom-center" | "top-right" | "bottom-right" | "top-left" | "bottom-left";
|
|
14
14
|
}>> & string;
|
|
15
15
|
export {};
|
package/dist/esm/index.js
CHANGED
|
@@ -61815,13 +61815,139 @@ const DivTitleWrap = styled.div `
|
|
|
61815
61815
|
`;
|
|
61816
61816
|
const ToastWrapper = styled.div `
|
|
61817
61817
|
position: fixed;
|
|
61818
|
-
|
|
61819
|
-
left: 50%;
|
|
61820
|
-
transform: translateX(-50%);
|
|
61821
|
-
z-index: 1000;
|
|
61818
|
+
z-index: 1050; /* Cao hơn bootstrap modal (1040) và các component khác */
|
|
61822
61819
|
display: flex;
|
|
61823
61820
|
flex-direction: column;
|
|
61824
|
-
gap:
|
|
61821
|
+
gap: 12px; /* Tăng gap để toast không quá sát nhau */
|
|
61822
|
+
max-width: 420px; /* Tăng một chút cho nội dung dài */
|
|
61823
|
+
min-width: 320px; /* Tăng min-width cho đẹp hơn */
|
|
61824
|
+
pointer-events: none; /* Tránh chặn click vào các element phía sau */
|
|
61825
|
+
|
|
61826
|
+
/* Cho phép click vào các toast con */
|
|
61827
|
+
> * {
|
|
61828
|
+
pointer-events: auto;
|
|
61829
|
+
}
|
|
61830
|
+
|
|
61831
|
+
${(props) => {
|
|
61832
|
+
switch (props.$position) {
|
|
61833
|
+
case "top-center":
|
|
61834
|
+
return css `
|
|
61835
|
+
top: 24px;
|
|
61836
|
+
left: 50%;
|
|
61837
|
+
transform: translateX(-50%);
|
|
61838
|
+
`;
|
|
61839
|
+
case "bottom-center":
|
|
61840
|
+
return css `
|
|
61841
|
+
bottom: 24px;
|
|
61842
|
+
left: 50%;
|
|
61843
|
+
transform: translateX(-50%);
|
|
61844
|
+
flex-direction: column-reverse; /* Toast mới xuất hiện từ dưới lên */
|
|
61845
|
+
`;
|
|
61846
|
+
case "top-right":
|
|
61847
|
+
return css `
|
|
61848
|
+
top: 24px;
|
|
61849
|
+
right: 24px;
|
|
61850
|
+
`;
|
|
61851
|
+
case "bottom-right":
|
|
61852
|
+
return css `
|
|
61853
|
+
bottom: 24px;
|
|
61854
|
+
right: 24px;
|
|
61855
|
+
flex-direction: column-reverse;
|
|
61856
|
+
`;
|
|
61857
|
+
case "top-left":
|
|
61858
|
+
return css `
|
|
61859
|
+
top: 24px;
|
|
61860
|
+
left: 24px;
|
|
61861
|
+
`;
|
|
61862
|
+
case "bottom-left":
|
|
61863
|
+
return css `
|
|
61864
|
+
bottom: 24px;
|
|
61865
|
+
left: 24px;
|
|
61866
|
+
flex-direction: column-reverse;
|
|
61867
|
+
`;
|
|
61868
|
+
default:
|
|
61869
|
+
return css `
|
|
61870
|
+
top: 24px;
|
|
61871
|
+
left: 50%;
|
|
61872
|
+
transform: translateX(-50%);
|
|
61873
|
+
`;
|
|
61874
|
+
}
|
|
61875
|
+
}}
|
|
61876
|
+
|
|
61877
|
+
/* Animation cho toast xuất hiện */
|
|
61878
|
+
> div {
|
|
61879
|
+
animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
61880
|
+
}
|
|
61881
|
+
|
|
61882
|
+
@keyframes toastSlideIn {
|
|
61883
|
+
from {
|
|
61884
|
+
opacity: 0;
|
|
61885
|
+
transform: translateY(-12px) scale(0.95);
|
|
61886
|
+
}
|
|
61887
|
+
to {
|
|
61888
|
+
opacity: 1;
|
|
61889
|
+
transform: translateY(0) scale(1);
|
|
61890
|
+
}
|
|
61891
|
+
}
|
|
61892
|
+
|
|
61893
|
+
/* Animation cho bottom positions */
|
|
61894
|
+
${(props) => props.$position?.includes("bottom") &&
|
|
61895
|
+
css `
|
|
61896
|
+
> div {
|
|
61897
|
+
animation: toastSlideInBottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
61898
|
+
}
|
|
61899
|
+
|
|
61900
|
+
@keyframes toastSlideInBottom {
|
|
61901
|
+
from {
|
|
61902
|
+
opacity: 0;
|
|
61903
|
+
transform: translateY(12px) scale(0.95);
|
|
61904
|
+
}
|
|
61905
|
+
to {
|
|
61906
|
+
opacity: 1;
|
|
61907
|
+
transform: translateY(0) scale(1);
|
|
61908
|
+
}
|
|
61909
|
+
}
|
|
61910
|
+
`}
|
|
61911
|
+
|
|
61912
|
+
/* Responsive cho mobile */
|
|
61913
|
+
@media (max-width: 768px) {
|
|
61914
|
+
max-width: calc(100vw - 32px);
|
|
61915
|
+
min-width: calc(100vw - 32px);
|
|
61916
|
+
|
|
61917
|
+
${(props) => {
|
|
61918
|
+
if (props.$position?.includes("center")) {
|
|
61919
|
+
return css `
|
|
61920
|
+
left: 16px;
|
|
61921
|
+
right: 16px;
|
|
61922
|
+
transform: none;
|
|
61923
|
+
`;
|
|
61924
|
+
}
|
|
61925
|
+
else if (props.$position?.includes("left")) {
|
|
61926
|
+
return css `
|
|
61927
|
+
left: 16px;
|
|
61928
|
+
`;
|
|
61929
|
+
}
|
|
61930
|
+
else if (props.$position?.includes("right")) {
|
|
61931
|
+
return css `
|
|
61932
|
+
right: 16px;
|
|
61933
|
+
`;
|
|
61934
|
+
}
|
|
61935
|
+
}}
|
|
61936
|
+
|
|
61937
|
+
${(props) => props.$position?.includes("top")
|
|
61938
|
+
? css `
|
|
61939
|
+
top: 16px;
|
|
61940
|
+
`
|
|
61941
|
+
: css `
|
|
61942
|
+
bottom: 16px;
|
|
61943
|
+
`}
|
|
61944
|
+
}
|
|
61945
|
+
|
|
61946
|
+
/* Tablet breakpoint */
|
|
61947
|
+
@media (max-width: 1024px) and (min-width: 769px) {
|
|
61948
|
+
max-width: 380px;
|
|
61949
|
+
min-width: 300px;
|
|
61950
|
+
}
|
|
61825
61951
|
`;
|
|
61826
61952
|
|
|
61827
61953
|
const getPadding = (size, borderPath) => {
|
|
@@ -62547,7 +62673,7 @@ const ToastProvider = ({ children, }) => {
|
|
|
62547
62673
|
setToasts((prev) => prev.slice(1));
|
|
62548
62674
|
}, duration);
|
|
62549
62675
|
}, []);
|
|
62550
|
-
return (jsxs(ToastContext.Provider, { value: { showToast }, children: [children, toasts.length > 0 && (jsx(ToastWrapper, { "$position": toasts[0].position || "top-
|
|
62676
|
+
return (jsxs(ToastContext.Provider, { value: { showToast }, children: [children, toasts.length > 0 && (jsx(ToastWrapper, { "$position": toasts[0].position || "top-right", children: toasts.map((toast, index) => (jsx(FISToast, { ...toast }, index))) }))] }));
|
|
62551
62677
|
};
|
|
62552
62678
|
|
|
62553
62679
|
const FISThemeProvider = ({ theme: theme$1 = theme, children, }) => (jsxs(ThemeProvider, { theme: theme$1, children: [jsx(GlobalStyle, { theme: theme$1 }), jsx(NotificationProvider, { children: jsx(ToastProvider, { children: children }) })] }));
|