@ttoss/components 2.7.11 → 2.8.0
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/JsonEditor/index.d.ts +1 -0
- package/dist/NotificationsMenu/index.d.ts +17 -2
- package/dist/SpotlightCard/index.d.ts +27 -0
- package/dist/esm/Menu/index.js +15 -2187
- package/dist/esm/NotificationCard/index.js +154 -3
- package/dist/esm/NotificationsMenu/index.js +181 -28
- package/dist/esm/SpotlightCard/index.js +211 -0
- package/package.json +9 -5
- package/dist/esm/chunk-4GBVRL7E.js +0 -156
|
@@ -1,5 +1,156 @@
|
|
|
1
1
|
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
-
import {
|
|
3
|
-
import "../chunk-
|
|
4
|
-
|
|
2
|
+
import { Icon } from "../chunk-2R7AUPJL.js";
|
|
3
|
+
import { __name } from "../chunk-V4MHYKRI.js";
|
|
4
|
+
|
|
5
|
+
// src/components/NotificationCard/NotificationCard.tsx
|
|
6
|
+
import { Box, Card, CloseButton, Link, Tag, Text } from "@ttoss/ui";
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
var NotificationCard = /* @__PURE__ */__name(props => {
|
|
9
|
+
const sxMap = {
|
|
10
|
+
success: {
|
|
11
|
+
card: {
|
|
12
|
+
backgroundColor: "feedback.background.positive.default",
|
|
13
|
+
borderColor: "feedback.border.positive.default"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
error: {
|
|
17
|
+
card: {
|
|
18
|
+
backgroundColor: "feedback.background.negative.default",
|
|
19
|
+
borderColor: "feedback.border.negative.default"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
warning: {
|
|
23
|
+
card: {
|
|
24
|
+
backgroundColor: "feedback.background.caution.default",
|
|
25
|
+
borderColor: "feedback.border.caution.default"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
info: {
|
|
29
|
+
card: {
|
|
30
|
+
backgroundColor: "feedback.background.primary.default",
|
|
31
|
+
borderColor: "feedback.border.primary.default"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
neutral: {
|
|
35
|
+
card: {
|
|
36
|
+
backgroundColor: "feedback.background.primary.default",
|
|
37
|
+
borderColor: "feedback.border.primary.default"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const icon = {
|
|
42
|
+
success: "success-circle",
|
|
43
|
+
error: "error",
|
|
44
|
+
warning: "warning-alt",
|
|
45
|
+
info: "info",
|
|
46
|
+
neutral: "info"
|
|
47
|
+
};
|
|
48
|
+
const hasCaption = Boolean(props.caption);
|
|
49
|
+
const hasActions = Boolean(props.actions && props.actions.length > 0);
|
|
50
|
+
const hasTitle = Boolean(props.title);
|
|
51
|
+
const shouldCenterVerticallyWithoutTitle = !hasCaption && !hasActions && !hasTitle;
|
|
52
|
+
const shouldCenterVerticallyWithTitle = !hasCaption && !hasActions && hasTitle;
|
|
53
|
+
const shouldAddMinHeight = !hasCaption && !hasActions;
|
|
54
|
+
return /* @__PURE__ */React.createElement(Card, {
|
|
55
|
+
sx: {
|
|
56
|
+
...sxMap[props.type].card,
|
|
57
|
+
width: "full"
|
|
58
|
+
}
|
|
59
|
+
}, props.title && /* @__PURE__ */React.createElement(Card.Title, {
|
|
60
|
+
sx: {
|
|
61
|
+
display: "flex",
|
|
62
|
+
justifyContent: "space-between",
|
|
63
|
+
alignItems: "center",
|
|
64
|
+
fontSize: ["md", "xl"],
|
|
65
|
+
paddingY: ["1", "2", "4"],
|
|
66
|
+
paddingX: ["2", "4", "8"]
|
|
67
|
+
}
|
|
68
|
+
}, /* @__PURE__ */React.createElement(Text, {
|
|
69
|
+
sx: {
|
|
70
|
+
display: "inline-flex",
|
|
71
|
+
alignItems: "flex-start",
|
|
72
|
+
gap: "2",
|
|
73
|
+
flexDirection: "row",
|
|
74
|
+
flexWrap: "wrap"
|
|
75
|
+
}
|
|
76
|
+
}, /* @__PURE__ */React.createElement(Box, {
|
|
77
|
+
sx: {
|
|
78
|
+
display: "flex",
|
|
79
|
+
alignItems: "center",
|
|
80
|
+
gap: "2"
|
|
81
|
+
}
|
|
82
|
+
}, /* @__PURE__ */React.createElement(Icon, {
|
|
83
|
+
icon: icon[props.type]
|
|
84
|
+
}), props.title), props.tags && (Array.isArray(props.tags) ? props.tags.length > 0 : true) && (Array.isArray(props.tags) ? props.tags.map((tag, index) => {
|
|
85
|
+
return /* @__PURE__ */React.createElement(Tag, {
|
|
86
|
+
key: index
|
|
87
|
+
}, tag);
|
|
88
|
+
}) : /* @__PURE__ */React.createElement(Tag, null, props.tags))), props.onClose && /* @__PURE__ */React.createElement(Box, {
|
|
89
|
+
sx: {
|
|
90
|
+
marginLeft: "auto"
|
|
91
|
+
}
|
|
92
|
+
}, /* @__PURE__ */React.createElement(CloseButton, {
|
|
93
|
+
onClick: props.onClose
|
|
94
|
+
}))), /* @__PURE__ */React.createElement(Card.Body, {
|
|
95
|
+
sx: {
|
|
96
|
+
...sxMap[props.type].card,
|
|
97
|
+
display: "flex",
|
|
98
|
+
flexDirection: "column",
|
|
99
|
+
gap: "2",
|
|
100
|
+
paddingY: ["1", "2", "4"],
|
|
101
|
+
paddingX: ["2", "4", "8"]
|
|
102
|
+
}
|
|
103
|
+
}, /* @__PURE__ */React.createElement(Box, {
|
|
104
|
+
sx: {
|
|
105
|
+
display: "flex",
|
|
106
|
+
justifyContent: "space-between",
|
|
107
|
+
minHeight: shouldAddMinHeight ? "40px" : "auto",
|
|
108
|
+
alignItems: shouldCenterVerticallyWithoutTitle ? "center" : shouldCenterVerticallyWithTitle ? "center" : "flex-start",
|
|
109
|
+
width: "100%",
|
|
110
|
+
gap: "4"
|
|
111
|
+
}
|
|
112
|
+
}, /* @__PURE__ */React.createElement(Box, {
|
|
113
|
+
sx: {
|
|
114
|
+
flex: 1
|
|
115
|
+
}
|
|
116
|
+
}, /* @__PURE__ */React.createElement(Text, {
|
|
117
|
+
sx: {
|
|
118
|
+
fontSize: ["sm", "md"]
|
|
119
|
+
}
|
|
120
|
+
}, props.message))), props.actions && props.actions.length > 0 && /* @__PURE__ */React.createElement(Box, {
|
|
121
|
+
sx: {
|
|
122
|
+
display: "flex",
|
|
123
|
+
flexDirection: "column",
|
|
124
|
+
gap: 2,
|
|
125
|
+
mt: 2
|
|
126
|
+
}
|
|
127
|
+
}, props.actions.map((action, index) => {
|
|
128
|
+
return action.action === "open_url" ? /* @__PURE__ */React.createElement(Link, {
|
|
129
|
+
key: index,
|
|
130
|
+
href: action.url,
|
|
131
|
+
target: "_blank",
|
|
132
|
+
rel: "noopener noreferrer",
|
|
133
|
+
sx: {
|
|
134
|
+
color: "action.text.accent.default",
|
|
135
|
+
cursor: "pointer"
|
|
136
|
+
}
|
|
137
|
+
}, action.label || "Acessar") : null;
|
|
138
|
+
})), props.caption && /* @__PURE__ */React.createElement(Box, {
|
|
139
|
+
sx: {
|
|
140
|
+
whiteSpace: "nowrap",
|
|
141
|
+
mt: 6
|
|
142
|
+
}
|
|
143
|
+
}, /* @__PURE__ */React.createElement(Text, {
|
|
144
|
+
sx: {
|
|
145
|
+
fontSize: "xs",
|
|
146
|
+
color: "text.secondary"
|
|
147
|
+
}
|
|
148
|
+
}, props.caption)), !props.title && props.onClose && /* @__PURE__ */React.createElement(Box, {
|
|
149
|
+
sx: {
|
|
150
|
+
alignSelf: "flex-end"
|
|
151
|
+
}
|
|
152
|
+
}, /* @__PURE__ */React.createElement(CloseButton, {
|
|
153
|
+
onClick: props.onClose
|
|
154
|
+
}))));
|
|
155
|
+
}, "NotificationCard");
|
|
5
156
|
export { NotificationCard };
|
|
@@ -1,11 +1,164 @@
|
|
|
1
1
|
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
-
import { NotificationCard } from "../chunk-4GBVRL7E.js";
|
|
3
2
|
import { Icon } from "../chunk-2R7AUPJL.js";
|
|
4
3
|
import { __name } from "../chunk-V4MHYKRI.js";
|
|
5
4
|
|
|
6
5
|
// src/components/NotificationsMenu/NotificationsMenu.tsx
|
|
7
|
-
import { Box, Button, Card, Flex, IconButton, Text } from "@ttoss/ui";
|
|
6
|
+
import { Box as Box2, Button, Card as Card2, Flex, IconButton, Text as Text2 } from "@ttoss/ui";
|
|
7
|
+
import * as React2 from "react";
|
|
8
|
+
|
|
9
|
+
// src/components/NotificationCard/NotificationCard.tsx
|
|
10
|
+
import { Box, Card, CloseButton, Link, Tag, Text } from "@ttoss/ui";
|
|
8
11
|
import * as React from "react";
|
|
12
|
+
var NotificationCard = /* @__PURE__ */__name(props => {
|
|
13
|
+
const sxMap = {
|
|
14
|
+
success: {
|
|
15
|
+
card: {
|
|
16
|
+
backgroundColor: "feedback.background.positive.default",
|
|
17
|
+
borderColor: "feedback.border.positive.default"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
error: {
|
|
21
|
+
card: {
|
|
22
|
+
backgroundColor: "feedback.background.negative.default",
|
|
23
|
+
borderColor: "feedback.border.negative.default"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
warning: {
|
|
27
|
+
card: {
|
|
28
|
+
backgroundColor: "feedback.background.caution.default",
|
|
29
|
+
borderColor: "feedback.border.caution.default"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
info: {
|
|
33
|
+
card: {
|
|
34
|
+
backgroundColor: "feedback.background.primary.default",
|
|
35
|
+
borderColor: "feedback.border.primary.default"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
neutral: {
|
|
39
|
+
card: {
|
|
40
|
+
backgroundColor: "feedback.background.primary.default",
|
|
41
|
+
borderColor: "feedback.border.primary.default"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const icon = {
|
|
46
|
+
success: "success-circle",
|
|
47
|
+
error: "error",
|
|
48
|
+
warning: "warning-alt",
|
|
49
|
+
info: "info",
|
|
50
|
+
neutral: "info"
|
|
51
|
+
};
|
|
52
|
+
const hasCaption = Boolean(props.caption);
|
|
53
|
+
const hasActions = Boolean(props.actions && props.actions.length > 0);
|
|
54
|
+
const hasTitle = Boolean(props.title);
|
|
55
|
+
const shouldCenterVerticallyWithoutTitle = !hasCaption && !hasActions && !hasTitle;
|
|
56
|
+
const shouldCenterVerticallyWithTitle = !hasCaption && !hasActions && hasTitle;
|
|
57
|
+
const shouldAddMinHeight = !hasCaption && !hasActions;
|
|
58
|
+
return /* @__PURE__ */React.createElement(Card, {
|
|
59
|
+
sx: {
|
|
60
|
+
...sxMap[props.type].card,
|
|
61
|
+
width: "full"
|
|
62
|
+
}
|
|
63
|
+
}, props.title && /* @__PURE__ */React.createElement(Card.Title, {
|
|
64
|
+
sx: {
|
|
65
|
+
display: "flex",
|
|
66
|
+
justifyContent: "space-between",
|
|
67
|
+
alignItems: "center",
|
|
68
|
+
fontSize: ["md", "xl"],
|
|
69
|
+
paddingY: ["1", "2", "4"],
|
|
70
|
+
paddingX: ["2", "4", "8"]
|
|
71
|
+
}
|
|
72
|
+
}, /* @__PURE__ */React.createElement(Text, {
|
|
73
|
+
sx: {
|
|
74
|
+
display: "inline-flex",
|
|
75
|
+
alignItems: "flex-start",
|
|
76
|
+
gap: "2",
|
|
77
|
+
flexDirection: "row",
|
|
78
|
+
flexWrap: "wrap"
|
|
79
|
+
}
|
|
80
|
+
}, /* @__PURE__ */React.createElement(Box, {
|
|
81
|
+
sx: {
|
|
82
|
+
display: "flex",
|
|
83
|
+
alignItems: "center",
|
|
84
|
+
gap: "2"
|
|
85
|
+
}
|
|
86
|
+
}, /* @__PURE__ */React.createElement(Icon, {
|
|
87
|
+
icon: icon[props.type]
|
|
88
|
+
}), props.title), props.tags && (Array.isArray(props.tags) ? props.tags.length > 0 : true) && (Array.isArray(props.tags) ? props.tags.map((tag, index) => {
|
|
89
|
+
return /* @__PURE__ */React.createElement(Tag, {
|
|
90
|
+
key: index
|
|
91
|
+
}, tag);
|
|
92
|
+
}) : /* @__PURE__ */React.createElement(Tag, null, props.tags))), props.onClose && /* @__PURE__ */React.createElement(Box, {
|
|
93
|
+
sx: {
|
|
94
|
+
marginLeft: "auto"
|
|
95
|
+
}
|
|
96
|
+
}, /* @__PURE__ */React.createElement(CloseButton, {
|
|
97
|
+
onClick: props.onClose
|
|
98
|
+
}))), /* @__PURE__ */React.createElement(Card.Body, {
|
|
99
|
+
sx: {
|
|
100
|
+
...sxMap[props.type].card,
|
|
101
|
+
display: "flex",
|
|
102
|
+
flexDirection: "column",
|
|
103
|
+
gap: "2",
|
|
104
|
+
paddingY: ["1", "2", "4"],
|
|
105
|
+
paddingX: ["2", "4", "8"]
|
|
106
|
+
}
|
|
107
|
+
}, /* @__PURE__ */React.createElement(Box, {
|
|
108
|
+
sx: {
|
|
109
|
+
display: "flex",
|
|
110
|
+
justifyContent: "space-between",
|
|
111
|
+
minHeight: shouldAddMinHeight ? "40px" : "auto",
|
|
112
|
+
alignItems: shouldCenterVerticallyWithoutTitle ? "center" : shouldCenterVerticallyWithTitle ? "center" : "flex-start",
|
|
113
|
+
width: "100%",
|
|
114
|
+
gap: "4"
|
|
115
|
+
}
|
|
116
|
+
}, /* @__PURE__ */React.createElement(Box, {
|
|
117
|
+
sx: {
|
|
118
|
+
flex: 1
|
|
119
|
+
}
|
|
120
|
+
}, /* @__PURE__ */React.createElement(Text, {
|
|
121
|
+
sx: {
|
|
122
|
+
fontSize: ["sm", "md"]
|
|
123
|
+
}
|
|
124
|
+
}, props.message))), props.actions && props.actions.length > 0 && /* @__PURE__ */React.createElement(Box, {
|
|
125
|
+
sx: {
|
|
126
|
+
display: "flex",
|
|
127
|
+
flexDirection: "column",
|
|
128
|
+
gap: 2,
|
|
129
|
+
mt: 2
|
|
130
|
+
}
|
|
131
|
+
}, props.actions.map((action, index) => {
|
|
132
|
+
return action.action === "open_url" ? /* @__PURE__ */React.createElement(Link, {
|
|
133
|
+
key: index,
|
|
134
|
+
href: action.url,
|
|
135
|
+
target: "_blank",
|
|
136
|
+
rel: "noopener noreferrer",
|
|
137
|
+
sx: {
|
|
138
|
+
color: "action.text.accent.default",
|
|
139
|
+
cursor: "pointer"
|
|
140
|
+
}
|
|
141
|
+
}, action.label || "Acessar") : null;
|
|
142
|
+
})), props.caption && /* @__PURE__ */React.createElement(Box, {
|
|
143
|
+
sx: {
|
|
144
|
+
whiteSpace: "nowrap",
|
|
145
|
+
mt: 6
|
|
146
|
+
}
|
|
147
|
+
}, /* @__PURE__ */React.createElement(Text, {
|
|
148
|
+
sx: {
|
|
149
|
+
fontSize: "xs",
|
|
150
|
+
color: "text.secondary"
|
|
151
|
+
}
|
|
152
|
+
}, props.caption)), !props.title && props.onClose && /* @__PURE__ */React.createElement(Box, {
|
|
153
|
+
sx: {
|
|
154
|
+
alignSelf: "flex-end"
|
|
155
|
+
}
|
|
156
|
+
}, /* @__PURE__ */React.createElement(CloseButton, {
|
|
157
|
+
onClick: props.onClose
|
|
158
|
+
}))));
|
|
159
|
+
}, "NotificationCard");
|
|
160
|
+
|
|
161
|
+
// src/components/NotificationsMenu/NotificationsMenu.tsx
|
|
9
162
|
var NotificationsMenu = /* @__PURE__ */__name(({
|
|
10
163
|
notifications,
|
|
11
164
|
defaultOpen = false,
|
|
@@ -16,12 +169,12 @@ var NotificationsMenu = /* @__PURE__ */__name(({
|
|
|
16
169
|
onClose,
|
|
17
170
|
onClearAll
|
|
18
171
|
}) => {
|
|
19
|
-
const [isOpen, setIsOpen] =
|
|
20
|
-
const [openToLeft, setOpenToLeft] =
|
|
21
|
-
const buttonRef =
|
|
22
|
-
const containerRef =
|
|
23
|
-
const loadMoreRef =
|
|
24
|
-
const [showCount, setShowCount] =
|
|
172
|
+
const [isOpen, setIsOpen] = React2.useState(defaultOpen);
|
|
173
|
+
const [openToLeft, setOpenToLeft] = React2.useState(false);
|
|
174
|
+
const buttonRef = React2.useRef(null);
|
|
175
|
+
const containerRef = React2.useRef(null);
|
|
176
|
+
const loadMoreRef = React2.useRef(null);
|
|
177
|
+
const [showCount, setShowCount] = React2.useState(true);
|
|
25
178
|
const togglePanel = /* @__PURE__ */__name(() => {
|
|
26
179
|
setIsOpen(prev => {
|
|
27
180
|
const next = !prev;
|
|
@@ -29,7 +182,7 @@ var NotificationsMenu = /* @__PURE__ */__name(({
|
|
|
29
182
|
return next;
|
|
30
183
|
});
|
|
31
184
|
}, "togglePanel");
|
|
32
|
-
|
|
185
|
+
React2.useEffect(() => {
|
|
33
186
|
if (!isOpen || !buttonRef.current) return;
|
|
34
187
|
const rect = buttonRef.current.getBoundingClientRect();
|
|
35
188
|
const spaceRight = window.innerWidth - rect.right;
|
|
@@ -37,7 +190,7 @@ var NotificationsMenu = /* @__PURE__ */__name(({
|
|
|
37
190
|
setShowCount(false);
|
|
38
191
|
setOpenToLeft(spaceRight < 500 && spaceLeft > spaceRight);
|
|
39
192
|
}, [isOpen]);
|
|
40
|
-
|
|
193
|
+
React2.useEffect(() => {
|
|
41
194
|
if (!hasMore || !onLoadMore || !loadMoreRef.current) return;
|
|
42
195
|
const observer = new IntersectionObserver(entries => {
|
|
43
196
|
if (entries[0].isIntersecting) {
|
|
@@ -55,7 +208,7 @@ var NotificationsMenu = /* @__PURE__ */__name(({
|
|
|
55
208
|
}
|
|
56
209
|
};
|
|
57
210
|
}, [hasMore, onLoadMore, notifications.length]);
|
|
58
|
-
|
|
211
|
+
React2.useEffect(() => {
|
|
59
212
|
if (!isOpen) return;
|
|
60
213
|
const handleClickOutside = /* @__PURE__ */__name(event => {
|
|
61
214
|
if (containerRef.current && !containerRef.current.contains(event.target) && buttonRef.current && !buttonRef.current.contains(event.target)) {
|
|
@@ -69,16 +222,16 @@ var NotificationsMenu = /* @__PURE__ */__name(({
|
|
|
69
222
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
70
223
|
};
|
|
71
224
|
}, [isOpen, onOpenChange, onClose]);
|
|
72
|
-
return /* @__PURE__ */
|
|
225
|
+
return /* @__PURE__ */React2.createElement(Flex, {
|
|
73
226
|
sx: {
|
|
74
227
|
position: "relative",
|
|
75
228
|
justifyContent: "flex-start"
|
|
76
229
|
}
|
|
77
|
-
}, /* @__PURE__ */
|
|
230
|
+
}, /* @__PURE__ */React2.createElement(Box2, {
|
|
78
231
|
sx: {
|
|
79
232
|
position: "relative"
|
|
80
233
|
}
|
|
81
|
-
}, /* @__PURE__ */
|
|
234
|
+
}, /* @__PURE__ */React2.createElement(IconButton, {
|
|
82
235
|
ref: buttonRef,
|
|
83
236
|
variant: "ghost",
|
|
84
237
|
sx: {
|
|
@@ -91,15 +244,15 @@ var NotificationsMenu = /* @__PURE__ */__name(({
|
|
|
91
244
|
}
|
|
92
245
|
},
|
|
93
246
|
onClick: togglePanel
|
|
94
|
-
}, /* @__PURE__ */
|
|
247
|
+
}, /* @__PURE__ */React2.createElement(Box2, {
|
|
95
248
|
sx: {
|
|
96
249
|
color: "display.text.muted.default"
|
|
97
250
|
}
|
|
98
|
-
}, /* @__PURE__ */
|
|
251
|
+
}, /* @__PURE__ */React2.createElement(Icon, {
|
|
99
252
|
icon: "mdi:bell-outline",
|
|
100
253
|
width: 22,
|
|
101
254
|
height: 22
|
|
102
|
-
})), count > 0 && showCount && /* @__PURE__ */
|
|
255
|
+
})), count > 0 && showCount && /* @__PURE__ */React2.createElement(Box2, {
|
|
103
256
|
sx: {
|
|
104
257
|
position: "absolute",
|
|
105
258
|
top: "-2px",
|
|
@@ -117,9 +270,9 @@ var NotificationsMenu = /* @__PURE__ */__name(({
|
|
|
117
270
|
justifyContent: "center",
|
|
118
271
|
lineHeight: 1
|
|
119
272
|
}
|
|
120
|
-
}, count > 99 ? "99+" : count)), isOpen && /* @__PURE__ */
|
|
273
|
+
}, count > 99 ? "99+" : count)), isOpen && /* @__PURE__ */React2.createElement("div", {
|
|
121
274
|
ref: containerRef
|
|
122
|
-
}, /* @__PURE__ */
|
|
275
|
+
}, /* @__PURE__ */React2.createElement(Card2, {
|
|
123
276
|
sx: {
|
|
124
277
|
position: "absolute",
|
|
125
278
|
top: "calc(100% + 8px)",
|
|
@@ -134,22 +287,22 @@ var NotificationsMenu = /* @__PURE__ */__name(({
|
|
|
134
287
|
borderRadius: "2xl",
|
|
135
288
|
backgroundColor: "display.background.secondary.default"
|
|
136
289
|
}
|
|
137
|
-
}, /* @__PURE__ */
|
|
290
|
+
}, /* @__PURE__ */React2.createElement(Box2, {
|
|
138
291
|
sx: {
|
|
139
292
|
width: "100%"
|
|
140
293
|
}
|
|
141
|
-
}, /* @__PURE__ */
|
|
294
|
+
}, /* @__PURE__ */React2.createElement(Flex, {
|
|
142
295
|
sx: {
|
|
143
296
|
flexDirection: "column",
|
|
144
297
|
gap: 4
|
|
145
298
|
}
|
|
146
|
-
}, notifications.length > 0 && onClearAll && /* @__PURE__ */
|
|
299
|
+
}, notifications.length > 0 && onClearAll && /* @__PURE__ */React2.createElement(Flex, {
|
|
147
300
|
sx: {
|
|
148
301
|
justifyContent: "flex-end",
|
|
149
302
|
p: 2,
|
|
150
303
|
marginBottom: -2
|
|
151
304
|
}
|
|
152
|
-
}, /* @__PURE__ */
|
|
305
|
+
}, /* @__PURE__ */React2.createElement(Button, {
|
|
153
306
|
variant: "ghost",
|
|
154
307
|
sx: {
|
|
155
308
|
borderRadius: "md",
|
|
@@ -170,24 +323,24 @@ var NotificationsMenu = /* @__PURE__ */__name(({
|
|
|
170
323
|
}
|
|
171
324
|
},
|
|
172
325
|
onClick: onClearAll
|
|
173
|
-
}, /* @__PURE__ */
|
|
326
|
+
}, /* @__PURE__ */React2.createElement(Icon, {
|
|
174
327
|
icon: "delete",
|
|
175
328
|
width: 16,
|
|
176
329
|
height: 16
|
|
177
|
-
}), /* @__PURE__ */
|
|
330
|
+
}), /* @__PURE__ */React2.createElement(Text2, {
|
|
178
331
|
sx: {
|
|
179
332
|
ml: -1,
|
|
180
333
|
marginTop: -0.4,
|
|
181
334
|
fontSize: "sm"
|
|
182
335
|
}
|
|
183
|
-
}, "Limpar Tudo"))), notifications.length === 0 ? /* @__PURE__ */
|
|
336
|
+
}, "Limpar Tudo"))), notifications.length === 0 ? /* @__PURE__ */React2.createElement(Text2, {
|
|
184
337
|
sx: {
|
|
185
338
|
color: "display.text.muted.default",
|
|
186
339
|
textAlign: "center",
|
|
187
340
|
p: 4
|
|
188
341
|
}
|
|
189
342
|
}, "Nenhuma notifica\xE7\xE3o") : notifications.map(notification => {
|
|
190
|
-
return /* @__PURE__ */
|
|
343
|
+
return /* @__PURE__ */React2.createElement(NotificationCard, {
|
|
191
344
|
key: notification.id,
|
|
192
345
|
...notification,
|
|
193
346
|
onClose: /* @__PURE__ */__name(() => {
|
|
@@ -195,7 +348,7 @@ var NotificationsMenu = /* @__PURE__ */__name(({
|
|
|
195
348
|
onClose?.();
|
|
196
349
|
}, "onClose")
|
|
197
350
|
});
|
|
198
|
-
}), hasMore && /* @__PURE__ */
|
|
351
|
+
}), hasMore && /* @__PURE__ */React2.createElement("div", {
|
|
199
352
|
ref: loadMoreRef,
|
|
200
353
|
style: {
|
|
201
354
|
height: 1
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
import { Icon } from "../chunk-2R7AUPJL.js";
|
|
3
|
+
import { __name } from "../chunk-V4MHYKRI.js";
|
|
4
|
+
|
|
5
|
+
// src/components/SpotlightCard/SpotlightCard.tsx
|
|
6
|
+
import { Box, Button, Card, Flex, Text } from "@ttoss/ui";
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
var SpotlightCard = /* @__PURE__ */__name(({
|
|
9
|
+
icon,
|
|
10
|
+
title,
|
|
11
|
+
subtitle,
|
|
12
|
+
description,
|
|
13
|
+
firstButton,
|
|
14
|
+
secondButton,
|
|
15
|
+
variant = "accent"
|
|
16
|
+
}) => {
|
|
17
|
+
React.useEffect(() => {
|
|
18
|
+
const styleId = "oca-spotlight-animations-v2";
|
|
19
|
+
if (!document.getElementById(styleId)) {
|
|
20
|
+
const style = document.createElement("style");
|
|
21
|
+
style.id = styleId;
|
|
22
|
+
style.innerHTML = `
|
|
23
|
+
@keyframes ocaGradientFlow {
|
|
24
|
+
0% { background-position: 0% 50%; }
|
|
25
|
+
50% { background-position: 100% 50%; }
|
|
26
|
+
100% { background-position: 0% 50%; }
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
document.head.appendChild(style);
|
|
30
|
+
}
|
|
31
|
+
}, []);
|
|
32
|
+
const hasButtons = !!firstButton || !!secondButton;
|
|
33
|
+
const isAccent = variant === "accent";
|
|
34
|
+
const textColorToken = isAccent ? "action.text.accent.default" : "action.text.primary.default";
|
|
35
|
+
const iconColorToken = isAccent ? "action.text.accent.default" : "display.text.accent.default";
|
|
36
|
+
const iconBgToken = isAccent ? "rgba(255,255,255,0.3)" : "action.background.secondary.default";
|
|
37
|
+
const btnPrimaryVariant = isAccent ? "primary" : "accent";
|
|
38
|
+
const btnPrimaryColorToken = isAccent ? "action.text.primary.default" : "action.text.accent.default";
|
|
39
|
+
const btnSecondaryColorToken = textColorToken;
|
|
40
|
+
const btnSecondaryBorderColorToken = isAccent ? "currentColor" : "display.border.muted.default";
|
|
41
|
+
const renderButton = /* @__PURE__ */__name((prop, config) => {
|
|
42
|
+
if (!prop) return null;
|
|
43
|
+
if (/* @__PURE__ */React.isValidElement(prop)) return prop;
|
|
44
|
+
if (typeof prop !== "object") return prop;
|
|
45
|
+
const {
|
|
46
|
+
sx,
|
|
47
|
+
...rest
|
|
48
|
+
} = prop;
|
|
49
|
+
const {
|
|
50
|
+
variant: defaultVariant,
|
|
51
|
+
textColor,
|
|
52
|
+
styles = {}
|
|
53
|
+
} = config;
|
|
54
|
+
return /* @__PURE__ */React.createElement(Button, {
|
|
55
|
+
variant: defaultVariant,
|
|
56
|
+
sx: {
|
|
57
|
+
display: "flex",
|
|
58
|
+
alignItems: "center",
|
|
59
|
+
justifyContent: "center",
|
|
60
|
+
gap: "2",
|
|
61
|
+
px: "6",
|
|
62
|
+
py: "3",
|
|
63
|
+
fontSize: "15px",
|
|
64
|
+
fontWeight: "bold",
|
|
65
|
+
whiteSpace: "nowrap",
|
|
66
|
+
transition: "all 0.2s",
|
|
67
|
+
color: textColor,
|
|
68
|
+
...styles,
|
|
69
|
+
...sx
|
|
70
|
+
},
|
|
71
|
+
...rest
|
|
72
|
+
});
|
|
73
|
+
}, "renderButton");
|
|
74
|
+
return /* @__PURE__ */React.createElement(Card, {
|
|
75
|
+
sx: {
|
|
76
|
+
display: "flex",
|
|
77
|
+
flexDirection: "row",
|
|
78
|
+
flexWrap: "nowrap",
|
|
79
|
+
alignItems: "center",
|
|
80
|
+
justifyContent: "space-between",
|
|
81
|
+
background: /* @__PURE__ */__name(t => {
|
|
82
|
+
const theme = t;
|
|
83
|
+
const bgStart = isAccent ? theme.colors?.action?.background?.accent?.default : theme.colors?.action?.background?.primary?.default;
|
|
84
|
+
const bgMiddle = isAccent ? theme.colors?.action?.background?.accent?.active : theme.colors?.action?.background?.secondary?.default;
|
|
85
|
+
if (isAccent) {
|
|
86
|
+
return `linear-gradient(270deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%),
|
|
87
|
+
linear-gradient(0deg, ${bgStart}, ${bgStart})`;
|
|
88
|
+
}
|
|
89
|
+
return `linear-gradient(270deg, ${bgStart}, ${bgMiddle}, ${bgStart})`;
|
|
90
|
+
}, "background"),
|
|
91
|
+
backgroundSize: isAccent ? "200% 100%, auto" : "400% 400%",
|
|
92
|
+
animation: "ocaGradientFlow 6s ease infinite",
|
|
93
|
+
width: "100%",
|
|
94
|
+
minHeight: "104px",
|
|
95
|
+
borderRadius: "xl",
|
|
96
|
+
boxShadow: "0 4px 20px rgba(0,0,0,0.1)",
|
|
97
|
+
py: "7",
|
|
98
|
+
px: "8",
|
|
99
|
+
gap: "5",
|
|
100
|
+
color: textColorToken,
|
|
101
|
+
overflow: "hidden",
|
|
102
|
+
borderWidth: "1px",
|
|
103
|
+
borderStyle: "solid",
|
|
104
|
+
borderColor: isAccent ? "transparent" : "display.border.muted.default"
|
|
105
|
+
},
|
|
106
|
+
"data-testid": "spotlight-card"
|
|
107
|
+
}, /* @__PURE__ */React.createElement(Flex, {
|
|
108
|
+
sx: {
|
|
109
|
+
alignItems: "center",
|
|
110
|
+
gap: "5",
|
|
111
|
+
flex: 1,
|
|
112
|
+
minWidth: 0
|
|
113
|
+
}
|
|
114
|
+
}, /* @__PURE__ */React.createElement(Box, {
|
|
115
|
+
sx: {
|
|
116
|
+
width: 58,
|
|
117
|
+
height: 58,
|
|
118
|
+
borderRadius: "2xl",
|
|
119
|
+
backgroundColor: iconBgToken,
|
|
120
|
+
display: "flex",
|
|
121
|
+
alignItems: "center",
|
|
122
|
+
justifyContent: "center",
|
|
123
|
+
flexShrink: 0,
|
|
124
|
+
color: iconColorToken
|
|
125
|
+
}
|
|
126
|
+
}, /* @__PURE__ */React.createElement(Icon, {
|
|
127
|
+
icon,
|
|
128
|
+
width: 28
|
|
129
|
+
})), /* @__PURE__ */React.createElement(Box, {
|
|
130
|
+
sx: {
|
|
131
|
+
minWidth: 0
|
|
132
|
+
}
|
|
133
|
+
}, /* @__PURE__ */React.createElement(Text, {
|
|
134
|
+
as: "div",
|
|
135
|
+
sx: {
|
|
136
|
+
fontFamily: "heading",
|
|
137
|
+
fontWeight: 800,
|
|
138
|
+
fontSize: "24px",
|
|
139
|
+
lineHeight: 1.2,
|
|
140
|
+
color: "inherit",
|
|
141
|
+
whiteSpace: "nowrap",
|
|
142
|
+
display: "flex",
|
|
143
|
+
alignItems: "baseline",
|
|
144
|
+
gap: "2"
|
|
145
|
+
}
|
|
146
|
+
}, /* @__PURE__ */React.createElement("span", {
|
|
147
|
+
style: {
|
|
148
|
+
fontWeight: 800,
|
|
149
|
+
letterSpacing: "-0.5px",
|
|
150
|
+
verticalAlign: "middle",
|
|
151
|
+
lineHeight: 1.1
|
|
152
|
+
}
|
|
153
|
+
}, title), subtitle && /* @__PURE__ */React.createElement("span", {
|
|
154
|
+
style: {
|
|
155
|
+
fontWeight: 300,
|
|
156
|
+
fontSize: "20px",
|
|
157
|
+
opacity: 0.8,
|
|
158
|
+
marginLeft: 6,
|
|
159
|
+
verticalAlign: "baseline",
|
|
160
|
+
lineHeight: 1.1
|
|
161
|
+
}
|
|
162
|
+
}, subtitle)), /* @__PURE__ */React.createElement(Text, {
|
|
163
|
+
as: "div",
|
|
164
|
+
sx: {
|
|
165
|
+
fontFamily: "body",
|
|
166
|
+
fontWeight: 400,
|
|
167
|
+
fontSize: "15px",
|
|
168
|
+
color: "inherit",
|
|
169
|
+
opacity: 0.85,
|
|
170
|
+
mt: "1",
|
|
171
|
+
overflow: "hidden",
|
|
172
|
+
textOverflow: "ellipsis",
|
|
173
|
+
display: "-webkit-box",
|
|
174
|
+
WebkitLineClamp: 2,
|
|
175
|
+
WebkitBoxOrient: "vertical"
|
|
176
|
+
}
|
|
177
|
+
}, description))), hasButtons && /* @__PURE__ */React.createElement(Flex, {
|
|
178
|
+
sx: {
|
|
179
|
+
gap: "4",
|
|
180
|
+
alignItems: "center",
|
|
181
|
+
flexShrink: 0,
|
|
182
|
+
ml: "auto"
|
|
183
|
+
}
|
|
184
|
+
}, renderButton(firstButton, {
|
|
185
|
+
variant: btnPrimaryVariant,
|
|
186
|
+
textColor: btnPrimaryColorToken,
|
|
187
|
+
styles: {
|
|
188
|
+
":hover": {
|
|
189
|
+
transform: "translateY(-1px)"
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}), renderButton(secondButton, {
|
|
193
|
+
variant: "secondary",
|
|
194
|
+
textColor: btnSecondaryColorToken,
|
|
195
|
+
styles: {
|
|
196
|
+
backgroundColor: "transparent",
|
|
197
|
+
borderWidth: "1px",
|
|
198
|
+
borderStyle: "solid",
|
|
199
|
+
borderColor: btnSecondaryBorderColorToken,
|
|
200
|
+
opacity: isAccent ? 0.6 : 1,
|
|
201
|
+
cursor: "pointer",
|
|
202
|
+
":hover": {
|
|
203
|
+
backgroundColor: "rgba(255,255,255,0.2)",
|
|
204
|
+
opacity: 1,
|
|
205
|
+
borderColor: btnSecondaryBorderColorToken
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
})));
|
|
209
|
+
}, "SpotlightCard");
|
|
210
|
+
SpotlightCard.displayName = "SpotlightCard";
|
|
211
|
+
export { SpotlightCard };
|