@carto/ps-react-ui 4.15.0 → 4.16.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.
Files changed (82) hide show
  1. package/dist/components.js +786 -749
  2. package/dist/components.js.map +1 -1
  3. package/dist/legend/stores.js +20 -16
  4. package/dist/legend-store-registry-CVYzhR1-.js +464 -0
  5. package/dist/legend-store-registry-CVYzhR1-.js.map +1 -0
  6. package/dist/legend.js +1478 -794
  7. package/dist/legend.js.map +1 -1
  8. package/dist/types/components/responsive-drawer/responsive-drawer.d.ts +2 -9
  9. package/dist/types/legend/components/a11y.d.ts +6 -0
  10. package/dist/types/legend/components/contexts.d.ts +22 -4
  11. package/dist/types/legend/components/index.d.ts +2 -2
  12. package/dist/types/legend/components/legend-actions/legend-actions.d.ts +4 -3
  13. package/dist/types/legend/components/legend-group/legend-group.d.ts +2 -11
  14. package/dist/types/legend/components/legend-group/styles.d.ts +40 -2
  15. package/dist/types/legend/components/legend-group-menu/legend-group-menu-items.d.ts +28 -0
  16. package/dist/types/legend/components/legend-group-menu/legend-group-menu.d.ts +11 -0
  17. package/dist/types/legend/components/legend-opacity/legend-opacity.d.ts +7 -17
  18. package/dist/types/legend/components/legend-opacity/styles.d.ts +11 -6
  19. package/dist/types/legend/components/legend-overflow-menu/legend-overflow-menu.d.ts +12 -0
  20. package/dist/types/legend/components/legend-panel-menu/legend-panel-menu.d.ts +11 -0
  21. package/dist/types/legend/components/legend-row/legend-row.d.ts +4 -11
  22. package/dist/types/legend/components/legend-row/styles.d.ts +36 -1
  23. package/dist/types/legend/components/legend-row-menu/legend-row-menu-items.d.ts +12 -0
  24. package/dist/types/legend/components/legend-row-menu/legend-row-menu.d.ts +4 -10
  25. package/dist/types/legend/components/legend-row-menu/legend-zoom-to.d.ts +3 -8
  26. package/dist/types/legend/components/legend-sortable/contexts.d.ts +7 -0
  27. package/dist/types/legend/components/legend-sortable/legend-sortable.d.ts +11 -0
  28. package/dist/types/legend/components/legend-sortable/sortable-entity.d.ts +27 -0
  29. package/dist/types/legend/components/legend-sortable/sortable-ids.d.ts +6 -0
  30. package/dist/types/legend/components/legend-sortable/styles.d.ts +54 -0
  31. package/dist/types/legend/components/legend-visible-layers/legend-visible-layers.d.ts +7 -0
  32. package/dist/types/legend/components/legend-visible-layers/styles.d.ts +48 -0
  33. package/dist/types/legend/components/run-async-menu-action.d.ts +7 -0
  34. package/dist/types/legend/index.d.ts +53 -6
  35. package/dist/types/legend/provider/labels.d.ts +21 -0
  36. package/dist/types/legend/stores/index.d.ts +1 -1
  37. package/dist/types/legend/stores/selectors.d.ts +31 -0
  38. package/dist/types/legend/stores/types.d.ts +11 -0
  39. package/package.json +3 -3
  40. package/src/components/responsive-drawer/responsive-drawer.test.tsx +138 -0
  41. package/src/components/responsive-drawer/responsive-drawer.tsx +77 -51
  42. package/src/legend/components/a11y.ts +14 -0
  43. package/src/legend/components/contexts.ts +29 -4
  44. package/src/legend/components/index.ts +3 -4
  45. package/src/legend/components/legend-actions/legend-actions.tsx +4 -3
  46. package/src/legend/components/legend-group/legend-group.test.tsx +166 -9
  47. package/src/legend/components/legend-group/legend-group.tsx +88 -49
  48. package/src/legend/components/legend-group/styles.ts +59 -2
  49. package/src/legend/components/legend-group-menu/legend-group-menu-items.tsx +132 -0
  50. package/src/legend/components/legend-group-menu/legend-group-menu.tsx +25 -0
  51. package/src/legend/components/legend-opacity/legend-opacity.tsx +43 -70
  52. package/src/legend/components/legend-opacity/styles.ts +14 -9
  53. package/src/legend/components/legend-overflow-menu/legend-overflow-menu.tsx +84 -0
  54. package/src/legend/components/legend-panel-menu/legend-panel-menu.tsx +23 -0
  55. package/src/legend/components/legend-ramp/legend-ramp-ui.tsx +2 -1
  56. package/src/legend/components/legend-row/legend-row.test.tsx +304 -85
  57. package/src/legend/components/legend-row/legend-row.tsx +73 -50
  58. package/src/legend/components/legend-row/styles.ts +54 -1
  59. package/src/legend/components/legend-row-menu/legend-row-menu-items.tsx +57 -0
  60. package/src/legend/components/legend-row-menu/legend-row-menu.tsx +12 -50
  61. package/src/legend/components/legend-row-menu/legend-zoom-to.tsx +25 -17
  62. package/src/legend/components/legend-sortable/contexts.ts +12 -0
  63. package/src/legend/components/legend-sortable/legend-sortable.test.tsx +144 -0
  64. package/src/legend/components/legend-sortable/legend-sortable.tsx +195 -0
  65. package/src/legend/components/legend-sortable/sortable-entity.tsx +91 -0
  66. package/src/legend/components/legend-sortable/sortable-ids.ts +17 -0
  67. package/src/legend/components/legend-sortable/styles.ts +56 -0
  68. package/src/legend/components/legend-visibility-toggle/legend-visibility-toggle.tsx +14 -8
  69. package/src/legend/components/legend-visible-layers/legend-visible-layers.test.tsx +86 -0
  70. package/src/legend/components/legend-visible-layers/legend-visible-layers.tsx +135 -0
  71. package/src/legend/components/legend-visible-layers/styles.ts +60 -0
  72. package/src/legend/components/run-async-menu-action.ts +20 -0
  73. package/src/legend/index.ts +59 -4
  74. package/src/legend/provider/labels.ts +43 -1
  75. package/src/legend/stores/index.ts +4 -0
  76. package/src/legend/stores/legend-store-registry.ts +60 -0
  77. package/src/legend/stores/legend-store.test.ts +116 -0
  78. package/src/legend/stores/selectors.ts +64 -2
  79. package/src/legend/stores/types.ts +11 -0
  80. package/src/widgets/actions/download/exports.test.tsx +14 -1
  81. package/dist/selectors-DwHj6mE2.js +0 -388
  82. package/dist/selectors-DwHj6mE2.js.map +0 -1
@@ -4,14 +4,7 @@ type ResponsiveDrawerPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bott
4
4
  /** Placement of the panel relative to its anchor (desktop popover only). */
5
5
  export type ResponsiveDrawerPlacement = 'side' | 'overlay';
6
6
  /**
7
- * Resolve the Popover anchor/transform origins for a given corner + placement.
8
- *
9
- * `transformOrigin` (the panel corner that pins to the anchor point) is the same
10
- * for both placements: the panel's own corner matching `position`. `anchorOrigin`
11
- * (the point on the anchor the panel pins to) differs:
12
- * - `'side'` flips horizontally → the panel opens beside the trigger.
13
- * - `'overlay'` uses the same corner → the panel sits **on top of** the anchor
14
- * (e.g. a trigger that's hidden while the panel is open), pinned corner-to-corner.
7
+ * Popover anchor/transform origins. `'overlay'` pins corner-to-corner on the anchor.
15
8
  */
16
9
  export declare function resolveOrigins(position: ResponsiveDrawerPosition, placement: ResponsiveDrawerPlacement): {
17
10
  anchorOrigin: PopoverOrigin;
@@ -22,7 +15,7 @@ export declare function ResponsiveDrawer<T extends {
22
15
  onChangeCollapsed: (collapsed: boolean) => void;
23
16
  position: ResponsiveDrawerPosition;
24
17
  slotProps?: PopoverProps['slotProps'];
25
- }>({ ref, children, collapsed, isMobile, position, sx, slotProps, onChangeCollapsed, modal, placement, }: Required<Pick<T, 'collapsed' | 'onChangeCollapsed' | 'position'>> & Pick<PopoverProps, 'slotProps' | 'sx'> & {
18
+ }>({ ref, children, collapsed, isMobile, position, sx, slotProps, container, onChangeCollapsed, modal, placement, }: Required<Pick<T, 'collapsed' | 'onChangeCollapsed' | 'position'>> & Pick<PopoverProps, 'slotProps' | 'sx' | 'container'> & {
26
19
  ref: HTMLElement | null;
27
20
  isMobile: boolean;
28
21
  children: ReactNode;
@@ -0,0 +1,6 @@
1
+ import { KeyboardEvent } from 'react';
2
+ /**
3
+ * Enter/Space activate a non-native `role='button'` element (the accordion
4
+ * title areas of `Legend.Row` / `Legend.Group`), like a real button.
5
+ */
6
+ export declare function accordionKeyDown(toggle: () => void): (event: KeyboardEvent<HTMLElement>) => void;
@@ -1,13 +1,11 @@
1
1
  /**
2
2
  * Per-row composition context provided by `Legend.Row`. Actions placed inside
3
3
  * the row resolve their target layer from here instead of taking a `layerId`
4
- * prop, and the opacity compound shares its popover state through it (the
5
- * popover anchors to the row's sticky header element to span its full width).
4
+ * prop, and the opacity compound (`Legend.Opacity.Item` / `.Inline`) shares
5
+ * its open state through it.
6
6
  */
7
7
  export interface LegendRowContextValue {
8
8
  layerId: string;
9
- /** The row's sticky header element — anchor for `Legend.Opacity.Popover`. */
10
- headerEl: HTMLElement | null;
11
9
  opacityOpen: boolean;
12
10
  setOpacityOpen: (open: boolean) => void;
13
11
  }
@@ -18,3 +16,23 @@ export declare function useLegendRow(): LegendRowContextValue | null;
18
16
  export declare const LegendGroupContext: import('react').Context<string | null>;
19
17
  /** Nearest `Legend.Group` id, or `null` outside a group. */
20
18
  export declare function useLegendGroupId(): string | null;
19
+ /**
20
+ * Overflow-menu controller for `Legend.RowMenu` / `Legend.GroupMenu` /
21
+ * `Legend.PanelMenu`. Async items (e.g. `Legend.ZoomTo`) use `setBusy` to keep
22
+ * the menu open and show in-item loading feedback, then `close()` when the
23
+ * handler settles. Prefer `runAsyncMenuAction` over calling these by hand.
24
+ */
25
+ export interface LegendMenuController {
26
+ /** Reactive busy flag for UI (spinner / disabled). */
27
+ busy: boolean;
28
+ /**
29
+ * Synchronous busy check (ref-backed) — use this to gate clicks so a second
30
+ * press before React re-renders cannot start another async action.
31
+ */
32
+ isBusy: () => boolean;
33
+ setBusy: (busy: boolean) => void;
34
+ close: () => void;
35
+ }
36
+ export declare const LegendMenuContext: import('react').Context<LegendMenuController | null>;
37
+ /** Nearest overflow-menu controller, or `null` outside a row/group menu. */
38
+ export declare function useLegendMenu(): LegendMenuController | null;
@@ -4,8 +4,8 @@ export { LegendRow } from './legend-row/legend-row';
4
4
  export type { LegendRowProps } from './legend-row/legend-row';
5
5
  export { LegendActions } from './legend-actions/legend-actions';
6
6
  export type { LegendActionsProps } from './legend-actions/legend-actions';
7
- export { LegendRowContext, LegendGroupContext, useLegendRow, useLegendGroupId, } from './contexts';
8
- export type { LegendRowContextValue } from './contexts';
7
+ export { LegendRowContext, LegendGroupContext, LegendMenuContext, useLegendRow, useLegendGroupId, useLegendMenu, } from './contexts';
8
+ export type { LegendRowContextValue, LegendMenuController } from './contexts';
9
9
  export { LegendVisibilityToggle } from './legend-visibility-toggle/legend-visibility-toggle';
10
10
  export { LegendRowMenu } from './legend-row-menu/legend-row-menu';
11
11
  export { LegendZoomTo } from './legend-row-menu/legend-zoom-to';
@@ -5,9 +5,10 @@ export interface LegendActionsProps {
5
5
  /**
6
6
  * Header actions slot for `Legend.Row` / `Legend.Group` (widgets-v2 `Actions`
7
7
  * parity): the wrapper partitions its children by component identity and
8
- * renders this slot inside the header, next to the collapse chevron, wrapped
9
- * in the hover-fade group (`PsLegend-rowFade` in rows, `PsLegend-groupFade`
10
- * in group headers — resolved from the nearest context).
8
+ * renders this slot inside the header, wrapped in the hover-fade group
9
+ * (`PsLegend-rowFade` in rows, `PsLegend-groupFade` in group headers —
10
+ * resolved from the nearest context). Compose the ⋮ menu last so it sits
11
+ * rightmost, per design.
11
12
  *
12
13
  * @experimental This API is new and may change in a future release.
13
14
  */
@@ -1,20 +1,11 @@
1
1
  import { ReactNode } from 'react';
2
2
  export interface LegendGroupProps {
3
3
  groupId: string;
4
- /**
5
- * Composition slots: `<Legend.Actions>` children render in the sticky
6
- * header (hover-fade); everything else is the collapsible body — the
7
- * consumer renders the member `<Legend.Row>`s explicitly (use
8
- * `selectLayersByGroup` to resolve them).
9
- */
4
+ /** `<Legend.Actions>` in the sticky header; member `<Legend.Row>`s in the body. */
10
5
  children?: ReactNode;
11
6
  }
12
7
  /**
13
- * Store-connected group wrapper (widgets-v2 `Wrapper` parity). Renders the
14
- * sticky 48px header — group icon + label from the store, the partitioned
15
- * `<Legend.Actions>` slot, and the collapse chevron — over the collapsible
16
- * body. Provides the group composition context so `Legend.VisibilityToggle`
17
- * placed in the header becomes the tri-state group eye.
8
+ * Store-connected group wrapper. Draggable inside `<Legend.Sortable>`.
18
9
  *
19
10
  * @experimental This API is new and may change in a future release.
20
11
  */
@@ -26,6 +26,19 @@ export declare const styles: {
26
26
  '&:hover .PsLegend-groupFade > *, &:focus-within .PsLegend-groupFade > *': {
27
27
  opacity: number;
28
28
  };
29
+ '& .PsLegend-dragHandle-group > *': {
30
+ opacity: number;
31
+ transition: ({ transitions }: Theme) => string;
32
+ '@media (hover: none)': {
33
+ opacity: number;
34
+ };
35
+ };
36
+ '&:hover .PsLegend-dragHandle-group > *, &:focus-within .PsLegend-dragHandle-group > *': {
37
+ opacity: number;
38
+ };
39
+ };
40
+ groupDragging: {
41
+ opacity: number;
29
42
  };
30
43
  header: {
31
44
  display: "flex";
@@ -38,19 +51,44 @@ export declare const styles: {
38
51
  position: "sticky";
39
52
  top: number;
40
53
  zIndex: number;
41
- backgroundColor: "background.paper";
54
+ backgroundColor: "background.default";
55
+ };
56
+ titleArea: {
57
+ flex: number;
58
+ minWidth: number;
59
+ display: "flex";
60
+ alignItems: "center";
61
+ gap: number;
62
+ cursor: "pointer";
63
+ userSelect: "none";
64
+ '&:focus-visible': {
65
+ outline: string;
66
+ outlineColor: "primary.main";
67
+ outlineOffset: number;
68
+ };
42
69
  };
43
70
  groupIcon: {
44
71
  display: "flex";
45
72
  color: "text.secondary";
46
73
  };
47
74
  label: {
48
- flex: number;
49
75
  minWidth: number;
50
76
  overflow: "hidden";
51
77
  textOverflow: "ellipsis";
52
78
  whiteSpace: "nowrap";
53
79
  };
80
+ chevron: {
81
+ fontSize: number;
82
+ color: "text.secondary";
83
+ flexShrink: number;
84
+ transition: ({ transitions }: Theme) => string;
85
+ '@media (hover: none)': {
86
+ display: "none";
87
+ };
88
+ };
89
+ chevronCollapsed: {
90
+ transform: "rotate(-90deg)";
91
+ };
54
92
  actions: {
55
93
  display: "flex";
56
94
  alignItems: "center";
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Show only this group (hide all other layers).
3
+ *
4
+ * @experimental This API is new and may change in a future release.
5
+ */
6
+ export declare function LegendShowOnlyGroup(): import("react/jsx-runtime").JSX.Element | null;
7
+ /**
8
+ * Show every layer (panel-level `Legend.PanelMenu` only).
9
+ *
10
+ * @experimental This API is new and may change in a future release.
11
+ */
12
+ export declare function LegendShowAllGroups(): import("react/jsx-runtime").JSX.Element | null;
13
+ /**
14
+ * Collapse / expand all groups (panel-level `Legend.PanelMenu` only).
15
+ *
16
+ * @experimental This API is new and may change in a future release.
17
+ */
18
+ export declare function LegendCollapseAllGroups(): import("react/jsx-runtime").JSX.Element | null;
19
+ export interface LegendZoomToGroupProps {
20
+ /** Fit viewport to the group; may return a Promise for async menu feedback. */
21
+ onZoomTo: (groupId: string) => void | Promise<void>;
22
+ }
23
+ /**
24
+ * Zoom-to-group menu item for `Legend.GroupMenu`. Self-hides when all members are hidden.
25
+ *
26
+ * @experimental This API is new and may change in a future release.
27
+ */
28
+ export declare function LegendZoomToGroup({ onZoomTo }: LegendZoomToGroupProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,11 @@
1
+ import { ReactNode } from 'react';
2
+ export interface LegendGroupMenuProps {
3
+ /** Menu items; async items use `stopPropagation` + `runAsyncMenuAction`. */
4
+ children?: ReactNode;
5
+ }
6
+ /**
7
+ * Overflow (⋮) menu for a group header. Renders nothing outside a `Legend.Group`.
8
+ *
9
+ * @experimental This API is new and may change in a future release.
10
+ */
11
+ export declare function LegendGroupMenu({ children }: LegendGroupMenuProps): import("react/jsx-runtime").JSX.Element;
@@ -1,32 +1,22 @@
1
1
  /**
2
- * Opacity header action for a layer row: a checkerboard icon button, pinned
3
- * `.active` in the hover-fade group while opacity ≠ 1 or the popover is open,
4
- * disabled while the layer is hidden. Opens `Legend.Opacity.Popover` through
5
- * the row context. Place it inside `<Legend.Actions>` of a `Legend.Row`.
2
+ * Opacity menu item toggles the row's inline bar; self-hides when hidden or no `opacityControl`.
6
3
  *
7
4
  * @experimental This API is new and may change in a future release.
8
5
  */
9
- declare function OpacityTrigger(): import("react/jsx-runtime").JSX.Element | null;
6
+ declare function OpacityItem(): import("react/jsx-runtime").JSX.Element | null;
10
7
  /**
11
- * The opacity editing surface a popover **anchored to the row's sticky
12
- * header, spanning its full width**, holding a slider (writes `setOpacity`
13
- * only on release, widgets-v2 parity) and a percent input (commits live as
14
- * soon as the draft parses, clamped 0–100; never ellipsizes "100 %").
15
- * Declare it anywhere inside the `Legend.Row` (it renders in a portal);
16
- * open it with `Legend.Opacity.Trigger`.
8
+ * Inline opacity bar (first body child of `Legend.Row`). Slider commits on release; input commits live.
17
9
  *
18
10
  * @experimental This API is new and may change in a future release.
19
11
  */
20
- declare function OpacityPopover(): import("react/jsx-runtime").JSX.Element | null;
12
+ declare function OpacityInline(): import("react/jsx-runtime").JSX.Element | null;
21
13
  /**
22
- * Compound opacity control for layer rows (widgets-v2 `FullScreen` parity):
23
- * `Trigger` lives in the header `<Legend.Actions>`, `Popover` anywhere in the
24
- * row body — they share state through the row context.
14
+ * Compound opacity control: `Item` in the row menu, `Inline` in the body.
25
15
  *
26
16
  * @experimental This API is new and may change in a future release.
27
17
  */
28
18
  export declare const LegendOpacity: {
29
- Trigger: typeof OpacityTrigger;
30
- Popover: typeof OpacityPopover;
19
+ Item: typeof OpacityItem;
20
+ Inline: typeof OpacityInline;
31
21
  };
32
22
  export {};
@@ -1,14 +1,19 @@
1
- import { Theme } from '@mui/material';
2
1
  export declare const styles: {
3
- triggerWrap: {
4
- display: "inline-flex";
2
+ inline: {
3
+ display: "flex";
4
+ flexDirection: "column";
5
+ gap: number;
6
+ borderRadius: number;
7
+ };
8
+ inlineHeader: {
9
+ display: "flex";
10
+ alignItems: "center";
11
+ justifyContent: "space-between";
5
12
  };
6
- popover: {
13
+ inlineControls: {
7
14
  display: "flex";
8
15
  alignItems: "center";
9
16
  gap: number;
10
- padding: ({ spacing }: Theme) => string;
11
- width: number;
12
17
  };
13
18
  slider: {
14
19
  flex: number;
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+ export interface LegendOverflowMenuProps {
3
+ /** Menu items; async items use `stopPropagation` + `runAsyncMenuAction`. */
4
+ children?: ReactNode;
5
+ /** When `false`, render nothing. Defaults to `true`. */
6
+ gate?: boolean;
7
+ /** `aria-label` for the ⋮ trigger. */
8
+ ariaLabel: string;
9
+ /** Extra `.active` pin (e.g. inline opacity bar open). */
10
+ active?: boolean;
11
+ }
12
+ export declare function LegendOverflowMenu({ children, gate, ariaLabel, active, }: LegendOverflowMenuProps): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,11 @@
1
+ import { ReactNode } from 'react';
2
+ export interface LegendPanelMenuProps {
3
+ /** Menu items; async items use `stopPropagation` + `runAsyncMenuAction`. */
4
+ children?: ReactNode;
5
+ }
6
+ /**
7
+ * Overflow (⋮) menu for the panel header (no row/group context).
8
+ *
9
+ * @experimental This API is new and may change in a future release.
10
+ */
11
+ export declare function LegendPanelMenu({ children }: LegendPanelMenuProps): import("react/jsx-runtime").JSX.Element;
@@ -2,21 +2,14 @@ import { ReactNode } from 'react';
2
2
  export interface LegendRowProps {
3
3
  layerId: string;
4
4
  /**
5
- * Composition slots: `<Legend.Actions>` children render in the sticky
6
- * header next to the collapse chevron (hover-fade); everything else renders
7
- * in the collapsible body, followed by the layer's `helperText` footer.
5
+ * `<Legend.Actions>` in the sticky header; body children + `helperText` footer.
6
+ * Place `<Legend.Opacity.Inline />` first in the body.
8
7
  */
9
8
  children?: ReactNode;
10
9
  }
11
10
  /**
12
- * Store-connected layer-row wrapper (widgets-v2 `Wrapper` parity). Renders
13
- * the sticky header — title + subtitle from the store with a smart-truncating
14
- * tooltip, the partitioned `<Legend.Actions>` slot, and the collapse chevron —
15
- * over the collapsible body. Provides the row composition context so actions
16
- * (`Legend.VisibilityToggle`, `Legend.Opacity.*`, `Legend.RowMenu`,
17
- * `Legend.ConfigSelect`, `Legend.Item`) resolve the layer without props.
18
- * When the layer is hidden the body is force-collapsed, the content dims,
19
- * and the chevron is disabled.
11
+ * Store-connected layer row. Provides row context for actions; hidden layers
12
+ * force-collapse the body.
20
13
  *
21
14
  * @experimental This API is new and may change in a future release.
22
15
  */
@@ -3,6 +3,7 @@ export declare const styles: {
3
3
  row: {
4
4
  display: "flex";
5
5
  flexDirection: "column";
6
+ position: "relative";
6
7
  '& + &': {
7
8
  borderTop: string;
8
9
  borderColor: "divider";
@@ -23,6 +24,19 @@ export declare const styles: {
23
24
  '&:hover .PsLegend-value, &:focus-within .PsLegend-value': {
24
25
  opacity: number;
25
26
  };
27
+ '& .PsLegend-dragHandle-layer > *': {
28
+ opacity: number;
29
+ transition: ({ transitions }: Theme) => string;
30
+ '@media (hover: none)': {
31
+ opacity: number;
32
+ };
33
+ };
34
+ '&:hover .PsLegend-dragHandle-layer > *, &:focus-within .PsLegend-dragHandle-layer > *': {
35
+ opacity: number;
36
+ };
37
+ };
38
+ rowDragging: {
39
+ opacity: number;
26
40
  };
27
41
  header: {
28
42
  display: "flex";
@@ -40,18 +54,39 @@ export declare const styles: {
40
54
  display: "flex";
41
55
  flexDirection: "column";
42
56
  };
57
+ titleBoxInteractive: {
58
+ cursor: "pointer";
59
+ userSelect: "none";
60
+ '&:focus-visible': {
61
+ outline: string;
62
+ outlineColor: "primary.main";
63
+ outlineOffset: number;
64
+ };
65
+ };
43
66
  titleLine: {
44
67
  minHeight: number;
45
68
  display: "flex";
46
69
  alignItems: "center";
70
+ gap: number;
47
71
  };
48
72
  title: {
49
- flex: number;
50
73
  minWidth: number;
51
74
  overflow: "hidden";
52
75
  textOverflow: "ellipsis";
53
76
  whiteSpace: "nowrap";
54
77
  };
78
+ chevron: {
79
+ fontSize: number;
80
+ color: "text.secondary";
81
+ flexShrink: number;
82
+ transition: ({ transitions }: Theme) => string;
83
+ '@media (hover: none)': {
84
+ display: "none";
85
+ };
86
+ };
87
+ chevronCollapsed: {
88
+ transform: "rotate(-90deg)";
89
+ };
55
90
  actions: {
56
91
  minHeight: number;
57
92
  display: "flex";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Show only this layer (and hide siblings in the same bucket).
3
+ *
4
+ * @experimental This API is new and may change in a future release.
5
+ */
6
+ export declare function LegendShowOnlyLayer(): import("react/jsx-runtime").JSX.Element | null;
7
+ /**
8
+ * Show all layers in the enclosing group, or all ungrouped layers at row scope.
9
+ *
10
+ * @experimental This API is new and may change in a future release.
11
+ */
12
+ export declare function LegendShowAllLayers(): import("react/jsx-runtime").JSX.Element | null;
@@ -1,18 +1,12 @@
1
1
  import { ReactNode } from 'react';
2
2
  export interface LegendRowMenuProps {
3
- /**
4
- * The menu items — composed by the consumer (e.g. `<Legend.ZoomTo>` or any
5
- * MUI `MenuItem`). A click on any item bubbles to the menu and closes it;
6
- * an item that must keep the menu open should `event.stopPropagation()`.
7
- */
3
+ /** Menu items; async items use `stopPropagation` + `runAsyncMenuAction`. */
8
4
  children?: ReactNode;
9
5
  }
10
6
  /**
11
- * Agnostic overflow (⋮) menu shell for a layer row the items are passed as
12
- * children, like `Legend.Actions`. Renders nothing without children, outside
13
- * a row, or while the layer is hidden (a hidden row keeps only its
14
- * visibility eye + collapse chevron).
7
+ * Overflow (⋮) menu for a layer row. Pins `.active` while open, busy, or the
8
+ * inline opacity bar is open. Items self-gate when hidden.
15
9
  *
16
10
  * @experimental This API is new and may change in a future release.
17
11
  */
18
- export declare function LegendRowMenu({ children }: LegendRowMenuProps): import("react/jsx-runtime").JSX.Element | null;
12
+ export declare function LegendRowMenu({ children }: LegendRowMenuProps): import("react/jsx-runtime").JSX.Element;
@@ -1,14 +1,9 @@
1
1
  export interface LegendZoomToProps {
2
- /**
3
- * Fit the map viewport to the layer. The handler lives at the composition
4
- * site (not the Provider) — each menu can wire its own behavior.
5
- */
6
- onZoomTo: (layerId: string) => void;
2
+ /** Fit viewport to the layer; may return a Promise for async menu feedback. */
3
+ onZoomTo: (layerId: string) => void | Promise<void>;
7
4
  }
8
5
  /**
9
- * "Zoom to" menu item for `Legend.RowMenu` resolves its layer from the
10
- * enclosing `Legend.Row` context and calls the `onZoomTo` it was composed
11
- * with. The click bubbles to the menu, which closes itself.
6
+ * Zoom-to-layer menu item for `Legend.RowMenu`. Self-hides when the layer is hidden.
12
7
  *
13
8
  * @experimental This API is new and may change in a future release.
14
9
  */
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Present (true) below a `<Legend.Sortable>` wrapper — `Legend.Group` /
3
+ * `Legend.Row` read it to become draggable (sortable shell + drag handle).
4
+ */
5
+ export declare const LegendSortableContext: import('react').Context<boolean>;
6
+ /** Whether the nearest legend composition is wrapped in `Legend.Sortable`. */
7
+ export declare function useLegendSortable(): boolean;
@@ -0,0 +1,11 @@
1
+ import { ReactNode } from 'react';
2
+ export interface LegendSortableProps {
3
+ /** Panel content (`Legend.Group` / ungrouped `Legend.Row` children). */
4
+ children?: ReactNode;
5
+ }
6
+ /**
7
+ * Opt-in DnD reordering for legend groups and layers (within bucket only).
8
+ *
9
+ * @experimental This API is new and may change in a future release.
10
+ */
11
+ export declare function LegendSortable({ children }: LegendSortableProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,27 @@
1
+ import { CSSProperties, ReactElement, ReactNode } from 'react';
2
+ import { SortableKind } from './sortable-ids';
3
+ /** What `SortableEntity` hands to its render callback. */
4
+ export interface SortableEntityRenderProps {
5
+ /** Attach to the entity's existing root element. */
6
+ rootRef: (el: HTMLElement | null) => void;
7
+ /** Sort transform/transition for the root (inline, per-frame values). */
8
+ rootStyle: CSSProperties;
9
+ /** The original is dimmed in place while its overlay clone is dragged. */
10
+ dragging: boolean;
11
+ /** The drag handle — absolutely positioned, place anywhere in the header. */
12
+ handle: ReactNode;
13
+ }
14
+ export interface SortableEntityProps {
15
+ kind: SortableKind;
16
+ id: string;
17
+ render: (sortable: SortableEntityRenderProps) => ReactElement;
18
+ }
19
+ /**
20
+ * Sortable shell for a legend group/row. Render-prop (instead of a wrapper
21
+ * element) so the entity keeps its own root — sibling CSS like the `& + &`
22
+ * dividers keeps working. Hosts `useSortable` and builds the drag handle
23
+ * (keyboard-activatable, labelled `labels.reorder`).
24
+ *
25
+ * @experimental This API is new and may change in a future release.
26
+ */
27
+ export declare function SortableEntity({ kind, id, render }: SortableEntityProps): ReactElement<unknown, string | import('react').JSXElementConstructor<any>>;
@@ -0,0 +1,6 @@
1
+ export type SortableKind = 'group' | 'layer';
2
+ export declare const toSortableId: (kind: SortableKind, id: string) => string;
3
+ export declare function parseSortableId(sortableId: string): {
4
+ kind: SortableKind;
5
+ id: string;
6
+ } | null;
@@ -0,0 +1,54 @@
1
+ import { Theme } from '@mui/material';
2
+ export declare const styles: {
3
+ handleSlot: {
4
+ position: "absolute";
5
+ zIndex: number;
6
+ display: "flex";
7
+ alignItems: "center";
8
+ justifyContent: "center";
9
+ height: number;
10
+ };
11
+ handleSlotLayer: {
12
+ right: number;
13
+ };
14
+ handleSlotGroup: {
15
+ right: number;
16
+ };
17
+ handle: {
18
+ padding: string;
19
+ cursor: "grab";
20
+ touchAction: "none";
21
+ color: "text.secondary";
22
+ '& .MuiSvgIcon-root': {
23
+ fontSize: number;
24
+ };
25
+ '&:active': {
26
+ cursor: "grabbing";
27
+ };
28
+ '&:hover': {
29
+ backgroundColor: "transparent";
30
+ };
31
+ };
32
+ overlay: {
33
+ display: "flex";
34
+ alignItems: "center";
35
+ gap: number;
36
+ padding: ({ spacing }: Theme) => string;
37
+ backgroundColor: "background.paper";
38
+ borderRadius: number;
39
+ boxShadow: number;
40
+ height: string;
41
+ maxWidth: string;
42
+ overflow: "hidden";
43
+ };
44
+ overlayIcon: {
45
+ display: "flex";
46
+ color: "text.secondary";
47
+ };
48
+ overlayLabel: {
49
+ minWidth: number;
50
+ overflow: "hidden";
51
+ textOverflow: "ellipsis";
52
+ whiteSpace: "nowrap";
53
+ };
54
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Panel checklist of visible layers — each entry hides its layer; the menu
3
+ * closes when nothing remains to list.
4
+ *
5
+ * @experimental This API is new and may change in a future release.
6
+ */
7
+ export declare function LegendVisibleLayers(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,48 @@
1
+ import { Theme } from '@mui/material';
2
+ export declare const styles: {
3
+ triggerWrap: {
4
+ display: "inline-flex";
5
+ };
6
+ paper: {
7
+ width: number;
8
+ maxHeight: number;
9
+ paddingBottom: number;
10
+ };
11
+ stickyHeader: {
12
+ position: "sticky";
13
+ top: number;
14
+ zIndex: number;
15
+ backgroundColor: "background.paper";
16
+ padding: number;
17
+ marginBlockEnd: number;
18
+ lineHeight: string;
19
+ borderBottom: string;
20
+ borderColor: "divider";
21
+ };
22
+ groupCaption: {
23
+ display: "block";
24
+ padding: ({ spacing }: Theme) => string;
25
+ };
26
+ item: {
27
+ minHeight: number;
28
+ display: "flex";
29
+ alignItems: "center";
30
+ justifyContent: "space-between";
31
+ gap: number;
32
+ padding: ({ spacing }: Theme) => string;
33
+ };
34
+ itemName: {
35
+ minWidth: number;
36
+ overflow: "hidden";
37
+ textOverflow: "ellipsis";
38
+ whiteSpace: "nowrap";
39
+ };
40
+ eye: {
41
+ fontSize: number;
42
+ color: "action.active";
43
+ flexShrink: number;
44
+ };
45
+ divider: {
46
+ marginY: number;
47
+ };
48
+ };