@mailstep/design-system 0.9.0 → 0.9.1
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/package.json
CHANGED
|
@@ -140,7 +140,8 @@ var store_default = (state = {}, action) => {
|
|
|
140
140
|
case actionTypes.resetGrid:
|
|
141
141
|
draft[gridName] = {
|
|
142
142
|
...initialState,
|
|
143
|
-
rowsPerPage: draft[gridName].rowsPerPage
|
|
143
|
+
rowsPerPage: draft[gridName].rowsPerPage,
|
|
144
|
+
presets: draft[gridName].presets
|
|
144
145
|
};
|
|
145
146
|
break;
|
|
146
147
|
case actionTypes.setColumnWidth:
|
|
@@ -16,6 +16,11 @@ const StyledLink = styled$1(Link)`
|
|
|
16
16
|
background-color: bgLightGray1;
|
|
17
17
|
border-radius: 6px;
|
|
18
18
|
}
|
|
19
|
+
${({ $disabled }) => $disabled && css`
|
|
20
|
+
opacity: 0.5;
|
|
21
|
+
pointer-events: none;
|
|
22
|
+
cursor: not-allowed;
|
|
23
|
+
`}
|
|
19
24
|
${({ $isActive }) => $isActive && css`
|
|
20
25
|
background-color: red1;
|
|
21
26
|
color: white;
|
|
@@ -32,23 +37,31 @@ const StyledLink = styled$1(Link)`
|
|
|
32
37
|
`}
|
|
33
38
|
`;
|
|
34
39
|
const MenuItem = ({ item, ItemComponent, onClose }) => {
|
|
35
|
-
const { onClick, link, hasSeparator, name, autoClose } = item;
|
|
40
|
+
const { onClick, link, hasSeparator, name, autoClose, disabled } = item;
|
|
41
|
+
const isActive = link === useLocation().pathname;
|
|
42
|
+
const onClickCallback = useCallback((e) => {
|
|
43
|
+
if (disabled) {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (onClick) {
|
|
48
|
+
e.preventDefault();
|
|
49
|
+
onClick();
|
|
50
|
+
}
|
|
51
|
+
if (autoClose && onClose) setTimeout(() => {
|
|
52
|
+
onClose();
|
|
53
|
+
}, 200);
|
|
54
|
+
}, [
|
|
55
|
+
autoClose,
|
|
56
|
+
disabled,
|
|
57
|
+
onClick,
|
|
58
|
+
onClose
|
|
59
|
+
]);
|
|
36
60
|
return /* @__PURE__ */ jsx(StyledLink, {
|
|
37
|
-
to: link,
|
|
38
|
-
$isActive:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
e.preventDefault();
|
|
42
|
-
onClick();
|
|
43
|
-
}
|
|
44
|
-
if (autoClose && onClose) setTimeout(() => {
|
|
45
|
-
onClose();
|
|
46
|
-
}, 200);
|
|
47
|
-
}, [
|
|
48
|
-
autoClose,
|
|
49
|
-
onClick,
|
|
50
|
-
onClose
|
|
51
|
-
]),
|
|
61
|
+
to: disabled ? void 0 : link,
|
|
62
|
+
$isActive: isActive,
|
|
63
|
+
$disabled: !!disabled,
|
|
64
|
+
onClick: onClickCallback,
|
|
52
65
|
$hasSeparator: !!hasSeparator,
|
|
53
66
|
"data-cy": name,
|
|
54
67
|
size: "inherit",
|
|
@@ -11,6 +11,7 @@ export type DefaultItem = {
|
|
|
11
11
|
hidden?: boolean;
|
|
12
12
|
count?: number;
|
|
13
13
|
autoClose?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
14
15
|
};
|
|
15
16
|
export type Item = {
|
|
16
17
|
link?: string | Pathname;
|
|
@@ -19,6 +20,7 @@ export type Item = {
|
|
|
19
20
|
name?: string;
|
|
20
21
|
autoClose?: boolean;
|
|
21
22
|
hidden?: boolean;
|
|
23
|
+
disabled?: boolean;
|
|
22
24
|
};
|
|
23
25
|
export type MenuItemProps<ItemType extends Item> = {
|
|
24
26
|
item: ItemType;
|