@ttoss/components 2.4.0 → 2.4.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.
@@ -0,0 +1,156 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ import { Icon } from "./chunk-AZTAV4VC.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 };
@@ -0,0 +1,7 @@
1
+ /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ var __defProp = Object.defineProperty;
3
+ var __name = (target, value) => __defProp(target, "name", {
4
+ value,
5
+ configurable: true
6
+ });
7
+ export { __name };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/components",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "description": "React components for ttoss ecosystem.",
5
5
  "license": "MIT",
6
6
  "author": "ttoss",
@@ -101,9 +101,9 @@
101
101
  },
102
102
  "peerDependencies": {
103
103
  "react": ">=16.8.0",
104
- "@ttoss/react-hooks": "^2.1.2",
104
+ "@ttoss/react-i18n": "^2.0.16",
105
105
  "@ttoss/ui": "^5.10.0",
106
- "@ttoss/react-i18n": "^2.0.14"
106
+ "@ttoss/react-hooks": "^2.1.2"
107
107
  },
108
108
  "devDependencies": {
109
109
  "@types/jest": "^30.0.0",
@@ -113,11 +113,12 @@
113
113
  "tsup": "^8.5.0",
114
114
  "tsx": "^4.19.2",
115
115
  "@ttoss/config": "^1.35.6",
116
+ "@ttoss/i18n-cli": "^0.7.32",
116
117
  "@ttoss/react-hooks": "^2.1.2",
117
118
  "@ttoss/react-icons": "^0.4.15",
119
+ "@ttoss/react-i18n": "^2.0.16",
118
120
  "@ttoss/test-utils": "^2.1.26",
119
- "@ttoss/ui": "^5.10.0",
120
- "@ttoss/react-i18n": "^2.0.14"
121
+ "@ttoss/ui": "^5.10.0"
121
122
  },
122
123
  "keywords": [
123
124
  "React",
@@ -132,6 +133,7 @@
132
133
  "build": "tsup",
133
134
  "postbuild": "pnpm run update-package-json-exports",
134
135
  "dev": "pnpm -r --filter=@docs/storybook run dev",
136
+ "i18n": "ttoss-i18n",
135
137
  "test": "jest --projects tests/unit",
136
138
  "update-package-json-exports": "tsx scripts/updatePackageJsonExports.ts"
137
139
  }
@@ -1,170 +0,0 @@
1
- /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- import { Icon } from "./chunk-JOSQSCZQ.js";
3
-
4
- // src/components/NotificationCard/NotificationCard.tsx
5
- import { Box, Card, CloseButton, Link, Tag, Text } from "@ttoss/ui";
6
- import { jsx, jsxs } from "react/jsx-runtime";
7
- var NotificationCard = props => {
8
- const sxMap = {
9
- success: {
10
- card: {
11
- backgroundColor: "feedback.background.positive.default",
12
- borderColor: "feedback.border.positive.default"
13
- }
14
- },
15
- error: {
16
- card: {
17
- backgroundColor: "feedback.background.negative.default",
18
- borderColor: "feedback.border.negative.default"
19
- }
20
- },
21
- warning: {
22
- card: {
23
- backgroundColor: "feedback.background.caution.default",
24
- borderColor: "feedback.border.caution.default"
25
- }
26
- },
27
- info: {
28
- card: {
29
- backgroundColor: "feedback.background.primary.default",
30
- borderColor: "feedback.border.primary.default"
31
- }
32
- },
33
- neutral: {
34
- card: {
35
- backgroundColor: "feedback.background.primary.default",
36
- borderColor: "feedback.border.primary.default"
37
- }
38
- }
39
- };
40
- const icon = {
41
- success: "success-circle",
42
- error: "error",
43
- warning: "warning-alt",
44
- info: "info",
45
- neutral: "info"
46
- };
47
- const hasCaption = Boolean(props.caption);
48
- const hasActions = Boolean(props.actions && props.actions.length > 0);
49
- const hasTitle = Boolean(props.title);
50
- const shouldCenterVerticallyWithoutTitle = !hasCaption && !hasActions && !hasTitle;
51
- const shouldCenterVerticallyWithTitle = !hasCaption && !hasActions && hasTitle;
52
- const shouldAddMinHeight = !hasCaption && !hasActions;
53
- return /* @__PURE__ */jsxs(Card, {
54
- sx: {
55
- ...sxMap[props.type].card,
56
- width: "full"
57
- },
58
- children: [props.title && /* @__PURE__ */jsxs(Card.Title, {
59
- sx: {
60
- display: "flex",
61
- justifyContent: "space-between",
62
- alignItems: "center",
63
- fontSize: ["md", "xl"],
64
- paddingY: ["1", "2", "4"],
65
- paddingX: ["2", "4", "8"]
66
- },
67
- children: [/* @__PURE__ */jsxs(Text, {
68
- sx: {
69
- display: "inline-flex",
70
- alignItems: "flex-start",
71
- gap: "2",
72
- flexDirection: "row",
73
- flexWrap: "wrap"
74
- },
75
- children: [/* @__PURE__ */jsxs(Box, {
76
- sx: {
77
- display: "flex",
78
- alignItems: "center",
79
- gap: "2"
80
- },
81
- children: [/* @__PURE__ */jsx(Icon, {
82
- icon: icon[props.type]
83
- }), props.title]
84
- }), props.tags && (Array.isArray(props.tags) ? props.tags.length > 0 : true) && (Array.isArray(props.tags) ? props.tags.map((tag, index) => {
85
- return /* @__PURE__ */jsx(Tag, {
86
- children: tag
87
- }, index);
88
- }) : /* @__PURE__ */jsx(Tag, {
89
- children: props.tags
90
- }))]
91
- }), props.onClose && /* @__PURE__ */jsx(Box, {
92
- sx: {
93
- marginLeft: "auto"
94
- },
95
- children: /* @__PURE__ */jsx(CloseButton, {
96
- onClick: props.onClose
97
- })
98
- })]
99
- }), /* @__PURE__ */jsxs(Card.Body, {
100
- sx: {
101
- ...sxMap[props.type].card,
102
- display: "flex",
103
- flexDirection: "column",
104
- gap: "2",
105
- paddingY: ["1", "2", "4"],
106
- paddingX: ["2", "4", "8"]
107
- },
108
- children: [/* @__PURE__ */jsx(Box, {
109
- sx: {
110
- display: "flex",
111
- justifyContent: "space-between",
112
- minHeight: shouldAddMinHeight ? "40px" : "auto",
113
- alignItems: shouldCenterVerticallyWithoutTitle ? "center" : shouldCenterVerticallyWithTitle ? "center" : "flex-start",
114
- width: "100%",
115
- gap: "4"
116
- },
117
- children: /* @__PURE__ */jsx(Box, {
118
- sx: {
119
- flex: 1
120
- },
121
- children: /* @__PURE__ */jsx(Text, {
122
- sx: {
123
- fontSize: ["sm", "md"]
124
- },
125
- children: props.message
126
- })
127
- })
128
- }), props.actions && props.actions.length > 0 && /* @__PURE__ */jsx(Box, {
129
- sx: {
130
- display: "flex",
131
- flexDirection: "column",
132
- gap: 2,
133
- mt: 2
134
- },
135
- children: props.actions.map((action, index) => {
136
- return action.action === "open_url" ? /* @__PURE__ */jsx(Link, {
137
- href: action.url,
138
- target: "_blank",
139
- rel: "noopener noreferrer",
140
- sx: {
141
- color: "action.text.accent.default",
142
- cursor: "pointer"
143
- },
144
- children: action.label || "Acessar"
145
- }, index) : null;
146
- })
147
- }), props.caption && /* @__PURE__ */jsx(Box, {
148
- sx: {
149
- whiteSpace: "nowrap",
150
- mt: 6
151
- },
152
- children: /* @__PURE__ */jsx(Text, {
153
- sx: {
154
- fontSize: "xs",
155
- color: "text.secondary"
156
- },
157
- children: props.caption
158
- })
159
- }), !props.title && props.onClose && /* @__PURE__ */jsx(Box, {
160
- sx: {
161
- alignSelf: "flex-end"
162
- },
163
- children: /* @__PURE__ */jsx(CloseButton, {
164
- onClick: props.onClose
165
- })
166
- })]
167
- })]
168
- });
169
- };
170
- export { NotificationCard };