@carto/ps-react-ui 4.2.7 → 4.3.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.
- package/dist/cjs-D4KH3azB.js +85 -0
- package/dist/cjs-D4KH3azB.js.map +1 -0
- package/dist/components.js +770 -1415
- package/dist/components.js.map +1 -1
- package/dist/error-B2IJ9d2h.js +38 -0
- package/dist/error-B2IJ9d2h.js.map +1 -0
- package/dist/exports-Cr43OCul.js +51 -0
- package/dist/exports-Cr43OCul.js.map +1 -0
- package/dist/lasso-tool-BwRzEW7k.js +534 -0
- package/dist/lasso-tool-BwRzEW7k.js.map +1 -0
- package/dist/no-data-C54XJt13.js +61 -0
- package/dist/no-data-C54XJt13.js.map +1 -0
- package/dist/note-t51drNe0.js +124 -0
- package/dist/note-t51drNe0.js.map +1 -0
- package/dist/options-D9wflre6.js +49 -0
- package/dist/options-D9wflre6.js.map +1 -0
- package/dist/row-DrHwXNvF.js +35 -0
- package/dist/row-DrHwXNvF.js.map +1 -0
- package/dist/series-D3Pc-kYX.js +91 -0
- package/dist/series-D3Pc-kYX.js.map +1 -0
- package/dist/smart-tooltip-BEtBaIdz.js +39 -0
- package/dist/smart-tooltip-BEtBaIdz.js.map +1 -0
- package/dist/styles-CCZnY17y.js +117 -0
- package/dist/styles-CCZnY17y.js.map +1 -0
- package/dist/tooltip-BDnrRKrp.js +25 -0
- package/dist/tooltip-BDnrRKrp.js.map +1 -0
- package/dist/types/components/measurement-tools/styles.d.ts +13 -4
- package/dist/types/hooks/index.d.ts +2 -0
- package/dist/types/hooks/use-debounce.d.ts +19 -0
- package/dist/types/hooks/use-widget-ref.d.ts +17 -0
- package/dist/types/widgets/_shared/chart-config/config-factory.d.ts +38 -0
- package/dist/types/widgets/_shared/chart-config/csv-modifiers.d.ts +19 -0
- package/dist/types/widgets/_shared/chart-config/index.d.ts +7 -0
- package/dist/types/widgets/_shared/chart-config/option-builders.d.ts +85 -0
- package/dist/types/widgets/_shared/skeleton/index.d.ts +4 -0
- package/dist/types/widgets/_shared/skeleton/styles.d.ts +19 -0
- package/dist/types/widgets/actions/change-column/change-column-icon.d.ts +1 -0
- package/dist/types/widgets/actions/change-column/change-column.d.ts +16 -0
- package/dist/types/widgets/actions/change-column/sortable-column-item.d.ts +9 -0
- package/dist/types/widgets/actions/change-column/types.d.ts +19 -0
- package/dist/types/widgets/actions/download/download.d.ts +2 -0
- package/dist/types/widgets/actions/download/exports.d.ts +6 -0
- package/dist/types/widgets/actions/download/types.d.ts +21 -0
- package/dist/types/widgets/actions/fullscreen/fullscreen.d.ts +2 -0
- package/dist/types/widgets/actions/fullscreen/styles.d.ts +16 -0
- package/dist/types/widgets/actions/fullscreen/types.d.ts +20 -0
- package/dist/types/widgets/actions/index.d.ts +18 -0
- package/dist/types/widgets/actions/lock-selection/lock-selection.d.ts +19 -0
- package/dist/types/widgets/actions/lock-selection/types.d.ts +36 -0
- package/dist/types/widgets/actions/relative-data/relative-data.d.ts +18 -0
- package/dist/types/widgets/actions/relative-data/style.d.ts +8 -0
- package/dist/types/widgets/actions/relative-data/types.d.ts +27 -0
- package/dist/types/widgets/actions/relative-data/utils.d.ts +9 -0
- package/dist/types/widgets/actions/relative-data/utils.test.d.ts +1 -0
- package/dist/types/widgets/actions/searcher/searcher-toggle.d.ts +18 -0
- package/dist/types/widgets/actions/searcher/searcher.d.ts +21 -0
- package/dist/types/widgets/actions/searcher/types.d.ts +64 -0
- package/dist/types/widgets/actions/shared/styles.d.ts +11 -0
- package/dist/types/widgets/actions/stack-toggle/grouped-bar-chart-icon.d.ts +1 -0
- package/dist/types/widgets/actions/stack-toggle/stack-toggle.d.ts +16 -0
- package/dist/types/widgets/actions/stack-toggle/types.d.ts +25 -0
- package/dist/types/widgets/actions/zoom-toggle/index.d.ts +2 -0
- package/dist/types/widgets/actions/zoom-toggle/style.d.ts +13 -0
- package/dist/types/widgets/actions/zoom-toggle/types.d.ts +41 -0
- package/dist/types/widgets/actions/zoom-toggle/zoom-toggle.d.ts +18 -0
- package/dist/types/widgets/bar/config.d.ts +5 -0
- package/dist/types/widgets/bar/index.d.ts +3 -0
- package/dist/types/widgets/bar/skeleton.d.ts +1 -0
- package/dist/types/widgets/bar/style.d.ts +37 -0
- package/dist/types/widgets/bar/types.d.ts +9 -0
- package/dist/types/widgets/category/category-ui.d.ts +2 -0
- package/dist/types/widgets/category/components/category-bar.d.ts +7 -0
- package/dist/types/widgets/category/components/category-legend.d.ts +6 -0
- package/dist/types/widgets/category/components/category-row-multi.d.ts +11 -0
- package/dist/types/widgets/category/components/category-row-other.d.ts +6 -0
- package/dist/types/widgets/category/components/category-row-single.d.ts +11 -0
- package/dist/types/widgets/category/components/index.d.ts +10 -0
- package/dist/types/widgets/category/config.d.ts +16 -0
- package/dist/types/widgets/category/index.d.ts +6 -0
- package/dist/types/widgets/category/skeleton.d.ts +1 -0
- package/dist/types/widgets/category/style.d.ts +120 -0
- package/dist/types/widgets/category/types.d.ts +34 -0
- package/dist/types/widgets/echart/const.d.ts +1 -0
- package/dist/types/widgets/echart/echart-ui.d.ts +2 -0
- package/dist/types/widgets/echart/echart.d.ts +2 -0
- package/dist/types/widgets/echart/index.d.ts +5 -0
- package/dist/types/widgets/echart/options.d.ts +2 -0
- package/dist/types/widgets/echart/types.d.ts +34 -0
- package/dist/types/widgets/echart/utils.d.ts +80 -0
- package/dist/types/widgets/error/error.d.ts +2 -0
- package/dist/types/widgets/error/index.d.ts +2 -0
- package/dist/types/widgets/error/types.d.ts +12 -0
- package/dist/types/widgets/formula/components/item.d.ts +2 -0
- package/dist/types/widgets/formula/components/prefix.d.ts +2 -0
- package/dist/types/widgets/formula/components/row.d.ts +2 -0
- package/dist/types/widgets/formula/components/series.d.ts +2 -0
- package/dist/types/widgets/formula/components/suffix.d.ts +2 -0
- package/dist/types/widgets/formula/components/value.d.ts +2 -0
- package/dist/types/widgets/formula/config.d.ts +4 -0
- package/dist/types/widgets/formula/formula-ui.d.ts +2 -0
- package/dist/types/widgets/formula/index.d.ts +11 -0
- package/dist/types/widgets/formula/serializer.d.ts +16 -0
- package/dist/types/widgets/formula/skeleton.d.ts +1 -0
- package/dist/types/widgets/formula/style.d.ts +21 -0
- package/dist/types/widgets/formula/types.d.ts +42 -0
- package/dist/types/widgets/histogram/config.d.ts +5 -0
- package/dist/types/widgets/histogram/index.d.ts +3 -0
- package/dist/types/widgets/histogram/skeleton.d.ts +1 -0
- package/dist/types/widgets/histogram/style.d.ts +15 -0
- package/dist/types/widgets/histogram/types.d.ts +9 -0
- package/dist/types/widgets/index.d.ts +9 -1
- package/dist/types/widgets/loader/index.d.ts +3 -0
- package/dist/types/widgets/loader/loader.d.ts +2 -0
- package/dist/types/widgets/loader/types.d.ts +9 -0
- package/dist/types/widgets/loader/utils.d.ts +1 -0
- package/dist/types/widgets/markdown/config.d.ts +4 -0
- package/dist/types/widgets/markdown/index.d.ts +5 -0
- package/dist/types/widgets/markdown/markdown-ui.d.ts +2 -0
- package/dist/types/widgets/markdown/markdown.d.ts +2 -0
- package/dist/types/widgets/markdown/skeleton.d.ts +1 -0
- package/dist/types/widgets/markdown/style.d.ts +2 -0
- package/dist/types/widgets/markdown/types.d.ts +18 -0
- package/dist/types/widgets/no-data/index.d.ts +2 -0
- package/dist/types/widgets/no-data/no-data.d.ts +35 -0
- package/dist/types/widgets/no-data/style.d.ts +6 -0
- package/dist/types/widgets/no-data/types.d.ts +67 -0
- package/dist/types/widgets/note/index.d.ts +2 -0
- package/dist/types/widgets/note/note.d.ts +2 -0
- package/dist/types/widgets/note/style.d.ts +28 -0
- package/dist/types/widgets/note/types.d.ts +8 -0
- package/dist/types/widgets/pie/config.d.ts +5 -0
- package/dist/types/widgets/pie/index.d.ts +3 -0
- package/dist/types/widgets/pie/skeleton.d.ts +1 -0
- package/dist/types/widgets/pie/style.d.ts +15 -0
- package/dist/types/widgets/pie/types.d.ts +9 -0
- package/dist/types/widgets/range/components/range-item.d.ts +2 -0
- package/dist/types/widgets/range/config.d.ts +6 -0
- package/dist/types/widgets/range/index.d.ts +6 -0
- package/dist/types/widgets/range/range-ui.d.ts +2 -0
- package/dist/types/widgets/range/serializer.d.ts +16 -0
- package/dist/types/widgets/range/serializer.test.d.ts +1 -0
- package/dist/types/widgets/range/skeleton.d.ts +1 -0
- package/dist/types/widgets/range/style.d.ts +2 -0
- package/dist/types/widgets/range/types.d.ts +33 -0
- package/dist/types/widgets/scatterplot/config.d.ts +5 -0
- package/dist/types/widgets/scatterplot/index.d.ts +3 -0
- package/dist/types/widgets/scatterplot/skeleton.d.ts +1 -0
- package/dist/types/widgets/scatterplot/style.d.ts +24 -0
- package/dist/types/widgets/scatterplot/types.d.ts +9 -0
- package/dist/types/widgets/selection-summary/index.d.ts +2 -0
- package/dist/types/widgets/selection-summary/selection-summary.d.ts +2 -0
- package/dist/types/widgets/selection-summary/style.d.ts +9 -0
- package/dist/types/widgets/selection-summary/types.d.ts +13 -0
- package/dist/types/widgets/skeleton-loader/index.d.ts +2 -0
- package/dist/types/widgets/skeleton-loader/skeleton-loader.d.ts +2 -0
- package/dist/types/widgets/skeleton-loader/types.d.ts +7 -0
- package/dist/types/widgets/spread/components/max-value.d.ts +2 -0
- package/dist/types/widgets/spread/components/min-value.d.ts +2 -0
- package/dist/types/widgets/spread/components/separator.d.ts +2 -0
- package/dist/types/widgets/spread/config.d.ts +10 -0
- package/dist/types/widgets/spread/index.d.ts +9 -0
- package/dist/types/widgets/spread/skeleton.d.ts +1 -0
- package/dist/types/widgets/spread/spread-ui.d.ts +2 -0
- package/dist/types/widgets/spread/style.d.ts +21 -0
- package/dist/types/widgets/spread/types.d.ts +40 -0
- package/dist/types/widgets/stores/index.d.ts +2 -0
- package/dist/types/widgets/stores/types.d.ts +165 -0
- package/dist/types/widgets/stores/widget-store.d.ts +39 -0
- package/dist/types/widgets/stores/widget-store.test.d.ts +1 -0
- package/dist/types/widgets/subheader/index.d.ts +2 -0
- package/dist/types/widgets/subheader/style.d.ts +19 -0
- package/dist/types/widgets/subheader/subheader.d.ts +2 -0
- package/dist/types/widgets/subheader/types.d.ts +10 -0
- package/dist/types/widgets/table/components/cell-header.d.ts +5 -0
- package/dist/types/widgets/table/components/cell.d.ts +16 -0
- package/dist/types/widgets/table/components/index.d.ts +4 -0
- package/dist/types/widgets/table/components/pagination-actions.d.ts +5 -0
- package/dist/types/widgets/table/components/pagination.d.ts +5 -0
- package/dist/types/widgets/table/components/row.d.ts +5 -0
- package/dist/types/widgets/table/config.d.ts +17 -0
- package/dist/types/widgets/table/helpers.d.ts +38 -0
- package/dist/types/widgets/table/helpers.test.d.ts +1 -0
- package/dist/types/widgets/table/hooks/index.d.ts +6 -0
- package/dist/types/widgets/table/hooks/use-pagination.d.ts +33 -0
- package/dist/types/widgets/table/hooks/use-pagination.test.d.ts +1 -0
- package/dist/types/widgets/table/hooks/use-selection.d.ts +30 -0
- package/dist/types/widgets/table/hooks/use-selection.test.d.ts +1 -0
- package/dist/types/widgets/table/hooks/use-sort.d.ts +22 -0
- package/dist/types/widgets/table/hooks/use-sort.test.d.ts +1 -0
- package/dist/types/widgets/table/index.d.ts +13 -0
- package/dist/types/widgets/table/serializer.d.ts +16 -0
- package/dist/types/widgets/table/skeleton.d.ts +10 -0
- package/dist/types/widgets/table/style.d.ts +33 -0
- package/dist/types/widgets/table/table-ui.d.ts +32 -0
- package/dist/types/widgets/table/types.d.ts +196 -0
- package/dist/types/widgets/timeseries/config.d.ts +5 -0
- package/dist/types/widgets/timeseries/index.d.ts +3 -0
- package/dist/types/widgets/timeseries/skeleton.d.ts +1 -0
- package/dist/types/widgets/timeseries/style.d.ts +38 -0
- package/dist/types/widgets/timeseries/types.d.ts +9 -0
- package/dist/types/widgets/toolbar-actions/index.d.ts +2 -0
- package/dist/types/widgets/toolbar-actions/styles.d.ts +37 -0
- package/dist/types/widgets/toolbar-actions/toolbar-actions.d.ts +8 -0
- package/dist/types/widgets/toolbar-actions/types.d.ts +45 -0
- package/dist/types/widgets/wrapper/components/actions.d.ts +2 -0
- package/dist/types/widgets/wrapper/components/options.d.ts +2 -0
- package/dist/types/widgets/wrapper/components/title.d.ts +6 -0
- package/dist/types/widgets/wrapper/index.d.ts +6 -0
- package/dist/types/widgets/wrapper/styles.d.ts +89 -0
- package/dist/types/widgets/wrapper/types.d.ts +37 -0
- package/dist/types/widgets/wrapper/wrapper-ui.d.ts +2 -0
- package/dist/types/widgets/wrapper/wrapper.d.ts +2 -0
- package/dist/use-widget-ref-B0aNCANx.js +19 -0
- package/dist/use-widget-ref-B0aNCANx.js.map +1 -0
- package/dist/utils-D3-eQyDR.js +144 -0
- package/dist/utils-D3-eQyDR.js.map +1 -0
- package/dist/widget-store-CB6Trp_0.js +131 -0
- package/dist/widget-store-CB6Trp_0.js.map +1 -0
- package/dist/widgets/actions.js +872 -0
- package/dist/widgets/actions.js.map +1 -0
- package/dist/widgets/bar.js +188 -0
- package/dist/widgets/bar.js.map +1 -0
- package/dist/widgets/category.js +427 -0
- package/dist/widgets/category.js.map +1 -0
- package/dist/widgets/echart.js +115 -0
- package/dist/widgets/echart.js.map +1 -0
- package/dist/widgets/error.js +5 -0
- package/dist/widgets/error.js.map +1 -0
- package/dist/widgets/formula.js +119 -0
- package/dist/widgets/formula.js.map +1 -0
- package/dist/widgets/histogram.js +186 -0
- package/dist/widgets/histogram.js.map +1 -0
- package/dist/widgets/loader.js +57 -0
- package/dist/widgets/loader.js.map +1 -0
- package/dist/widgets/markdown.js +127 -0
- package/dist/widgets/markdown.js.map +1 -0
- package/dist/widgets/no-data.js +5 -0
- package/dist/widgets/no-data.js.map +1 -0
- package/dist/widgets/note.js +5 -0
- package/dist/widgets/note.js.map +1 -0
- package/dist/widgets/pie.js +230 -0
- package/dist/widgets/pie.js.map +1 -0
- package/dist/widgets/range.js +217 -0
- package/dist/widgets/range.js.map +1 -0
- package/dist/widgets/scatterplot.js +233 -0
- package/dist/widgets/scatterplot.js.map +1 -0
- package/dist/widgets/selection-summary.js +40 -0
- package/dist/widgets/selection-summary.js.map +1 -0
- package/dist/widgets/skeleton-loader.js +24 -0
- package/dist/widgets/skeleton-loader.js.map +1 -0
- package/dist/widgets/spread.js +161 -0
- package/dist/widgets/spread.js.map +1 -0
- package/dist/widgets/stores.js +5 -0
- package/dist/widgets/stores.js.map +1 -0
- package/dist/widgets/subheader.js +52 -0
- package/dist/widgets/subheader.js.map +1 -0
- package/dist/widgets/table.js +672 -0
- package/dist/widgets/table.js.map +1 -0
- package/dist/widgets/timeseries.js +187 -0
- package/dist/widgets/timeseries.js.map +1 -0
- package/dist/widgets/toolbar-actions.js +6725 -0
- package/dist/widgets/toolbar-actions.js.map +1 -0
- package/dist/widgets/wrapper.js +295 -0
- package/dist/widgets/wrapper.js.map +1 -0
- package/dist/widgets.js +12 -1
- package/dist/widgets.js.map +1 -1
- package/package.json +114 -4
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RangeDataItem } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Sanitizes RangeDataItem by converting ReactNode note values to undefined.
|
|
4
|
+
* This ensures only string values are stored in the widget state.
|
|
5
|
+
*
|
|
6
|
+
* @param item - The RangeDataItem to sanitize
|
|
7
|
+
* @returns A new RangeDataItem with ReactNode note values converted to undefined
|
|
8
|
+
*/
|
|
9
|
+
export declare function sanitizeRangeDataItem(item: RangeDataItem): RangeDataItem;
|
|
10
|
+
/**
|
|
11
|
+
* Sanitizes an array of RangeDataItems by converting ReactNode note values to undefined.
|
|
12
|
+
*
|
|
13
|
+
* @param items - Array of RangeDataItems to sanitize
|
|
14
|
+
* @returns A new array with sanitized RangeDataItems
|
|
15
|
+
*/
|
|
16
|
+
export declare function sanitizeRangeDataItems(items: RangeDataItem[] | undefined): RangeDataItem[] | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function RangeSkeleton(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { BaseWidgetState, WidgetsStoreProps } from '../stores/types';
|
|
3
|
+
import { WrapperState } from '../wrapper/types';
|
|
4
|
+
import { DownloadItem } from '../actions/download/types';
|
|
5
|
+
export interface RangeUIProps {
|
|
6
|
+
id: WidgetsStoreProps['id'];
|
|
7
|
+
}
|
|
8
|
+
export interface RangeDataItem {
|
|
9
|
+
min: number;
|
|
10
|
+
max: number;
|
|
11
|
+
value?: number[];
|
|
12
|
+
step?: number;
|
|
13
|
+
marks?: boolean | {
|
|
14
|
+
value: number;
|
|
15
|
+
label?: string;
|
|
16
|
+
}[];
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
color?: string;
|
|
19
|
+
note?: string | ReactNode;
|
|
20
|
+
}
|
|
21
|
+
export interface RangeItemProps {
|
|
22
|
+
id: WidgetsStoreProps['id'];
|
|
23
|
+
index: number;
|
|
24
|
+
}
|
|
25
|
+
export type RangeWidgetData = RangeDataItem[];
|
|
26
|
+
export type RangeWidgetState = BaseWidgetState<WrapperState<RangeWidgetConfig>> & {
|
|
27
|
+
data: RangeWidgetData;
|
|
28
|
+
};
|
|
29
|
+
export interface RangeWidgetConfig {
|
|
30
|
+
formatter?: (value: number) => string;
|
|
31
|
+
onChange?: (value: number[], index: number) => void;
|
|
32
|
+
}
|
|
33
|
+
export type RangeDownloadConfig = DownloadItem<RangeWidgetData>[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ScatterplotConfig, ScatterplotWidgetConfig, ScatterplotWidgetData } from './types';
|
|
2
|
+
import { DownloadItem } from '../actions';
|
|
3
|
+
import { ConfigProps } from '../loader/types';
|
|
4
|
+
export declare function scatterplotDownloadConfig({ refUI, }: ConfigProps): DownloadItem<ScatterplotWidgetData>[];
|
|
5
|
+
export declare function scatterplotConfig(props: ScatterplotConfig): ScatterplotWidgetConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ScatterplotSkeleton(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
export declare const styles: {
|
|
3
|
+
skeleton: {
|
|
4
|
+
graph: {
|
|
5
|
+
container: {
|
|
6
|
+
position: "relative";
|
|
7
|
+
display: "flex";
|
|
8
|
+
alignItems: "center";
|
|
9
|
+
justifyContent: "space-between";
|
|
10
|
+
flexDirection: "column";
|
|
11
|
+
gap: ({ spacing }: Theme) => string;
|
|
12
|
+
height: ({ spacing }: Theme) => string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
legend: {
|
|
16
|
+
display: "flex";
|
|
17
|
+
alignItems: "center";
|
|
18
|
+
gap: ({ spacing }: Theme) => string;
|
|
19
|
+
height: ({ spacing }: Theme) => string;
|
|
20
|
+
position: "absolute";
|
|
21
|
+
bottom: number;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EchartWidgetState } from '../echart';
|
|
2
|
+
import { EchartWidgetOptionProps, EchartWidgetProps } from '../echart/types';
|
|
3
|
+
import { ConfigProps } from '../loader';
|
|
4
|
+
export type ScatterplotWidgetData = [number, number][][];
|
|
5
|
+
export type ScatterplotWidgetState = EchartWidgetState;
|
|
6
|
+
export type ScatterplotWidgetConfig = EchartWidgetProps & {
|
|
7
|
+
type: 'scatterplot';
|
|
8
|
+
};
|
|
9
|
+
export type ScatterplotConfig = ConfigProps & EchartWidgetOptionProps<ScatterplotWidgetData>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface WidgetSelectionSummaryProps {
|
|
2
|
+
selections: number;
|
|
3
|
+
onClear?: () => void;
|
|
4
|
+
labels?: Partial<SelectionSummaryLabels>;
|
|
5
|
+
}
|
|
6
|
+
export interface SelectionSummaryLabels {
|
|
7
|
+
/** Label for "All selected" state */
|
|
8
|
+
allSelected: string;
|
|
9
|
+
/** Label for number of selections */
|
|
10
|
+
selections: (count: number) => string;
|
|
11
|
+
/** Label for clear button */
|
|
12
|
+
clear: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { SkeletonLoaderProps } from './types';
|
|
2
|
+
export declare function SkeletonLoader({ id, children, Skeleton, }: SkeletonLoaderProps): string | number | bigint | boolean | Iterable<import('react').ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<import('react').ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DownloadItem } from '../actions';
|
|
2
|
+
import { ConfigProps } from '../loader/types';
|
|
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
|
+
export declare function spreadDownloadConfig({ refUI, }: ConfigProps): DownloadItem<SpreadWidgetData>[];
|
|
10
|
+
export declare function spreadConfig(): SpreadWidgetConfig;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { SpreadUI } from './spread-ui';
|
|
2
|
+
export { SpreadSkeleton } from './skeleton';
|
|
3
|
+
export { spreadConfig, spreadDownloadConfig } from './config';
|
|
4
|
+
export { MinValue } from './components/min-value';
|
|
5
|
+
export { MaxValue } from './components/max-value';
|
|
6
|
+
export { Separator } from './components/separator';
|
|
7
|
+
export { Item, Row, Prefix, Suffix, Series } from '../formula';
|
|
8
|
+
export type { RowProps, ValueProps, SpreadWidgetState, SpreadWidgetConfig, SpreadWidgetData, SpreadDownloadConfig, ItemProps, SpreadDataItem, SpreadUIProps, } from './types';
|
|
9
|
+
export type { SeriesConfig } from '../formula/types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SpreadSkeleton(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
export declare const styles: {
|
|
3
|
+
root: {
|
|
4
|
+
display: "flex";
|
|
5
|
+
flexDirection: "column";
|
|
6
|
+
gap: (theme: Theme) => string;
|
|
7
|
+
};
|
|
8
|
+
item: {
|
|
9
|
+
'&[data-disabled="true"]': {
|
|
10
|
+
color: (theme: Theme) => string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
row: {
|
|
14
|
+
display: "flex";
|
|
15
|
+
alignItems: "center";
|
|
16
|
+
gap: (theme: Theme) => string;
|
|
17
|
+
'& + &': {
|
|
18
|
+
marginTop: (theme: Theme) => string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { TypographyProps } from '@mui/material';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { BaseWidgetState, WidgetsStoreProps } from '../stores/types';
|
|
4
|
+
import { WrapperState } from '../wrapper/types';
|
|
5
|
+
import { DownloadItem } from '../actions/download/types';
|
|
6
|
+
import { SeriesConfig } from '../formula/types';
|
|
7
|
+
export interface SpreadUIProps {
|
|
8
|
+
id: WidgetsStoreProps['id'];
|
|
9
|
+
}
|
|
10
|
+
export interface SpreadDataItem {
|
|
11
|
+
min: number;
|
|
12
|
+
max: number;
|
|
13
|
+
prefix?: string | ReactNode;
|
|
14
|
+
suffix?: string | ReactNode;
|
|
15
|
+
color?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface RowProps {
|
|
18
|
+
id: WidgetsStoreProps['id'];
|
|
19
|
+
children: ReactNode | ((props: {
|
|
20
|
+
index: number;
|
|
21
|
+
}) => ReactNode);
|
|
22
|
+
}
|
|
23
|
+
export interface ValueProps extends Omit<ItemProps, 'children'> {
|
|
24
|
+
id: WidgetsStoreProps['id'];
|
|
25
|
+
index?: number;
|
|
26
|
+
}
|
|
27
|
+
export interface ItemProps {
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
TypographyProps?: TypographyProps;
|
|
31
|
+
}
|
|
32
|
+
export type SpreadWidgetData = SpreadDataItem[];
|
|
33
|
+
export type SpreadWidgetState = BaseWidgetState<WrapperState<SpreadWidgetConfig> & {
|
|
34
|
+
data: SpreadWidgetData;
|
|
35
|
+
}>;
|
|
36
|
+
export interface SpreadWidgetConfig {
|
|
37
|
+
formatter?: (value: number) => string;
|
|
38
|
+
series?: SeriesConfig[];
|
|
39
|
+
}
|
|
40
|
+
export type SpreadDownloadConfig = DownloadItem<SpreadWidgetData>[];
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export interface WidgetsStoreProps {
|
|
3
|
+
/** Unique identifier for the widget */
|
|
4
|
+
id: string;
|
|
5
|
+
/** Type of widget */
|
|
6
|
+
type: string;
|
|
7
|
+
/** Widget data - flexible to accommodate different widget types */
|
|
8
|
+
data: unknown;
|
|
9
|
+
/** Loading state */
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
/** Fetching state (e.g., for async data) */
|
|
12
|
+
isFetching: boolean;
|
|
13
|
+
/** Error message if any */
|
|
14
|
+
error?: {
|
|
15
|
+
title?: string;
|
|
16
|
+
message?: string;
|
|
17
|
+
};
|
|
18
|
+
/** Whether widget is visible */
|
|
19
|
+
visible?: boolean;
|
|
20
|
+
/** Reference to the widget ui instance */
|
|
21
|
+
refUI?: RefObject<HTMLElement | null>;
|
|
22
|
+
/** Registered tools for the widget's transformation pipeline */
|
|
23
|
+
registeredTools?: ToolRegistration[];
|
|
24
|
+
/** Formatter function for widget values */
|
|
25
|
+
formatter?: (value: number) => string;
|
|
26
|
+
/** Locale for number formatting (e.g., 'en-US', 'es-ES', 'fr-FR') */
|
|
27
|
+
locale?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Tool transformation function type
|
|
31
|
+
* Can be synchronous or asynchronous to support remote operations
|
|
32
|
+
*/
|
|
33
|
+
export type ToolTransformFunction = (data: unknown, config?: Record<string, unknown>) => Promise<unknown> | unknown;
|
|
34
|
+
/**
|
|
35
|
+
* Tool registration for widget pipeline
|
|
36
|
+
*
|
|
37
|
+
* @example Basic tool registration
|
|
38
|
+
* ```typescript
|
|
39
|
+
* registerTool(widgetId, {
|
|
40
|
+
* id: 'searcher',
|
|
41
|
+
* order: 10,
|
|
42
|
+
* enabled: true,
|
|
43
|
+
* fn: (data) => filterData(data),
|
|
44
|
+
* })
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @example Tool with dependencies
|
|
48
|
+
* ```typescript
|
|
49
|
+
* registerTool(widgetId, {
|
|
50
|
+
* id: 'lock-selection',
|
|
51
|
+
* order: 20,
|
|
52
|
+
* enabled: true,
|
|
53
|
+
* fn: (data) => lockData(data),
|
|
54
|
+
* disables: ['searcher', 'relative-data'], // Disable these when active
|
|
55
|
+
* })
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* Dependency Management:
|
|
59
|
+
* - Multiple tools can disable the same target (reference counting)
|
|
60
|
+
* - Target is only re-enabled when ALL disabling tools are inactive
|
|
61
|
+
* - Original enabled state is preserved and restored
|
|
62
|
+
* - Circular dependencies are detected and throw errors
|
|
63
|
+
*/
|
|
64
|
+
export interface ToolRegistration {
|
|
65
|
+
/** Unique tool identifier (e.g., 'searcher', 'relative-data') */
|
|
66
|
+
id: string;
|
|
67
|
+
/** Execution priority - lower numbers execute first */
|
|
68
|
+
order: number;
|
|
69
|
+
/** Transformation function */
|
|
70
|
+
fn: ToolTransformFunction;
|
|
71
|
+
/** Whether tool is currently enabled */
|
|
72
|
+
enabled: boolean;
|
|
73
|
+
/** Tool-specific configuration */
|
|
74
|
+
config?: Record<string, unknown>;
|
|
75
|
+
/**
|
|
76
|
+
* Array of tool IDs to disable when this tool is active.
|
|
77
|
+
* During pipeline execution, if this tool is enabled, any tools listed
|
|
78
|
+
* in this array will be excluded from the pipeline.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* disables: ['searcher', 'relative-data']
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
disables?: string[];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Base widget state interface
|
|
89
|
+
*/
|
|
90
|
+
export type BaseWidgetState<T> = WidgetsStoreProps & T;
|
|
91
|
+
/**
|
|
92
|
+
* Union type for all widget states
|
|
93
|
+
*/
|
|
94
|
+
export type WidgetState = BaseWidgetState<unknown>;
|
|
95
|
+
/**
|
|
96
|
+
* Widget store state with tool registration
|
|
97
|
+
*/
|
|
98
|
+
export interface WidgetStoreState {
|
|
99
|
+
/** Map of widget id to widget state */
|
|
100
|
+
widgets: Record<string, WidgetState>;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Widget store actions
|
|
104
|
+
*/
|
|
105
|
+
export interface WidgetStoreActions {
|
|
106
|
+
/**
|
|
107
|
+
* Add or update a widget in the store
|
|
108
|
+
* @param id - Widget ID
|
|
109
|
+
* @param widget - Widget state properties to merge (accepts any object structure)
|
|
110
|
+
* @template T - Type of the widget state for type-safe access
|
|
111
|
+
*/
|
|
112
|
+
setWidget: <T = any>(id: WidgetState['id'], widget: Partial<T>) => void;
|
|
113
|
+
/**
|
|
114
|
+
* Remove a widget from the store
|
|
115
|
+
* @param id - Widget ID to remove
|
|
116
|
+
*/
|
|
117
|
+
removeWidget: (id: WidgetState['id']) => void;
|
|
118
|
+
/**
|
|
119
|
+
* Clear all widgets
|
|
120
|
+
*/
|
|
121
|
+
clearWidgets: () => void;
|
|
122
|
+
/**
|
|
123
|
+
* Get widget by ID
|
|
124
|
+
* @param id - Widget ID
|
|
125
|
+
* @returns Widget state or undefined if not found
|
|
126
|
+
*/
|
|
127
|
+
getWidget: <T extends WidgetState = WidgetState>(id: WidgetState['id']) => T | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* Register a tool with the widget's transformation pipeline
|
|
130
|
+
* @param widgetId - Widget ID
|
|
131
|
+
* @param tool - Tool registration object
|
|
132
|
+
*/
|
|
133
|
+
registerTool: (widgetId: string, tool: ToolRegistration) => void;
|
|
134
|
+
/**
|
|
135
|
+
* Unregister a tool from the widget's transformation pipeline
|
|
136
|
+
* @param widgetId - Widget ID
|
|
137
|
+
* @param toolId - Tool ID to remove
|
|
138
|
+
*/
|
|
139
|
+
unregisterTool: (widgetId: string, toolId: string) => void;
|
|
140
|
+
/**
|
|
141
|
+
* Update tool configuration
|
|
142
|
+
* @param widgetId - Widget ID
|
|
143
|
+
* @param toolId - Tool ID
|
|
144
|
+
* @param config - New configuration to merge
|
|
145
|
+
*/
|
|
146
|
+
updateToolConfig: (widgetId: string, toolId: string, config: Record<string, unknown>) => void;
|
|
147
|
+
/**
|
|
148
|
+
* Set tool enabled state
|
|
149
|
+
* @param widgetId - Widget ID
|
|
150
|
+
* @param toolId - Tool ID
|
|
151
|
+
* @param enabled - Whether tool should be enabled
|
|
152
|
+
*/
|
|
153
|
+
setToolEnabled: (widgetId: string, toolId: string, enabled: boolean) => void;
|
|
154
|
+
/**
|
|
155
|
+
* Execute the tool transformation pipeline
|
|
156
|
+
* Supports both synchronous and asynchronous tools
|
|
157
|
+
* @param widgetId - Widget ID
|
|
158
|
+
* @param sourceData - Original data to transform
|
|
159
|
+
*/
|
|
160
|
+
executeToolPipeline: (widgetId: string, sourceData: unknown) => Promise<void>;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Complete widget store interface
|
|
164
|
+
*/
|
|
165
|
+
export type WidgetStore = WidgetStoreState & WidgetStoreActions;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { WidgetStore } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Zustand store for managing widget state across the application.
|
|
4
|
+
*
|
|
5
|
+
* This store provides centralized state management for all widget UI components
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* // Import the store
|
|
10
|
+
* import { useWidgetStore } from '@carto/ps-react-ui/widgets'
|
|
11
|
+
*
|
|
12
|
+
* // Use in a component
|
|
13
|
+
* function MyWidget() {
|
|
14
|
+
* const setWidget = useWidgetStore((state) => state.setWidget)
|
|
15
|
+
* const widget = useWidgetStore((state) => state.widgets['my-widget'])
|
|
16
|
+
*
|
|
17
|
+
* useEffect(() => {
|
|
18
|
+
* setWidget({
|
|
19
|
+
* id: 'my-widget',
|
|
20
|
+
* type: 'formula',
|
|
21
|
+
* title: 'Total Sales',
|
|
22
|
+
* isLoading: false,
|
|
23
|
+
* visible: true,
|
|
24
|
+
* data: { value: 1000, prefix: '$' }
|
|
25
|
+
* })
|
|
26
|
+
* }, [setWidget])
|
|
27
|
+
*
|
|
28
|
+
* return <div>{widget?.data?.value}</div>
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* // Get widgets by type
|
|
35
|
+
* const getWidgetsByType = useWidgetStore((state) => state.getWidgetsByType)
|
|
36
|
+
* const formulaWidgets = getWidgetsByType('formula')
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare const useWidgetStore: import('node_modules/zustand/esm/react.mjs').UseBoundStore<import('node_modules/zustand/esm/vanilla.mjs').StoreApi<WidgetStore>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
export declare const styles: {
|
|
3
|
+
root: {
|
|
4
|
+
display: "flex";
|
|
5
|
+
alignItems: "center";
|
|
6
|
+
gap: ({ spacing }: Theme) => string;
|
|
7
|
+
minHeight: ({ spacing }: Theme) => string;
|
|
8
|
+
};
|
|
9
|
+
slotLeft: {
|
|
10
|
+
flexShrink: number;
|
|
11
|
+
};
|
|
12
|
+
slotRight: {
|
|
13
|
+
flexGrow: number;
|
|
14
|
+
display: "flex";
|
|
15
|
+
justifyContent: "flex-end";
|
|
16
|
+
alignItems: "center";
|
|
17
|
+
gap: ({ spacing }: Theme) => string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SxProps, Theme } from '@mui/material';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface WidgetSubHeaderProps {
|
|
4
|
+
/** Content for the left slot */
|
|
5
|
+
slotLeft?: ReactNode;
|
|
6
|
+
/** Content for the right slot*/
|
|
7
|
+
slotRight?: ReactNode;
|
|
8
|
+
/** Custom styles */
|
|
9
|
+
sx?: SxProps<Theme>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CellHeaderProps } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Table cell header component with optional sorting and select-all checkbox
|
|
4
|
+
*/
|
|
5
|
+
export declare function CellHeader({ column, sortState, onSort, isSelectAll, isAllSelected, isIndeterminate, onSelectAll, }: CellHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TableColumn } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Props for Cell component
|
|
4
|
+
*/
|
|
5
|
+
export interface CellProps {
|
|
6
|
+
/** Column definition */
|
|
7
|
+
column: TableColumn;
|
|
8
|
+
/** Cell value */
|
|
9
|
+
value: unknown;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Table cell component with automatic markdown support for string values
|
|
13
|
+
* Markdown is rendered when the raw value is a string and no formatter is defined.
|
|
14
|
+
* If a formatter is used, its output is rendered directly without markdown parsing.
|
|
15
|
+
*/
|
|
16
|
+
export declare function Cell({ column, value }: CellProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PaginationActionsProps } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Custom pagination actions with first/prev/next/last buttons
|
|
4
|
+
*/
|
|
5
|
+
export declare function PaginationActions({ count, page, rowsPerPage, onPageChange, }: PaginationActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RowProps } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Table row component with selection and hover support
|
|
4
|
+
*/
|
|
5
|
+
export declare function Row({ row, columns, isSelected, selectable, onClick, onSelect, onMouseEnter, onMouseLeave, }: RowProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ConfigProps } from '../loader/types';
|
|
2
|
+
import { TableDownloadConfig, TableWidgetConfig, TableColumn, Mode, SortDirection } from './types';
|
|
3
|
+
export declare const DEFAULT_MODE: Mode;
|
|
4
|
+
export declare const DEFAULT_PAGE = 0;
|
|
5
|
+
export declare const DEFAULT_ROWS_PER_PAGE = 10;
|
|
6
|
+
export declare const DEFAULT_ROWS_PER_PAGE_OPTIONS: number[];
|
|
7
|
+
export declare const DEFAULT_COLUMN_ID: null;
|
|
8
|
+
export declare const DEFAULT_DIRECTION: SortDirection;
|
|
9
|
+
/**
|
|
10
|
+
* Default table download configuration
|
|
11
|
+
* Supports PNG export (screenshot) and CSV export (data)
|
|
12
|
+
*/
|
|
13
|
+
export declare function tableDownloadConfig({ refUI, }: ConfigProps): TableDownloadConfig;
|
|
14
|
+
/**
|
|
15
|
+
* Default table widget configuration
|
|
16
|
+
*/
|
|
17
|
+
export declare function tableConfig(columns?: TableColumn[]): TableWidgetConfig;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Get formatted cell value for display
|
|
4
|
+
* Handles primitives, arrays, objects, and custom formatters
|
|
5
|
+
*
|
|
6
|
+
* @param cellValue - Raw cell value
|
|
7
|
+
* @param formatter - Optional formatter function
|
|
8
|
+
* @returns Formatted value for display
|
|
9
|
+
*/
|
|
10
|
+
export declare function getCellValue<T>(cellValue: T): ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Compare two values for sorting
|
|
13
|
+
* Handles strings, numbers, and other types
|
|
14
|
+
*
|
|
15
|
+
* @param a - First value
|
|
16
|
+
* @param b - Second value
|
|
17
|
+
* @param direction - Sort direction
|
|
18
|
+
* @returns Comparison result (-1, 0, 1)
|
|
19
|
+
*/
|
|
20
|
+
export declare function compareValues(a: unknown, b: unknown, direction: 'asc' | 'desc'): number;
|
|
21
|
+
/**
|
|
22
|
+
* Sort data array by column
|
|
23
|
+
*
|
|
24
|
+
* @param data - Data array to sort
|
|
25
|
+
* @param columnId - Column ID to sort by
|
|
26
|
+
* @param direction - Sort direction
|
|
27
|
+
* @returns Sorted data array (new array, does not mutate original)
|
|
28
|
+
*/
|
|
29
|
+
export declare function sortData<T extends Record<string, unknown>>(data: T[], columnId: string, direction: 'asc' | 'desc'): T[];
|
|
30
|
+
/**
|
|
31
|
+
* Paginate data array
|
|
32
|
+
*
|
|
33
|
+
* @param data - Data array to paginate
|
|
34
|
+
* @param page - Current page (0-indexed)
|
|
35
|
+
* @param rowsPerPage - Number of rows per page
|
|
36
|
+
* @returns Paginated data slice
|
|
37
|
+
*/
|
|
38
|
+
export declare function paginateData<T>(data: T[], page: number, rowsPerPage: number): T[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { usePagination } from './use-pagination';
|
|
2
|
+
export { useSort } from './use-sort';
|
|
3
|
+
export { useSelection } from './use-selection';
|
|
4
|
+
export type { UsePaginationResult } from './use-pagination';
|
|
5
|
+
export type { UseSortResult } from './use-sort';
|
|
6
|
+
export type { UseSelectionOptions, UseSelectionResult } from './use-selection';
|