@carto/ps-react-ui 4.14.1 → 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 (116) hide show
  1. package/dist/chat.js +494 -466
  2. package/dist/chat.js.map +1 -1
  3. package/dist/components.js +837 -774
  4. package/dist/components.js.map +1 -1
  5. package/dist/legend/stores.js +20 -16
  6. package/dist/legend-store-registry-CVYzhR1-.js +464 -0
  7. package/dist/legend-store-registry-CVYzhR1-.js.map +1 -0
  8. package/dist/legend.js +1478 -794
  9. package/dist/legend.js.map +1 -1
  10. package/dist/markdown-DdqANCiN.js +102 -0
  11. package/dist/markdown-DdqANCiN.js.map +1 -0
  12. package/dist/markdown-content-Dk2DSgbf.js +10287 -0
  13. package/dist/markdown-content-Dk2DSgbf.js.map +1 -0
  14. package/dist/types/chat/bubbles/chat-agent-message-markdown.d.ts +12 -0
  15. package/dist/types/chat/bubbles/chat-agent-message.d.ts +9 -0
  16. package/dist/types/chat/bubbles/index.d.ts +1 -0
  17. package/dist/types/chat/index.d.ts +2 -1
  18. package/dist/types/chat/types.d.ts +9 -0
  19. package/dist/types/components/index.d.ts +2 -1
  20. package/dist/types/components/lasso-tool/message.d.ts +7 -0
  21. package/dist/types/components/lasso-tool/types.d.ts +17 -2
  22. package/dist/types/components/responsive-drawer/responsive-drawer.d.ts +2 -9
  23. package/dist/types/legend/components/a11y.d.ts +6 -0
  24. package/dist/types/legend/components/contexts.d.ts +22 -4
  25. package/dist/types/legend/components/index.d.ts +2 -2
  26. package/dist/types/legend/components/legend-actions/legend-actions.d.ts +4 -3
  27. package/dist/types/legend/components/legend-group/legend-group.d.ts +2 -11
  28. package/dist/types/legend/components/legend-group/styles.d.ts +40 -2
  29. package/dist/types/legend/components/legend-group-menu/legend-group-menu-items.d.ts +28 -0
  30. package/dist/types/legend/components/legend-group-menu/legend-group-menu.d.ts +11 -0
  31. package/dist/types/legend/components/legend-opacity/legend-opacity.d.ts +7 -17
  32. package/dist/types/legend/components/legend-opacity/styles.d.ts +11 -6
  33. package/dist/types/legend/components/legend-overflow-menu/legend-overflow-menu.d.ts +12 -0
  34. package/dist/types/legend/components/legend-panel-menu/legend-panel-menu.d.ts +11 -0
  35. package/dist/types/legend/components/legend-row/legend-row.d.ts +4 -11
  36. package/dist/types/legend/components/legend-row/styles.d.ts +36 -1
  37. package/dist/types/legend/components/legend-row-menu/legend-row-menu-items.d.ts +12 -0
  38. package/dist/types/legend/components/legend-row-menu/legend-row-menu.d.ts +4 -10
  39. package/dist/types/legend/components/legend-row-menu/legend-zoom-to.d.ts +3 -8
  40. package/dist/types/legend/components/legend-sortable/contexts.d.ts +7 -0
  41. package/dist/types/legend/components/legend-sortable/legend-sortable.d.ts +11 -0
  42. package/dist/types/legend/components/legend-sortable/sortable-entity.d.ts +27 -0
  43. package/dist/types/legend/components/legend-sortable/sortable-ids.d.ts +6 -0
  44. package/dist/types/legend/components/legend-sortable/styles.d.ts +54 -0
  45. package/dist/types/legend/components/legend-visible-layers/legend-visible-layers.d.ts +7 -0
  46. package/dist/types/legend/components/legend-visible-layers/styles.d.ts +48 -0
  47. package/dist/types/legend/components/run-async-menu-action.d.ts +7 -0
  48. package/dist/types/legend/index.d.ts +53 -6
  49. package/dist/types/legend/provider/labels.d.ts +21 -0
  50. package/dist/types/legend/stores/index.d.ts +1 -1
  51. package/dist/types/legend/stores/selectors.d.ts +31 -0
  52. package/dist/types/legend/stores/types.d.ts +11 -0
  53. package/dist/types/widgets-v2/markdown/markdown-content.d.ts +7 -1
  54. package/dist/widgets-v2/markdown.js +9 -8
  55. package/dist/widgets-v2/markdown.js.map +1 -1
  56. package/dist/widgets-v2.js +23 -22
  57. package/dist/widgets-v2.js.map +1 -1
  58. package/package.json +5 -4
  59. package/src/chat/bubbles/chat-agent-message-markdown.test.tsx +38 -0
  60. package/src/chat/bubbles/chat-agent-message-markdown.tsx +34 -0
  61. package/src/chat/bubbles/chat-agent-message.test.tsx +12 -0
  62. package/src/chat/bubbles/chat-agent-message.tsx +21 -1
  63. package/src/chat/bubbles/index.ts +1 -0
  64. package/src/chat/index.ts +2 -0
  65. package/src/chat/types.ts +10 -0
  66. package/src/components/index.ts +2 -0
  67. package/src/components/lasso-tool/message.tsx +36 -0
  68. package/src/components/lasso-tool/types.ts +20 -1
  69. package/src/components/responsive-drawer/responsive-drawer.test.tsx +138 -0
  70. package/src/components/responsive-drawer/responsive-drawer.tsx +77 -51
  71. package/src/legend/components/a11y.ts +14 -0
  72. package/src/legend/components/contexts.ts +29 -4
  73. package/src/legend/components/index.ts +3 -4
  74. package/src/legend/components/legend-actions/legend-actions.tsx +4 -3
  75. package/src/legend/components/legend-group/legend-group.test.tsx +166 -9
  76. package/src/legend/components/legend-group/legend-group.tsx +88 -49
  77. package/src/legend/components/legend-group/styles.ts +59 -2
  78. package/src/legend/components/legend-group-menu/legend-group-menu-items.tsx +132 -0
  79. package/src/legend/components/legend-group-menu/legend-group-menu.tsx +25 -0
  80. package/src/legend/components/legend-opacity/legend-opacity.tsx +43 -70
  81. package/src/legend/components/legend-opacity/styles.ts +14 -9
  82. package/src/legend/components/legend-overflow-menu/legend-overflow-menu.tsx +84 -0
  83. package/src/legend/components/legend-panel-menu/legend-panel-menu.tsx +23 -0
  84. package/src/legend/components/legend-ramp/legend-ramp-ui.tsx +2 -1
  85. package/src/legend/components/legend-row/legend-row.test.tsx +304 -85
  86. package/src/legend/components/legend-row/legend-row.tsx +73 -50
  87. package/src/legend/components/legend-row/styles.ts +54 -1
  88. package/src/legend/components/legend-row-menu/legend-row-menu-items.tsx +57 -0
  89. package/src/legend/components/legend-row-menu/legend-row-menu.tsx +12 -50
  90. package/src/legend/components/legend-row-menu/legend-zoom-to.tsx +25 -17
  91. package/src/legend/components/legend-sortable/contexts.ts +12 -0
  92. package/src/legend/components/legend-sortable/legend-sortable.test.tsx +144 -0
  93. package/src/legend/components/legend-sortable/legend-sortable.tsx +195 -0
  94. package/src/legend/components/legend-sortable/sortable-entity.tsx +91 -0
  95. package/src/legend/components/legend-sortable/sortable-ids.ts +17 -0
  96. package/src/legend/components/legend-sortable/styles.ts +56 -0
  97. package/src/legend/components/legend-visibility-toggle/legend-visibility-toggle.tsx +14 -8
  98. package/src/legend/components/legend-visible-layers/legend-visible-layers.test.tsx +86 -0
  99. package/src/legend/components/legend-visible-layers/legend-visible-layers.tsx +135 -0
  100. package/src/legend/components/legend-visible-layers/styles.ts +60 -0
  101. package/src/legend/components/run-async-menu-action.ts +20 -0
  102. package/src/legend/index.ts +59 -4
  103. package/src/legend/provider/labels.ts +43 -1
  104. package/src/legend/stores/index.ts +4 -0
  105. package/src/legend/stores/legend-store-registry.ts +60 -0
  106. package/src/legend/stores/legend-store.test.ts +116 -0
  107. package/src/legend/stores/selectors.ts +64 -2
  108. package/src/legend/stores/types.ts +11 -0
  109. package/src/widgets/actions/download/exports.test.tsx +14 -1
  110. package/src/widgets-v2/markdown/markdown-content.test.tsx +10 -0
  111. package/src/widgets-v2/markdown/markdown-content.tsx +9 -0
  112. package/src/widgets-v2/wrapper/widget-wrapper.tsx +4 -1
  113. package/dist/markdown-BD1jcknS.js +0 -8326
  114. package/dist/markdown-BD1jcknS.js.map +0 -1
  115. package/dist/selectors-DwHj6mE2.js +0 -388
  116. package/dist/selectors-DwHj6mE2.js.map +0 -1
@@ -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
+ };
@@ -0,0 +1,7 @@
1
+ import { LegendMenuController } from './contexts';
2
+ /**
3
+ * Run an async menu action with busy gating. Uses `isBusy()` (ref-backed) so a
4
+ * second click before React re-renders cannot fire the handler twice. Keeps
5
+ * the menu open while pending, then clears busy and closes when it settles.
6
+ */
7
+ export declare function runAsyncMenuAction(menu: LegendMenuController, action: () => void | Promise<void>): Promise<void>;
@@ -5,6 +5,12 @@ import { LegendActions } from './components/legend-actions/legend-actions';
5
5
  import { LegendVisibilityToggle } from './components/legend-visibility-toggle/legend-visibility-toggle';
6
6
  import { LegendRowMenu } from './components/legend-row-menu/legend-row-menu';
7
7
  import { LegendZoomTo } from './components/legend-row-menu/legend-zoom-to';
8
+ import { LegendShowOnlyLayer, LegendShowAllLayers } from './components/legend-row-menu/legend-row-menu-items';
9
+ import { LegendGroupMenu } from './components/legend-group-menu/legend-group-menu';
10
+ import { LegendShowOnlyGroup, LegendShowAllGroups, LegendCollapseAllGroups, LegendZoomToGroup } from './components/legend-group-menu/legend-group-menu-items';
11
+ import { LegendPanelMenu } from './components/legend-panel-menu/legend-panel-menu';
12
+ import { LegendVisibleLayers } from './components/legend-visible-layers/legend-visible-layers';
13
+ import { LegendSortable } from './components/legend-sortable/legend-sortable';
8
14
  import { LegendConfigSelect } from './components/legend-config-select/legend-config-select';
9
15
  import { LegendItem } from './components/legend-item/legend-item';
10
16
  import { LegendItemUI } from './components/legend-item/legend-item-ui';
@@ -22,31 +28,58 @@ import { LegendIconUI } from './components/legend-icon/legend-icon-ui';
22
28
  * children — `<Legend.Actions>` renders in the sticky header (hover-fade),
23
29
  * everything else in the collapsible body.
24
30
  *
31
+ * Collapse is the title row itself (whole header minus the actions), with an
32
+ * informative chevron that touch devices don't show. The ⋮ menus are
33
+ * extensible shells: compose the built-in items and append your own
34
+ * `MenuItem`s. The built-in items are **self-contained** — their effect is
35
+ * implemented inside the component through the store's primitive setters, so
36
+ * they mount with zero wiring; only `ZoomTo`/`ZoomToGroup` take an `onZoomTo`
37
+ * handler (zooming is the map's concern). Pass an async handler to keep the
38
+ * menu open with in-item loading feedback until it settles.
39
+ *
25
40
  * ```tsx
26
41
  * import { Legend } from '@carto/ps-react-ui/legend'
27
42
  *
28
43
  * <Legend.Provider id='map-legend' layers={layers} groups={groups}>
44
+ * // Panel-wide actions (Show all groups / Collapse all) live once here,
45
+ * // not repeated per group.
46
+ * <Legend.PanelMenu>
47
+ * <Legend.ShowAllGroups />
48
+ * <Legend.CollapseAllGroups />
49
+ * </Legend.PanelMenu>
50
+ *
29
51
  * <Legend.Group groupId='demographics'>
30
52
  * <Legend.Actions>
31
53
  * <Legend.VisibilityToggle /> // tri-state group eye
54
+ * <Legend.GroupMenu> // ⋮ (rightmost)
55
+ * <Legend.ShowOnlyGroup />
56
+ * <Legend.ShowAllLayers /> // this group's members
57
+ * <Legend.ZoomToGroup onZoomTo={zoomToGroup} />
58
+ * </Legend.GroupMenu>
32
59
  * </Legend.Actions>
33
60
  * <Legend.Row layerId='income'>
34
- * // Actions read L→R: options · opacity · visibility
61
+ * // Actions read L→R: eye · options
35
62
  * <Legend.Actions>
63
+ * <Legend.VisibilityToggle /> // layer eye
36
64
  * <Legend.RowMenu>
65
+ * <Legend.ShowOnlyLayer />
66
+ * <Legend.Opacity.Item />
37
67
  * <Legend.ZoomTo onZoomTo={zoomTo} />
38
68
  * </Legend.RowMenu>
39
- * <Legend.Opacity.Trigger />
40
- * <Legend.VisibilityToggle /> // layer eye
41
69
  * </Legend.Actions>
70
+ * <Legend.Opacity.Inline /> // bar between header and body
42
71
  * <Legend.ConfigSelect />
43
72
  * <Legend.Item />
44
- * <Legend.Opacity.Popover /> // anchors to the row header
45
73
  * </Legend.Row>
46
74
  * </Legend.Group>
47
75
  * </Legend.Provider>
48
76
  * ```
49
77
  *
78
+ * `Legend.ShowAllLayers` is composed at whichever site it targets: directly
79
+ * in a `Legend.GroupMenu` for that group's members (as above), or in an
80
+ * ungrouped row's `Legend.RowMenu` for the loose-layer bucket — it resolves
81
+ * its own scope from context either way.
82
+ *
50
83
  * @experimental This API is new and may change in a future release.
51
84
  */
52
85
  export declare const Legend: {
@@ -54,12 +87,22 @@ export declare const Legend: {
54
87
  readonly Group: typeof LegendGroup;
55
88
  readonly Row: typeof LegendRow;
56
89
  readonly Actions: typeof LegendActions;
90
+ readonly Sortable: typeof LegendSortable;
57
91
  readonly VisibilityToggle: typeof LegendVisibilityToggle;
58
92
  readonly RowMenu: typeof LegendRowMenu;
59
93
  readonly ZoomTo: typeof LegendZoomTo;
94
+ readonly ShowOnlyLayer: typeof LegendShowOnlyLayer;
95
+ readonly ShowAllLayers: typeof LegendShowAllLayers;
96
+ readonly GroupMenu: typeof LegendGroupMenu;
97
+ readonly ShowOnlyGroup: typeof LegendShowOnlyGroup;
98
+ readonly ShowAllGroups: typeof LegendShowAllGroups;
99
+ readonly CollapseAllGroups: typeof LegendCollapseAllGroups;
100
+ readonly ZoomToGroup: typeof LegendZoomToGroup;
101
+ readonly PanelMenu: typeof LegendPanelMenu;
102
+ readonly VisibleLayers: typeof LegendVisibleLayers;
60
103
  readonly Opacity: {
61
- Trigger: () => import("react/jsx-runtime").JSX.Element | null;
62
- Popover: () => import("react/jsx-runtime").JSX.Element | null;
104
+ Item: () => import("react/jsx-runtime").JSX.Element | null;
105
+ Inline: () => import("react/jsx-runtime").JSX.Element | null;
63
106
  };
64
107
  readonly ConfigSelect: typeof LegendConfigSelect;
65
108
  readonly Item: typeof LegendItem;
@@ -75,9 +118,13 @@ export type { LegendProviderProps, LegendLabels } from './provider';
75
118
  export type { LegendGroupProps } from './components/legend-group/legend-group';
76
119
  export type { LegendRowProps } from './components/legend-row/legend-row';
77
120
  export type { LegendActionsProps } from './components/legend-actions/legend-actions';
121
+ export type { LegendSortableProps } from './components/legend-sortable/legend-sortable';
78
122
  export type { LegendVisibilityToggleProps } from './components/legend-visibility-toggle/legend-visibility-toggle';
79
123
  export type { LegendRowMenuProps } from './components/legend-row-menu/legend-row-menu';
80
124
  export type { LegendZoomToProps } from './components/legend-row-menu/legend-zoom-to';
125
+ export type { LegendGroupMenuProps } from './components/legend-group-menu/legend-group-menu';
126
+ export type { LegendZoomToGroupProps } from './components/legend-group-menu/legend-group-menu-items';
127
+ export type { LegendPanelMenuProps } from './components/legend-panel-menu/legend-panel-menu';
81
128
  export type { LegendRowContextValue } from './components/contexts';
82
129
  export type { LegendItemUIProps } from './components/legend-item/legend-item-ui';
83
130
  export type { LegendSwatchProps } from './components/legend-swatch/legend-swatch';
@@ -10,12 +10,33 @@ export interface LegendLabels {
10
10
  showLayer: string;
11
11
  layerOptions: string;
12
12
  zoomTo: string;
13
+ /** In-flight label for Zoom to layer / Zoom to group. */
14
+ loading: string;
15
+ showOnlyLayer: string;
16
+ showAllLayers: string;
13
17
  hideGroup: string;
14
18
  showGroup: string;
15
19
  expandGroup: string;
16
20
  collapseGroup: string;
21
+ groupOptions: string;
22
+ showOnlyGroup: string;
23
+ showAllGroups: string;
24
+ collapseAllGroups: string;
25
+ expandAllGroups: string;
26
+ zoomToGroup: string;
27
+ panelOptions: string;
28
+ /** Sticky header of the visible-layers summary; the count is appended. */
29
+ enabledLayers: string;
30
+ /** Tooltip of the visible-layers summary trigger. */
31
+ toggleEnabledLayers: string;
32
+ /** Tooltip shared by the ⋮ menu triggers (row, group and panel). */
33
+ moreOptions: string;
34
+ /** Drag handle of sortable groups/rows (aria + tooltip). */
35
+ reorder: string;
17
36
  opacity: string;
18
37
  attribute: string;
38
+ /** Generic close affordance (e.g. the inline opacity bar's ✕). */
39
+ close: string;
19
40
  radiusRangeBy: string;
20
41
  colorBasedOn: string;
21
42
  colorGradient: string;
@@ -2,4 +2,4 @@ export type { LegendPosition, LegendOrientation, LegendSwatchShape, LegendFillPa
2
2
  export { LegendContext, useLegendId } from './legend-context';
3
3
  export { createLegendStore, getLegendStore, hasLegendStore, deleteLegendStore, clearAllLegendStores, setLegendStoreEntry, registerLegendStore, unregisterLegendStore, useLegendStore, useLegendShallow, } from './legend-store-registry';
4
4
  export type { LegendVisibility } from './selectors';
5
- export { selectOrderedGroups, selectLayersByGroup, selectOrderedLayers, selectGroupVisibility, } from './selectors';
5
+ export { selectOrderedGroups, selectLayersByGroup, selectOrderedLayers, selectGroupVisibility, selectLayerCollapsible, selectAllGroupsCollapsed, selectVisibleLayersGrouped, selectHasGroups, } from './selectors';
@@ -18,6 +18,37 @@ export declare function selectLayersByGroup(state: LegendState, groupId: string
18
18
  * @experimental This API is new and may change in a future release.
19
19
  */
20
20
  export declare function selectOrderedLayers(state: LegendState): LegendLayer[];
21
+ /**
22
+ * `true` when every group is collapsed (`false` with no groups) — drives the
23
+ * "Collapse all groups" / "Expand all groups" menu label flip.
24
+ *
25
+ * @experimental This API is new and may change in a future release.
26
+ */
27
+ export declare function selectAllGroupsCollapsed(state: LegendState): boolean;
28
+ /**
29
+ * Whether the legend has groups — gates panel-level group actions.
30
+ *
31
+ * @experimental This API is new and may change in a future release.
32
+ */
33
+ export declare function selectHasGroups(state: LegendState): boolean;
34
+ /**
35
+ * Visible layers grouped for the enabled-layers menu.
36
+ *
37
+ * @experimental This API is new and may change in a future release.
38
+ */
39
+ export declare function selectVisibleLayersGrouped(state: LegendState): {
40
+ group?: LegendGroup;
41
+ layers: LegendLayer[];
42
+ }[];
43
+ /**
44
+ * Whether a layer has any collapsible body — something the row's `Collapse`
45
+ * can actually fold. A layer with no variables, sections, or helper note
46
+ * renders an empty body, so there is nothing to collapse. Gates the row's
47
+ * title-area collapse affordance (chevron + click).
48
+ *
49
+ * @experimental This API is new and may change in a future release.
50
+ */
51
+ export declare function selectLayerCollapsible(state: LegendState, layerId: string): boolean;
21
52
  /**
22
53
  * Tri-state visibility — derived for groups from their member layers, and the
23
54
  * state contract of a controlled `Legend.VisibilityToggle` for any custom
@@ -230,6 +230,12 @@ export interface LegendState {
230
230
  * section's `options`.
231
231
  */
232
232
  setSectionValue: (id: string, sectionId: string, value: string) => void;
233
+ /**
234
+ * Move a layer to `toIndex` **within its sibling bucket** (its group, or
235
+ * the ungrouped bucket). `toIndex` is clamped; orders stay dense. No-op
236
+ * for unknown ids or when the position doesn't change.
237
+ */
238
+ moveLayer: (id: string, toIndex: number) => void;
233
239
  /**
234
240
  * Show/hide **all member layers** of a group (the group itself has no stored
235
241
  * visibility — it is derived from its members). Each member keeps its own
@@ -239,6 +245,11 @@ export interface LegendState {
239
245
  */
240
246
  setGroupVisibility: (id: string, visible: boolean) => void;
241
247
  setGroupCollapsed: (id: string, collapsed: boolean) => void;
248
+ /**
249
+ * Move a group to `toIndex` within the group list. `toIndex` is clamped;
250
+ * orders stay dense. No-op for unknown ids or an unchanged position.
251
+ */
252
+ moveGroup: (id: string, toIndex: number) => void;
242
253
  /**
243
254
  * Add a layer, or update it if `input.id` already exists. Interactive state
244
255
  * (visible/opacity/collapsed/order and section actives) is preserved unless
@@ -18,6 +18,12 @@ export interface MarkdownContentProps {
18
18
  * Defaults to `false` so caption slots stay text-only by default.
19
19
  */
20
20
  allowImages?: boolean;
21
+ /**
22
+ * When `true`, enables GitHub Flavored Markdown (tables, strikethrough,
23
+ * task lists, autolinks) via `remark-gfm`. Defaults to `false` so existing
24
+ * consumers keep CommonMark-only parsing.
25
+ */
26
+ gfm?: boolean;
21
27
  }
22
28
  /**
23
29
  * Low-level Markdown rendering primitive. Wraps `react-markdown` with two
@@ -31,4 +37,4 @@ export interface MarkdownContentProps {
31
37
  * tree. `safeUrlTransform` is always applied as a second layer for markdown
32
38
  * links/images on the `allowHtml=false` path.
33
39
  */
34
- export declare function MarkdownContent({ content, components, allowHtml, allowImages, }: MarkdownContentProps): import("react/jsx-runtime").JSX.Element;
40
+ export declare function MarkdownContent({ content, components, allowHtml, allowImages, gfm, }: MarkdownContentProps): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,8 @@
1
- import { M as E, a as O, b as S } from "../markdown-BD1jcknS.js";
1
+ import { M as E, a as O } from "../markdown-DdqANCiN.js";
2
+ import { MarkdownContent as j } from "../markdown-content-Dk2DSgbf.js";
2
3
  import { jsx as i } from "react/jsx-runtime";
3
- import { c as s } from "react/compiler-runtime";
4
- import { Box as c, Skeleton as p } from "@mui/material";
4
+ import { c } from "react/compiler-runtime";
5
+ import { Box as p, Skeleton as s } from "@mui/material";
5
6
  import "react";
6
7
  import "@mui/icons-material";
7
8
  import "../lasso-tool-YLFRgb-S.js";
@@ -22,15 +23,15 @@ const m = {
22
23
  })
23
24
  };
24
25
  function y(o) {
25
- const e = s(2), {
26
+ const e = c(2), {
26
27
  lines: r
27
28
  } = o, n = r === void 0 ? 5 : r;
28
29
  let t;
29
30
  if (e[0] !== n) {
30
31
  const l = ["100%", "95%", "90%", "85%", "70%"];
31
- t = /* @__PURE__ */ i(c, { sx: m.root, children: Array.from({
32
+ t = /* @__PURE__ */ i(p, { sx: m.root, children: Array.from({
32
33
  length: n
33
- }).map((k, a) => /* @__PURE__ */ i(p, { variant: "rectangular", sx: m.line(l[a % l.length] ?? "85%") }, `line-${a}`)) }), e[0] = n, e[1] = t;
34
+ }).map((k, a) => /* @__PURE__ */ i(s, { variant: "rectangular", sx: m.line(l[a % l.length] ?? "85%") }, `line-${a}`)) }), e[0] = n, e[1] = t;
34
35
  } else
35
36
  t = e[1];
36
37
  return t;
@@ -60,9 +61,9 @@ function I(o) {
60
61
  }
61
62
  export {
62
63
  E as Markdown,
63
- O as MarkdownContent,
64
+ j as MarkdownContent,
64
65
  y as MarkdownSkeleton,
65
- S as MarkdownUI,
66
+ O as MarkdownUI,
66
67
  I as createMarkdownDownloadConfig
67
68
  };
68
69
  //# sourceMappingURL=markdown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdown.js","sources":["../../src/widgets-v2/markdown/skeleton.tsx","../../src/widgets-v2/markdown/download.tsx"],"sourcesContent":["import { Box, Skeleton } from '@mui/material'\nimport type { SxProps, Theme } from '@mui/material'\n\nconst styles = {\n root: {\n display: 'flex',\n flexDirection: 'column',\n gap: 1,\n py: 1,\n },\n line: (width: string): SxProps<Theme> => ({ width, height: 18 }),\n} as const\n\nexport interface MarkdownSkeletonProps {\n lines?: number\n}\n\nexport function MarkdownSkeleton({ lines = 5 }: MarkdownSkeletonProps) {\n // Vary widths to mimic prose.\n const widths = ['100%', '95%', '90%', '85%', '70%']\n return (\n <Box sx={styles.root}>\n {Array.from({ length: lines }).map((_, i) => (\n <Skeleton\n key={`line-${i}`}\n variant='rectangular'\n sx={styles.line(widths[i % widths.length] ?? '85%')}\n />\n ))}\n </Box>\n )\n}\n","import {\n DOWNLOAD_ITEM_IDS,\n MarkdownIcon,\n buildPngDownloadItem,\n toCsvString,\n triggerLinkDownload,\n type DownloadItem,\n} from '../actions/download'\nimport type { MarkdownWidgetData } from './types'\n\n/**\n * Download menu items for the Markdown widget. Always includes a `.md`\n * item that saves the markdown source verbatim. When `getCaptureEl` is\n * supplied, prepends a PNG item that rasterises the captured element via\n * `html2canvas`.\n */\nexport function createMarkdownDownloadConfig(args: {\n filename: string\n getData: () => MarkdownWidgetData\n getCaptureEl?: () => HTMLElement | null\n pngPixelRatio?: number\n pngBackgroundColor?: string | null\n}): DownloadItem[] {\n const items: DownloadItem[] = []\n if (args.getCaptureEl) {\n items.push(\n buildPngDownloadItem({\n filename: args.filename,\n getCaptureEl: args.getCaptureEl,\n pixelRatio: args.pngPixelRatio,\n backgroundColor: args.pngBackgroundColor,\n }),\n )\n }\n items.push({\n id: DOWNLOAD_ITEM_IDS.markdown,\n label: 'Markdown',\n icon: <MarkdownIcon fontSize='small' />,\n resolve: () => {\n const data = args.getData()\n const blob = new Blob([data.content ?? ''], {\n type: 'text/markdown;charset=utf-8;',\n })\n const url = URL.createObjectURL(blob)\n return Promise.resolve({\n url,\n filename: `${args.filename}.md`,\n revoke: () => URL.revokeObjectURL(url),\n })\n },\n })\n return items\n}\n\n// Re-export pure helpers consumers may want when building a custom Download item.\nexport { toCsvString, triggerLinkDownload }\n"],"names":["styles","root","display","flexDirection","gap","py","line","width","height","MarkdownSkeleton","t0","$","_c","lines","t1","undefined","t2","widths","Box","Array","from","length","map","_","i","jsx","Skeleton","createMarkdownDownloadConfig","args","items","getCaptureEl","push","buildPngDownloadItem","filename","pixelRatio","pngPixelRatio","backgroundColor","pngBackgroundColor","id","DOWNLOAD_ITEM_IDS","markdown","label","icon","MarkdownIcon","resolve","data","getData","blob","Blob","content","type","url","URL","createObjectURL","Promise","revoke","revokeObjectURL"],"mappings":";;;;;;;;;;;AAGA,MAAMA,IAAS;AAAA,EACbC,MAAM;AAAA,IACJC,SAAS;AAAA,IACTC,eAAe;AAAA,IACfC,KAAK;AAAA,IACLC,IAAI;AAAA,EAAA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MAAM;AAAA,MAAA,CACP,GACKC,IAAMC,IAAIC,gBAAgBN,CAAI;AACpC,aAAOO,QAAQV,QAAQ;AAAA,QACrBO,KAAAA;AAAAA,QACAlB,UAAU,GAAGL,EAAKK,QAAQ;AAAA,QAC1BsB,QAAQA,MAAMH,IAAII,gBAAgBL,CAAG;AAAA,MAAA,CACtC;AAAA,IACH;AAAA,EAAA,CACD,GACMtB;AACT;"}
1
+ {"version":3,"file":"markdown.js","sources":["../../src/widgets-v2/markdown/skeleton.tsx","../../src/widgets-v2/markdown/download.tsx"],"sourcesContent":["import { Box, Skeleton } from '@mui/material'\nimport type { SxProps, Theme } from '@mui/material'\n\nconst styles = {\n root: {\n display: 'flex',\n flexDirection: 'column',\n gap: 1,\n py: 1,\n },\n line: (width: string): SxProps<Theme> => ({ width, height: 18 }),\n} as const\n\nexport interface MarkdownSkeletonProps {\n lines?: number\n}\n\nexport function MarkdownSkeleton({ lines = 5 }: MarkdownSkeletonProps) {\n // Vary widths to mimic prose.\n const widths = ['100%', '95%', '90%', '85%', '70%']\n return (\n <Box sx={styles.root}>\n {Array.from({ length: lines }).map((_, i) => (\n <Skeleton\n key={`line-${i}`}\n variant='rectangular'\n sx={styles.line(widths[i % widths.length] ?? '85%')}\n />\n ))}\n </Box>\n )\n}\n","import {\n DOWNLOAD_ITEM_IDS,\n MarkdownIcon,\n buildPngDownloadItem,\n toCsvString,\n triggerLinkDownload,\n type DownloadItem,\n} from '../actions/download'\nimport type { MarkdownWidgetData } from './types'\n\n/**\n * Download menu items for the Markdown widget. Always includes a `.md`\n * item that saves the markdown source verbatim. When `getCaptureEl` is\n * supplied, prepends a PNG item that rasterises the captured element via\n * `html2canvas`.\n */\nexport function createMarkdownDownloadConfig(args: {\n filename: string\n getData: () => MarkdownWidgetData\n getCaptureEl?: () => HTMLElement | null\n pngPixelRatio?: number\n pngBackgroundColor?: string | null\n}): DownloadItem[] {\n const items: DownloadItem[] = []\n if (args.getCaptureEl) {\n items.push(\n buildPngDownloadItem({\n filename: args.filename,\n getCaptureEl: args.getCaptureEl,\n pixelRatio: args.pngPixelRatio,\n backgroundColor: args.pngBackgroundColor,\n }),\n )\n }\n items.push({\n id: DOWNLOAD_ITEM_IDS.markdown,\n label: 'Markdown',\n icon: <MarkdownIcon fontSize='small' />,\n resolve: () => {\n const data = args.getData()\n const blob = new Blob([data.content ?? ''], {\n type: 'text/markdown;charset=utf-8;',\n })\n const url = URL.createObjectURL(blob)\n return Promise.resolve({\n url,\n filename: `${args.filename}.md`,\n revoke: () => URL.revokeObjectURL(url),\n })\n },\n })\n return items\n}\n\n// Re-export pure helpers consumers may want when building a custom Download item.\nexport { toCsvString, triggerLinkDownload }\n"],"names":["styles","root","display","flexDirection","gap","py","line","width","height","MarkdownSkeleton","t0","$","_c","lines","t1","undefined","t2","widths","Box","Array","from","length","map","_","i","jsx","Skeleton","createMarkdownDownloadConfig","args","items","getCaptureEl","push","buildPngDownloadItem","filename","pixelRatio","pngPixelRatio","backgroundColor","pngBackgroundColor","id","DOWNLOAD_ITEM_IDS","markdown","label","icon","MarkdownIcon","resolve","data","getData","blob","Blob","content","type","url","URL","createObjectURL","Promise","revoke","revokeObjectURL"],"mappings":";;;;;;;;;;;;AAGA,MAAMA,IAAS;AAAA,EACbC,MAAM;AAAA,IACJC,SAAS;AAAA,IACTC,eAAe;AAAA,IACfC,KAAK;AAAA,IACLC,IAAI;AAAA,EAAA;AAAA,EAENC,MAAMA,CAACC,OAAmC;AAAA,IAAEA,OAAAA;AAAAA,IAAOC,QAAQ;AAAA,EAAA;AAC7D;AAMO,SAAAC,EAAAC,GAAA;AAAA,QAAAC,IAAAC,EAAA,CAAA,GAA0B;AAAA,IAAAC,OAAAC;AAAAA,EAAAA,IAAAJ,GAAEG,IAAAC,MAAAC,SAAA,IAAAD;AAAS,MAAAE;AAAA,MAAAL,SAAAE,GAAA;AAE1C,UAAAI,IAAe,CAAC,QAAQ,OAAO,OAAO,OAAO,KAAK;AAEhDD,IAAAA,sBAACE,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utils";
16
16
  import { o as Ze, a as Ke, E as Ye } from "./echart-Bdvbfx9s.js";
17
- import { D as Wn } from "./echart-Bdvbfx9s.js";
18
- import { a as Je, b as Qe, M as et } from "./markdown-BD1jcknS.js";
19
- import { C as tt, L as nt, F as ot, j as rt, R as it, B as lt, Z as st, m as at, n as ct, l as dt, k as ft } from "./change-column-CiVAjOUB.js";
17
+ import { D as $n } from "./echart-Bdvbfx9s.js";
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-CiVAjOUB.js";
20
20
  import "html2canvas";
21
- import { a as pt, F as mt } from "./formula-DuC0NQLH.js";
21
+ import { a as dt, F as ft } from "./formula-DuC0NQLH.js";
22
+ import { a as pt, M as mt } from "./markdown-DdqANCiN.js";
22
23
  import "react-markdown";
23
24
  import { b as ut, a as gt } from "./spread-4MYPOntd.js";
24
25
  import { a as ht, R as yt } from "./range-l4fNHLEg.js";
@@ -902,7 +903,7 @@ function ye(t) {
902
903
  function tn(t) {
903
904
  return !t;
904
905
  }
905
- const In = {
906
+ const Ln = {
906
907
  // Composition shell
907
908
  Provider: wt,
908
909
  Wrapper: kt,
@@ -919,25 +920,25 @@ const In = {
919
920
  Echart: Ye,
920
921
  EchartUI: Ke,
921
922
  // Actions
922
- Searcher: ft,
923
- SearcherToggle: dt,
924
- StackToggle: ct,
925
- ShowAllToggle: at,
926
- ZoomToggle: st,
927
- BrushToggle: lt,
928
- RelativeData: it,
929
- Download: rt,
930
- FullScreen: ot,
931
- LockSelection: nt,
932
- ChangeColumn: tt,
923
+ Searcher: ct,
924
+ SearcherToggle: at,
925
+ StackToggle: st,
926
+ ShowAllToggle: lt,
927
+ ZoomToggle: it,
928
+ BrushToggle: rt,
929
+ RelativeData: ot,
930
+ Download: nt,
931
+ FullScreen: tt,
932
+ LockSelection: et,
933
+ ChangeColumn: Qe,
933
934
  // Widget primitives (renderer bridges + pure UI). Pre-composed widget
934
935
  // modules (Bar, FormulaWidget, TableWidget, etc.) are application-level
935
936
  // compositions of these primitives and live outside the library —
936
937
  // see `apps/storybook/stories/modules/widgets/` for canonical examples.
937
- Formula: mt,
938
- FormulaUI: pt,
939
- Markdown: et,
940
- MarkdownUI: Qe,
938
+ Formula: ft,
939
+ FormulaUI: dt,
940
+ Markdown: mt,
941
+ MarkdownUI: pt,
941
942
  Spread: gt,
942
943
  SpreadUI: ut,
943
944
  Range: yt,
@@ -948,12 +949,12 @@ const In = {
948
949
  TableUI: vt
949
950
  };
950
951
  export {
951
- Wn as DEFAULT_INIT_OPTS,
952
+ $n as DEFAULT_INIT_OPTS,
952
953
  Kt as DEFAULT_NOTE_LABELS,
953
954
  Nt as DEFAULT_SELECTION_SUMMARY_LABELS,
954
955
  Dt as DEFAULT_STATE_LABELS,
955
956
  zt as DEFAULT_TOOLBOX_LABELS,
956
957
  Tt as DEFAULT_WRAPPER_LABELS,
957
- In as Widget
958
+ Ln as Widget
958
959
  };
959
960
  //# sourceMappingURL=widgets-v2.js.map