@moises.ai/design-system 3.10.1 → 3.10.3

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.10.1",
3
+ "version": "3.10.3",
4
4
  "description": "Design System package based on @radix-ui/themes with custom defaults",
5
5
  "private": false,
6
6
  "type": "module",
@@ -22,6 +22,7 @@ const DataRow = React.memo(function DataRow({
22
22
  anyRowSelected,
23
23
  selectedCount,
24
24
  sortedKey,
25
+ mobileSecondaryColumnId,
25
26
  hasDropdownOptions,
26
27
  onRowClick,
27
28
  onSelectRow,
@@ -160,8 +161,8 @@ const DataRow = React.memo(function DataRow({
160
161
  key={column.id}
161
162
  className={classNames(
162
163
  styles.projectCell,
163
- index === 0 ? styles.columnProject : styles.dataColumn,
164
- index === 1 ? styles.firstDataColumn : null,
164
+ index === 0 ? styles.columnProject : styles.dataColumn,
165
+ column.id === mobileSecondaryColumnId ? styles.mobileVisibleDataColumn : null,
165
166
  { [styles.sortedColumn]: sortedKey === column.id },
166
167
  )}
167
168
  data-column-id={column.id}
@@ -224,6 +225,16 @@ export const DataTable = ({
224
225
  const anchorRowIndexRef = useRef(null)
225
226
 
226
227
  const sortedKey = sorting?.field
228
+ const primaryColumnId = columns?.[0]?.id
229
+ const defaultSecondaryColumnId = columns?.[1]?.id
230
+
231
+ const mobileSecondaryColumnId = useMemo(() => {
232
+ if (!columns?.length) return undefined
233
+ if (!sortedKey || sortedKey === primaryColumnId) {
234
+ return defaultSecondaryColumnId
235
+ }
236
+ return sortedKey
237
+ }, [columns, sortedKey, primaryColumnId, defaultSecondaryColumnId])
227
238
 
228
239
  const selectedSet = useMemo(() => new Set(selectedRowIds), [selectedRowIds])
229
240
 
@@ -436,8 +447,8 @@ export const DataTable = ({
436
447
  key={column.id}
437
448
  className={classNames(styles.columnHeaderCell, {
438
449
  [styles.columnProject]: index === 0,
439
- [styles.dataColumn]: index !== 0,
440
- [styles.firstDataColumn]: index === 1,
450
+ [styles.dataColumn]: index !== 0,
451
+ [styles.mobileVisibleDataColumn]: column.id === mobileSecondaryColumnId,
441
452
  [styles.sortedColumn]: toUpperCase(sortedKey) === toUpperCase(column.id),
442
453
  })}
443
454
  >
@@ -500,6 +511,7 @@ export const DataTable = ({
500
511
  anyRowSelected={anyRowChecked}
501
512
  selectedCount={selectedCount}
502
513
  sortedKey={sortedKey}
514
+ mobileSecondaryColumnId={mobileSecondaryColumnId}
503
515
  hasDropdownOptions={hasDropdownOptions}
504
516
  onRowClick={handleRowClick}
505
517
  onSelectRow={handleSelectRow}
@@ -400,8 +400,8 @@
400
400
  .columnProject {
401
401
  display: table-cell !important;
402
402
  }
403
-
404
- .dataColumn.sortedColumn {
403
+
404
+ .dataColumn.mobileVisibleDataColumn {
405
405
  display: table-cell !important;
406
406
  }
407
407
 
@@ -414,9 +414,3 @@
414
414
  opacity: 1;
415
415
  }
416
416
  }
417
-
418
- @media (max-width: 1124px) {
419
- .firstDataColumn {
420
- display: table-cell !important;
421
- }
422
- }
@@ -482,4 +482,46 @@ export const Default = {
482
482
  sort: 'DESC',
483
483
  },
484
484
  },
485
+ }
486
+
487
+ export const SortedByTitle = {
488
+ render: (args) => (
489
+ <div
490
+ style={{
491
+ width: '100%',
492
+ maxWidth: '1620px',
493
+ maxHeight: '400px',
494
+ }}
495
+ >
496
+ <SelectableTemplate {...args} />
497
+ </div>
498
+ ),
499
+ args: {
500
+ ...Default.args,
501
+ initialSorting: {
502
+ field: 'title',
503
+ sort: 'ASC',
504
+ },
505
+ },
506
+ }
507
+
508
+ export const SortedByKey = {
509
+ render: (args) => (
510
+ <div
511
+ style={{
512
+ width: '100%',
513
+ maxWidth: '1620px',
514
+ maxHeight: '400px',
515
+ }}
516
+ >
517
+ <SelectableTemplate {...args} />
518
+ </div>
519
+ ),
520
+ args: {
521
+ ...Default.args,
522
+ initialSorting: {
523
+ field: 'KEY',
524
+ sort: 'ASC',
525
+ },
526
+ },
485
527
  }
@@ -26,9 +26,9 @@ export const ProfileMenu = ({
26
26
 
27
27
  const wrapCloseMenu = isMobile
28
28
  ? (baseClose) => () => {
29
- baseClose()
30
- close()
31
- }
29
+ baseClose()
30
+ close()
31
+ }
32
32
  : undefined
33
33
 
34
34
  const trigger = <MenuTrigger user={user} collapsed={collapsed} />
@@ -48,6 +48,7 @@ export const ProfileMenu = ({
48
48
  }
49
49
  options={menuOptions}
50
50
  side={isMobileViewport ? 'top' : 'right'}
51
+ align={isMobileViewport ? 'end' : 'center'}
51
52
  {...props}
52
53
  wrapCloseMenu={wrapCloseMenu}
53
54
  onSelectionChange={handleSelectionChange}