@carto/ps-react-ui 4.18.0 → 4.19.0

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.
@@ -1,5 +1,6 @@
1
1
  export interface ChangeColumnLabels {
2
2
  trigger: string;
3
+ title?: string;
3
4
  reset: string;
4
5
  }
5
6
  export declare const DEFAULT_CHANGE_COLUMN_LABELS: ChangeColumnLabels;
@@ -11,23 +11,49 @@ export declare const styles: {
11
11
  };
12
12
  menuPaper: {
13
13
  overflow: "hidden";
14
- minWidth: number;
14
+ };
15
+ header: {
16
+ color: "text.secondary";
17
+ backgroundColor: "transparent";
18
+ typography: string;
19
+ px: number;
20
+ py: number;
15
21
  };
16
22
  item: {
23
+ position: "relative";
17
24
  cursor: "grab";
25
+ px: number;
26
+ touchAction: "none";
27
+ '&:hover .change-column-drag-handle': {
28
+ opacity: number;
29
+ };
18
30
  '&:focus-visible': {
19
31
  outline: string;
20
32
  outlineColor: "primary.main";
21
33
  outlineOffset: number;
22
34
  };
35
+ '&:focus-visible .change-column-drag-handle': {
36
+ opacity: number;
37
+ };
23
38
  };
24
39
  itemDragging: {
25
40
  opacity: number;
26
41
  cursor: "grabbing";
27
42
  };
28
43
  dragHandle: {
44
+ position: "absolute";
45
+ left: number;
46
+ top: string;
47
+ transform: "translateY(-50%)";
29
48
  color: "text.secondary";
30
- mr: number;
31
49
  fontSize: number;
50
+ opacity: number;
51
+ transition: "opacity 0.1s";
52
+ '@media (hover: none)': {
53
+ opacity: number;
54
+ };
55
+ };
56
+ dragHandleVisible: {
57
+ opacity: number;
32
58
  };
33
59
  };
@@ -1,4 +1,4 @@
1
- import { B as L, C as o, D as e, a as A, b as E, c as r, d as t, e as S, f as _, g as T, h as l, i as D, j as d, F as n, L as c, R as O, S as g, k as B, l as C, m, n as F, Z as U, o as i, p as I, q as h, r as w, s as G, t as f, u as N, v as R } from "../change-column-Bhcxmp-r.js";
1
+ import { B as L, C as o, D as e, a as A, b as E, c as r, d as t, e as S, f as _, g as T, h as l, i as D, j as d, F as n, L as c, R as O, S as g, k as B, l as C, m, n as F, Z as U, o as i, p as I, q as h, r as w, s as G, t as f, u as N, v as R } from "../change-column-Fu1DCYQ3.js";
2
2
  import { Z as u, a as x, c as M } from "../transforms-Cdx4fkU5.js";
3
3
  import { d as b, a as p, t as v, b as H } from "../exports-Cx-f6m6U.js";
4
4
  import { C as W, D as V, M as y, P as K, b as j } from "../png-item-9dNbB37T.js";
@@ -16,7 +16,7 @@ import "@carto/ps-utils";
16
16
  import { o as Ze, a as Ke, E as Ye } from "./echart-B10dhEaM.js";
17
17
  import { D as $n } from "./echart-B10dhEaM.js";
18
18
  import { MarkdownContent as Je } from "./markdown-content-Dk2DSgbf.js";
19
- import { C as Qe, L as et, F as tt, j as nt, R as ot, B as rt, Z as it, m as lt, n as st, l as at, k as ct } from "./change-column-Bhcxmp-r.js";
19
+ import { C as Qe, L as et, F as tt, j as nt, R as ot, B as rt, Z as it, m as lt, n as st, l as at, k as ct } from "./change-column-Fu1DCYQ3.js";
20
20
  import "html2canvas";
21
21
  import { a as dt, F as ft } from "./formula-DuC0NQLH.js";
22
22
  import { a as pt, M as mt } from "./markdown-DdqANCiN.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carto/ps-react-ui",
3
- "version": "4.18.0",
3
+ "version": "4.19.0",
4
4
  "description": "CARTO's Professional Service React Material library",
5
5
  "type": "module",
6
6
  "devDependencies": {
@@ -14,7 +14,12 @@ import {
14
14
  sortableKeyboardCoordinates,
15
15
  verticalListSortingStrategy,
16
16
  } from '@dnd-kit/sortable'
17
- import { IconButton, Menu, type SvgIconProps } from '@mui/material'
17
+ import {
18
+ IconButton,
19
+ ListSubheader,
20
+ Menu,
21
+ type SvgIconProps,
22
+ } from '@mui/material'
18
23
  import { Tooltip } from '../../../components'
19
24
  import { getWidgetStore, useWidget, useWidgetId } from '../../stores'
20
25
  import { ChangeColumnIcon } from './change-column-icon'
@@ -150,6 +155,7 @@ export function ChangeColumn({
150
155
  sensors={sensors}
151
156
  collisionDetection={closestCenter}
152
157
  onDragEnd={handleDragEnd}
158
+ autoScroll={false}
153
159
  >
154
160
  <Menu
155
161
  id='change-column-menu'
@@ -160,6 +166,9 @@ export function ChangeColumn({
160
166
  transformOrigin={{ vertical: 'top', horizontal: 'right' }}
161
167
  slotProps={{ paper: { sx: styles.menuPaper } }}
162
168
  >
169
+ <ListSubheader disableSticky role='presentation' sx={styles.header}>
170
+ {_labels.title}
171
+ </ListSubheader>
163
172
  <SortableContext
164
173
  items={orderedIds}
165
174
  strategy={verticalListSortingStrategy}
@@ -1,9 +1,11 @@
1
1
  export interface ChangeColumnLabels {
2
2
  trigger: string
3
+ title?: string
3
4
  reset: string
4
5
  }
5
6
 
6
7
  export const DEFAULT_CHANGE_COLUMN_LABELS: ChangeColumnLabels = {
7
8
  trigger: 'Change column order',
9
+ title: 'Column reorder',
8
10
  reset: 'Reset to default',
9
11
  }
@@ -45,11 +45,18 @@ export function SortableColumnItem({
45
45
  style={transformStyle}
46
46
  {...attributes}
47
47
  {...listeners}
48
+ disableGutters
48
49
  role='menuitem'
49
50
  tabIndex={0}
50
51
  sx={{ ...styles.item, ...(isDragging && styles.itemDragging) }}
51
52
  >
52
- <HandleIcon sx={styles.dragHandle} />
53
+ <HandleIcon
54
+ className='change-column-drag-handle'
55
+ sx={{
56
+ ...styles.dragHandle,
57
+ ...(isDragging && styles.dragHandleVisible),
58
+ }}
59
+ />
53
60
  <ListItemText>{label}</ListItemText>
54
61
  </MenuItem>
55
62
  )
@@ -10,23 +10,49 @@ export const styles = {
10
10
  },
11
11
  menuPaper: {
12
12
  overflow: 'hidden',
13
- minWidth: 220,
13
+ },
14
+ header: {
15
+ color: 'text.secondary',
16
+ backgroundColor: 'transparent',
17
+ typography: 'caption',
18
+ px: 2,
19
+ py: 0.75,
14
20
  },
15
21
  item: {
22
+ position: 'relative',
16
23
  cursor: 'grab',
24
+ px: 2,
25
+ touchAction: 'none',
26
+ '&:hover .change-column-drag-handle': {
27
+ opacity: 1,
28
+ },
17
29
  '&:focus-visible': {
18
30
  outline: '2px solid',
19
31
  outlineColor: 'primary.main',
20
32
  outlineOffset: -2,
21
33
  },
34
+ '&:focus-visible .change-column-drag-handle': {
35
+ opacity: 1,
36
+ },
22
37
  },
23
38
  itemDragging: {
24
39
  opacity: 0.5,
25
40
  cursor: 'grabbing',
26
41
  },
27
42
  dragHandle: {
43
+ position: 'absolute',
44
+ left: 0,
45
+ top: '50%',
46
+ transform: 'translateY(-50%)',
28
47
  color: 'text.secondary',
29
- mr: 1,
30
48
  fontSize: 18,
49
+ opacity: 0,
50
+ transition: 'opacity 0.1s',
51
+ '@media (hover: none)': {
52
+ opacity: 1,
53
+ },
54
+ },
55
+ dragHandleVisible: {
56
+ opacity: 1,
31
57
  },
32
58
  } satisfies Record<string, SxProps<Theme>>