@ttoss/components 2.10.2 → 2.11.0
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.
- package/dist/Accordion/index.d.ts +16 -0
- package/dist/DatePicker/index.d.ts +19 -0
- package/dist/Drawer/index.d.ts +12 -0
- package/dist/FileUploader/index.d.ts +55 -0
- package/dist/InstallPwa/index.d.ts +10 -0
- package/dist/JsonEditor/index.d.ts +2 -0
- package/dist/JsonView/index.d.ts +1 -0
- package/dist/List/index.d.ts +13 -0
- package/dist/Markdown/index.d.ts +11 -0
- package/dist/Menu/index.d.ts +11 -0
- package/dist/Modal/index.d.ts +10 -0
- package/dist/NavList/index.d.ts +55 -0
- package/dist/NotificationCard/index.d.ts +21 -0
- package/dist/NotificationsMenu/index.d.ts +21 -0
- package/dist/Search/index.d.ts +11 -0
- package/dist/SpotlightCard/index.d.ts +27 -0
- package/dist/Table/index.d.ts +16 -0
- package/dist/Tabs/index.d.ts +18 -0
- package/dist/Toast/index.d.ts +8 -0
- package/dist/esm/Accordion/index.js +49 -0
- package/dist/esm/DatePicker/index.js +2476 -0
- package/dist/esm/Drawer/index.js +59 -0
- package/dist/esm/FileUploader/index.js +401 -0
- package/dist/esm/InstallPwa/index.js +61 -0
- package/dist/esm/JsonEditor/index.js +6 -0
- package/dist/esm/JsonView/index.js +6 -0
- package/dist/esm/List/index.js +30 -0
- package/dist/esm/Markdown/index.js +23 -0
- package/dist/esm/Menu/index.js +131 -0
- package/dist/esm/Modal/index.js +65 -0
- package/dist/esm/NavList/index.js +246 -0
- package/dist/esm/NotificationCard/index.js +5 -0
- package/dist/esm/NotificationsMenu/index.js +205 -0
- package/dist/esm/Search/index.js +29 -0
- package/dist/esm/SpotlightCard/index.js +212 -0
- package/dist/esm/Table/index.js +63 -0
- package/dist/esm/Tabs/index.js +75 -0
- package/dist/esm/Toast/index.js +38 -0
- package/dist/esm/chunk-6LHIQ5YP.js +156 -0
- package/dist/esm/chunk-V4MHYKRI.js +7 -0
- package/dist/esm/chunk-WT55GXBD.js +2176 -0
- package/package.json +3 -3
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
import { Icon } from "../chunk-WT55GXBD.js";
|
|
3
|
+
import { __name } from "../chunk-V4MHYKRI.js";
|
|
4
|
+
|
|
5
|
+
// src/components/SpotlightCard/SpotlightCard.tsx
|
|
6
|
+
import { Box, Button, Card, Flex, keyframes, Text } from "@ttoss/ui";
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
var SpotlightCard = /* @__PURE__ */__name(({
|
|
9
|
+
icon,
|
|
10
|
+
title,
|
|
11
|
+
badge,
|
|
12
|
+
description,
|
|
13
|
+
firstButton,
|
|
14
|
+
secondButton,
|
|
15
|
+
variant = "accent"
|
|
16
|
+
}) => {
|
|
17
|
+
const gradientFlow = keyframes({
|
|
18
|
+
"0%": {
|
|
19
|
+
backgroundPosition: "0% 50%"
|
|
20
|
+
},
|
|
21
|
+
"50%": {
|
|
22
|
+
backgroundPosition: "100% 50%"
|
|
23
|
+
},
|
|
24
|
+
"100%": {
|
|
25
|
+
backgroundPosition: "0% 50%"
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
const hasButtons = !!firstButton || !!secondButton;
|
|
29
|
+
const isAccent = variant === "accent";
|
|
30
|
+
const textColorToken = isAccent ? "action.text.accent.default" : "action.text.primary.default";
|
|
31
|
+
const iconColorToken = isAccent ? "action.text.accent.default" : "display.text.accent.default";
|
|
32
|
+
const iconBgToken = isAccent ? "rgba(255,255,255,0.3)" : "action.background.secondary.default";
|
|
33
|
+
const badgeBgToken = isAccent ? "action.background.primary.default" : "action.background.accent.default";
|
|
34
|
+
const badgeTextToken = isAccent ? "action.text.primary.default" : "action.text.accent.default";
|
|
35
|
+
const btnPrimaryVariant = isAccent ? "primary" : "accent";
|
|
36
|
+
const btnPrimaryColorToken = isAccent ? "action.text.primary.default" : "action.text.accent.default";
|
|
37
|
+
const btnSecondaryColorToken = textColorToken;
|
|
38
|
+
const btnSecondaryBorderColorToken = isAccent ? "currentColor" : "display.border.muted.default";
|
|
39
|
+
const renderButton = /* @__PURE__ */__name((prop, config) => {
|
|
40
|
+
if (!prop) return null;
|
|
41
|
+
if (/* @__PURE__ */React.isValidElement(prop)) return prop;
|
|
42
|
+
if (typeof prop !== "object") return prop;
|
|
43
|
+
const {
|
|
44
|
+
sx,
|
|
45
|
+
...rest
|
|
46
|
+
} = prop;
|
|
47
|
+
const {
|
|
48
|
+
variant: defaultVariant,
|
|
49
|
+
textColor,
|
|
50
|
+
styles = {}
|
|
51
|
+
} = config;
|
|
52
|
+
return /* @__PURE__ */React.createElement(Button, {
|
|
53
|
+
variant: defaultVariant,
|
|
54
|
+
sx: {
|
|
55
|
+
display: "flex",
|
|
56
|
+
alignItems: "center",
|
|
57
|
+
justifyContent: "center",
|
|
58
|
+
gap: "2",
|
|
59
|
+
px: "6",
|
|
60
|
+
py: "3",
|
|
61
|
+
fontSize: "15px",
|
|
62
|
+
fontWeight: "bold",
|
|
63
|
+
whiteSpace: "nowrap",
|
|
64
|
+
transition: "all 0.2s",
|
|
65
|
+
color: textColor,
|
|
66
|
+
...styles,
|
|
67
|
+
...sx
|
|
68
|
+
},
|
|
69
|
+
...rest
|
|
70
|
+
});
|
|
71
|
+
}, "renderButton");
|
|
72
|
+
return /* @__PURE__ */React.createElement(Card, {
|
|
73
|
+
sx: {
|
|
74
|
+
display: "flex",
|
|
75
|
+
flexDirection: "row",
|
|
76
|
+
flexWrap: "nowrap",
|
|
77
|
+
alignItems: "center",
|
|
78
|
+
justifyContent: "space-between",
|
|
79
|
+
background: /* @__PURE__ */__name(t => {
|
|
80
|
+
const theme = t;
|
|
81
|
+
const bgStart = isAccent ? theme.colors?.action?.background?.accent?.default : theme.colors?.action?.background?.primary?.default;
|
|
82
|
+
const bgMiddle = isAccent ? theme.colors?.action?.background?.accent?.active : theme.colors?.action?.background?.secondary?.default;
|
|
83
|
+
if (isAccent) {
|
|
84
|
+
return `linear-gradient(270deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%),
|
|
85
|
+
linear-gradient(0deg, ${bgStart}, ${bgStart})`;
|
|
86
|
+
}
|
|
87
|
+
return `linear-gradient(270deg, ${bgStart}, ${bgMiddle}, ${bgStart})`;
|
|
88
|
+
}, "background"),
|
|
89
|
+
backgroundSize: isAccent ? "200% 100%, auto" : "400% 400%",
|
|
90
|
+
animation: `${gradientFlow} 6s ease infinite`,
|
|
91
|
+
width: "100%",
|
|
92
|
+
minHeight: "104px",
|
|
93
|
+
borderRadius: "xl",
|
|
94
|
+
boxShadow: "0 4px 20px rgba(0,0,0,0.1)",
|
|
95
|
+
py: "7",
|
|
96
|
+
px: "8",
|
|
97
|
+
gap: "5",
|
|
98
|
+
color: textColorToken,
|
|
99
|
+
overflow: "hidden",
|
|
100
|
+
borderWidth: "1px",
|
|
101
|
+
borderStyle: "solid",
|
|
102
|
+
borderColor: isAccent ? "transparent" : "display.border.muted.default"
|
|
103
|
+
},
|
|
104
|
+
"data-testid": "spotlight-card"
|
|
105
|
+
}, /* @__PURE__ */React.createElement(Flex, {
|
|
106
|
+
sx: {
|
|
107
|
+
alignItems: "center",
|
|
108
|
+
gap: "5",
|
|
109
|
+
flex: 1,
|
|
110
|
+
minWidth: 0
|
|
111
|
+
}
|
|
112
|
+
}, /* @__PURE__ */React.createElement(Box, {
|
|
113
|
+
sx: {
|
|
114
|
+
width: 64,
|
|
115
|
+
height: 64,
|
|
116
|
+
borderRadius: "2xl",
|
|
117
|
+
backgroundColor: iconBgToken,
|
|
118
|
+
display: "flex",
|
|
119
|
+
alignItems: "center",
|
|
120
|
+
justifyContent: "center",
|
|
121
|
+
flexShrink: 0,
|
|
122
|
+
color: iconColorToken
|
|
123
|
+
}
|
|
124
|
+
}, /* @__PURE__ */React.createElement(Icon, {
|
|
125
|
+
icon,
|
|
126
|
+
width: 32
|
|
127
|
+
})), /* @__PURE__ */React.createElement(Box, {
|
|
128
|
+
sx: {
|
|
129
|
+
minWidth: 0
|
|
130
|
+
}
|
|
131
|
+
}, /* @__PURE__ */React.createElement(Text, {
|
|
132
|
+
as: "div",
|
|
133
|
+
sx: {
|
|
134
|
+
fontFamily: "mono",
|
|
135
|
+
// Tamanho da fonte aumentado para dar mais presença ao OneClick
|
|
136
|
+
fontSize: "32px",
|
|
137
|
+
lineHeight: 1.1,
|
|
138
|
+
color: "inherit",
|
|
139
|
+
whiteSpace: "nowrap",
|
|
140
|
+
display: "flex",
|
|
141
|
+
alignItems: "center",
|
|
142
|
+
gap: "3"
|
|
143
|
+
}
|
|
144
|
+
}, title, badge && /* @__PURE__ */React.createElement(Box, {
|
|
145
|
+
as: "span",
|
|
146
|
+
sx: {
|
|
147
|
+
backgroundColor: badgeBgToken,
|
|
148
|
+
color: badgeTextToken,
|
|
149
|
+
fontFamily: "mono",
|
|
150
|
+
fontWeight: "bold",
|
|
151
|
+
fontSize: "11px",
|
|
152
|
+
lineHeight: 1,
|
|
153
|
+
paddingX: "6px",
|
|
154
|
+
paddingY: "3px",
|
|
155
|
+
borderRadius: "md",
|
|
156
|
+
textTransform: "uppercase",
|
|
157
|
+
letterSpacing: "0.05em",
|
|
158
|
+
display: "inline-flex",
|
|
159
|
+
alignItems: "center",
|
|
160
|
+
boxShadow: "0 2px 4px rgba(0,0,0,0.1)",
|
|
161
|
+
transform: "translateY(3px)"
|
|
162
|
+
}
|
|
163
|
+
}, badge)), /* @__PURE__ */React.createElement(Text, {
|
|
164
|
+
as: "div",
|
|
165
|
+
sx: {
|
|
166
|
+
fontFamily: "body",
|
|
167
|
+
fontWeight: 400,
|
|
168
|
+
fontSize: "16px",
|
|
169
|
+
color: "inherit",
|
|
170
|
+
opacity: 0.9,
|
|
171
|
+
mt: "1",
|
|
172
|
+
overflow: "hidden",
|
|
173
|
+
textOverflow: "ellipsis",
|
|
174
|
+
display: "-webkit-box",
|
|
175
|
+
WebkitLineClamp: 2,
|
|
176
|
+
WebkitBoxOrient: "vertical"
|
|
177
|
+
}
|
|
178
|
+
}, description))), hasButtons && /* @__PURE__ */React.createElement(Flex, {
|
|
179
|
+
sx: {
|
|
180
|
+
gap: "4",
|
|
181
|
+
alignItems: "center",
|
|
182
|
+
flexShrink: 0,
|
|
183
|
+
ml: "auto"
|
|
184
|
+
}
|
|
185
|
+
}, renderButton(firstButton, {
|
|
186
|
+
variant: btnPrimaryVariant,
|
|
187
|
+
textColor: btnPrimaryColorToken,
|
|
188
|
+
styles: {
|
|
189
|
+
":hover": {
|
|
190
|
+
transform: "translateY(-1px)"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}), renderButton(secondButton, {
|
|
194
|
+
variant: "secondary",
|
|
195
|
+
textColor: btnSecondaryColorToken,
|
|
196
|
+
styles: {
|
|
197
|
+
backgroundColor: "transparent",
|
|
198
|
+
borderWidth: "1px",
|
|
199
|
+
borderStyle: "solid",
|
|
200
|
+
borderColor: btnSecondaryBorderColorToken,
|
|
201
|
+
opacity: isAccent ? 0.6 : 1,
|
|
202
|
+
cursor: "pointer",
|
|
203
|
+
":hover": {
|
|
204
|
+
backgroundColor: "rgba(255,255,255,0.2)",
|
|
205
|
+
opacity: 1,
|
|
206
|
+
borderColor: btnSecondaryBorderColorToken
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
})));
|
|
210
|
+
}, "SpotlightCard");
|
|
211
|
+
SpotlightCard.displayName = "SpotlightCard";
|
|
212
|
+
export { SpotlightCard };
|
|
@@ -0,0 +1,63 @@
|
|
|
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/Table/Table.tsx
|
|
6
|
+
import { Box } from "@ttoss/ui";
|
|
7
|
+
import { createCell, createColumnHelper, flexRender, getCoreRowModel, useReactTable } from "@tanstack/react-table";
|
|
8
|
+
var Table = /* @__PURE__ */__name(props => {
|
|
9
|
+
return /* @__PURE__ */React.createElement(Box, {
|
|
10
|
+
as: "table",
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
}, "Table");
|
|
14
|
+
var TableHead = /* @__PURE__ */__name(props => {
|
|
15
|
+
return /* @__PURE__ */React.createElement(Box, {
|
|
16
|
+
as: "thead",
|
|
17
|
+
...props
|
|
18
|
+
});
|
|
19
|
+
}, "TableHead");
|
|
20
|
+
var TableBody = /* @__PURE__ */__name(props => {
|
|
21
|
+
return /* @__PURE__ */React.createElement(Box, {
|
|
22
|
+
as: "tbody",
|
|
23
|
+
...props
|
|
24
|
+
});
|
|
25
|
+
}, "TableBody");
|
|
26
|
+
var TableRow = /* @__PURE__ */__name(props => {
|
|
27
|
+
return /* @__PURE__ */React.createElement(Box, {
|
|
28
|
+
as: "tr",
|
|
29
|
+
...props
|
|
30
|
+
});
|
|
31
|
+
}, "TableRow");
|
|
32
|
+
var TableCell = /* @__PURE__ */__name(props => {
|
|
33
|
+
return /* @__PURE__ */React.createElement(Box, {
|
|
34
|
+
as: "td",
|
|
35
|
+
...props
|
|
36
|
+
});
|
|
37
|
+
}, "TableCell");
|
|
38
|
+
var TableHeader = /* @__PURE__ */__name(props => {
|
|
39
|
+
return /* @__PURE__ */React.createElement(Box, {
|
|
40
|
+
as: "th",
|
|
41
|
+
...props
|
|
42
|
+
});
|
|
43
|
+
}, "TableHeader");
|
|
44
|
+
var TableCaption = /* @__PURE__ */__name(props => {
|
|
45
|
+
return /* @__PURE__ */React.createElement(Box, {
|
|
46
|
+
as: "caption",
|
|
47
|
+
...props
|
|
48
|
+
});
|
|
49
|
+
}, "TableCaption");
|
|
50
|
+
var TableFooter = /* @__PURE__ */__name(props => {
|
|
51
|
+
return /* @__PURE__ */React.createElement(Box, {
|
|
52
|
+
as: "tfoot",
|
|
53
|
+
...props
|
|
54
|
+
});
|
|
55
|
+
}, "TableFooter");
|
|
56
|
+
Table.Head = TableHead;
|
|
57
|
+
Table.Body = TableBody;
|
|
58
|
+
Table.Row = TableRow;
|
|
59
|
+
Table.Cell = TableCell;
|
|
60
|
+
Table.Header = TableHeader;
|
|
61
|
+
Table.Caption = TableCaption;
|
|
62
|
+
Table.Footer = TableFooter;
|
|
63
|
+
export { Table, createCell, createColumnHelper, flexRender, getCoreRowModel, useReactTable };
|
|
@@ -0,0 +1,75 @@
|
|
|
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/Tabs/Tabs.tsx
|
|
6
|
+
import { Box } from "@ttoss/ui";
|
|
7
|
+
import { Tab, TabList, TabPanel, Tabs as ReactTabs } from "react-tabs";
|
|
8
|
+
var Tabs = /* @__PURE__ */__name(props => {
|
|
9
|
+
const {
|
|
10
|
+
sx: customSx,
|
|
11
|
+
...restProps
|
|
12
|
+
} = props;
|
|
13
|
+
return /* @__PURE__ */React.createElement(Box, {
|
|
14
|
+
sx: /* @__PURE__ */__name(({
|
|
15
|
+
colors
|
|
16
|
+
}) => {
|
|
17
|
+
const themeColors = colors;
|
|
18
|
+
return {
|
|
19
|
+
/**
|
|
20
|
+
* Tabs
|
|
21
|
+
*/
|
|
22
|
+
".react-tabs": {
|
|
23
|
+
WebkitTapHighlightColor: "transparent"
|
|
24
|
+
},
|
|
25
|
+
".react-tabs__tab-list": {
|
|
26
|
+
borderBottom: "md",
|
|
27
|
+
borderColor: themeColors?.input?.border?.muted?.default,
|
|
28
|
+
paddingLeft: 0
|
|
29
|
+
},
|
|
30
|
+
".react-tabs__tab--selected": {
|
|
31
|
+
backgroundColor: "transparent",
|
|
32
|
+
border: "none",
|
|
33
|
+
borderBottom: "lg",
|
|
34
|
+
borderColor: themeColors?.input?.border?.accent?.default
|
|
35
|
+
},
|
|
36
|
+
".react-tabs__tab": {
|
|
37
|
+
color: themeColors?.input?.text?.secondary?.default,
|
|
38
|
+
display: "inline-flex",
|
|
39
|
+
alignItems: "center",
|
|
40
|
+
gap: "2",
|
|
41
|
+
padding: "3",
|
|
42
|
+
cursor: "pointer",
|
|
43
|
+
position: "relative",
|
|
44
|
+
listStyle: "none"
|
|
45
|
+
},
|
|
46
|
+
".react-tabs__tab--disabled": {
|
|
47
|
+
cursor: "not-allowed",
|
|
48
|
+
color: themeColors?.input?.text?.muted?.default
|
|
49
|
+
},
|
|
50
|
+
".react-tabs__tab:focus": {
|
|
51
|
+
outline: "none"
|
|
52
|
+
},
|
|
53
|
+
".react-tabs__tab:focus:after": {
|
|
54
|
+
position: "absolute",
|
|
55
|
+
height: "min",
|
|
56
|
+
left: "-2",
|
|
57
|
+
right: "-2",
|
|
58
|
+
bottom: "-3"
|
|
59
|
+
},
|
|
60
|
+
".react-tabs__tab-panel": {
|
|
61
|
+
display: "none"
|
|
62
|
+
},
|
|
63
|
+
".react-tabs__tab-panel--selected": {
|
|
64
|
+
display: "block"
|
|
65
|
+
},
|
|
66
|
+
...customSx
|
|
67
|
+
};
|
|
68
|
+
}, "sx"),
|
|
69
|
+
...restProps
|
|
70
|
+
}, /* @__PURE__ */React.createElement(ReactTabs, restProps, props.children));
|
|
71
|
+
}, "Tabs");
|
|
72
|
+
Tabs.TabList = TabList;
|
|
73
|
+
Tabs.Tab = Tab;
|
|
74
|
+
Tabs.TabPanel = TabPanel;
|
|
75
|
+
export { Tabs };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
import { __name } from "../chunk-V4MHYKRI.js";
|
|
3
|
+
|
|
4
|
+
// src/components/Toast/Toast.tsx
|
|
5
|
+
import { css as createClassName } from "@emotion/css";
|
|
6
|
+
import { css as transformStyleObject } from "@theme-ui/css";
|
|
7
|
+
import { Box, useTheme } from "@ttoss/ui";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { toast as toastReactToastify, ToastContainer as ReactToastifyToastContainer } from "react-toastify";
|
|
10
|
+
var ToastContainer = /* @__PURE__ */__name(props => {
|
|
11
|
+
const {
|
|
12
|
+
theme
|
|
13
|
+
} = useTheme();
|
|
14
|
+
const className = React.useMemo(() => {
|
|
15
|
+
const styles = transformStyleObject({
|
|
16
|
+
".Toastify__toast-container": {}
|
|
17
|
+
})(theme);
|
|
18
|
+
return createClassName(styles);
|
|
19
|
+
}, [theme]);
|
|
20
|
+
return /* @__PURE__ */React.createElement(Box, {
|
|
21
|
+
className,
|
|
22
|
+
sx: /* @__PURE__ */__name(({
|
|
23
|
+
colors,
|
|
24
|
+
fonts
|
|
25
|
+
}) => {
|
|
26
|
+
const themeColors = colors;
|
|
27
|
+
return {
|
|
28
|
+
"--toastify-font-family": fonts?.body,
|
|
29
|
+
"--toastify-color-light": themeColors?.feedback?.background?.primary?.default
|
|
30
|
+
};
|
|
31
|
+
}, "sx")
|
|
32
|
+
}, /* @__PURE__ */React.createElement(ReactToastifyToastContainer, {
|
|
33
|
+
className,
|
|
34
|
+
...props
|
|
35
|
+
}));
|
|
36
|
+
}, "ToastContainer");
|
|
37
|
+
var toast = toastReactToastify;
|
|
38
|
+
export { ToastContainer, toast };
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
import { Icon } from "./chunk-WT55GXBD.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 };
|