@ttoss/components 2.0.24 → 2.1.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.
@@ -0,0 +1,11 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ type NotificationType = 'success' | 'error' | 'warning' | 'info';
4
+ declare const NotificationCard: (props: {
5
+ type: NotificationType;
6
+ title?: string;
7
+ message: string;
8
+ onClose?: () => void;
9
+ }) => react_jsx_runtime.JSX.Element;
10
+
11
+ export { NotificationCard };
@@ -1,7 +1,8 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ToastContainerProps } from 'react-toastify';
3
- export { ToastContainerProps, toast } from 'react-toastify';
2
+ import { ToastContainerProps, toast as toast$1 } from 'react-toastify';
3
+ export { ToastContainerProps, ToastOptions } from 'react-toastify';
4
4
 
5
5
  declare const ToastContainer: (props: ToastContainerProps) => react_jsx_runtime.JSX.Element;
6
+ declare const toast: typeof toast$1;
6
7
 
7
- export { ToastContainer };
8
+ export { ToastContainer, toast };
@@ -1,5 +1,4 @@
1
1
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- import "../chunk-ESDEGKXL.js";
3
2
 
4
3
  // src/components/Markdown/Markdown.tsx
5
4
  import { BaseStyles } from "@ttoss/ui";
@@ -1,5 +1,4 @@
1
1
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- import "../chunk-ESDEGKXL.js";
3
2
 
4
3
  // ../react-icons/src/Icon.tsx
5
4
  import * as React2 from "react";
@@ -1,5 +1,4 @@
1
1
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- import "../chunk-ESDEGKXL.js";
3
2
 
4
3
  // src/components/Modal/Modal.tsx
5
4
  import { css as transformStyleObject } from "@theme-ui/css";
@@ -0,0 +1,57 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+
3
+ // src/components/NotificationCard/NotificationCard.tsx
4
+ import { Box, Card, CloseButton } from "@ttoss/ui";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ var NotificationCard = props => {
7
+ const sxMap = {
8
+ success: {
9
+ card: {
10
+ borderColor: "feedback.border.positive.default"
11
+ }
12
+ },
13
+ error: {
14
+ card: {
15
+ borderColor: "feedback.border.negative.default"
16
+ }
17
+ },
18
+ warning: {
19
+ card: {
20
+ borderColor: "feedback.border.caution.default"
21
+ }
22
+ },
23
+ info: {
24
+ card: {
25
+ borderColor: "feedback.border.primary.default"
26
+ }
27
+ }
28
+ };
29
+ return /* @__PURE__ */jsxs(Card, {
30
+ sx: {
31
+ ...sxMap[props.type].card,
32
+ width: "full"
33
+ },
34
+ children: [props.title && /* @__PURE__ */jsxs(Card.Title, {
35
+ sx: {
36
+ display: "flex",
37
+ justifyContent: "space-between",
38
+ alignItems: "center",
39
+ fontSize: "xl"
40
+ },
41
+ children: [props.title, props.onClose && /* @__PURE__ */jsx(CloseButton, {
42
+ onClick: props.onClose
43
+ })]
44
+ }), /* @__PURE__ */jsxs(Card.Body, {
45
+ sx: {
46
+ display: "flex",
47
+ gap: "4"
48
+ },
49
+ children: [props.message, !props.title && props.onClose && /* @__PURE__ */jsx(Box, {
50
+ children: /* @__PURE__ */jsx(CloseButton, {
51
+ onClick: props.onClose
52
+ })
53
+ })]
54
+ })]
55
+ });
56
+ };
57
+ export { NotificationCard };
@@ -2,29 +2,39 @@
2
2
  import "../chunk-ESDEGKXL.js";
3
3
 
4
4
  // src/components/Toast/Toast.tsx
5
- import { Box } from "@ttoss/ui";
6
- import { toast, ToastContainer as ReactToastifyToastContainer } from "react-toastify";
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";
7
10
  import { jsx } from "react/jsx-runtime";
8
11
  var ToastContainer = props => {
12
+ const {
13
+ theme
14
+ } = useTheme();
15
+ const className = React.useMemo(() => {
16
+ const styles = transformStyleObject({
17
+ ".Toastify__toast-container": {}
18
+ })(theme);
19
+ return createClassName(styles);
20
+ }, [theme]);
9
21
  return /* @__PURE__ */jsx(Box, {
22
+ className,
10
23
  sx: ({
11
24
  colors,
12
25
  fonts
13
26
  }) => {
27
+ const themeColors = colors;
14
28
  return {
15
- "--toastify-color-light": "#fff",
16
- "--toastify-color-dark": "#121212",
17
- "--toastify-color-info": colors?.info || "#3498db",
18
- "--toastify-color-success": colors?.success || "#07bc0c",
19
- "--toastify-color-warning": "#f1c40f",
20
- "--toastify-color-error": "#e74c3c",
21
- "--toastify-color-progress-light": `linear-gradient(to right, ${colors?.primary}, ${colors?.secondary})`,
22
- "--toastify-font-family": fonts.body
29
+ "--toastify-font-family": fonts?.body,
30
+ "--toastify-color-light": themeColors?.feedback?.background?.primary?.default
23
31
  };
24
32
  },
25
33
  children: /* @__PURE__ */jsx(ReactToastifyToastContainer, {
34
+ className,
26
35
  ...props
27
36
  })
28
37
  });
29
38
  };
39
+ var toast = toastReactToastify;
30
40
  export { ToastContainer, toast };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/components",
3
- "version": "2.0.24",
3
+ "version": "2.1.0",
4
4
  "description": "React components for ttoss ecosystem.",
5
5
  "license": "MIT",
6
6
  "author": "ttoss",
@@ -50,6 +50,10 @@
50
50
  "types": "./dist/Modal/index.d.ts",
51
51
  "import": "./dist/esm/Modal/index.js"
52
52
  },
53
+ "./NotificationCard": {
54
+ "types": "./dist/NotificationCard/index.d.ts",
55
+ "import": "./dist/esm/NotificationCard/index.js"
56
+ },
53
57
  "./Search": {
54
58
  "types": "./dist/Search/index.d.ts",
55
59
  "import": "./dist/esm/Search/index.js"
@@ -85,7 +89,7 @@
85
89
  "peerDependencies": {
86
90
  "react": ">=16.8.0",
87
91
  "@ttoss/react-hooks": "^2.0.10",
88
- "@ttoss/ui": "^5.1.6"
92
+ "@ttoss/ui": "^5.2.0"
89
93
  },
90
94
  "devDependencies": {
91
95
  "@types/jest": "^29.5.14",
@@ -96,9 +100,9 @@
96
100
  "tsx": "^4.19.2",
97
101
  "@ttoss/config": "^1.35.2",
98
102
  "@ttoss/react-icons": "^0.4.9",
99
- "@ttoss/react-hooks": "^2.0.10",
100
103
  "@ttoss/test-utils": "^2.1.22",
101
- "@ttoss/ui": "^5.1.6"
104
+ "@ttoss/react-hooks": "^2.0.10",
105
+ "@ttoss/ui": "^5.2.0"
102
106
  },
103
107
  "keywords": [
104
108
  "React",