@carto/ps-react-ui 4.3.9 → 4.4.0-chat-ui.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 (154) hide show
  1. package/dist/chat.js +798 -0
  2. package/dist/chat.js.map +1 -0
  3. package/dist/components.js +723 -711
  4. package/dist/components.js.map +1 -1
  5. package/dist/{lasso-tool-jl4YK02H.js → lasso-tool-BYbxrJ-7.js} +184 -190
  6. package/dist/lasso-tool-BYbxrJ-7.js.map +1 -0
  7. package/dist/{row-BKmVAUN5.js → row-DTCV0Ocm.js} +2 -2
  8. package/dist/row-DTCV0Ocm.js.map +1 -0
  9. package/dist/{series-D1pynfeh.js → series-CYNOu2Ju.js} +2 -2
  10. package/dist/{series-D1pynfeh.js.map → series-CYNOu2Ju.js.map} +1 -1
  11. package/dist/smart-tooltip-D4vwQpFf.js +37 -0
  12. package/dist/smart-tooltip-D4vwQpFf.js.map +1 -0
  13. package/dist/{styles-DrPyd0y5.js → styles-CAroD5Rc.js} +12 -12
  14. package/dist/styles-CAroD5Rc.js.map +1 -0
  15. package/dist/types/chat/bubbles/chat-error-message.d.ts +2 -0
  16. package/dist/types/chat/bubbles/chat-suggestion-button.d.ts +2 -0
  17. package/dist/types/chat/bubbles/chat-user-message.d.ts +2 -0
  18. package/dist/types/chat/bubbles/index.d.ts +4 -0
  19. package/dist/types/chat/const.d.ts +3 -0
  20. package/dist/types/chat/containers/chat-content.d.ts +2 -0
  21. package/dist/types/chat/containers/chat-footer.d.ts +2 -0
  22. package/dist/types/chat/containers/chat-header.d.ts +2 -0
  23. package/dist/types/chat/containers/chat-starter.d.ts +2 -0
  24. package/dist/types/chat/containers/index.d.ts +4 -0
  25. package/dist/types/chat/containers/styles.d.ts +101 -0
  26. package/dist/types/chat/feedback/chat-loader.d.ts +2 -0
  27. package/dist/types/chat/feedback/chat-rating-action.d.ts +2 -0
  28. package/dist/types/chat/feedback/chat-thinking.d.ts +2 -0
  29. package/dist/types/chat/feedback/chat-tools.d.ts +2 -0
  30. package/dist/types/chat/feedback/index.d.ts +5 -0
  31. package/dist/types/chat/feedback/styles.d.ts +65 -0
  32. package/dist/types/chat/index.d.ts +16 -0
  33. package/dist/types/chat/types.d.ts +99 -0
  34. package/dist/types/components/copy-button/copy-button.d.ts +2 -0
  35. package/dist/types/components/copy-button/types.d.ts +6 -0
  36. package/dist/types/components/index.d.ts +2 -0
  37. package/dist/types/widgets/_shared/chart-config/option-builders.d.ts +1 -1
  38. package/dist/types/widgets/category/config.d.ts +3 -10
  39. package/dist/types/widgets/range/config.d.ts +0 -4
  40. package/dist/types/widgets/spread/config.d.ts +0 -5
  41. package/dist/types/widgets/table/config.d.ts +1 -2
  42. package/dist/types/widgets/table/table-ui.d.ts +1 -1
  43. package/dist/types/widgets/wrapper/components/options.d.ts +1 -1
  44. package/dist/widgets/actions.js +614 -627
  45. package/dist/widgets/actions.js.map +1 -1
  46. package/dist/widgets/bar.js +49 -49
  47. package/dist/widgets/bar.js.map +1 -1
  48. package/dist/widgets/category.js +37 -36
  49. package/dist/widgets/category.js.map +1 -1
  50. package/dist/widgets/formula.js +14 -13
  51. package/dist/widgets/formula.js.map +1 -1
  52. package/dist/widgets/histogram.js +53 -52
  53. package/dist/widgets/histogram.js.map +1 -1
  54. package/dist/widgets/markdown.js +10 -9
  55. package/dist/widgets/markdown.js.map +1 -1
  56. package/dist/widgets/pie.js +16 -15
  57. package/dist/widgets/pie.js.map +1 -1
  58. package/dist/widgets/range.js +1 -1
  59. package/dist/widgets/range.js.map +1 -1
  60. package/dist/widgets/scatterplot.js +20 -19
  61. package/dist/widgets/scatterplot.js.map +1 -1
  62. package/dist/widgets/spread.js +60 -59
  63. package/dist/widgets/spread.js.map +1 -1
  64. package/dist/widgets/table.js +68 -67
  65. package/dist/widgets/table.js.map +1 -1
  66. package/dist/widgets/timeseries.js +26 -25
  67. package/dist/widgets/timeseries.js.map +1 -1
  68. package/dist/widgets/wrapper.js +153 -162
  69. package/dist/widgets/wrapper.js.map +1 -1
  70. package/package.json +7 -3
  71. package/src/chat/bubbles/chat-agent-message.test.tsx +30 -0
  72. package/src/chat/bubbles/chat-agent-message.tsx +11 -0
  73. package/src/chat/bubbles/chat-error-message.test.tsx +40 -0
  74. package/src/chat/bubbles/chat-error-message.tsx +47 -0
  75. package/src/chat/bubbles/chat-suggestion-button.test.tsx +24 -0
  76. package/src/chat/bubbles/chat-suggestion-button.tsx +27 -0
  77. package/src/chat/bubbles/chat-user-message.test.tsx +27 -0
  78. package/src/chat/bubbles/chat-user-message.tsx +27 -0
  79. package/src/chat/bubbles/index.ts +4 -0
  80. package/src/chat/bubbles/styles.ts +106 -0
  81. package/src/chat/const.ts +3 -0
  82. package/src/chat/containers/chat-content.test.tsx +15 -0
  83. package/src/chat/containers/chat-content.tsx +32 -0
  84. package/src/chat/containers/chat-footer.test.tsx +34 -0
  85. package/src/chat/containers/chat-footer.tsx +78 -0
  86. package/src/chat/containers/chat-header.test.tsx +28 -0
  87. package/src/chat/containers/chat-header.tsx +29 -0
  88. package/src/chat/containers/chat-starter.test.tsx +32 -0
  89. package/src/chat/containers/chat-starter.tsx +75 -0
  90. package/src/chat/containers/index.ts +4 -0
  91. package/src/chat/containers/styles.ts +107 -0
  92. package/src/chat/feedback/chat-actions-container.test.tsx +64 -0
  93. package/src/chat/feedback/chat-actions-container.tsx +7 -0
  94. package/src/chat/feedback/chat-loader.test.tsx +10 -0
  95. package/src/chat/feedback/chat-loader.tsx +31 -0
  96. package/src/chat/feedback/chat-rating-action.tsx +43 -0
  97. package/src/chat/feedback/chat-thinking.test.tsx +15 -0
  98. package/src/chat/feedback/chat-thinking.tsx +23 -0
  99. package/src/chat/feedback/chat-tools.test.tsx +23 -0
  100. package/src/chat/feedback/chat-tools.tsx +54 -0
  101. package/src/chat/feedback/index.ts +5 -0
  102. package/src/chat/feedback/styles.ts +80 -0
  103. package/src/chat/index.ts +45 -0
  104. package/src/chat/types.ts +124 -0
  105. package/src/components/basemaps/basemaps.tsx +3 -1
  106. package/src/components/copy-button/copy-button.test.tsx +41 -0
  107. package/src/components/copy-button/copy-button.tsx +31 -0
  108. package/src/components/copy-button/types.ts +10 -0
  109. package/src/components/geolocation-controls/geolocation-controls.tsx +10 -6
  110. package/src/components/index.ts +3 -0
  111. package/src/components/lasso-tool/lasso-tool-inline.tsx +6 -2
  112. package/src/components/lasso-tool/lasso-tool.tsx +9 -3
  113. package/src/components/list-data/list-data-skeleton.tsx +1 -1
  114. package/src/components/list-data/list-data.tsx +5 -3
  115. package/src/components/measurement-tools/measurement-tools.tsx +5 -1
  116. package/src/components/smart-tooltip/smart-tooltip.tsx +3 -1
  117. package/src/widgets/_shared/chart-config/option-builders.test.ts +2 -2
  118. package/src/widgets/_shared/chart-config/option-builders.ts +6 -4
  119. package/src/widgets/actions/download/download.test.tsx +6 -2
  120. package/src/widgets/actions/download/download.tsx +3 -1
  121. package/src/widgets/actions/fullscreen/fullscreen.tsx +8 -1
  122. package/src/widgets/actions/relative-data/relative-data.tsx +2 -6
  123. package/src/widgets/actions/searcher/searcher.tsx +0 -6
  124. package/src/widgets/bar/config.ts +8 -4
  125. package/src/widgets/bar/skeleton.tsx +1 -1
  126. package/src/widgets/category/components/category-row-multi.tsx +1 -1
  127. package/src/widgets/category/config.ts +1 -11
  128. package/src/widgets/formula/components/row.tsx +1 -1
  129. package/src/widgets/histogram/config.ts +7 -2
  130. package/src/widgets/histogram/skeleton.tsx +2 -2
  131. package/src/widgets/pie/skeleton.tsx +1 -1
  132. package/src/widgets/range/config.ts +0 -5
  133. package/src/widgets/scatterplot/skeleton.tsx +2 -2
  134. package/src/widgets/spread/config.ts +0 -6
  135. package/src/widgets/table/config.ts +1 -1
  136. package/src/widgets/table/table-ui.tsx +1 -1
  137. package/src/widgets/timeseries/skeleton.tsx +1 -1
  138. package/src/widgets/wrapper/components/actions.test.tsx +6 -2
  139. package/src/widgets/wrapper/components/actions.tsx +3 -1
  140. package/src/widgets/wrapper/components/options.test.tsx +12 -4
  141. package/src/widgets/wrapper/components/options.tsx +8 -3
  142. package/src/widgets/wrapper/wrapper-ui.tsx +5 -2
  143. package/src/widgets/wrapper/wrapper.tsx +2 -4
  144. package/dist/lasso-tool-jl4YK02H.js.map +0 -1
  145. package/dist/row-BKmVAUN5.js.map +0 -1
  146. package/dist/smart-tooltip-BEtBaIdz.js +0 -39
  147. package/dist/smart-tooltip-BEtBaIdz.js.map +0 -1
  148. package/dist/styles-DrPyd0y5.js.map +0 -1
  149. package/dist/types/widgets/actions/relative-data/style.d.ts +0 -8
  150. package/dist/types/widgets/actions/zoom-toggle/index.d.ts +0 -2
  151. package/dist/types/widgets/table/components/index.d.ts +0 -4
  152. package/src/widgets/actions/relative-data/style.ts +0 -9
  153. package/src/widgets/actions/zoom-toggle/index.ts +0 -2
  154. package/src/widgets/table/components/index.ts +0 -4
@@ -0,0 +1,99 @@
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
+ labels?: {
42
+ jumpToLatest?: string;
43
+ };
44
+ }
45
+ export interface ChatHeaderProps extends ChatSxProps {
46
+ leftSlot?: ReactNode;
47
+ title: ReactNode;
48
+ rightSlot?: ReactNode;
49
+ onClose?: () => void;
50
+ }
51
+ export interface ChatFooterProps extends ChatSxProps {
52
+ value: string;
53
+ onChange: (value: string) => void;
54
+ onSend: () => void;
55
+ onStop?: () => void;
56
+ isGenerating?: boolean;
57
+ disabled?: boolean;
58
+ placeholder?: string;
59
+ labels?: {
60
+ send?: string;
61
+ stop?: string;
62
+ };
63
+ caption?: ReactNode;
64
+ }
65
+ export interface ChatStarterItem {
66
+ label: string;
67
+ color?: string;
68
+ }
69
+ export interface ChatStarterProps extends ChatSxProps {
70
+ icon?: ReactNode;
71
+ title?: ReactNode;
72
+ description?: ReactNode;
73
+ items: string[] | ChatStarterItem[];
74
+ size?: 'small' | 'medium';
75
+ onSelect?: (prompt: string) => void;
76
+ }
77
+ export interface ChatActionsContainerProps extends ChatSxProps {
78
+ children: ReactNode;
79
+ }
80
+ export interface ChatRatingActionProps {
81
+ onRatingChange?: (rating: 'up' | 'down' | null) => void;
82
+ rating?: 'up' | 'down' | null;
83
+ labels?: {
84
+ thumbUp?: string;
85
+ thumbDown?: string;
86
+ };
87
+ }
88
+ export interface ChatToolItem {
89
+ id: string;
90
+ name: string;
91
+ status: 'loading' | 'thinking' | 'complete' | 'error';
92
+ content?: ReactNode;
93
+ }
94
+ export interface ChatToolsProps extends ChatSxProps {
95
+ tools: ChatToolItem[];
96
+ labels?: {
97
+ title?: string;
98
+ };
99
+ }
@@ -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 @@ import { CallbackDataParams, TopLevelFormatterParams } from '../../../../node_mo
8
8
  * Rounds a value up to the nearest "nice" number.
9
9
  * A nice number is a multiple of 10^floor(log10(value)).
10
10
  *
11
- * Examples: 547 → 600, 200 → 200, 1200 → 2000, 18 → 20, 5 → 5
11
+ * Examples: 547 → 600, 200 → 200, 1200 → 2000, 18 → 20, 5 → 5, -547 → -500
12
12
  */
13
13
  export declare function niceNum(value: number): number;
14
14
  /**
@@ -1,16 +1,9 @@
1
1
  import { DownloadItem } from '../actions';
2
2
  import { ConfigProps } from '../loader/types';
3
- import { CategoryWidgetConfig, CategoryWidgetData, CategorySeriesConfig, CategoryLabels } from './types';
4
- export interface CategoryDownloadConfigProps extends ConfigProps {
3
+ import { CategoryWidgetConfig, CategoryWidgetData, CategorySeriesConfig } from './types';
4
+ interface CategoryDownloadConfigProps extends ConfigProps {
5
5
  series?: CategorySeriesConfig[];
6
6
  }
7
- export interface CategoryConfigProps {
8
- data?: CategoryWidgetData;
9
- series?: CategorySeriesConfig[];
10
- formatter?: (value: number) => string;
11
- maxItems?: number;
12
- labels?: CategoryLabels;
13
- max?: number;
14
- }
15
7
  export declare function categoryDownloadConfig({ refUI, series, }: CategoryDownloadConfigProps): DownloadItem<CategoryWidgetData>[];
16
8
  export declare function categoryConfig(): CategoryWidgetConfig;
9
+ export {};
@@ -1,6 +1,2 @@
1
1
  import { RangeWidgetConfig } from './types';
2
- export interface RangeConfigProps {
3
- formatter?: (value: number) => string;
4
- onChange?: (value: number[], index: number) => void;
5
- }
6
2
  export declare function rangeConfig(): RangeWidgetConfig;
@@ -1,10 +1,5 @@
1
1
  import { DownloadItem } from '../actions';
2
2
  import { ConfigProps } from '../loader/types';
3
3
  import { SpreadWidgetConfig, SpreadWidgetData } from './types';
4
- import { SeriesConfig } from '../formula/types';
5
- export interface SpreadConfigProps {
6
- formatter?: (value: number) => string;
7
- series?: SeriesConfig[];
8
- }
9
4
  export declare function spreadDownloadConfig({ refUI, }: ConfigProps): DownloadItem<SpreadWidgetData>[];
10
5
  export declare function spreadConfig(): SpreadWidgetConfig;
@@ -1,6 +1,5 @@
1
1
  import { ConfigProps } from '../loader/types';
2
- import { TableDownloadConfig, TableWidgetConfig, TableColumn, Mode, SortDirection } from './types';
3
- export declare const DEFAULT_MODE: Mode;
2
+ import { TableDownloadConfig, TableWidgetConfig, TableColumn, SortDirection } from './types';
4
3
  export declare const DEFAULT_PAGE = 0;
5
4
  export declare const DEFAULT_ROWS_PER_PAGE = 10;
6
5
  export declare const DEFAULT_ROWS_PER_PAGE_OPTIONS: number[];
@@ -4,7 +4,7 @@ import { TableUIProps } from './types';
4
4
  /**
5
5
  * Props for the base Table component
6
6
  */
7
- export interface TableComponentProps extends MuiTableProps {
7
+ interface TableComponentProps extends MuiTableProps {
8
8
  /** Table element ref */
9
9
  ref?: Ref<HTMLTableElement>;
10
10
  }
@@ -1,2 +1,2 @@
1
1
  import { WrapperOptionsProps } from '../types';
2
- export declare function Options({ labels, options }: WrapperOptionsProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function Options({ labels, options, }: WrapperOptionsProps): import("react/jsx-runtime").JSX.Element;