@ttoss/components 2.10.0 → 2.10.2

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 (39) hide show
  1. package/package.json +18 -11
  2. package/dist/Accordion/index.d.ts +0 -16
  3. package/dist/Drawer/index.d.ts +0 -12
  4. package/dist/FileUploader/index.d.ts +0 -55
  5. package/dist/InstallPwa/index.d.ts +0 -10
  6. package/dist/JsonEditor/index.d.ts +0 -2
  7. package/dist/JsonView/index.d.ts +0 -1
  8. package/dist/List/index.d.ts +0 -13
  9. package/dist/Markdown/index.d.ts +0 -11
  10. package/dist/Menu/index.d.ts +0 -11
  11. package/dist/Modal/index.d.ts +0 -10
  12. package/dist/NavList/index.d.ts +0 -55
  13. package/dist/NotificationCard/index.d.ts +0 -21
  14. package/dist/NotificationsMenu/index.d.ts +0 -36
  15. package/dist/Search/index.d.ts +0 -11
  16. package/dist/SpotlightCard/index.d.ts +0 -27
  17. package/dist/Table/index.d.ts +0 -16
  18. package/dist/Tabs/index.d.ts +0 -18
  19. package/dist/Toast/index.d.ts +0 -8
  20. package/dist/esm/Accordion/index.js +0 -49
  21. package/dist/esm/Drawer/index.js +0 -59
  22. package/dist/esm/FileUploader/index.js +0 -401
  23. package/dist/esm/InstallPwa/index.js +0 -61
  24. package/dist/esm/JsonEditor/index.js +0 -6
  25. package/dist/esm/JsonView/index.js +0 -6
  26. package/dist/esm/List/index.js +0 -30
  27. package/dist/esm/Markdown/index.js +0 -23
  28. package/dist/esm/Menu/index.js +0 -131
  29. package/dist/esm/Modal/index.js +0 -65
  30. package/dist/esm/NavList/index.js +0 -246
  31. package/dist/esm/NotificationCard/index.js +0 -156
  32. package/dist/esm/NotificationsMenu/index.js +0 -358
  33. package/dist/esm/Search/index.js +0 -29
  34. package/dist/esm/SpotlightCard/index.js +0 -212
  35. package/dist/esm/Table/index.js +0 -63
  36. package/dist/esm/Tabs/index.js +0 -75
  37. package/dist/esm/Toast/index.js +0 -38
  38. package/dist/esm/chunk-2R7AUPJL.js +0 -2176
  39. package/dist/esm/chunk-V4MHYKRI.js +0 -7
@@ -1,65 +0,0 @@
1
- /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- import * as React from 'react';
3
- import { __name } from "../chunk-V4MHYKRI.js";
4
-
5
- // src/components/Modal/Modal.tsx
6
- import { css as transformStyleObject } from "@theme-ui/css";
7
- import { useResponsiveValue, useTheme } from "@ttoss/ui";
8
- import ReactModal from "react-modal";
9
- ReactModal.defaultStyles = {
10
- overlay: {},
11
- content: {}
12
- };
13
- var Modal = /* @__PURE__ */__name(props => {
14
- const {
15
- theme
16
- } = useTheme();
17
- const space = theme.space;
18
- const padding = useResponsiveValue([space?.["4"], space?.["5"], space?.["5"]]) || 0;
19
- const style = {
20
- overlay: transformStyleObject({
21
- position: "fixed",
22
- top: 0,
23
- left: 0,
24
- right: 0,
25
- bottom: 0,
26
- backgroundColor: "rgba(0, 0, 0, 0.5)",
27
- display: "flex",
28
- justifyContent: "center",
29
- alignItems: "center",
30
- zIndex: "modal",
31
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
32
- ...props.style?.overlay
33
- })(theme),
34
- content: transformStyleObject({
35
- /**
36
- * Theme
37
- */
38
- backgroundColor: "surface",
39
- padding,
40
- border: "default",
41
- borderColor: "surface",
42
- borderRadius: "default",
43
- /**
44
- * General
45
- */
46
- WebkitOverflowScrolling: "touch",
47
- overflow: "auto",
48
- position: "relative",
49
- top: "0px",
50
- left: "0px",
51
- right: "0px",
52
- bottom: "0px",
53
- maxHeight: "90%",
54
- maxWidth: "90%",
55
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
56
- ...props.style?.content
57
- })(theme)
58
- };
59
- return /* @__PURE__ */React.createElement(ReactModal, {
60
- ...props,
61
- style
62
- });
63
- }, "Modal");
64
- Modal.setAppElement = ReactModal.setAppElement;
65
- export { Modal };
@@ -1,246 +0,0 @@
1
- /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- import { Icon } from "../chunk-2R7AUPJL.js";
3
- import { __name } from "../chunk-V4MHYKRI.js";
4
-
5
- // src/components/NavList/NavList.tsx
6
- import { Divider, Flex, Link, Text } from "@ttoss/ui";
7
- import * as React from "react";
8
- var getVariantStyles = /* @__PURE__ */__name(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
- }, "getVariantStyles");
119
- var NavListItemComponent = /* @__PURE__ */__name(({
120
- item,
121
- onItemClick,
122
- variantStyles,
123
- iconSize,
124
- LinkComponent = Link,
125
- showDivider = false
126
- }) => {
127
- const handleClick = /* @__PURE__ */__name(event => {
128
- if (item.disabled) {
129
- event.preventDefault();
130
- return;
131
- }
132
- item.onClick?.(event);
133
- onItemClick?.(item);
134
- }, "handleClick");
135
- const itemStyles = {
136
- ...variantStyles.item,
137
- ...(item.active ? variantStyles.activeItem : {}),
138
- ...(item.disabled ? {
139
- opacity: 0.5,
140
- cursor: "not-allowed",
141
- pointerEvents: "none"
142
- } : {})
143
- };
144
- const isDefaultLink = LinkComponent === Link;
145
- const linkContent = /* @__PURE__ */React.createElement(Flex, {
146
- sx: {
147
- alignItems: "center",
148
- gap: "2",
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(({
178
- items = [],
179
- groups = [],
180
- variant = "menu",
181
- onItemClick,
182
- sx,
183
- iconSize,
184
- LinkComponent
185
- }) => {
186
- const variantStyles = getVariantStyles(variant);
187
- const processedGroups = React.useMemo(() => {
188
- if (groups.length > 0) {
189
- return groups;
190
- }
191
- if (items.length > 0) {
192
- const groupedItems = items.reduce((acc, item) => {
193
- const groupKey = item.group || "__ungrouped__";
194
- if (!acc[groupKey]) {
195
- acc[groupKey] = [];
196
- }
197
- acc[groupKey].push(item);
198
- return acc;
199
- }, {});
200
- return Object.entries(groupedItems).map(([key, groupItems]) => {
201
- return {
202
- id: key,
203
- label: key === "__ungrouped__" ? void 0 : key,
204
- items: groupItems,
205
- divider: false
206
- };
207
- });
208
- }
209
- return [];
210
- }, [items, groups]);
211
- return /* @__PURE__ */React.createElement(Flex, {
212
- as: "nav",
213
- sx: {
214
- ...variantStyles.container,
215
- ...sx
216
- },
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");
245
- NavList.displayName = "NavList";
246
- export { NavList };
@@ -1,156 +0,0 @@
1
- /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- import { Icon } from "../chunk-2R7AUPJL.js";
3
- import { __name } from "../chunk-V4MHYKRI.js";
4
-
5
- // src/components/NotificationCard/NotificationCard.tsx
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 };