@moises.ai/design-system 3.9.16 → 3.9.18

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": "3.9.16",
3
+ "version": "3.9.18",
4
4
  "description": "Design System package based on @radix-ui/themes with custom defaults",
5
5
  "private": false,
6
6
  "type": "module",
@@ -1,5 +1,6 @@
1
1
  import { Flex, Text } from '@radix-ui/themes'
2
2
  import styles from './AdditionalItems.module.css'
3
+ import { Tooltip } from '../Tooltip/Tooltip'
3
4
  import classNames from 'classnames'
4
5
  import { useMobileDrawerContext } from '../../contexts/MobileDrawerContext'
5
6
 
@@ -22,7 +23,7 @@ export const AdditionalItems = ({
22
23
  item.onClick?.()
23
24
  if (isMobile) close()
24
25
  }
25
- return (
26
+ const navItem = (
26
27
  <Flex
27
28
  key={item.id || index}
28
29
  align="center"
@@ -52,6 +53,13 @@ export const AdditionalItems = ({
52
53
  </div>
53
54
  </Flex>
54
55
  )
56
+ return collapsed ? (
57
+ <Tooltip key={item.id || index} content={item.label} side="right">
58
+ {navItem}
59
+ </Tooltip>
60
+ ) : (
61
+ navItem
62
+ )
55
63
  })}
56
64
  </Flex>
57
65
  )
@@ -1,4 +1,5 @@
1
1
  import { Flex, Text, Badge } from '@radix-ui/themes'
2
+ import { Tooltip } from '../Tooltip/Tooltip'
2
3
  import styles from './ProductsList.module.css'
3
4
  import classNames from 'classnames'
4
5
  import { useMobileDrawerContext } from '../../contexts/MobileDrawerContext'
@@ -20,7 +21,7 @@ export const ProductsList = ({
20
21
  <Flex direction="column">
21
22
  {products.map((product) => {
22
23
  const isSelected = selectedProductId === product.id
23
- return (
24
+ const navItem = (
24
25
  <Flex
25
26
  key={product.id}
26
27
  align="center"
@@ -64,6 +65,13 @@ export const ProductsList = ({
64
65
  </div>
65
66
  </Flex>
66
67
  )
68
+ return collapsed ? (
69
+ <Tooltip key={product.id} content={product.label} side="right">
70
+ {navItem}
71
+ </Tooltip>
72
+ ) : (
73
+ navItem
74
+ )
67
75
  })}
68
76
  </Flex>
69
77
  )
@@ -1,6 +1,6 @@
1
1
  import classNames from 'classnames'
2
2
  import React from 'react'
3
- import { Button } from '../Button/Button'
3
+ import { Tooltip } from '../Tooltip/Tooltip'
4
4
  import { useIsMobileViewport } from '../../utils/useIsMobileViewport'
5
5
  import { DropdownMenu } from '../DropdownMenu/DropdownMenu'
6
6
  import { MenuTrigger } from './MenuTrigger'
@@ -12,6 +12,7 @@ export const ProfileMenu = ({
12
12
  user,
13
13
  menuOptions = [],
14
14
  collapsed,
15
+ tooltip = 'Profile',
15
16
  onSelectionChange,
16
17
  ...props
17
18
  }) => {
@@ -23,10 +24,21 @@ export const ProfileMenu = ({
23
24
  if (isMobile) close()
24
25
  }
25
26
 
27
+ const trigger = <MenuTrigger user={user} collapsed={collapsed} />
26
28
  return (
27
29
  <DropdownMenu
28
30
  className={classNames(styles.profileMenu, className)}
29
- trigger={<MenuTrigger user={user} collapsed={collapsed} />}
31
+ trigger={
32
+ collapsed && tooltip ? (
33
+ <div>
34
+ <Tooltip content={tooltip} side="right">
35
+ {trigger}
36
+ </Tooltip>
37
+ </div>
38
+ ) : (
39
+ trigger
40
+ )
41
+ }
30
42
  options={menuOptions}
31
43
  side={isMobileViewport ? 'top' : 'right'}
32
44
  {...props}
@@ -13,8 +13,8 @@ import { useMobileDrawerContext } from '../../contexts/MobileDrawerContext'
13
13
 
14
14
  const SetlistIconFallback = () => <SetlistIcon width={16} height={16} />
15
15
 
16
- function SetlistExpandButton({ onExpand, className, style, collapsed = false }) {
17
- return (
16
+ function SetlistExpandButton({ onExpand, className, style, collapsed = false, tooltip }) {
17
+ const button = (
18
18
  <button
19
19
  type="button"
20
20
  className={classNames(
@@ -39,9 +39,16 @@ function SetlistExpandButton({ onExpand, className, style, collapsed = false })
39
39
  </Flex>
40
40
  </button>
41
41
  )
42
+ return collapsed && tooltip ? (
43
+ <Tooltip content={tooltip} side="right">
44
+ {button}
45
+ </Tooltip>
46
+ ) : (
47
+ button
48
+ )
42
49
  }
43
50
 
44
- function NewSetlistButton({ onClick, className, collapsed = false, text = 'New Setlist' }) {
51
+ function NewSetlistButton({ onClick, className, collapsed = false, text = 'New Setlist', }) {
45
52
  return (
46
53
  <SetlistItem
47
54
  isSelected={false}
@@ -239,6 +246,7 @@ export const SetlistList = ({
239
246
  onSetlistClick,
240
247
  onNewSetlistClick,
241
248
  newSetlistButtonText = 'New Setlist',
249
+ newSetlistButtonTooltip = 'Expand setlists',
242
250
  collapsed = false,
243
251
  isMobile = false,
244
252
  }) => {
@@ -394,6 +402,7 @@ export const SetlistList = ({
394
402
  <SetlistExpandButton
395
403
  onExpand={handleSetlistIconClick}
396
404
  collapsed={collapsed}
405
+ tooltip={newSetlistButtonTooltip}
397
406
  className={styles.collapsedStackItem}
398
407
  style={{
399
408
  position: 'relative',
@@ -20,6 +20,10 @@ export const Shell = ({
20
20
  selectedSetlistId,
21
21
  onSetlistClick,
22
22
  onNewSetlistClick,
23
+ newSetlistButtonTooltip,
24
+ expandButtonTooltip,
25
+ profileMenuTooltip,
26
+ sidebarTooltip,
23
27
  children,
24
28
  }) => {
25
29
  const [collapsed, setCollapsed] = useState(false)
@@ -29,7 +33,11 @@ export const Shell = ({
29
33
 
30
34
  return (
31
35
  <>
32
- <Sidebar isCollapsed={collapsed} onCollapsedChange={setCollapsed}>
36
+ <Sidebar
37
+ isCollapsed={collapsed}
38
+ onCollapsedChange={setCollapsed}
39
+ tooltip={sidebarTooltip}
40
+ >
33
41
  <Flex direction="column">
34
42
  <SidebarSection title="PRODUCTS" collapsed={effectiveCollapsed} />
35
43
  <ProductsList
@@ -49,6 +57,8 @@ export const Shell = ({
49
57
  selectedSetlistId={selectedSetlistId}
50
58
  onSetlistClick={onSetlistClick}
51
59
  onNewSetlistClick={onNewSetlistClick}
60
+ newSetlistButtonTooltip={newSetlistButtonTooltip}
61
+ expandButtonTooltip={expandButtonTooltip}
52
62
  collapsed={effectiveCollapsed}
53
63
  isMobile={isMobile}
54
64
  />
@@ -67,6 +77,7 @@ export const Shell = ({
67
77
  user={userProfileItems}
68
78
  menuOptions={userProfileItems?.menuOptions}
69
79
  collapsed={effectiveCollapsed}
80
+ tooltip={profileMenuTooltip}
70
81
  />
71
82
  </Flex>
72
83
  </Sidebar>
@@ -1,5 +1,6 @@
1
1
  import { Flex } from '@radix-ui/themes'
2
2
  import { IconButton } from '../IconButton/IconButton'
3
+ import { Tooltip } from '../Tooltip/Tooltip'
3
4
  import styles from './Sidebar.module.css'
4
5
  import { useState } from 'react'
5
6
  import classNames from 'classnames'
@@ -19,6 +20,7 @@ export const Sidebar = ({
19
20
  isCollapsed,
20
21
  onCollapsedChange,
21
22
  onLogoClick,
23
+ tooltip = 'Expand menu',
22
24
  ...props
23
25
  }) => {
24
26
  const { isMobile, isOpen: mobileOpen, open, close } = useMobileDrawer()
@@ -50,6 +52,40 @@ export const Sidebar = ({
50
52
  }
51
53
  }
52
54
 
55
+ const logoContent = (
56
+ <>
57
+ <div
58
+ className={classNames(styles.logoToggleContainer, {
59
+ [styles.logoToggleContainerCollapsed]: effectiveCollapsed,
60
+ })}
61
+ >
62
+ <MoisesLogoIcon
63
+ width={32}
64
+ height={17}
65
+ className={classNames(styles.logoInContainer, {
66
+ [styles.logoInContainerHidden]: effectiveCollapsed && isHovered,
67
+ })}
68
+ />
69
+ <Tooltip content={tooltip} side="right" sideOffset={15}>
70
+ <SidebarLeftIcon
71
+ width={16}
72
+ height={16}
73
+ className={classNames(styles.toggleInContainer, {
74
+ [styles.toggleInContainerVisible]:
75
+ effectiveCollapsed && isHovered,
76
+ })}
77
+ />
78
+ </Tooltip>
79
+ </div>
80
+ <MoisesIcon
81
+ height={12.269}
82
+ className={classNames(styles.moisesIcon, {
83
+ [styles.moisesIconHidden]: effectiveCollapsed,
84
+ })}
85
+ />
86
+ </>
87
+ )
88
+
53
89
  return (
54
90
  <MobileDrawerProvider value={{ close, isMobile }}>
55
91
  <div
@@ -58,120 +94,93 @@ export const Sidebar = ({
58
94
  })}
59
95
  {...props}
60
96
  >
61
- <div className={styles.mobileTopBarWrapper}>
62
- <Flex
63
- align="center"
64
- justify="between"
65
- className={classNames(styles.mobileTopBar, {
66
- [styles.mobileTopBarOpen]: isMobile && mobileOpen,
67
- })}
68
- >
97
+ <div className={styles.mobileTopBarWrapper}>
69
98
  <Flex
70
99
  align="center"
71
- gap="2"
72
- height="38px"
73
- onClick={onLogoClick}
74
- style={{ cursor: onLogoClick ? 'pointer' : 'default' }}
100
+ justify="between"
101
+ className={classNames(styles.mobileTopBar, {
102
+ [styles.mobileTopBarOpen]: isMobile && mobileOpen,
103
+ })}
75
104
  >
76
- <MoisesLogoIcon width={32} height={17} />
77
- <MoisesIcon height={12.269} />
78
- </Flex>
105
+ <Flex
106
+ align="center"
107
+ gap="2"
108
+ height="38px"
109
+ onClick={onLogoClick}
110
+ style={{ cursor: onLogoClick ? 'pointer' : 'default' }}
111
+ >
112
+ <MoisesLogoIcon width={32} height={17} />
113
+ <MoisesIcon height={12.269} />
114
+ </Flex>
79
115
 
80
- <IconButton
81
- variant="ghost"
82
- size="2"
83
- onClick={mobileOpen ? close : open}
84
- className={styles.mobileTopBarAction}
85
- aria-label={mobileOpen ? 'Close menu' : 'Open menu'}
86
- >
87
- {mobileOpen ? (
88
- <CloseIcon width={20} height={20} />
89
- ) : (
90
- <HamburgerMenu3Icon width={20} height={20} />
91
- )}
92
- </IconButton>
93
- </Flex>
94
- </div>
116
+ <IconButton
117
+ variant="ghost"
118
+ size="2"
119
+ onClick={mobileOpen ? close : open}
120
+ className={styles.mobileTopBarAction}
121
+ aria-label={mobileOpen ? 'Close menu' : 'Open menu'}
122
+ >
123
+ {mobileOpen ? (
124
+ <CloseIcon width={20} height={20} />
125
+ ) : (
126
+ <HamburgerMenu3Icon width={20} height={20} />
127
+ )}
128
+ </IconButton>
129
+ </Flex>
130
+ </div>
95
131
 
96
- <div
97
- className={classNames(styles.mobileDrawer, {
98
- [styles.mobileDrawerOpen]: isMobile && mobileOpen,
99
- })}
100
- >
101
- <Flex
102
- direction="column"
103
- className={classNames(styles.mobileDrawerContent, {
104
- [styles.mobileDrawerContentOpen]: isMobile && mobileOpen,
132
+ <div
133
+ className={classNames(styles.mobileDrawer, {
134
+ [styles.mobileDrawerOpen]: isMobile && mobileOpen,
105
135
  })}
106
136
  >
107
- {children}
108
- </Flex>
109
- </div>
137
+ <Flex
138
+ direction="column"
139
+ className={classNames(styles.mobileDrawerContent, {
140
+ [styles.mobileDrawerContentOpen]: isMobile && mobileOpen,
141
+ })}
142
+ >
143
+ {children}
144
+ </Flex>
145
+ </div>
110
146
 
111
- <Flex
112
- direction="column"
113
- className={styles.desktopSidebar}
114
- onMouseEnter={handleMouseEnter}
115
- onMouseLeave={handleMouseLeave}
116
- >
117
147
  <Flex
118
- align="center"
119
- justify="between"
120
- className={classNames(styles.header, {
121
- [styles.headerCollapsed]: effectiveCollapsed,
122
- })}
148
+ direction="column"
149
+ className={styles.desktopSidebar}
150
+ onMouseEnter={handleMouseEnter}
151
+ onMouseLeave={handleMouseLeave}
123
152
  >
124
153
  <Flex
125
154
  align="center"
126
- gap="2"
127
- onClick={handleLogoClick}
128
- style={{ cursor: 'pointer' }}
155
+ justify="between"
156
+ className={classNames(styles.header, {
157
+ [styles.headerCollapsed]: effectiveCollapsed,
158
+ })}
129
159
  >
130
- <div
131
- className={classNames(styles.logoToggleContainer, {
132
- [styles.logoToggleContainerCollapsed]: effectiveCollapsed,
133
- })}
160
+ <Flex
161
+ align="center"
162
+ gap="2"
163
+ onClick={handleLogoClick}
164
+ style={{ cursor: 'pointer' }}
134
165
  >
135
- <MoisesLogoIcon
136
- width={32}
137
- height={17}
138
- className={classNames(styles.logoInContainer, {
139
- [styles.logoInContainerHidden]:
140
- effectiveCollapsed && isHovered,
141
- })}
142
- />
143
- <SidebarLeftIcon
144
- width={16}
145
- height={16}
146
- className={classNames(styles.toggleInContainer, {
147
- [styles.toggleInContainerVisible]:
148
- effectiveCollapsed && isHovered,
149
- })}
150
- />
151
- </div>
152
- <MoisesIcon
153
- height={12.269}
154
- className={classNames(styles.moisesIcon, {
155
- [styles.moisesIconHidden]: effectiveCollapsed,
166
+ {logoContent}
167
+ </Flex>
168
+ <Flex
169
+ align="center"
170
+ justify="center"
171
+ onClick={handleToggleCollapse}
172
+ className={classNames(styles.toggleButton, {
173
+ [styles.toggleButtonHidden]: effectiveCollapsed,
156
174
  })}
157
- />
175
+ >
176
+ <SidebarLeftIcon width={16} height={16} />
177
+ </Flex>
158
178
  </Flex>
159
- <Flex
160
- align="center"
161
- justify="center"
162
- onClick={handleToggleCollapse}
163
- className={classNames(styles.toggleButton, {
164
- [styles.toggleButtonHidden]: effectiveCollapsed,
165
- })}
166
- >
167
- <SidebarLeftIcon width={16} height={16} />
179
+ <Flex direction="column" className={styles.content}>
180
+ {children}
168
181
  </Flex>
169
182
  </Flex>
170
- <Flex direction="column" className={styles.content}>
171
- {children}
172
- </Flex>
173
- </Flex>
174
- </div>
183
+ </div>
175
184
  </MobileDrawerProvider>
176
185
  )
177
186
  }
@@ -1,3 +1,8 @@
1
+ .tooltipTriggerWrapper {
2
+ display: block;
3
+ width: 100%;
4
+ }
5
+
1
6
  .root {
2
7
  background-color: var(--neutral-1);
3
8
  width: 240px;