@ttoss/components 2.4.0 → 2.4.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.
@@ -1,12 +1,12 @@
1
1
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- import { NotificationCard } from "../chunk-E6CBXO5W.js";
3
- import { Icon } from "../chunk-JOSQSCZQ.js";
2
+ import { NotificationCard } from "../chunk-GOISZ4AR.js";
3
+ import { Icon } from "../chunk-AZTAV4VC.js";
4
+ import { __name } from "../chunk-V4MHYKRI.js";
4
5
 
5
6
  // src/components/NotificationsMenu/NotificationsMenu.tsx
6
7
  import { Box, Button, Card, Flex, IconButton, Text } from "@ttoss/ui";
7
8
  import * as React from "react";
8
- import { jsx, jsxs } from "react/jsx-runtime";
9
- var NotificationsMenu = ({
9
+ var NotificationsMenu = /* @__PURE__ */__name(({
10
10
  notifications,
11
11
  defaultOpen = false,
12
12
  hasMore = false,
@@ -22,13 +22,13 @@ var NotificationsMenu = ({
22
22
  const containerRef = React.useRef(null);
23
23
  const loadMoreRef = React.useRef(null);
24
24
  const [showCount, setShowCount] = React.useState(true);
25
- const togglePanel = () => {
25
+ const togglePanel = /* @__PURE__ */__name(() => {
26
26
  setIsOpen(prev => {
27
27
  const next = !prev;
28
28
  onOpenChange?.(next);
29
29
  return next;
30
30
  });
31
- };
31
+ }, "togglePanel");
32
32
  React.useEffect(() => {
33
33
  if (!isOpen || !buttonRef.current) return;
34
34
  const rect = buttonRef.current.getBoundingClientRect();
@@ -57,161 +57,149 @@ var NotificationsMenu = ({
57
57
  }, [hasMore, onLoadMore, notifications.length]);
58
58
  React.useEffect(() => {
59
59
  if (!isOpen) return;
60
- const handleClickOutside = event => {
60
+ const handleClickOutside = /* @__PURE__ */__name(event => {
61
61
  if (containerRef.current && !containerRef.current.contains(event.target) && buttonRef.current && !buttonRef.current.contains(event.target)) {
62
62
  setIsOpen(false);
63
63
  onOpenChange?.(false);
64
64
  onClose?.();
65
65
  }
66
- };
66
+ }, "handleClickOutside");
67
67
  document.addEventListener("mousedown", handleClickOutside);
68
68
  return () => {
69
69
  document.removeEventListener("mousedown", handleClickOutside);
70
70
  };
71
71
  }, [isOpen, onOpenChange, onClose]);
72
- return /* @__PURE__ */jsx(Flex, {
72
+ return /* @__PURE__ */React.createElement(Flex, {
73
73
  sx: {
74
74
  position: "relative",
75
75
  justifyContent: "flex-start"
76
+ }
77
+ }, /* @__PURE__ */React.createElement(Box, {
78
+ sx: {
79
+ position: "relative"
80
+ }
81
+ }, /* @__PURE__ */React.createElement(IconButton, {
82
+ ref: buttonRef,
83
+ variant: "ghost",
84
+ sx: {
85
+ position: "relative",
86
+ borderRadius: "full",
87
+ padding: 1,
88
+ transition: "background-color 0.3s ease",
89
+ "&:hover": {
90
+ backgroundColor: "action.background.muted.default"
91
+ }
92
+ },
93
+ onClick: togglePanel
94
+ }, /* @__PURE__ */React.createElement(Box, {
95
+ sx: {
96
+ color: "display.text.muted.default"
97
+ }
98
+ }, /* @__PURE__ */React.createElement(Icon, {
99
+ icon: "mdi:bell-outline",
100
+ width: 22,
101
+ height: 22
102
+ })), count > 0 && showCount && /* @__PURE__ */React.createElement(Box, {
103
+ sx: {
104
+ position: "absolute",
105
+ top: "-2px",
106
+ right: "-2px",
107
+ minWidth: "14px",
108
+ height: "14px",
109
+ paddingX: 1,
110
+ borderRadius: "full",
111
+ backgroundColor: "action.background.negative.default",
112
+ color: "feedback.text.primary.default",
113
+ fontSize: "10px",
114
+ fontWeight: "bold",
115
+ display: "flex",
116
+ alignItems: "center",
117
+ justifyContent: "center",
118
+ lineHeight: 1
119
+ }
120
+ }, count > 99 ? "99+" : count)), isOpen && /* @__PURE__ */React.createElement("div", {
121
+ ref: containerRef
122
+ }, /* @__PURE__ */React.createElement(Card, {
123
+ sx: {
124
+ position: "absolute",
125
+ top: "calc(100% + 8px)",
126
+ left: openToLeft ? "auto" : 0,
127
+ right: openToLeft ? 0 : "auto",
128
+ width: notifications.length === 0 ? ["60vw", "300px"] : ["90vw", "600px"],
129
+ maxHeight: "550px",
130
+ overflowY: "auto",
131
+ zIndex: "modal",
132
+ padding: 0,
133
+ boxShadow: "xl",
134
+ borderRadius: "2xl",
135
+ backgroundColor: "display.background.secondary.default"
136
+ }
137
+ }, /* @__PURE__ */React.createElement(Box, {
138
+ sx: {
139
+ width: "100%"
140
+ }
141
+ }, /* @__PURE__ */React.createElement(Flex, {
142
+ sx: {
143
+ flexDirection: "column",
144
+ gap: 4
145
+ }
146
+ }, notifications.length > 0 && onClearAll && /* @__PURE__ */React.createElement(Flex, {
147
+ sx: {
148
+ justifyContent: "flex-end",
149
+ p: 2,
150
+ marginBottom: -2
151
+ }
152
+ }, /* @__PURE__ */React.createElement(Button, {
153
+ variant: "ghost",
154
+ sx: {
155
+ borderRadius: "md",
156
+ padding: 1,
157
+ paddingLeft: 10,
158
+ paddingRight: 10,
159
+ fontSize: "md",
160
+ color: "display.text.muted.default",
161
+ border: "1px solid",
162
+ borderColor: "display.border.default",
163
+ transition: "all 0.2s ease",
164
+ display: "flex",
165
+ alignItems: "center",
166
+ "&:hover": {
167
+ backgroundColor: "action.background.muted.default",
168
+ color: "display.text.default",
169
+ borderColor: "action.border.default"
170
+ }
76
171
  },
77
- children: /* @__PURE__ */jsxs(Box, {
78
- sx: {
79
- position: "relative"
80
- },
81
- children: [/* @__PURE__ */jsxs(IconButton, {
82
- ref: buttonRef,
83
- variant: "ghost",
84
- sx: {
85
- position: "relative",
86
- borderRadius: "full",
87
- padding: 1,
88
- transition: "background-color 0.3s ease",
89
- "&:hover": {
90
- backgroundColor: "action.background.muted.default"
91
- }
92
- },
93
- onClick: togglePanel,
94
- children: [/* @__PURE__ */jsx(Box, {
95
- sx: {
96
- color: "display.text.muted.default"
97
- },
98
- children: /* @__PURE__ */jsx(Icon, {
99
- icon: "mdi:bell-outline",
100
- width: 22,
101
- height: 22
102
- })
103
- }), count > 0 && showCount && /* @__PURE__ */jsx(Box, {
104
- sx: {
105
- position: "absolute",
106
- top: "-2px",
107
- right: "-2px",
108
- minWidth: "14px",
109
- height: "14px",
110
- paddingX: 1,
111
- borderRadius: "full",
112
- backgroundColor: "action.background.negative.default",
113
- color: "feedback.text.primary.default",
114
- fontSize: "10px",
115
- fontWeight: "bold",
116
- display: "flex",
117
- alignItems: "center",
118
- justifyContent: "center",
119
- lineHeight: 1
120
- },
121
- children: count > 99 ? "99+" : count
122
- })]
123
- }), isOpen && /* @__PURE__ */jsx("div", {
124
- ref: containerRef,
125
- children: /* @__PURE__ */jsx(Card, {
126
- sx: {
127
- position: "absolute",
128
- top: "calc(100% + 8px)",
129
- left: openToLeft ? "auto" : 0,
130
- right: openToLeft ? 0 : "auto",
131
- width: notifications.length === 0 ? ["60vw", "300px"] : ["90vw", "600px"],
132
- maxHeight: "550px",
133
- overflowY: "auto",
134
- zIndex: "modal",
135
- padding: 0,
136
- boxShadow: "xl",
137
- borderRadius: "2xl",
138
- backgroundColor: "display.background.secondary.default"
139
- },
140
- children: /* @__PURE__ */jsx(Box, {
141
- sx: {
142
- width: "100%"
143
- },
144
- children: /* @__PURE__ */jsxs(Flex, {
145
- sx: {
146
- flexDirection: "column",
147
- gap: 4
148
- },
149
- children: [notifications.length > 0 && onClearAll && /* @__PURE__ */jsx(Flex, {
150
- sx: {
151
- justifyContent: "flex-end",
152
- p: 2,
153
- marginBottom: -2
154
- },
155
- children: /* @__PURE__ */jsxs(Button, {
156
- variant: "ghost",
157
- sx: {
158
- borderRadius: "md",
159
- padding: 1,
160
- paddingLeft: 10,
161
- paddingRight: 10,
162
- fontSize: "md",
163
- color: "display.text.muted.default",
164
- border: "1px solid",
165
- borderColor: "display.border.default",
166
- transition: "all 0.2s ease",
167
- display: "flex",
168
- alignItems: "center",
169
- "&:hover": {
170
- backgroundColor: "action.background.muted.default",
171
- color: "display.text.default",
172
- borderColor: "action.border.default"
173
- }
174
- },
175
- onClick: onClearAll,
176
- children: [/* @__PURE__ */jsx(Icon, {
177
- icon: "delete",
178
- width: 16,
179
- height: 16
180
- }), /* @__PURE__ */jsx(Text, {
181
- sx: {
182
- ml: -1,
183
- marginTop: -0.4,
184
- fontSize: "sm"
185
- },
186
- children: "Limpar Tudo"
187
- })]
188
- })
189
- }), notifications.length === 0 ? /* @__PURE__ */jsx(Text, {
190
- sx: {
191
- color: "display.text.muted.default",
192
- textAlign: "center",
193
- p: 4
194
- },
195
- children: "Nenhuma notifica\xE7\xE3o"
196
- }) : notifications.map(notification => {
197
- return /* @__PURE__ */jsx(NotificationCard, {
198
- ...notification,
199
- onClose: () => {
200
- notification.onClose?.();
201
- onClose?.();
202
- }
203
- }, notification.id);
204
- }), hasMore && /* @__PURE__ */jsx("div", {
205
- ref: loadMoreRef,
206
- style: {
207
- height: 1
208
- }
209
- })]
210
- })
211
- })
212
- })
213
- })]
214
- })
215
- });
216
- };
172
+ onClick: onClearAll
173
+ }, /* @__PURE__ */React.createElement(Icon, {
174
+ icon: "delete",
175
+ width: 16,
176
+ height: 16
177
+ }), /* @__PURE__ */React.createElement(Text, {
178
+ sx: {
179
+ ml: -1,
180
+ marginTop: -0.4,
181
+ fontSize: "sm"
182
+ }
183
+ }, "Limpar Tudo"))), notifications.length === 0 ? /* @__PURE__ */React.createElement(Text, {
184
+ sx: {
185
+ color: "display.text.muted.default",
186
+ textAlign: "center",
187
+ p: 4
188
+ }
189
+ }, "Nenhuma notifica\xE7\xE3o") : notifications.map(notification => {
190
+ return /* @__PURE__ */React.createElement(NotificationCard, {
191
+ key: notification.id,
192
+ ...notification,
193
+ onClose: /* @__PURE__ */__name(() => {
194
+ notification.onClose?.();
195
+ onClose?.();
196
+ }, "onClose")
197
+ });
198
+ }), hasMore && /* @__PURE__ */React.createElement("div", {
199
+ ref: loadMoreRef,
200
+ style: {
201
+ height: 1
202
+ }
203
+ })))))));
204
+ }, "NotificationsMenu");
217
205
  export { NotificationsMenu };
@@ -1,11 +1,11 @@
1
1
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ import { __name } from "../chunk-V4MHYKRI.js";
2
3
 
3
4
  // src/components/Search/Search.tsx
4
5
  import * as React from "react";
5
6
  import { Input } from "@ttoss/ui";
6
7
  import { useDebounce } from "@ttoss/react-hooks";
7
- import { jsx } from "react/jsx-runtime";
8
- var Search = ({
8
+ var Search = /* @__PURE__ */__name(({
9
9
  value,
10
10
  defaultValue,
11
11
  loading,
@@ -17,13 +17,13 @@ var Search = ({
17
17
  React.useEffect(() => {
18
18
  onChange(debouncedValue);
19
19
  }, [debouncedValue, onChange]);
20
- return /* @__PURE__ */jsx(Input, {
20
+ return /* @__PURE__ */React.createElement(Input, {
21
21
  leadingIcon: loading ? "loading" : "search",
22
22
  defaultValue: text,
23
- onChange: e => {
23
+ onChange: /* @__PURE__ */__name(e => {
24
24
  return setText(e.target.value);
25
- },
25
+ }, "onChange"),
26
26
  ...props
27
27
  });
28
- };
28
+ }, "Search");
29
29
  export { Search };
@@ -1,57 +1,57 @@
1
1
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ import { __name } from "../chunk-V4MHYKRI.js";
2
3
 
3
4
  // src/components/Table/Table.tsx
4
5
  import { Box } from "@ttoss/ui";
5
6
  import { createCell, createColumnHelper, flexRender, getCoreRowModel, useReactTable } from "@tanstack/react-table";
6
- import { jsx } from "react/jsx-runtime";
7
- var Table = props => {
8
- return /* @__PURE__ */jsx(Box, {
7
+ var Table = /* @__PURE__ */__name(props => {
8
+ return /* @__PURE__ */React.createElement(Box, {
9
9
  as: "table",
10
10
  ...props
11
11
  });
12
- };
13
- var TableHead = props => {
14
- return /* @__PURE__ */jsx(Box, {
12
+ }, "Table");
13
+ var TableHead = /* @__PURE__ */__name(props => {
14
+ return /* @__PURE__ */React.createElement(Box, {
15
15
  as: "thead",
16
16
  ...props
17
17
  });
18
- };
19
- var TableBody = props => {
20
- return /* @__PURE__ */jsx(Box, {
18
+ }, "TableHead");
19
+ var TableBody = /* @__PURE__ */__name(props => {
20
+ return /* @__PURE__ */React.createElement(Box, {
21
21
  as: "tbody",
22
22
  ...props
23
23
  });
24
- };
25
- var TableRow = props => {
26
- return /* @__PURE__ */jsx(Box, {
24
+ }, "TableBody");
25
+ var TableRow = /* @__PURE__ */__name(props => {
26
+ return /* @__PURE__ */React.createElement(Box, {
27
27
  as: "tr",
28
28
  ...props
29
29
  });
30
- };
31
- var TableCell = props => {
32
- return /* @__PURE__ */jsx(Box, {
30
+ }, "TableRow");
31
+ var TableCell = /* @__PURE__ */__name(props => {
32
+ return /* @__PURE__ */React.createElement(Box, {
33
33
  as: "td",
34
34
  ...props
35
35
  });
36
- };
37
- var TableHeader = props => {
38
- return /* @__PURE__ */jsx(Box, {
36
+ }, "TableCell");
37
+ var TableHeader = /* @__PURE__ */__name(props => {
38
+ return /* @__PURE__ */React.createElement(Box, {
39
39
  as: "th",
40
40
  ...props
41
41
  });
42
- };
43
- var TableCaption = props => {
44
- return /* @__PURE__ */jsx(Box, {
42
+ }, "TableHeader");
43
+ var TableCaption = /* @__PURE__ */__name(props => {
44
+ return /* @__PURE__ */React.createElement(Box, {
45
45
  as: "caption",
46
46
  ...props
47
47
  });
48
- };
49
- var TableFooter = props => {
50
- return /* @__PURE__ */jsx(Box, {
48
+ }, "TableCaption");
49
+ var TableFooter = /* @__PURE__ */__name(props => {
50
+ return /* @__PURE__ */React.createElement(Box, {
51
51
  as: "tfoot",
52
52
  ...props
53
53
  });
54
- };
54
+ }, "TableFooter");
55
55
  Table.Head = TableHead;
56
56
  Table.Body = TableBody;
57
57
  Table.Row = TableRow;
@@ -1,23 +1,23 @@
1
1
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ import { __name } from "../chunk-V4MHYKRI.js";
2
3
 
3
4
  // src/components/Tabs/Tabs.tsx
4
5
  import { Box } from "@ttoss/ui";
5
6
  import { Tab, TabList, TabPanel, Tabs as ReactTabs } from "react-tabs";
6
- import { jsx } from "react/jsx-runtime";
7
- var Tabs = props => {
7
+ var Tabs = /* @__PURE__ */__name(props => {
8
8
  const {
9
9
  sx: customSx,
10
10
  ...restProps
11
11
  } = props;
12
- return /* @__PURE__ */jsx(Box, {
13
- sx: ({
12
+ return /* @__PURE__ */React.createElement(Box, {
13
+ sx: /* @__PURE__ */__name(({
14
14
  colors
15
15
  }) => {
16
16
  const themeColors = colors;
17
17
  return {
18
18
  /**
19
- * Tabs
20
- */
19
+ * Tabs
20
+ */
21
21
  ".react-tabs": {
22
22
  WebkitTapHighlightColor: "transparent"
23
23
  },
@@ -61,14 +61,10 @@ var Tabs = props => {
61
61
  },
62
62
  ...customSx
63
63
  };
64
- },
65
- ...restProps,
66
- children: /* @__PURE__ */jsx(ReactTabs, {
67
- ...props,
68
- children: props.children
69
- })
70
- });
71
- };
64
+ }, "sx"),
65
+ ...restProps
66
+ }, /* @__PURE__ */React.createElement(ReactTabs, props, props.children));
67
+ }, "Tabs");
72
68
  Tabs.TabList = TabList;
73
69
  Tabs.Tab = Tab;
74
70
  Tabs.TabPanel = TabPanel;
@@ -1,4 +1,5 @@
1
1
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ import { __name } from "../chunk-V4MHYKRI.js";
2
3
 
3
4
  // src/components/Toast/Toast.tsx
4
5
  import { css as createClassName } from "@emotion/css";
@@ -6,8 +7,7 @@ import { css as transformStyleObject } from "@theme-ui/css";
6
7
  import { Box, useTheme } from "@ttoss/ui";
7
8
  import * as React from "react";
8
9
  import { toast as toastReactToastify, ToastContainer as ReactToastifyToastContainer } from "react-toastify";
9
- import { jsx } from "react/jsx-runtime";
10
- var ToastContainer = props => {
10
+ var ToastContainer = /* @__PURE__ */__name(props => {
11
11
  const {
12
12
  theme
13
13
  } = useTheme();
@@ -17,9 +17,9 @@ var ToastContainer = props => {
17
17
  })(theme);
18
18
  return createClassName(styles);
19
19
  }, [theme]);
20
- return /* @__PURE__ */jsx(Box, {
20
+ return /* @__PURE__ */React.createElement(Box, {
21
21
  className,
22
- sx: ({
22
+ sx: /* @__PURE__ */__name(({
23
23
  colors,
24
24
  fonts
25
25
  }) => {
@@ -28,12 +28,11 @@ var ToastContainer = props => {
28
28
  "--toastify-font-family": fonts?.body,
29
29
  "--toastify-color-light": themeColors?.feedback?.background?.primary?.default
30
30
  };
31
- },
32
- children: /* @__PURE__ */jsx(ReactToastifyToastContainer, {
33
- className,
34
- ...props
35
- })
36
- });
37
- };
31
+ }, "sx")
32
+ }, /* @__PURE__ */React.createElement(ReactToastifyToastContainer, {
33
+ className,
34
+ ...props
35
+ }));
36
+ }, "ToastContainer");
38
37
  var toast = toastReactToastify;
39
38
  export { ToastContainer, toast };