@carto/ps-react-ui 4.20.1 → 4.21.1
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/{actions-Dy9JVr7F.js → actions-C7ZAO0FG.js} +4 -4
- package/dist/{actions-Dy9JVr7F.js.map → actions-C7ZAO0FG.js.map} +1 -1
- package/dist/{actions-DKX98LlI.js → actions-DZGaL_uT.js} +2 -2
- package/dist/{actions-DKX98LlI.js.map → actions-DZGaL_uT.js.map} +1 -1
- package/dist/{category-DHZscHaS.js → category-DZt6yiST.js} +3 -3
- package/dist/{category-DHZscHaS.js.map → category-DZt6yiST.js.map} +1 -1
- package/dist/{chart-config-BGt7wkK7.js → chart-config-BWxjodlt.js} +2 -2
- package/dist/chart-config-BWxjodlt.js.map +1 -0
- package/dist/chat.js.map +1 -1
- package/dist/{components-DDt4mOQn.js → components-DKjBezcJ.js} +73 -73
- package/dist/components-DKjBezcJ.js.map +1 -0
- package/dist/components.js +1 -1
- package/dist/{download-BT6qBamM.js → download-C7he8mSh.js} +2 -2
- package/dist/{download-BT6qBamM.js.map → download-C7he8mSh.js.map} +1 -1
- package/dist/{formula-Bk9CBzm2.js → formula-BNuRXsmh.js} +2 -2
- package/dist/{formula-Bk9CBzm2.js.map → formula-BNuRXsmh.js.map} +1 -1
- package/dist/{formula-Dsru_p-g.js → formula-Cqj84ZGX.js} +2 -2
- package/dist/{formula-Dsru_p-g.js.map → formula-Cqj84ZGX.js.map} +1 -1
- package/dist/legend.js +2 -0
- package/dist/legend.js.map +1 -1
- package/dist/{markdown-DnSJMPjQ.js → markdown-CV_KP-at.js} +2 -2
- package/dist/{markdown-DnSJMPjQ.js.map → markdown-CV_KP-at.js.map} +1 -1
- package/dist/{spread-Dy8pshpN.js → spread-C8T12Nfh.js} +3 -3
- package/dist/{spread-Dy8pshpN.js.map → spread-C8T12Nfh.js.map} +1 -1
- package/dist/{table-BfTG6rrs.js → table-CNQijNNB.js} +2 -2
- package/dist/{table-BfTG6rrs.js.map → table-CNQijNNB.js.map} +1 -1
- package/dist/types/chat/bubbles/chat-agent-message-markdown.d.ts +1 -1
- package/dist/types/chat/bubbles/chat-agent-message.d.ts +1 -1
- package/dist/types/chat/bubbles/chat-error-message.d.ts +1 -1
- package/dist/types/chat/bubbles/chat-suggestion-button.d.ts +1 -1
- package/dist/types/chat/bubbles/chat-user-message.d.ts +1 -1
- package/dist/types/chat/bubbles/index.d.ts +5 -5
- package/dist/types/chat/bubbles/styles.d.ts +88 -0
- package/dist/types/chat/containers/chat-content.d.ts +1 -1
- package/dist/types/chat/containers/chat-footer.d.ts +1 -1
- package/dist/types/chat/containers/chat-header.d.ts +1 -1
- package/dist/types/chat/containers/chat-starter.d.ts +1 -1
- package/dist/types/chat/containers/index.d.ts +4 -4
- package/dist/types/chat/feedback/chat-actions-container.d.ts +3 -0
- package/dist/types/chat/feedback/chat-loader.d.ts +1 -1
- package/dist/types/chat/feedback/chat-rating-action.d.ts +1 -1
- package/dist/types/chat/feedback/chat-thinking.d.ts +1 -1
- package/dist/types/chat/feedback/chat-tool-code-area.d.ts +1 -1
- package/dist/types/chat/feedback/chat-tool-full-view-dialog.d.ts +1 -1
- package/dist/types/chat/feedback/chat-tool-group.d.ts +1 -1
- package/dist/types/chat/feedback/chat-tool-trace.d.ts +1 -1
- package/dist/types/chat/feedback/get-tool-label.d.ts +1 -1
- package/dist/types/chat/feedback/index.d.ts +8 -8
- package/dist/types/chat/feedback/styles.d.ts +212 -0
- package/dist/types/chat/index.d.ts +21 -21
- package/dist/types/components/basemaps/basemaps.d.ts +1 -1
- package/dist/types/components/basemaps/const.d.ts +1 -1
- package/dist/types/components/basemaps/group.d.ts +1 -1
- package/dist/types/components/basemaps/header.d.ts +1 -1
- package/dist/types/components/copy-button/copy-button.d.ts +1 -1
- package/dist/types/components/geolocation-controls/geolocation-controls.d.ts +1 -1
- package/dist/types/components/index.d.ts +26 -26
- package/dist/types/components/lasso-tool/chip.d.ts +1 -1
- package/dist/types/components/lasso-tool/const.d.ts +2 -2
- package/dist/types/components/lasso-tool/geometry-toolbar.d.ts +1 -1
- package/dist/types/components/lasso-tool/lasso-tool-inline.d.ts +1 -1
- package/dist/types/components/lasso-tool/lasso-tool.d.ts +1 -1
- package/dist/types/components/lasso-tool/layer-filters.d.ts +1 -1
- package/dist/types/components/lasso-tool/message.d.ts +1 -1
- package/dist/types/components/lasso-tool/types.d.ts +1 -1
- package/dist/types/components/list-data/list-data.d.ts +1 -1
- package/dist/types/components/measurement-tools/const.d.ts +2 -2
- package/dist/types/components/measurement-tools/measurement-tools.d.ts +1 -1
- package/dist/types/components/measurement-tools/types.d.ts +1 -1
- package/dist/types/components/responsive-drawer/responsive-drawer.d.ts +10 -3
- package/dist/types/components/types.d.ts +1 -1
- package/dist/types/components/zoom-controls/zoom-controls.d.ts +1 -1
- package/dist/types/hooks/index.d.ts +1 -1
- package/dist/types/legend/components/icons.d.ts +1 -1
- package/dist/types/legend/components/index.d.ts +26 -26
- package/dist/types/legend/components/legend-category/legend-category-ui.d.ts +1 -1
- package/dist/types/legend/components/legend-icon/legend-icon-ui.d.ts +1 -1
- package/dist/types/legend/components/legend-item/legend-item-ui.d.ts +2 -2
- package/dist/types/legend/components/legend-proportion/legend-proportion-ui.d.ts +2 -2
- package/dist/types/legend/components/legend-ramp/legend-ramp-ui.d.ts +2 -2
- package/dist/types/legend/components/legend-sortable/sortable-entity.d.ts +1 -1
- package/dist/types/legend/components/legend-swatch/legend-swatch.d.ts +1 -1
- package/dist/types/legend/components/legend-visibility-toggle/legend-visibility-toggle.d.ts +2 -2
- package/dist/types/legend/components/run-async-menu-action.d.ts +1 -1
- package/dist/types/legend/index.d.ts +41 -41
- package/dist/types/legend/provider/index.d.ts +6 -6
- package/dist/types/legend/provider/legend-config-context.d.ts +1 -1
- package/dist/types/legend/provider/legend-provider.d.ts +2 -2
- package/dist/types/legend/stores/index.d.ts +5 -5
- package/dist/types/legend/stores/legend-store-registry.d.ts +1 -1
- package/dist/types/legend/stores/selectors.d.ts +1 -1
- package/dist/types/widgets/actions/brush-toggle/brush-toggle.d.ts +1 -1
- package/dist/types/widgets/actions/brush-toggle/hit-test.d.ts +1 -1
- package/dist/types/widgets/actions/brush-toggle/types.d.ts +1 -1
- package/dist/types/widgets/actions/change-column/change-column.d.ts +1 -1
- package/dist/types/widgets/actions/change-column/sortable-column-item.d.ts +1 -1
- package/dist/types/widgets/actions/download/download.d.ts +1 -1
- package/dist/types/widgets/actions/download/exports.d.ts +1 -1
- package/dist/types/widgets/actions/download/types.d.ts +1 -1
- package/dist/types/widgets/actions/fullscreen/fullscreen.d.ts +1 -1
- package/dist/types/widgets/actions/fullscreen/types.d.ts +1 -1
- package/dist/types/widgets/actions/index.d.ts +20 -20
- package/dist/types/widgets/actions/lock-selection/lock-selection.d.ts +1 -1
- package/dist/types/widgets/actions/lock-selection/types.d.ts +1 -1
- package/dist/types/widgets/actions/relative-data/relative-data.d.ts +1 -1
- package/dist/types/widgets/actions/relative-data/types.d.ts +1 -1
- package/dist/types/widgets/actions/relative-data/utils.d.ts +1 -1
- package/dist/types/widgets/actions/searcher/searcher-toggle.d.ts +1 -1
- package/dist/types/widgets/actions/searcher/searcher.d.ts +1 -1
- package/dist/types/widgets/actions/searcher/types.d.ts +2 -2
- package/dist/types/widgets/actions/stack-toggle/stack-toggle.d.ts +1 -1
- package/dist/types/widgets/actions/stack-toggle/types.d.ts +1 -1
- package/dist/types/widgets/actions/zoom-toggle/types.d.ts +1 -1
- package/dist/types/widgets/actions/zoom-toggle/zoom-toggle.d.ts +1 -1
- package/dist/types/widgets/bar/config.d.ts +2 -2
- package/dist/types/widgets/bar/index.d.ts +3 -3
- package/dist/types/widgets/bar/types.d.ts +3 -3
- package/dist/types/widgets/category/category-ui.d.ts +1 -1
- package/dist/types/widgets/category/components/category-legend.d.ts +1 -1
- package/dist/types/widgets/category/components/category-row-multi.d.ts +1 -1
- package/dist/types/widgets/category/components/category-row-single.d.ts +1 -1
- package/dist/types/widgets/category/config.d.ts +3 -3
- package/dist/types/widgets/category/index.d.ts +14 -14
- package/dist/types/widgets/category/types.d.ts +3 -3
- package/dist/types/widgets/echart/echart-ui.d.ts +1 -1
- package/dist/types/widgets/echart/echart.d.ts +1 -1
- package/dist/types/widgets/echart/index.d.ts +5 -5
- package/dist/types/widgets/echart/options.d.ts +1 -1
- package/dist/types/widgets/echart/types.d.ts +1 -1
- package/dist/types/widgets/echart/utils.d.ts +1 -1
- package/dist/types/widgets/error/error.d.ts +1 -1
- package/dist/types/widgets/error/index.d.ts +2 -2
- package/dist/types/widgets/error/types.d.ts +1 -1
- package/dist/types/widgets/formula/components/item.d.ts +1 -1
- package/dist/types/widgets/formula/components/prefix.d.ts +1 -1
- package/dist/types/widgets/formula/components/row.d.ts +1 -1
- package/dist/types/widgets/formula/components/series.d.ts +1 -1
- package/dist/types/widgets/formula/components/suffix.d.ts +1 -1
- package/dist/types/widgets/formula/components/value.d.ts +1 -1
- package/dist/types/widgets/formula/config.d.ts +2 -2
- package/dist/types/widgets/formula/formula-ui.d.ts +1 -1
- package/dist/types/widgets/formula/index.d.ts +11 -11
- package/dist/types/widgets/formula/serializer.d.ts +1 -1
- package/dist/types/widgets/formula/types.d.ts +3 -3
- package/dist/types/widgets/histogram/config.d.ts +3 -3
- package/dist/types/widgets/histogram/index.d.ts +4 -4
- package/dist/types/widgets/histogram/types.d.ts +3 -3
- package/dist/types/widgets/loader/index.d.ts +3 -3
- package/dist/types/widgets/loader/loader.d.ts +1 -1
- package/dist/types/widgets/loader/types.d.ts +1 -1
- package/dist/types/widgets/markdown/config.d.ts +2 -2
- package/dist/types/widgets/markdown/index.d.ts +5 -5
- package/dist/types/widgets/markdown/markdown-ui.d.ts +1 -1
- package/dist/types/widgets/markdown/markdown.d.ts +1 -1
- package/dist/types/widgets/markdown/types.d.ts +3 -3
- package/dist/types/widgets/no-data/index.d.ts +2 -2
- package/dist/types/widgets/no-data/no-data.d.ts +1 -1
- package/dist/types/widgets/no-data/types.d.ts +1 -1
- package/dist/types/widgets/note/index.d.ts +2 -2
- package/dist/types/widgets/note/note.d.ts +1 -1
- package/dist/types/widgets/note/types.d.ts +1 -1
- package/dist/types/widgets/pie/config.d.ts +2 -2
- package/dist/types/widgets/pie/index.d.ts +3 -3
- package/dist/types/widgets/pie/types.d.ts +3 -3
- package/dist/types/widgets/range/components/range-item.d.ts +1 -1
- package/dist/types/widgets/range/config.d.ts +1 -1
- package/dist/types/widgets/range/index.d.ts +6 -6
- package/dist/types/widgets/range/range-ui.d.ts +1 -1
- package/dist/types/widgets/range/serializer.d.ts +1 -1
- package/dist/types/widgets/range/types.d.ts +3 -3
- package/dist/types/widgets/scatterplot/config.d.ts +2 -2
- package/dist/types/widgets/scatterplot/index.d.ts +3 -3
- package/dist/types/widgets/scatterplot/types.d.ts +3 -3
- package/dist/types/widgets/selection-summary/index.d.ts +2 -2
- package/dist/types/widgets/selection-summary/selection-summary.d.ts +1 -1
- package/dist/types/widgets/skeleton-loader/index.d.ts +2 -2
- package/dist/types/widgets/skeleton-loader/skeleton-loader.d.ts +1 -1
- package/dist/types/widgets/skeleton-loader/types.d.ts +1 -1
- package/dist/types/widgets/spread/components/max-value.d.ts +1 -1
- package/dist/types/widgets/spread/components/min-value.d.ts +1 -1
- package/dist/types/widgets/spread/components/separator.d.ts +1 -1
- package/dist/types/widgets/spread/config.d.ts +3 -3
- package/dist/types/widgets/spread/index.d.ts +9 -9
- package/dist/types/widgets/spread/spread-ui.d.ts +1 -1
- package/dist/types/widgets/spread/types.d.ts +4 -4
- package/dist/types/widgets/stores/index.d.ts +3 -3
- package/dist/types/widgets/stores/use-widget-selector.d.ts +1 -1
- package/dist/types/widgets/stores/widget-store.d.ts +2 -2
- package/dist/types/widgets/subheader/index.d.ts +2 -2
- package/dist/types/widgets/subheader/subheader.d.ts +1 -1
- package/dist/types/widgets/table/components/cell-header.d.ts +1 -1
- package/dist/types/widgets/table/components/cell.d.ts +1 -1
- package/dist/types/widgets/table/components/pagination-actions.d.ts +1 -1
- package/dist/types/widgets/table/components/pagination.d.ts +1 -1
- package/dist/types/widgets/table/components/row.d.ts +1 -1
- package/dist/types/widgets/table/config.d.ts +2 -2
- package/dist/types/widgets/table/hooks/use-pagination.d.ts +1 -1
- package/dist/types/widgets/table/hooks/use-selection.d.ts +1 -1
- package/dist/types/widgets/table/hooks/use-sort.d.ts +1 -1
- package/dist/types/widgets/table/index.d.ts +17 -17
- package/dist/types/widgets/table/serializer.d.ts +1 -1
- package/dist/types/widgets/table/table-ui.d.ts +8 -8
- package/dist/types/widgets/table/types.d.ts +3 -3
- package/dist/types/widgets/timeseries/config.d.ts +2 -2
- package/dist/types/widgets/timeseries/index.d.ts +3 -3
- package/dist/types/widgets/timeseries/types.d.ts +3 -3
- package/dist/types/widgets/toolbar-actions/index.d.ts +2 -2
- package/dist/types/widgets/toolbar-actions/toolbar-actions.d.ts +1 -1
- package/dist/types/widgets/utils/chart-config/config-factory.d.ts +1 -1
- package/dist/types/widgets/utils/chart-config/download-config.d.ts +2 -2
- package/dist/types/widgets/utils/chart-config/index.d.ts +6 -6
- package/dist/types/widgets/utils/chart-config/option-builders.d.ts +142 -0
- package/dist/types/widgets/utils/index.d.ts +7 -7
- package/dist/types/widgets/utils/skeleton/index.d.ts +1 -1
- package/dist/types/widgets/wrapper/components/actions.d.ts +1 -1
- package/dist/types/widgets/wrapper/components/options.d.ts +1 -1
- package/dist/types/widgets/wrapper/components/title.d.ts +1 -1
- package/dist/types/widgets/wrapper/index.d.ts +6 -6
- package/dist/types/widgets/wrapper/types.d.ts +1 -1
- package/dist/types/widgets/wrapper/wrapper-ui.d.ts +1 -1
- package/dist/types/widgets/wrapper/wrapper.d.ts +1 -1
- package/dist/types/widgets-v2/actions/brush-toggle/brush-toggle.d.ts +1 -1
- package/dist/types/widgets-v2/actions/brush-toggle/index.d.ts +3 -3
- package/dist/types/widgets-v2/actions/change-column/change-column.d.ts +1 -1
- package/dist/types/widgets-v2/actions/change-column/index.d.ts +3 -3
- package/dist/types/widgets-v2/actions/change-column/types.d.ts +1 -1
- package/dist/types/widgets-v2/actions/download/csv-item.d.ts +1 -1
- package/dist/types/widgets-v2/actions/download/download.d.ts +2 -2
- package/dist/types/widgets-v2/actions/download/index.d.ts +8 -8
- package/dist/types/widgets-v2/actions/download/png-item.d.ts +1 -1
- package/dist/types/widgets-v2/actions/fullscreen/fullscreen.d.ts +1 -1
- package/dist/types/widgets-v2/actions/fullscreen/index.d.ts +3 -3
- package/dist/types/widgets-v2/actions/fullscreen/types.d.ts +1 -1
- package/dist/types/widgets-v2/actions/index.d.ts +10 -10
- package/dist/types/widgets-v2/actions/lock-selection/index.d.ts +3 -3
- package/dist/types/widgets-v2/actions/lock-selection/lock-selection.d.ts +1 -1
- package/dist/types/widgets-v2/actions/relative-data/index.d.ts +3 -3
- package/dist/types/widgets-v2/actions/relative-data/relative-data.d.ts +1 -1
- package/dist/types/widgets-v2/actions/searcher/index.d.ts +4 -4
- package/dist/types/widgets-v2/actions/searcher/searcher-toggle.d.ts +1 -1
- package/dist/types/widgets-v2/actions/searcher/searcher.d.ts +1 -1
- package/dist/types/widgets-v2/actions/show-all/index.d.ts +2 -2
- package/dist/types/widgets-v2/actions/show-all/show-all.d.ts +1 -1
- package/dist/types/widgets-v2/actions/stack-toggle/index.d.ts +3 -3
- package/dist/types/widgets-v2/actions/stack-toggle/stack-toggle.d.ts +1 -1
- package/dist/types/widgets-v2/actions/zoom-toggle/index.d.ts +3 -3
- package/dist/types/widgets-v2/actions/zoom-toggle/zoom-toggle.d.ts +2 -2
- package/dist/types/widgets-v2/bar/download.d.ts +2 -2
- package/dist/types/widgets-v2/bar/index.d.ts +4 -4
- package/dist/types/widgets-v2/bar/options.d.ts +2 -2
- package/dist/types/widgets-v2/bar/types.d.ts +1 -1
- package/dist/types/widgets-v2/category/category-ui.d.ts +1 -1
- package/dist/types/widgets-v2/category/category.d.ts +1 -1
- package/dist/types/widgets-v2/category/components/category-bar-stacked.d.ts +1 -1
- package/dist/types/widgets-v2/category/components/category-bar.d.ts +1 -1
- package/dist/types/widgets-v2/category/components/category-legend.d.ts +1 -1
- package/dist/types/widgets-v2/category/components/category-row-multi.d.ts +1 -1
- package/dist/types/widgets-v2/category/components/category-row-single.d.ts +1 -1
- package/dist/types/widgets-v2/category/components/category-row-stacked.d.ts +1 -1
- package/dist/types/widgets-v2/category/download.d.ts +2 -2
- package/dist/types/widgets-v2/category/index.d.ts +10 -10
- package/dist/types/widgets-v2/category/skeleton.d.ts +1 -1
- package/dist/types/widgets-v2/category/style.d.ts +1 -1
- package/dist/types/widgets-v2/category/types.d.ts +1 -1
- package/dist/types/widgets-v2/echart/echart.d.ts +1 -1
- package/dist/types/widgets-v2/echart/index.d.ts +4 -4
- package/dist/types/widgets-v2/echart/use-chart-selection.d.ts +1 -1
- package/dist/types/widgets-v2/formula/delta.d.ts +1 -1
- package/dist/types/widgets-v2/formula/download.d.ts +2 -2
- package/dist/types/widgets-v2/formula/formula-ui.d.ts +1 -1
- package/dist/types/widgets-v2/formula/index.d.ts +11 -11
- package/dist/types/widgets-v2/formula/types.d.ts +1 -1
- package/dist/types/widgets-v2/histogram/download.d.ts +2 -2
- package/dist/types/widgets-v2/histogram/index.d.ts +5 -5
- package/dist/types/widgets-v2/histogram/options.d.ts +3 -3
- package/dist/types/widgets-v2/histogram/types.d.ts +1 -1
- package/dist/types/widgets-v2/index.d.ts +45 -45
- package/dist/types/widgets-v2/markdown/download.d.ts +2 -2
- package/dist/types/widgets-v2/markdown/index.d.ts +6 -6
- package/dist/types/widgets-v2/note/widget-note.d.ts +1 -1
- package/dist/types/widgets-v2/pie/download.d.ts +2 -2
- package/dist/types/widgets-v2/pie/index.d.ts +4 -4
- package/dist/types/widgets-v2/pie/options.d.ts +2 -2
- package/dist/types/widgets-v2/pie/types.d.ts +1 -1
- package/dist/types/widgets-v2/range/index.d.ts +4 -4
- package/dist/types/widgets-v2/range/range-ui.d.ts +1 -1
- package/dist/types/widgets-v2/range/range.d.ts +1 -1
- package/dist/types/widgets-v2/scatterplot/download.d.ts +2 -2
- package/dist/types/widgets-v2/scatterplot/index.d.ts +5 -5
- package/dist/types/widgets-v2/scatterplot/options.d.ts +2 -2
- package/dist/types/widgets-v2/scatterplot/types.d.ts +1 -1
- package/dist/types/widgets-v2/selection-summary/selection-summary.d.ts +1 -1
- package/dist/types/widgets-v2/spread/download.d.ts +2 -2
- package/dist/types/widgets-v2/spread/index.d.ts +7 -7
- package/dist/types/widgets-v2/spread/spread-ui.d.ts +1 -1
- package/dist/types/widgets-v2/spread/types.d.ts +1 -1
- package/dist/types/widgets-v2/state/widget-state.d.ts +1 -1
- package/dist/types/widgets-v2/stores/index.d.ts +8 -8
- package/dist/types/widgets-v2/stores/pipeline-middleware.d.ts +1 -1
- package/dist/types/widgets-v2/stores/transforms.d.ts +1 -1
- package/dist/types/widgets-v2/stores/use-transform.d.ts +1 -1
- package/dist/types/widgets-v2/stores/widget-store-registry.d.ts +1 -1
- package/dist/types/widgets-v2/table/download.d.ts +2 -2
- package/dist/types/widgets-v2/table/helpers.d.ts +1 -1
- package/dist/types/widgets-v2/table/index.d.ts +8 -8
- package/dist/types/widgets-v2/table/table-ui.d.ts +2 -2
- package/dist/types/widgets-v2/table/table.d.ts +2 -2
- package/dist/types/widgets-v2/table/types.d.ts +1 -1
- package/dist/types/widgets-v2/timeseries/download.d.ts +2 -2
- package/dist/types/widgets-v2/timeseries/index.d.ts +5 -5
- package/dist/types/widgets-v2/timeseries/options.d.ts +4 -4
- package/dist/types/widgets-v2/timeseries/types.d.ts +1 -1
- package/dist/types/widgets-v2/toolbox/toolbox.d.ts +1 -1
- package/dist/types/widgets-v2/utils/index.d.ts +3 -3
- package/dist/types/widgets-v2/wrapper/index.d.ts +4 -4
- package/dist/types/widgets-v2/wrapper/widget-wrapper.d.ts +1 -1
- package/dist/{utils-DtvTjjMq.js → utils-ClB6nn4w.js} +2 -2
- package/dist/{utils-DtvTjjMq.js.map → utils-ClB6nn4w.js.map} +1 -1
- package/dist/widgets/actions.js +1 -1
- package/dist/widgets/bar.js +1 -1
- package/dist/widgets/category.js +1 -1
- package/dist/widgets/formula.js +1 -1
- package/dist/widgets/histogram.js +2 -2
- package/dist/widgets/markdown.js +1 -1
- package/dist/widgets/pie.js +1 -1
- package/dist/widgets/scatterplot.js +1 -1
- package/dist/widgets/spread.js +2 -2
- package/dist/widgets/table.js +14 -17
- package/dist/widgets/table.js.map +1 -1
- package/dist/widgets/timeseries.js +1 -1
- package/dist/widgets/utils.js +1 -1
- package/dist/widgets/wrapper.js +1 -1
- package/dist/widgets-v2/actions.js +3 -3
- package/dist/widgets-v2/bar.js +4 -4
- package/dist/widgets-v2/category.js +1 -1
- package/dist/widgets-v2/formula.js +1 -1
- package/dist/widgets-v2/histogram.js +4 -4
- package/dist/widgets-v2/markdown.js +1 -1
- package/dist/widgets-v2/pie.js +10 -10
- package/dist/widgets-v2/pie.js.map +1 -1
- package/dist/widgets-v2/scatterplot.js +4 -4
- package/dist/widgets-v2/spread.js +1 -1
- package/dist/widgets-v2/table.js +1 -1
- package/dist/widgets-v2/timeseries.js +4 -4
- package/dist/widgets-v2/utils.js +1 -1
- package/dist/widgets-v2.js +9 -9
- package/dist/{zoom-toggle-CA0ifG23.js → zoom-toggle-KA63b6-J.js} +2 -2
- package/dist/{zoom-toggle-CA0ifG23.js.map → zoom-toggle-KA63b6-J.js.map} +1 -1
- package/package.json +6 -5
- package/src/chat/bubbles/styles.ts +27 -8
- package/src/chat/feedback/chat-actions-container.tsx +5 -2
- package/src/chat/feedback/styles.ts +8 -5
- package/src/components/basemaps/basemaps.tsx +4 -4
- package/src/components/responsive-drawer/responsive-drawer.test.tsx +37 -23
- package/src/components/responsive-drawer/responsive-drawer.tsx +15 -8
- package/src/legend/components/legend-row/legend-row.test.tsx +19 -0
- package/src/legend/components/legend-row/legend-row.tsx +15 -2
- package/src/widgets/table/components/pagination-actions.tsx +4 -4
- package/src/widgets/utils/chart-config/option-builders.ts +5 -1
- package/src/widgets-v2/pie/options.test.ts +67 -0
- package/src/widgets-v2/pie/options.ts +27 -4
- package/src/widgets-v2/selection-summary/selection-summary.test.tsx +1 -1
- package/src/widgets-v2/toolbox/toolbox.test.tsx +1 -1
- package/dist/chart-config-BGt7wkK7.js.map +0 -1
- package/dist/components-DDt4mOQn.js.map +0 -1
- package/dist/types/legend/stores/legend-store.test.d.ts +0 -1
- package/dist/types/widgets/actions/brush-toggle/hit-test.test.d.ts +0 -1
- package/dist/types/widgets/actions/relative-data/utils.test.d.ts +0 -1
- package/dist/types/widgets/echart/utils.test.d.ts +0 -1
- package/dist/types/widgets/formula/config.test.d.ts +0 -1
- package/dist/types/widgets/loader/utils.test.d.ts +0 -1
- package/dist/types/widgets/range/serializer.test.d.ts +0 -1
- package/dist/types/widgets/stores/widget-store-branches.test.d.ts +0 -1
- package/dist/types/widgets/stores/widget-store-performance.test.d.ts +0 -1
- package/dist/types/widgets/stores/widget-store.test.d.ts +0 -1
- package/dist/types/widgets/table/config.test.d.ts +0 -1
- package/dist/types/widgets/table/helpers.test.d.ts +0 -1
- package/dist/types/widgets/table/hooks/use-pagination.test.d.ts +0 -1
- package/dist/types/widgets/table/hooks/use-selection.test.d.ts +0 -1
- package/dist/types/widgets/table/hooks/use-sort.test.d.ts +0 -1
- package/dist/types/widgets/utils/chart-config/option-builders.test.d.ts +0 -1
- package/dist/types/widgets-v2/actions/brush-toggle/transforms.test.d.ts +0 -1
- package/dist/types/widgets-v2/actions/relative-data/transforms.test.d.ts +0 -1
- package/dist/types/widgets-v2/actions/stack-toggle/transforms.test.d.ts +0 -1
- package/dist/types/widgets-v2/actions/zoom-toggle/transforms.test.d.ts +0 -1
- package/dist/types/widgets-v2/bar/options.test.d.ts +0 -1
- package/dist/types/widgets-v2/category/download.test.d.ts +0 -1
- package/dist/types/widgets-v2/echart/edge-label-clamp.test.d.ts +0 -1
- package/dist/types/widgets-v2/echart/shared-resize-observer.test.d.ts +0 -1
- package/dist/types/widgets-v2/histogram/download.test.d.ts +0 -1
- package/dist/types/widgets-v2/histogram/options.test.d.ts +0 -1
- package/dist/types/widgets-v2/histogram/transforms.test.d.ts +0 -1
- package/dist/types/widgets-v2/markdown/download.test.d.ts +0 -1
- package/dist/types/widgets-v2/pie/download.test.d.ts +0 -1
- package/dist/types/widgets-v2/pie/options.test.d.ts +0 -1
- package/dist/types/widgets-v2/scatterplot/download.test.d.ts +0 -1
- package/dist/types/widgets-v2/scatterplot/options.test.d.ts +0 -1
- package/dist/types/widgets-v2/scatterplot/transforms.test.d.ts +0 -1
- package/dist/types/widgets-v2/spread/band.test.d.ts +0 -1
- package/dist/types/widgets-v2/spread/download.test.d.ts +0 -1
- package/dist/types/widgets-v2/state/labels.test.d.ts +0 -1
- package/dist/types/widgets-v2/stores/pipeline-middleware.test.d.ts +0 -1
- package/dist/types/widgets-v2/stores/transforms.test.d.ts +0 -1
- package/dist/types/widgets-v2/stores/widget-store-registry.test.d.ts +0 -1
- package/dist/types/widgets-v2/table/download.test.d.ts +0 -1
- package/dist/types/widgets-v2/table/helpers.test.d.ts +0 -1
- package/dist/types/widgets-v2/table/transforms.test.d.ts +0 -1
- package/dist/types/widgets-v2/test-utils.d.ts +0 -52
- package/dist/types/widgets-v2/timeseries/download.test.d.ts +0 -1
- package/dist/types/widgets-v2/timeseries/options.test.d.ts +0 -1
- package/dist/types/widgets-v2/timeseries/transforms.test.d.ts +0 -1
- package/dist/types/widgets-v2/utils/merge-options.test.d.ts +0 -1
- package/dist/types/widgets-v2/utils/resolve-theme-color.test.d.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pie.js","names":["Theme","EChartsOption","echarts","CallbackDataParams","buildGridConfig","buildLegendConfig","buildSeriesLabelConfig","createTooltipFormatter","createTooltipPositioner","niceNum","OptionFactory","OptionFactoryContext","mergeOptions","resolveThemeColor","WidgetSeries","PieEChartsOption","PieOptionFactoryInput","PieOptionsInput","PieWidgetData","DEFAULT_RADIUS","pieOptions","theme","formatter","labelFormatter","legend","hasLegend","left","type","itemGap","selectedMode","tooltip","trigger","backgroundColor","palette","grey","borderWidth","padding","parseInt","spacing","textStyle","color","common","white","fontSize","fontFamily","typography","caption","position","buildPieTooltipFormatter","Object","values","qualitative","bold","Record","series","colorBy","avoidLabelOverlap","selectedOffset","legendHoverLink","emphasis","disabled","itemStyle","borderColor","background","paper","label","show","rich","b","fontWeight","lineHeight","c","createPieOptionFactory","options","optionsOverride","radius","selection","selectionSet","undefined","length","Set","option","data","ctx","structural","Partial","seriesArr","Array","isArray","dataset","buildMultiSeriesBarFusion","buildSingleSeriesPieFusion","seriesTemplates","broadcastTemplate","baseTooltip","baseLegend","resolvePaletteColor","params","swatch","dataIndex","colorFn","base","datum","value","name","has","modifyAlpha","centerData","centerMaxName","centerMaxValue","Infinity","d","labelTextFormatter","encodeIndex","encode","at","formattedValue","String","formattedName","map","s","source","_","i","template","templateObj","templateLabel","templateItemStyle","const","datasetIndex","center","itemName","selected","fromEntries","baseGrid","grid","niceMinVal","niceMaxVal","computeNiceBounds","barColorFn","seriesIdx","seriesIndex","seriesSwatch","right","containLabel","overrideColor","barMaxWidth","focus","xAxis","min","max","axisLine","axisTick","splitLine","lineStyle","black","divider","axisLabel","overlineDelicate","margin","showMaxLabel","showMinLabel","yAxis","buildHorizontalBarTooltipFormatter","item","x","dimName","dimensionNames","row","raw","marker","seriesName","Number","isFinite","Box","Skeleton","SxProps","Theme","OUTER_SIZE","HOLE_SIZE","styles","root","display","flexDirection","alignItems","justifyContent","minHeight","py","gap","spacing","donut","position","ring","width","height","hole","zIndex","borderRadius","bgcolor","label","legend","legendItem","Record","PieSkeletonProps","count","PieSkeleton","t0","$","_c","t1","t2","Symbol","for","t3","t4","map","_temp","i","buildCsvDownloadItem","buildPngDownloadItem","DownloadItem","PieWidgetData","createPieDownloadConfig","args","filename","getData","seriesNames","getCaptureEl","HTMLElement","pngPixelRatio","pngBackgroundColor","items","push","pixelRatio","backgroundColor","getRows","data","rows","i","series","entries","seriesName","slice","name","value"],"sources":["../../src/widgets-v2/pie/options.ts","../../src/widgets-v2/pie/skeleton.tsx","../../src/widgets-v2/pie/download.ts"],"sourcesContent":["import type { Theme } from '@mui/material'\nimport type { EChartsOption } from 'echarts'\nimport * as echarts from 'echarts'\nimport type { CallbackDataParams } from 'echarts/types/dist/shared'\nimport {\n buildGridConfig,\n buildLegendConfig,\n buildSeriesLabelConfig,\n createTooltipFormatter,\n createTooltipPositioner,\n niceNum,\n} from '../../widgets/utils/chart-config'\nimport type { OptionFactory, OptionFactoryContext } from '../echart'\nimport { mergeOptions, resolveThemeColor } from '../utils'\nimport type { WidgetSeries } from '../types'\nimport type {\n PieEChartsOption,\n PieOptionFactoryInput,\n PieOptionsInput,\n PieWidgetData,\n} from './types'\n\nconst DEFAULT_RADIUS: readonly [string, string] = ['58%', '74%']\n\n/**\n * Builds the **structural** ECharts option for a pie / donut widget.\n * Mirrors v1's pie look-and-feel: themed legend (`buildLegendConfig`),\n * themed tooltip via `createTooltipPositioner` / `createTooltipFormatter`,\n * `qualitative.bold` color palette, slice borders against the paper\n * background, hover-emphasis disabled, and a centered rich-text label.\n *\n * Layered like Bar / Histogram:\n * - **Theme-aware bits** live here on a series template (slice border,\n * center-label rich style sizes, emphasis-disabled).\n * - **Reactive bits** (tooltip value formatter, center-label text,\n * selection-driven dim) are re-emitted by\n * {@link createPieOptionFactory} at fusion time so RelativeData's\n * percent override flows through.\n */\nexport function pieOptions({\n theme,\n formatter,\n labelFormatter,\n}: PieOptionsInput): PieEChartsOption {\n return {\n legend: {\n ...buildLegendConfig({ hasLegend: true, labelFormatter }),\n // Pie reads better with a centered legend (the donut is radially\n // symmetric — left-aligning the legend below it visually unbalances\n // the chart). Override `buildLegendConfig`'s `type: 'scroll'` with\n // `'plain'` so long category lists wrap to multiple rows instead\n // of clipping the last visible item against the chart container.\n // The wider `itemGap` gives chips breathing room in the typical\n // 3–6 category case.\n left: 'center',\n type: 'scroll',\n itemGap: 16,\n // The legend is presentational only here — the pie has its own\n // click-to-select affordance on the slices themselves, so legend\n // clicks toggling series visibility would be a second, redundant/\n // conflicting interaction model. Hover-highlight is disabled per\n // series via `legendHoverLink` (ECharts has no legend-level knob\n // for it).\n selectedMode: false,\n },\n tooltip: {\n // Pie uses item-trigger (no axis); the rest of the styling mirrors\n // bar/histogram so the dashboard reads consistently — dark\n // grey[900] bg, white caption-font text, padded, with the shared\n // overflow-aware positioner.\n trigger: 'item',\n backgroundColor: theme.palette.grey[900],\n borderWidth: 0,\n padding: [parseInt(theme.spacing(1)), parseInt(theme.spacing(1))],\n textStyle: {\n color: theme.palette.common.white,\n fontSize: 11,\n fontFamily: theme.typography.caption.fontFamily,\n },\n position: createTooltipPositioner(theme),\n formatter: buildPieTooltipFormatter(formatter, labelFormatter),\n },\n // V1 used `qualitative.bold` only (no `secondary.main` prefix) because\n // pie slices are categorical — each slice deserves a distinct palette\n // entry from the start, not a primary highlight.\n color: Object.values(\n (theme.palette as { qualitative?: { bold?: Record<string, string> } })\n .qualitative?.bold ?? {},\n ),\n // Pie template. The merger spreads this into each per-data series it\n // emits — borderColor / borderWidth / emphasis-disabled / label rich\n // sizes all survive through.\n series: [\n {\n type: 'pie',\n colorBy: 'data',\n avoidLabelOverlap: true,\n selectedOffset: 0,\n legendHoverLink: false,\n emphasis: { disabled: true },\n itemStyle: {\n borderColor: theme.palette.background.paper,\n borderWidth: 1,\n },\n label: {\n show: true,\n position: 'center',\n rich: {\n b: { fontSize: 16, fontWeight: 'normal', lineHeight: 20 },\n c: { fontSize: 28, fontWeight: 'bold', lineHeight: 27 },\n },\n },\n },\n ],\n }\n}\n\n/**\n * Returns the pie widget's {@link OptionFactory} — one closure that owns\n * BOTH phases of option construction:\n *\n * - **Structural phase** (`option == null`) — builds the theme-aware\n * structural option via {@link pieOptions}, optionally merging the\n * consumer-supplied `optionsOverride` on top. Called once by Provider\n * to seed `rawOptions` in the store.\n * - **Merge phase** (`option != null`) — fuses post-pipeline `state.data`\n * (`PieWidgetData`) into the option via the dataset API. Single-series\n * → donut (one dataset, `series[i].encode = { itemName: 'name', value: 'value' }`).\n * Multi-series → horizontal-bar fallback (mirrors v1 pie). Reactive\n * formatters from `ctx` drive the tooltip + center label at fusion\n * time so RelativeData's percent formatter flows through without a\n * structural rebuild.\n */\nexport function createPieOptionFactory(\n options: PieOptionFactoryInput,\n): OptionFactory {\n const { theme, formatter, labelFormatter, optionsOverride, series } = options\n const radius = options.radius ?? DEFAULT_RADIUS\n const selection = options.selection\n // An explicit `[]` (deselected down to zero via chart clicks) is treated\n // the same as no selection: the pie has no bar/histogram-style \"nothing\n // selected\" affordance, so dimming every slice would just look broken —\n // it renders fully active, same as the no-interaction state.\n const selectionSet =\n selection === undefined || selection === null || selection.length === 0\n ? null\n : new Set<string | number>(selection)\n return (option, data, ctx) => {\n if (option == null) {\n const structural = pieOptions({ theme, formatter, labelFormatter })\n return optionsOverride\n ? (mergeOptions(\n structural as unknown as Record<string, unknown>,\n optionsOverride as Partial<Record<string, unknown>>,\n ) as EChartsOption)\n : structural\n }\n\n const seriesArr = Array.isArray(data) ? (data as PieWidgetData) : []\n if (seriesArr.length === 0) {\n return { ...option, dataset: [], series: [] }\n }\n if (seriesArr.length > 1) {\n return buildMultiSeriesBarFusion(\n option,\n seriesArr,\n theme,\n series,\n ctx,\n selectionSet,\n )\n }\n return buildSingleSeriesPieFusion(\n option,\n seriesArr,\n radius,\n series,\n ctx,\n selectionSet,\n )\n }\n}\n\n/**\n * Single-series donut fusion. Spreads the structural pie series template\n * into per-data series with center/radius/encoding, wires the reactive\n * center-label / tooltip formatters and the per-data palette-aware\n * selection-dim callback.\n */\nfunction buildSingleSeriesPieFusion(\n option: EChartsOption,\n seriesArr: PieWidgetData,\n radius: readonly [string, string],\n series: readonly WidgetSeries[] | undefined,\n ctx: OptionFactoryContext | undefined,\n selectionSet: Set<string | number> | null,\n): EChartsOption {\n const seriesTemplates = Array.isArray(option.series) ? option.series : []\n const broadcastTemplate = seriesTemplates[0] ?? {}\n const baseTooltip =\n typeof option.tooltip === 'object' && !Array.isArray(option.tooltip)\n ? option.tooltip\n : {}\n const baseLegend =\n typeof option.legend === 'object' && !Array.isArray(option.legend)\n ? option.legend\n : {}\n const formatter = ctx?.formatter\n const labelFormatter = ctx?.labelFormatter\n\n // Pie wants `colorBy: 'data'` — each slice draws from the option's\n // `color` palette by data index. But installing an `itemStyle.color`\n // callback disables ECharts' automatic per-data cycling, and\n // `params.color` collapses to the series color (so every slice goes\n // the same color). We re-implement the per-data palette resolution\n // here so the multicolor look survives selection-driven dimming.\n const palette = Array.isArray(option.color)\n ? (option.color as readonly (string | undefined)[])\n : []\n const resolvePaletteColor = (params: CallbackDataParams): string => {\n const swatch =\n palette.length > 0\n ? palette[params.dataIndex % palette.length]\n : undefined\n return swatch ?? (params.color as string)\n }\n\n // Always emit `itemStyle.color` (passthrough when nothing is selected),\n // not conditionally — same anti-stale-callback rationale as bar /\n // histogram. The slice border + width come from the structural\n // template's `itemStyle` and survive via the spread below.\n //\n // `selectionSet` is the *included* set, same direct semantics as\n // bar/histogram/timeseries (no ADR-014 exclusion inversion). Dim a slice\n // when its name is NOT in the set. `selectionSet` is never a non-null\n // empty Set — the collapse above (`selection.length === 0 → null`) rules\n // that out — so there's no \"dim everything\" case here, unlike a widget\n // that gives `[]` its own \"selected down to nothing\" meaning.\n const colorFn = (params: CallbackDataParams): string => {\n const base = resolvePaletteColor(params)\n if (!selectionSet) return base\n const datum = params.value as { name?: string | number } | undefined\n const name = datum?.name ?? params.name\n return name != null && selectionSet.has(name)\n ? base\n : echarts.color.modifyAlpha(base, 0.15)\n }\n\n // Which slice renders the centre value+name: the greatest value among\n // the *included* slices (all of them when there's no active\n // selection), computed locally — no query round-trip. Only that one\n // slice's formatter call returns text; every other slice returns ''\n // so exactly one label ever renders at the shared centre anchor. Only\n // `typeof value === 'number'` participates — if every included slice's\n // value is non-numeric, `centerMaxName` stays `undefined` and no slice\n // matches it in `labelTextFormatter` below, so the chart renders with no\n // centre label at all (graceful no-op, not a crash).\n const centerData = seriesArr[0] ?? []\n let centerMaxName: string | number | undefined\n let centerMaxValue = -Infinity\n for (const d of centerData) {\n if (selectionSet && !selectionSet.has(d.name)) continue\n if (typeof d.value === 'number' && d.value > centerMaxValue) {\n centerMaxValue = d.value\n centerMaxName = d.name\n }\n }\n\n // Center label formatter — lives in the merger because it reads\n // reactive `formatter` / `labelFormatter` from ctx. The rich tags\n // `{c|…}` and `{b|…}` reference the rich styles baked into the\n // structural label template.\n const labelTextFormatter = (params: CallbackDataParams): string => {\n const { name } = params\n if (name == null || name !== centerMaxName) return ''\n const encodeIndex = params.encode?.value?.[0]\n if (encodeIndex === undefined) return ''\n const value = (Object.values(params.data ?? {}) as unknown[]).at(\n encodeIndex,\n )\n // `value` here is the resolved dataset cell — for pie data it's a\n // `string | number` primitive. Anything else is a misuse we won't\n // dress up with `String(...)` (would render \"[object Object]\").\n const formattedValue =\n typeof value === 'number'\n ? formatter\n ? formatter(value)\n : String(value)\n : typeof value === 'string'\n ? value\n : ''\n const formattedName = labelFormatter\n ? String(labelFormatter(name ?? ''))\n : String(name ?? '')\n return `{c|${formattedValue}}\\n\\n{b|${formattedName}}`\n }\n\n return {\n ...option,\n dataset: seriesArr.map((s) => ({ source: s as readonly object[] })),\n series: seriesArr.map((_, i) => {\n const template =\n (seriesTemplates[i] as object | undefined) ??\n (broadcastTemplate as object)\n const templateObj = typeof template === 'object' ? template : {}\n const templateLabel = (templateObj as { label?: object }).label ?? {}\n const templateItemStyle =\n (templateObj as { itemStyle?: object }).itemStyle ?? {}\n return {\n ...templateObj,\n type: 'pie' as const,\n legendHoverLink: false,\n datasetIndex: i,\n name: series?.[i]?.name ?? `Series ${i + 1}`,\n radius: [...radius],\n // Lift the donut up so the bottom-anchored legend has the\n // vertical real estate to wrap to multiple rows for long\n // category lists — at exactly `50%` the bottom slices crowd\n // the chips and `type: 'plain'` legends can't expand upward\n // without overlapping the donut.\n center: ['50%', '38%'] as [string, string],\n encode: { itemName: 'name', value: 'value' },\n label: {\n ...templateLabel,\n formatter: labelTextFormatter,\n },\n itemStyle: {\n ...templateItemStyle,\n color: colorFn,\n },\n }\n }),\n // Legend always shows for pie (mirrors v1) — slice names drive the\n // entries, so even a single donut benefits from a category list.\n //\n // Exclusion is conveyed purely via `colorFn`/`labelTextFormatter`\n // dimming above, never via the legend's `selected` map: for a pie\n // series, ECharts treats `legend.selected[name] = false` as \"remove\n // this data point,\" which recomputes every remaining slice's angle —\n // the excluded slice disappears instead of rendering dimmed. Forcing\n // every name to `true` on every render also overrides ECharts' own\n // internal toggle state from a native legend click (which flips a\n // name to `false` and hides it before our `legendselectchanged`\n // handler gets a chance to react), so a legend click never leaves a\n // slice structurally removed — only the color/label dimming reflects\n // exclusion, and it stays in sync with the slice itself since both\n // read `selectionSet` on the same render.\n legend: {\n ...baseLegend,\n show: true,\n selectedMode: false,\n selected: Object.fromEntries(\n (seriesArr[0] ?? []).map((d) => [String(d.name), true]),\n ),\n },\n tooltip: {\n ...baseTooltip,\n formatter: buildPieTooltipFormatter(formatter, labelFormatter),\n },\n }\n}\n\n/**\n * Multi-series horizontal-bar fusion. Mirrors v1 pie's \"pie data with\n * >1 series collapses into a horizontal bar chart\" behavior — side-by-\n * side donuts don't read well when you're comparing the same categories\n * across cohorts, so swap to a value-on-x / category-on-y bar layout.\n *\n * Pie data shape is identical to bar's (`{ name, value }[][]`), so the\n * same dataset feeds either layout without transformation.\n */\nfunction buildMultiSeriesBarFusion(\n option: EChartsOption,\n seriesArr: PieWidgetData,\n theme: Theme,\n series: readonly WidgetSeries[] | undefined,\n ctx: OptionFactoryContext | undefined,\n selectionSet: Set<string | number> | null,\n): EChartsOption {\n const baseTooltip =\n typeof option.tooltip === 'object' && !Array.isArray(option.tooltip)\n ? option.tooltip\n : {}\n const baseLegend =\n typeof option.legend === 'object' && !Array.isArray(option.legend)\n ? option.legend\n : {}\n const baseGrid =\n typeof option.grid === 'object' && !Array.isArray(option.grid)\n ? option.grid\n : {}\n const formatter = ctx?.formatter\n const labelFormatter = ctx?.labelFormatter\n\n const { niceMinVal, niceMaxVal } = computeNiceBounds(seriesArr)\n\n // Per-series palette — multi-series bars take one color per series\n // (not per-data, unlike donut slices). Same anti-stale-callback rule:\n // always emit the callback so a transition to/from a selection\n // replaces the previous closure cleanly.\n const palette = Array.isArray(option.color)\n ? (option.color as readonly (string | undefined)[])\n : []\n const barColorFn = (params: CallbackDataParams): string => {\n const seriesIdx = params.seriesIndex ?? 0\n const seriesSwatch =\n palette.length > 0 ? palette[seriesIdx % palette.length] : undefined\n const base = (seriesSwatch ?? params.color) as string\n if (!selectionSet) return base\n const datum = params.value as { name?: string | number } | undefined\n const name = datum?.name ?? params.name\n return name != null && selectionSet.has(name)\n ? base\n : echarts.color.modifyAlpha(base, 0.15)\n }\n\n return {\n ...option,\n dataset: seriesArr.map((s) => ({ source: s as readonly object[] })),\n grid: {\n ...baseGrid,\n ...buildGridConfig(true, theme),\n right: parseInt(theme.spacing(4)),\n containLabel: true,\n },\n // Drop pie-specific structural keys that shouldn't render in the\n // bar fallback. ECharts ignores undefined keys, so this is a clean\n // override.\n series: seriesArr.map((_, i) => {\n const overrideColor = resolveThemeColor(theme, series?.[i]?.color)\n return {\n datasetIndex: i,\n type: 'bar' as const,\n name: series?.[i]?.name ?? `Series ${i + 1}`,\n barMaxWidth: 100,\n legendHoverLink: false,\n emphasis: { focus: 'series' },\n ...buildSeriesLabelConfig(formatter, 'x'),\n itemStyle: { color: barColorFn },\n ...(overrideColor ? { color: overrideColor } : {}),\n }\n }),\n xAxis: {\n type: 'value',\n // Closures over the pre-computed nice bounds — ECharts calls them\n // once per render to resolve the axis extents.\n min: () => niceMinVal,\n max: () => niceMaxVal,\n axisLine: { show: false },\n axisTick: { show: false },\n splitLine: {\n show: true,\n lineStyle: { color: theme.palette.black?.[4] ?? theme.palette.divider },\n },\n // Value labels render BELOW the axis line (default placement),\n // NOT inside the plot. Bar/histogram use `inside: true` +\n // `verticalAlign: 'bottom'` for their *vertical* y-axis where the\n // axis is the left wall — labels inside read like grid annotations.\n // A horizontal bar chart's value axis is the x-axis, and `inside`\n // there pushes the max label *behind* the bar (it visually\n // disappears once a bar reaches the right edge). Use the default\n // below-the-axis placement so the rounded extents stay readable.\n axisLabel: {\n fontSize: theme.typography.overlineDelicate?.fontSize,\n fontFamily: theme.typography.overlineDelicate?.fontFamily,\n margin: parseInt(theme.spacing(1)),\n showMaxLabel: true,\n showMinLabel: true,\n formatter: (value: number) => {\n if (value !== niceMaxVal && value !== niceMinVal) return ''\n if (value === 0) return ''\n return formatter ? formatter(value) : String(value)\n },\n },\n },\n yAxis: {\n type: 'category',\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n padding: [parseInt(theme.spacing(0.5)), 0, 0, 0],\n ...(labelFormatter && {\n formatter: (value: string | number) => String(labelFormatter(value)),\n }),\n },\n },\n // Mirrors the donut branch's `selected` reset above — `selectedMode:\n // false` blocks the native legend click that would otherwise undo an\n // ECharts-internal toggle, so without forcing every entry back to\n // `true` here a prior native toggle (from before `selectedMode` took\n // effect, or a stale `keepAlive` instance) would stay hidden forever\n // with no way to restore it.\n legend: {\n ...baseLegend,\n show: true,\n selectedMode: false,\n selected: Object.fromEntries(\n seriesArr.map((_, i) => [series?.[i]?.name ?? `Series ${i + 1}`, true]),\n ),\n },\n tooltip: {\n ...baseTooltip,\n trigger: 'axis',\n formatter: buildHorizontalBarTooltipFormatter(formatter, labelFormatter),\n },\n } as EChartsOption\n}\n\n/**\n * Tooltip formatter for the horizontal-bar fallback. Reads the value by\n * `encode.x` dimension index (v1 parity) so it stays robust to\n * downstream changes that rename dataset columns.\n */\nfunction buildHorizontalBarTooltipFormatter(\n formatter: ((value: number) => string) | undefined,\n labelFormatter: ((value: string | number) => string | number) | undefined,\n) {\n return createTooltipFormatter((item) => {\n const encodeIndex = item.encode?.x?.at(0)\n const dimName =\n encodeIndex !== undefined ? item.dimensionNames?.[encodeIndex] : undefined\n const row =\n item.value && typeof item.value === 'object' && !Array.isArray(item.value)\n ? (item.value as Record<string, string | number>)\n : undefined\n const raw = dimName && row ? row[dimName] : undefined\n const formattedValue =\n typeof raw === 'number' && formatter ? formatter(raw) : (raw ?? '')\n const marker = typeof item.marker === 'string' ? item.marker : ''\n const seriesName = item.seriesName ? `${item.seriesName}: ` : ''\n const name = labelFormatter\n ? String(labelFormatter(item.name ?? ''))\n : String(item.name ?? '')\n return { name, seriesName, marker, value: formattedValue }\n })\n}\n\n/**\n * Min/max bounds over every datum's `.value` across all series. Used by\n * the horizontal-bar fallback's x-axis label formatter so we only render\n * labels at the rounded extents (matches v1 + bar / histogram).\n */\nfunction computeNiceBounds(seriesArr: PieWidgetData): {\n niceMinVal: number\n niceMaxVal: number\n} {\n let min = 0\n let max = -Infinity\n for (const series of seriesArr) {\n for (const d of series) {\n if (typeof d?.value !== 'number' || !Number.isFinite(d.value)) continue\n if (d.value < min) min = d.value\n if (d.value > max) max = d.value\n }\n }\n return {\n niceMinVal: min < 0 ? niceNum(min) : 0,\n niceMaxVal: max <= 0 ? 1 : niceNum(max),\n }\n}\n\n/**\n * Tooltip formatter for pie slices. `item.value` is the dataset row\n * object (e.g. `{ name: 'A', value: 10 }`); we pull the value by\n * `encode.value`'s dimension index, formatted via the reactive `formatter`\n * if present. Slice name passes through `labelFormatter`.\n */\nfunction buildPieTooltipFormatter(\n formatter: ((value: number) => string) | undefined,\n labelFormatter: ((value: string | number) => string | number) | undefined,\n) {\n return createTooltipFormatter((item) => {\n const encodeIndex = item.encode?.value?.at(0) ?? 1\n const values =\n item.value && typeof item.value === 'object' && !Array.isArray(item.value)\n ? (Object.values(item.value) as (string | number)[])\n : []\n const raw = values[encodeIndex]\n const formattedValue =\n typeof raw === 'number' && formatter ? formatter(raw) : (raw ?? '')\n const marker = typeof item.marker === 'string' ? item.marker : ''\n const seriesName = item.seriesName ? `${item.seriesName}: ` : ''\n const name = labelFormatter\n ? String(labelFormatter(item.name ?? ''))\n : String(item.name ?? '')\n return { name, seriesName, marker, value: formattedValue }\n })\n}\n","import { Box, Skeleton } from '@mui/material'\nimport type { SxProps, Theme } from '@mui/material'\n\nconst OUTER_SIZE = 160\nconst HOLE_SIZE = 96\n\nconst styles = {\n root: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n minHeight: 200,\n py: 1,\n gap: ({ spacing }) => spacing(2),\n },\n donut: {\n position: 'relative',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n },\n ring: {\n width: OUTER_SIZE,\n height: OUTER_SIZE,\n },\n hole: {\n position: 'absolute',\n zIndex: 1,\n width: HOLE_SIZE,\n height: HOLE_SIZE,\n borderRadius: '50%',\n bgcolor: 'background.paper',\n },\n label: {\n position: 'absolute',\n zIndex: 2,\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n gap: ({ spacing }) => spacing(0.5),\n },\n legend: {\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(2),\n },\n legendItem: {\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(1.5),\n },\n} satisfies Record<string, SxProps<Theme>>\n\nexport interface PieSkeletonProps {\n count?: number\n}\n\n/**\n * Loading state for the Pie widget. Mirrors the donut silhouette — a ring\n * (gray circle with a background-coloured hole punched out), a stacked\n * value/name stub in the centre, and a centered legend stub below — so the\n * skeleton reads as \"a donut chart\" rather than a solid disc.\n *\n * Single donut only: multi-series pie loads as a horizontal bar chart, so\n * rendering one ring stays honest regardless of `count`.\n */\nexport function PieSkeleton({ count }: PieSkeletonProps) {\n // `count` is accepted for API compatibility but intentionally unused: the\n // skeleton always renders a single donut, since multi-series pie loads as a\n // horizontal bar chart rather than multiple donuts.\n void count\n return (\n <Box sx={styles.root}>\n <Box sx={styles.donut}>\n <Skeleton variant='circular' sx={styles.ring} />\n <Box sx={styles.hole} />\n <Box sx={styles.label}>\n <Skeleton width={56} height={18} />\n <Skeleton width={36} height={8} />\n </Box>\n </Box>\n <Box sx={styles.legend}>\n {[0, 1].map((i) => (\n <Box key={`legend-${i}`} sx={styles.legendItem}>\n <Skeleton variant='circular' width={8} height={8} />\n <Skeleton width={48} height={8} />\n </Box>\n ))}\n </Box>\n </Box>\n )\n}\n","import {\n buildCsvDownloadItem,\n buildPngDownloadItem,\n type DownloadItem,\n} from '../actions/download'\nimport type { PieWidgetData } from './types'\n\n/**\n * Download menu items for the Pie widget. Always includes a CSV item with\n * `series, name, value` columns (one row per slice; series labels come from\n * `seriesNames` if provided, else `series_<n>`). When `getCaptureEl` is\n * supplied, prepends a PNG item that rasterises the captured element via\n * `html2canvas`.\n */\nexport function createPieDownloadConfig(args: {\n filename: string\n getData: () => PieWidgetData\n seriesNames?: readonly string[]\n getCaptureEl?: () => HTMLElement | null\n pngPixelRatio?: number\n pngBackgroundColor?: string | null\n}): DownloadItem[] {\n const items: DownloadItem[] = []\n if (args.getCaptureEl) {\n items.push(\n buildPngDownloadItem({\n filename: args.filename,\n getCaptureEl: args.getCaptureEl,\n pixelRatio: args.pngPixelRatio,\n backgroundColor: args.pngBackgroundColor,\n }),\n )\n }\n items.push(\n buildCsvDownloadItem({\n filename: args.filename,\n getRows: () => {\n const data = args.getData()\n const rows: unknown[][] = [['series', 'name', 'value']]\n for (const [i, series] of data.entries()) {\n const seriesName = args.seriesNames?.[i] ?? `series_${i + 1}`\n for (const slice of series) {\n rows.push([seriesName, slice.name, slice.value])\n }\n }\n return rows\n },\n }),\n )\n return items\n}\n"],"mappings":";;;;;;;;AAsBA,IAAMmB,IAA4C,CAAC,OAAO,KAAK;AAiB/D,SAAgBC,EAAW,EACzBC,UACAC,cACAC,qBACoC;CACpC,OAAO;EACLC,QAAQ;GACN,GAAGnB,EAAkB;IAAEoB,WAAW;IAAMF;GAAe,CAAC;GAQxDG,MAAM;GACNC,MAAM;GACNC,SAAS;GAOTC,cAAc;EAChB;EACAC,SAAS;GAKPC,SAAS;GACTC,iBAAiBX,EAAMY,QAAQC,KAAK;GACpCC,aAAa;GACbC,SAAS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,GAAD;GAAS,IAAAjC,EAAMoB;GACZ,UAAA,CAAC,GAAG,CAAC,CAAC,CAAAe,IAAKC,CAKX;EANC,CAAA,CATF;KAiBET,EAAA,KAAAO,KAAAA,IAAAP,EAAA,IAjBNO;AAiBM;AAvBH,SAAAE,EAAAC,GAAA;CAAA,OAiBG,kBAAC,GAAD;EAA6B,IAAArC,EAAMqB;EAAnC,UAAA,CACE,kBAAC,GAAD;GAAkB,SAAA;GAAkB,OAAA;GAAW,QAAA;EAAC,CAAA,GAChD,kBAAC,GAAD;GAAiB,OAAA;GAAY,QAAA;EAAC,CAAA,CAF5B;CAAM,GAAA,UAAUgB,GAAhB;AAGE;;;AC1EhB,SAAgBK,EAAwBC,GAOrB;CACjB,IAAMQ,IAAwB,CAAA;CA2B9B,OA1BIR,EAAKI,gBACPI,EAAMC,KACJb,EAAqB;EACnBK,UAAUD,EAAKC;EACfG,cAAcJ,EAAKI;EACnBM,YAAYV,EAAKM;EACjBK,iBAAiBX,EAAKO;CACxB,CAAC,CACH,GAEFC,EAAMC,KACJd,EAAqB;EACnBM,UAAUD,EAAKC;EACfW,eAAe;GACb,IAAMC,IAAOb,EAAKE,QAAQ,GACpBY,IAAoB,CAAC;IAAC;IAAU;IAAQ;GAAO,CAAC;GACtD,KAAK,IAAM,CAACC,GAAGC,MAAWH,EAAKI,QAAQ,GAAG;IACxC,IAAMC,IAAalB,EAAKG,cAAcY,MAAM,UAAUA,IAAI;IAC1D,KAAK,IAAMI,KAASH,GAClBF,EAAKL,KAAK;KAACS;KAAYC,EAAMC;KAAMD,EAAME;IAAK,CAAC;GAEnD;GACA,OAAOP;EACT;CACF,CAAC,CACH,GACON;AACT"}
|
|
1
|
+
{"version":3,"file":"pie.js","names":["Theme","EChartsOption","echarts","CallbackDataParams","buildGridConfig","buildLegendConfig","buildSeriesLabelConfig","createTooltipFormatter","createTooltipPositioner","niceNum","OptionFactory","OptionFactoryContext","mergeOptions","resolveThemeColor","WidgetSeries","PieEChartsOption","PieOptionFactoryInput","PieOptionsInput","PieWidgetData","DEFAULT_RADIUS","pieOptions","theme","formatter","labelFormatter","legend","hasLegend","left","type","itemGap","selectedMode","tooltip","trigger","backgroundColor","palette","grey","borderWidth","padding","parseInt","spacing","textStyle","color","common","white","fontSize","fontFamily","typography","caption","position","buildPieTooltipFormatter","Object","values","qualitative","bold","Record","series","colorBy","avoidLabelOverlap","selectedOffset","legendHoverLink","emphasis","disabled","itemStyle","borderColor","background","paper","label","show","rich","b","fontWeight","lineHeight","c","createPieOptionFactory","options","optionsOverride","radius","selection","selectionSet","undefined","length","Set","option","data","ctx","structural","Partial","seriesArr","Array","isArray","dataset","buildMultiSeriesBarFusion","buildSingleSeriesPieFusion","seriesTemplates","broadcastTemplate","baseTooltip","baseLegend","resolvePaletteColor","params","swatch","dataIndex","colorFn","base","datum","value","name","has","modifyAlpha","templateLabelPosition","isCenterLabel","centerData","centerMaxName","centerMaxValue","Infinity","d","labelTextFormatter","encodeIndex","encode","at","formattedValue","String","formattedName","separator","map","s","source","_","i","template","templateObj","templateLabel","templateItemStyle","const","datasetIndex","center","itemName","selected","fromEntries","baseGrid","grid","niceMinVal","niceMaxVal","computeNiceBounds","barColorFn","seriesIdx","seriesIndex","seriesSwatch","right","containLabel","overrideColor","barMaxWidth","focus","xAxis","min","max","axisLine","axisTick","splitLine","lineStyle","black","divider","axisLabel","overlineDelicate","margin","showMaxLabel","showMinLabel","yAxis","buildHorizontalBarTooltipFormatter","item","x","dimName","dimensionNames","row","raw","marker","seriesName","Number","isFinite","Box","Skeleton","SxProps","Theme","OUTER_SIZE","HOLE_SIZE","styles","root","display","flexDirection","alignItems","justifyContent","minHeight","py","gap","spacing","donut","position","ring","width","height","hole","zIndex","borderRadius","bgcolor","label","legend","legendItem","Record","PieSkeletonProps","count","PieSkeleton","t0","$","_c","t1","t2","Symbol","for","t3","t4","map","_temp","i","buildCsvDownloadItem","buildPngDownloadItem","DownloadItem","PieWidgetData","createPieDownloadConfig","args","filename","getData","seriesNames","getCaptureEl","HTMLElement","pngPixelRatio","pngBackgroundColor","items","push","pixelRatio","backgroundColor","getRows","data","rows","i","series","entries","seriesName","slice","name","value"],"sources":["../../src/widgets-v2/pie/options.ts","../../src/widgets-v2/pie/skeleton.tsx","../../src/widgets-v2/pie/download.ts"],"sourcesContent":["import type { Theme } from '@mui/material'\nimport type { EChartsOption } from 'echarts'\nimport * as echarts from 'echarts'\nimport type { CallbackDataParams } from 'echarts/types/dist/shared'\nimport {\n buildGridConfig,\n buildLegendConfig,\n buildSeriesLabelConfig,\n createTooltipFormatter,\n createTooltipPositioner,\n niceNum,\n} from '../../widgets/utils/chart-config'\nimport type { OptionFactory, OptionFactoryContext } from '../echart'\nimport { mergeOptions, resolveThemeColor } from '../utils'\nimport type { WidgetSeries } from '../types'\nimport type {\n PieEChartsOption,\n PieOptionFactoryInput,\n PieOptionsInput,\n PieWidgetData,\n} from './types'\n\nconst DEFAULT_RADIUS: readonly [string, string] = ['58%', '74%']\n\n/**\n * Builds the **structural** ECharts option for a pie / donut widget.\n * Mirrors v1's pie look-and-feel: themed legend (`buildLegendConfig`),\n * themed tooltip via `createTooltipPositioner` / `createTooltipFormatter`,\n * `qualitative.bold` color palette, slice borders against the paper\n * background, hover-emphasis disabled, and a centered rich-text label.\n *\n * Layered like Bar / Histogram:\n * - **Theme-aware bits** live here on a series template (slice border,\n * center-label rich style sizes, emphasis-disabled).\n * - **Reactive bits** (tooltip value formatter, center-label text,\n * selection-driven dim) are re-emitted by\n * {@link createPieOptionFactory} at fusion time so RelativeData's\n * percent override flows through.\n */\nexport function pieOptions({\n theme,\n formatter,\n labelFormatter,\n}: PieOptionsInput): PieEChartsOption {\n return {\n legend: {\n ...buildLegendConfig({ hasLegend: true, labelFormatter }),\n // Pie reads better with a centered legend (the donut is radially\n // symmetric — left-aligning the legend below it visually unbalances\n // the chart). Override `buildLegendConfig`'s `type: 'scroll'` with\n // `'plain'` so long category lists wrap to multiple rows instead\n // of clipping the last visible item against the chart container.\n // The wider `itemGap` gives chips breathing room in the typical\n // 3–6 category case.\n left: 'center',\n type: 'scroll',\n itemGap: 16,\n // The legend is presentational only here — the pie has its own\n // click-to-select affordance on the slices themselves, so legend\n // clicks toggling series visibility would be a second, redundant/\n // conflicting interaction model. Hover-highlight is disabled per\n // series via `legendHoverLink` (ECharts has no legend-level knob\n // for it).\n selectedMode: false,\n },\n tooltip: {\n // Pie uses item-trigger (no axis); the rest of the styling mirrors\n // bar/histogram so the dashboard reads consistently — dark\n // grey[900] bg, white caption-font text, padded, with the shared\n // overflow-aware positioner.\n trigger: 'item',\n backgroundColor: theme.palette.grey[900],\n borderWidth: 0,\n padding: [parseInt(theme.spacing(1)), parseInt(theme.spacing(1))],\n textStyle: {\n color: theme.palette.common.white,\n fontSize: 11,\n fontFamily: theme.typography.caption.fontFamily,\n },\n position: createTooltipPositioner(theme),\n formatter: buildPieTooltipFormatter(formatter, labelFormatter),\n },\n // V1 used `qualitative.bold` only (no `secondary.main` prefix) because\n // pie slices are categorical — each slice deserves a distinct palette\n // entry from the start, not a primary highlight.\n color: Object.values(\n (theme.palette as { qualitative?: { bold?: Record<string, string> } })\n .qualitative?.bold ?? {},\n ),\n // Pie template. The merger spreads this into each per-data series it\n // emits — borderColor / borderWidth / emphasis-disabled / label rich\n // sizes all survive through.\n series: [\n {\n type: 'pie',\n colorBy: 'data',\n avoidLabelOverlap: true,\n selectedOffset: 0,\n legendHoverLink: false,\n emphasis: { disabled: true },\n itemStyle: {\n borderColor: theme.palette.background.paper,\n borderWidth: 1,\n },\n label: {\n show: true,\n position: 'center',\n rich: {\n b: { fontSize: 16, fontWeight: 'normal', lineHeight: 20 },\n c: { fontSize: 28, fontWeight: 'bold', lineHeight: 27 },\n },\n },\n },\n ],\n }\n}\n\n/**\n * Returns the pie widget's {@link OptionFactory} — one closure that owns\n * BOTH phases of option construction:\n *\n * - **Structural phase** (`option == null`) — builds the theme-aware\n * structural option via {@link pieOptions}, optionally merging the\n * consumer-supplied `optionsOverride` on top. Called once by Provider\n * to seed `rawOptions` in the store.\n * - **Merge phase** (`option != null`) — fuses post-pipeline `state.data`\n * (`PieWidgetData`) into the option via the dataset API. Single-series\n * → donut (one dataset, `series[i].encode = { itemName: 'name', value: 'value' }`).\n * Multi-series → horizontal-bar fallback (mirrors v1 pie). Reactive\n * formatters from `ctx` drive the tooltip + center label at fusion\n * time so RelativeData's percent formatter flows through without a\n * structural rebuild.\n */\nexport function createPieOptionFactory(\n options: PieOptionFactoryInput,\n): OptionFactory {\n const { theme, formatter, labelFormatter, optionsOverride, series } = options\n const radius = options.radius ?? DEFAULT_RADIUS\n const selection = options.selection\n // An explicit `[]` (deselected down to zero via chart clicks) is treated\n // the same as no selection: the pie has no bar/histogram-style \"nothing\n // selected\" affordance, so dimming every slice would just look broken —\n // it renders fully active, same as the no-interaction state.\n const selectionSet =\n selection === undefined || selection === null || selection.length === 0\n ? null\n : new Set<string | number>(selection)\n return (option, data, ctx) => {\n if (option == null) {\n const structural = pieOptions({ theme, formatter, labelFormatter })\n return optionsOverride\n ? (mergeOptions(\n structural as unknown as Record<string, unknown>,\n optionsOverride as Partial<Record<string, unknown>>,\n ) as EChartsOption)\n : structural\n }\n\n const seriesArr = Array.isArray(data) ? (data as PieWidgetData) : []\n if (seriesArr.length === 0) {\n return { ...option, dataset: [], series: [] }\n }\n if (seriesArr.length > 1) {\n return buildMultiSeriesBarFusion(\n option,\n seriesArr,\n theme,\n series,\n ctx,\n selectionSet,\n )\n }\n return buildSingleSeriesPieFusion(\n option,\n seriesArr,\n radius,\n series,\n ctx,\n selectionSet,\n )\n }\n}\n\n/**\n * Single-series donut fusion. Spreads the structural pie series template\n * into per-data series with center/radius/encoding, wires the reactive\n * center-label / tooltip formatters and the per-data palette-aware\n * selection-dim callback.\n */\nfunction buildSingleSeriesPieFusion(\n option: EChartsOption,\n seriesArr: PieWidgetData,\n radius: readonly [string, string],\n series: readonly WidgetSeries[] | undefined,\n ctx: OptionFactoryContext | undefined,\n selectionSet: Set<string | number> | null,\n): EChartsOption {\n const seriesTemplates = Array.isArray(option.series) ? option.series : []\n const broadcastTemplate = seriesTemplates[0] ?? {}\n const baseTooltip =\n typeof option.tooltip === 'object' && !Array.isArray(option.tooltip)\n ? option.tooltip\n : {}\n const baseLegend =\n typeof option.legend === 'object' && !Array.isArray(option.legend)\n ? option.legend\n : {}\n const formatter = ctx?.formatter\n const labelFormatter = ctx?.labelFormatter\n\n // Pie wants `colorBy: 'data'` — each slice draws from the option's\n // `color` palette by data index. But installing an `itemStyle.color`\n // callback disables ECharts' automatic per-data cycling, and\n // `params.color` collapses to the series color (so every slice goes\n // the same color). We re-implement the per-data palette resolution\n // here so the multicolor look survives selection-driven dimming.\n const palette = Array.isArray(option.color)\n ? (option.color as readonly (string | undefined)[])\n : []\n const resolvePaletteColor = (params: CallbackDataParams): string => {\n const swatch =\n palette.length > 0\n ? palette[params.dataIndex % palette.length]\n : undefined\n return swatch ?? (params.color as string)\n }\n\n // Always emit `itemStyle.color` (passthrough when nothing is selected),\n // not conditionally — same anti-stale-callback rationale as bar /\n // histogram. The slice border + width come from the structural\n // template's `itemStyle` and survive via the spread below.\n //\n // `selectionSet` is the *included* set, same direct semantics as\n // bar/histogram/timeseries (no ADR-014 exclusion inversion). Dim a slice\n // when its name is NOT in the set. `selectionSet` is never a non-null\n // empty Set — the collapse above (`selection.length === 0 → null`) rules\n // that out — so there's no \"dim everything\" case here, unlike a widget\n // that gives `[]` its own \"selected down to nothing\" meaning.\n const colorFn = (params: CallbackDataParams): string => {\n const base = resolvePaletteColor(params)\n if (!selectionSet) return base\n const datum = params.value as { name?: string | number } | undefined\n const name = datum?.name ?? params.name\n return name != null && selectionSet.has(name)\n ? base\n : echarts.color.modifyAlpha(base, 0.15)\n }\n\n // ECharts anchors EVERY slice's `position: 'center'` label at the same\n // point, so at most one of them can ever be legible — the donut design\n // leans into that (one KPI inside the ring) and picks a single slice\n // below. A consumer that moves the labels off the centre gives each\n // slice its own anchor (`'outside'` with leader lines is what the PDF\n // export uses, `'inside'` / `'insideTop'` … likewise), and there the\n // single-label rule is simply wrong: every slice must render its own\n // label. Read the position off the structural template, which already\n // carries the consumer's `optionsOverride`.\n const templateLabelPosition = (\n broadcastTemplate as { label?: { position?: unknown } }\n ).label?.position\n const isCenterLabel =\n templateLabelPosition === undefined || templateLabelPosition === 'center'\n\n // Which slice renders the centre value+name: the greatest value among\n // the *included* slices (all of them when there's no active\n // selection), computed locally — no query round-trip. Only that one\n // slice's formatter call returns text; every other slice returns ''\n // so exactly one label ever renders at the shared centre anchor. Only\n // `typeof value === 'number'` participates — if every included slice's\n // value is non-numeric, `centerMaxName` stays `undefined` and no slice\n // matches it in `labelTextFormatter` below, so the chart renders with no\n // centre label at all (graceful no-op, not a crash). Skipped entirely\n // for off-centre labels, where every slice labels itself.\n const centerData = seriesArr[0] ?? []\n let centerMaxName: string | number | undefined\n let centerMaxValue = -Infinity\n for (const d of centerData) {\n if (selectionSet && !selectionSet.has(d.name)) continue\n if (typeof d.value === 'number' && d.value > centerMaxValue) {\n centerMaxValue = d.value\n centerMaxName = d.name\n }\n }\n\n // Slice label formatter — lives in the merger because it reads\n // reactive `formatter` / `labelFormatter` from ctx. The rich tags\n // `{c|…}` and `{b|…}` reference the rich styles baked into the\n // structural label template.\n const labelTextFormatter = (params: CallbackDataParams): string => {\n const { name } = params\n if (name == null) return ''\n if (isCenterLabel && name !== centerMaxName) return ''\n const encodeIndex = params.encode?.value?.[0]\n if (encodeIndex === undefined) return ''\n const value = (Object.values(params.data ?? {}) as unknown[]).at(\n encodeIndex,\n )\n // `value` here is the resolved dataset cell — for pie data it's a\n // `string | number` primitive. Anything else is a misuse we won't\n // dress up with `String(...)` (would render \"[object Object]\").\n const formattedValue =\n typeof value === 'number'\n ? formatter\n ? formatter(value)\n : String(value)\n : typeof value === 'string'\n ? value\n : ''\n const formattedName = labelFormatter\n ? String(labelFormatter(name ?? ''))\n : String(name ?? '')\n // The blank line is what separates the big centre KPI from its\n // caption. Off-centre labels sit next to their own slice and are\n // laid out against their neighbours, so the spacer only inflates\n // each label's bounding box — enough, with a hidden `{b|…}` block,\n // to make ECharts drop colliding labels altogether.\n const separator = isCenterLabel ? '\\n\\n' : '\\n'\n return `{c|${formattedValue}}${separator}{b|${formattedName}}`\n }\n\n return {\n ...option,\n dataset: seriesArr.map((s) => ({ source: s as readonly object[] })),\n series: seriesArr.map((_, i) => {\n const template =\n (seriesTemplates[i] as object | undefined) ??\n (broadcastTemplate as object)\n const templateObj = typeof template === 'object' ? template : {}\n const templateLabel = (templateObj as { label?: object }).label ?? {}\n const templateItemStyle =\n (templateObj as { itemStyle?: object }).itemStyle ?? {}\n return {\n ...templateObj,\n type: 'pie' as const,\n legendHoverLink: false,\n datasetIndex: i,\n name: series?.[i]?.name ?? `Series ${i + 1}`,\n radius: [...radius],\n // Lift the donut up so the bottom-anchored legend has the\n // vertical real estate to wrap to multiple rows for long\n // category lists — at exactly `50%` the bottom slices crowd\n // the chips and `type: 'plain'` legends can't expand upward\n // without overlapping the donut.\n center: ['50%', '38%'] as [string, string],\n encode: { itemName: 'name', value: 'value' },\n label: {\n ...templateLabel,\n formatter: labelTextFormatter,\n },\n itemStyle: {\n ...templateItemStyle,\n color: colorFn,\n },\n }\n }),\n // Legend always shows for pie (mirrors v1) — slice names drive the\n // entries, so even a single donut benefits from a category list.\n //\n // Exclusion is conveyed purely via `colorFn`/`labelTextFormatter`\n // dimming above, never via the legend's `selected` map: for a pie\n // series, ECharts treats `legend.selected[name] = false` as \"remove\n // this data point,\" which recomputes every remaining slice's angle —\n // the excluded slice disappears instead of rendering dimmed. Forcing\n // every name to `true` on every render also overrides ECharts' own\n // internal toggle state from a native legend click (which flips a\n // name to `false` and hides it before our `legendselectchanged`\n // handler gets a chance to react), so a legend click never leaves a\n // slice structurally removed — only the color/label dimming reflects\n // exclusion, and it stays in sync with the slice itself since both\n // read `selectionSet` on the same render.\n legend: {\n ...baseLegend,\n show: true,\n selectedMode: false,\n selected: Object.fromEntries(\n (seriesArr[0] ?? []).map((d) => [String(d.name), true]),\n ),\n },\n tooltip: {\n ...baseTooltip,\n formatter: buildPieTooltipFormatter(formatter, labelFormatter),\n },\n }\n}\n\n/**\n * Multi-series horizontal-bar fusion. Mirrors v1 pie's \"pie data with\n * >1 series collapses into a horizontal bar chart\" behavior — side-by-\n * side donuts don't read well when you're comparing the same categories\n * across cohorts, so swap to a value-on-x / category-on-y bar layout.\n *\n * Pie data shape is identical to bar's (`{ name, value }[][]`), so the\n * same dataset feeds either layout without transformation.\n */\nfunction buildMultiSeriesBarFusion(\n option: EChartsOption,\n seriesArr: PieWidgetData,\n theme: Theme,\n series: readonly WidgetSeries[] | undefined,\n ctx: OptionFactoryContext | undefined,\n selectionSet: Set<string | number> | null,\n): EChartsOption {\n const baseTooltip =\n typeof option.tooltip === 'object' && !Array.isArray(option.tooltip)\n ? option.tooltip\n : {}\n const baseLegend =\n typeof option.legend === 'object' && !Array.isArray(option.legend)\n ? option.legend\n : {}\n const baseGrid =\n typeof option.grid === 'object' && !Array.isArray(option.grid)\n ? option.grid\n : {}\n const formatter = ctx?.formatter\n const labelFormatter = ctx?.labelFormatter\n\n const { niceMinVal, niceMaxVal } = computeNiceBounds(seriesArr)\n\n // Per-series palette — multi-series bars take one color per series\n // (not per-data, unlike donut slices). Same anti-stale-callback rule:\n // always emit the callback so a transition to/from a selection\n // replaces the previous closure cleanly.\n const palette = Array.isArray(option.color)\n ? (option.color as readonly (string | undefined)[])\n : []\n const barColorFn = (params: CallbackDataParams): string => {\n const seriesIdx = params.seriesIndex ?? 0\n const seriesSwatch =\n palette.length > 0 ? palette[seriesIdx % palette.length] : undefined\n const base = (seriesSwatch ?? params.color) as string\n if (!selectionSet) return base\n const datum = params.value as { name?: string | number } | undefined\n const name = datum?.name ?? params.name\n return name != null && selectionSet.has(name)\n ? base\n : echarts.color.modifyAlpha(base, 0.15)\n }\n\n return {\n ...option,\n dataset: seriesArr.map((s) => ({ source: s as readonly object[] })),\n grid: {\n ...baseGrid,\n ...buildGridConfig(true, theme),\n right: parseInt(theme.spacing(4)),\n containLabel: true,\n },\n // Drop pie-specific structural keys that shouldn't render in the\n // bar fallback. ECharts ignores undefined keys, so this is a clean\n // override.\n series: seriesArr.map((_, i) => {\n const overrideColor = resolveThemeColor(theme, series?.[i]?.color)\n return {\n datasetIndex: i,\n type: 'bar' as const,\n name: series?.[i]?.name ?? `Series ${i + 1}`,\n barMaxWidth: 100,\n legendHoverLink: false,\n emphasis: { focus: 'series' },\n ...buildSeriesLabelConfig(formatter, 'x'),\n itemStyle: { color: barColorFn },\n ...(overrideColor ? { color: overrideColor } : {}),\n }\n }),\n xAxis: {\n type: 'value',\n // Closures over the pre-computed nice bounds — ECharts calls them\n // once per render to resolve the axis extents.\n min: () => niceMinVal,\n max: () => niceMaxVal,\n axisLine: { show: false },\n axisTick: { show: false },\n splitLine: {\n show: true,\n lineStyle: { color: theme.palette.black?.[4] ?? theme.palette.divider },\n },\n // Value labels render BELOW the axis line (default placement),\n // NOT inside the plot. Bar/histogram use `inside: true` +\n // `verticalAlign: 'bottom'` for their *vertical* y-axis where the\n // axis is the left wall — labels inside read like grid annotations.\n // A horizontal bar chart's value axis is the x-axis, and `inside`\n // there pushes the max label *behind* the bar (it visually\n // disappears once a bar reaches the right edge). Use the default\n // below-the-axis placement so the rounded extents stay readable.\n axisLabel: {\n fontSize: theme.typography.overlineDelicate?.fontSize,\n fontFamily: theme.typography.overlineDelicate?.fontFamily,\n margin: parseInt(theme.spacing(1)),\n showMaxLabel: true,\n showMinLabel: true,\n formatter: (value: number) => {\n if (value !== niceMaxVal && value !== niceMinVal) return ''\n if (value === 0) return ''\n return formatter ? formatter(value) : String(value)\n },\n },\n },\n yAxis: {\n type: 'category',\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n padding: [parseInt(theme.spacing(0.5)), 0, 0, 0],\n ...(labelFormatter && {\n formatter: (value: string | number) => String(labelFormatter(value)),\n }),\n },\n },\n // Mirrors the donut branch's `selected` reset above — `selectedMode:\n // false` blocks the native legend click that would otherwise undo an\n // ECharts-internal toggle, so without forcing every entry back to\n // `true` here a prior native toggle (from before `selectedMode` took\n // effect, or a stale `keepAlive` instance) would stay hidden forever\n // with no way to restore it.\n legend: {\n ...baseLegend,\n show: true,\n selectedMode: false,\n selected: Object.fromEntries(\n seriesArr.map((_, i) => [series?.[i]?.name ?? `Series ${i + 1}`, true]),\n ),\n },\n tooltip: {\n ...baseTooltip,\n trigger: 'axis',\n formatter: buildHorizontalBarTooltipFormatter(formatter, labelFormatter),\n },\n } as EChartsOption\n}\n\n/**\n * Tooltip formatter for the horizontal-bar fallback. Reads the value by\n * `encode.x` dimension index (v1 parity) so it stays robust to\n * downstream changes that rename dataset columns.\n */\nfunction buildHorizontalBarTooltipFormatter(\n formatter: ((value: number) => string) | undefined,\n labelFormatter: ((value: string | number) => string | number) | undefined,\n) {\n return createTooltipFormatter((item) => {\n const encodeIndex = item.encode?.x?.at(0)\n const dimName =\n encodeIndex !== undefined ? item.dimensionNames?.[encodeIndex] : undefined\n const row =\n item.value && typeof item.value === 'object' && !Array.isArray(item.value)\n ? (item.value as Record<string, string | number>)\n : undefined\n const raw = dimName && row ? row[dimName] : undefined\n const formattedValue =\n typeof raw === 'number' && formatter ? formatter(raw) : (raw ?? '')\n const marker = typeof item.marker === 'string' ? item.marker : ''\n const seriesName = item.seriesName ? `${item.seriesName}: ` : ''\n const name = labelFormatter\n ? String(labelFormatter(item.name ?? ''))\n : String(item.name ?? '')\n return { name, seriesName, marker, value: formattedValue }\n })\n}\n\n/**\n * Min/max bounds over every datum's `.value` across all series. Used by\n * the horizontal-bar fallback's x-axis label formatter so we only render\n * labels at the rounded extents (matches v1 + bar / histogram).\n */\nfunction computeNiceBounds(seriesArr: PieWidgetData): {\n niceMinVal: number\n niceMaxVal: number\n} {\n let min = 0\n let max = -Infinity\n for (const series of seriesArr) {\n for (const d of series) {\n if (typeof d?.value !== 'number' || !Number.isFinite(d.value)) continue\n if (d.value < min) min = d.value\n if (d.value > max) max = d.value\n }\n }\n return {\n niceMinVal: min < 0 ? niceNum(min) : 0,\n niceMaxVal: max <= 0 ? 1 : niceNum(max),\n }\n}\n\n/**\n * Tooltip formatter for pie slices. `item.value` is the dataset row\n * object (e.g. `{ name: 'A', value: 10 }`); we pull the value by\n * `encode.value`'s dimension index, formatted via the reactive `formatter`\n * if present. Slice name passes through `labelFormatter`.\n */\nfunction buildPieTooltipFormatter(\n formatter: ((value: number) => string) | undefined,\n labelFormatter: ((value: string | number) => string | number) | undefined,\n) {\n return createTooltipFormatter((item) => {\n const encodeIndex = item.encode?.value?.at(0) ?? 1\n const values =\n item.value && typeof item.value === 'object' && !Array.isArray(item.value)\n ? (Object.values(item.value) as (string | number)[])\n : []\n const raw = values[encodeIndex]\n const formattedValue =\n typeof raw === 'number' && formatter ? formatter(raw) : (raw ?? '')\n const marker = typeof item.marker === 'string' ? item.marker : ''\n const seriesName = item.seriesName ? `${item.seriesName}: ` : ''\n const name = labelFormatter\n ? String(labelFormatter(item.name ?? ''))\n : String(item.name ?? '')\n return { name, seriesName, marker, value: formattedValue }\n })\n}\n","import { Box, Skeleton } from '@mui/material'\nimport type { SxProps, Theme } from '@mui/material'\n\nconst OUTER_SIZE = 160\nconst HOLE_SIZE = 96\n\nconst styles = {\n root: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n minHeight: 200,\n py: 1,\n gap: ({ spacing }) => spacing(2),\n },\n donut: {\n position: 'relative',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n },\n ring: {\n width: OUTER_SIZE,\n height: OUTER_SIZE,\n },\n hole: {\n position: 'absolute',\n zIndex: 1,\n width: HOLE_SIZE,\n height: HOLE_SIZE,\n borderRadius: '50%',\n bgcolor: 'background.paper',\n },\n label: {\n position: 'absolute',\n zIndex: 2,\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n gap: ({ spacing }) => spacing(0.5),\n },\n legend: {\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(2),\n },\n legendItem: {\n display: 'flex',\n alignItems: 'center',\n gap: ({ spacing }) => spacing(1.5),\n },\n} satisfies Record<string, SxProps<Theme>>\n\nexport interface PieSkeletonProps {\n count?: number\n}\n\n/**\n * Loading state for the Pie widget. Mirrors the donut silhouette — a ring\n * (gray circle with a background-coloured hole punched out), a stacked\n * value/name stub in the centre, and a centered legend stub below — so the\n * skeleton reads as \"a donut chart\" rather than a solid disc.\n *\n * Single donut only: multi-series pie loads as a horizontal bar chart, so\n * rendering one ring stays honest regardless of `count`.\n */\nexport function PieSkeleton({ count }: PieSkeletonProps) {\n // `count` is accepted for API compatibility but intentionally unused: the\n // skeleton always renders a single donut, since multi-series pie loads as a\n // horizontal bar chart rather than multiple donuts.\n void count\n return (\n <Box sx={styles.root}>\n <Box sx={styles.donut}>\n <Skeleton variant='circular' sx={styles.ring} />\n <Box sx={styles.hole} />\n <Box sx={styles.label}>\n <Skeleton width={56} height={18} />\n <Skeleton width={36} height={8} />\n </Box>\n </Box>\n <Box sx={styles.legend}>\n {[0, 1].map((i) => (\n <Box key={`legend-${i}`} sx={styles.legendItem}>\n <Skeleton variant='circular' width={8} height={8} />\n <Skeleton width={48} height={8} />\n </Box>\n ))}\n </Box>\n </Box>\n )\n}\n","import {\n buildCsvDownloadItem,\n buildPngDownloadItem,\n type DownloadItem,\n} from '../actions/download'\nimport type { PieWidgetData } from './types'\n\n/**\n * Download menu items for the Pie widget. Always includes a CSV item with\n * `series, name, value` columns (one row per slice; series labels come from\n * `seriesNames` if provided, else `series_<n>`). When `getCaptureEl` is\n * supplied, prepends a PNG item that rasterises the captured element via\n * `html2canvas`.\n */\nexport function createPieDownloadConfig(args: {\n filename: string\n getData: () => PieWidgetData\n seriesNames?: readonly string[]\n getCaptureEl?: () => HTMLElement | null\n pngPixelRatio?: number\n pngBackgroundColor?: string | null\n}): DownloadItem[] {\n const items: DownloadItem[] = []\n if (args.getCaptureEl) {\n items.push(\n buildPngDownloadItem({\n filename: args.filename,\n getCaptureEl: args.getCaptureEl,\n pixelRatio: args.pngPixelRatio,\n backgroundColor: args.pngBackgroundColor,\n }),\n )\n }\n items.push(\n buildCsvDownloadItem({\n filename: args.filename,\n getRows: () => {\n const data = args.getData()\n const rows: unknown[][] = [['series', 'name', 'value']]\n for (const [i, series] of data.entries()) {\n const seriesName = args.seriesNames?.[i] ?? `series_${i + 1}`\n for (const slice of series) {\n rows.push([seriesName, slice.name, slice.value])\n }\n }\n return rows\n },\n }),\n )\n return items\n}\n"],"mappings":";;;;;;;;AAsBA,IAAMmB,IAA4C,CAAC,OAAO,KAAK;AAiB/D,SAAgBC,EAAW,EACzBC,UACAC,cACAC,qBACoC;CACpC,OAAO;EACLC,QAAQ;GACN,GAAGnB,EAAkB;IAAEoB,WAAW;IAAMF;GAAe,CAAC;GAQxDG,MAAM;GACNC,MAAM;GACNC,SAAS;GAOTC,cAAc;EAChB;EACAC,SAAS;GAKPC,SAAS;GACTC,iBAAiBX,EAAMY,QAAQC,KAAK;GACpCC,aAAa;GACbC,SAAS,CAACC,SAAShB,EAAMiB,QAAQ,CAAC,CAAC,GAAGD,SAAShB,EAAMiB,QAAQ,CAAC,CAAC,CAAC;GAChEC,WAAW;IACTC,OAAOnB,EAAMY,QAAQQ,OAAOC;IAC5BC,UAAU;IACVC,YAAYvB,EAAMwB,WAAWC,QAAQF;GACvC;GACAG,UAAUvC,EAAwBa,CAAK;GACvCC,WAAW0B,EAAyB1B,GAAWC,CAAc;EAC/D;EAIAiB,OAAOS,OAAOC,OACX7B,EAAMY,QACJkB,aAAaC,QAAQ,CAAC,CAC3B;EAIAE,QAAQ,CACN;GACE3B,MAAM;GACN4B,SAAS;GACTC,mBAAmB;GACnBC,gBAAgB;GAChBC,iBAAiB;GACjBC,UAAU,EAAEC,UAAU,GAAK;GAC3BC,WAAW;IACTC,aAAazC,EAAMY,QAAQ8B,WAAWC;IACtC7B,aAAa;GACf;GACA8B,OAAO;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;AAGE;;;AC1EhB,SAAgBK,EAAwBC,GAOrB;CACjB,IAAMQ,IAAwB,CAAA;CA2B9B,OA1BIR,EAAKI,gBACPI,EAAMC,KACJb,EAAqB;EACnBK,UAAUD,EAAKC;EACfG,cAAcJ,EAAKI;EACnBM,YAAYV,EAAKM;EACjBK,iBAAiBX,EAAKO;CACxB,CAAC,CACH,GAEFC,EAAMC,KACJd,EAAqB;EACnBM,UAAUD,EAAKC;EACfW,eAAe;GACb,IAAMC,IAAOb,EAAKE,QAAQ,GACpBY,IAAoB,CAAC;IAAC;IAAU;IAAQ;GAAO,CAAC;GACtD,KAAK,IAAM,CAACC,GAAGC,MAAWH,EAAKI,QAAQ,GAAG;IACxC,IAAMC,IAAalB,EAAKG,cAAcY,MAAM,UAAUA,IAAI;IAC1D,KAAK,IAAMI,KAASH,GAClBF,EAAKL,KAAK;KAACS;KAAYC,EAAMC;KAAMD,EAAME;IAAK,CAAC;GAEnD;GACA,OAAOP;EACT;CACF,CAAC,CACH,GACON;AACT"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as e } from "../zoom-toggle-
|
|
2
|
-
import { n as t, t as n } from "../download-
|
|
3
|
-
import { r, t as i } from "../utils-
|
|
4
|
-
import { a, d as o, f as s, i as c, s as l, u } from "../chart-config-
|
|
1
|
+
import { r as e } from "../zoom-toggle-KA63b6-J.js";
|
|
2
|
+
import { n as t, t as n } from "../download-C7he8mSh.js";
|
|
3
|
+
import { r, t as i } from "../utils-ClB6nn4w.js";
|
|
4
|
+
import { a, d as o, f as s, i as c, s as l, u } from "../chart-config-BWxjodlt.js";
|
|
5
5
|
import { c as d } from "react/compiler-runtime";
|
|
6
6
|
import { Box as f, Skeleton as p } from "@mui/material";
|
|
7
7
|
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, i as t, n, o as r, r as i, t as a } from "../spread-
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, t as a } from "../spread-C8T12Nfh.js";
|
|
2
2
|
export { r as Separator, t as Spread, i as SpreadSkeleton, e as SpreadUI, n as createSpreadDownloadConfig, a as getSpreadBand };
|
package/dist/widgets-v2/table.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, d as n, f as r, i, l as a, m as o, n as s, o as c, p as l, r as u, s as d, t as f, u as p } from "../table-
|
|
1
|
+
import { a as e, c as t, d as n, f as r, i, l as a, m as o, n as s, o as c, p as l, r as u, s as d, t as f, u as p } from "../table-CNQijNNB.js";
|
|
2
2
|
export { o as DEFAULT_TABLE_LABELS, r as DEFAULT_TABLE_PAGE_SIZE, l as DEFAULT_TABLE_PAGE_SIZE_OPTIONS, i as Table, u as TableSkeleton, n as TableUI, e as compareValues, s as createTableDownloadConfig, c as deriveVisibleRows, f as filterTableByLockedRows, d as paginateRows, t as resolveColumns, a as sortRows, p as tableDataToCsv };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as e } from "../zoom-toggle-
|
|
2
|
-
import { n as t, t as n } from "../download-
|
|
3
|
-
import { n as r, r as i, t as a } from "../utils-
|
|
4
|
-
import { a as o, d as s, f as c, i as l, s as u, u as d } from "../chart-config-
|
|
1
|
+
import { r as e } from "../zoom-toggle-KA63b6-J.js";
|
|
2
|
+
import { n as t, t as n } from "../download-C7he8mSh.js";
|
|
3
|
+
import { n as r, r as i, t as a } from "../utils-ClB6nn4w.js";
|
|
4
|
+
import { a as o, d as s, f as c, i as l, s as u, u as d } from "../chart-config-BWxjodlt.js";
|
|
5
5
|
import { c as f } from "react/compiler-runtime";
|
|
6
6
|
import { Box as p, Skeleton as m } from "@mui/material";
|
|
7
7
|
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
package/dist/widgets-v2/utils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, r as t, t as n } from "../utils-
|
|
1
|
+
import { n as e, r as t, t as n } from "../utils-ClB6nn4w.js";
|
|
2
2
|
export { t as mergeOptions, e as positionDataZoomForLegend, n as resolveThemeColor };
|
package/dist/widgets-v2.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { t as e } from "./tooltip-DJUGNZxY.js";
|
|
2
|
-
import "./components-
|
|
2
|
+
import "./components-DKjBezcJ.js";
|
|
3
3
|
import { t } from "./smart-tooltip-CwGHCqab.js";
|
|
4
4
|
import { C as n, S as r, T as i, _ as a, h as o, l as s, m as c, p as l, w as u, x as d, y as f } from "./stores-BVFMfgyo.js";
|
|
5
5
|
import { i as p, n as m, o as h, r as g } from "./echart-DSz2Tu0z.js";
|
|
6
6
|
import { t as _ } from "./markdown-content-BzKoX3eu.js";
|
|
7
|
-
import { C as v, S as y, c as b, f as x, g as S, o as C, r as w, t as T, y as E } from "./actions-
|
|
8
|
-
import { t as D } from "./zoom-toggle-
|
|
9
|
-
import { s as O } from "./download-
|
|
10
|
-
import { i as k, r as A } from "./formula-
|
|
11
|
-
import { i as j, r as M } from "./markdown-
|
|
12
|
-
import { a as N, i as P } from "./spread-
|
|
7
|
+
import { C as v, S as y, c as b, f as x, g as S, o as C, r as w, t as T, y as E } from "./actions-C7ZAO0FG.js";
|
|
8
|
+
import { t as D } from "./zoom-toggle-KA63b6-J.js";
|
|
9
|
+
import { s as O } from "./download-C7he8mSh.js";
|
|
10
|
+
import { i as k, r as A } from "./formula-Cqj84ZGX.js";
|
|
11
|
+
import { i as j, r as M } from "./markdown-CV_KP-at.js";
|
|
12
|
+
import { a as N, i as P } from "./spread-C8T12Nfh.js";
|
|
13
13
|
import { n as F, r as I } from "./range-BPWVrAsY.js";
|
|
14
|
-
import { i as L, r as R } from "./category-
|
|
15
|
-
import { d as z, i as B } from "./table-
|
|
14
|
+
import { i as L, r as R } from "./category-DZt6yiST.js";
|
|
15
|
+
import { d as z, i as B } from "./table-CNQijNNB.js";
|
|
16
16
|
import { c as V } from "react/compiler-runtime";
|
|
17
17
|
import { Children as H, Component as U, isValidElement as W, useEffect as G, useLayoutEffect as K, useRef as q, useState as J } from "react";
|
|
18
18
|
import { Accordion as ee, AccordionDetails as te, AccordionSummary as ne, Alert as re, AlertTitle as ie, Box as Y, Button as ae, Divider as oe, Grow as se, IconButton as ce, LinearProgress as le, Link as ue, Paper as de, Popper as fe, Typography as X } from "@mui/material";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./tooltip-DJUGNZxY.js";
|
|
2
|
-
import "./components-
|
|
2
|
+
import "./components-DKjBezcJ.js";
|
|
3
3
|
import { T as t, f as n, n as r } from "./stores-BVFMfgyo.js";
|
|
4
4
|
import { c as i } from "react/compiler-runtime";
|
|
5
5
|
import "react";
|
|
@@ -161,4 +161,4 @@ function y(l) {
|
|
|
161
161
|
//#endregion
|
|
162
162
|
export { f as a, p as i, g as n, h as r, y as t };
|
|
163
163
|
|
|
164
|
-
//# sourceMappingURL=zoom-toggle-
|
|
164
|
+
//# sourceMappingURL=zoom-toggle-KA63b6-J.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zoom-toggle-CA0ifG23.js","names":["Theme","SLIDER_HANDLE_ICON","SLIDER_HEIGHT","SLIDER_BOTTOM","ZoomAxis","CreateAddZoomOptions","axes","createAddZoom","theme","options","option","includeX","includes","includeY","sliderStyles","getZoomSliderStyles","baseSliderProps","throttle","showDetail","brushSelect","moveHandleSize","handleSize","cfg","Record","dataZoom","push","type","xAxisIndex","yAxisIndex","height","bottom","handleIcon","width","right","addZoom","secondary","palette","main","fillerColor","borderColor","borderWidth","backgroundColor","borderRadius","dataBackground","lineStyle","opacity","areaStyle","color","selectedDataBackground","handleStyle","common","white","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","textStyle","black","text","primary","fontSize","parseInt","typography","overlineDelicate","fontFamily","caption","ZOOM_LAYOUT","sliderHeight","sliderGap","sliderBottomWithLegend","const","ZoomToggleLabels","on","off","DEFAULT_ZOOM_TOGGLE_LABELS","SxProps","Theme","styles","toggle","p","fontSize","toggleActive","background","theme","palette","primary","relatedLight","Record","useCallback","useMemo","ComponentType","IconButton","useTheme","SvgIconProps","ZoomIn","ZoomInIcon","Tooltip","getEchartInstance","useSingleTransform","useWidgetId","createAddZoom","ZoomAxis","DEFAULT_ZOOM_TOGGLE_LABELS","ZoomToggleLabels","styles","ZOOM_DESCRIPTOR","id","type","const","order","ZoomToggleProps","initialEnabled","labels","Partial","icon","iconProps","axes","ZoomToggle","t0","$","_c","t1","t2","undefined","Icon","theme","t3","_labels","t4","includes","includeX","t5","includeY","t6","resolved","push","transform","t7","enabled","toggle","t8","setOption","replaceMerge","handleToggle","tooltip","on","off","t9","t10","toggleActive","t11","t12","t13","t14"],"sources":["../src/widgets-v2/actions/zoom-toggle/transforms.ts","../src/widgets-v2/actions/zoom-toggle/labels.ts","../src/widgets-v2/actions/zoom-toggle/style.ts","../src/widgets-v2/actions/zoom-toggle/zoom-toggle.tsx"],"sourcesContent":["import type { Theme } from '@mui/material'\n\n/**\n * v1's slider handle — 9×36 SVG with a white pill body, secondary-colored\n * stroke, and three grip lines. Inlined as a data URL so the chart can\n * render it without a network fetch.\n */\nconst SLIDER_HANDLE_ICON =\n 'image://data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOSIgaGVpZ2h0PSIzNiIgdmlld0JveD0iMCAwIDkgMzYiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHg9IjAuNSIgeT0iLTAuNSIgd2lkdGg9IjgiIGhlaWdodD0iMTgiIHJ4PSI0IiB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDI3KSIgZmlsbD0id2hpdGUiIHN0cm9rZT0iIzM1OEJFNyIvPgo8cmVjdCB3aWR0aD0iMyIgaGVpZ2h0PSIyIiByeD0iMSIgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMyAyMykiIGZpbGw9IiMzNThCRTciLz4KPHJlY3Qgd2lkdGg9IjMiIGhlaWdodD0iMiIgcng9IjEiIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIC0xIDMgMTkpIiBmaWxsPSIjMzU4QkU3Ii8+CjxyZWN0IHdpZHRoPSIzIiBoZWlnaHQ9IjIiIHJ4PSIxIiB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAzIDE1KSIgZmlsbD0iIzM1OEJFNyIvPgo8L3N2Zz4='\n\nconst SLIDER_HEIGHT = 32\nconst SLIDER_BOTTOM = 0\n\n/** Which chart axis (or axes) zoom applies to. */\nexport type ZoomAxis = 'x' | 'y'\n\nexport interface CreateAddZoomOptions {\n /**\n * Axes to enable zoom on. Default `['x']` (matches bar / histogram /\n * timeseries — horizontal pan/zoom on the category axis). Pass\n * `['x', 'y']` for a scatterplot-style 2D zoom (mouse-wheel scales both\n * axes; a horizontal slider sits at the bottom for x-range and a\n * vertical slider sits on the right for y-range).\n */\n axes?: readonly ZoomAxis[]\n}\n\n/**\n * Theme-bound zoom config transform: adds one inside `dataZoom`\n * (mouse-wheel + drag) per axis plus a styled slider per axis with the\n * v1 chrome (blue-tinted filler, secondary-color data preview, white\n * pill handles, CARTO typography). The x-slider is horizontal at the\n * bottom; the y-slider is vertical on the right.\n *\n * Returned function has stable identity for a given theme + axes\n * combination; pair with `useMemo` at the call site.\n *\n * **No `start` / `end`** are emitted: ECharts defaults to `0–100` on the\n * first `setOption` and then keeps the runtime slider state across\n * subsequent merges (no `replaceMerge` for `dataZoom`). Re-running the\n * transform on data/formatter/RelativeData updates therefore preserves the\n * user's dragged range instead of snapping it back.\n */\nexport function createAddZoom(\n theme: Theme,\n options: CreateAddZoomOptions = {},\n): (option: unknown) => unknown {\n const axes = options.axes ?? ['x']\n const includeX = axes.includes('x')\n const includeY = axes.includes('y')\n const sliderStyles = getZoomSliderStyles(theme)\n const baseSliderProps = {\n throttle: 0,\n showDetail: false,\n brushSelect: false,\n moveHandleSize: 8,\n handleSize: '100%',\n ...sliderStyles,\n }\n return (option: unknown): unknown => {\n if (option == null || typeof option !== 'object') return option\n const cfg = option as Record<string, unknown>\n const dataZoom: object[] = []\n if (includeX) {\n dataZoom.push({ type: 'inside', xAxisIndex: [0], throttle: 0 })\n }\n if (includeY) {\n dataZoom.push({ type: 'inside', yAxisIndex: [0], throttle: 0 })\n }\n if (includeX) {\n dataZoom.push({\n type: 'slider',\n xAxisIndex: [0],\n height: SLIDER_HEIGHT,\n bottom: SLIDER_BOTTOM,\n handleIcon: SLIDER_HANDLE_ICON,\n ...baseSliderProps,\n })\n }\n if (includeY) {\n // Vertical slider — `width` is its thickness, `right` pins it to\n // the right edge. We omit `handleIcon` so ECharts renders its\n // default vertical handle (the inline SVG is shaped for a\n // horizontal slider and looks wrong when rotated).\n dataZoom.push({\n type: 'slider',\n yAxisIndex: [0],\n width: SLIDER_HEIGHT,\n right: SLIDER_BOTTOM,\n ...baseSliderProps,\n })\n }\n return { ...cfg, dataZoom }\n }\n}\n\n/**\n * Back-compat untyped transform — produces the bare `dataZoom` config from\n * the original v2 implementation. Use {@link createAddZoom} when a theme is\n * available so the slider matches the v1 styling.\n *\n * `start` / `end` are intentionally omitted so ECharts preserves the user's\n * runtime range across subsequent `setOption` merges (see {@link createAddZoom}).\n */\nexport const addZoom = (option: unknown): unknown => {\n if (option == null || typeof option !== 'object') return option\n const cfg = option as Record<string, unknown>\n return {\n ...cfg,\n dataZoom: [\n { type: 'inside' },\n {\n type: 'slider',\n height: SLIDER_HEIGHT,\n bottom: SLIDER_BOTTOM,\n },\n ],\n }\n}\n\n/** Style block matching v1's `getEChartZoomSliderStyles`. */\nfunction getZoomSliderStyles(theme: Theme) {\n const secondary = theme.palette.secondary?.main ?? '#358BE7'\n return {\n fillerColor: 'rgba(53, 139, 231, 0.25)',\n borderColor: 'rgba(53, 139, 231, 0.3)',\n borderWidth: 0.5,\n backgroundColor: 'transparent',\n borderRadius: 4,\n dataBackground: {\n lineStyle: { opacity: 0 },\n areaStyle: { opacity: 1, color: secondary },\n },\n selectedDataBackground: {\n lineStyle: { opacity: 0 },\n areaStyle: { opacity: 1, color: secondary },\n },\n handleStyle: {\n color: theme.palette.common?.white ?? '#fff',\n borderColor: 'rgba(3, 111, 226, 0.08)',\n borderWidth: 1,\n shadowBlur: 3,\n shadowColor: 'rgba(0, 0, 0, 0.1)',\n shadowOffsetX: 0,\n shadowOffsetY: 1,\n },\n textStyle: {\n color: theme.palette.black?.[60] ?? theme.palette.text?.primary,\n fontSize: parseInt(\n (theme.typography.overlineDelicate?.fontSize as string | undefined) ??\n '11',\n ),\n fontFamily:\n theme.typography.overlineDelicate?.fontFamily ??\n theme.typography.caption?.fontFamily,\n },\n }\n}\n\n/**\n * Visual layout constants used by the data-fusion mergers (bar, histogram,\n * timeseries) when laying out the slider against the legend / grid.\n */\nexport const ZOOM_LAYOUT = {\n /** Slider height in px (matches `createAddZoom` output). */\n sliderHeight: SLIDER_HEIGHT,\n /** Vertical gap between chart grid and the slider. */\n sliderGap: 8,\n /** Slider `bottom` when a legend is shown — sits above the legend row. */\n sliderBottomWithLegend: 28,\n} as const\n","export interface ZoomToggleLabels {\n on: string\n off: string\n}\n\nexport const DEFAULT_ZOOM_TOGGLE_LABELS: ZoomToggleLabels = {\n on: 'Disable zoom',\n off: 'Enable zoom',\n}\n","import type { SxProps, Theme } from '@mui/material'\n\nexport const styles = {\n toggle: {\n p: 0.5,\n '& .MuiSvgIcon-root': { fontSize: 20 },\n },\n toggleActive: {\n background: (theme: Theme) => theme.palette.primary.relatedLight,\n },\n} satisfies Record<string, SxProps<Theme>>\n","import { useCallback, useMemo, type ComponentType } from 'react'\nimport { IconButton, useTheme, type SvgIconProps } from '@mui/material'\nimport { ZoomIn as ZoomInIcon } from '@mui/icons-material'\nimport { Tooltip } from '../../../components'\nimport {\n getEchartInstance,\n useSingleTransform,\n useWidgetId,\n} from '../../stores'\nimport { createAddZoom, type ZoomAxis } from './transforms'\nimport { DEFAULT_ZOOM_TOGGLE_LABELS, type ZoomToggleLabels } from './labels'\nimport { styles } from './style'\n\nconst ZOOM_DESCRIPTOR = {\n id: 'zoom-toggle',\n type: 'config' as const,\n order: 20,\n}\n\nexport interface ZoomToggleProps {\n initialEnabled?: boolean\n labels?: Partial<ZoomToggleLabels>\n icon?: ComponentType<SvgIconProps>\n iconProps?: SvgIconProps\n /**\n * Which axes the zoom controls. Default `['x']` — matches bar /\n * histogram / timeseries (horizontal pan on the category axis). Pass\n * `['x', 'y']` for 2D zoom on a scatterplot-style chart (mouse-wheel\n * scales both axes; horizontal slider at bottom + vertical slider on\n * the right).\n */\n axes?: readonly ZoomAxis[]\n}\n\n/**\n * Toggle a `dataZoom` slider + wheel-zoom on the chart. The transform is\n * theme-bound so the slider gets v1's CARTO chrome (blue-tinted filler,\n * secondary-color preview, white pill handles).\n *\n * `dataZoom` is intentionally NOT in `replaceMergeKeys` — ECharts merges\n * subsequent `setOption` calls so the user's dragged range survives\n * unrelated re-renders (data updates, formatter swaps, RelativeData toggles).\n *\n * On disable the transform is unregistered, but ECharts' merge semantics\n * would otherwise *keep* the live `dataZoom` component visible. To remove\n * the slider immediately we issue a one-shot\n * `setOption({}, { replaceMerge: ['dataZoom'] })` against the live chart\n * instance via {@link getEchartInstance} — this bypasses the pipeline so\n * unrelated transforms aren't disturbed.\n */\nexport function ZoomToggle({\n initialEnabled = false,\n labels,\n icon: Icon = ZoomInIcon,\n iconProps,\n axes,\n}: ZoomToggleProps) {\n const id = useWidgetId()\n const theme = useTheme()\n const _labels = { ...DEFAULT_ZOOM_TOGGLE_LABELS, ...labels }\n // Reduce `axes` to two structural booleans before memoizing so the memo\n // depends on stable primitive values, not an array reference (callers\n // typically pass an inline `axes={['x', 'y']}` literal that changes\n // identity each render). Default — no `axes` prop — is x-axis only,\n // matching `createAddZoom`'s default.\n const includeX = axes ? axes.includes('x') : true\n const includeY = axes ? axes.includes('y') : false\n const transform = useMemo(() => {\n const resolved: ZoomAxis[] = []\n if (includeX) resolved.push('x')\n if (includeY) resolved.push('y')\n return createAddZoom(theme, { axes: resolved })\n }, [theme, includeX, includeY])\n const { enabled, toggle } = useSingleTransform(\n id,\n ZOOM_DESCRIPTOR,\n transform,\n { initialEnabled },\n )\n\n const handleToggle = useCallback(() => {\n if (enabled) {\n // About to disable — clear the dataZoom component on the live\n // instance so the slider disappears immediately.\n getEchartInstance(id)?.setOption({}, { replaceMerge: ['dataZoom'] })\n }\n toggle()\n }, [enabled, toggle, id])\n\n const tooltip = enabled ? _labels.on : _labels.off\n\n return (\n <Tooltip title={tooltip}>\n <IconButton\n size='small'\n aria-label={tooltip}\n aria-pressed={enabled}\n onClick={handleToggle}\n className={enabled ? 'active' : undefined}\n sx={{ ...styles.toggle, ...(enabled && styles.toggleActive) }}\n >\n <Icon fontSize='small' {...iconProps} />\n </IconButton>\n </Tooltip>\n )\n}\n"],"mappings":";;;;;;;;;AAOA,IAAMC,IACJ,8pBAEIC,IAAgB,IAChBC,IAAgB;AAgCtB,SAAgBI,EACdC,GACAC,IAAgC,CAAC,GACH;CAC9B,IAAMH,IAAOG,EAAQH,QAAQ,CAAC,GAAG,GAC3BK,IAAWL,EAAKM,SAAS,GAAG,GAC5BC,IAAWP,EAAKM,SAAS,GAAG,GAE5BI,IAAkB;EACtBC,UAAU;EACVC,YAAY;EACZC,aAAa;EACbC,gBAAgB;EAChBC,YAAY;EACZ,GAPmBN,EAAoBP,CAOpCM;CACL;CACA,QAAQJ,MAA6B;EACnC,IAAsB,OAAOA,KAAW,aAApCA,GAA8C,OAAOA;EACzD,IAAMY,IAAMZ,GACNc,IAAqB,CAAA;EA8B3B,OA7BIb,KACFa,EAASC,KAAK;GAAEC,MAAM;GAAUC,YAAY,CAAC,CAAC;GAAGV,UAAU;EAAE,CAAC,GAE5DJ,KACFW,EAASC,KAAK;GAAEC,MAAM;GAAUE,YAAY,CAAC,CAAC;GAAGX,UAAU;EAAE,CAAC,GAE5DN,KACFa,EAASC,KAAK;GACZC,MAAM;GACNC,YAAY,CAAC,CAAC;GACdE,QAAQ3B;G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AAA/B,EAAA,QAAAgC,KAAAhC,EAAA,QAAA4B,KAAA5B,EAAA,QAAAyB,KAR1CQ,IAAA,kBAAC,GAAD;EACO,MAAA;EACOR,cAAAA;EACEN,gBAAAA;EACLK,SAAAA;EACE,WAAAI;EACP,IAAAG;EAEJC,UAAAA;CARS,CAAA,GASEhC,EAAA,MAAAmB,GAAAnB,EAAA,MAAAwB,GAAAxB,EAAA,MAAA+B,GAAA/B,EAAA,MAAAgC,GAAAhC,EAAA,MAAA4B,GAAA5B,EAAA,MAAAyB,GAAAzB,EAAA,MAAAiC,KAAAA,IAAAjC,EAAA;CAAA,IAAAkC;CACL,OADKlC,EAAA,QAAAiC,KAAAjC,EAAA,QAAAyB,KAVfS,IAAA,kBAAC,GAAD;EAAgBT,OAAAA;EACdQ,UAAAA;CADM,CAAA,GAWEjC,EAAA,MAAAiC,GAAAjC,EAAA,MAAAyB,GAAAzB,EAAA,MAAAkC,KAAAA,IAAAlC,EAAA,KAXVkC;AAWU"}
|
|
1
|
+
{"version":3,"file":"zoom-toggle-KA63b6-J.js","names":["Theme","SLIDER_HANDLE_ICON","SLIDER_HEIGHT","SLIDER_BOTTOM","ZoomAxis","CreateAddZoomOptions","axes","createAddZoom","theme","options","option","includeX","includes","includeY","sliderStyles","getZoomSliderStyles","baseSliderProps","throttle","showDetail","brushSelect","moveHandleSize","handleSize","cfg","Record","dataZoom","push","type","xAxisIndex","yAxisIndex","height","bottom","handleIcon","width","right","addZoom","secondary","palette","main","fillerColor","borderColor","borderWidth","backgroundColor","borderRadius","dataBackground","lineStyle","opacity","areaStyle","color","selectedDataBackground","handleStyle","common","white","shadowBlur","shadowColor","shadowOffsetX","shadowOffsetY","textStyle","black","text","primary","fontSize","parseInt","typography","overlineDelicate","fontFamily","caption","ZOOM_LAYOUT","sliderHeight","sliderGap","sliderBottomWithLegend","const","ZoomToggleLabels","on","off","DEFAULT_ZOOM_TOGGLE_LABELS","SxProps","Theme","styles","toggle","p","fontSize","toggleActive","background","theme","palette","primary","relatedLight","Record","useCallback","useMemo","ComponentType","IconButton","useTheme","SvgIconProps","ZoomIn","ZoomInIcon","Tooltip","getEchartInstance","useSingleTransform","useWidgetId","createAddZoom","ZoomAxis","DEFAULT_ZOOM_TOGGLE_LABELS","ZoomToggleLabels","styles","ZOOM_DESCRIPTOR","id","type","const","order","ZoomToggleProps","initialEnabled","labels","Partial","icon","iconProps","axes","ZoomToggle","t0","$","_c","t1","t2","undefined","Icon","theme","t3","_labels","t4","includes","includeX","t5","includeY","t6","resolved","push","transform","t7","enabled","toggle","t8","setOption","replaceMerge","handleToggle","tooltip","on","off","t9","t10","toggleActive","t11","t12","t13","t14"],"sources":["../src/widgets-v2/actions/zoom-toggle/transforms.ts","../src/widgets-v2/actions/zoom-toggle/labels.ts","../src/widgets-v2/actions/zoom-toggle/style.ts","../src/widgets-v2/actions/zoom-toggle/zoom-toggle.tsx"],"sourcesContent":["import type { Theme } from '@mui/material'\n\n/**\n * v1's slider handle — 9×36 SVG with a white pill body, secondary-colored\n * stroke, and three grip lines. Inlined as a data URL so the chart can\n * render it without a network fetch.\n */\nconst SLIDER_HANDLE_ICON =\n 'image://data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOSIgaGVpZ2h0PSIzNiIgdmlld0JveD0iMCAwIDkgMzYiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHg9IjAuNSIgeT0iLTAuNSIgd2lkdGg9IjgiIGhlaWdodD0iMTgiIHJ4PSI0IiB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDI3KSIgZmlsbD0id2hpdGUiIHN0cm9rZT0iIzM1OEJFNyIvPgo8cmVjdCB3aWR0aD0iMyIgaGVpZ2h0PSIyIiByeD0iMSIgdHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMyAyMykiIGZpbGw9IiMzNThCRTciLz4KPHJlY3Qgd2lkdGg9IjMiIGhlaWdodD0iMiIgcng9IjEiIHRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIC0xIDMgMTkpIiBmaWxsPSIjMzU4QkU3Ii8+CjxyZWN0IHdpZHRoPSIzIiBoZWlnaHQ9IjIiIHJ4PSIxIiB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAzIDE1KSIgZmlsbD0iIzM1OEJFNyIvPgo8L3N2Zz4='\n\nconst SLIDER_HEIGHT = 32\nconst SLIDER_BOTTOM = 0\n\n/** Which chart axis (or axes) zoom applies to. */\nexport type ZoomAxis = 'x' | 'y'\n\nexport interface CreateAddZoomOptions {\n /**\n * Axes to enable zoom on. Default `['x']` (matches bar / histogram /\n * timeseries — horizontal pan/zoom on the category axis). Pass\n * `['x', 'y']` for a scatterplot-style 2D zoom (mouse-wheel scales both\n * axes; a horizontal slider sits at the bottom for x-range and a\n * vertical slider sits on the right for y-range).\n */\n axes?: readonly ZoomAxis[]\n}\n\n/**\n * Theme-bound zoom config transform: adds one inside `dataZoom`\n * (mouse-wheel + drag) per axis plus a styled slider per axis with the\n * v1 chrome (blue-tinted filler, secondary-color data preview, white\n * pill handles, CARTO typography). The x-slider is horizontal at the\n * bottom; the y-slider is vertical on the right.\n *\n * Returned function has stable identity for a given theme + axes\n * combination; pair with `useMemo` at the call site.\n *\n * **No `start` / `end`** are emitted: ECharts defaults to `0–100` on the\n * first `setOption` and then keeps the runtime slider state across\n * subsequent merges (no `replaceMerge` for `dataZoom`). Re-running the\n * transform on data/formatter/RelativeData updates therefore preserves the\n * user's dragged range instead of snapping it back.\n */\nexport function createAddZoom(\n theme: Theme,\n options: CreateAddZoomOptions = {},\n): (option: unknown) => unknown {\n const axes = options.axes ?? ['x']\n const includeX = axes.includes('x')\n const includeY = axes.includes('y')\n const sliderStyles = getZoomSliderStyles(theme)\n const baseSliderProps = {\n throttle: 0,\n showDetail: false,\n brushSelect: false,\n moveHandleSize: 8,\n handleSize: '100%',\n ...sliderStyles,\n }\n return (option: unknown): unknown => {\n if (option == null || typeof option !== 'object') return option\n const cfg = option as Record<string, unknown>\n const dataZoom: object[] = []\n if (includeX) {\n dataZoom.push({ type: 'inside', xAxisIndex: [0], throttle: 0 })\n }\n if (includeY) {\n dataZoom.push({ type: 'inside', yAxisIndex: [0], throttle: 0 })\n }\n if (includeX) {\n dataZoom.push({\n type: 'slider',\n xAxisIndex: [0],\n height: SLIDER_HEIGHT,\n bottom: SLIDER_BOTTOM,\n handleIcon: SLIDER_HANDLE_ICON,\n ...baseSliderProps,\n })\n }\n if (includeY) {\n // Vertical slider — `width` is its thickness, `right` pins it to\n // the right edge. We omit `handleIcon` so ECharts renders its\n // default vertical handle (the inline SVG is shaped for a\n // horizontal slider and looks wrong when rotated).\n dataZoom.push({\n type: 'slider',\n yAxisIndex: [0],\n width: SLIDER_HEIGHT,\n right: SLIDER_BOTTOM,\n ...baseSliderProps,\n })\n }\n return { ...cfg, dataZoom }\n }\n}\n\n/**\n * Back-compat untyped transform — produces the bare `dataZoom` config from\n * the original v2 implementation. Use {@link createAddZoom} when a theme is\n * available so the slider matches the v1 styling.\n *\n * `start` / `end` are intentionally omitted so ECharts preserves the user's\n * runtime range across subsequent `setOption` merges (see {@link createAddZoom}).\n */\nexport const addZoom = (option: unknown): unknown => {\n if (option == null || typeof option !== 'object') return option\n const cfg = option as Record<string, unknown>\n return {\n ...cfg,\n dataZoom: [\n { type: 'inside' },\n {\n type: 'slider',\n height: SLIDER_HEIGHT,\n bottom: SLIDER_BOTTOM,\n },\n ],\n }\n}\n\n/** Style block matching v1's `getEChartZoomSliderStyles`. */\nfunction getZoomSliderStyles(theme: Theme) {\n const secondary = theme.palette.secondary?.main ?? '#358BE7'\n return {\n fillerColor: 'rgba(53, 139, 231, 0.25)',\n borderColor: 'rgba(53, 139, 231, 0.3)',\n borderWidth: 0.5,\n backgroundColor: 'transparent',\n borderRadius: 4,\n dataBackground: {\n lineStyle: { opacity: 0 },\n areaStyle: { opacity: 1, color: secondary },\n },\n selectedDataBackground: {\n lineStyle: { opacity: 0 },\n areaStyle: { opacity: 1, color: secondary },\n },\n handleStyle: {\n color: theme.palette.common?.white ?? '#fff',\n borderColor: 'rgba(3, 111, 226, 0.08)',\n borderWidth: 1,\n shadowBlur: 3,\n shadowColor: 'rgba(0, 0, 0, 0.1)',\n shadowOffsetX: 0,\n shadowOffsetY: 1,\n },\n textStyle: {\n color: theme.palette.black?.[60] ?? theme.palette.text?.primary,\n fontSize: parseInt(\n (theme.typography.overlineDelicate?.fontSize as string | undefined) ??\n '11',\n ),\n fontFamily:\n theme.typography.overlineDelicate?.fontFamily ??\n theme.typography.caption?.fontFamily,\n },\n }\n}\n\n/**\n * Visual layout constants used by the data-fusion mergers (bar, histogram,\n * timeseries) when laying out the slider against the legend / grid.\n */\nexport const ZOOM_LAYOUT = {\n /** Slider height in px (matches `createAddZoom` output). */\n sliderHeight: SLIDER_HEIGHT,\n /** Vertical gap between chart grid and the slider. */\n sliderGap: 8,\n /** Slider `bottom` when a legend is shown — sits above the legend row. */\n sliderBottomWithLegend: 28,\n} as const\n","export interface ZoomToggleLabels {\n on: string\n off: string\n}\n\nexport const DEFAULT_ZOOM_TOGGLE_LABELS: ZoomToggleLabels = {\n on: 'Disable zoom',\n off: 'Enable zoom',\n}\n","import type { SxProps, Theme } from '@mui/material'\n\nexport const styles = {\n toggle: {\n p: 0.5,\n '& .MuiSvgIcon-root': { fontSize: 20 },\n },\n toggleActive: {\n background: (theme: Theme) => theme.palette.primary.relatedLight,\n },\n} satisfies Record<string, SxProps<Theme>>\n","import { useCallback, useMemo, type ComponentType } from 'react'\nimport { IconButton, useTheme, type SvgIconProps } from '@mui/material'\nimport { ZoomIn as ZoomInIcon } from '@mui/icons-material'\nimport { Tooltip } from '../../../components'\nimport {\n getEchartInstance,\n useSingleTransform,\n useWidgetId,\n} from '../../stores'\nimport { createAddZoom, type ZoomAxis } from './transforms'\nimport { DEFAULT_ZOOM_TOGGLE_LABELS, type ZoomToggleLabels } from './labels'\nimport { styles } from './style'\n\nconst ZOOM_DESCRIPTOR = {\n id: 'zoom-toggle',\n type: 'config' as const,\n order: 20,\n}\n\nexport interface ZoomToggleProps {\n initialEnabled?: boolean\n labels?: Partial<ZoomToggleLabels>\n icon?: ComponentType<SvgIconProps>\n iconProps?: SvgIconProps\n /**\n * Which axes the zoom controls. Default `['x']` — matches bar /\n * histogram / timeseries (horizontal pan on the category axis). Pass\n * `['x', 'y']` for 2D zoom on a scatterplot-style chart (mouse-wheel\n * scales both axes; horizontal slider at bottom + vertical slider on\n * the right).\n */\n axes?: readonly ZoomAxis[]\n}\n\n/**\n * Toggle a `dataZoom` slider + wheel-zoom on the chart. The transform is\n * theme-bound so the slider gets v1's CARTO chrome (blue-tinted filler,\n * secondary-color preview, white pill handles).\n *\n * `dataZoom` is intentionally NOT in `replaceMergeKeys` — ECharts merges\n * subsequent `setOption` calls so the user's dragged range survives\n * unrelated re-renders (data updates, formatter swaps, RelativeData toggles).\n *\n * On disable the transform is unregistered, but ECharts' merge semantics\n * would otherwise *keep* the live `dataZoom` component visible. To remove\n * the slider immediately we issue a one-shot\n * `setOption({}, { replaceMerge: ['dataZoom'] })` against the live chart\n * instance via {@link getEchartInstance} — this bypasses the pipeline so\n * unrelated transforms aren't disturbed.\n */\nexport function ZoomToggle({\n initialEnabled = false,\n labels,\n icon: Icon = ZoomInIcon,\n iconProps,\n axes,\n}: ZoomToggleProps) {\n const id = useWidgetId()\n const theme = useTheme()\n const _labels = { ...DEFAULT_ZOOM_TOGGLE_LABELS, ...labels }\n // Reduce `axes` to two structural booleans before memoizing so the memo\n // depends on stable primitive values, not an array reference (callers\n // typically pass an inline `axes={['x', 'y']}` literal that changes\n // identity each render). Default — no `axes` prop — is x-axis only,\n // matching `createAddZoom`'s default.\n const includeX = axes ? axes.includes('x') : true\n const includeY = axes ? axes.includes('y') : false\n const transform = useMemo(() => {\n const resolved: ZoomAxis[] = []\n if (includeX) resolved.push('x')\n if (includeY) resolved.push('y')\n return createAddZoom(theme, { axes: resolved })\n }, [theme, includeX, includeY])\n const { enabled, toggle } = useSingleTransform(\n id,\n ZOOM_DESCRIPTOR,\n transform,\n { initialEnabled },\n )\n\n const handleToggle = useCallback(() => {\n if (enabled) {\n // About to disable — clear the dataZoom component on the live\n // instance so the slider disappears immediately.\n getEchartInstance(id)?.setOption({}, { replaceMerge: ['dataZoom'] })\n }\n toggle()\n }, [enabled, toggle, id])\n\n const tooltip = enabled ? _labels.on : _labels.off\n\n return (\n <Tooltip title={tooltip}>\n <IconButton\n size='small'\n aria-label={tooltip}\n aria-pressed={enabled}\n onClick={handleToggle}\n className={enabled ? 'active' : undefined}\n sx={{ ...styles.toggle, ...(enabled && styles.toggleActive) }}\n >\n <Icon fontSize='small' {...iconProps} />\n </IconButton>\n </Tooltip>\n )\n}\n"],"mappings":";;;;;;;;;AAOA,IAAMC,IACJ,8pBAEIC,IAAgB,IAChBC,IAAgB;AAgCtB,SAAgBI,EACdC,GACAC,IAAgC,CAAC,GACH;CAC9B,IAAMH,IAAOG,EAAQH,QAAQ,CAAC,GAAG,GAC3BK,IAAWL,EAAKM,SAAS,GAAG,GAC5BC,IAAWP,EAAKM,SAAS,GAAG,GAE5BI,IAAkB;EACtBC,UAAU;EACVC,YAAY;EACZC,aAAa;EACbC,gBAAgB;EAChBC,YAAY;EACZ,GAPmBN,EAAoBP,CAOpCM;CACL;CACA,QAAQJ,MAA6B;EACnC,IAAsB,OAAOA,KAAW,aAApCA,GAA8C,OAAOA;EACzD,IAAMY,IAAMZ,GACNc,IAAqB,CAAA;EA8B3B,OA7BIb,KACFa,EAASC,KAAK;GAAEC,MAAM;GAAUC,YAAY,CAAC,CAAC;GAAGV,UAAU;EAAE,CAAC,GAE5DJ,KACFW,EAASC,KAAK;GAAEC,MAAM;GAAUE,YAAY,CAAC,CAAC;GAAGX,UAAU;EAAE,CAAC,GAE5DN,KACFa,EAASC,KAAK;GACZC,MAAM;GACNC,YAAY,CAAC,CAAC;GACdE,QAAQ3B;GACR4B,QAAQ3B;G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AgC,KAAAhC,EAAA,QAAA4B,KAAA5B,EAAA,QAAAyB,KAR1CQ,IAAA,kBAAC,GAAD;EACO,MAAA;EACOR,cAAAA;EACEN,gBAAAA;EACLK,SAAAA;EACE,WAAAI;EACP,IAAAG;EAEJC,UAAAA;CARS,CAAA,GASEhC,EAAA,MAAAmB,GAAAnB,EAAA,MAAAwB,GAAAxB,EAAA,MAAA+B,GAAA/B,EAAA,MAAAgC,GAAAhC,EAAA,MAAA4B,GAAA5B,EAAA,MAAAyB,GAAAzB,EAAA,MAAAiC,KAAAA,IAAAjC,EAAA;CAAA,IAAAkC;CACL,OADKlC,EAAA,QAAAiC,KAAAjC,EAAA,QAAAyB,KAVfS,IAAA,kBAAC,GAAD;EAAgBT,OAAAA;EACdQ,UAAAA;CADM,CAAA,GAWEjC,EAAA,MAAAiC,GAAAjC,EAAA,MAAAyB,GAAAzB,EAAA,MAAAkC,KAAAA,IAAAlC,EAAA,KAXVkC;AAWU"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carto/ps-react-ui",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.21.1",
|
|
4
4
|
"description": "CARTO's Professional Service React Material library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"devDependencies": {
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"react-dom": "19.2.8",
|
|
18
18
|
"react-markdown": "10.1.0",
|
|
19
19
|
"zustand": "5.0.15",
|
|
20
|
-
"@carto/ps-
|
|
21
|
-
"@carto/ps-
|
|
20
|
+
"@carto/ps-utils": "2.1.1",
|
|
21
|
+
"@carto/ps-common-types": "1.0.0"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@carto/meridian-ds": "^2.0.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"react-dom": "^19.2.0",
|
|
36
36
|
"react-markdown": "^10.0.0",
|
|
37
37
|
"zustand": "^5.0.0",
|
|
38
|
-
"@carto/ps-utils": "2.1.
|
|
38
|
+
"@carto/ps-utils": "2.1.1"
|
|
39
39
|
},
|
|
40
40
|
"exports": {
|
|
41
41
|
"./chat": {
|
|
@@ -244,7 +244,8 @@
|
|
|
244
244
|
"dependencies": {
|
|
245
245
|
"rehype-raw": "7.0.0",
|
|
246
246
|
"rehype-sanitize": "6.0.0",
|
|
247
|
-
"remark-gfm": "4.0.1"
|
|
247
|
+
"remark-gfm": "4.0.1",
|
|
248
|
+
"type-fest": "5.8.0"
|
|
248
249
|
},
|
|
249
250
|
"scripts": {
|
|
250
251
|
"dev": "vite build --watch --emptyOutDir=false",
|
|
@@ -1,15 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
styled,
|
|
3
|
+
Typography,
|
|
4
|
+
type SxProps,
|
|
5
|
+
type Theme,
|
|
6
|
+
type TypographyProps,
|
|
7
|
+
} from '@mui/material'
|
|
8
|
+
import type { CSSObject } from '@mui/material/styles'
|
|
9
|
+
import type { FC } from 'react'
|
|
2
10
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
// The explicit annotation is what keeps this file's .d.ts emittable: the type
|
|
12
|
+
// `styled()` infers can only be named through a pnpm-internal @mui/system path
|
|
13
|
+
// (TS2742), and vite-plugin-dts drops the whole declaration when that happens.
|
|
14
|
+
//
|
|
15
|
+
// ponytail: `component` and `ref` still typecheck, but the prop re-typing that
|
|
16
|
+
// comes with them does not — `component="a" href="#"` is rejected here and
|
|
17
|
+
// accepted on `Typography` itself. Restoring it needs `OverridableComponent`,
|
|
18
|
+
// which a MUI v5 `styled()` result isn't assignable to under React 19 types.
|
|
19
|
+
// Consumers who need the polymorphism use `Typography` directly.
|
|
20
|
+
export const ChatMessageOverflow: FC<TypographyProps> = styled(Typography)(
|
|
21
|
+
() => ({
|
|
22
|
+
whiteSpace: 'pre-wrap',
|
|
23
|
+
overflowX: 'clip',
|
|
24
|
+
overflowWrap: 'break-word',
|
|
25
|
+
maxWidth: '100%',
|
|
26
|
+
}),
|
|
27
|
+
)
|
|
9
28
|
ChatMessageOverflow.displayName = 'ChatMessageOverflow'
|
|
10
29
|
|
|
11
30
|
export const styles = {
|
|
12
|
-
agentMessageContainer: (theme: Theme) => ({
|
|
31
|
+
agentMessageContainer: (theme: Theme): CSSObject => ({
|
|
13
32
|
...theme.typography.body2,
|
|
14
33
|
width: '100%',
|
|
15
34
|
display: 'flex',
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { Box, styled } from '@mui/material'
|
|
1
|
+
import { Box, styled, type BoxProps } from '@mui/material'
|
|
2
|
+
import type { FC } from 'react'
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
// See chat/bubbles/styles.ts: the annotation keeps the declaration emittable,
|
|
5
|
+
// and what it gives up on `component=`.
|
|
6
|
+
export const ChatActionsContainer: FC<BoxProps> = styled(Box)(({ theme }) => ({
|
|
4
7
|
display: 'flex',
|
|
5
8
|
alignItems: 'center',
|
|
6
9
|
gap: theme.spacing(0.5),
|
|
@@ -121,12 +121,14 @@ export const styles = {
|
|
|
121
121
|
padding: ({ spacing }) => spacing(1),
|
|
122
122
|
borderRadius: ({ spacing }) => spacing(0.5),
|
|
123
123
|
backgroundColor: ({ palette }) => palette.background.default,
|
|
124
|
-
fontFamily: ({ typography }) =>
|
|
124
|
+
fontFamily: ({ typography }): string =>
|
|
125
125
|
typography.code3?.fontFamily ??
|
|
126
126
|
typography.code1?.fontFamily ??
|
|
127
127
|
'monospace',
|
|
128
|
-
fontSize: ({ typography })
|
|
129
|
-
|
|
128
|
+
fontSize: ({ typography }): string | number =>
|
|
129
|
+
typography.code3?.fontSize ?? '0.75rem',
|
|
130
|
+
lineHeight: ({ typography }): string | number =>
|
|
131
|
+
typography.code3?.lineHeight ?? 1.333,
|
|
130
132
|
whiteSpace: 'pre-wrap',
|
|
131
133
|
wordBreak: 'break-word',
|
|
132
134
|
overflowY: 'auto',
|
|
@@ -164,11 +166,12 @@ export const styles = {
|
|
|
164
166
|
padding: ({ spacing }) => spacing(1),
|
|
165
167
|
background: ({ palette, spacing }) =>
|
|
166
168
|
`linear-gradient(to right, ${palette.action.hover} calc(${spacing(1)} + 3em), ${palette.background.default} calc(${spacing(1)} + 3em))`,
|
|
167
|
-
fontFamily: ({ typography }) =>
|
|
169
|
+
fontFamily: ({ typography }): string =>
|
|
168
170
|
typography.code3?.fontFamily ??
|
|
169
171
|
typography.code1?.fontFamily ??
|
|
170
172
|
'monospace',
|
|
171
|
-
fontSize: ({ typography })
|
|
173
|
+
fontSize: ({ typography }): string | number =>
|
|
174
|
+
typography.code3?.fontSize ?? '0.75rem',
|
|
172
175
|
whiteSpace: 'pre-wrap',
|
|
173
176
|
wordBreak: 'break-word',
|
|
174
177
|
lineHeight: 1.6,
|
|
@@ -40,7 +40,7 @@ export function BasemapsUI({
|
|
|
40
40
|
onChange,
|
|
41
41
|
TooltipProps,
|
|
42
42
|
}: BasemapsUIProps): JSX.Element {
|
|
43
|
-
const [
|
|
43
|
+
const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null)
|
|
44
44
|
const [isOpen, setIsOpen] = useState(false)
|
|
45
45
|
const timeoutRef = useRef<NodeJS.Timeout | null>(null)
|
|
46
46
|
const [timer, setTimer] = useState<number | null>(null)
|
|
@@ -55,7 +55,7 @@ export function BasemapsUI({
|
|
|
55
55
|
const groupCount = Object.keys(groups).length
|
|
56
56
|
|
|
57
57
|
const handleClose = () => {
|
|
58
|
-
|
|
58
|
+
setAnchorEl(null)
|
|
59
59
|
setIsOpen(false)
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -93,7 +93,7 @@ export function BasemapsUI({
|
|
|
93
93
|
<IconButton
|
|
94
94
|
sx={styles.toggle}
|
|
95
95
|
onClick={(e) => {
|
|
96
|
-
|
|
96
|
+
setAnchorEl(e.currentTarget as HTMLButtonElement)
|
|
97
97
|
setIsOpen(true)
|
|
98
98
|
}}
|
|
99
99
|
>
|
|
@@ -105,7 +105,7 @@ export function BasemapsUI({
|
|
|
105
105
|
</Tooltip>
|
|
106
106
|
|
|
107
107
|
<ResponsiveDrawer
|
|
108
|
-
|
|
108
|
+
anchorEl={anchorEl}
|
|
109
109
|
slotProps={{
|
|
110
110
|
paper: {
|
|
111
111
|
sx: {
|