@ttoss/components 2.14.24 → 2.14.26

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 (47) hide show
  1. package/dist/index.d.mts +910 -0
  2. package/dist/index.mjs +3074 -0
  3. package/package.json +18 -104
  4. package/dist/Accordion/index.d.mts +0 -157
  5. package/dist/Accordion/index.mjs +0 -175
  6. package/dist/DatePicker/index.d.mts +0 -26
  7. package/dist/DatePicker/index.mjs +0 -339
  8. package/dist/Drawer/index.d.mts +0 -17
  9. package/dist/Drawer/index.mjs +0 -66
  10. package/dist/EnhancedTitle/index.d.mts +0 -107
  11. package/dist/EnhancedTitle/index.mjs +0 -234
  12. package/dist/FileUploader/index.d.mts +0 -77
  13. package/dist/FileUploader/index.mjs +0 -386
  14. package/dist/InstallPwa/index.d.mts +0 -13
  15. package/dist/InstallPwa/index.mjs +0 -64
  16. package/dist/JsonEditor/index.d.mts +0 -3
  17. package/dist/JsonEditor/index.mjs +0 -3
  18. package/dist/JsonView/index.d.mts +0 -3
  19. package/dist/JsonView/index.mjs +0 -3
  20. package/dist/List/index.d.mts +0 -16
  21. package/dist/List/index.mjs +0 -34
  22. package/dist/LockedOverlay/index.d.mts +0 -162
  23. package/dist/LockedOverlay/index.mjs +0 -386
  24. package/dist/Markdown/index.d.mts +0 -16
  25. package/dist/Markdown/index.mjs +0 -26
  26. package/dist/Menu/index.d.mts +0 -16
  27. package/dist/Menu/index.mjs +0 -136
  28. package/dist/MetricCard/index.d.mts +0 -153
  29. package/dist/MetricCard/index.mjs +0 -408
  30. package/dist/Modal/index.d.mts +0 -11
  31. package/dist/Modal/index.mjs +0 -64
  32. package/dist/NavList/index.d.mts +0 -64
  33. package/dist/NavList/index.mjs +0 -252
  34. package/dist/NotificationCard/index.d.mts +0 -22
  35. package/dist/NotificationCard/index.mjs +0 -173
  36. package/dist/NotificationsMenu/index.d.mts +0 -47
  37. package/dist/NotificationsMenu/index.mjs +0 -380
  38. package/dist/Search/index.d.mts +0 -18
  39. package/dist/Search/index.mjs +0 -31
  40. package/dist/SpotlightCard/index.d.mts +0 -36
  41. package/dist/SpotlightCard/index.mjs +0 -219
  42. package/dist/Table/index.d.mts +0 -17
  43. package/dist/Table/index.mjs +0 -64
  44. package/dist/Tabs/index.d.mts +0 -17
  45. package/dist/Tabs/index.mjs +0 -87
  46. package/dist/Toast/index.d.mts +0 -8
  47. package/dist/Toast/index.mjs +0 -43
@@ -1,252 +0,0 @@
1
- /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- import { Icon } from "@ttoss/react-icons";
3
- import { Divider, Flex, Link, Text } from "@ttoss/ui";
4
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
- import * as React from "react";
6
-
7
- //#region src/components/NavList/NavList.tsx
8
- var getVariantStyles = variant => {
9
- switch (variant) {
10
- case "sidebar":
11
- return {
12
- container: {
13
- flexDirection: "column",
14
- gap: "1",
15
- width: "full"
16
- },
17
- item: {
18
- backgroundColor: "transparent",
19
- padding: "3",
20
- borderRadius: "none",
21
- fontSize: "md",
22
- transition: "background-color 0.15s ease",
23
- "&:hover": {
24
- backgroundColor: "navigation.background.muted.hover",
25
- textDecoration: "none"
26
- }
27
- },
28
- activeItem: {
29
- backgroundColor: "navigation.background.muted.default",
30
- borderLeft: "4px solid",
31
- borderColor: "navigation.border.primary.default",
32
- paddingLeft: "calc(0.75rem - 4px)"
33
- },
34
- icon: {
35
- size: 20
36
- },
37
- groupLabel: {
38
- fontSize: "xs",
39
- fontWeight: "bold",
40
- color: "navigation.text.muted.default",
41
- textTransform: "uppercase",
42
- marginBottom: "2",
43
- marginTop: "4"
44
- }
45
- };
46
- case "menu":
47
- return {
48
- container: {
49
- flexDirection: "column",
50
- gap: "1",
51
- width: "full"
52
- },
53
- item: {
54
- backgroundColor: "transparent",
55
- borderRadius: "md",
56
- padding: "2",
57
- fontSize: "md",
58
- transition: "all 0.2s ease",
59
- "&:hover": {
60
- backgroundColor: "navigation.background.muted.hover",
61
- transform: "translateX(4px)",
62
- textDecoration: "none"
63
- }
64
- },
65
- activeItem: {
66
- backgroundColor: "navigation.background.muted.default",
67
- fontWeight: "bold"
68
- },
69
- icon: {
70
- size: 18
71
- },
72
- groupLabel: {
73
- fontSize: "sm",
74
- fontWeight: "semibold",
75
- color: "display.text.secondary.default",
76
- marginBottom: "2",
77
- marginTop: "3"
78
- }
79
- };
80
- case "dropdown":
81
- return {
82
- container: {
83
- flexDirection: "column",
84
- gap: "1",
85
- width: "full"
86
- },
87
- item: {
88
- backgroundColor: "transparent",
89
- padding: "2",
90
- fontSize: "sm",
91
- borderBottom: "sm",
92
- borderColor: "display.border.muted.default",
93
- transition: "background-color 0.1s ease",
94
- "&:hover": {
95
- backgroundColor: "navigation.background.muted.hover",
96
- textDecoration: "none"
97
- }
98
- },
99
- activeItem: {
100
- backgroundColor: "navigation.background.muted.default",
101
- fontWeight: "semibold"
102
- },
103
- icon: {
104
- size: 16
105
- },
106
- groupLabel: {
107
- fontSize: "xs",
108
- fontWeight: "medium",
109
- color: "display.text.secondary.default",
110
- marginBottom: "1",
111
- marginTop: "2",
112
- paddingX: "2"
113
- }
114
- };
115
- default:
116
- return getVariantStyles("menu");
117
- }
118
- };
119
- var NavListItemComponent = ({
120
- item,
121
- onItemClick,
122
- variantStyles,
123
- iconSize,
124
- LinkComponent = Link,
125
- showDivider = false
126
- }) => {
127
- const handleClick = event => {
128
- if (item.disabled) {
129
- event.preventDefault();
130
- return;
131
- }
132
- item.onClick?.(event);
133
- onItemClick?.(item);
134
- };
135
- const itemStyles = {
136
- ...variantStyles.item,
137
- ...(item.active ? variantStyles.activeItem : {}),
138
- ...(item.disabled ? {
139
- opacity: .5,
140
- cursor: "not-allowed",
141
- pointerEvents: "none"
142
- } : {})
143
- };
144
- const isDefaultLink = LinkComponent === Link;
145
- const linkContent = /* @__PURE__ */jsxs(Flex, {
146
- sx: {
147
- alignItems: "center",
148
- gap: "2",
149
- color: "navigation.text.primary.default"
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
- var NavList = ({
185
- items = [],
186
- groups = [],
187
- variant = "menu",
188
- onItemClick,
189
- sx,
190
- iconSize,
191
- LinkComponent
192
- }) => {
193
- const variantStyles = getVariantStyles(variant);
194
- const processedGroups = React.useMemo(() => {
195
- if (groups.length > 0) return groups;
196
- if (items.length > 0) {
197
- const groupedItems = items.reduce((acc, item) => {
198
- const groupKey = item.group || "__ungrouped__";
199
- if (!acc[groupKey]) acc[groupKey] = [];
200
- acc[groupKey].push(item);
201
- return acc;
202
- }, {});
203
- return Object.entries(groupedItems).map(([key, groupItems]) => {
204
- return {
205
- id: key,
206
- label: key === "__ungrouped__" ? void 0 : key,
207
- items: groupItems,
208
- divider: false
209
- };
210
- });
211
- }
212
- return [];
213
- }, [items, groups]);
214
- return /* @__PURE__ */jsx(Flex, {
215
- as: "nav",
216
- sx: {
217
- ...variantStyles.container,
218
- ...sx
219
- },
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
- };
249
- NavList.displayName = "NavList";
250
-
251
- //#endregion
252
- export { NavList };
@@ -1,22 +0,0 @@
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 };
@@ -1,173 +0,0 @@
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
- var 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 };
@@ -1,47 +0,0 @@
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 };