visits-style 1.4.18 → 1.4.19
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/components/Toast/index.d.ts +1 -1
- package/dist/components/Toast/types.d.ts +8 -3
- package/dist/index.cjs.js +16 -10
- package/dist/index.es.js +16 -10
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ToastContainerProps } from './types';
|
|
2
|
-
export default function Toast({ toasts, clear, fixed,
|
|
2
|
+
export default function Toast({ toasts, clear, fixed, offset, position, space }: ToastContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -30,10 +30,15 @@ export interface ToastContainerProps {
|
|
|
30
30
|
*/
|
|
31
31
|
position?: ToastContainerPositionType;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
34
|
-
* @default
|
|
33
|
+
* offset 単位はpx
|
|
34
|
+
* @default positionによって16px自動反映
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
offset?: Partial<{
|
|
37
|
+
top: string;
|
|
38
|
+
left: string;
|
|
39
|
+
right: string;
|
|
40
|
+
bottom: string;
|
|
41
|
+
}>;
|
|
37
42
|
/**
|
|
38
43
|
* toast間の間隔
|
|
39
44
|
* @default '16px'
|
package/dist/index.cjs.js
CHANGED
|
@@ -1017,7 +1017,7 @@ function ToastItem({
|
|
|
1017
1017
|
clearRef.current = clear;
|
|
1018
1018
|
if (!isMounted)
|
|
1019
1019
|
return null;
|
|
1020
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Item, { ref: refs.setFloating, role: "
|
|
1020
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Item, { ref: refs.setFloating, role: "log", "data-testid": "vs-toast-item", className, style: styles, onClick: handleClickToast, children: message });
|
|
1021
1021
|
}
|
|
1022
1022
|
const Item = /* @__PURE__ */ styledComponents.styled.li.withConfig({
|
|
1023
1023
|
displayName: "ToastItem__Item",
|
|
@@ -1028,24 +1028,30 @@ function Toast({
|
|
|
1028
1028
|
toasts,
|
|
1029
1029
|
clear,
|
|
1030
1030
|
fixed,
|
|
1031
|
-
|
|
1031
|
+
offset = {},
|
|
1032
1032
|
position = "top-left",
|
|
1033
1033
|
space = "16px"
|
|
1034
1034
|
}) {
|
|
1035
1035
|
const style = React.useMemo(() => {
|
|
1036
1036
|
const base = {
|
|
1037
|
-
position: fixed ? "fixed" : "absolute"
|
|
1037
|
+
position: fixed ? "fixed" : "absolute",
|
|
1038
|
+
...offset
|
|
1038
1039
|
};
|
|
1039
|
-
if (
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1040
|
+
if (!Object.keys(offset).length) {
|
|
1041
|
+
if (position.indexOf("top") > -1) {
|
|
1042
|
+
base.top = "16px";
|
|
1043
|
+
} else if (position.indexOf("bottom") > -1) {
|
|
1044
|
+
base.bottom = "16px";
|
|
1045
|
+
}
|
|
1046
|
+
if (position.indexOf("left") > -1) {
|
|
1047
|
+
base.left = "16px";
|
|
1048
|
+
} else if (position.indexOf("right") > -1) {
|
|
1049
|
+
base.right = "16px";
|
|
1050
|
+
}
|
|
1043
1051
|
}
|
|
1044
1052
|
if (position.indexOf("left") > -1) {
|
|
1045
|
-
base.left = margin;
|
|
1046
1053
|
base.alignItems = "flex-start";
|
|
1047
1054
|
} else if (position.indexOf("right") > -1) {
|
|
1048
|
-
base.right = margin;
|
|
1049
1055
|
base.alignItems = "flex-end";
|
|
1050
1056
|
} else {
|
|
1051
1057
|
base.left = "50%";
|
|
@@ -1053,7 +1059,7 @@ function Toast({
|
|
|
1053
1059
|
base.transform = "translateX(-50%)";
|
|
1054
1060
|
}
|
|
1055
1061
|
return base;
|
|
1056
|
-
}, [fixed,
|
|
1062
|
+
}, [fixed, offset, position]);
|
|
1057
1063
|
return /* @__PURE__ */ jsxRuntime.jsx(Portal$1, { children: /* @__PURE__ */ jsxRuntime.jsx(ToastList, { style, $space: space, children: toasts.map((props) => /* @__PURE__ */ React.createElement(ToastItem, { ...props, key: props.id, clear })) }) });
|
|
1058
1064
|
}
|
|
1059
1065
|
const ToastList = /* @__PURE__ */ styledComponents.styled.ul.withConfig({
|
package/dist/index.es.js
CHANGED
|
@@ -1009,7 +1009,7 @@ function ToastItem({
|
|
|
1009
1009
|
clearRef.current = clear;
|
|
1010
1010
|
if (!isMounted)
|
|
1011
1011
|
return null;
|
|
1012
|
-
return /* @__PURE__ */ jsx(Item, { ref: refs.setFloating, role: "
|
|
1012
|
+
return /* @__PURE__ */ jsx(Item, { ref: refs.setFloating, role: "log", "data-testid": "vs-toast-item", className, style: styles, onClick: handleClickToast, children: message });
|
|
1013
1013
|
}
|
|
1014
1014
|
const Item = /* @__PURE__ */ styled.li.withConfig({
|
|
1015
1015
|
displayName: "ToastItem__Item",
|
|
@@ -1020,24 +1020,30 @@ function Toast({
|
|
|
1020
1020
|
toasts,
|
|
1021
1021
|
clear,
|
|
1022
1022
|
fixed,
|
|
1023
|
-
|
|
1023
|
+
offset = {},
|
|
1024
1024
|
position = "top-left",
|
|
1025
1025
|
space = "16px"
|
|
1026
1026
|
}) {
|
|
1027
1027
|
const style = useMemo(() => {
|
|
1028
1028
|
const base = {
|
|
1029
|
-
position: fixed ? "fixed" : "absolute"
|
|
1029
|
+
position: fixed ? "fixed" : "absolute",
|
|
1030
|
+
...offset
|
|
1030
1031
|
};
|
|
1031
|
-
if (
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1032
|
+
if (!Object.keys(offset).length) {
|
|
1033
|
+
if (position.indexOf("top") > -1) {
|
|
1034
|
+
base.top = "16px";
|
|
1035
|
+
} else if (position.indexOf("bottom") > -1) {
|
|
1036
|
+
base.bottom = "16px";
|
|
1037
|
+
}
|
|
1038
|
+
if (position.indexOf("left") > -1) {
|
|
1039
|
+
base.left = "16px";
|
|
1040
|
+
} else if (position.indexOf("right") > -1) {
|
|
1041
|
+
base.right = "16px";
|
|
1042
|
+
}
|
|
1035
1043
|
}
|
|
1036
1044
|
if (position.indexOf("left") > -1) {
|
|
1037
|
-
base.left = margin;
|
|
1038
1045
|
base.alignItems = "flex-start";
|
|
1039
1046
|
} else if (position.indexOf("right") > -1) {
|
|
1040
|
-
base.right = margin;
|
|
1041
1047
|
base.alignItems = "flex-end";
|
|
1042
1048
|
} else {
|
|
1043
1049
|
base.left = "50%";
|
|
@@ -1045,7 +1051,7 @@ function Toast({
|
|
|
1045
1051
|
base.transform = "translateX(-50%)";
|
|
1046
1052
|
}
|
|
1047
1053
|
return base;
|
|
1048
|
-
}, [fixed,
|
|
1054
|
+
}, [fixed, offset, position]);
|
|
1049
1055
|
return /* @__PURE__ */ jsx(Portal$1, { children: /* @__PURE__ */ jsx(ToastList, { style, $space: space, children: toasts.map((props) => /* @__PURE__ */ createElement(ToastItem, { ...props, key: props.id, clear })) }) });
|
|
1050
1056
|
}
|
|
1051
1057
|
const ToastList = /* @__PURE__ */ styled.ul.withConfig({
|
package/package.json
CHANGED