@moises.ai/design-system 4.15.9 → 4.15.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moises.ai/design-system",
3
- "version": "4.15.9",
3
+ "version": "4.15.10",
4
4
  "description": "Design System package based on @radix-ui/themes with custom defaults",
5
5
  "private": false,
6
6
  "type": "module",
@@ -21,6 +21,7 @@ The \`CardDetails\` component is the enhanced card variant for the ListCards com
21
21
  - **See details button** - Navigate to detailed views or trigger modals
22
22
  - **Clickable avatar** - Add interactive elements like play/pause to the avatar area
23
23
  - **Custom avatar content** - Display custom React nodes in the avatar area
24
+ - **Avatar tooltip** - Show a tooltip on hover over the avatar (e.g. for status icons)
24
25
  - **Auto description** - Renders \`item.description\` (or the \`description\` prop) by default
25
26
  - **Rich formatting** - Override the description by passing \`children\` for separators, ellipsis, etc.
26
27
 
@@ -62,6 +63,17 @@ import { ListCards } from '@moises.ai/design-system'
62
63
  </ListCards>
63
64
  \`\`\`
64
65
 
66
+ #### Avatar status icon with tooltip
67
+
68
+ \`\`\`jsx
69
+ <ListCards.CardDetails
70
+ item={item}
71
+ disabled={item.isFailed}
72
+ avatarContent={<AlertIcon />}
73
+ avatarTooltip="Voice training failed"
74
+ />
75
+ \`\`\`
76
+
65
77
  #### Full-featured CardDetails
66
78
 
67
79
  \`\`\`jsx
@@ -95,6 +107,7 @@ import { ListCards } from '@moises.ai/design-system'
95
107
 
96
108
  onAvatarClick?: (event: React.MouseEvent) => void; // Called when avatar area is clicked
97
109
  avatarContent?: React.ReactNode; // Custom content to render in avatar area
110
+ avatarTooltip?: string; // Tooltip shown on hover over the avatar area (e.g. status icons)
98
111
 
99
112
  // Content
100
113
  children?: React.ReactNode; // Custom content for the description area (overrides description)
@@ -11,8 +11,18 @@ import classNames from 'classnames'
11
11
  import React from 'react'
12
12
  import { SparklesIcon } from '../../icons/SparklesIcon'
13
13
  import { ThumbnailPicker } from '../ThumbnailPicker/ThumbnailPicker'
14
+ import { Tooltip } from '../Tooltip/Tooltip'
14
15
  import styles from './ListCards.module.css'
15
16
 
17
+ const withAvatarTooltip = (content, tooltip) => {
18
+ if (!tooltip) return content
19
+ return (
20
+ <Tooltip content={tooltip}>
21
+ <div className={styles.avatarTooltipTrigger}>{content}</div>
22
+ </Tooltip>
23
+ )
24
+ }
25
+
16
26
  const Card = ({
17
27
  className,
18
28
  image,
@@ -139,6 +149,7 @@ const CardDetails = ({
139
149
  onSeeDetails,
140
150
  onAvatarClick,
141
151
  avatarContent,
152
+ avatarTooltip,
142
153
  seeDetailsText = 'Details',
143
154
  actions,
144
155
  loading,
@@ -194,15 +205,18 @@ const CardDetails = ({
194
205
  }}
195
206
  >
196
207
  {!onAvatarClick &&
197
- (loading ? (
198
- <div className={styles.listCardsAvatarIcon}>
199
- <SparklesIcon className={styles.loadingIcon} />
200
- </div>
201
- ) : avatarContent ? (
202
- <div className={styles.listCardsAvatarIcon}>{avatarContent}</div>
203
- ) : (
204
- <Avatar src={avatarUrl} className={styles.listCardsAvatar} />
205
- ))}
208
+ withAvatarTooltip(
209
+ loading ? (
210
+ <div className={styles.listCardsAvatarIcon}>
211
+ <SparklesIcon className={styles.loadingIcon} />
212
+ </div>
213
+ ) : avatarContent ? (
214
+ <div className={styles.listCardsAvatarIcon}>{avatarContent}</div>
215
+ ) : (
216
+ <Avatar src={avatarUrl} className={styles.listCardsAvatar} />
217
+ ),
218
+ avatarTooltip,
219
+ )}
206
220
  <Flex
207
221
  direction="column"
208
222
  justify="center"
@@ -254,10 +268,13 @@ const CardDetails = ({
254
268
  : undefined
255
269
  }
256
270
  >
257
- {avatarContent ? (
258
- <div className={styles.avatarContent}>{avatarContent}</div>
259
- ) : (
260
- <Avatar src={avatarUrl} className={styles.listCardsAvatar} />
271
+ {withAvatarTooltip(
272
+ avatarContent ? (
273
+ <div className={styles.avatarContent}>{avatarContent}</div>
274
+ ) : (
275
+ <Avatar src={avatarUrl} className={styles.listCardsAvatar} />
276
+ ),
277
+ avatarTooltip,
261
278
  )}
262
279
  </div>
263
280
  </div>
@@ -58,12 +58,18 @@
58
58
  height: 80px;
59
59
  }
60
60
 
61
+ .avatarTooltipTrigger {
62
+ pointer-events: auto;
63
+ display: flex;
64
+ flex-shrink: 0;
65
+ }
66
+
61
67
  .listCardsAvatarIcon {
62
68
  width: 60px;
63
69
  height: 60px;
64
70
  min-width: 60px;
65
71
  border-radius: 6px;
66
-
72
+
67
73
  background: var(--neutral-alpha-2);
68
74
  display: flex;
69
75
  align-items: center;
@@ -141,6 +141,7 @@ import { ListCards } from '@moises.ai/design-system'
141
141
  seeDetailsText?: string; // Custom text for the details button (default: "Details")
142
142
  onAvatarClick?: (event: React.MouseEvent) => void; // Avatar click handler
143
143
  avatarContent?: React.ReactNode; // Custom avatar content (e.g., play/pause button)
144
+ avatarTooltip?: string; // Tooltip shown on hover over the avatar area
144
145
  }
145
146
  \`\`\`
146
147
  `,
@@ -396,6 +397,9 @@ export const WithCustomActions = {
396
397
  />
397
398
  ) : undefined
398
399
  }
400
+ avatarTooltip={
401
+ item.isFailed ? 'Voice training failed' : undefined
402
+ }
399
403
  actions={
400
404
  item.isFailed ? (
401
405
  <IconButton