@ttoss/components 2.14.20 → 2.14.22

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,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/NavList/NavList.tsx
5
2
  import { Icon } from "@ttoss/react-icons";
6
3
  import { Divider, Flex, Link, Text } from "@ttoss/ui";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
5
  import * as React from "react";
8
- var getVariantStyles = /* @__PURE__ */__name(variant => {
6
+
7
+ //#region src/components/NavList/NavList.tsx
8
+ const getVariantStyles = variant => {
9
9
  switch (variant) {
10
10
  case "sidebar":
11
11
  return {
@@ -115,8 +115,8 @@ var getVariantStyles = /* @__PURE__ */__name(variant => {
115
115
  default:
116
116
  return getVariantStyles("menu");
117
117
  }
118
- }, "getVariantStyles");
119
- var NavListItemComponent = /* @__PURE__ */__name(({
118
+ };
119
+ const NavListItemComponent = ({
120
120
  item,
121
121
  onItemClick,
122
122
  variantStyles,
@@ -124,57 +124,64 @@ var NavListItemComponent = /* @__PURE__ */__name(({
124
124
  LinkComponent = Link,
125
125
  showDivider = false
126
126
  }) => {
127
- const handleClick = /* @__PURE__ */__name(event => {
127
+ const handleClick = event => {
128
128
  if (item.disabled) {
129
129
  event.preventDefault();
130
130
  return;
131
131
  }
132
132
  item.onClick?.(event);
133
133
  onItemClick?.(item);
134
- }, "handleClick");
134
+ };
135
135
  const itemStyles = {
136
136
  ...variantStyles.item,
137
137
  ...(item.active ? variantStyles.activeItem : {}),
138
138
  ...(item.disabled ? {
139
- opacity: 0.5,
139
+ opacity: .5,
140
140
  cursor: "not-allowed",
141
141
  pointerEvents: "none"
142
142
  } : {})
143
143
  };
144
144
  const isDefaultLink = LinkComponent === Link;
145
- const linkContent = /* @__PURE__ */React.createElement(Flex, {
145
+ const linkContent = /* @__PURE__ */jsxs(Flex, {
146
146
  sx: {
147
147
  alignItems: "center",
148
148
  gap: "2",
149
149
  color: "navigation.text.primary.default"
150
- }
151
- }, item.icon && /* @__PURE__ */React.createElement(Icon, {
152
- icon: item.icon,
153
- width: iconSize ?? variantStyles.icon.size,
154
- height: iconSize ?? variantStyles.icon.size
155
- }), /* @__PURE__ */React.createElement(Text, null, item.label));
156
- return /* @__PURE__ */React.createElement(React.Fragment, null, isDefaultLink ? /* @__PURE__ */React.createElement(LinkComponent, {
157
- href: item.href,
158
- onClick: handleClick,
159
- sx: itemStyles,
160
- "aria-disabled": item.disabled,
161
- "aria-current": item.active ? "page" : void 0,
162
- quiet: true
163
- }, linkContent) : /* @__PURE__ */React.createElement(Link, {
164
- as: LinkComponent,
165
- href: item.href,
166
- onClick: handleClick,
167
- sx: itemStyles,
168
- "aria-disabled": item.disabled,
169
- "aria-current": item.active ? "page" : void 0,
170
- quiet: true
171
- }, linkContent), showDivider && /* @__PURE__ */React.createElement(Divider, {
172
- sx: {
173
- marginY: "2"
174
- }
175
- }));
176
- }, "NavListItemComponent");
177
- var NavList = /* @__PURE__ */__name(({
150
+ },
151
+ children: [item.icon && /* @__PURE__ */jsx(Icon, {
152
+ icon: item.icon,
153
+ width: iconSize ?? variantStyles.icon.size,
154
+ height: iconSize ?? variantStyles.icon.size
155
+ }), /* @__PURE__ */jsx(Text, {
156
+ children: item.label
157
+ })]
158
+ });
159
+ return /* @__PURE__ */jsxs(Fragment, {
160
+ children: [isDefaultLink ? /* @__PURE__ */jsx(LinkComponent, {
161
+ href: item.href,
162
+ onClick: handleClick,
163
+ sx: itemStyles,
164
+ "aria-disabled": item.disabled,
165
+ "aria-current": item.active ? "page" : void 0,
166
+ quiet: true,
167
+ children: linkContent
168
+ }) : /* @__PURE__ */jsx(Link, {
169
+ as: LinkComponent,
170
+ href: item.href,
171
+ onClick: handleClick,
172
+ sx: itemStyles,
173
+ "aria-disabled": item.disabled,
174
+ "aria-current": item.active ? "page" : void 0,
175
+ quiet: true,
176
+ children: linkContent
177
+ }), showDivider && /* @__PURE__ */jsx(Divider, {
178
+ sx: {
179
+ marginY: "2"
180
+ }
181
+ })]
182
+ });
183
+ };
184
+ const NavList = ({
178
185
  items = [],
179
186
  groups = [],
180
187
  variant = "menu",
@@ -185,15 +192,11 @@ var NavList = /* @__PURE__ */__name(({
185
192
  }) => {
186
193
  const variantStyles = getVariantStyles(variant);
187
194
  const processedGroups = React.useMemo(() => {
188
- if (groups.length > 0) {
189
- return groups;
190
- }
195
+ if (groups.length > 0) return groups;
191
196
  if (items.length > 0) {
192
197
  const groupedItems = items.reduce((acc, item) => {
193
198
  const groupKey = item.group || "__ungrouped__";
194
- if (!acc[groupKey]) {
195
- acc[groupKey] = [];
196
- }
199
+ if (!acc[groupKey]) acc[groupKey] = [];
197
200
  acc[groupKey].push(item);
198
201
  return acc;
199
202
  }, {});
@@ -208,39 +211,42 @@ var NavList = /* @__PURE__ */__name(({
208
211
  }
209
212
  return [];
210
213
  }, [items, groups]);
211
- return /* @__PURE__ */React.createElement(Flex, {
214
+ return /* @__PURE__ */jsx(Flex, {
212
215
  as: "nav",
213
216
  sx: {
214
217
  ...variantStyles.container,
215
218
  ...sx
216
219
  },
217
- role: "navigation"
218
- }, processedGroups.map((group, groupIndex) => {
219
- return /* @__PURE__ */React.createElement(React.Fragment, {
220
- key: group.id || `group-${groupIndex}`
221
- }, group.label && /* @__PURE__ */React.createElement(Text, {
222
- sx: variantStyles.groupLabel,
223
- as: "div",
224
- role: "heading"
225
- }, group.label), /* @__PURE__ */React.createElement(Flex, {
226
- sx: {
227
- flexDirection: "column",
228
- gap: variantStyles.container.gap
229
- }
230
- }, group.items.map((item, itemIndex) => {
231
- const isLastItem = itemIndex === group.items.length - 1;
232
- const showDivider = item.divider || isLastItem && group.divider;
233
- return /* @__PURE__ */React.createElement(NavListItemComponent, {
234
- key: item.id || `${group.id}-item-${itemIndex}`,
235
- item,
236
- onItemClick,
237
- variantStyles,
238
- iconSize,
239
- LinkComponent,
240
- showDivider
241
- });
242
- })));
243
- }));
244
- }, "NavList");
220
+ role: "navigation",
221
+ children: processedGroups.map((group, groupIndex) => {
222
+ return /* @__PURE__ */jsxs(React.Fragment, {
223
+ children: [group.label && /* @__PURE__ */jsx(Text, {
224
+ sx: variantStyles.groupLabel,
225
+ as: "div",
226
+ role: "heading",
227
+ children: group.label
228
+ }), /* @__PURE__ */jsx(Flex, {
229
+ sx: {
230
+ flexDirection: "column",
231
+ gap: variantStyles.container.gap
232
+ },
233
+ children: group.items.map((item, itemIndex) => {
234
+ const isLastItem = itemIndex === group.items.length - 1;
235
+ return /* @__PURE__ */jsx(NavListItemComponent, {
236
+ item,
237
+ onItemClick,
238
+ variantStyles,
239
+ iconSize,
240
+ LinkComponent,
241
+ showDivider: item.divider || isLastItem && group.divider
242
+ }, item.id || `${group.id}-item-${itemIndex}`);
243
+ })
244
+ })]
245
+ }, group.id || `group-${groupIndex}`);
246
+ })
247
+ });
248
+ };
245
249
  NavList.displayName = "NavList";
250
+
251
+ //#endregion
246
252
  export { NavList };
@@ -0,0 +1,22 @@
1
+
2
+ import * as React from "react";
3
+
4
+ //#region src/components/NotificationCard/NotificationCard.d.ts
5
+ type NotificationType = 'success' | 'error' | 'warning' | 'info' | 'neutral';
6
+ type NotificationAction = {
7
+ action?: 'open_url';
8
+ url?: string;
9
+ label?: string;
10
+ };
11
+ type NotificationCardProps = {
12
+ type: NotificationType;
13
+ title?: string | React.ReactNode;
14
+ message: string | React.ReactNode;
15
+ actions?: NotificationAction[];
16
+ caption?: string | React.ReactNode;
17
+ tags?: string[] | React.ReactNode;
18
+ onClose?: () => void;
19
+ };
20
+ declare const NotificationCard: (props: NotificationCardProps) => import("react/jsx-runtime").JSX.Element;
21
+ //#endregion
22
+ export { NotificationAction, NotificationCard, NotificationCardProps };
@@ -0,0 +1,173 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ import { Icon } from "@ttoss/react-icons";
3
+ import { Box, Card, CloseButton, Link, Tag, Text } from "@ttoss/ui";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import "react";
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
+ export { NotificationCard };
@@ -0,0 +1,47 @@
1
+
2
+ import * as React from "react";
3
+
4
+ //#region src/components/NotificationCard/NotificationCard.d.ts
5
+ type NotificationType = 'success' | 'error' | 'warning' | 'info' | 'neutral';
6
+ type NotificationAction = {
7
+ action?: 'open_url';
8
+ url?: string;
9
+ label?: string;
10
+ };
11
+ type NotificationCardProps = {
12
+ type: NotificationType;
13
+ title?: string | React.ReactNode;
14
+ message: string | React.ReactNode;
15
+ actions?: NotificationAction[];
16
+ caption?: string | React.ReactNode;
17
+ tags?: string[] | React.ReactNode;
18
+ onClose?: () => void;
19
+ };
20
+ //#endregion
21
+ //#region src/components/NotificationsMenu/NotificationsMenu.d.ts
22
+ type Notification = NotificationCardProps & {
23
+ id: string;
24
+ group?: string;
25
+ };
26
+ type Props = {
27
+ notifications: Notification[];
28
+ defaultOpen?: boolean;
29
+ hasMore?: boolean;
30
+ count: number;
31
+ onLoadMore?: () => void;
32
+ onOpenChange?: (isOpen: boolean) => void;
33
+ onClose?: () => void;
34
+ onClearAll?: () => void;
35
+ };
36
+ declare const NotificationsMenu: ({
37
+ notifications,
38
+ defaultOpen,
39
+ hasMore,
40
+ onLoadMore,
41
+ onOpenChange,
42
+ count,
43
+ onClose,
44
+ onClearAll
45
+ }: Props) => import("react/jsx-runtime").JSX.Element;
46
+ //#endregion
47
+ export { Notification, NotificationsMenu };