@moises.ai/design-system 4.16.11 → 4.17.1

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.16.11",
3
+ "version": "4.17.1",
4
4
  "description": "Design System package based on @radix-ui/themes with custom defaults",
5
5
  "private": false,
6
6
  "type": "module",
@@ -1,4 +1,3 @@
1
-
2
1
  import classNames from 'classnames'
3
2
  import { DropdownMenu as DropdownMenuRadix } from 'radix-ui'
4
3
  import { memo, useCallback, useState } from 'react'
@@ -8,9 +7,6 @@ import { Theme } from '../theme/Theme'
8
7
  import styles from './ToolsDropdown.module.css'
9
8
  import { Flex, ScrollArea, Separator } from '../../index'
10
9
 
11
- const FOCUSABLE_SELECTOR =
12
- 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [role="switch"]:not([disabled]), [tabindex]:not([tabindex="-1"])'
13
-
14
10
  export const ToolsDropdown = memo(
15
11
  ({
16
12
  trigger,
@@ -66,19 +62,16 @@ export const ToolsDropdown = memo(
66
62
  }, [])
67
63
 
68
64
  const handleOpenAutoFocus = useCallback((event) => {
69
- const panel = event.currentTarget.querySelector('[data-tools-dropdown-panel]')
70
- const focusable = panel?.querySelector(FOCUSABLE_SELECTOR)
71
-
72
- if (!focusable) return
73
-
74
65
  event.preventDefault()
75
- focusable.focus({ preventScroll: true })
66
+ const panel = event.currentTarget.querySelector('[data-tools-dropdown-panel]')
67
+ panel?.focus({ preventScroll: true })
76
68
  }, [])
77
69
 
78
70
  const renderPanel = () => (
79
71
  <div
80
72
  className={styles.contentPanel}
81
73
  data-tools-dropdown-panel
74
+ tabIndex={-1}
82
75
  onKeyDown={handlePanelKeyDown}
83
76
  >
84
77
  {typeof children === 'function' ? children(closeMenu) : children}
@@ -159,4 +152,4 @@ export const ToolsDropdown = memo(
159
152
  },
160
153
  )
161
154
 
162
- ToolsDropdown.displayName = 'ToolsDropdown'
155
+ ToolsDropdown.displayName = 'ToolsDropdown'
@@ -2,6 +2,7 @@ import { Flex, Switch, Text } from '@radix-ui/themes'
2
2
  import { useState } from 'react'
3
3
  import { MetronomeIcon } from '../../icons/MetronomeIcon'
4
4
  import { ToolsDropdown } from './ToolsDropdown'
5
+ import { IconButton } from '../IconButton/IconButton'
5
6
  export default {
6
7
  title: 'Components/ToolsDropdown',
7
8
  component: ToolsDropdown,
@@ -79,6 +80,9 @@ export const WithRenderProp = {
79
80
  {(closeMenu) => (
80
81
  <>
81
82
  <Flex direction="column" gap="3" width="220px">
83
+ <IconButton >
84
+ <MetronomeIcon width={16} height={16} />
85
+ </IconButton>
82
86
  <Text size="2">Show chord diagrams</Text>
83
87
  <Switch
84
88
  size="2"
@@ -9,6 +9,9 @@ export const Tooltip = ({
9
9
  content,
10
10
  shortcut,
11
11
  color = 'gray',
12
+ variant = 'default',
13
+ title,
14
+ headerActions,
12
15
  delayDuration = 200,
13
16
  skipDelayDuration,
14
17
  disableHoverableContent,
@@ -22,6 +25,8 @@ export const Tooltip = ({
22
25
  ...restContentProps
23
26
  } = props
24
27
 
28
+ const isDiagram = variant === 'diagram'
29
+
25
30
  const providerProps = {
26
31
  delayDuration,
27
32
  skipDelayDuration,
@@ -45,19 +50,40 @@ export const Tooltip = ({
45
50
  <TooltipPrimitive.Content
46
51
  className={classNames(
47
52
  styles.TooltipContent,
48
- styles[`TooltipContent--${color}`]
53
+ !isDiagram && styles[`TooltipContent--${color}`],
54
+ isDiagram && styles.TooltipDiagram
49
55
  )}
50
56
  sideOffset={5}
51
57
  {...restContentProps}
52
58
  >
53
- <Text size='1' className={styles.TooltipText}>{content}</Text>
54
- {shortcut && (
55
- <Text size='0' className={classNames(
56
- styles.TooltipShortcut,
57
- styles[`TooltipShortcut--${color}`]
58
- )}>
59
- {shortcut}
60
- </Text>
59
+ {isDiagram ? (
60
+ <>
61
+ <div className={styles.TooltipDiagramHeader}>
62
+ {title && (
63
+ <Text size='2' className={styles.TooltipDiagramTitle}>
64
+ {title}
65
+ </Text>
66
+ )}
67
+ {headerActions && (
68
+ <div className={styles.TooltipDiagramActions}>
69
+ {headerActions}
70
+ </div>
71
+ )}
72
+ </div>
73
+ <div className={styles.TooltipDiagramBody}>{content}</div>
74
+ </>
75
+ ) : (
76
+ <>
77
+ <Text size='1' className={styles.TooltipText}>{content}</Text>
78
+ {shortcut && (
79
+ <Text size='0' className={classNames(
80
+ styles.TooltipShortcut,
81
+ styles[`TooltipShortcut--${color}`]
82
+ )}>
83
+ {shortcut}
84
+ </Text>
85
+ )}
86
+ </>
61
87
  )}
62
88
  <TooltipPrimitive.Arrow className={styles.TooltipArrow} />
63
89
  </TooltipPrimitive.Content>
@@ -85,6 +85,55 @@
85
85
  color: rgba(252, 253, 255, 0.94);
86
86
  }
87
87
 
88
+ /* Diagram variant (matches the "tooltip diagram" surface from Figma) */
89
+ .TooltipDiagram {
90
+ flex-direction: column;
91
+ align-items: stretch;
92
+ gap: var(--spacing-1, 4px);
93
+ max-width: none;
94
+ padding: var(--spacing-1, 4px) var(--spacing-2, 8px) var(--spacing-2, 8px);
95
+ border-radius: var(--radius-4, 8px);
96
+ border: 1px solid var(--neutral-alpha-3, rgba(221, 234, 248, 0.08));
97
+ background: var(--panel-solid, #18191b);
98
+ color: var(--neutral-alpha-12, rgba(252, 253, 255, 0.94));
99
+ box-shadow:
100
+ 0 12px 32px -16px rgba(0, 0, 0, 0.3),
101
+ 0 12px 60px 0 rgba(0, 0, 0, 0.15);
102
+ }
103
+
104
+ .TooltipDiagram .TooltipArrow {
105
+ fill: var(--panel-solid, #18191b);
106
+ }
107
+
108
+ .TooltipDiagramHeader {
109
+ display: flex;
110
+ align-items: center;
111
+ justify-content: space-between;
112
+ gap: var(--spacing-2, 8px);
113
+ width: 100%;
114
+ }
115
+
116
+ .TooltipDiagramTitle {
117
+ color: var(--neutral-alpha-9, rgba(223, 235, 253, 0.43));
118
+ font-weight: 400;
119
+ font-size: 14px;
120
+ line-height: 20px;
121
+ white-space: nowrap;
122
+ }
123
+
124
+ .TooltipDiagramActions {
125
+ display: inline-flex;
126
+ align-items: center;
127
+ }
128
+
129
+ .TooltipDiagramBody {
130
+ display: flex;
131
+ flex-direction: column;
132
+ align-items: center;
133
+ gap: var(--spacing-1, 4px);
134
+ width: 100%;
135
+ }
136
+
88
137
  .TooltipText {
89
138
  white-space: normal;
90
139
  overflow-wrap: anywhere;
@@ -13,6 +13,10 @@ export default {
13
13
  control: 'select',
14
14
  options: ['white', 'gray'],
15
15
  },
16
+ variant: {
17
+ control: 'select',
18
+ options: ['default', 'diagram'],
19
+ },
16
20
  },
17
21
  }
18
22
 
@@ -58,4 +62,42 @@ export const WithShortcutWhite = {
58
62
  color: 'white',
59
63
  children: <Button>Hover me</Button>,
60
64
  },
65
+ }
66
+
67
+ export const Diagram = {
68
+ args: {
69
+ variant: 'diagram',
70
+ title: 'Diagram',
71
+ side: 'top',
72
+ open: true,
73
+ headerActions: (
74
+ <button
75
+ type="button"
76
+ aria-label="More"
77
+ style={{
78
+ width: 12,
79
+ height: 24,
80
+ padding: 0,
81
+ border: 'none',
82
+ background: 'transparent',
83
+ color: 'rgba(223, 235, 253, 0.43)',
84
+ cursor: 'pointer',
85
+ lineHeight: 0,
86
+ }}
87
+ >
88
+
89
+ </button>
90
+ ),
91
+ content: (
92
+ <div
93
+ style={{
94
+ width: 100,
95
+ height: 155,
96
+ borderRadius: 8,
97
+ background: '#edeef0',
98
+ }}
99
+ />
100
+ ),
101
+ children: <Button>Hover me</Button>,
102
+ },
61
103
  }
@@ -80,9 +80,7 @@ export const createRenderItem = (MenuPrimitives) => {
80
80
  </div>
81
81
  </MenuPrimitives.SubTrigger>
82
82
 
83
- <MenuPrimitives.SubContent
84
- className={classNames(styles.menuSubContent, opt.subContentClassName)}
85
- >
83
+ <MenuPrimitives.SubContent className={styles.menuSubContent}>
86
84
  {opt?.children?.map((child) =>
87
85
  renderItem(
88
86
  child,