@moises.ai/design-system 3.10.0 → 3.10.2

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.0",
3
+ "version": "3.10.2",
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,
@@ -161,6 +162,7 @@ const DataRow = React.memo(function DataRow({
161
162
  className={classNames(
162
163
  styles.projectCell,
163
164
  index === 0 ? styles.columnProject : styles.dataColumn,
165
+ column.id === mobileSecondaryColumnId ? styles.mobileVisibleDataColumn : null,
164
166
  { [styles.sortedColumn]: sortedKey === column.id },
165
167
  )}
166
168
  data-column-id={column.id}
@@ -223,6 +225,16 @@ export const DataTable = ({
223
225
  const anchorRowIndexRef = useRef(null)
224
226
 
225
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])
226
238
 
227
239
  const selectedSet = useMemo(() => new Set(selectedRowIds), [selectedRowIds])
228
240
 
@@ -436,6 +448,7 @@ export const DataTable = ({
436
448
  className={classNames(styles.columnHeaderCell, {
437
449
  [styles.columnProject]: index === 0,
438
450
  [styles.dataColumn]: index !== 0,
451
+ [styles.mobileVisibleDataColumn]: column.id === mobileSecondaryColumnId,
439
452
  [styles.sortedColumn]: toUpperCase(sortedKey) === toUpperCase(column.id),
440
453
  })}
441
454
  >
@@ -498,6 +511,7 @@ export const DataTable = ({
498
511
  anyRowSelected={anyRowChecked}
499
512
  selectedCount={selectedCount}
500
513
  sortedKey={sortedKey}
514
+ mobileSecondaryColumnId={mobileSecondaryColumnId}
501
515
  hasDropdownOptions={hasDropdownOptions}
502
516
  onRowClick={handleRowClick}
503
517
  onSelectRow={handleSelectRow}
@@ -178,7 +178,7 @@
178
178
 
179
179
  .DataTable :global(.rt-TableColumnHeaderCell:nth-child(2)),
180
180
  .DataTable :global(.rt-TableCell:nth-child(2)) {
181
- max-width: 565px;
181
+ max-width: 480px;
182
182
  min-width: 260px;
183
183
  box-shadow: none;
184
184
  width: 100%;
@@ -400,8 +400,8 @@
400
400
  .columnProject {
401
401
  display: table-cell !important;
402
402
  }
403
-
404
- .sortedColumn {
403
+
404
+ .dataColumn.mobileVisibleDataColumn {
405
405
  display: table-cell !important;
406
406
  }
407
407
 
@@ -413,4 +413,4 @@
413
413
  .dropdownTriggerWrapperIcon {
414
414
  opacity: 1;
415
415
  }
416
- }
416
+ }
@@ -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
  }