@ttoss/components 2.14.20 → 2.14.21

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 (74) hide show
  1. package/dist/Accordion/index.d.mts +157 -0
  2. package/dist/Accordion/index.mjs +175 -0
  3. package/dist/DatePicker/index.d.mts +26 -0
  4. package/dist/DatePicker/index.mjs +339 -0
  5. package/dist/Drawer/index.d.mts +17 -0
  6. package/dist/{esm/Drawer/index.js → Drawer/index.mjs} +21 -14
  7. package/dist/EnhancedTitle/{index.d.ts → index.d.mts} +57 -47
  8. package/dist/EnhancedTitle/index.mjs +234 -0
  9. package/dist/FileUploader/index.d.mts +77 -0
  10. package/dist/FileUploader/index.mjs +386 -0
  11. package/dist/InstallPwa/index.d.mts +13 -0
  12. package/dist/InstallPwa/index.mjs +64 -0
  13. package/dist/JsonEditor/index.d.mts +3 -0
  14. package/dist/{esm/JsonEditor/index.js → JsonEditor/index.mjs} +0 -3
  15. package/dist/JsonView/index.d.mts +3 -0
  16. package/dist/{esm/JsonView/index.js → JsonView/index.mjs} +0 -3
  17. package/dist/List/{index.d.ts → index.d.mts} +9 -6
  18. package/dist/List/index.mjs +34 -0
  19. package/dist/LockedOverlay/index.d.mts +162 -0
  20. package/dist/LockedOverlay/index.mjs +386 -0
  21. package/dist/Markdown/index.d.mts +16 -0
  22. package/dist/Markdown/index.mjs +26 -0
  23. package/dist/Menu/index.d.mts +16 -0
  24. package/dist/{esm/Menu/index.js → Menu/index.mjs} +56 -51
  25. package/dist/MetricCard/index.d.mts +153 -0
  26. package/dist/MetricCard/index.mjs +408 -0
  27. package/dist/Modal/index.d.mts +11 -0
  28. package/dist/{esm/Modal/index.js → Modal/index.mjs} +11 -12
  29. package/dist/NavList/index.d.mts +64 -0
  30. package/dist/{esm/NavList/index.js → NavList/index.mjs} +79 -73
  31. package/dist/NotificationCard/index.d.mts +22 -0
  32. package/dist/NotificationCard/index.mjs +173 -0
  33. package/dist/NotificationsMenu/index.d.mts +47 -0
  34. package/dist/NotificationsMenu/index.mjs +380 -0
  35. package/dist/Search/index.d.mts +18 -0
  36. package/dist/{esm/Search/index.js → Search/index.mjs} +11 -9
  37. package/dist/SpotlightCard/index.d.mts +36 -0
  38. package/dist/SpotlightCard/index.mjs +219 -0
  39. package/dist/Table/index.d.mts +17 -0
  40. package/dist/Table/index.mjs +64 -0
  41. package/dist/Tabs/index.d.mts +17 -0
  42. package/dist/{esm/Tabs/index.js → Tabs/index.mjs} +24 -12
  43. package/dist/Toast/index.d.mts +8 -0
  44. package/dist/Toast/index.mjs +43 -0
  45. package/package.json +15 -15
  46. package/dist/Accordion/index.d.ts +0 -148
  47. package/dist/DatePicker/index.d.ts +0 -20
  48. package/dist/Drawer/index.d.ts +0 -12
  49. package/dist/LockedOverlay/index.d.ts +0 -151
  50. package/dist/Markdown/index.d.ts +0 -11
  51. package/dist/Menu/index.d.ts +0 -11
  52. package/dist/MetricCard/index.d.ts +0 -148
  53. package/dist/Modal/index.d.ts +0 -10
  54. package/dist/NavList/index.d.ts +0 -55
  55. package/dist/NotificationCard/index.d.ts +0 -21
  56. package/dist/NotificationsMenu/index.d.ts +0 -36
  57. package/dist/Search/index.d.ts +0 -11
  58. package/dist/SpotlightCard/index.d.ts +0 -27
  59. package/dist/Table/index.d.ts +0 -16
  60. package/dist/esm/Accordion/index.js +0 -119
  61. package/dist/esm/DatePicker/index.js +0 -331
  62. package/dist/esm/EnhancedTitle/index.js +0 -190
  63. package/dist/esm/FileUploader/index.js +0 -401
  64. package/dist/esm/InstallPwa/index.js +0 -61
  65. package/dist/esm/List/index.js +0 -30
  66. package/dist/esm/LockedOverlay/index.js +0 -316
  67. package/dist/esm/Markdown/index.js +0 -23
  68. package/dist/esm/MetricCard/index.js +0 -327
  69. package/dist/esm/NotificationCard/index.js +0 -156
  70. package/dist/esm/NotificationsMenu/index.js +0 -359
  71. package/dist/esm/SpotlightCard/index.js +0 -212
  72. package/dist/esm/Table/index.js +0 -63
  73. package/dist/esm/Toast/index.js +0 -38
  74. package/dist/esm/chunk-V4MHYKRI.js +0 -7
@@ -1,316 +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/LockedOverlay/LockedOverlay.tsx
6
- import { Icon as Icon2 } from "@ttoss/react-icons";
7
- import { Button as Button2, Card as Card2, Flex as Flex2 } from "@ttoss/ui";
8
-
9
- // src/components/SpotlightCard/SpotlightCard.tsx
10
- import { Icon } from "@ttoss/react-icons";
11
- import { Box, Button, Card, Flex, keyframes, Text } from "@ttoss/ui";
12
- import * as React2 from "react";
13
- var SpotlightCard = /* @__PURE__ */__name(({
14
- icon,
15
- title,
16
- badge,
17
- description,
18
- firstButton,
19
- secondButton,
20
- variant = "accent"
21
- }) => {
22
- const gradientFlow = keyframes({
23
- "0%": {
24
- backgroundPosition: "0% 50%"
25
- },
26
- "50%": {
27
- backgroundPosition: "100% 50%"
28
- },
29
- "100%": {
30
- backgroundPosition: "0% 50%"
31
- }
32
- });
33
- const hasButtons = !!firstButton || !!secondButton;
34
- const isAccent = variant === "accent";
35
- const textColorToken = isAccent ? "action.text.accent.default" : "action.text.primary.default";
36
- const iconColorToken = isAccent ? "action.text.accent.default" : "display.text.accent.default";
37
- const iconBgToken = isAccent ? "rgba(255,255,255,0.3)" : "action.background.secondary.default";
38
- const badgeBgToken = isAccent ? "action.background.primary.default" : "action.background.accent.default";
39
- const badgeTextToken = isAccent ? "action.text.primary.default" : "action.text.accent.default";
40
- const btnPrimaryVariant = isAccent ? "primary" : "accent";
41
- const btnPrimaryColorToken = isAccent ? "action.text.primary.default" : "action.text.accent.default";
42
- const btnSecondaryColorToken = textColorToken;
43
- const btnSecondaryBorderColorToken = isAccent ? "currentColor" : "display.border.muted.default";
44
- const renderButton = /* @__PURE__ */__name((prop, config) => {
45
- if (!prop) return null;
46
- if (/* @__PURE__ */React2.isValidElement(prop)) return prop;
47
- if (typeof prop !== "object") return prop;
48
- const {
49
- sx,
50
- ...rest
51
- } = prop;
52
- const {
53
- variant: defaultVariant,
54
- textColor,
55
- styles = {}
56
- } = config;
57
- return /* @__PURE__ */React2.createElement(Button, {
58
- variant: defaultVariant,
59
- sx: {
60
- display: "flex",
61
- alignItems: "center",
62
- justifyContent: "center",
63
- gap: "2",
64
- px: "6",
65
- py: "3",
66
- fontSize: "15px",
67
- fontWeight: "bold",
68
- whiteSpace: "nowrap",
69
- transition: "all 0.2s",
70
- color: textColor,
71
- ...styles,
72
- ...sx
73
- },
74
- ...rest
75
- });
76
- }, "renderButton");
77
- return /* @__PURE__ */React2.createElement(Card, {
78
- sx: {
79
- display: "flex",
80
- flexDirection: ["row"],
81
- flexWrap: "nowrap",
82
- alignItems: "center",
83
- justifyContent: "space-between",
84
- background: /* @__PURE__ */__name(t => {
85
- const theme = t;
86
- const bgStart = isAccent ? theme.colors?.action?.background?.accent?.default : theme.colors?.action?.background?.primary?.default;
87
- const bgMiddle = isAccent ? theme.colors?.action?.background?.accent?.active : theme.colors?.action?.background?.secondary?.default;
88
- if (isAccent) {
89
- return `linear-gradient(270deg, transparent 0%, rgba(255,255,255,0.4) 50%, transparent 100%),
90
- linear-gradient(0deg, ${bgStart}, ${bgStart})`;
91
- }
92
- return `linear-gradient(270deg, ${bgStart}, ${bgMiddle}, ${bgStart})`;
93
- }, "background"),
94
- backgroundSize: isAccent ? "200% 100%, auto" : "400% 400%",
95
- animation: `${gradientFlow} 6s ease infinite`,
96
- width: "100%",
97
- minHeight: "104px",
98
- borderRadius: "xl",
99
- boxShadow: "0 4px 20px rgba(0,0,0,0.1)",
100
- py: "7",
101
- px: "8",
102
- gap: "5",
103
- color: textColorToken,
104
- overflow: "hidden",
105
- borderWidth: "1px",
106
- borderStyle: "solid",
107
- borderColor: isAccent ? "transparent" : "display.border.muted.default"
108
- },
109
- "data-testid": "spotlight-card"
110
- }, /* @__PURE__ */React2.createElement(Flex, {
111
- sx: {
112
- alignItems: "center",
113
- gap: "5",
114
- flex: 1,
115
- minWidth: 0
116
- }
117
- }, /* @__PURE__ */React2.createElement(Box, {
118
- sx: {
119
- width: 64,
120
- height: 64,
121
- borderRadius: "2xl",
122
- backgroundColor: iconBgToken,
123
- display: "flex",
124
- alignItems: "center",
125
- justifyContent: "center",
126
- flexShrink: 0,
127
- color: iconColorToken
128
- }
129
- }, /* @__PURE__ */React2.createElement(Icon, {
130
- icon,
131
- width: 32
132
- })), /* @__PURE__ */React2.createElement(Box, {
133
- sx: {
134
- minWidth: 0
135
- }
136
- }, /* @__PURE__ */React2.createElement(Text, {
137
- as: "div",
138
- sx: {
139
- fontFamily: "mono",
140
- // Tamanho da fonte aumentado para dar mais presença ao OneClick
141
- fontSize: "32px",
142
- lineHeight: 1.1,
143
- color: "inherit",
144
- whiteSpace: "nowrap",
145
- display: "flex",
146
- alignItems: "center",
147
- gap: "3"
148
- }
149
- }, title, badge && /* @__PURE__ */React2.createElement(Box, {
150
- as: "span",
151
- sx: {
152
- backgroundColor: badgeBgToken,
153
- color: badgeTextToken,
154
- fontFamily: "mono",
155
- fontWeight: "bold",
156
- fontSize: "11px",
157
- lineHeight: 1,
158
- paddingX: "6px",
159
- paddingY: "3px",
160
- borderRadius: "md",
161
- textTransform: "uppercase",
162
- letterSpacing: "0.05em",
163
- display: "inline-flex",
164
- alignItems: "center",
165
- boxShadow: "0 2px 4px rgba(0,0,0,0.1)",
166
- transform: "translateY(3px)"
167
- }
168
- }, badge)), /* @__PURE__ */React2.createElement(Text, {
169
- as: "div",
170
- sx: {
171
- fontFamily: "body",
172
- fontWeight: 400,
173
- fontSize: "16px",
174
- color: "inherit",
175
- opacity: 0.9,
176
- mt: "1",
177
- overflow: "hidden",
178
- textOverflow: "ellipsis",
179
- display: "-webkit-box",
180
- WebkitLineClamp: 2,
181
- WebkitBoxOrient: "vertical"
182
- }
183
- }, description))), hasButtons && /* @__PURE__ */React2.createElement(Flex, {
184
- sx: {
185
- gap: "4",
186
- alignItems: "center",
187
- flexShrink: 0,
188
- ml: "auto"
189
- }
190
- }, renderButton(firstButton, {
191
- variant: btnPrimaryVariant,
192
- textColor: btnPrimaryColorToken,
193
- styles: {
194
- ":hover": {
195
- transform: "translateY(-1px)"
196
- }
197
- }
198
- }), renderButton(secondButton, {
199
- variant: "secondary",
200
- textColor: btnSecondaryColorToken,
201
- styles: {
202
- backgroundColor: "transparent",
203
- borderWidth: "1px",
204
- borderStyle: "solid",
205
- borderColor: btnSecondaryBorderColorToken,
206
- opacity: isAccent ? 0.6 : 1,
207
- cursor: "pointer",
208
- ":hover": {
209
- backgroundColor: "rgba(255,255,255,0.2)",
210
- opacity: 1,
211
- borderColor: btnSecondaryBorderColorToken
212
- }
213
- }
214
- })));
215
- }, "SpotlightCard");
216
- SpotlightCard.displayName = "SpotlightCard";
217
-
218
- // src/components/LockedOverlay/LockedOverlay.tsx
219
- var LockedOverlay = /* @__PURE__ */__name(({
220
- isOpen,
221
- onRequestClose,
222
- header,
223
- firstButton,
224
- secondButton,
225
- children,
226
- actions,
227
- sx,
228
- zIndex = 1
229
- }) => {
230
- const content = /* @__PURE__ */React.createElement(Card2, {
231
- className: "lockedoverlay-card",
232
- role: "dialog",
233
- "aria-modal": true,
234
- sx: {
235
- width: "full",
236
- maxWidth: "620px",
237
- borderRadius: "lg",
238
- overflow: "auto",
239
- border: "none",
240
- boxShadow: "none"
241
- }
242
- }, /* @__PURE__ */React.createElement(Flex2, {
243
- sx: {
244
- width: "full",
245
- paddingX: "6",
246
- paddingY: "4"
247
- }
248
- }, /* @__PURE__ */React.createElement(SpotlightCard, {
249
- icon: header.icon,
250
- title: header.title,
251
- description: header.description,
252
- variant: header.variant || "primary",
253
- firstButton,
254
- secondButton
255
- })), /* @__PURE__ */React.createElement(Card2.Body, {
256
- sx: {
257
- px: ["5", "7"],
258
- py: ["6", "7"],
259
- gap: "6",
260
- width: "full"
261
- }
262
- }, children, actions && actions.length > 0 && /* @__PURE__ */React.createElement(Card2.Footer, null, /* @__PURE__ */React.createElement(Flex2, {
263
- className: "lockedoverlay-footer",
264
- sx: {
265
- flexDirection: "column",
266
- gap: "4",
267
- alignItems: "center",
268
- width: "full",
269
- paddingX: "6",
270
- marginTop: "8"
271
- }
272
- }, actions.map((action, index) => {
273
- return /* @__PURE__ */React.createElement(Button2, {
274
- key: index,
275
- variant: action.variant,
276
- onClick: action.onClick,
277
- sx: {
278
- width: "full",
279
- justifyContent: "center"
280
- }
281
- }, action.icon && /* @__PURE__ */React.createElement(Icon2, {
282
- icon: action.icon
283
- }), action.label);
284
- })))));
285
- if (!isOpen) {
286
- return null;
287
- }
288
- return /* @__PURE__ */React.createElement(Flex2, {
289
- "data-testid": "lockedoverlay-overlay",
290
- onClick: /* @__PURE__ */__name(() => {
291
- return onRequestClose?.();
292
- }, "onClick"),
293
- sx: {
294
- position: "absolute",
295
- inset: 0,
296
- backgroundColor: "rgba(0, 0, 0, 0.5)",
297
- display: "flex",
298
- justifyContent: "center",
299
- alignItems: "center",
300
- zIndex,
301
- ...sx
302
- }
303
- }, /* @__PURE__ */React.createElement(Flex2, {
304
- onClick: /* @__PURE__ */__name(event => {
305
- event.stopPropagation();
306
- }, "onClick"),
307
- sx: {
308
- width: "full",
309
- maxWidth: ["95%", "90%", "620px"],
310
- maxHeight: "90%",
311
- justifyContent: "center",
312
- overflow: "auto"
313
- }
314
- }, content));
315
- }, "LockedOverlay");
316
- export { LockedOverlay };
@@ -1,23 +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/Markdown/Markdown.tsx
6
- import { BaseStyles } from "@ttoss/ui";
7
- import ReactMarkdown from "react-markdown";
8
- import rehypeRaw from "rehype-raw";
9
- import remarkGfm from "remark-gfm";
10
- var Markdown = /* @__PURE__ */__name(({
11
- children,
12
- sx,
13
- ...props
14
- }) => {
15
- return /* @__PURE__ */React.createElement(BaseStyles, {
16
- sx
17
- }, /* @__PURE__ */React.createElement(ReactMarkdown, {
18
- rehypePlugins: [rehypeRaw],
19
- remarkPlugins: [remarkGfm],
20
- ...props
21
- }, children));
22
- }, "Markdown");
23
- export { Markdown };
@@ -1,327 +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/MetricCard/MetricCard.tsx
6
- import { defineMessages, useI18n } from "@ttoss/react-i18n";
7
- import { Icon } from "@ttoss/react-icons";
8
- import { Box, Card, Flex, Text, TooltipIcon } from "@ttoss/ui";
9
- var messages = defineMessages({
10
- ofMax: {
11
- id: "oYpm71",
12
- defaultMessage: [{
13
- "type": 0,
14
- "value": "of "
15
- }, {
16
- "type": 1,
17
- "value": "max"
18
- }]
19
- },
20
- percentageUsed: {
21
- id: "zr0OS6",
22
- defaultMessage: [{
23
- "type": 1,
24
- "value": "percentage"
25
- }, {
26
- "type": 0,
27
- "value": "% used"
28
- }]
29
- },
30
- unlimited: {
31
- id: "rskBv4",
32
- defaultMessage: [{
33
- "type": 0,
34
- "value": "Unlimited"
35
- }]
36
- },
37
- infinity: {
38
- id: "0EjvY6",
39
- defaultMessage: [{
40
- "type": 0,
41
- "value": "∞"
42
- }]
43
- },
44
- nearLimit: {
45
- id: "1DbX9V",
46
- defaultMessage: [{
47
- "type": 0,
48
- "value": "Near limit"
49
- }]
50
- },
51
- reachedLimit: {
52
- id: "4NwCn9",
53
- defaultMessage: [{
54
- "type": 0,
55
- "value": "Reached limit"
56
- }]
57
- }
58
- });
59
- var MetricIconWrapper = /* @__PURE__ */__name(({
60
- icon
61
- }) => {
62
- return /* @__PURE__ */React.createElement(Flex, {
63
- sx: {
64
- alignItems: "center",
65
- justifyContent: "center",
66
- borderRadius: "full",
67
- border: "md",
68
- borderColor: "display.border.muted.default",
69
- backgroundColor: "display.background.muted.default",
70
- color: "display.text.secondary.default",
71
- width: "48px",
72
- height: "48px",
73
- flexShrink: 0
74
- }
75
- }, icon && /* @__PURE__ */React.createElement(Icon, {
76
- icon
77
- }));
78
- }, "MetricIconWrapper");
79
- var MetricCardHeader = /* @__PURE__ */__name(({
80
- label,
81
- tooltip,
82
- isClickable
83
- }) => {
84
- const isTooltipAction = typeof tooltip === "function";
85
- const tooltipText = typeof tooltip === "string" ? tooltip : void 0;
86
- return /* @__PURE__ */React.createElement(Flex, {
87
- sx: {
88
- alignItems: "center",
89
- gap: "2"
90
- }
91
- }, /* @__PURE__ */React.createElement(Text, {
92
- sx: {
93
- fontSize: "sm",
94
- fontWeight: "medium",
95
- color: "display.text.secondary.default"
96
- }
97
- }, label), tooltipText && /* @__PURE__ */React.createElement(TooltipIcon, {
98
- icon: "fluent:info-24-regular",
99
- tooltip: {
100
- children: tooltipText
101
- },
102
- variant: "info"
103
- }), isTooltipAction && /* @__PURE__ */React.createElement(Text, {
104
- onClick: /* @__PURE__ */__name(e => {
105
- e.stopPropagation();
106
- tooltip();
107
- }, "onClick"),
108
- sx: {
109
- fontSize: "sm",
110
- color: "display.text.secondary.default",
111
- cursor: "pointer",
112
- ":hover": {
113
- color: "action.text.primary.default"
114
- }
115
- }
116
- }, /* @__PURE__ */React.createElement(Icon, {
117
- icon: "fluent:info-24-regular",
118
- inline: true
119
- })), isClickable && /* @__PURE__ */React.createElement(Text, {
120
- sx: {
121
- fontSize: "sm",
122
- color: "display.text.secondary.default"
123
- }
124
- }, /* @__PURE__ */React.createElement(Icon, {
125
- icon: "fluent:open-24-regular",
126
- inline: true
127
- })));
128
- }, "MetricCardHeader");
129
- var DateMetricContent = /* @__PURE__ */__name(({
130
- metric
131
- }) => {
132
- return /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement(Text, {
133
- sx: {
134
- fontSize: "2xl",
135
- fontWeight: "bold",
136
- color: "display.text.primary.default"
137
- }
138
- }, metric.date), metric.remainingDaysMessage && /* @__PURE__ */React.createElement(Flex, {
139
- sx: {
140
- alignItems: "center",
141
- gap: "2"
142
- }
143
- }, /* @__PURE__ */React.createElement(Text, {
144
- sx: {
145
- fontSize: "sm",
146
- color: metric.isWarning ? "feedback.text.caution.default" : "display.text.secondary.default"
147
- }
148
- }, /* @__PURE__ */React.createElement(Icon, {
149
- icon: metric.isWarning ? "fluent:warning-24-regular" : "fluent:clock-24-regular",
150
- inline: true
151
- })), /* @__PURE__ */React.createElement(Text, {
152
- sx: {
153
- fontSize: "sm",
154
- color: metric.isWarning ? "feedback.text.caution.default" : "display.text.secondary.default"
155
- }
156
- }, metric.remainingDaysMessage)));
157
- }, "DateMetricContent");
158
- var PercentageMetricContent = /* @__PURE__ */__name(({
159
- metric
160
- }) => {
161
- const {
162
- intl
163
- } = useI18n();
164
- const percentage = metric.max === null || metric.max <= 0 ? null : Math.min(Math.round(metric.current / metric.max * 100), 100);
165
- const formatValue = metric.formatValue || (val => {
166
- return val.toString();
167
- });
168
- const showAlert = percentage !== null && metric.showAlertThreshold !== void 0 && percentage >= metric.showAlertThreshold;
169
- const isOverLimit = percentage !== null && percentage >= 100;
170
- const maxText = metric.max !== null ? formatValue(metric.max) : intl.formatMessage(messages.infinity);
171
- return /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement(Flex, {
172
- sx: {
173
- alignItems: "baseline",
174
- justifyContent: "space-between",
175
- gap: "2"
176
- }
177
- }, /* @__PURE__ */React.createElement(Text, {
178
- sx: {
179
- fontSize: "2xl",
180
- fontWeight: "bold",
181
- color: "display.text.primary.default"
182
- }
183
- }, formatValue(metric.current)), /* @__PURE__ */React.createElement(Text, {
184
- sx: {
185
- fontSize: "sm",
186
- color: "display.text.secondary.default"
187
- }
188
- }, intl.formatMessage(messages.ofMax, {
189
- max: maxText
190
- }))), /* @__PURE__ */React.createElement(Box, {
191
- sx: {
192
- width: "full",
193
- height: "8px",
194
- backgroundColor: "display.background.secondary.default",
195
- borderRadius: "full",
196
- overflow: "hidden"
197
- }
198
- }, /* @__PURE__ */React.createElement(Box, {
199
- sx: {
200
- height: "full",
201
- width: percentage !== null ? `${percentage}%` : "100%",
202
- backgroundColor: "action.background.primary.default",
203
- borderRadius: "full",
204
- transition: "width 0.5s ease-out"
205
- }
206
- })), /* @__PURE__ */React.createElement(Flex, {
207
- sx: {
208
- alignItems: "center",
209
- justifyContent: "space-between",
210
- fontSize: "xs"
211
- }
212
- }, /* @__PURE__ */React.createElement(Text, {
213
- sx: {
214
- color: "display.text.secondary.default"
215
- }
216
- }, percentage !== null ? intl.formatMessage(messages.percentageUsed, {
217
- percentage
218
- }) : intl.formatMessage(messages.unlimited)), showAlert && !isOverLimit && /* @__PURE__ */React.createElement(Flex, {
219
- sx: {
220
- alignItems: "center",
221
- gap: "1",
222
- color: "feedback.text.caution.default"
223
- }
224
- }, /* @__PURE__ */React.createElement(Icon, {
225
- icon: "fluent:warning-24-regular"
226
- }), /* @__PURE__ */React.createElement(Text, {
227
- sx: {
228
- fontWeight: "medium"
229
- }
230
- }, intl.formatMessage(messages.nearLimit))), showAlert && isOverLimit && /* @__PURE__ */React.createElement(Flex, {
231
- sx: {
232
- alignItems: "center",
233
- gap: "1",
234
- color: "feedback.text.negative.default"
235
- }
236
- }, /* @__PURE__ */React.createElement(Icon, {
237
- icon: "fluent:warning-24-regular"
238
- }), /* @__PURE__ */React.createElement(Text, {
239
- sx: {
240
- fontWeight: "medium",
241
- color: "feedback.text.negative.default"
242
- }
243
- }, intl.formatMessage(messages.reachedLimit)))));
244
- }, "PercentageMetricContent");
245
- var NumberMetricContent = /* @__PURE__ */__name(({
246
- metric
247
- }) => {
248
- const {
249
- intl
250
- } = useI18n();
251
- const formatValue = metric.formatValue || (val => {
252
- return val.toString();
253
- });
254
- const maxText = metric.max !== null ? formatValue(metric.max) : intl.formatMessage(messages.infinity);
255
- return /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement(Flex, {
256
- sx: {
257
- alignItems: "baseline",
258
- gap: "3"
259
- }
260
- }, /* @__PURE__ */React.createElement(Text, {
261
- sx: {
262
- fontSize: "2xl",
263
- fontWeight: "bold",
264
- color: "display.text.primary.default"
265
- }
266
- }, formatValue(metric.current)), /* @__PURE__ */React.createElement(Text, {
267
- sx: {
268
- fontSize: "sm",
269
- color: "display.text.secondary.default"
270
- }
271
- }, intl.formatMessage(messages.ofMax, {
272
- max: maxText
273
- }))), metric.footerText && /* @__PURE__ */React.createElement(Text, {
274
- sx: {
275
- fontSize: "xs",
276
- color: "display.text.secondary.default",
277
- lineHeight: "relaxed",
278
- maxWidth: "300px"
279
- }
280
- }, metric.footerText));
281
- }, "NumberMetricContent");
282
- var MetricCard = /* @__PURE__ */__name(({
283
- metric,
284
- isLoading = false
285
- }) => {
286
- if (isLoading) {
287
- return null;
288
- }
289
- const isClickable = Boolean(metric.onClick || metric.helpArticleAction);
290
- return /* @__PURE__ */React.createElement(Card, {
291
- onClick: metric.onClick || metric.helpArticleAction,
292
- sx: {
293
- backgroundColor: "display.background.muted.default",
294
- padding: "6",
295
- cursor: isClickable ? "pointer" : "default",
296
- transition: "all 0.2s ease",
297
- minWidth: ["full", "full", "400px"],
298
- ":hover": {
299
- transform: "scale(1.01)"
300
- }
301
- }
302
- }, /* @__PURE__ */React.createElement(Flex, {
303
- sx: {
304
- gap: "4",
305
- width: "full"
306
- }
307
- }, /* @__PURE__ */React.createElement(MetricIconWrapper, {
308
- icon: metric.icon
309
- }), /* @__PURE__ */React.createElement(Flex, {
310
- sx: {
311
- flex: 1,
312
- flexDirection: "column",
313
- gap: "2"
314
- }
315
- }, /* @__PURE__ */React.createElement(MetricCardHeader, {
316
- label: metric.label,
317
- tooltip: metric.tooltip,
318
- isClickable
319
- }), metric.type === "date" && /* @__PURE__ */React.createElement(DateMetricContent, {
320
- metric
321
- }), metric.type === "percentage" && /* @__PURE__ */React.createElement(PercentageMetricContent, {
322
- metric
323
- }), metric.type === "number" && /* @__PURE__ */React.createElement(NumberMetricContent, {
324
- metric
325
- }))));
326
- }, "MetricCard");
327
- export { MetricCard };