@ttoss/components 2.14.19 → 2.14.21
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/Accordion/index.d.mts +157 -0
- package/dist/Accordion/index.mjs +175 -0
- package/dist/DatePicker/index.d.mts +26 -0
- package/dist/DatePicker/index.mjs +339 -0
- package/dist/Drawer/index.d.mts +17 -0
- package/dist/{esm/Drawer/index.js → Drawer/index.mjs} +21 -14
- package/dist/EnhancedTitle/{index.d.ts → index.d.mts} +57 -47
- package/dist/EnhancedTitle/index.mjs +234 -0
- package/dist/FileUploader/index.d.mts +77 -0
- package/dist/FileUploader/index.mjs +386 -0
- package/dist/InstallPwa/index.d.mts +13 -0
- package/dist/InstallPwa/index.mjs +64 -0
- package/dist/JsonEditor/index.d.mts +3 -0
- package/dist/{esm/JsonEditor/index.js → JsonEditor/index.mjs} +0 -3
- package/dist/JsonView/index.d.mts +3 -0
- package/dist/{esm/JsonView/index.js → JsonView/index.mjs} +0 -3
- package/dist/List/{index.d.ts → index.d.mts} +9 -6
- package/dist/List/index.mjs +34 -0
- package/dist/LockedOverlay/index.d.mts +162 -0
- package/dist/LockedOverlay/index.mjs +386 -0
- package/dist/Markdown/index.d.mts +16 -0
- package/dist/Markdown/index.mjs +26 -0
- package/dist/Menu/index.d.mts +16 -0
- package/dist/{esm/Menu/index.js → Menu/index.mjs} +56 -51
- package/dist/MetricCard/index.d.mts +153 -0
- package/dist/MetricCard/index.mjs +408 -0
- package/dist/Modal/index.d.mts +11 -0
- package/dist/{esm/Modal/index.js → Modal/index.mjs} +11 -12
- package/dist/NavList/index.d.mts +64 -0
- package/dist/{esm/NavList/index.js → NavList/index.mjs} +79 -73
- package/dist/NotificationCard/index.d.mts +22 -0
- package/dist/NotificationCard/index.mjs +173 -0
- package/dist/NotificationsMenu/index.d.mts +47 -0
- package/dist/NotificationsMenu/index.mjs +380 -0
- package/dist/Search/index.d.mts +18 -0
- package/dist/{esm/Search/index.js → Search/index.mjs} +11 -9
- package/dist/SpotlightCard/index.d.mts +36 -0
- package/dist/SpotlightCard/index.mjs +219 -0
- package/dist/Table/index.d.mts +17 -0
- package/dist/Table/index.mjs +64 -0
- package/dist/Tabs/index.d.mts +17 -0
- package/dist/{esm/Tabs/index.js → Tabs/index.mjs} +24 -12
- package/dist/Toast/index.d.mts +8 -0
- package/dist/Toast/index.mjs +43 -0
- package/package.json +15 -15
- package/dist/Accordion/index.d.ts +0 -148
- package/dist/DatePicker/index.d.ts +0 -20
- package/dist/Drawer/index.d.ts +0 -12
- package/dist/FileUploader/index.d.ts +0 -55
- package/dist/InstallPwa/index.d.ts +0 -10
- package/dist/JsonEditor/index.d.ts +0 -2
- package/dist/JsonView/index.d.ts +0 -1
- package/dist/LockedOverlay/index.d.ts +0 -151
- package/dist/Markdown/index.d.ts +0 -11
- package/dist/Menu/index.d.ts +0 -11
- package/dist/MetricCard/index.d.ts +0 -148
- package/dist/Modal/index.d.ts +0 -10
- package/dist/NavList/index.d.ts +0 -55
- package/dist/NotificationCard/index.d.ts +0 -21
- package/dist/NotificationsMenu/index.d.ts +0 -36
- package/dist/Search/index.d.ts +0 -11
- package/dist/SpotlightCard/index.d.ts +0 -27
- package/dist/Table/index.d.ts +0 -16
- package/dist/esm/Accordion/index.js +0 -119
- package/dist/esm/DatePicker/index.js +0 -331
- package/dist/esm/EnhancedTitle/index.js +0 -190
- package/dist/esm/FileUploader/index.js +0 -401
- package/dist/esm/InstallPwa/index.js +0 -61
- package/dist/esm/List/index.js +0 -30
- package/dist/esm/LockedOverlay/index.js +0 -316
- package/dist/esm/Markdown/index.js +0 -23
- package/dist/esm/MetricCard/index.js +0 -327
- package/dist/esm/NotificationCard/index.js +0 -156
- package/dist/esm/NotificationsMenu/index.js +0 -359
- package/dist/esm/SpotlightCard/index.js +0 -212
- package/dist/esm/Table/index.js +0 -63
- package/dist/esm/Toast/index.js +0 -38
- package/dist/esm/chunk-V4MHYKRI.js +0 -7
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
import { Icon } from "@ttoss/react-icons";
|
|
3
|
+
import { Box, Button, Card, CloseButton, Flex, IconButton, Link, Tag, Text } from "@ttoss/ui";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/components/NotificationCard/NotificationCard.tsx
|
|
8
|
+
const NotificationCard = 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__ */jsxs(Card, {
|
|
55
|
+
sx: {
|
|
56
|
+
...sxMap[props.type].card,
|
|
57
|
+
width: "full"
|
|
58
|
+
},
|
|
59
|
+
children: [props.title && /* @__PURE__ */jsxs(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
|
+
children: [/* @__PURE__ */jsxs(Text, {
|
|
69
|
+
sx: {
|
|
70
|
+
display: "inline-flex",
|
|
71
|
+
alignItems: "flex-start",
|
|
72
|
+
gap: "2",
|
|
73
|
+
flexDirection: "row",
|
|
74
|
+
flexWrap: "wrap"
|
|
75
|
+
},
|
|
76
|
+
children: [/* @__PURE__ */jsxs(Box, {
|
|
77
|
+
sx: {
|
|
78
|
+
display: "flex",
|
|
79
|
+
alignItems: "center",
|
|
80
|
+
gap: "2"
|
|
81
|
+
},
|
|
82
|
+
children: [/* @__PURE__ */jsx(Icon, {
|
|
83
|
+
icon: icon[props.type]
|
|
84
|
+
}), props.title]
|
|
85
|
+
}), props.tags && (Array.isArray(props.tags) ? props.tags.length > 0 : true) && (Array.isArray(props.tags) ? props.tags.map((tag, index) => {
|
|
86
|
+
return /* @__PURE__ */jsx(Tag, {
|
|
87
|
+
children: tag
|
|
88
|
+
}, index);
|
|
89
|
+
}) : /* @__PURE__ */jsx(Tag, {
|
|
90
|
+
children: props.tags
|
|
91
|
+
}))]
|
|
92
|
+
}), props.onClose && /* @__PURE__ */jsx(Box, {
|
|
93
|
+
sx: {
|
|
94
|
+
marginLeft: "auto"
|
|
95
|
+
},
|
|
96
|
+
children: /* @__PURE__ */jsx(CloseButton, {
|
|
97
|
+
onClick: props.onClose
|
|
98
|
+
})
|
|
99
|
+
})]
|
|
100
|
+
}), /* @__PURE__ */jsxs(Card.Body, {
|
|
101
|
+
sx: {
|
|
102
|
+
...sxMap[props.type].card,
|
|
103
|
+
display: "flex",
|
|
104
|
+
flexDirection: "column",
|
|
105
|
+
gap: "2",
|
|
106
|
+
paddingY: ["1", "2", "4"],
|
|
107
|
+
paddingX: ["2", "4", "8"]
|
|
108
|
+
},
|
|
109
|
+
children: [/* @__PURE__ */jsx(Box, {
|
|
110
|
+
sx: {
|
|
111
|
+
display: "flex",
|
|
112
|
+
justifyContent: "space-between",
|
|
113
|
+
minHeight: shouldAddMinHeight ? "40px" : "auto",
|
|
114
|
+
alignItems: shouldCenterVerticallyWithoutTitle ? "center" : shouldCenterVerticallyWithTitle ? "center" : "flex-start",
|
|
115
|
+
width: "100%",
|
|
116
|
+
gap: "4"
|
|
117
|
+
},
|
|
118
|
+
children: /* @__PURE__ */jsx(Box, {
|
|
119
|
+
sx: {
|
|
120
|
+
flex: 1
|
|
121
|
+
},
|
|
122
|
+
children: /* @__PURE__ */jsx(Text, {
|
|
123
|
+
sx: {
|
|
124
|
+
fontSize: ["sm", "md"]
|
|
125
|
+
},
|
|
126
|
+
children: props.message
|
|
127
|
+
})
|
|
128
|
+
})
|
|
129
|
+
}), props.actions && props.actions.length > 0 && /* @__PURE__ */jsx(Box, {
|
|
130
|
+
sx: {
|
|
131
|
+
display: "flex",
|
|
132
|
+
flexDirection: "column",
|
|
133
|
+
gap: 2,
|
|
134
|
+
mt: 2
|
|
135
|
+
},
|
|
136
|
+
children: props.actions.map((action, index) => {
|
|
137
|
+
return action.action === "open_url" ? /* @__PURE__ */jsx(Link, {
|
|
138
|
+
href: action.url,
|
|
139
|
+
target: "_blank",
|
|
140
|
+
rel: "noopener noreferrer",
|
|
141
|
+
sx: {
|
|
142
|
+
color: "action.text.accent.default",
|
|
143
|
+
cursor: "pointer"
|
|
144
|
+
},
|
|
145
|
+
children: action.label || "Acessar"
|
|
146
|
+
}, index) : null;
|
|
147
|
+
})
|
|
148
|
+
}), props.caption && /* @__PURE__ */jsx(Box, {
|
|
149
|
+
sx: {
|
|
150
|
+
whiteSpace: "nowrap",
|
|
151
|
+
mt: 6
|
|
152
|
+
},
|
|
153
|
+
children: /* @__PURE__ */jsx(Text, {
|
|
154
|
+
sx: {
|
|
155
|
+
fontSize: "xs",
|
|
156
|
+
color: "text.secondary"
|
|
157
|
+
},
|
|
158
|
+
children: props.caption
|
|
159
|
+
})
|
|
160
|
+
}), !props.title && props.onClose && /* @__PURE__ */jsx(Box, {
|
|
161
|
+
sx: {
|
|
162
|
+
alignSelf: "flex-end"
|
|
163
|
+
},
|
|
164
|
+
children: /* @__PURE__ */jsx(CloseButton, {
|
|
165
|
+
onClick: props.onClose
|
|
166
|
+
})
|
|
167
|
+
})]
|
|
168
|
+
})]
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
//#endregion
|
|
173
|
+
//#region src/components/NotificationsMenu/NotificationsMenu.tsx
|
|
174
|
+
const NotificationsMenu = ({
|
|
175
|
+
notifications,
|
|
176
|
+
defaultOpen = false,
|
|
177
|
+
hasMore = false,
|
|
178
|
+
onLoadMore,
|
|
179
|
+
onOpenChange,
|
|
180
|
+
count,
|
|
181
|
+
onClose,
|
|
182
|
+
onClearAll
|
|
183
|
+
}) => {
|
|
184
|
+
const [isOpen, setIsOpen] = React.useState(defaultOpen);
|
|
185
|
+
const [openToLeft, setOpenToLeft] = React.useState(false);
|
|
186
|
+
const buttonRef = React.useRef(null);
|
|
187
|
+
const containerRef = React.useRef(null);
|
|
188
|
+
const loadMoreRef = React.useRef(null);
|
|
189
|
+
const [showCount, setShowCount] = React.useState(true);
|
|
190
|
+
const togglePanel = () => {
|
|
191
|
+
setIsOpen(prev => {
|
|
192
|
+
const next = !prev;
|
|
193
|
+
onOpenChange?.(next);
|
|
194
|
+
return next;
|
|
195
|
+
});
|
|
196
|
+
};
|
|
197
|
+
React.useEffect(() => {
|
|
198
|
+
if (!isOpen || !buttonRef.current) return;
|
|
199
|
+
const rect = buttonRef.current.getBoundingClientRect();
|
|
200
|
+
const spaceRight = window.innerWidth - rect.right;
|
|
201
|
+
const spaceLeft = rect.left;
|
|
202
|
+
setShowCount(false);
|
|
203
|
+
setOpenToLeft(spaceRight < 500 && spaceLeft > spaceRight);
|
|
204
|
+
}, [isOpen]);
|
|
205
|
+
React.useEffect(() => {
|
|
206
|
+
if (!hasMore || !onLoadMore || !loadMoreRef.current) return;
|
|
207
|
+
const observer = new IntersectionObserver(entries => {
|
|
208
|
+
if (entries[0].isIntersecting) onLoadMore();
|
|
209
|
+
}, {
|
|
210
|
+
root: null,
|
|
211
|
+
rootMargin: "0px",
|
|
212
|
+
threshold: 1
|
|
213
|
+
});
|
|
214
|
+
observer.observe(loadMoreRef.current);
|
|
215
|
+
return () => {
|
|
216
|
+
if (loadMoreRef.current) observer.unobserve(loadMoreRef.current);
|
|
217
|
+
};
|
|
218
|
+
}, [hasMore, onLoadMore, notifications.length]);
|
|
219
|
+
React.useEffect(() => {
|
|
220
|
+
if (!isOpen) return;
|
|
221
|
+
const handleClickOutside = event => {
|
|
222
|
+
if (containerRef.current && !containerRef.current.contains(event.target) && buttonRef.current && !buttonRef.current.contains(event.target)) {
|
|
223
|
+
setIsOpen(false);
|
|
224
|
+
onOpenChange?.(false);
|
|
225
|
+
onClose?.();
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
229
|
+
return () => {
|
|
230
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
231
|
+
};
|
|
232
|
+
}, [isOpen, onOpenChange, onClose]);
|
|
233
|
+
return /* @__PURE__ */jsx(Flex, {
|
|
234
|
+
sx: {
|
|
235
|
+
position: "relative",
|
|
236
|
+
justifyContent: "flex-start"
|
|
237
|
+
},
|
|
238
|
+
children: /* @__PURE__ */jsxs(Box, {
|
|
239
|
+
sx: {
|
|
240
|
+
position: "relative"
|
|
241
|
+
},
|
|
242
|
+
children: [/* @__PURE__ */jsxs(IconButton, {
|
|
243
|
+
ref: buttonRef,
|
|
244
|
+
variant: "ghost",
|
|
245
|
+
sx: {
|
|
246
|
+
position: "relative",
|
|
247
|
+
borderRadius: "full",
|
|
248
|
+
padding: 1,
|
|
249
|
+
transition: "background-color 0.3s ease",
|
|
250
|
+
"&:hover": {
|
|
251
|
+
backgroundColor: "action.background.muted.default"
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
onClick: togglePanel,
|
|
255
|
+
children: [/* @__PURE__ */jsx(Box, {
|
|
256
|
+
sx: {
|
|
257
|
+
color: "display.text.muted.default"
|
|
258
|
+
},
|
|
259
|
+
children: /* @__PURE__ */jsx(Icon, {
|
|
260
|
+
icon: "mdi:bell-outline",
|
|
261
|
+
width: 22,
|
|
262
|
+
height: 22
|
|
263
|
+
})
|
|
264
|
+
}), count > 0 && showCount && /* @__PURE__ */jsx(Box, {
|
|
265
|
+
sx: {
|
|
266
|
+
position: "absolute",
|
|
267
|
+
top: "-2px",
|
|
268
|
+
right: "-2px",
|
|
269
|
+
minWidth: "14px",
|
|
270
|
+
height: "14px",
|
|
271
|
+
paddingX: 1,
|
|
272
|
+
borderRadius: "full",
|
|
273
|
+
backgroundColor: "action.background.negative.default",
|
|
274
|
+
color: "feedback.text.primary.default",
|
|
275
|
+
fontSize: "10px",
|
|
276
|
+
fontWeight: "bold",
|
|
277
|
+
display: "flex",
|
|
278
|
+
alignItems: "center",
|
|
279
|
+
justifyContent: "center",
|
|
280
|
+
lineHeight: 1
|
|
281
|
+
},
|
|
282
|
+
children: count > 99 ? "99+" : count
|
|
283
|
+
})]
|
|
284
|
+
}), isOpen && /* @__PURE__ */jsx("div", {
|
|
285
|
+
ref: containerRef,
|
|
286
|
+
children: /* @__PURE__ */jsx(Card, {
|
|
287
|
+
sx: {
|
|
288
|
+
position: "absolute",
|
|
289
|
+
top: "calc(100% + 8px)",
|
|
290
|
+
left: openToLeft ? "auto" : 0,
|
|
291
|
+
right: openToLeft ? 0 : "auto",
|
|
292
|
+
width: notifications.length === 0 ? ["60vw", "300px"] : ["90vw", "600px"],
|
|
293
|
+
maxHeight: "550px",
|
|
294
|
+
overflowY: "auto",
|
|
295
|
+
zIndex: "modal",
|
|
296
|
+
padding: 0,
|
|
297
|
+
boxShadow: "xl",
|
|
298
|
+
borderRadius: "2xl",
|
|
299
|
+
backgroundColor: "display.background.secondary.default"
|
|
300
|
+
},
|
|
301
|
+
children: /* @__PURE__ */jsx(Box, {
|
|
302
|
+
sx: {
|
|
303
|
+
width: "100%"
|
|
304
|
+
},
|
|
305
|
+
children: /* @__PURE__ */jsxs(Flex, {
|
|
306
|
+
sx: {
|
|
307
|
+
flexDirection: "column",
|
|
308
|
+
gap: 4
|
|
309
|
+
},
|
|
310
|
+
children: [notifications.length > 0 && onClearAll && /* @__PURE__ */jsx(Flex, {
|
|
311
|
+
sx: {
|
|
312
|
+
justifyContent: "flex-end",
|
|
313
|
+
p: 2,
|
|
314
|
+
marginBottom: -2
|
|
315
|
+
},
|
|
316
|
+
children: /* @__PURE__ */jsxs(Button, {
|
|
317
|
+
variant: "ghost",
|
|
318
|
+
sx: {
|
|
319
|
+
borderRadius: "md",
|
|
320
|
+
padding: 1,
|
|
321
|
+
paddingLeft: 10,
|
|
322
|
+
paddingRight: 10,
|
|
323
|
+
fontSize: "md",
|
|
324
|
+
color: "display.text.muted.default",
|
|
325
|
+
border: "1px solid",
|
|
326
|
+
borderColor: "display.border.default",
|
|
327
|
+
transition: "all 0.2s ease",
|
|
328
|
+
display: "flex",
|
|
329
|
+
alignItems: "center",
|
|
330
|
+
"&:hover": {
|
|
331
|
+
backgroundColor: "action.background.muted.default",
|
|
332
|
+
color: "display.text.default",
|
|
333
|
+
borderColor: "action.border.default"
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
onClick: onClearAll,
|
|
337
|
+
children: [/* @__PURE__ */jsx(Icon, {
|
|
338
|
+
icon: "delete",
|
|
339
|
+
width: 16,
|
|
340
|
+
height: 16
|
|
341
|
+
}), /* @__PURE__ */jsx(Text, {
|
|
342
|
+
sx: {
|
|
343
|
+
ml: -1,
|
|
344
|
+
marginTop: -.4,
|
|
345
|
+
fontSize: "sm"
|
|
346
|
+
},
|
|
347
|
+
children: "Limpar Tudo"
|
|
348
|
+
})]
|
|
349
|
+
})
|
|
350
|
+
}), notifications.length === 0 ? /* @__PURE__ */jsx(Text, {
|
|
351
|
+
sx: {
|
|
352
|
+
color: "display.text.muted.default",
|
|
353
|
+
textAlign: "center",
|
|
354
|
+
p: 4
|
|
355
|
+
},
|
|
356
|
+
children: "Nenhuma notificação"
|
|
357
|
+
}) : notifications.map(notification => {
|
|
358
|
+
return /* @__PURE__ */jsx(NotificationCard, {
|
|
359
|
+
...notification,
|
|
360
|
+
onClose: () => {
|
|
361
|
+
notification.onClose?.();
|
|
362
|
+
onClose?.();
|
|
363
|
+
}
|
|
364
|
+
}, notification.id);
|
|
365
|
+
}), hasMore && /* @__PURE__ */jsx("div", {
|
|
366
|
+
ref: loadMoreRef,
|
|
367
|
+
style: {
|
|
368
|
+
height: 1
|
|
369
|
+
}
|
|
370
|
+
})]
|
|
371
|
+
})
|
|
372
|
+
})
|
|
373
|
+
})
|
|
374
|
+
})]
|
|
375
|
+
})
|
|
376
|
+
});
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
//#endregion
|
|
380
|
+
export { NotificationsMenu };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
import { InputProps } from "@ttoss/ui";
|
|
3
|
+
|
|
4
|
+
//#region src/components/Search/Search.d.ts
|
|
5
|
+
type SearchProps = Omit<InputProps, 'onChange'> & {
|
|
6
|
+
loading?: boolean;
|
|
7
|
+
debounce?: number;
|
|
8
|
+
onChange: (value?: InputProps['value']) => void;
|
|
9
|
+
};
|
|
10
|
+
declare const Search: ({
|
|
11
|
+
value,
|
|
12
|
+
defaultValue,
|
|
13
|
+
loading,
|
|
14
|
+
onChange,
|
|
15
|
+
...props
|
|
16
|
+
}: SearchProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
//#endregion
|
|
18
|
+
export { Search, SearchProps };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
-
import { __name } from "../chunk-V4MHYKRI.js";
|
|
3
|
-
|
|
4
|
-
// src/components/Search/Search.tsx
|
|
5
|
-
import * as React from "react";
|
|
6
2
|
import { Input } from "@ttoss/ui";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
5
|
import { useDebounce } from "@ttoss/react-hooks";
|
|
8
|
-
|
|
6
|
+
|
|
7
|
+
//#region src/components/Search/Search.tsx
|
|
8
|
+
const Search = ({
|
|
9
9
|
value,
|
|
10
10
|
defaultValue,
|
|
11
11
|
loading,
|
|
@@ -17,13 +17,15 @@ var Search = /* @__PURE__ */__name(({
|
|
|
17
17
|
React.useEffect(() => {
|
|
18
18
|
onChange(debouncedValue);
|
|
19
19
|
}, [debouncedValue, onChange]);
|
|
20
|
-
return /* @__PURE__ */
|
|
20
|
+
return /* @__PURE__ */jsx(Input, {
|
|
21
21
|
leadingIcon: loading ? "loading" : "search",
|
|
22
22
|
defaultValue: text,
|
|
23
|
-
onChange:
|
|
23
|
+
onChange: e => {
|
|
24
24
|
return setText(e.target.value);
|
|
25
|
-
},
|
|
25
|
+
},
|
|
26
26
|
...props
|
|
27
27
|
});
|
|
28
|
-
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
29
31
|
export { Search };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
import { IconType } from "@ttoss/react-icons";
|
|
3
|
+
import { ButtonProps } from "@ttoss/ui";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/components/SpotlightCard/SpotlightCard.d.ts
|
|
7
|
+
type ButtonPropType = ButtonProps | React.ReactNode;
|
|
8
|
+
type SpotlightCardProps = {
|
|
9
|
+
icon: IconType;
|
|
10
|
+
/**
|
|
11
|
+
* Title of the card. Pass a ReactNode for styling.
|
|
12
|
+
*/
|
|
13
|
+
title: string | React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Badge text. Renders as a badge/tag next to the title.
|
|
16
|
+
*/
|
|
17
|
+
badge?: string | React.ReactNode;
|
|
18
|
+
description: string;
|
|
19
|
+
firstButton?: ButtonPropType;
|
|
20
|
+
secondButton?: ButtonPropType;
|
|
21
|
+
variant?: 'accent' | 'primary';
|
|
22
|
+
};
|
|
23
|
+
declare const SpotlightCard: {
|
|
24
|
+
({
|
|
25
|
+
icon,
|
|
26
|
+
title,
|
|
27
|
+
badge,
|
|
28
|
+
description,
|
|
29
|
+
firstButton,
|
|
30
|
+
secondButton,
|
|
31
|
+
variant
|
|
32
|
+
}: SpotlightCardProps): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
displayName: string;
|
|
34
|
+
};
|
|
35
|
+
//#endregion
|
|
36
|
+
export { SpotlightCard, SpotlightCardProps };
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
import { Icon } from "@ttoss/react-icons";
|
|
3
|
+
import { Box, Button, Card, Flex, Text, keyframes } from "@ttoss/ui";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/components/SpotlightCard/SpotlightCard.tsx
|
|
8
|
+
const SpotlightCard = ({
|
|
9
|
+
icon,
|
|
10
|
+
title,
|
|
11
|
+
badge,
|
|
12
|
+
description,
|
|
13
|
+
firstButton,
|
|
14
|
+
secondButton,
|
|
15
|
+
variant = "accent"
|
|
16
|
+
}) => {
|
|
17
|
+
const gradientFlow = keyframes({
|
|
18
|
+
"0%": {
|
|
19
|
+
backgroundPosition: "0% 50%"
|
|
20
|
+
},
|
|
21
|
+
"50%": {
|
|
22
|
+
backgroundPosition: "100% 50%"
|
|
23
|
+
},
|
|
24
|
+
"100%": {
|
|
25
|
+
backgroundPosition: "0% 50%"
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
const hasButtons = !!firstButton || !!secondButton;
|
|
29
|
+
const isAccent = variant === "accent";
|
|
30
|
+
const textColorToken = isAccent ? "action.text.accent.default" : "action.text.primary.default";
|
|
31
|
+
const iconColorToken = isAccent ? "action.text.accent.default" : "display.text.accent.default";
|
|
32
|
+
const iconBgToken = isAccent ? "rgba(255,255,255,0.3)" : "action.background.secondary.default";
|
|
33
|
+
const badgeBgToken = isAccent ? "action.background.primary.default" : "action.background.accent.default";
|
|
34
|
+
const badgeTextToken = isAccent ? "action.text.primary.default" : "action.text.accent.default";
|
|
35
|
+
const btnPrimaryVariant = isAccent ? "primary" : "accent";
|
|
36
|
+
const btnPrimaryColorToken = isAccent ? "action.text.primary.default" : "action.text.accent.default";
|
|
37
|
+
const btnSecondaryColorToken = textColorToken;
|
|
38
|
+
const btnSecondaryBorderColorToken = isAccent ? "currentColor" : "display.border.muted.default";
|
|
39
|
+
const renderButton = (prop, config) => {
|
|
40
|
+
if (!prop) return null;
|
|
41
|
+
if (React.isValidElement(prop)) return prop;
|
|
42
|
+
if (typeof prop !== "object") return prop;
|
|
43
|
+
const {
|
|
44
|
+
sx,
|
|
45
|
+
...rest
|
|
46
|
+
} = prop;
|
|
47
|
+
const {
|
|
48
|
+
variant: defaultVariant,
|
|
49
|
+
textColor,
|
|
50
|
+
styles = {}
|
|
51
|
+
} = config;
|
|
52
|
+
return /* @__PURE__ */jsx(Button, {
|
|
53
|
+
variant: defaultVariant,
|
|
54
|
+
sx: {
|
|
55
|
+
display: "flex",
|
|
56
|
+
alignItems: "center",
|
|
57
|
+
justifyContent: "center",
|
|
58
|
+
gap: "2",
|
|
59
|
+
px: "6",
|
|
60
|
+
py: "3",
|
|
61
|
+
fontSize: "15px",
|
|
62
|
+
fontWeight: "bold",
|
|
63
|
+
whiteSpace: "nowrap",
|
|
64
|
+
transition: "all 0.2s",
|
|
65
|
+
color: textColor,
|
|
66
|
+
...styles,
|
|
67
|
+
...sx
|
|
68
|
+
},
|
|
69
|
+
...rest
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
return /* @__PURE__ */jsxs(Card, {
|
|
73
|
+
sx: {
|
|
74
|
+
display: "flex",
|
|
75
|
+
flexDirection: ["row"],
|
|
76
|
+
flexWrap: "nowrap",
|
|
77
|
+
alignItems: "center",
|
|
78
|
+
justifyContent: "space-between",
|
|
79
|
+
background: t => {
|
|
80
|
+
const theme = t;
|
|
81
|
+
const bgStart = isAccent ? theme.colors?.action?.background?.accent?.default : theme.colors?.action?.background?.primary?.default;
|
|
82
|
+
const bgMiddle = isAccent ? theme.colors?.action?.background?.accent?.active : theme.colors?.action?.background?.secondary?.default;
|
|
83
|
+
if (isAccent) return `linear-gradient(270deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%),
|
|
84
|
+
linear-gradient(0deg, ${bgStart}, ${bgStart})`;
|
|
85
|
+
return `linear-gradient(270deg, ${bgStart}, ${bgMiddle}, ${bgStart})`;
|
|
86
|
+
},
|
|
87
|
+
backgroundSize: isAccent ? "200% 100%, auto" : "400% 400%",
|
|
88
|
+
animation: `${gradientFlow} 6s ease infinite`,
|
|
89
|
+
width: "100%",
|
|
90
|
+
minHeight: "104px",
|
|
91
|
+
borderRadius: "xl",
|
|
92
|
+
boxShadow: "0 4px 20px rgba(0,0,0,0.1)",
|
|
93
|
+
py: "7",
|
|
94
|
+
px: "8",
|
|
95
|
+
gap: "5",
|
|
96
|
+
color: textColorToken,
|
|
97
|
+
overflow: "hidden",
|
|
98
|
+
borderWidth: "1px",
|
|
99
|
+
borderStyle: "solid",
|
|
100
|
+
borderColor: isAccent ? "transparent" : "display.border.muted.default"
|
|
101
|
+
},
|
|
102
|
+
"data-testid": "spotlight-card",
|
|
103
|
+
children: [/* @__PURE__ */jsxs(Flex, {
|
|
104
|
+
sx: {
|
|
105
|
+
alignItems: "center",
|
|
106
|
+
gap: "5",
|
|
107
|
+
flex: 1,
|
|
108
|
+
minWidth: 0
|
|
109
|
+
},
|
|
110
|
+
children: [/* @__PURE__ */jsx(Box, {
|
|
111
|
+
sx: {
|
|
112
|
+
width: 64,
|
|
113
|
+
height: 64,
|
|
114
|
+
borderRadius: "2xl",
|
|
115
|
+
backgroundColor: iconBgToken,
|
|
116
|
+
display: "flex",
|
|
117
|
+
alignItems: "center",
|
|
118
|
+
justifyContent: "center",
|
|
119
|
+
flexShrink: 0,
|
|
120
|
+
color: iconColorToken
|
|
121
|
+
},
|
|
122
|
+
children: /* @__PURE__ */jsx(Icon, {
|
|
123
|
+
icon,
|
|
124
|
+
width: 32
|
|
125
|
+
})
|
|
126
|
+
}), /* @__PURE__ */jsxs(Box, {
|
|
127
|
+
sx: {
|
|
128
|
+
minWidth: 0
|
|
129
|
+
},
|
|
130
|
+
children: [/* @__PURE__ */jsxs(Text, {
|
|
131
|
+
as: "div",
|
|
132
|
+
sx: {
|
|
133
|
+
fontFamily: "mono",
|
|
134
|
+
fontSize: "32px",
|
|
135
|
+
lineHeight: 1.1,
|
|
136
|
+
color: "inherit",
|
|
137
|
+
whiteSpace: "nowrap",
|
|
138
|
+
display: "flex",
|
|
139
|
+
alignItems: "center",
|
|
140
|
+
gap: "3"
|
|
141
|
+
},
|
|
142
|
+
children: [title, badge && /* @__PURE__ */jsx(Box, {
|
|
143
|
+
as: "span",
|
|
144
|
+
sx: {
|
|
145
|
+
backgroundColor: badgeBgToken,
|
|
146
|
+
color: badgeTextToken,
|
|
147
|
+
fontFamily: "mono",
|
|
148
|
+
fontWeight: "bold",
|
|
149
|
+
fontSize: "11px",
|
|
150
|
+
lineHeight: 1,
|
|
151
|
+
paddingX: "6px",
|
|
152
|
+
paddingY: "3px",
|
|
153
|
+
borderRadius: "md",
|
|
154
|
+
textTransform: "uppercase",
|
|
155
|
+
letterSpacing: "0.05em",
|
|
156
|
+
display: "inline-flex",
|
|
157
|
+
alignItems: "center",
|
|
158
|
+
boxShadow: "0 2px 4px rgba(0,0,0,0.1)",
|
|
159
|
+
transform: "translateY(3px)"
|
|
160
|
+
},
|
|
161
|
+
children: badge
|
|
162
|
+
})]
|
|
163
|
+
}), /* @__PURE__ */jsx(Text, {
|
|
164
|
+
as: "div",
|
|
165
|
+
sx: {
|
|
166
|
+
fontFamily: "body",
|
|
167
|
+
fontWeight: 400,
|
|
168
|
+
fontSize: "16px",
|
|
169
|
+
color: "inherit",
|
|
170
|
+
opacity: .9,
|
|
171
|
+
mt: "1",
|
|
172
|
+
overflow: "hidden",
|
|
173
|
+
textOverflow: "ellipsis",
|
|
174
|
+
display: "-webkit-box",
|
|
175
|
+
WebkitLineClamp: 2,
|
|
176
|
+
WebkitBoxOrient: "vertical"
|
|
177
|
+
},
|
|
178
|
+
children: description
|
|
179
|
+
})]
|
|
180
|
+
})]
|
|
181
|
+
}), hasButtons && /* @__PURE__ */jsxs(Flex, {
|
|
182
|
+
sx: {
|
|
183
|
+
gap: "4",
|
|
184
|
+
alignItems: "center",
|
|
185
|
+
flexShrink: 0,
|
|
186
|
+
ml: "auto"
|
|
187
|
+
},
|
|
188
|
+
children: [renderButton(firstButton, {
|
|
189
|
+
variant: btnPrimaryVariant,
|
|
190
|
+
textColor: btnPrimaryColorToken,
|
|
191
|
+
styles: {
|
|
192
|
+
":hover": {
|
|
193
|
+
transform: "translateY(-1px)"
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}), renderButton(secondButton, {
|
|
197
|
+
variant: "secondary",
|
|
198
|
+
textColor: btnSecondaryColorToken,
|
|
199
|
+
styles: {
|
|
200
|
+
backgroundColor: "transparent",
|
|
201
|
+
borderWidth: "1px",
|
|
202
|
+
borderStyle: "solid",
|
|
203
|
+
borderColor: btnSecondaryBorderColorToken,
|
|
204
|
+
opacity: isAccent ? .6 : 1,
|
|
205
|
+
cursor: "pointer",
|
|
206
|
+
":hover": {
|
|
207
|
+
backgroundColor: "rgba(255,255,255,0.2)",
|
|
208
|
+
opacity: 1,
|
|
209
|
+
borderColor: btnSecondaryBorderColorToken
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
})]
|
|
213
|
+
})]
|
|
214
|
+
});
|
|
215
|
+
};
|
|
216
|
+
SpotlightCard.displayName = "SpotlightCard";
|
|
217
|
+
|
|
218
|
+
//#endregion
|
|
219
|
+
export { SpotlightCard };
|