@ttoss/components 2.2.26 → 2.2.27
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.
|
@@ -14,7 +14,8 @@ type Props = {
|
|
|
14
14
|
onLoadMore?: () => void;
|
|
15
15
|
onOpenChange?: (isOpen: boolean) => void;
|
|
16
16
|
onClose?: () => void;
|
|
17
|
+
onClearAll?: () => void;
|
|
17
18
|
};
|
|
18
|
-
declare const NotificationsMenu: ({ notifications, defaultOpen, hasMore, onLoadMore, onOpenChange, count, onClose, }: Props) => react_jsx_runtime.JSX.Element;
|
|
19
|
+
declare const NotificationsMenu: ({ notifications, defaultOpen, hasMore, onLoadMore, onOpenChange, count, onClose, onClearAll, }: Props) => react_jsx_runtime.JSX.Element;
|
|
19
20
|
|
|
20
21
|
export { type Notification, NotificationsMenu };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Icon, NotificationCard } from "../chunk-QIWMC6WC.js";
|
|
3
3
|
|
|
4
4
|
// src/components/NotificationsMenu/NotificationsMenu.tsx
|
|
5
|
-
import { Box, Card, Flex, IconButton, Text } from "@ttoss/ui";
|
|
5
|
+
import { Box, Button, Card, Flex, IconButton, Text } from "@ttoss/ui";
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
var NotificationsMenu = ({
|
|
@@ -12,7 +12,8 @@ var NotificationsMenu = ({
|
|
|
12
12
|
onLoadMore,
|
|
13
13
|
onOpenChange,
|
|
14
14
|
count,
|
|
15
|
-
onClose
|
|
15
|
+
onClose,
|
|
16
|
+
onClearAll
|
|
16
17
|
}) => {
|
|
17
18
|
const [isOpen, setIsOpen] = React.useState(defaultOpen);
|
|
18
19
|
const [openToLeft, setOpenToLeft] = React.useState(false);
|
|
@@ -118,52 +119,93 @@ var NotificationsMenu = ({
|
|
|
118
119
|
},
|
|
119
120
|
children: count > 99 ? "99+" : count
|
|
120
121
|
})]
|
|
121
|
-
}), isOpen && /* @__PURE__ */jsx(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
top: "calc(100% + 8px)",
|
|
125
|
-
left: openToLeft ? "auto" : 0,
|
|
126
|
-
right: openToLeft ? 0 : "auto",
|
|
127
|
-
width: ["90vw", "500px"],
|
|
128
|
-
maxHeight: "400px",
|
|
129
|
-
overflowY: "auto",
|
|
130
|
-
zIndex: 10,
|
|
131
|
-
padding: 0,
|
|
132
|
-
boxShadow: "xl",
|
|
133
|
-
borderRadius: "2xl",
|
|
134
|
-
backgroundColor: "display.background.secondary.default"
|
|
135
|
-
},
|
|
136
|
-
children: /* @__PURE__ */jsx(Box, {
|
|
137
|
-
ref: containerRef,
|
|
122
|
+
}), isOpen && /* @__PURE__ */jsx("div", {
|
|
123
|
+
ref: containerRef,
|
|
124
|
+
children: /* @__PURE__ */jsx(Card, {
|
|
138
125
|
sx: {
|
|
139
|
-
|
|
126
|
+
position: "absolute",
|
|
127
|
+
top: "calc(100% + 8px)",
|
|
128
|
+
left: openToLeft ? "auto" : 0,
|
|
129
|
+
right: openToLeft ? 0 : "auto",
|
|
130
|
+
width: ["90vw", "550px"],
|
|
131
|
+
maxHeight: "400px",
|
|
132
|
+
overflowY: "auto",
|
|
133
|
+
zIndex: 10,
|
|
134
|
+
padding: 0,
|
|
135
|
+
boxShadow: "xl",
|
|
136
|
+
borderRadius: "2xl",
|
|
137
|
+
backgroundColor: "display.background.secondary.default"
|
|
140
138
|
},
|
|
141
|
-
children: /* @__PURE__ */
|
|
139
|
+
children: /* @__PURE__ */jsx(Box, {
|
|
142
140
|
sx: {
|
|
143
|
-
|
|
144
|
-
gap: 2
|
|
141
|
+
width: "100%"
|
|
145
142
|
},
|
|
146
|
-
children:
|
|
143
|
+
children: /* @__PURE__ */jsxs(Flex, {
|
|
147
144
|
sx: {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
p: 4
|
|
145
|
+
flexDirection: "column",
|
|
146
|
+
gap: 4
|
|
151
147
|
},
|
|
152
|
-
children:
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
148
|
+
children: [notifications.length > 0 && onClearAll && /* @__PURE__ */jsx(Flex, {
|
|
149
|
+
sx: {
|
|
150
|
+
justifyContent: "flex-end",
|
|
151
|
+
p: 2,
|
|
152
|
+
marginBottom: -2
|
|
153
|
+
},
|
|
154
|
+
children: /* @__PURE__ */jsxs(Button, {
|
|
155
|
+
variant: "ghost",
|
|
156
|
+
sx: {
|
|
157
|
+
borderRadius: "md",
|
|
158
|
+
padding: 1,
|
|
159
|
+
paddingLeft: 10,
|
|
160
|
+
paddingRight: 10,
|
|
161
|
+
fontSize: "md",
|
|
162
|
+
color: "display.text.muted.default",
|
|
163
|
+
border: "1px solid",
|
|
164
|
+
borderColor: "display.border.default",
|
|
165
|
+
transition: "all 0.2s ease",
|
|
166
|
+
display: "flex",
|
|
167
|
+
alignItems: "center",
|
|
168
|
+
"&:hover": {
|
|
169
|
+
backgroundColor: "action.background.muted.default",
|
|
170
|
+
color: "display.text.default",
|
|
171
|
+
borderColor: "action.border.default"
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
onClick: onClearAll,
|
|
175
|
+
children: [/* @__PURE__ */jsx(Icon, {
|
|
176
|
+
icon: "delete",
|
|
177
|
+
width: 18,
|
|
178
|
+
height: 18
|
|
179
|
+
}), /* @__PURE__ */jsx(Text, {
|
|
180
|
+
sx: {
|
|
181
|
+
ml: -1,
|
|
182
|
+
marginTop: -0.4
|
|
183
|
+
},
|
|
184
|
+
children: "Limpar Tudo"
|
|
185
|
+
})]
|
|
186
|
+
})
|
|
187
|
+
}), notifications.length === 0 ? /* @__PURE__ */jsx(Text, {
|
|
188
|
+
sx: {
|
|
189
|
+
color: "display.text.muted.default",
|
|
190
|
+
textAlign: "center",
|
|
191
|
+
p: 4
|
|
192
|
+
},
|
|
193
|
+
children: "Nenhuma notifica\xE7\xE3o"
|
|
194
|
+
}) : notifications.map(notification => {
|
|
195
|
+
return /* @__PURE__ */jsx(NotificationCard, {
|
|
196
|
+
...notification,
|
|
197
|
+
onClose: () => {
|
|
198
|
+
notification.onClose?.();
|
|
199
|
+
onClose?.();
|
|
200
|
+
}
|
|
201
|
+
}, notification.id);
|
|
202
|
+
}), hasMore && /* @__PURE__ */jsx("div", {
|
|
203
|
+
ref: loadMoreRef,
|
|
204
|
+
style: {
|
|
205
|
+
height: 1
|
|
159
206
|
}
|
|
160
|
-
}
|
|
161
|
-
})
|
|
162
|
-
ref: loadMoreRef,
|
|
163
|
-
style: {
|
|
164
|
-
height: 1
|
|
165
|
-
}
|
|
166
|
-
})]
|
|
207
|
+
})]
|
|
208
|
+
})
|
|
167
209
|
})
|
|
168
210
|
})
|
|
169
211
|
})]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/components",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.27",
|
|
4
4
|
"description": "React components for ttoss ecosystem.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ttoss",
|
|
@@ -107,11 +107,11 @@
|
|
|
107
107
|
"react": "^19.1.0",
|
|
108
108
|
"tsup": "^8.5.0",
|
|
109
109
|
"tsx": "^4.19.2",
|
|
110
|
-
"@ttoss/react-hooks": "^2.1.2",
|
|
111
110
|
"@ttoss/config": "^1.35.6",
|
|
111
|
+
"@ttoss/react-icons": "^0.4.15",
|
|
112
|
+
"@ttoss/react-hooks": "^2.1.2",
|
|
112
113
|
"@ttoss/test-utils": "^2.1.26",
|
|
113
|
-
"@ttoss/ui": "^5.9.2"
|
|
114
|
-
"@ttoss/react-icons": "^0.4.15"
|
|
114
|
+
"@ttoss/ui": "^5.9.2"
|
|
115
115
|
},
|
|
116
116
|
"keywords": [
|
|
117
117
|
"React",
|