@carto/ps-react-ui 4.9.1 → 4.11.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 (188) hide show
  1. package/dist/category-Dnd2_j0x.js +719 -0
  2. package/dist/category-Dnd2_j0x.js.map +1 -0
  3. package/dist/change-column-BiuuHCDN.js +1156 -0
  4. package/dist/change-column-BiuuHCDN.js.map +1 -0
  5. package/dist/chat.js +1507 -0
  6. package/dist/chat.js.map +1 -0
  7. package/dist/components.js +122 -120
  8. package/dist/components.js.map +1 -1
  9. package/dist/copy-button-DGL1tyli.js +26 -0
  10. package/dist/copy-button-DGL1tyli.js.map +1 -0
  11. package/dist/{data-zoom-layout-0QSptXG_.js → data-zoom-layout--YiY6ko_.js} +4 -3
  12. package/dist/{data-zoom-layout-0QSptXG_.js.map → data-zoom-layout--YiY6ko_.js.map} +1 -1
  13. package/dist/{download-config-CzmjOT2T.js → download-config-oJIFZ2WC.js} +9 -8
  14. package/dist/{download-config-CzmjOT2T.js.map → download-config-oJIFZ2WC.js.map} +1 -1
  15. package/dist/{spread-Y9R1f5dm.js → spread-CPis22AE.js} +4 -3
  16. package/dist/{spread-Y9R1f5dm.js.map → spread-CPis22AE.js.map} +1 -1
  17. package/dist/types/chat/bubbles/chat-error-message.d.ts +2 -0
  18. package/dist/types/chat/bubbles/chat-suggestion-button.d.ts +2 -0
  19. package/dist/types/chat/bubbles/chat-user-message.d.ts +2 -0
  20. package/dist/types/chat/bubbles/index.d.ts +4 -0
  21. package/dist/types/chat/const.d.ts +4 -0
  22. package/dist/types/chat/containers/chat-content.d.ts +2 -0
  23. package/dist/types/chat/containers/chat-footer.d.ts +2 -0
  24. package/dist/types/chat/containers/chat-header.d.ts +2 -0
  25. package/dist/types/chat/containers/chat-starter.d.ts +2 -0
  26. package/dist/types/chat/containers/index.d.ts +4 -0
  27. package/dist/types/chat/containers/styles.d.ts +93 -0
  28. package/dist/types/chat/feedback/chat-loader.d.ts +2 -0
  29. package/dist/types/chat/feedback/chat-rating-action.d.ts +2 -0
  30. package/dist/types/chat/feedback/chat-thinking.d.ts +2 -0
  31. package/dist/types/chat/feedback/chat-tool-code-area.d.ts +2 -0
  32. package/dist/types/chat/feedback/chat-tool-full-view-dialog.d.ts +2 -0
  33. package/dist/types/chat/feedback/chat-tool-group.d.ts +2 -0
  34. package/dist/types/chat/feedback/chat-tool-trace.d.ts +3 -0
  35. package/dist/types/chat/feedback/get-tool-label.d.ts +2 -0
  36. package/dist/types/chat/feedback/index.d.ts +8 -0
  37. package/dist/types/chat/feedback/styles.d.ts +211 -0
  38. package/dist/types/chat/index.d.ts +20 -0
  39. package/dist/types/chat/types.d.ts +184 -0
  40. package/dist/types/chat/use-typewriter.d.ts +30 -0
  41. package/dist/types/components/copy-button/copy-button.d.ts +2 -0
  42. package/dist/types/components/copy-button/types.d.ts +6 -0
  43. package/dist/types/components/index.d.ts +2 -0
  44. package/dist/types/widgets/actions/brush-toggle/style.d.ts +1 -1
  45. package/dist/types/widgets/actions/shared/styles.d.ts +1 -1
  46. package/dist/types/widgets/actions/zoom-toggle/style.d.ts +1 -1
  47. package/dist/types/widgets/echart/types.d.ts +1 -1
  48. package/dist/types/widgets/toolbar-actions/styles.d.ts +1 -1
  49. package/dist/types/widgets-v2/actions/brush-toggle/style.d.ts +1 -1
  50. package/dist/types/widgets-v2/actions/change-column/style.d.ts +1 -1
  51. package/dist/types/widgets-v2/actions/fullscreen/style.d.ts +1 -1
  52. package/dist/types/widgets-v2/actions/index.d.ts +1 -0
  53. package/dist/types/widgets-v2/actions/lock-selection/style.d.ts +1 -1
  54. package/dist/types/widgets-v2/actions/relative-data/style.d.ts +1 -1
  55. package/dist/types/widgets-v2/actions/searcher/style.d.ts +1 -1
  56. package/dist/types/widgets-v2/actions/show-all/index.d.ts +2 -0
  57. package/dist/types/widgets-v2/actions/show-all/labels.d.ts +5 -0
  58. package/dist/types/widgets-v2/actions/show-all/show-all.d.ts +33 -0
  59. package/dist/types/widgets-v2/actions/show-all/style.d.ts +8 -0
  60. package/dist/types/widgets-v2/actions/stack-toggle/style.d.ts +1 -1
  61. package/dist/types/widgets-v2/actions/zoom-toggle/style.d.ts +1 -1
  62. package/dist/types/widgets-v2/category/category-ui.d.ts +9 -2
  63. package/dist/types/widgets-v2/category/category.d.ts +9 -2
  64. package/dist/types/widgets-v2/category/components/category-row-other.d.ts +19 -6
  65. package/dist/types/widgets-v2/category/style.d.ts +21 -2
  66. package/dist/types/widgets-v2/category/types.d.ts +2 -0
  67. package/dist/types/widgets-v2/index.d.ts +3 -2
  68. package/dist/types/widgets-v2/selection-summary/labels.d.ts +7 -2
  69. package/dist/types/widgets-v2/selection-summary/selection-summary.d.ts +13 -6
  70. package/dist/types/widgets-v2/selection-summary/style.d.ts +15 -0
  71. package/dist/widgets/actions.js +115 -114
  72. package/dist/widgets/actions.js.map +1 -1
  73. package/dist/widgets/bar.js +1 -1
  74. package/dist/widgets/category.js +9 -8
  75. package/dist/widgets/category.js.map +1 -1
  76. package/dist/widgets/formula.js +11 -10
  77. package/dist/widgets/formula.js.map +1 -1
  78. package/dist/widgets/histogram.js +7 -6
  79. package/dist/widgets/histogram.js.map +1 -1
  80. package/dist/widgets/markdown.js +9 -8
  81. package/dist/widgets/markdown.js.map +1 -1
  82. package/dist/widgets/pie.js +1 -1
  83. package/dist/widgets/scatterplot.js +1 -1
  84. package/dist/widgets/spread.js +9 -8
  85. package/dist/widgets/spread.js.map +1 -1
  86. package/dist/widgets/table.js +17 -16
  87. package/dist/widgets/table.js.map +1 -1
  88. package/dist/widgets/timeseries.js +1 -1
  89. package/dist/widgets/utils.js +1 -1
  90. package/dist/widgets/wrapper.js +3 -2
  91. package/dist/widgets/wrapper.js.map +1 -1
  92. package/dist/widgets-v2/actions.js +41 -37
  93. package/dist/widgets-v2/bar.js +8 -7
  94. package/dist/widgets-v2/bar.js.map +1 -1
  95. package/dist/widgets-v2/category.js +22 -21
  96. package/dist/widgets-v2/category.js.map +1 -1
  97. package/dist/widgets-v2/formula.js +23 -22
  98. package/dist/widgets-v2/formula.js.map +1 -1
  99. package/dist/widgets-v2/histogram.js +10 -9
  100. package/dist/widgets-v2/histogram.js.map +1 -1
  101. package/dist/widgets-v2/markdown.js +9 -8
  102. package/dist/widgets-v2/markdown.js.map +1 -1
  103. package/dist/widgets-v2/pie.js +7 -6
  104. package/dist/widgets-v2/pie.js.map +1 -1
  105. package/dist/widgets-v2/scatterplot.js +9 -8
  106. package/dist/widgets-v2/scatterplot.js.map +1 -1
  107. package/dist/widgets-v2/spread.js +9 -8
  108. package/dist/widgets-v2/spread.js.map +1 -1
  109. package/dist/widgets-v2/table.js +16 -15
  110. package/dist/widgets-v2/table.js.map +1 -1
  111. package/dist/widgets-v2/timeseries.js +8 -7
  112. package/dist/widgets-v2/timeseries.js.map +1 -1
  113. package/dist/widgets-v2/utils.js +1 -1
  114. package/dist/widgets-v2.js +276 -271
  115. package/dist/widgets-v2.js.map +1 -1
  116. package/package.json +7 -3
  117. package/src/chat/bubbles/chat-agent-message.test.tsx +30 -0
  118. package/src/chat/bubbles/chat-agent-message.tsx +11 -0
  119. package/src/chat/bubbles/chat-error-message.test.tsx +40 -0
  120. package/src/chat/bubbles/chat-error-message.tsx +47 -0
  121. package/src/chat/bubbles/chat-suggestion-button.test.tsx +24 -0
  122. package/src/chat/bubbles/chat-suggestion-button.tsx +27 -0
  123. package/src/chat/bubbles/chat-user-message.test.tsx +27 -0
  124. package/src/chat/bubbles/chat-user-message.tsx +27 -0
  125. package/src/chat/bubbles/index.ts +4 -0
  126. package/src/chat/bubbles/styles.ts +148 -0
  127. package/src/chat/const.ts +4 -0
  128. package/src/chat/containers/chat-content.test.tsx +269 -0
  129. package/src/chat/containers/chat-content.tsx +142 -0
  130. package/src/chat/containers/chat-footer.test.tsx +34 -0
  131. package/src/chat/containers/chat-footer.tsx +78 -0
  132. package/src/chat/containers/chat-header.test.tsx +28 -0
  133. package/src/chat/containers/chat-header.tsx +29 -0
  134. package/src/chat/containers/chat-starter.test.tsx +32 -0
  135. package/src/chat/containers/chat-starter.tsx +75 -0
  136. package/src/chat/containers/index.ts +4 -0
  137. package/src/chat/containers/styles.ts +96 -0
  138. package/src/chat/feedback/chat-actions-container.test.tsx +64 -0
  139. package/src/chat/feedback/chat-actions-container.tsx +7 -0
  140. package/src/chat/feedback/chat-loader.test.tsx +10 -0
  141. package/src/chat/feedback/chat-loader.tsx +31 -0
  142. package/src/chat/feedback/chat-rating-action.tsx +43 -0
  143. package/src/chat/feedback/chat-thinking.test.tsx +15 -0
  144. package/src/chat/feedback/chat-thinking.tsx +23 -0
  145. package/src/chat/feedback/chat-tool-code-area.test.tsx +23 -0
  146. package/src/chat/feedback/chat-tool-code-area.tsx +71 -0
  147. package/src/chat/feedback/chat-tool-full-view-dialog.test.tsx +39 -0
  148. package/src/chat/feedback/chat-tool-full-view-dialog.tsx +121 -0
  149. package/src/chat/feedback/chat-tool-group.test.tsx +84 -0
  150. package/src/chat/feedback/chat-tool-group.tsx +156 -0
  151. package/src/chat/feedback/chat-tool-trace.test.tsx +81 -0
  152. package/src/chat/feedback/chat-tool-trace.tsx +192 -0
  153. package/src/chat/feedback/get-tool-label.test.tsx +91 -0
  154. package/src/chat/feedback/get-tool-label.ts +13 -0
  155. package/src/chat/feedback/index.ts +8 -0
  156. package/src/chat/feedback/styles.ts +229 -0
  157. package/src/chat/index.ts +59 -0
  158. package/src/chat/types.ts +215 -0
  159. package/src/chat/use-typewriter.test.tsx +38 -0
  160. package/src/chat/use-typewriter.ts +82 -0
  161. package/src/components/copy-button/copy-button.test.tsx +41 -0
  162. package/src/components/copy-button/copy-button.tsx +31 -0
  163. package/src/components/copy-button/types.ts +10 -0
  164. package/src/components/index.ts +3 -0
  165. package/src/widgets/echart/types.ts +1 -1
  166. package/src/widgets-v2/actions/index.ts +8 -0
  167. package/src/widgets-v2/actions/show-all/index.ts +7 -0
  168. package/src/widgets-v2/actions/show-all/labels.ts +8 -0
  169. package/src/widgets-v2/actions/show-all/show-all.test.tsx +50 -0
  170. package/src/widgets-v2/actions/show-all/show-all.tsx +72 -0
  171. package/src/widgets-v2/actions/show-all/style.ts +8 -0
  172. package/src/widgets-v2/category/category-ui.test.tsx +26 -10
  173. package/src/widgets-v2/category/category-ui.tsx +13 -3
  174. package/src/widgets-v2/category/category.test.tsx +4 -4
  175. package/src/widgets-v2/category/category.tsx +10 -1
  176. package/src/widgets-v2/category/components/category-row-other.test.tsx +36 -7
  177. package/src/widgets-v2/category/components/category-row-other.tsx +64 -13
  178. package/src/widgets-v2/category/style.ts +35 -4
  179. package/src/widgets-v2/category/types.ts +2 -0
  180. package/src/widgets-v2/index.ts +3 -0
  181. package/src/widgets-v2/selection-summary/labels.ts +8 -4
  182. package/src/widgets-v2/selection-summary/selection-summary.test.tsx +15 -9
  183. package/src/widgets-v2/selection-summary/selection-summary.tsx +42 -22
  184. package/src/widgets-v2/selection-summary/style.ts +15 -0
  185. package/dist/category-DwaeYjpX.js +0 -656
  186. package/dist/category-DwaeYjpX.js.map +0 -1
  187. package/dist/change-column-B4IT0rh6.js +0 -1110
  188. package/dist/change-column-B4IT0rh6.js.map +0 -1
@@ -0,0 +1,184 @@
1
+ import { ReactNode } from 'react';
2
+ import { ButtonBaseProps, SxProps, Theme } from '@mui/material';
3
+ export interface ChatSxProps {
4
+ sx?: SxProps<Theme>;
5
+ }
6
+ export interface ChatErrorAction {
7
+ label: string;
8
+ onClick: () => void;
9
+ }
10
+ export interface ChatUserMessageProps extends ChatSxProps {
11
+ children: ReactNode;
12
+ /** enabled to render text with a lighter color for indicating things like an error sending the message */
13
+ muted?: boolean;
14
+ /** content to render on top of the message for user attachments */
15
+ topContext?: ReactNode;
16
+ }
17
+ export interface ChatAgentMessageProps extends ChatSxProps {
18
+ children: ReactNode;
19
+ }
20
+ export interface ChatErrorMessageProps extends ChatSxProps {
21
+ errors: string[];
22
+ icon?: ReactNode;
23
+ actions?: ChatErrorAction[];
24
+ }
25
+ export interface ChatSuggestionButtonProps extends ChatSxProps, Omit<ButtonBaseProps, 'children'> {
26
+ label: ReactNode;
27
+ color?: string;
28
+ }
29
+ export interface ChatThinkingProps extends ChatSxProps {
30
+ duration?: number;
31
+ children?: ReactNode;
32
+ }
33
+ export interface ChatLoaderProps extends ChatSxProps {
34
+ size?: number;
35
+ labels?: {
36
+ loading?: string;
37
+ };
38
+ }
39
+ export interface ChatContentProps extends ChatSxProps {
40
+ children: ReactNode;
41
+ /**
42
+ * Smooth-scrolls to the bottom whenever new content is added — but only if
43
+ * the user was already at (or near) the bottom. Readers who scrolled up to
44
+ * revisit older messages are left alone. Defaults to `true`; pass `false`
45
+ * to opt out and manage scroll yourself via the ref.
46
+ */
47
+ autoScroll?: boolean;
48
+ labels?: {
49
+ jumpToLatest?: string;
50
+ };
51
+ }
52
+ /**
53
+ * Imperative handle exposed by `ChatContent` via `ref`. Use it to drive scroll
54
+ * from the parent — for example, calling `scrollToBottom()` when a new agent
55
+ * message arrives.
56
+ */
57
+ export interface ChatContentRef {
58
+ /** Smooth-scrolls the content area to the bottom. */
59
+ scrollToBottom: () => void;
60
+ /** Smooth-scrolls the content area to the top. */
61
+ scrollToTop: () => void;
62
+ /** `true` when the content area is scrolled to (or near) its bottom edge. */
63
+ isAtBottom: boolean;
64
+ /** `true` when the content area is scrolled to (or near) its top edge. */
65
+ isAtTop: boolean;
66
+ }
67
+ export interface ChatHeaderProps extends ChatSxProps {
68
+ leftSlot?: ReactNode;
69
+ title: ReactNode;
70
+ rightSlot?: ReactNode;
71
+ onClose?: () => void;
72
+ }
73
+ export interface ChatFooterProps extends ChatSxProps {
74
+ /** Current value of the chat message area. */
75
+ value: string;
76
+ /** Called with the new textarea value on every keystroke. */
77
+ onChange: (value: string) => void;
78
+ /** Called when the send button is clicked or Enter is pressed (without Shift). */
79
+ onSend: () => void;
80
+ /** Called when the stop button is clicked. Only shown while `isGenerating` is true. */
81
+ onStop?: () => void;
82
+ /** When true, swaps the send button for a stop button and disables the textarea. */
83
+ isGenerating?: boolean;
84
+ /** Disables the textarea and both send/stop buttons. */
85
+ disabled?: boolean;
86
+ /** Placeholder text for the textarea. Defaults to `'Type a message...'`. */
87
+ placeholder?: string;
88
+ /** Accessible labels for the send and stop buttons (used as `aria-label`). */
89
+ labels?: {
90
+ /** Defaults to `'Send'`. */
91
+ send?: string;
92
+ /** Defaults to `'Stop'`. */
93
+ stop?: string;
94
+ };
95
+ /** Helper text rendered under the input. Defaults to an AI disclaimer; pass `null` to hide. */
96
+ caption?: ReactNode;
97
+ }
98
+ export interface ChatStarterItem {
99
+ label: string;
100
+ color?: string;
101
+ }
102
+ export interface ChatStarterProps extends ChatSxProps {
103
+ icon?: ReactNode;
104
+ title?: ReactNode;
105
+ description?: ReactNode;
106
+ items: string[] | ChatStarterItem[];
107
+ size?: 'small' | 'medium';
108
+ onSelect?: (prompt: string) => void;
109
+ }
110
+ export interface ChatRatingActionProps {
111
+ onRatingChange?: (rating: 'up' | 'down' | null) => void;
112
+ rating?: 'up' | 'down' | null;
113
+ labels?: {
114
+ thumbUp?: string;
115
+ thumbDown?: string;
116
+ };
117
+ }
118
+ export interface ChatToolItem {
119
+ id: string;
120
+ name: string;
121
+ status: 'running' | 'complete' | 'error';
122
+ /** Display label shown while status is 'running'. Falls back to a capitalized `name`. */
123
+ runningLabel?: string;
124
+ /** Display label shown for non-running statuses. Falls back to a capitalized `name`. */
125
+ label?: string;
126
+ /** Friendly reference name for the tool (e.g. "add_marker"). Displayed with icon. */
127
+ reference?: string;
128
+ /** Execution duration in seconds (e.g. 1.8) */
129
+ duration?: number;
130
+ /** Input arguments as a JSON string or plain text */
131
+ inputArguments?: string;
132
+ /** Output as a JSON string or plain text */
133
+ output?: string;
134
+ }
135
+ export interface ChatToolTraceProps extends ChatSxProps {
136
+ tool: ChatToolItem;
137
+ /** Whether the trace accordion is expanded */
138
+ expanded?: boolean;
139
+ /** Callback when accordion expansion state changes */
140
+ onExpandedChange?: (expanded: boolean) => void;
141
+ labels?: {
142
+ toolExecuted?: string;
143
+ reference?: string;
144
+ duration?: string;
145
+ status?: string;
146
+ inputArguments?: string;
147
+ output?: string;
148
+ fullView?: string;
149
+ success?: string;
150
+ error?: string;
151
+ running?: string;
152
+ };
153
+ }
154
+ export interface ChatToolCodeAreaProps extends ChatSxProps {
155
+ /** Code content to display */
156
+ content: string;
157
+ /** Label for the full view dialog title */
158
+ title?: string;
159
+ /** Render with error styling (red left border, tinted background) */
160
+ isError?: boolean;
161
+ labels?: {
162
+ fullView?: string;
163
+ };
164
+ }
165
+ export interface ChatToolFullViewDialogProps {
166
+ open: boolean;
167
+ onClose: () => void;
168
+ title: string;
169
+ content: string;
170
+ }
171
+ export interface ChatToolGroupProps extends ChatSxProps {
172
+ tools: ChatToolItem[];
173
+ /** Whether the group accordion is expanded */
174
+ expanded?: boolean;
175
+ /** Callback when group expansion state changes */
176
+ onExpandedChange?: (expanded: boolean) => void;
177
+ /** Map of tool IDs to their individual expanded state. Used to preserve expansion state during grouping. */
178
+ expandedTools?: Record<string, boolean>;
179
+ /** Callback when an individual tool's expansion state changes */
180
+ onToolExpandedChange?: (value: Record<string, boolean>, toolId?: string) => void;
181
+ labels?: ChatToolTraceProps['labels'] & {
182
+ toolsUsed?: string;
183
+ };
184
+ }
@@ -0,0 +1,30 @@
1
+ interface UseTypewriterOptions {
2
+ /** Characters revealed per second (default: `500`). */
3
+ speed?: number;
4
+ /** When true on mount, skip the animation and reveal the full text immediately. */
5
+ skipAnimation?: boolean;
6
+ }
7
+ interface UseTypewriterResult {
8
+ /** The portion of `fullText` revealed so far. */
9
+ displayedText: string;
10
+ /** `true` while characters are still being revealed. */
11
+ isTyping: boolean;
12
+ }
13
+ /**
14
+ * Reveals a string character-by-character at a steady rate via
15
+ * `requestAnimationFrame`. Useful for smoothing out bursty WebSocket-streamed
16
+ * agent message text — pair it with `ChatAgentMessage`.
17
+ *
18
+ * @example
19
+ * ```tsx
20
+ * const { displayedText, isTyping } = useTypewriter(message)
21
+ * return (
22
+ * <ChatAgentMessage>
23
+ * <Markdown>{displayedText}</Markdown>
24
+ * {isTyping ? <Cursor /> : null}
25
+ * </ChatAgentMessage>
26
+ * )
27
+ * ```
28
+ */
29
+ export declare function useTypewriter(fullText: string, options?: UseTypewriterOptions): UseTypewriterResult;
30
+ export {};
@@ -0,0 +1,2 @@
1
+ import { CopyButtonProps } from './types';
2
+ export declare function CopyButton({ copyText, onSuccess, onError, 'aria-label': ariaLabel, ...props }: CopyButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { IconButtonProps } from '@mui/material/IconButton';
2
+ export interface CopyButtonProps extends Omit<IconButtonProps, 'onError' | 'onClick'> {
3
+ copyText: string;
4
+ onSuccess?: () => void;
5
+ onError?: (err: Error) => void;
6
+ }
@@ -18,3 +18,5 @@ export { BasemapsUI } from './basemaps/basemaps';
18
18
  export type { BasemapsUIProps } from './basemaps/types';
19
19
  export { Tooltip, setTooltipEnterDelay } from './tooltip/tooltip';
20
20
  export { SmartTooltip } from './smart-tooltip/smart-tooltip';
21
+ export type { CopyButtonProps } from './copy-button/types';
22
+ export { CopyButton } from './copy-button/copy-button';
@@ -8,7 +8,7 @@ export declare const styles: {
8
8
  };
9
9
  trigger: {
10
10
  '&[data-active="true"]': {
11
- background: (theme: Theme) => any;
11
+ background: (theme: Theme) => string;
12
12
  };
13
13
  };
14
14
  };
@@ -5,7 +5,7 @@ import { Theme } from '@mui/material';
5
5
  export declare const actionButtonStyles: {
6
6
  trigger: {
7
7
  '&[data-active="true"]': {
8
- background: (theme: Theme) => any;
8
+ background: (theme: Theme) => string;
9
9
  };
10
10
  };
11
11
  };
@@ -7,7 +7,7 @@ export declare const styles: {
7
7
  };
8
8
  trigger: {
9
9
  '&[data-active="true"]': {
10
- background: (theme: Theme) => any;
10
+ background: (theme: Theme) => string;
11
11
  };
12
12
  };
13
13
  };
@@ -1,7 +1,7 @@
1
1
  import { EChartsOption } from 'echarts';
2
2
  import { BaseWidgetState } from '../stores/types';
3
3
  import { Ref, RefObject } from 'react';
4
- import { theme as CartoTheme } from '../../theme';
4
+ import { theme as CartoTheme } from '@carto/meridian-ds/theme';
5
5
  import type * as echarts from 'echarts';
6
6
  export type EchartOptionsProps = EChartsOption;
7
7
  export interface EchartUIProps {
@@ -31,7 +31,7 @@ export declare const styles: {
31
31
  };
32
32
  triggerButton: {
33
33
  '&[data-active="true"]': {
34
- backgroundColor: ({ palette }: Theme) => any;
34
+ backgroundColor: ({ palette }: Theme) => string;
35
35
  };
36
36
  };
37
37
  };
@@ -7,6 +7,6 @@ export declare const styles: {
7
7
  };
8
8
  };
9
9
  toggleActive: {
10
- background: (theme: Theme) => any;
10
+ background: (theme: Theme) => string;
11
11
  };
12
12
  };
@@ -7,7 +7,7 @@ export declare const styles: {
7
7
  };
8
8
  };
9
9
  toggleActive: {
10
- background: (theme: Theme) => any;
10
+ background: (theme: Theme) => string;
11
11
  };
12
12
  menuPaper: {
13
13
  overflow: "hidden";
@@ -14,7 +14,7 @@ export declare const styles: {
14
14
  };
15
15
  };
16
16
  triggerActive: {
17
- background: (theme: Theme) => any;
17
+ background: (theme: Theme) => string;
18
18
  };
19
19
  dialogPaper: {
20
20
  width: string;
@@ -1,5 +1,6 @@
1
1
  export { Searcher, SearcherToggle, setSearcherText, filterBySearchText, DEFAULT_SEARCHER_LABELS, type SearcherProps, type SearcherToggleProps, type SearcherLabels, } from './searcher';
2
2
  export { StackToggle, addStack, DEFAULT_STACK_TOGGLE_LABELS, type StackToggleProps, type StackToggleLabels, } from './stack-toggle';
3
+ export { ShowAllToggle, setShowAll, SHOW_ALL_ID, DEFAULT_SHOW_ALL_LABELS, type ShowAllToggleProps, type ShowAllLabels, } from './show-all';
3
4
  export { ZoomToggle, addZoom, createAddZoom, ZOOM_LAYOUT, DEFAULT_ZOOM_TOGGLE_LABELS, type ZoomToggleProps, type ZoomToggleLabels, } from './zoom-toggle';
4
5
  export { BrushToggle, addBrush, DEFAULT_BRUSH_TOGGLE_LABELS, type BrushToggleProps, type BrushToggleLabels, } from './brush-toggle';
5
6
  export { RelativeData, toRelativeData, createPercentFormatter, DEFAULT_RELATIVE_DATA_LABELS, type RelativeDataProps, type RelativeDataLabels, } from './relative-data';
@@ -7,6 +7,6 @@ export declare const styles: {
7
7
  };
8
8
  };
9
9
  toggleActive: {
10
- background: (theme: Theme) => any;
10
+ background: (theme: Theme) => string;
11
11
  };
12
12
  };
@@ -7,6 +7,6 @@ export declare const styles: {
7
7
  };
8
8
  };
9
9
  toggleActive: {
10
- background: (theme: Theme) => any;
10
+ background: (theme: Theme) => string;
11
11
  };
12
12
  };
@@ -7,7 +7,7 @@ export declare const styles: {
7
7
  };
8
8
  };
9
9
  toggleActive: {
10
- background: (theme: Theme) => any;
10
+ background: (theme: Theme) => string;
11
11
  };
12
12
  input: {
13
13
  width: string;
@@ -0,0 +1,2 @@
1
+ export { ShowAllToggle, setShowAll, SHOW_ALL_ID, type ShowAllToggleProps, } from './show-all';
2
+ export { DEFAULT_SHOW_ALL_LABELS, type ShowAllLabels } from './labels';
@@ -0,0 +1,5 @@
1
+ export interface ShowAllLabels {
2
+ /** Tooltip + aria-label for the collapse (✕) button shown while expanded. */
3
+ toggle: string;
4
+ }
5
+ export declare const DEFAULT_SHOW_ALL_LABELS: ShowAllLabels;
@@ -0,0 +1,33 @@
1
+ import { ComponentType } from 'react';
2
+ import { SvgIconProps } from '@mui/material';
3
+ import { ShowAllLabels } from './labels';
4
+ /**
5
+ * The `show-all` flag is a pure UI signal (no data/config transform): the
6
+ * Category overflow row writes it `true` via {@link setShowAll}, the
7
+ * composer reads it with `useTransformEnabled(id, SHOW_ALL_ID)` to drop the
8
+ * row cap, and this button writes it back `false` to collapse. Stored under
9
+ * `transformStates` so `useTransformEnabled` can observe it like any other
10
+ * action flag — but it never registers a pipeline transform, so toggling it
11
+ * never re-runs the data pipeline.
12
+ */
13
+ export declare const SHOW_ALL_ID = "show-all";
14
+ export interface ShowAllToggleProps {
15
+ labels?: Partial<ShowAllLabels>;
16
+ icon?: ComponentType<SvgIconProps>;
17
+ iconProps?: SvgIconProps;
18
+ }
19
+ /**
20
+ * Collapse (✕) affordance shown while a widget is expanded into its
21
+ * "show all" state. Clicking it clears the `show-all` flag, returning the
22
+ * widget to its capped view. Mount it conditionally (only while the flag is
23
+ * set) so it doesn't occupy a `Widget.Toolbox` visibility-budget slot when
24
+ * the widget is collapsed.
25
+ */
26
+ export declare function ShowAllToggle({ labels, icon: Icon, iconProps, }: ShowAllToggleProps): import("react/jsx-runtime").JSX.Element;
27
+ /**
28
+ * Imperatively writes the `show-all` flag into the widget store. Mirrors
29
+ * {@link setSearcherText} — used by the Category overflow row (to expand)
30
+ * and the {@link ShowAllToggle} button (to collapse) without routing through
31
+ * a re-rendered subscription.
32
+ */
33
+ export declare function setShowAll(widgetId: string, value: boolean): void;
@@ -0,0 +1,8 @@
1
+ export declare const styles: {
2
+ toggle: {
3
+ p: number;
4
+ '& .MuiSvgIcon-root': {
5
+ fontSize: number;
6
+ };
7
+ };
8
+ };
@@ -7,6 +7,6 @@ export declare const styles: {
7
7
  };
8
8
  };
9
9
  toggleActive: {
10
- background: (theme: Theme) => any;
10
+ background: (theme: Theme) => string;
11
11
  };
12
12
  };
@@ -7,6 +7,6 @@ export declare const styles: {
7
7
  };
8
8
  };
9
9
  toggleActive: {
10
- background: (theme: Theme) => any;
10
+ background: (theme: Theme) => string;
11
11
  };
12
12
  };
@@ -23,7 +23,7 @@ export interface CategoryUIProps {
23
23
  * Caps the number of visible category rows.
24
24
  *
25
25
  * - `undefined` (omitted) — caps at {@link DEFAULT_MAX_ITEMS} (20).
26
- * Surplus rows fold into a single italic "Other (X more)" footer.
26
+ * Surplus rows fold into a single "Others <count>" footer row.
27
27
  * `undefined` cannot mean "no cap" because it's consumed by the
28
28
  * default-parameter syntax — pass `null` instead.
29
29
  * - positive finite N — same as the default but with a custom cap.
@@ -44,6 +44,13 @@ export interface CategoryUIProps {
44
44
  maxItems?: number | null;
45
45
  /** Labels for the "Other" overflow row. `{count}` placeholder is replaced. */
46
46
  labels?: CategoryLabels;
47
+ /**
48
+ * When provided, the "Other" overflow row becomes a button — clicking it
49
+ * fires `onShowAll`, which a composer typically wires to expand the widget
50
+ * (drop the row cap) so every category becomes reachable. When omitted the
51
+ * overflow row stays a static summary.
52
+ */
53
+ onShowAll?: () => void;
47
54
  /** Manual override for the bar-width denominator. */
48
55
  maxOverride?: number;
49
56
  /**
@@ -78,4 +85,4 @@ export interface CategoryUIProps {
78
85
  * Returns `null` when there's nothing to render — `Widget.State` is the
79
86
  * empty-state authority in the canonical compositor.
80
87
  */
81
- export declare function CategoryUI({ data, selection, onSelectionChange, formatter, labelFormatter, series, maxItems, labels, maxOverride, size, stacked, }: CategoryUIProps): import("react/jsx-runtime").JSX.Element | null;
88
+ export declare function CategoryUI({ data, selection, onSelectionChange, formatter, labelFormatter, series, maxItems, labels, onShowAll, maxOverride, size, stacked, }: CategoryUIProps): import("react/jsx-runtime").JSX.Element | null;
@@ -7,7 +7,7 @@ export interface CategoryProps {
7
7
  /** Per-series metadata. Enables the legend + overrides palette per index. */
8
8
  series?: readonly CategorySeriesConfig[];
9
9
  /**
10
- * Cap visible rows; overflow folds into "Other (X more)". Default 20
10
+ * Cap visible rows; overflow folds into an "Others <count>" row. Default 20
11
11
  * (when omitted). Pass `0` to swap the cap for a scrollable viewport
12
12
  * (composers use this when the user opens the SearcherToggle —
13
13
  * `maxItems = searcherOpen ? 0 : userMaxItems`). Pass `null` to disable
@@ -16,6 +16,13 @@ export interface CategoryProps {
16
16
  maxItems?: number | null;
17
17
  /** Labels for the "Other" overflow row. */
18
18
  labels?: CategoryLabels;
19
+ /**
20
+ * When provided, the "Other" overflow row becomes a button that fires this
21
+ * callback. Composers wire it to expand the widget (e.g. flip the
22
+ * `show-all` flag) so every category is shown. Forwarded to
23
+ * {@link CategoryUI}.
24
+ */
25
+ onShowAll?: () => void;
19
26
  /**
20
27
  * Manual override for the bar-width denominator. When omitted, the
21
28
  * bridge auto-fills from the widget store's `rawData` so bar widths
@@ -45,4 +52,4 @@ export interface CategoryProps {
45
52
  * `onSelectionChange` follow the destination-owned principle: the
46
53
  * consumer keeps the list in their own store and passes it through.
47
54
  */
48
- export declare function Category({ selection, onSelectionChange, series, maxItems, labels, maxOverride, size, stacked, }: CategoryProps): import("react/jsx-runtime").JSX.Element;
55
+ export declare function Category({ selection, onSelectionChange, series, maxItems, labels, onShowAll, maxOverride, size, stacked, }: CategoryProps): import("react/jsx-runtime").JSX.Element;
@@ -1,13 +1,26 @@
1
1
  export interface CategoryRowOtherProps {
2
2
  hiddenCount: number;
3
- /** Label for the overflow row. Defaults to `'Other'`. */
3
+ /** Label for the overflow row. Defaults to `'Others'`. */
4
4
  otherLabel?: string;
5
- /** Count text with `{count}` placeholder. Defaults to `'{count} more'`. */
5
+ /** Count text with `{count}` placeholder. Defaults to `'{count}'`. */
6
6
  otherCountLabel?: string;
7
+ /**
8
+ * When provided, the row becomes a button: clicking it (or Enter/Space)
9
+ * fires `onShowAll`, expanding the widget to reveal every category. When
10
+ * omitted the row renders as a static, non-interactive summary.
11
+ */
12
+ onShowAll?: () => void;
13
+ /** Tooltip shown over the button form. Defaults to `'Show all'`. */
14
+ showAllLabel?: string;
7
15
  }
8
16
  /**
9
- * Static "Other (X more)" overflow summary row. Rendered after the last
10
- * visible category row when `data.length > maxItems`. Non-interactive
11
- * no selection, no keyboard target.
17
+ * Overflow summary row rendered after the last visible category row when
18
+ * `data.length > maxItems`. Shows `Others <count>` (count muted, no
19
+ * parentheses).
20
+ *
21
+ * When `onShowAll` is supplied the row is an interactive button — clicking
22
+ * it (or Enter/Space) expands the widget to show all categories, mirroring
23
+ * the Searcher's full-list view. Without `onShowAll` it stays a static,
24
+ * non-interactive summary (backward-compatible default).
12
25
  */
13
- export declare function CategoryRowOther({ hiddenCount, otherLabel, otherCountLabel, }: CategoryRowOtherProps): import("react/jsx-runtime").JSX.Element;
26
+ export declare function CategoryRowOther({ hiddenCount, otherLabel, otherCountLabel, onShowAll, showAllLabel, }: CategoryRowOtherProps): import("react/jsx-runtime").JSX.Element;
@@ -13,6 +13,9 @@ export declare const styles: {
13
13
  gap: number;
14
14
  py: number;
15
15
  };
16
+ listScroll: {
17
+ pr: number;
18
+ };
16
19
  rowSingle: {
17
20
  display: string;
18
21
  flexDirection: string;
@@ -150,17 +153,33 @@ export declare const styles: {
150
153
  };
151
154
  otherRow: {
152
155
  display: string;
153
- justifyContent: string;
154
156
  alignItems: string;
157
+ gap: number;
155
158
  py: number;
156
159
  px: number;
157
160
  };
161
+ otherLabelButton: {
162
+ cursor: string;
163
+ userSelect: string;
164
+ borderRadius: number;
165
+ px: number;
166
+ ml: number;
167
+ transition: string;
168
+ '&:hover': {
169
+ bgcolor: string;
170
+ };
171
+ '&:focus-visible': {
172
+ outline: string;
173
+ outlineColor: string;
174
+ outlineOffset: number;
175
+ };
176
+ };
158
177
  otherLabel: {
159
- fontStyle: string;
160
178
  color: string;
161
179
  fontWeight: string;
162
180
  };
163
181
  otherCount: {
164
182
  color: string;
183
+ fontVariantNumeric: string;
165
184
  };
166
185
  };
@@ -42,6 +42,8 @@ export type CategorySeriesConfig = WidgetSeries;
42
42
  export interface CategoryLabels {
43
43
  other?: string;
44
44
  otherCount?: string;
45
+ /** Tooltip shown over the clickable "Others" row. Defaults to `'Show all'`. */
46
+ showAll?: string;
45
47
  }
46
48
  /**
47
49
  * Visual density of the bar primitive. `'small'` (default) keeps the
@@ -9,7 +9,7 @@ import { Toolbox } from './toolbox/toolbox';
9
9
  import { DEFAULT_TOOLBOX_LABELS } from './toolbox/labels';
10
10
  import { Echart, EchartUI, DEFAULT_INIT_OPTS } from './echart';
11
11
  import { DEFAULT_NOTE_LABELS } from './note/labels';
12
- import { Searcher, SearcherToggle, StackToggle, ZoomToggle, BrushToggle, RelativeData, Download, LockSelection, ChangeColumn } from './actions';
12
+ import { Searcher, SearcherToggle, StackToggle, ShowAllToggle, ZoomToggle, BrushToggle, RelativeData, Download, LockSelection, ChangeColumn } from './actions';
13
13
  import { Formula, FormulaUI } from './formula';
14
14
  import { Markdown, MarkdownUI } from './markdown';
15
15
  import { Spread, SpreadUI } from './spread';
@@ -59,6 +59,7 @@ export declare const Widget: {
59
59
  readonly Searcher: typeof Searcher;
60
60
  readonly SearcherToggle: typeof SearcherToggle;
61
61
  readonly StackToggle: typeof StackToggle;
62
+ readonly ShowAllToggle: typeof ShowAllToggle;
62
63
  readonly ZoomToggle: typeof ZoomToggle;
63
64
  readonly BrushToggle: typeof BrushToggle;
64
65
  readonly RelativeData: typeof RelativeData;
@@ -95,7 +96,7 @@ export type { ToolboxLabels } from './toolbox/labels';
95
96
  export type { EchartProps, EchartUIProps, EchartsEventHandler } from './echart';
96
97
  export type { NoteProps, NoteMarkdownProps } from './note/widget-note';
97
98
  export type { NoteLabels } from './note/labels';
98
- export type { SearcherProps, SearcherToggleProps, StackToggleProps, ZoomToggleProps, BrushToggleProps, RelativeDataProps, DownloadProps, DownloadItem, FullScreenTriggerProps, FullScreenSlotProps, LockSelectionProps, LockSelectionKey, ChangeColumnProps, ChangeColumnItem, } from './actions';
99
+ export type { SearcherProps, SearcherToggleProps, StackToggleProps, ShowAllToggleProps, ZoomToggleProps, BrushToggleProps, RelativeDataProps, DownloadProps, DownloadItem, FullScreenTriggerProps, FullScreenSlotProps, LockSelectionProps, LockSelectionKey, ChangeColumnProps, ChangeColumnItem, } from './actions';
99
100
  export type { FormulaUIProps, FormulaDataItem, FormulaWidgetData, } from './formula';
100
101
  export type { MarkdownUIProps, MarkdownWidgetData } from './markdown';
101
102
  export type { PieDatum, PieWidgetData } from './pie';
@@ -1,6 +1,11 @@
1
+ import { ReactNode } from 'react';
1
2
  export interface SelectionSummaryLabels {
2
- allSelected: string;
3
- selections: (count: number) => string;
3
+ /**
4
+ * Optional custom renderer for the count. Defaults to the built-in two-tone
5
+ * `selected / total` rendering. Receives the already-resolved displayed
6
+ * number (which equals `total` when nothing is selected).
7
+ */
8
+ summary?: (selected: number, total: number) => ReactNode;
4
9
  clear: string;
5
10
  }
6
11
  export declare const DEFAULT_SELECTION_SUMMARY_LABELS: SelectionSummaryLabels;
@@ -4,19 +4,26 @@ import { SelectionSummaryLabels } from './labels';
4
4
  export interface SelectionSummaryProps {
5
5
  /** Number of currently selected items. */
6
6
  count: number;
7
- /** Optional total — when 0 the component renders nothing (no data to summarize). */
7
+ /** Optional total — when `undefined` or `0` the component renders nothing (no data). */
8
8
  total?: number;
9
- /** Clear callback. Shown only when count > 0. */
9
+ /** Clear callback. The Clear control is shown only when `count > 0` and `onClear` is provided. */
10
10
  onClear?: () => void;
11
11
  labels?: Partial<SelectionSummaryLabels>;
12
12
  icon?: ComponentType<SvgIconProps>;
13
13
  iconProps?: SvgIconProps;
14
14
  }
15
15
  /**
16
+ * Renders a `selected / total` count.
17
+ *
16
18
  * Render rules:
17
- * - `total === 0` → render nothing.
18
- * - `count === 0` → render `labels.allSelected` (matches v1 default),
19
- * prefixed with the optional `icon` glyph when provided.
20
- * - `count > 0` render `labels.selections(count)` + Clear (when `onClear`).
19
+ * - `!total` (undefined or 0) → render nothing (no data to summarize).
20
+ * - `count === 0` → display `total / total` (everything is implicitly in
21
+ * scope); no Clear button.
22
+ * - `count > 0` display `count / total` + Clear (when `onClear` is given).
23
+ *
24
+ * The count is two-tone by default (selected number bold/`text.primary`,
25
+ * ` / total` in `text.secondary`). Pass `labels.summary` to render a custom
26
+ * node instead — it receives the already-resolved displayed number (which
27
+ * equals `total` when nothing is selected).
21
28
  */
22
29
  export declare function SelectionSummary({ count, total, onClear, labels, icon: Icon, iconProps, }: SelectionSummaryProps): import("react/jsx-runtime").JSX.Element | null;