@moises.ai/design-system 3.6.5 → 3.6.6

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.6.5",
3
+ "version": "3.6.6",
4
4
  "description": "Design System package based on @radix-ui/themes with custom defaults",
5
5
  "private": false,
6
6
  "type": "module",
@@ -155,6 +155,7 @@ export const DataTable = ({
155
155
  onSelectAll,
156
156
  onSelectRow,
157
157
  stickyOffset = 0,
158
+ stickyBodyOffset = 0,
158
159
  ...props
159
160
  }) => {
160
161
  const [isHeaderHovering, setIsHeaderHovering] = useState(false)
@@ -279,12 +280,16 @@ export const DataTable = ({
279
280
  const stickyOffsetValue =
280
281
  typeof stickyOffset === 'number' ? `${stickyOffset}px` : stickyOffset
281
282
 
283
+ const stickyBodyOffsetValue =
284
+ typeof stickyBodyOffset === 'number' ? `${stickyBodyOffset}px` : stickyBodyOffset
285
+
282
286
  return (
283
287
  <Table.Root
284
288
  className={classNames(styles.DataTable, className)}
285
289
  size="1"
286
290
  style={{
287
291
  '--datatable-sticky-offset': stickyOffsetValue,
292
+ '--datatable-sticky-body-offset': stickyBodyOffsetValue,
288
293
  ...style,
289
294
  }}
290
295
  {...restProps}
@@ -360,7 +365,7 @@ export const DataTable = ({
360
365
  </Table.Row>
361
366
  </Table.Header>
362
367
 
363
- <Table.Body>
368
+ <Table.Body >
364
369
  {data.map((row, index) => (
365
370
  <DataRow
366
371
  key={row.id}
@@ -54,6 +54,12 @@
54
54
  background-color: var(--neutral-1) !important;
55
55
  }
56
56
 
57
+ .DataTable :global(.rt-TableBody) {
58
+ position: relative;
59
+ top: var(--datatable-sticky-body-offset, 0px) !important;
60
+ }
61
+
62
+
57
63
  .DataTable :global(.rt-TableHeader) :global(.rt-TableRow) {
58
64
  background-color: var(--neutral-1) !important;
59
65
  }
@@ -2,10 +2,7 @@ import { Flex, Text, Avatar, ScrollArea } from '@radix-ui/themes'
2
2
  import styles from './SetlistList.module.css'
3
3
  import classNames from 'classnames'
4
4
  import {
5
- DotsVerticalIcon,
6
5
  SetlistIcon,
7
- UserGroupIcon,
8
- GlobeIcon,
9
6
  PlusIcon,
10
7
  } from '../../icons'
11
8
  import { DropdownMenu } from '../DropdownMenu/DropdownMenu'
@@ -16,6 +13,55 @@ import { useMobileDrawerContext } from '../../contexts/MobileDrawerContext'
16
13
 
17
14
  const SetlistIconFallback = () => <SetlistIcon width={16} height={16} />
18
15
 
16
+ function SetlistExpandButton({ onExpand, className, style, collapsed = false }) {
17
+ return (
18
+ <button
19
+ type="button"
20
+ className={classNames(
21
+ styles.newSetlistItem,
22
+ styles.collapsedStackItem,
23
+ styles.collapsedTransition,
24
+ styles.setlistExpandButton,
25
+ { [styles.collapsed]: collapsed },
26
+ className,
27
+ )}
28
+ style={style}
29
+ onClick={(e) => {
30
+ e.stopPropagation()
31
+ onExpand?.(e)
32
+ }}
33
+ aria-label="Expand setlist"
34
+ >
35
+ <Flex gap="3" align="center" className={styles.collapsedInner}>
36
+ <div className={styles.avatarSetlist}>
37
+ <SetlistIcon width={16} height={16} />
38
+ </div>
39
+ </Flex>
40
+ </button>
41
+ )
42
+ }
43
+
44
+ function NewSetlistButton({ onClick, className, collapsed = false }) {
45
+ return (
46
+ <SetlistItem
47
+ isSelected={false}
48
+ onClick={onClick}
49
+ avatar={
50
+ <div className={styles.iconSwap}>
51
+ <PlusIcon
52
+ width={16}
53
+ height={16}
54
+ className={classNames(styles.iconSwapLayer, styles.iconVisible, styles.plusIcon)}
55
+ />
56
+ </div>
57
+ }
58
+ text="New Setlist"
59
+ className={classNames(styles.newSetlistItemButton, styles.collapsedTransition, className)}
60
+ collapsed={collapsed}
61
+ />
62
+ )
63
+ }
64
+
19
65
  function renderSetlistAvatar(icon) {
20
66
  if (!icon) return <SetlistIconFallback />
21
67
  if (typeof icon === 'string') {
@@ -69,7 +115,6 @@ export const SetlistItem = ({
69
115
  moises = false,
70
116
  collapsed = false,
71
117
  isMobile = false,
72
- onAvatarClick,
73
118
  }) => {
74
119
  const [isHovering, setIsHovering] = useState(false)
75
120
 
@@ -93,8 +138,8 @@ export const SetlistItem = ({
93
138
  <Flex
94
139
  gap="3"
95
140
  align="center"
96
- role="button"
97
- tabIndex={0}
141
+ role={onClick ? 'button' : undefined}
142
+ tabIndex={onClick ? 0 : undefined}
98
143
  onClick={onClick}
99
144
  className={classNames(styles.newSetlistItem, className, {
100
145
  [styles.navItemSelected]: isSelected,
@@ -103,12 +148,16 @@ export const SetlistItem = ({
103
148
  })}
104
149
  onMouseEnter={handleMouseEnter}
105
150
  onMouseLeave={handleMouseLeave}
106
- onKeyDown={(e) => {
107
- if (e.key === 'Enter' || e.key === ' ') {
108
- e.preventDefault()
109
- onClick?.()
110
- }
111
- }}
151
+ onKeyDown={
152
+ onClick
153
+ ? (e) => {
154
+ if (e.key === 'Enter' || e.key === ' ') {
155
+ e.preventDefault()
156
+ onClick?.()
157
+ }
158
+ }
159
+ : undefined
160
+ }
112
161
  style={style}
113
162
  >
114
163
  <Flex
@@ -119,32 +168,7 @@ export const SetlistItem = ({
119
168
  })}
120
169
  >
121
170
  {avatar && (
122
- <div
123
- className={classNames(styles.avatarSetlist, {
124
- [styles.avatarClickable]: onAvatarClick,
125
- })}
126
- onClick={
127
- onAvatarClick
128
- ? (e) => {
129
- e.stopPropagation()
130
- onAvatarClick(e)
131
- }
132
- : undefined
133
- }
134
- role={onAvatarClick ? 'button' : undefined}
135
- tabIndex={onAvatarClick ? 0 : undefined}
136
- onKeyDown={
137
- onAvatarClick
138
- ? (e) => {
139
- if (e.key === 'Enter' || e.key === ' ') {
140
- e.preventDefault()
141
- e.stopPropagation()
142
- onAvatarClick(e)
143
- }
144
- }
145
- : undefined
146
- }
147
- >
171
+ <div className={styles.avatarSetlist}>
148
172
  {typeof avatar === 'string' ? (
149
173
  <Avatar
150
174
  src={avatar}
@@ -307,28 +331,6 @@ export const SetlistList = ({
307
331
  }
308
332
  }, [])
309
333
 
310
- const renderNewSetlistAvatar = () => (
311
- <div className={styles.iconSwap}>
312
- <SetlistIcon
313
- width={16}
314
- height={16}
315
- className={classNames(styles.iconSwapLayer, {
316
- [styles.iconVisible]: showCollapsedStack,
317
- [styles.iconHidden]: !showCollapsedStack,
318
- })}
319
- />
320
- <PlusIcon
321
- width={16}
322
- height={16}
323
- className={classNames(
324
- styles.iconSwapLayer,
325
- styles.plusIcon,
326
- showCollapsedStack ? styles.iconHidden : styles.iconVisible,
327
- )}
328
- />
329
- </div>
330
- )
331
-
332
334
  const getCollapsedStackStyle = (index) => {
333
335
  if (!collapsed) return undefined
334
336
  if (!showCollapsedStack) {
@@ -386,16 +388,10 @@ export const SetlistList = ({
386
388
  >
387
389
  {onNewSetlistClick &&
388
390
  (showCollapsedStack ? (
389
- <SetlistItem
390
- isSelected={false}
391
- onClick={handleNewSetlistClick}
392
- onAvatarClick={handleSetlistIconClick}
393
- avatar={renderNewSetlistAvatar()}
394
- className={classNames(
395
- styles.collapsedStackItem,
396
- styles.collapsedTransition,
397
- )}
391
+ <SetlistExpandButton
392
+ onExpand={handleSetlistIconClick}
398
393
  collapsed={collapsed}
394
+ className={styles.collapsedStackItem}
399
395
  style={{
400
396
  position: 'relative',
401
397
  marginTop: 0,
@@ -403,14 +399,9 @@ export const SetlistList = ({
403
399
  }}
404
400
  />
405
401
  ) : (
406
- <SetlistItem
407
- isSelected={false}
402
+ <NewSetlistButton
408
403
  onClick={handleNewSetlistClick}
409
- avatar={renderNewSetlistAvatar()}
410
- text="New Setlist"
411
- className={classNames(styles.newSetlistItemButton, {
412
- [styles.collapsedTransition]: collapsed,
413
- })}
404
+ className={styles.collapsedTransition}
414
405
  collapsed={collapsed}
415
406
  />
416
407
  ))}
@@ -233,10 +233,33 @@
233
233
 
234
234
  .collapsedStackItem {
235
235
  position: relative;
236
- /* justify-content: flex-start; */
237
- /* :hover {
238
- background: #212225 !important;
239
- } */
236
+ }
237
+
238
+ .setlistExpandButton {
239
+ display: flex;
240
+ align-items: center;
241
+ width: fit-content;
242
+ margin: 0 10px;
243
+ padding: 2px;
244
+ border: none;
245
+ border-radius: 6px;
246
+ background: transparent;
247
+ cursor: pointer;
248
+ font: inherit;
249
+ color: inherit;
250
+ }
251
+
252
+ .setlistExpandButton:hover {
253
+ background: var(--neutral-alpha-2);
254
+ }
255
+
256
+ .setlistExpandButton:hover .avatarSetlist {
257
+ background: var(--neutral-alpha-3);
258
+ }
259
+
260
+ .setlistExpandButton:focus-visible {
261
+ outline: 2px solid var(--neutral-alpha-8);
262
+ outline-offset: -1px;
240
263
  }
241
264
 
242
265
  .collapsedMask {
@@ -297,6 +320,11 @@
297
320
  pointer-events: none;
298
321
  }
299
322
 
323
+ .iconSwap.iconClickable {
324
+ pointer-events: auto;
325
+ cursor: pointer;
326
+ }
327
+
300
328
  .iconSwapLayer {
301
329
  position: absolute;
302
330
  inset: 0;
@@ -305,6 +333,12 @@
305
333
  justify-content: center;
306
334
  opacity: 0;
307
335
  transition: opacity 160ms ease-in-out;
336
+ pointer-events: none;
337
+ }
338
+
339
+ .iconSwapLayer.iconClickable {
340
+ pointer-events: auto;
341
+ cursor: pointer;
308
342
  }
309
343
 
310
344
  .iconVisible {