@ttoss/components 2.14.20 → 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.
Files changed (74) hide show
  1. package/dist/Accordion/index.d.mts +157 -0
  2. package/dist/Accordion/index.mjs +175 -0
  3. package/dist/DatePicker/index.d.mts +26 -0
  4. package/dist/DatePicker/index.mjs +339 -0
  5. package/dist/Drawer/index.d.mts +17 -0
  6. package/dist/{esm/Drawer/index.js → Drawer/index.mjs} +21 -14
  7. package/dist/EnhancedTitle/{index.d.ts → index.d.mts} +57 -47
  8. package/dist/EnhancedTitle/index.mjs +234 -0
  9. package/dist/FileUploader/index.d.mts +77 -0
  10. package/dist/FileUploader/index.mjs +386 -0
  11. package/dist/InstallPwa/index.d.mts +13 -0
  12. package/dist/InstallPwa/index.mjs +64 -0
  13. package/dist/JsonEditor/index.d.mts +3 -0
  14. package/dist/{esm/JsonEditor/index.js → JsonEditor/index.mjs} +0 -3
  15. package/dist/JsonView/index.d.mts +3 -0
  16. package/dist/{esm/JsonView/index.js → JsonView/index.mjs} +0 -3
  17. package/dist/List/{index.d.ts → index.d.mts} +9 -6
  18. package/dist/List/index.mjs +34 -0
  19. package/dist/LockedOverlay/index.d.mts +162 -0
  20. package/dist/LockedOverlay/index.mjs +386 -0
  21. package/dist/Markdown/index.d.mts +16 -0
  22. package/dist/Markdown/index.mjs +26 -0
  23. package/dist/Menu/index.d.mts +16 -0
  24. package/dist/{esm/Menu/index.js → Menu/index.mjs} +56 -51
  25. package/dist/MetricCard/index.d.mts +153 -0
  26. package/dist/MetricCard/index.mjs +408 -0
  27. package/dist/Modal/index.d.mts +11 -0
  28. package/dist/{esm/Modal/index.js → Modal/index.mjs} +11 -12
  29. package/dist/NavList/index.d.mts +64 -0
  30. package/dist/{esm/NavList/index.js → NavList/index.mjs} +79 -73
  31. package/dist/NotificationCard/index.d.mts +22 -0
  32. package/dist/NotificationCard/index.mjs +173 -0
  33. package/dist/NotificationsMenu/index.d.mts +47 -0
  34. package/dist/NotificationsMenu/index.mjs +380 -0
  35. package/dist/Search/index.d.mts +18 -0
  36. package/dist/{esm/Search/index.js → Search/index.mjs} +11 -9
  37. package/dist/SpotlightCard/index.d.mts +36 -0
  38. package/dist/SpotlightCard/index.mjs +219 -0
  39. package/dist/Table/index.d.mts +17 -0
  40. package/dist/Table/index.mjs +64 -0
  41. package/dist/Tabs/index.d.mts +17 -0
  42. package/dist/{esm/Tabs/index.js → Tabs/index.mjs} +24 -12
  43. package/dist/Toast/index.d.mts +8 -0
  44. package/dist/Toast/index.mjs +43 -0
  45. package/package.json +15 -15
  46. package/dist/Accordion/index.d.ts +0 -148
  47. package/dist/DatePicker/index.d.ts +0 -20
  48. package/dist/Drawer/index.d.ts +0 -12
  49. package/dist/LockedOverlay/index.d.ts +0 -151
  50. package/dist/Markdown/index.d.ts +0 -11
  51. package/dist/Menu/index.d.ts +0 -11
  52. package/dist/MetricCard/index.d.ts +0 -148
  53. package/dist/Modal/index.d.ts +0 -10
  54. package/dist/NavList/index.d.ts +0 -55
  55. package/dist/NotificationCard/index.d.ts +0 -21
  56. package/dist/NotificationsMenu/index.d.ts +0 -36
  57. package/dist/Search/index.d.ts +0 -11
  58. package/dist/SpotlightCard/index.d.ts +0 -27
  59. package/dist/Table/index.d.ts +0 -16
  60. package/dist/esm/Accordion/index.js +0 -119
  61. package/dist/esm/DatePicker/index.js +0 -331
  62. package/dist/esm/EnhancedTitle/index.js +0 -190
  63. package/dist/esm/FileUploader/index.js +0 -401
  64. package/dist/esm/InstallPwa/index.js +0 -61
  65. package/dist/esm/List/index.js +0 -30
  66. package/dist/esm/LockedOverlay/index.js +0 -316
  67. package/dist/esm/Markdown/index.js +0 -23
  68. package/dist/esm/MetricCard/index.js +0 -327
  69. package/dist/esm/NotificationCard/index.js +0 -156
  70. package/dist/esm/NotificationsMenu/index.js +0 -359
  71. package/dist/esm/SpotlightCard/index.js +0 -212
  72. package/dist/esm/Table/index.js +0 -63
  73. package/dist/esm/Toast/index.js +0 -38
  74. package/dist/esm/chunk-V4MHYKRI.js +0 -7
@@ -1,156 +0,0 @@
1
- /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- import { __name } from "../chunk-V4MHYKRI.js";
3
-
4
- // src/components/NotificationCard/NotificationCard.tsx
5
- import { Icon } from "@ttoss/react-icons";
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");
156
- export { NotificationCard };
@@ -1,359 +0,0 @@
1
- /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- import { __name } from "../chunk-V4MHYKRI.js";
3
-
4
- // src/components/NotificationsMenu/NotificationsMenu.tsx
5
- import { Icon as Icon2 } from "@ttoss/react-icons";
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 { Icon } from "@ttoss/react-icons";
11
- import { Box, Card, CloseButton, Link, Tag, Text } from "@ttoss/ui";
12
- import * as React from "react";
13
- var NotificationCard = /* @__PURE__ */__name(props => {
14
- const sxMap = {
15
- success: {
16
- card: {
17
- backgroundColor: "feedback.background.positive.default",
18
- borderColor: "feedback.border.positive.default"
19
- }
20
- },
21
- error: {
22
- card: {
23
- backgroundColor: "feedback.background.negative.default",
24
- borderColor: "feedback.border.negative.default"
25
- }
26
- },
27
- warning: {
28
- card: {
29
- backgroundColor: "feedback.background.caution.default",
30
- borderColor: "feedback.border.caution.default"
31
- }
32
- },
33
- info: {
34
- card: {
35
- backgroundColor: "feedback.background.primary.default",
36
- borderColor: "feedback.border.primary.default"
37
- }
38
- },
39
- neutral: {
40
- card: {
41
- backgroundColor: "feedback.background.primary.default",
42
- borderColor: "feedback.border.primary.default"
43
- }
44
- }
45
- };
46
- const icon = {
47
- success: "success-circle",
48
- error: "error",
49
- warning: "warning-alt",
50
- info: "info",
51
- neutral: "info"
52
- };
53
- const hasCaption = Boolean(props.caption);
54
- const hasActions = Boolean(props.actions && props.actions.length > 0);
55
- const hasTitle = Boolean(props.title);
56
- const shouldCenterVerticallyWithoutTitle = !hasCaption && !hasActions && !hasTitle;
57
- const shouldCenterVerticallyWithTitle = !hasCaption && !hasActions && hasTitle;
58
- const shouldAddMinHeight = !hasCaption && !hasActions;
59
- return /* @__PURE__ */React.createElement(Card, {
60
- sx: {
61
- ...sxMap[props.type].card,
62
- width: "full"
63
- }
64
- }, props.title && /* @__PURE__ */React.createElement(Card.Title, {
65
- sx: {
66
- display: "flex",
67
- justifyContent: "space-between",
68
- alignItems: "center",
69
- fontSize: ["md", "xl"],
70
- paddingY: ["1", "2", "4"],
71
- paddingX: ["2", "4", "8"]
72
- }
73
- }, /* @__PURE__ */React.createElement(Text, {
74
- sx: {
75
- display: "inline-flex",
76
- alignItems: "flex-start",
77
- gap: "2",
78
- flexDirection: "row",
79
- flexWrap: "wrap"
80
- }
81
- }, /* @__PURE__ */React.createElement(Box, {
82
- sx: {
83
- display: "flex",
84
- alignItems: "center",
85
- gap: "2"
86
- }
87
- }, /* @__PURE__ */React.createElement(Icon, {
88
- icon: icon[props.type]
89
- }), props.title), props.tags && (Array.isArray(props.tags) ? props.tags.length > 0 : true) && (Array.isArray(props.tags) ? props.tags.map((tag, index) => {
90
- return /* @__PURE__ */React.createElement(Tag, {
91
- key: index
92
- }, tag);
93
- }) : /* @__PURE__ */React.createElement(Tag, null, props.tags))), props.onClose && /* @__PURE__ */React.createElement(Box, {
94
- sx: {
95
- marginLeft: "auto"
96
- }
97
- }, /* @__PURE__ */React.createElement(CloseButton, {
98
- onClick: props.onClose
99
- }))), /* @__PURE__ */React.createElement(Card.Body, {
100
- sx: {
101
- ...sxMap[props.type].card,
102
- display: "flex",
103
- flexDirection: "column",
104
- gap: "2",
105
- paddingY: ["1", "2", "4"],
106
- paddingX: ["2", "4", "8"]
107
- }
108
- }, /* @__PURE__ */React.createElement(Box, {
109
- sx: {
110
- display: "flex",
111
- justifyContent: "space-between",
112
- minHeight: shouldAddMinHeight ? "40px" : "auto",
113
- alignItems: shouldCenterVerticallyWithoutTitle ? "center" : shouldCenterVerticallyWithTitle ? "center" : "flex-start",
114
- width: "100%",
115
- gap: "4"
116
- }
117
- }, /* @__PURE__ */React.createElement(Box, {
118
- sx: {
119
- flex: 1
120
- }
121
- }, /* @__PURE__ */React.createElement(Text, {
122
- sx: {
123
- fontSize: ["sm", "md"]
124
- }
125
- }, props.message))), props.actions && props.actions.length > 0 && /* @__PURE__ */React.createElement(Box, {
126
- sx: {
127
- display: "flex",
128
- flexDirection: "column",
129
- gap: 2,
130
- mt: 2
131
- }
132
- }, props.actions.map((action, index) => {
133
- return action.action === "open_url" ? /* @__PURE__ */React.createElement(Link, {
134
- key: index,
135
- href: action.url,
136
- target: "_blank",
137
- rel: "noopener noreferrer",
138
- sx: {
139
- color: "action.text.accent.default",
140
- cursor: "pointer"
141
- }
142
- }, action.label || "Acessar") : null;
143
- })), props.caption && /* @__PURE__ */React.createElement(Box, {
144
- sx: {
145
- whiteSpace: "nowrap",
146
- mt: 6
147
- }
148
- }, /* @__PURE__ */React.createElement(Text, {
149
- sx: {
150
- fontSize: "xs",
151
- color: "text.secondary"
152
- }
153
- }, props.caption)), !props.title && props.onClose && /* @__PURE__ */React.createElement(Box, {
154
- sx: {
155
- alignSelf: "flex-end"
156
- }
157
- }, /* @__PURE__ */React.createElement(CloseButton, {
158
- onClick: props.onClose
159
- }))));
160
- }, "NotificationCard");
161
-
162
- // src/components/NotificationsMenu/NotificationsMenu.tsx
163
- var NotificationsMenu = /* @__PURE__ */__name(({
164
- notifications,
165
- defaultOpen = false,
166
- hasMore = false,
167
- onLoadMore,
168
- onOpenChange,
169
- count,
170
- onClose,
171
- onClearAll
172
- }) => {
173
- const [isOpen, setIsOpen] = React2.useState(defaultOpen);
174
- const [openToLeft, setOpenToLeft] = React2.useState(false);
175
- const buttonRef = React2.useRef(null);
176
- const containerRef = React2.useRef(null);
177
- const loadMoreRef = React2.useRef(null);
178
- const [showCount, setShowCount] = React2.useState(true);
179
- const togglePanel = /* @__PURE__ */__name(() => {
180
- setIsOpen(prev => {
181
- const next = !prev;
182
- onOpenChange?.(next);
183
- return next;
184
- });
185
- }, "togglePanel");
186
- React2.useEffect(() => {
187
- if (!isOpen || !buttonRef.current) return;
188
- const rect = buttonRef.current.getBoundingClientRect();
189
- const spaceRight = window.innerWidth - rect.right;
190
- const spaceLeft = rect.left;
191
- setShowCount(false);
192
- setOpenToLeft(spaceRight < 500 && spaceLeft > spaceRight);
193
- }, [isOpen]);
194
- React2.useEffect(() => {
195
- if (!hasMore || !onLoadMore || !loadMoreRef.current) return;
196
- const observer = new IntersectionObserver(entries => {
197
- if (entries[0].isIntersecting) {
198
- onLoadMore();
199
- }
200
- }, {
201
- root: null,
202
- rootMargin: "0px",
203
- threshold: 1
204
- });
205
- observer.observe(loadMoreRef.current);
206
- return () => {
207
- if (loadMoreRef.current) {
208
- observer.unobserve(loadMoreRef.current);
209
- }
210
- };
211
- }, [hasMore, onLoadMore, notifications.length]);
212
- React2.useEffect(() => {
213
- if (!isOpen) return;
214
- const handleClickOutside = /* @__PURE__ */__name(event => {
215
- if (containerRef.current && !containerRef.current.contains(event.target) && buttonRef.current && !buttonRef.current.contains(event.target)) {
216
- setIsOpen(false);
217
- onOpenChange?.(false);
218
- onClose?.();
219
- }
220
- }, "handleClickOutside");
221
- document.addEventListener("mousedown", handleClickOutside);
222
- return () => {
223
- document.removeEventListener("mousedown", handleClickOutside);
224
- };
225
- }, [isOpen, onOpenChange, onClose]);
226
- return /* @__PURE__ */React2.createElement(Flex, {
227
- sx: {
228
- position: "relative",
229
- justifyContent: "flex-start"
230
- }
231
- }, /* @__PURE__ */React2.createElement(Box2, {
232
- sx: {
233
- position: "relative"
234
- }
235
- }, /* @__PURE__ */React2.createElement(IconButton, {
236
- ref: buttonRef,
237
- variant: "ghost",
238
- sx: {
239
- position: "relative",
240
- borderRadius: "full",
241
- padding: 1,
242
- transition: "background-color 0.3s ease",
243
- "&:hover": {
244
- backgroundColor: "action.background.muted.default"
245
- }
246
- },
247
- onClick: togglePanel
248
- }, /* @__PURE__ */React2.createElement(Box2, {
249
- sx: {
250
- color: "display.text.muted.default"
251
- }
252
- }, /* @__PURE__ */React2.createElement(Icon2, {
253
- icon: "mdi:bell-outline",
254
- width: 22,
255
- height: 22
256
- })), count > 0 && showCount && /* @__PURE__ */React2.createElement(Box2, {
257
- sx: {
258
- position: "absolute",
259
- top: "-2px",
260
- right: "-2px",
261
- minWidth: "14px",
262
- height: "14px",
263
- paddingX: 1,
264
- borderRadius: "full",
265
- backgroundColor: "action.background.negative.default",
266
- color: "feedback.text.primary.default",
267
- fontSize: "10px",
268
- fontWeight: "bold",
269
- display: "flex",
270
- alignItems: "center",
271
- justifyContent: "center",
272
- lineHeight: 1
273
- }
274
- }, count > 99 ? "99+" : count)), isOpen && /* @__PURE__ */React2.createElement("div", {
275
- ref: containerRef
276
- }, /* @__PURE__ */React2.createElement(Card2, {
277
- sx: {
278
- position: "absolute",
279
- top: "calc(100% + 8px)",
280
- left: openToLeft ? "auto" : 0,
281
- right: openToLeft ? 0 : "auto",
282
- width: notifications.length === 0 ? ["60vw", "300px"] : ["90vw", "600px"],
283
- maxHeight: "550px",
284
- overflowY: "auto",
285
- zIndex: "modal",
286
- padding: 0,
287
- boxShadow: "xl",
288
- borderRadius: "2xl",
289
- backgroundColor: "display.background.secondary.default"
290
- }
291
- }, /* @__PURE__ */React2.createElement(Box2, {
292
- sx: {
293
- width: "100%"
294
- }
295
- }, /* @__PURE__ */React2.createElement(Flex, {
296
- sx: {
297
- flexDirection: "column",
298
- gap: 4
299
- }
300
- }, notifications.length > 0 && onClearAll && /* @__PURE__ */React2.createElement(Flex, {
301
- sx: {
302
- justifyContent: "flex-end",
303
- p: 2,
304
- marginBottom: -2
305
- }
306
- }, /* @__PURE__ */React2.createElement(Button, {
307
- variant: "ghost",
308
- sx: {
309
- borderRadius: "md",
310
- padding: 1,
311
- paddingLeft: 10,
312
- paddingRight: 10,
313
- fontSize: "md",
314
- color: "display.text.muted.default",
315
- border: "1px solid",
316
- borderColor: "display.border.default",
317
- transition: "all 0.2s ease",
318
- display: "flex",
319
- alignItems: "center",
320
- "&:hover": {
321
- backgroundColor: "action.background.muted.default",
322
- color: "display.text.default",
323
- borderColor: "action.border.default"
324
- }
325
- },
326
- onClick: onClearAll
327
- }, /* @__PURE__ */React2.createElement(Icon2, {
328
- icon: "delete",
329
- width: 16,
330
- height: 16
331
- }), /* @__PURE__ */React2.createElement(Text2, {
332
- sx: {
333
- ml: -1,
334
- marginTop: -0.4,
335
- fontSize: "sm"
336
- }
337
- }, "Limpar Tudo"))), notifications.length === 0 ? /* @__PURE__ */React2.createElement(Text2, {
338
- sx: {
339
- color: "display.text.muted.default",
340
- textAlign: "center",
341
- p: 4
342
- }
343
- }, "Nenhuma notifica\xE7\xE3o") : notifications.map(notification => {
344
- return /* @__PURE__ */React2.createElement(NotificationCard, {
345
- key: notification.id,
346
- ...notification,
347
- onClose: /* @__PURE__ */__name(() => {
348
- notification.onClose?.();
349
- onClose?.();
350
- }, "onClose")
351
- });
352
- }), hasMore && /* @__PURE__ */React2.createElement("div", {
353
- ref: loadMoreRef,
354
- style: {
355
- height: 1
356
- }
357
- })))))));
358
- }, "NotificationsMenu");
359
- export { NotificationsMenu };