@carto/ps-react-ui 4.7.0 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/category-DwaeYjpX.js +656 -0
- package/dist/category-DwaeYjpX.js.map +1 -0
- package/dist/change-column-Cidl_M-4.js +1110 -0
- package/dist/change-column-Cidl_M-4.js.map +1 -0
- package/dist/data-zoom-layout-BH0LPwSy.js +28 -0
- package/dist/data-zoom-layout-BH0LPwSy.js.map +1 -0
- package/dist/echart-CU0KmClP.js +176 -0
- package/dist/echart-CU0KmClP.js.map +1 -0
- package/dist/exports-Cx-f6m6U.js +63 -0
- package/dist/exports-Cx-f6m6U.js.map +1 -0
- package/dist/formula-DuC0NQLH.js +79 -0
- package/dist/formula-DuC0NQLH.js.map +1 -0
- package/dist/markdown-BD1jcknS.js +8326 -0
- package/dist/markdown-BD1jcknS.js.map +1 -0
- package/dist/merge-options-DCkkHZIf.js +34 -0
- package/dist/merge-options-DCkkHZIf.js.map +1 -0
- package/dist/{styles-BYTyKQFP.js → option-builders-F-c9ELi1.js} +25 -45
- package/dist/option-builders-F-c9ELi1.js.map +1 -0
- package/dist/png-item-CS4z1iSH.js +45 -0
- package/dist/png-item-CS4z1iSH.js.map +1 -0
- package/dist/range-DsqTjSpg.js +186 -0
- package/dist/range-DsqTjSpg.js.map +1 -0
- package/dist/spread-CTuIXZSM.js +67 -0
- package/dist/spread-CTuIXZSM.js.map +1 -0
- package/dist/style-DVnT6HC1.js +131 -0
- package/dist/style-DVnT6HC1.js.map +1 -0
- package/dist/styles-cohnxh9F.js +23 -0
- package/dist/styles-cohnxh9F.js.map +1 -0
- package/dist/table-HIpXuq4G.js +390 -0
- package/dist/table-HIpXuq4G.js.map +1 -0
- package/dist/transforms-Cdx4fkU5.js +106 -0
- package/dist/transforms-Cdx4fkU5.js.map +1 -0
- package/dist/types/widgets/echart/utils.test.d.ts +1 -0
- package/dist/types/widgets/formula/config.test.d.ts +1 -0
- package/dist/types/widgets/stores/widget-store-branches.test.d.ts +1 -0
- package/dist/types/widgets/table/config.test.d.ts +1 -0
- package/dist/types/widgets-v2/actions/brush-toggle/brush-toggle.d.ts +56 -0
- package/dist/types/widgets-v2/actions/brush-toggle/index.d.ts +3 -0
- package/dist/types/widgets-v2/actions/brush-toggle/labels.d.ts +5 -0
- package/dist/types/widgets-v2/actions/brush-toggle/style.d.ts +12 -0
- package/dist/types/widgets-v2/actions/brush-toggle/transforms.d.ts +11 -0
- package/dist/types/widgets-v2/actions/brush-toggle/transforms.test.d.ts +1 -0
- package/dist/types/widgets-v2/actions/change-column/change-column-icon.d.ts +2 -0
- package/dist/types/widgets-v2/actions/change-column/change-column.d.ts +29 -0
- package/dist/types/widgets-v2/actions/change-column/index.d.ts +3 -0
- package/dist/types/widgets-v2/actions/change-column/labels.d.ts +5 -0
- package/dist/types/widgets-v2/actions/change-column/sortable-column-item.d.ts +14 -0
- package/dist/types/widgets-v2/actions/change-column/style.d.ts +33 -0
- package/dist/types/widgets-v2/actions/change-column/types.d.ts +10 -0
- package/dist/types/widgets-v2/actions/download/download.d.ts +18 -0
- package/dist/types/widgets-v2/actions/download/exports.d.ts +37 -0
- package/dist/types/widgets-v2/actions/download/icons.d.ts +12 -0
- package/dist/types/widgets-v2/actions/download/index.d.ts +6 -0
- package/dist/types/widgets-v2/actions/download/labels.d.ts +11 -0
- package/dist/types/widgets-v2/actions/download/png-item.d.ts +24 -0
- package/dist/types/widgets-v2/actions/download/style.d.ts +1 -0
- package/dist/types/widgets-v2/actions/download/types.d.ts +35 -0
- package/dist/types/widgets-v2/actions/fullscreen/fullscreen.d.ts +59 -0
- package/dist/types/widgets-v2/actions/fullscreen/index.d.ts +3 -0
- package/dist/types/widgets-v2/actions/fullscreen/labels.d.ts +5 -0
- package/dist/types/widgets-v2/actions/fullscreen/style.d.ts +48 -0
- package/dist/types/widgets-v2/actions/fullscreen/types.d.ts +14 -0
- package/dist/types/widgets-v2/actions/index.d.ts +9 -0
- package/dist/types/widgets-v2/actions/lock-selection/index.d.ts +3 -0
- package/dist/types/widgets-v2/actions/lock-selection/labels.d.ts +6 -0
- package/dist/types/widgets-v2/actions/lock-selection/lock-selection.d.ts +36 -0
- package/dist/types/widgets-v2/actions/lock-selection/style.d.ts +12 -0
- package/dist/types/widgets-v2/actions/lock-selection/transforms.d.ts +6 -0
- package/dist/types/widgets-v2/actions/relative-data/index.d.ts +3 -0
- package/dist/types/widgets-v2/actions/relative-data/labels.d.ts +5 -0
- package/dist/types/widgets-v2/actions/relative-data/relative-data.d.ts +39 -0
- package/dist/types/widgets-v2/actions/relative-data/style.d.ts +12 -0
- package/dist/types/widgets-v2/actions/relative-data/transforms.d.ts +30 -0
- package/dist/types/widgets-v2/actions/relative-data/transforms.test.d.ts +1 -0
- package/dist/types/widgets-v2/actions/searcher/filter.d.ts +6 -0
- package/dist/types/widgets-v2/actions/searcher/index.d.ts +4 -0
- package/dist/types/widgets-v2/actions/searcher/labels.d.ts +7 -0
- package/dist/types/widgets-v2/actions/searcher/searcher-toggle.d.ts +23 -0
- package/dist/types/widgets-v2/actions/searcher/searcher.d.ts +11 -0
- package/dist/types/widgets-v2/actions/searcher/style.d.ts +16 -0
- package/dist/types/widgets-v2/actions/stack-toggle/index.d.ts +3 -0
- package/dist/types/widgets-v2/actions/stack-toggle/labels.d.ts +5 -0
- package/dist/types/widgets-v2/actions/stack-toggle/stack-toggle.d.ts +10 -0
- package/dist/types/widgets-v2/actions/stack-toggle/style.d.ts +12 -0
- package/dist/types/widgets-v2/actions/stack-toggle/transforms.d.ts +13 -0
- package/dist/types/widgets-v2/actions/stack-toggle/transforms.test.d.ts +1 -0
- package/dist/types/widgets-v2/actions/zoom-toggle/index.d.ts +3 -0
- package/dist/types/widgets-v2/actions/zoom-toggle/labels.d.ts +5 -0
- package/dist/types/widgets-v2/actions/zoom-toggle/style.d.ts +12 -0
- package/dist/types/widgets-v2/actions/zoom-toggle/transforms.d.ts +51 -0
- package/dist/types/widgets-v2/actions/zoom-toggle/transforms.test.d.ts +1 -0
- package/dist/types/widgets-v2/actions/zoom-toggle/zoom-toggle.d.ts +35 -0
- package/dist/types/widgets-v2/bar/download.d.ts +24 -0
- package/dist/types/widgets-v2/bar/index.d.ts +4 -0
- package/dist/types/widgets-v2/bar/options.d.ts +43 -0
- package/dist/types/widgets-v2/bar/options.test.d.ts +1 -0
- package/dist/types/widgets-v2/bar/skeleton.d.ts +6 -0
- package/dist/types/widgets-v2/bar/types.d.ts +41 -0
- package/dist/types/widgets-v2/category/category-ui.d.ts +81 -0
- package/dist/types/widgets-v2/category/category.d.ts +48 -0
- package/dist/types/widgets-v2/category/components/category-bar-stacked.d.ts +28 -0
- package/dist/types/widgets-v2/category/components/category-bar.d.ts +23 -0
- package/dist/types/widgets-v2/category/components/category-legend.d.ts +18 -0
- package/dist/types/widgets-v2/category/components/category-row-multi.d.ts +31 -0
- package/dist/types/widgets-v2/category/components/category-row-other.d.ts +13 -0
- package/dist/types/widgets-v2/category/components/category-row-single.d.ts +28 -0
- package/dist/types/widgets-v2/category/components/category-row-stacked.d.ts +38 -0
- package/dist/types/widgets-v2/category/download.d.ts +16 -0
- package/dist/types/widgets-v2/category/download.test.d.ts +1 -0
- package/dist/types/widgets-v2/category/index.d.ts +10 -0
- package/dist/types/widgets-v2/category/skeleton.d.ts +11 -0
- package/dist/types/widgets-v2/category/style.d.ts +166 -0
- package/dist/types/widgets-v2/category/types.d.ts +49 -0
- package/dist/types/widgets-v2/echart/echart-ui.d.ts +44 -0
- package/dist/types/widgets-v2/echart/echart.d.ts +75 -0
- package/dist/types/widgets-v2/echart/index.d.ts +4 -0
- package/dist/types/widgets-v2/echart/shared-resize-observer.d.ts +5 -0
- package/dist/types/widgets-v2/echart/shared-resize-observer.test.d.ts +1 -0
- package/dist/types/widgets-v2/echart/style.d.ts +6 -0
- package/dist/types/widgets-v2/echart/use-chart-selection.d.ts +51 -0
- package/dist/types/widgets-v2/formula/delta.d.ts +22 -0
- package/dist/types/widgets-v2/formula/download.d.ts +20 -0
- package/dist/types/widgets-v2/formula/formula-ui.d.ts +20 -0
- package/dist/types/widgets-v2/formula/formula.d.ts +8 -0
- package/dist/types/widgets-v2/formula/index.d.ts +11 -0
- package/dist/types/widgets-v2/formula/note.d.ts +11 -0
- package/dist/types/widgets-v2/formula/prefix.d.ts +12 -0
- package/dist/types/widgets-v2/formula/series.d.ts +16 -0
- package/dist/types/widgets-v2/formula/skeleton.d.ts +4 -0
- package/dist/types/widgets-v2/formula/style.d.ts +29 -0
- package/dist/types/widgets-v2/formula/suffix.d.ts +12 -0
- package/dist/types/widgets-v2/formula/types.d.ts +40 -0
- package/dist/types/widgets-v2/formula/value.d.ts +14 -0
- package/dist/types/widgets-v2/histogram/download.d.ts +17 -0
- package/dist/types/widgets-v2/histogram/download.test.d.ts +1 -0
- package/dist/types/widgets-v2/histogram/index.d.ts +5 -0
- package/dist/types/widgets-v2/histogram/options.d.ts +42 -0
- package/dist/types/widgets-v2/histogram/options.test.d.ts +1 -0
- package/dist/types/widgets-v2/histogram/skeleton.d.ts +9 -0
- package/dist/types/widgets-v2/histogram/transforms.d.ts +17 -0
- package/dist/types/widgets-v2/histogram/transforms.test.d.ts +1 -0
- package/dist/types/widgets-v2/histogram/types.d.ts +47 -0
- package/dist/types/widgets-v2/index.d.ts +107 -0
- package/dist/types/widgets-v2/markdown/download.d.ts +16 -0
- package/dist/types/widgets-v2/markdown/download.test.d.ts +1 -0
- package/dist/types/widgets-v2/markdown/index.d.ts +6 -0
- package/dist/types/widgets-v2/markdown/markdown-content.d.ts +34 -0
- package/dist/types/widgets-v2/markdown/markdown-ui.d.ts +12 -0
- package/dist/types/widgets-v2/markdown/markdown.d.ts +6 -0
- package/dist/types/widgets-v2/markdown/skeleton.d.ts +4 -0
- package/dist/types/widgets-v2/markdown/style.d.ts +61 -0
- package/dist/types/widgets-v2/markdown/types.d.ts +4 -0
- package/dist/types/widgets-v2/note/labels.d.ts +5 -0
- package/dist/types/widgets-v2/note/style.d.ts +26 -0
- package/dist/types/widgets-v2/note/widget-note.d.ts +46 -0
- package/dist/types/widgets-v2/pie/download.d.ts +17 -0
- package/dist/types/widgets-v2/pie/download.test.d.ts +1 -0
- package/dist/types/widgets-v2/pie/index.d.ts +4 -0
- package/dist/types/widgets-v2/pie/options.d.ts +35 -0
- package/dist/types/widgets-v2/pie/options.test.d.ts +1 -0
- package/dist/types/widgets-v2/pie/skeleton.d.ts +4 -0
- package/dist/types/widgets-v2/pie/types.d.ts +50 -0
- package/dist/types/widgets-v2/provider/widget-provider.d.ts +32 -0
- package/dist/types/widgets-v2/range/index.d.ts +4 -0
- package/dist/types/widgets-v2/range/range-ui.d.ts +19 -0
- package/dist/types/widgets-v2/range/range.d.ts +19 -0
- package/dist/types/widgets-v2/range/skeleton.d.ts +9 -0
- package/dist/types/widgets-v2/range/style.d.ts +40 -0
- package/dist/types/widgets-v2/range/types.d.ts +37 -0
- package/dist/types/widgets-v2/scatterplot/download.d.ts +16 -0
- package/dist/types/widgets-v2/scatterplot/download.test.d.ts +1 -0
- package/dist/types/widgets-v2/scatterplot/index.d.ts +5 -0
- package/dist/types/widgets-v2/scatterplot/options.d.ts +42 -0
- package/dist/types/widgets-v2/scatterplot/options.test.d.ts +1 -0
- package/dist/types/widgets-v2/scatterplot/skeleton.d.ts +12 -0
- package/dist/types/widgets-v2/scatterplot/transforms.d.ts +17 -0
- package/dist/types/widgets-v2/scatterplot/transforms.test.d.ts +1 -0
- package/dist/types/widgets-v2/scatterplot/types.d.ts +50 -0
- package/dist/types/widgets-v2/selection-summary/labels.d.ts +6 -0
- package/dist/types/widgets-v2/selection-summary/selection-summary.d.ts +22 -0
- package/dist/types/widgets-v2/selection-summary/style.d.ts +23 -0
- package/dist/types/widgets-v2/spread/download.d.ts +15 -0
- package/dist/types/widgets-v2/spread/download.test.d.ts +1 -0
- package/dist/types/widgets-v2/spread/index.d.ts +6 -0
- package/dist/types/widgets-v2/spread/separator.d.ts +7 -0
- package/dist/types/widgets-v2/spread/skeleton.d.ts +9 -0
- package/dist/types/widgets-v2/spread/spread-ui.d.ts +18 -0
- package/dist/types/widgets-v2/spread/spread.d.ts +5 -0
- package/dist/types/widgets-v2/spread/types.d.ts +25 -0
- package/dist/types/widgets-v2/state/labels.d.ts +7 -0
- package/dist/types/widgets-v2/state/labels.test.d.ts +1 -0
- package/dist/types/widgets-v2/state/style.d.ts +19 -0
- package/dist/types/widgets-v2/state/widget-state.d.ts +19 -0
- package/dist/types/widgets-v2/stores/index.d.ts +8 -0
- package/dist/types/widgets-v2/stores/pipeline-middleware.d.ts +5 -0
- package/dist/types/widgets-v2/stores/pipeline-middleware.test.d.ts +1 -0
- package/dist/types/widgets-v2/stores/transforms.d.ts +4 -0
- package/dist/types/widgets-v2/stores/transforms.test.d.ts +1 -0
- package/dist/types/widgets-v2/stores/types.d.ts +55 -0
- package/dist/types/widgets-v2/stores/use-echart-instance.d.ts +15 -0
- package/dist/types/widgets-v2/stores/use-transform-enabled.d.ts +17 -0
- package/dist/types/widgets-v2/stores/use-transform.d.ts +12 -0
- package/dist/types/widgets-v2/stores/widget-context.d.ts +2 -0
- package/dist/types/widgets-v2/stores/widget-store-registry.d.ts +74 -0
- package/dist/types/widgets-v2/stores/widget-store-registry.test.d.ts +1 -0
- package/dist/types/widgets-v2/subheader/style.d.ts +10 -0
- package/dist/types/widgets-v2/subheader/subheader.d.ts +11 -0
- package/dist/types/widgets-v2/table/download.d.ts +18 -0
- package/dist/types/widgets-v2/table/download.test.d.ts +1 -0
- package/dist/types/widgets-v2/table/helpers.d.ts +32 -0
- package/dist/types/widgets-v2/table/helpers.test.d.ts +1 -0
- package/dist/types/widgets-v2/table/index.d.ts +7 -0
- package/dist/types/widgets-v2/table/labels.d.ts +22 -0
- package/dist/types/widgets-v2/table/skeleton.d.ts +22 -0
- package/dist/types/widgets-v2/table/style.d.ts +44 -0
- package/dist/types/widgets-v2/table/table-ui.d.ts +38 -0
- package/dist/types/widgets-v2/table/table.d.ts +50 -0
- package/dist/types/widgets-v2/table/types.d.ts +37 -0
- package/dist/types/widgets-v2/test-utils.d.ts +52 -0
- package/dist/types/widgets-v2/timeseries/download.d.ts +17 -0
- package/dist/types/widgets-v2/timeseries/download.test.d.ts +1 -0
- package/dist/types/widgets-v2/timeseries/index.d.ts +4 -0
- package/dist/types/widgets-v2/timeseries/options.d.ts +39 -0
- package/dist/types/widgets-v2/timeseries/options.test.d.ts +1 -0
- package/dist/types/widgets-v2/timeseries/skeleton.d.ts +8 -0
- package/dist/types/widgets-v2/timeseries/types.d.ts +56 -0
- package/dist/types/widgets-v2/toolbox/labels.d.ts +5 -0
- package/dist/types/widgets-v2/toolbox/style.d.ts +30 -0
- package/dist/types/widgets-v2/toolbox/toolbox.d.ts +49 -0
- package/dist/types/widgets-v2/utils/data-zoom-layout.d.ts +11 -0
- package/dist/types/widgets-v2/utils/index.d.ts +2 -0
- package/dist/types/widgets-v2/utils/merge-options.d.ts +12 -0
- package/dist/types/widgets-v2/utils/merge-options.test.d.ts +1 -0
- package/dist/types/widgets-v2/wrapper/index.d.ts +4 -0
- package/dist/types/widgets-v2/wrapper/labels.d.ts +6 -0
- package/dist/types/widgets-v2/wrapper/style.d.ts +111 -0
- package/dist/types/widgets-v2/wrapper/widget-actions.d.ts +22 -0
- package/dist/types/widgets-v2/wrapper/widget-content.d.ts +12 -0
- package/dist/types/widgets-v2/wrapper/widget-wrapper.d.ts +51 -0
- package/dist/use-transform-DXPN3nY7.js +110 -0
- package/dist/use-transform-DXPN3nY7.js.map +1 -0
- package/dist/widget-context-DTGO0Yta.js +13 -0
- package/dist/widget-context-DTGO0Yta.js.map +1 -0
- package/dist/widget-store-registry-_W4Z4xp-.js +178 -0
- package/dist/widget-store-registry-_W4Z4xp-.js.map +1 -0
- package/dist/widgets/actions.js +688 -668
- package/dist/widgets/actions.js.map +1 -1
- package/dist/widgets/bar.js +14 -13
- package/dist/widgets/bar.js.map +1 -1
- package/dist/widgets/histogram.js +38 -37
- package/dist/widgets/histogram.js.map +1 -1
- package/dist/widgets/pie.js +19 -18
- package/dist/widgets/pie.js.map +1 -1
- package/dist/widgets/scatterplot.js +8 -7
- package/dist/widgets/scatterplot.js.map +1 -1
- package/dist/widgets/timeseries.js +11 -10
- package/dist/widgets/timeseries.js.map +1 -1
- package/dist/widgets/utils.js +8 -7
- package/dist/widgets/utils.js.map +1 -1
- package/dist/widgets-v2/actions.js +43 -0
- package/dist/widgets-v2/actions.js.map +1 -0
- package/dist/widgets-v2/bar.js +327 -0
- package/dist/widgets-v2/bar.js.map +1 -0
- package/dist/widgets-v2/category.js +104 -0
- package/dist/widgets-v2/category.js.map +1 -0
- package/dist/widgets-v2/echart.js +57 -0
- package/dist/widgets-v2/echart.js.map +1 -0
- package/dist/widgets-v2/formula.js +74 -0
- package/dist/widgets-v2/formula.js.map +1 -0
- package/dist/widgets-v2/histogram.js +350 -0
- package/dist/widgets-v2/histogram.js.map +1 -0
- package/dist/widgets-v2/markdown.js +68 -0
- package/dist/widgets-v2/markdown.js.map +1 -0
- package/dist/widgets-v2/pie.js +381 -0
- package/dist/widgets-v2/pie.js.map +1 -0
- package/dist/widgets-v2/range.js +52 -0
- package/dist/widgets-v2/range.js.map +1 -0
- package/dist/widgets-v2/scatterplot.js +405 -0
- package/dist/widgets-v2/scatterplot.js.map +1 -0
- package/dist/widgets-v2/spread.js +72 -0
- package/dist/widgets-v2/spread.js.map +1 -0
- package/dist/widgets-v2/stores.js +42 -0
- package/dist/widgets-v2/stores.js.map +1 -0
- package/dist/widgets-v2/table.js +78 -0
- package/dist/widgets-v2/table.js.map +1 -0
- package/dist/widgets-v2/timeseries.js +352 -0
- package/dist/widgets-v2/timeseries.js.map +1 -0
- package/dist/widgets-v2/utils.js +7 -0
- package/dist/widgets-v2/utils.js.map +1 -0
- package/dist/widgets-v2.js +953 -0
- package/dist/widgets-v2.js.map +1 -0
- package/package.json +73 -5
- package/src/components/lasso-tool/chip.test.tsx +176 -0
- package/src/components/lasso-tool/lasso-tool-inline.test.tsx +171 -0
- package/src/components/lasso-tool/lasso-tool.test.tsx +198 -0
- package/src/components/list-data/list-data.test.tsx +73 -0
- package/src/components/no-data-alert/no-data-alert.test.tsx +38 -0
- package/src/components/responsive-drawer/responsive-drawer.test.tsx +68 -0
- package/src/widgets/actions/brush-toggle/brush-overlay.test.tsx +465 -0
- package/src/widgets/actions/brush-toggle/brush-overlay.tsx +24 -2
- package/src/widgets/actions/brush-toggle/brush-toggle.test.tsx +208 -0
- package/src/widgets/actions/change-column/change-column-dnd.test.tsx +193 -0
- package/src/widgets/actions/change-column/sortable-column-item.test.tsx +124 -0
- package/src/widgets/actions/zoom-toggle/zoom-toggle.test.tsx +322 -0
- package/src/widgets/category/components/category-rows.test.tsx +213 -0
- package/src/widgets/echart/utils.test.ts +277 -0
- package/src/widgets/formula/config.test.ts +37 -0
- package/src/widgets/histogram/config.ts +1 -3
- package/src/widgets/range/components/range-item.test.tsx +243 -0
- package/src/widgets/stores/widget-store-branches.test.ts +275 -0
- package/src/widgets/table/config.test.ts +65 -0
- package/src/widgets/utils/chart-config/option-builders.test.ts +188 -0
- package/src/widgets-v2/PERFORMANCE.md +189 -0
- package/src/widgets-v2/actions/brush-toggle/brush-toggle.test.tsx +180 -0
- package/src/widgets-v2/actions/brush-toggle/brush-toggle.tsx +154 -0
- package/src/widgets-v2/actions/brush-toggle/index.ts +3 -0
- package/src/widgets-v2/actions/brush-toggle/labels.ts +9 -0
- package/src/widgets-v2/actions/brush-toggle/style.ts +11 -0
- package/src/widgets-v2/actions/brush-toggle/transforms.test.ts +47 -0
- package/src/widgets-v2/actions/brush-toggle/transforms.ts +31 -0
- package/src/widgets-v2/actions/change-column/change-column-icon.tsx +14 -0
- package/src/widgets-v2/actions/change-column/change-column.test.tsx +59 -0
- package/src/widgets-v2/actions/change-column/change-column.tsx +180 -0
- package/src/widgets-v2/actions/change-column/index.ts +7 -0
- package/src/widgets-v2/actions/change-column/labels.ts +9 -0
- package/src/widgets-v2/actions/change-column/sortable-column-item.tsx +56 -0
- package/src/widgets-v2/actions/change-column/style.ts +32 -0
- package/src/widgets-v2/actions/change-column/types.ts +11 -0
- package/src/widgets-v2/actions/download/download.test.tsx +327 -0
- package/src/widgets-v2/actions/download/download.tsx +144 -0
- package/src/widgets-v2/actions/download/exports.test.tsx +198 -0
- package/src/widgets-v2/actions/download/exports.ts +115 -0
- package/src/widgets-v2/actions/download/icons.tsx +26 -0
- package/src/widgets-v2/actions/download/index.ts +13 -0
- package/src/widgets-v2/actions/download/labels.ts +16 -0
- package/src/widgets-v2/actions/download/png-item.test.tsx +72 -0
- package/src/widgets-v2/actions/download/png-item.tsx +52 -0
- package/src/widgets-v2/actions/download/style.ts +3 -0
- package/src/widgets-v2/actions/download/types.ts +32 -0
- package/src/widgets-v2/actions/fullscreen/fullscreen.test.tsx +150 -0
- package/src/widgets-v2/actions/fullscreen/fullscreen.tsx +230 -0
- package/src/widgets-v2/actions/fullscreen/index.ts +7 -0
- package/src/widgets-v2/actions/fullscreen/labels.ts +9 -0
- package/src/widgets-v2/actions/fullscreen/style.ts +59 -0
- package/src/widgets-v2/actions/fullscreen/types.ts +15 -0
- package/src/widgets-v2/actions/index.ts +82 -0
- package/src/widgets-v2/actions/lock-selection/index.ts +10 -0
- package/src/widgets-v2/actions/lock-selection/labels.ts +11 -0
- package/src/widgets-v2/actions/lock-selection/lock-selection.test.tsx +187 -0
- package/src/widgets-v2/actions/lock-selection/lock-selection.tsx +130 -0
- package/src/widgets-v2/actions/lock-selection/style.ts +11 -0
- package/src/widgets-v2/actions/lock-selection/transforms.ts +27 -0
- package/src/widgets-v2/actions/relative-data/index.ts +3 -0
- package/src/widgets-v2/actions/relative-data/labels.ts +9 -0
- package/src/widgets-v2/actions/relative-data/relative-data.test.tsx +71 -0
- package/src/widgets-v2/actions/relative-data/relative-data.tsx +107 -0
- package/src/widgets-v2/actions/relative-data/style.ts +11 -0
- package/src/widgets-v2/actions/relative-data/transforms.test.ts +151 -0
- package/src/widgets-v2/actions/relative-data/transforms.ts +70 -0
- package/src/widgets-v2/actions/searcher/filter.ts +28 -0
- package/src/widgets-v2/actions/searcher/index.ts +8 -0
- package/src/widgets-v2/actions/searcher/labels.ts +13 -0
- package/src/widgets-v2/actions/searcher/searcher-toggle.tsx +91 -0
- package/src/widgets-v2/actions/searcher/searcher.test.tsx +92 -0
- package/src/widgets-v2/actions/searcher/searcher.tsx +112 -0
- package/src/widgets-v2/actions/searcher/style.ts +15 -0
- package/src/widgets-v2/actions/stack-toggle/index.ts +3 -0
- package/src/widgets-v2/actions/stack-toggle/labels.ts +9 -0
- package/src/widgets-v2/actions/stack-toggle/stack-toggle.test.tsx +61 -0
- package/src/widgets-v2/actions/stack-toggle/stack-toggle.tsx +54 -0
- package/src/widgets-v2/actions/stack-toggle/style.ts +11 -0
- package/src/widgets-v2/actions/stack-toggle/transforms.test.ts +43 -0
- package/src/widgets-v2/actions/stack-toggle/transforms.ts +25 -0
- package/src/widgets-v2/actions/zoom-toggle/index.ts +9 -0
- package/src/widgets-v2/actions/zoom-toggle/labels.ts +9 -0
- package/src/widgets-v2/actions/zoom-toggle/style.ts +11 -0
- package/src/widgets-v2/actions/zoom-toggle/transforms.test.ts +148 -0
- package/src/widgets-v2/actions/zoom-toggle/transforms.ts +171 -0
- package/src/widgets-v2/actions/zoom-toggle/zoom-toggle.test.tsx +107 -0
- package/src/widgets-v2/actions/zoom-toggle/zoom-toggle.tsx +106 -0
- package/src/widgets-v2/bar/download.test.tsx +91 -0
- package/src/widgets-v2/bar/download.tsx +66 -0
- package/src/widgets-v2/bar/index.ts +10 -0
- package/src/widgets-v2/bar/options.test.ts +317 -0
- package/src/widgets-v2/bar/options.ts +326 -0
- package/src/widgets-v2/bar/skeleton.test.tsx +19 -0
- package/src/widgets-v2/bar/skeleton.tsx +69 -0
- package/src/widgets-v2/bar/types.ts +46 -0
- package/src/widgets-v2/category/category-ui.test.tsx +746 -0
- package/src/widgets-v2/category/category-ui.tsx +389 -0
- package/src/widgets-v2/category/category.relative-data.test.tsx +107 -0
- package/src/widgets-v2/category/category.stack-toggle.test.tsx +85 -0
- package/src/widgets-v2/category/category.test.tsx +305 -0
- package/src/widgets-v2/category/category.tsx +121 -0
- package/src/widgets-v2/category/components/category-bar-stacked.test.tsx +121 -0
- package/src/widgets-v2/category/components/category-bar-stacked.tsx +73 -0
- package/src/widgets-v2/category/components/category-bar.test.tsx +64 -0
- package/src/widgets-v2/category/components/category-bar.tsx +49 -0
- package/src/widgets-v2/category/components/category-legend.test.tsx +51 -0
- package/src/widgets-v2/category/components/category-legend.tsx +39 -0
- package/src/widgets-v2/category/components/category-row-multi.tsx +86 -0
- package/src/widgets-v2/category/components/category-row-other.test.tsx +28 -0
- package/src/widgets-v2/category/components/category-row-other.tsx +33 -0
- package/src/widgets-v2/category/components/category-row-single.tsx +76 -0
- package/src/widgets-v2/category/components/category-row-stacked.test.tsx +244 -0
- package/src/widgets-v2/category/components/category-row-stacked.tsx +99 -0
- package/src/widgets-v2/category/download.test.ts +71 -0
- package/src/widgets-v2/category/download.ts +54 -0
- package/src/widgets-v2/category/index.ts +32 -0
- package/src/widgets-v2/category/skeleton.test.tsx +26 -0
- package/src/widgets-v2/category/skeleton.tsx +74 -0
- package/src/widgets-v2/category/style.ts +290 -0
- package/src/widgets-v2/category/types.ts +54 -0
- package/src/widgets-v2/echart/echart-ui.test.tsx +232 -0
- package/src/widgets-v2/echart/echart-ui.tsx +184 -0
- package/src/widgets-v2/echart/echart.test.tsx +229 -0
- package/src/widgets-v2/echart/echart.tsx +199 -0
- package/src/widgets-v2/echart/index.ts +22 -0
- package/src/widgets-v2/echart/shared-resize-observer.test.ts +91 -0
- package/src/widgets-v2/echart/shared-resize-observer.ts +56 -0
- package/src/widgets-v2/echart/style.ts +8 -0
- package/src/widgets-v2/echart/use-chart-selection.test.tsx +118 -0
- package/src/widgets-v2/echart/use-chart-selection.ts +115 -0
- package/src/widgets-v2/formula/delta.tsx +61 -0
- package/src/widgets-v2/formula/download.test.tsx +65 -0
- package/src/widgets-v2/formula/download.tsx +69 -0
- package/src/widgets-v2/formula/formula-ui.test.tsx +91 -0
- package/src/widgets-v2/formula/formula-ui.tsx +66 -0
- package/src/widgets-v2/formula/formula.test.tsx +50 -0
- package/src/widgets-v2/formula/formula.tsx +34 -0
- package/src/widgets-v2/formula/index.ts +17 -0
- package/src/widgets-v2/formula/note.tsx +25 -0
- package/src/widgets-v2/formula/prefix.tsx +25 -0
- package/src/widgets-v2/formula/series.tsx +67 -0
- package/src/widgets-v2/formula/skeleton.test.tsx +21 -0
- package/src/widgets-v2/formula/skeleton.tsx +27 -0
- package/src/widgets-v2/formula/style.ts +31 -0
- package/src/widgets-v2/formula/subcomponents.test.tsx +107 -0
- package/src/widgets-v2/formula/suffix.tsx +25 -0
- package/src/widgets-v2/formula/types.ts +44 -0
- package/src/widgets-v2/formula/value.tsx +31 -0
- package/src/widgets-v2/histogram/download.test.ts +94 -0
- package/src/widgets-v2/histogram/download.ts +60 -0
- package/src/widgets-v2/histogram/index.ts +10 -0
- package/src/widgets-v2/histogram/options.test.ts +304 -0
- package/src/widgets-v2/histogram/options.ts +337 -0
- package/src/widgets-v2/histogram/skeleton.test.tsx +16 -0
- package/src/widgets-v2/histogram/skeleton.tsx +70 -0
- package/src/widgets-v2/histogram/transforms.test.ts +46 -0
- package/src/widgets-v2/histogram/transforms.ts +30 -0
- package/src/widgets-v2/histogram/types.ts +51 -0
- package/src/widgets-v2/index.ts +201 -0
- package/src/widgets-v2/markdown/download.test.ts +66 -0
- package/src/widgets-v2/markdown/download.ts +53 -0
- package/src/widgets-v2/markdown/index.ts +6 -0
- package/src/widgets-v2/markdown/markdown-content.test.tsx +155 -0
- package/src/widgets-v2/markdown/markdown-content.tsx +72 -0
- package/src/widgets-v2/markdown/markdown-ui.test.tsx +75 -0
- package/src/widgets-v2/markdown/markdown-ui.tsx +55 -0
- package/src/widgets-v2/markdown/markdown.test.tsx +39 -0
- package/src/widgets-v2/markdown/markdown.tsx +17 -0
- package/src/widgets-v2/markdown/skeleton.test.tsx +15 -0
- package/src/widgets-v2/markdown/skeleton.tsx +32 -0
- package/src/widgets-v2/markdown/style.ts +53 -0
- package/src/widgets-v2/markdown/types.ts +4 -0
- package/src/widgets-v2/note/labels.ts +9 -0
- package/src/widgets-v2/note/style.ts +26 -0
- package/src/widgets-v2/note/widget-note.test.tsx +158 -0
- package/src/widgets-v2/note/widget-note.tsx +172 -0
- package/src/widgets-v2/pie/download.test.ts +78 -0
- package/src/widgets-v2/pie/download.ts +55 -0
- package/src/widgets-v2/pie/index.ts +10 -0
- package/src/widgets-v2/pie/options.test.ts +585 -0
- package/src/widgets-v2/pie/options.ts +509 -0
- package/src/widgets-v2/pie/skeleton.test.tsx +17 -0
- package/src/widgets-v2/pie/skeleton.tsx +32 -0
- package/src/widgets-v2/pie/types.ts +55 -0
- package/src/widgets-v2/provider/widget-provider.test.tsx +119 -0
- package/src/widgets-v2/provider/widget-provider.tsx +111 -0
- package/src/widgets-v2/range/index.ts +4 -0
- package/src/widgets-v2/range/range-ui.test.tsx +130 -0
- package/src/widgets-v2/range/range-ui.tsx +211 -0
- package/src/widgets-v2/range/range.test.tsx +68 -0
- package/src/widgets-v2/range/range.tsx +46 -0
- package/src/widgets-v2/range/skeleton.test.tsx +17 -0
- package/src/widgets-v2/range/skeleton.tsx +47 -0
- package/src/widgets-v2/range/style.ts +41 -0
- package/src/widgets-v2/range/types.ts +37 -0
- package/src/widgets-v2/scatterplot/download.test.ts +71 -0
- package/src/widgets-v2/scatterplot/download.ts +54 -0
- package/src/widgets-v2/scatterplot/index.ts +11 -0
- package/src/widgets-v2/scatterplot/options.test.ts +399 -0
- package/src/widgets-v2/scatterplot/options.ts +421 -0
- package/src/widgets-v2/scatterplot/skeleton.test.tsx +17 -0
- package/src/widgets-v2/scatterplot/skeleton.tsx +84 -0
- package/src/widgets-v2/scatterplot/transforms.test.ts +97 -0
- package/src/widgets-v2/scatterplot/transforms.ts +38 -0
- package/src/widgets-v2/scatterplot/types.ts +55 -0
- package/src/widgets-v2/selection-summary/labels.ts +11 -0
- package/src/widgets-v2/selection-summary/selection-summary.test.tsx +53 -0
- package/src/widgets-v2/selection-summary/selection-summary.tsx +62 -0
- package/src/widgets-v2/selection-summary/style.ts +23 -0
- package/src/widgets-v2/spread/download.test.ts +64 -0
- package/src/widgets-v2/spread/download.ts +59 -0
- package/src/widgets-v2/spread/index.ts +6 -0
- package/src/widgets-v2/spread/separator.tsx +11 -0
- package/src/widgets-v2/spread/skeleton.test.tsx +17 -0
- package/src/widgets-v2/spread/skeleton.tsx +38 -0
- package/src/widgets-v2/spread/spread-ui.test.tsx +108 -0
- package/src/widgets-v2/spread/spread-ui.tsx +52 -0
- package/src/widgets-v2/spread/spread.test.tsx +50 -0
- package/src/widgets-v2/spread/spread.tsx +31 -0
- package/src/widgets-v2/spread/types.ts +27 -0
- package/src/widgets-v2/state/labels.test.ts +33 -0
- package/src/widgets-v2/state/labels.ts +20 -0
- package/src/widgets-v2/state/style.ts +25 -0
- package/src/widgets-v2/state/widget-state.test.tsx +294 -0
- package/src/widgets-v2/state/widget-state.tsx +184 -0
- package/src/widgets-v2/stores/index.ts +49 -0
- package/src/widgets-v2/stores/pipeline-middleware.test.ts +187 -0
- package/src/widgets-v2/stores/pipeline-middleware.ts +91 -0
- package/src/widgets-v2/stores/transforms.test.ts +162 -0
- package/src/widgets-v2/stores/transforms.ts +70 -0
- package/src/widgets-v2/stores/types.ts +64 -0
- package/src/widgets-v2/stores/use-echart-instance.test.tsx +91 -0
- package/src/widgets-v2/stores/use-echart-instance.ts +29 -0
- package/src/widgets-v2/stores/use-transform-enabled.test.tsx +127 -0
- package/src/widgets-v2/stores/use-transform-enabled.ts +25 -0
- package/src/widgets-v2/stores/use-transform.test.tsx +262 -0
- package/src/widgets-v2/stores/use-transform.ts +158 -0
- package/src/widgets-v2/stores/widget-context.test.tsx +58 -0
- package/src/widgets-v2/stores/widget-context.ts +15 -0
- package/src/widgets-v2/stores/widget-store-registry.test.ts +292 -0
- package/src/widgets-v2/stores/widget-store-registry.ts +248 -0
- package/src/widgets-v2/subheader/style.ts +12 -0
- package/src/widgets-v2/subheader/subheader.test.tsx +30 -0
- package/src/widgets-v2/subheader/subheader.tsx +16 -0
- package/src/widgets-v2/table/download.test.ts +75 -0
- package/src/widgets-v2/table/download.ts +47 -0
- package/src/widgets-v2/table/helpers.test.ts +214 -0
- package/src/widgets-v2/table/helpers.ts +136 -0
- package/src/widgets-v2/table/index.ts +23 -0
- package/src/widgets-v2/table/labels.tsx +41 -0
- package/src/widgets-v2/table/skeleton.test.tsx +26 -0
- package/src/widgets-v2/table/skeleton.tsx +65 -0
- package/src/widgets-v2/table/style.ts +46 -0
- package/src/widgets-v2/table/table-ui.test.tsx +200 -0
- package/src/widgets-v2/table/table-ui.tsx +331 -0
- package/src/widgets-v2/table/table.test.tsx +119 -0
- package/src/widgets-v2/table/table.tsx +174 -0
- package/src/widgets-v2/table/types.ts +44 -0
- package/src/widgets-v2/test-utils.ts +107 -0
- package/src/widgets-v2/timeseries/download.test.ts +95 -0
- package/src/widgets-v2/timeseries/download.ts +86 -0
- package/src/widgets-v2/timeseries/index.ts +10 -0
- package/src/widgets-v2/timeseries/options.test.ts +379 -0
- package/src/widgets-v2/timeseries/options.ts +341 -0
- package/src/widgets-v2/timeseries/skeleton.test.tsx +13 -0
- package/src/widgets-v2/timeseries/skeleton.tsx +76 -0
- package/src/widgets-v2/timeseries/types.ts +61 -0
- package/src/widgets-v2/toolbox/labels.ts +9 -0
- package/src/widgets-v2/toolbox/style.ts +33 -0
- package/src/widgets-v2/toolbox/toolbox.test.tsx +200 -0
- package/src/widgets-v2/toolbox/toolbox.tsx +309 -0
- package/src/widgets-v2/utils/data-zoom-layout.ts +26 -0
- package/src/widgets-v2/utils/index.ts +2 -0
- package/src/widgets-v2/utils/merge-options.test.ts +52 -0
- package/src/widgets-v2/utils/merge-options.ts +50 -0
- package/src/widgets-v2/wrapper/index.ts +14 -0
- package/src/widgets-v2/wrapper/labels.ts +11 -0
- package/src/widgets-v2/wrapper/style.ts +134 -0
- package/src/widgets-v2/wrapper/widget-actions.test.tsx +52 -0
- package/src/widgets-v2/wrapper/widget-actions.tsx +43 -0
- package/src/widgets-v2/wrapper/widget-content.test.tsx +27 -0
- package/src/widgets-v2/wrapper/widget-content.tsx +29 -0
- package/src/widgets-v2/wrapper/widget-wrapper.test.tsx +159 -0
- package/src/widgets-v2/wrapper/widget-wrapper.tsx +178 -0
- package/dist/styles-BYTyKQFP.js.map +0 -1
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import type { SxProps, Theme } from '@mui/material'
|
|
2
|
+
|
|
3
|
+
export const styles = {
|
|
4
|
+
root: {
|
|
5
|
+
position: 'relative',
|
|
6
|
+
width: '100%',
|
|
7
|
+
minWidth: 0,
|
|
8
|
+
bgcolor: 'background.paper',
|
|
9
|
+
border: '1px solid',
|
|
10
|
+
borderColor: 'divider',
|
|
11
|
+
borderRadius: 1,
|
|
12
|
+
overflow: 'hidden',
|
|
13
|
+
// MUI Accordion ships its own collapsed-state divider rules; clear them
|
|
14
|
+
// so they don't fight our card border.
|
|
15
|
+
'&::before': { display: 'none' },
|
|
16
|
+
|
|
17
|
+
// Hover-fade actions (v1 parity). Direct children of
|
|
18
|
+
// `.widget-wrapper-actions` are dimmed by default on fine-pointer devices
|
|
19
|
+
// and fade in on hover; an action carrying the `.active` class stays
|
|
20
|
+
// full-opacity even outside hover. Coarse-pointer devices show actions
|
|
21
|
+
// always.
|
|
22
|
+
//
|
|
23
|
+
// The class must sit on the action element itself
|
|
24
|
+
// (`<IconButton className='active'>`). v2 does NOT wrap each action in
|
|
25
|
+
// an extra container the way v1 does, so the `> *` selector lands on the
|
|
26
|
+
// action button directly — `&:has(.active)` would only match if the
|
|
27
|
+
// class were on a descendant, which is never the case here.
|
|
28
|
+
'& .widget-wrapper-actions > *': {
|
|
29
|
+
opacity: 1,
|
|
30
|
+
transition: ({ transitions }: Theme) =>
|
|
31
|
+
transitions.create('opacity', {
|
|
32
|
+
duration: transitions.duration.standard,
|
|
33
|
+
easing: transitions.easing.easeInOut,
|
|
34
|
+
}),
|
|
35
|
+
'@media (hover: hover)': {
|
|
36
|
+
opacity: 0,
|
|
37
|
+
},
|
|
38
|
+
'&.active': {
|
|
39
|
+
opacity: 1,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
'&:hover .widget-wrapper-actions > *': {
|
|
43
|
+
opacity: 1,
|
|
44
|
+
},
|
|
45
|
+
'&[data-collapsed="true"] .widget-wrapper-actions > *': {
|
|
46
|
+
opacity: 0,
|
|
47
|
+
pointerEvents: 'none',
|
|
48
|
+
'&.active': {
|
|
49
|
+
opacity: 1,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
// Disabled state — only block interaction; keep visuals unchanged.
|
|
54
|
+
// MUI's default `.Mui-disabled` rules dim the AccordionSummary's color
|
|
55
|
+
// and add a faded background; we override them so the wrapper looks
|
|
56
|
+
// identical to its enabled form. The single behavioral change is
|
|
57
|
+
// `pointer-events: none`, which propagates to every descendant.
|
|
58
|
+
'&.Mui-disabled': {
|
|
59
|
+
pointerEvents: 'none',
|
|
60
|
+
bgcolor: 'background.paper',
|
|
61
|
+
'& .MuiAccordionSummary-root.Mui-disabled': {
|
|
62
|
+
opacity: 1,
|
|
63
|
+
color: 'inherit',
|
|
64
|
+
backgroundColor: 'transparent',
|
|
65
|
+
},
|
|
66
|
+
'& .MuiAccordionSummary-expandIconWrapper': {
|
|
67
|
+
display: 'none',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
loading: {
|
|
72
|
+
position: 'absolute',
|
|
73
|
+
top: 0,
|
|
74
|
+
left: 0,
|
|
75
|
+
width: '100%',
|
|
76
|
+
height: ({ spacing }: Theme) => spacing(0.35),
|
|
77
|
+
zIndex: 1,
|
|
78
|
+
},
|
|
79
|
+
summary: {
|
|
80
|
+
minHeight: ({ spacing }: Theme) => spacing(7),
|
|
81
|
+
'& .MuiAccordionSummary-content': {
|
|
82
|
+
gap: ({ spacing }: Theme) => spacing(0.5),
|
|
83
|
+
paddingInlineEnd: ({ spacing }: Theme) => spacing(0.75),
|
|
84
|
+
alignItems: 'center',
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
titleCell: {
|
|
88
|
+
flexGrow: 1,
|
|
89
|
+
flexShrink: 1,
|
|
90
|
+
minWidth: 0,
|
|
91
|
+
display: 'flex',
|
|
92
|
+
alignItems: 'center',
|
|
93
|
+
minHeight: ({ spacing }: Theme) => spacing(3),
|
|
94
|
+
},
|
|
95
|
+
titleText: {
|
|
96
|
+
minWidth: 0,
|
|
97
|
+
wordBreak: 'break-word',
|
|
98
|
+
overflow: 'hidden',
|
|
99
|
+
display: '-webkit-box',
|
|
100
|
+
WebkitLineClamp: 2,
|
|
101
|
+
WebkitBoxOrient: 'vertical',
|
|
102
|
+
},
|
|
103
|
+
actions: {
|
|
104
|
+
display: 'flex',
|
|
105
|
+
alignItems: 'center',
|
|
106
|
+
gap: 0.5,
|
|
107
|
+
justifyContent: 'flex-end',
|
|
108
|
+
flexShrink: 0,
|
|
109
|
+
'& > *': {
|
|
110
|
+
pointerEvents: 'auto',
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
options: {
|
|
114
|
+
display: 'flex',
|
|
115
|
+
alignItems: 'center',
|
|
116
|
+
gap: 0.5,
|
|
117
|
+
flexShrink: 0,
|
|
118
|
+
},
|
|
119
|
+
detail: {
|
|
120
|
+
display: 'flex',
|
|
121
|
+
flexDirection: 'column',
|
|
122
|
+
gap: ({ spacing }: Theme) => spacing(1),
|
|
123
|
+
paddingTop: ({ spacing }: Theme) => spacing(0.5),
|
|
124
|
+
},
|
|
125
|
+
content: {
|
|
126
|
+
minWidth: 0,
|
|
127
|
+
display: 'flex',
|
|
128
|
+
flexDirection: 'column',
|
|
129
|
+
gap: 1,
|
|
130
|
+
},
|
|
131
|
+
footer: {
|
|
132
|
+
pt: 1,
|
|
133
|
+
},
|
|
134
|
+
} satisfies Record<string, SxProps<Theme>>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from 'vitest'
|
|
2
|
+
import { fireEvent, render } from '@testing-library/react'
|
|
3
|
+
import { Actions, Options } from './widget-actions'
|
|
4
|
+
|
|
5
|
+
describe('<Actions>', () => {
|
|
6
|
+
it('renders children and applies the widget-wrapper-actions class', () => {
|
|
7
|
+
const { container, getByText } = render(
|
|
8
|
+
<Actions>
|
|
9
|
+
<button>act</button>
|
|
10
|
+
</Actions>,
|
|
11
|
+
)
|
|
12
|
+
expect(getByText('act')).toBeTruthy()
|
|
13
|
+
expect(container.querySelector('.widget-wrapper-actions')).not.toBeNull()
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
it('stops click propagation', () => {
|
|
17
|
+
const onWrapperClick = vi.fn()
|
|
18
|
+
const { getByText } = render(
|
|
19
|
+
<button type='button' onClick={onWrapperClick}>
|
|
20
|
+
<Actions>
|
|
21
|
+
<span>btn</span>
|
|
22
|
+
</Actions>
|
|
23
|
+
</button>,
|
|
24
|
+
)
|
|
25
|
+
fireEvent.click(getByText('btn'))
|
|
26
|
+
expect(onWrapperClick).not.toHaveBeenCalled()
|
|
27
|
+
})
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
describe('<Options>', () => {
|
|
31
|
+
it('renders children', () => {
|
|
32
|
+
const { getByText } = render(
|
|
33
|
+
<Options>
|
|
34
|
+
<span>opt</span>
|
|
35
|
+
</Options>,
|
|
36
|
+
)
|
|
37
|
+
expect(getByText('opt')).toBeTruthy()
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it('stops click propagation', () => {
|
|
41
|
+
const onWrapperClick = vi.fn()
|
|
42
|
+
const { getByText } = render(
|
|
43
|
+
<button type='button' onClick={onWrapperClick}>
|
|
44
|
+
<Options>
|
|
45
|
+
<span>opt</span>
|
|
46
|
+
</Options>
|
|
47
|
+
</button>,
|
|
48
|
+
)
|
|
49
|
+
fireEvent.click(getByText('opt'))
|
|
50
|
+
expect(onWrapperClick).not.toHaveBeenCalled()
|
|
51
|
+
})
|
|
52
|
+
})
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Box, type SxProps, type Theme } from '@mui/material'
|
|
2
|
+
import type { ReactNode } from 'react'
|
|
3
|
+
import { styles } from './style'
|
|
4
|
+
|
|
5
|
+
export interface ActionsProps {
|
|
6
|
+
sx?: SxProps<Theme>
|
|
7
|
+
children: ReactNode
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Slot for the wrapper header's right-side action buttons. The
|
|
12
|
+
* `widget-wrapper-actions` className activates the hover-fade CSS rule on
|
|
13
|
+
* `<Wrapper>`: action children fade in on hover (always visible on coarse-
|
|
14
|
+
* pointer devices), and stay full-opacity when a descendant is marked with
|
|
15
|
+
* `.active` — typically applied by toggled actions.
|
|
16
|
+
*
|
|
17
|
+
* The container also stops click propagation so interacting with an action
|
|
18
|
+
* doesn't toggle the wrapper's collapse.
|
|
19
|
+
*/
|
|
20
|
+
export function Actions({ sx, children }: ActionsProps) {
|
|
21
|
+
return (
|
|
22
|
+
<Box
|
|
23
|
+
className='widget-wrapper-actions'
|
|
24
|
+
onClick={(e) => e.stopPropagation()}
|
|
25
|
+
sx={{ ...styles.actions, ...sx }}
|
|
26
|
+
>
|
|
27
|
+
{children}
|
|
28
|
+
</Box>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface OptionsProps {
|
|
33
|
+
sx?: SxProps<Theme>
|
|
34
|
+
children: ReactNode
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function Options({ sx, children }: OptionsProps) {
|
|
38
|
+
return (
|
|
39
|
+
<Box onClick={(e) => e.stopPropagation()} sx={{ ...styles.options, ...sx }}>
|
|
40
|
+
{children}
|
|
41
|
+
</Box>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
import { render } from '@testing-library/react'
|
|
3
|
+
import { Content, Footer } from './widget-content'
|
|
4
|
+
|
|
5
|
+
describe('<Content>', () => {
|
|
6
|
+
it('renders children inside a data-slot=content box', () => {
|
|
7
|
+
const { getByText, container } = render(
|
|
8
|
+
<Content>
|
|
9
|
+
<span>body</span>
|
|
10
|
+
</Content>,
|
|
11
|
+
)
|
|
12
|
+
expect(getByText('body')).toBeTruthy()
|
|
13
|
+
expect(container.querySelector('[data-slot="content"]')).not.toBeNull()
|
|
14
|
+
})
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
describe('<Footer>', () => {
|
|
18
|
+
it('renders children inside a data-slot=footer box', () => {
|
|
19
|
+
const { getByText, container } = render(
|
|
20
|
+
<Footer>
|
|
21
|
+
<span>foot</span>
|
|
22
|
+
</Footer>,
|
|
23
|
+
)
|
|
24
|
+
expect(getByText('foot')).toBeTruthy()
|
|
25
|
+
expect(container.querySelector('[data-slot="footer"]')).not.toBeNull()
|
|
26
|
+
})
|
|
27
|
+
})
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Box, type SxProps, type Theme } from '@mui/material'
|
|
2
|
+
import type { ReactNode } from 'react'
|
|
3
|
+
import { styles } from './style'
|
|
4
|
+
|
|
5
|
+
export interface ContentProps {
|
|
6
|
+
sx?: SxProps<Theme>
|
|
7
|
+
children: ReactNode
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function Content({ sx, children }: ContentProps) {
|
|
11
|
+
return (
|
|
12
|
+
<Box data-slot='content' sx={{ ...styles.content, ...sx }}>
|
|
13
|
+
{children}
|
|
14
|
+
</Box>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface FooterProps {
|
|
19
|
+
sx?: SxProps<Theme>
|
|
20
|
+
children: ReactNode
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function Footer({ sx, children }: FooterProps) {
|
|
24
|
+
return (
|
|
25
|
+
<Box data-slot='footer' sx={{ ...styles.footer, ...sx }}>
|
|
26
|
+
{children}
|
|
27
|
+
</Box>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
|
2
|
+
import { fireEvent, render, screen } from '@testing-library/react'
|
|
3
|
+
import { Provider } from '../provider/widget-provider'
|
|
4
|
+
import { clearAllWidgetStores } from '../stores'
|
|
5
|
+
import { Wrapper } from './widget-wrapper'
|
|
6
|
+
import { Actions } from './widget-actions'
|
|
7
|
+
import { Content } from './widget-content'
|
|
8
|
+
|
|
9
|
+
beforeEach(() => clearAllWidgetStores())
|
|
10
|
+
afterEach(() => clearAllWidgetStores())
|
|
11
|
+
|
|
12
|
+
function withProvider(id: string, ui: React.ReactNode, isFetching = false) {
|
|
13
|
+
return (
|
|
14
|
+
<Provider id={id} data={[]} isFetching={isFetching}>
|
|
15
|
+
{ui}
|
|
16
|
+
</Provider>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
describe('<Wrapper>', () => {
|
|
21
|
+
it('renders the title', () => {
|
|
22
|
+
render(
|
|
23
|
+
withProvider(
|
|
24
|
+
'wrap-1',
|
|
25
|
+
<Wrapper title='Sales'>
|
|
26
|
+
<Content>body</Content>
|
|
27
|
+
</Wrapper>,
|
|
28
|
+
),
|
|
29
|
+
)
|
|
30
|
+
expect(screen.getByText('Sales')).toBeTruthy()
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
it('renders Content children when expanded', () => {
|
|
34
|
+
render(
|
|
35
|
+
withProvider(
|
|
36
|
+
'wrap-2',
|
|
37
|
+
<Wrapper title='t'>
|
|
38
|
+
<Content>
|
|
39
|
+
<div data-testid='body'>body</div>
|
|
40
|
+
</Content>
|
|
41
|
+
</Wrapper>,
|
|
42
|
+
),
|
|
43
|
+
)
|
|
44
|
+
expect(screen.getByTestId('body')).toBeTruthy()
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
it('keeps Content mounted but visually hidden when collapsed', () => {
|
|
48
|
+
// Accordion uses MUI <Collapse>, which animates the parent via height/visibility.
|
|
49
|
+
// Children stay mounted (the Collapse keeps `keepMounted` semantics by default).
|
|
50
|
+
render(
|
|
51
|
+
withProvider(
|
|
52
|
+
'wrap-3',
|
|
53
|
+
<Wrapper title='t' defaultCollapsed>
|
|
54
|
+
<Content>
|
|
55
|
+
<div data-testid='body'>body</div>
|
|
56
|
+
</Content>
|
|
57
|
+
</Wrapper>,
|
|
58
|
+
),
|
|
59
|
+
)
|
|
60
|
+
expect(screen.getByTestId('body')).toBeTruthy()
|
|
61
|
+
// Find the AccordionDetails ancestor and confirm aria-hidden / inert reflects collapsed.
|
|
62
|
+
const root = screen.getByText('t').closest('.MuiAccordion-root')
|
|
63
|
+
expect(root?.getAttribute('data-collapsed')).toBe('true')
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
it('toggles via the chevron icon button — header summary owns the click', () => {
|
|
67
|
+
render(
|
|
68
|
+
withProvider(
|
|
69
|
+
'wrap-4',
|
|
70
|
+
<Wrapper title='t'>
|
|
71
|
+
<Content>body</Content>
|
|
72
|
+
</Wrapper>,
|
|
73
|
+
),
|
|
74
|
+
)
|
|
75
|
+
const summary = screen.getByRole('button', { name: 'Collapse' })
|
|
76
|
+
expect(summary.getAttribute('aria-expanded')).toBe('true')
|
|
77
|
+
fireEvent.click(summary)
|
|
78
|
+
expect(
|
|
79
|
+
screen
|
|
80
|
+
.getByRole('button', { name: 'Expand' })
|
|
81
|
+
.getAttribute('aria-expanded'),
|
|
82
|
+
).toBe('false')
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
it('honors custom collapse/expand labels on the summary', () => {
|
|
86
|
+
render(
|
|
87
|
+
withProvider(
|
|
88
|
+
'wrap-5',
|
|
89
|
+
<Wrapper title='t' labels={{ collapse: 'Hide', expand: 'Show' }}>
|
|
90
|
+
<Content>body</Content>
|
|
91
|
+
</Wrapper>,
|
|
92
|
+
),
|
|
93
|
+
)
|
|
94
|
+
expect(screen.getByRole('button', { name: 'Hide' })).toBeTruthy()
|
|
95
|
+
fireEvent.click(screen.getByRole('button', { name: 'Hide' }))
|
|
96
|
+
expect(screen.getByRole('button', { name: 'Show' })).toBeTruthy()
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
it('renders <Actions> children inside the summary row, not the details panel', () => {
|
|
100
|
+
render(
|
|
101
|
+
withProvider(
|
|
102
|
+
'wrap-6',
|
|
103
|
+
<Wrapper title='t'>
|
|
104
|
+
<Actions>
|
|
105
|
+
<button data-testid='action-btn'>A</button>
|
|
106
|
+
</Actions>
|
|
107
|
+
<Content>
|
|
108
|
+
<div data-testid='body-content'>body</div>
|
|
109
|
+
</Content>
|
|
110
|
+
</Wrapper>,
|
|
111
|
+
),
|
|
112
|
+
)
|
|
113
|
+
const actionBtn = screen.getByTestId('action-btn')
|
|
114
|
+
const bodyContent = screen.getByTestId('body-content')
|
|
115
|
+
// The action lives inside the AccordionSummary, the body inside AccordionDetails.
|
|
116
|
+
expect(actionBtn.closest('.MuiAccordionSummary-root')).not.toBeNull()
|
|
117
|
+
expect(bodyContent.closest('.MuiAccordionDetails-root')).not.toBeNull()
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
it('shows a LinearProgress at the top when the store reports isFetching', () => {
|
|
121
|
+
render(
|
|
122
|
+
withProvider(
|
|
123
|
+
'wrap-7',
|
|
124
|
+
<Wrapper title='t'>
|
|
125
|
+
<Content>body</Content>
|
|
126
|
+
</Wrapper>,
|
|
127
|
+
true,
|
|
128
|
+
),
|
|
129
|
+
)
|
|
130
|
+
expect(screen.getByRole('progressbar')).toBeTruthy()
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
it('hides the LinearProgress when isFetching is false', () => {
|
|
134
|
+
render(
|
|
135
|
+
withProvider(
|
|
136
|
+
'wrap-8',
|
|
137
|
+
<Wrapper title='t'>
|
|
138
|
+
<Content>body</Content>
|
|
139
|
+
</Wrapper>,
|
|
140
|
+
false,
|
|
141
|
+
),
|
|
142
|
+
)
|
|
143
|
+
expect(screen.queryByRole('progressbar')).toBeNull()
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
it('applies disabled styling without removing children', () => {
|
|
147
|
+
render(
|
|
148
|
+
withProvider(
|
|
149
|
+
'wrap-9',
|
|
150
|
+
<Wrapper title='t' disabled>
|
|
151
|
+
<Content>
|
|
152
|
+
<div data-testid='body'>body</div>
|
|
153
|
+
</Content>
|
|
154
|
+
</Wrapper>,
|
|
155
|
+
),
|
|
156
|
+
)
|
|
157
|
+
expect(screen.getByTestId('body')).toBeTruthy()
|
|
158
|
+
})
|
|
159
|
+
})
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Children,
|
|
3
|
+
isValidElement,
|
|
4
|
+
useCallback,
|
|
5
|
+
useState,
|
|
6
|
+
type ComponentType,
|
|
7
|
+
type ReactElement,
|
|
8
|
+
type ReactNode,
|
|
9
|
+
} from 'react'
|
|
10
|
+
import {
|
|
11
|
+
Accordion,
|
|
12
|
+
AccordionDetails,
|
|
13
|
+
AccordionSummary,
|
|
14
|
+
Box,
|
|
15
|
+
LinearProgress,
|
|
16
|
+
Typography,
|
|
17
|
+
type SvgIconProps,
|
|
18
|
+
type SxProps,
|
|
19
|
+
type Theme,
|
|
20
|
+
} from '@mui/material'
|
|
21
|
+
import ExpandMoreIcon from '@mui/icons-material/ExpandMore'
|
|
22
|
+
import { SmartTooltip } from '../../components/smart-tooltip/smart-tooltip'
|
|
23
|
+
import { useWidget, useWidgetId } from '../stores'
|
|
24
|
+
import { Actions, Options } from './widget-actions'
|
|
25
|
+
import { styles } from './style'
|
|
26
|
+
import { DEFAULT_WRAPPER_LABELS, type WrapperLabels } from './labels'
|
|
27
|
+
|
|
28
|
+
export interface WrapperProps {
|
|
29
|
+
title: string
|
|
30
|
+
/**
|
|
31
|
+
* Controlled collapsed state. When supplied, the wrapper is fully
|
|
32
|
+
* controlled — the consumer is responsible for updating it via
|
|
33
|
+
* `onCollapseChange`. Leave undefined to use the uncontrolled mode,
|
|
34
|
+
* which seeds internal state from `defaultCollapsed`.
|
|
35
|
+
*/
|
|
36
|
+
collapsed?: boolean
|
|
37
|
+
/**
|
|
38
|
+
* Fires whenever the user interacts to toggle the wrapper, with the
|
|
39
|
+
* NEXT collapsed value. Called for both controlled and uncontrolled
|
|
40
|
+
* usage — consumers can subscribe to user-driven toggles even when
|
|
41
|
+
* letting the wrapper manage its own state.
|
|
42
|
+
*/
|
|
43
|
+
onCollapseChange?: (collapsed: boolean) => void
|
|
44
|
+
/**
|
|
45
|
+
* Initial collapsed state when the wrapper is uncontrolled (i.e.
|
|
46
|
+
* `collapsed` is undefined). Ignored when `collapsed` is supplied.
|
|
47
|
+
*/
|
|
48
|
+
defaultCollapsed?: boolean
|
|
49
|
+
disabled?: boolean
|
|
50
|
+
labels?: Partial<WrapperLabels>
|
|
51
|
+
/**
|
|
52
|
+
* Icon shown at the right edge of the summary row. Accordion rotates it
|
|
53
|
+
* 180° automatically when the wrapper expands. Default: `ExpandMoreIcon`.
|
|
54
|
+
*/
|
|
55
|
+
expandIcon?: ComponentType<SvgIconProps>
|
|
56
|
+
iconProps?: SvgIconProps
|
|
57
|
+
sx?: SxProps<Theme>
|
|
58
|
+
children: ReactNode
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Widget shell — title + collapsible body, built on MUI `<Accordion>` for
|
|
63
|
+
* native click-to-toggle on the summary header and a smooth open/close
|
|
64
|
+
* transition. UX matches v1 `<WrapperUI>`:
|
|
65
|
+
*
|
|
66
|
+
* • hover-fade action buttons (always visible on coarse-pointer devices)
|
|
67
|
+
* • multi-line title clamp (`WebkitLineClamp: 2`, word-break) + SmartTooltip
|
|
68
|
+
* when the text overflows
|
|
69
|
+
* • top-edge `<LinearProgress>` driven by the widget store's `isFetching`
|
|
70
|
+
* • chevron at the right end (rotated by Accordion based on expanded state)
|
|
71
|
+
*
|
|
72
|
+
* Children are partitioned by component identity: `<Actions>` and `<Options>`
|
|
73
|
+
* render inside the summary row; everything else (`<Content>`, `<Footer>`,
|
|
74
|
+
* loose nodes) renders inside the details panel.
|
|
75
|
+
*/
|
|
76
|
+
export function Wrapper({
|
|
77
|
+
title,
|
|
78
|
+
collapsed,
|
|
79
|
+
onCollapseChange,
|
|
80
|
+
defaultCollapsed = false,
|
|
81
|
+
disabled = false,
|
|
82
|
+
labels,
|
|
83
|
+
expandIcon: ExpandIcon = ExpandMoreIcon,
|
|
84
|
+
iconProps,
|
|
85
|
+
sx,
|
|
86
|
+
children,
|
|
87
|
+
}: WrapperProps) {
|
|
88
|
+
const id = useWidgetId()
|
|
89
|
+
const isFetching = useWidget(id, (s) => s.isFetching)
|
|
90
|
+
// Controlled vs uncontrolled: when the consumer passes `collapsed`, they
|
|
91
|
+
// own the state; otherwise we keep an internal copy seeded from
|
|
92
|
+
// `defaultCollapsed`. `internalCollapsed` is still tracked in controlled
|
|
93
|
+
// mode so a consumer can drop the controlled prop later without losing
|
|
94
|
+
// the last-known position.
|
|
95
|
+
const isControlled = collapsed !== undefined
|
|
96
|
+
const [internalCollapsed, setInternalCollapsed] = useState(defaultCollapsed)
|
|
97
|
+
const effectiveCollapsed = isControlled ? collapsed : internalCollapsed
|
|
98
|
+
const handleAccordionToggle = useCallback(
|
|
99
|
+
(_: unknown, expanded: boolean) => {
|
|
100
|
+
const next = !expanded
|
|
101
|
+
onCollapseChange?.(next)
|
|
102
|
+
setInternalCollapsed(next)
|
|
103
|
+
},
|
|
104
|
+
[onCollapseChange],
|
|
105
|
+
)
|
|
106
|
+
const _labels = { ...DEFAULT_WRAPPER_LABELS, ...labels }
|
|
107
|
+
|
|
108
|
+
const { summary: summarySlots, details: detailsSlots } =
|
|
109
|
+
partitionChildren(children)
|
|
110
|
+
|
|
111
|
+
const ariaLabel = effectiveCollapsed ? _labels.expand : _labels.collapse
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<Accordion
|
|
115
|
+
data-collapsed={effectiveCollapsed ? 'true' : undefined}
|
|
116
|
+
expanded={!effectiveCollapsed}
|
|
117
|
+
onChange={handleAccordionToggle}
|
|
118
|
+
disabled={disabled}
|
|
119
|
+
disableGutters
|
|
120
|
+
elevation={0}
|
|
121
|
+
square
|
|
122
|
+
sx={{ ...styles.root, ...sx }}
|
|
123
|
+
>
|
|
124
|
+
{isFetching ? (
|
|
125
|
+
<LinearProgress sx={styles.loading} color='primary' />
|
|
126
|
+
) : null}
|
|
127
|
+
|
|
128
|
+
<AccordionSummary
|
|
129
|
+
expandIcon={<ExpandIcon fontSize='small' {...iconProps} />}
|
|
130
|
+
aria-label={ariaLabel}
|
|
131
|
+
sx={styles.summary}
|
|
132
|
+
>
|
|
133
|
+
<SmartTooltip title={title}>
|
|
134
|
+
{({ ref }) => (
|
|
135
|
+
<Box sx={styles.titleCell}>
|
|
136
|
+
<Typography
|
|
137
|
+
ref={ref}
|
|
138
|
+
variant='subtitle1'
|
|
139
|
+
sx={styles.titleText}
|
|
140
|
+
textTransform='none'
|
|
141
|
+
>
|
|
142
|
+
{title}
|
|
143
|
+
</Typography>
|
|
144
|
+
</Box>
|
|
145
|
+
)}
|
|
146
|
+
</SmartTooltip>
|
|
147
|
+
{summarySlots}
|
|
148
|
+
</AccordionSummary>
|
|
149
|
+
<AccordionDetails sx={styles.detail}>{detailsSlots}</AccordionDetails>
|
|
150
|
+
</Accordion>
|
|
151
|
+
)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Splits children by component identity: `<Actions>` and `<Options>` belong
|
|
156
|
+
* in the summary row, everything else in the details panel. Identity
|
|
157
|
+
* comparison works because both slot components are imported from the same
|
|
158
|
+
* module that consumers use.
|
|
159
|
+
*/
|
|
160
|
+
function partitionChildren(children: ReactNode): {
|
|
161
|
+
summary: ReactNode[]
|
|
162
|
+
details: ReactNode[]
|
|
163
|
+
} {
|
|
164
|
+
const summary: ReactNode[] = []
|
|
165
|
+
const details: ReactNode[] = []
|
|
166
|
+
for (const child of Children.toArray(children)) {
|
|
167
|
+
if (isSlot(child, Actions) || isSlot(child, Options)) {
|
|
168
|
+
summary.push(child)
|
|
169
|
+
} else {
|
|
170
|
+
details.push(child)
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return { summary, details }
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function isSlot(node: ReactNode, type: unknown): node is ReactElement {
|
|
177
|
+
return isValidElement(node) && node.type === type
|
|
178
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"styles-BYTyKQFP.js","sources":["../src/widgets/utils/chart-config/option-builders.ts","../src/widgets/utils/skeleton/styles.ts"],"sourcesContent":["import type { Theme } from '@mui/material'\nimport type { LegendComponentOption } from 'echarts'\nimport type {\n CallbackDataParams,\n TopLevelFormatterParams,\n} from 'echarts/types/dist/shared'\n\n/**\n * Shared EChart configuration builders for chart widgets\n */\n\n/**\n * Rounds a value up to the nearest \"nice\" number.\n * A nice number is a multiple of 10^floor(log10(value)).\n *\n * Examples: 547 → 600, 200 → 200, 1200 → 2000, 18 → 20, 5 → 5, -547 → -500\n */\nexport function niceNum(value: number): number {\n if (value === 0) return 0\n const absValue = Math.abs(value)\n const base = Math.pow(10, Math.floor(Math.log10(absValue)))\n const rounded = Math.ceil(absValue / base) * base\n return value < 0 ? -rounded : rounded\n}\n\n/**\n * Builds standard legend configuration for chart widgets\n *\n * @param params - Legend configuration parameters\n * @param params.hasLegend - Whether to show the legend\n * @param params.labelFormatter - Optional formatter for legend item names\n * @returns Legend configuration object\n */\nexport function buildLegendConfig({\n hasLegend,\n labelFormatter,\n}: {\n hasLegend: boolean\n labelFormatter?: (value: string | number) => string | number\n}): LegendComponentOption {\n return {\n show: hasLegend,\n icon: 'circle' as const,\n left: 0,\n bottom: 0,\n orient: 'horizontal',\n type: 'scroll',\n ...(labelFormatter && {\n formatter: (name: string) => String(labelFormatter(name)),\n }),\n }\n}\n\n/**\n * Builds standard grid configuration with legend-aware spacing\n *\n * @param hasLegend - Whether the chart has a legend\n * @param theme - MUI theme for spacing\n * @param additionalConfig - Additional grid configuration to merge\n * @returns Grid configuration object\n */\nexport function buildGridConfig(hasLegend: boolean, theme: Theme) {\n return {\n ...(!hasLegend && { bottom: parseInt(theme.spacing(3)) }),\n ...(hasLegend && { bottom: parseInt(theme.spacing(7)) }),\n }\n}\n\n/**\n * Creates a tooltip position calculator that handles overflow\n * Used by bar, histogram, and scatterplot widgets\n *\n * @param theme - MUI theme for spacing\n * @returns Tooltip position function\n */\nexport function createTooltipPositioner(theme: Theme) {\n return function (\n point: [number, number],\n _params: unknown,\n _dom: unknown,\n _rect: unknown,\n size: { contentSize: [number, number]; viewSize: [number, number] },\n ) {\n const position = { top: parseInt(theme.spacing(0.5)) } as Record<\n string,\n number\n >\n\n // Position tooltip left or right based on available space\n if (size.contentSize[0] < size.viewSize[0] - point[0]) {\n position.left = point[0]\n } else {\n position.right = size.viewSize[0] - point[0]\n }\n\n return position\n }\n}\n\n/**\n * Creates an axis label formatter for ECharts\n * Used to format numeric axis labels with a widget formatter\n *\n * @param formatter - Optional formatter function from widget config\n * @returns Axis label formatter function or undefined\n */\nexport function createAxisLabelFormatter(\n formatter?: (value: number) => string,\n) {\n if (!formatter) return undefined\n return (value: number) => formatter(value)\n}\n\n/**\n * Applies labelFormatter to xAxis configuration\n * Applies to any xAxis regardless of axis type (category, value, etc.)\n *\n * @param xAxis - Existing xAxis configuration\n * @param labelFormatter - Optional labelFormatter function from widget config\n * @returns Updated xAxis configuration\n */\nexport function applyXAxisFormatter(\n xAxis: unknown,\n formatter?: (value: string | number) => string | number,\n) {\n const xAxisIsObject = xAxis && !Array.isArray(xAxis)\n const xAxisTyped = xAxis as { type?: string; axisLabel?: unknown }\n\n const axisFormatter =\n formatter && xAxisIsObject\n ? (value: string | number) => String(formatter(value))\n : undefined\n\n return {\n ...xAxisTyped,\n axisLabel: {\n ...(typeof xAxisTyped.axisLabel === 'object' && xAxisTyped.axisLabel\n ? xAxisTyped.axisLabel\n : {}),\n formatter: axisFormatter,\n },\n }\n}\n\n/**\n * Applies formatter to yAxis configuration\n * Only applies to single axis objects (not arrays) with type 'value'\n *\n * @param yAxis - Existing yAxis configuration\n * @param formatter - Optional formatter function from widget config\n * @returns Updated yAxis configuration or undefined if no changes needed\n */\nexport function applyYAxisFormatter(\n yAxis: unknown,\n formatter?: (value: number) => string,\n) {\n let axisFormatter = createAxisLabelFormatter(formatter)\n\n const yAxisIsObject = yAxis && !Array.isArray(yAxis)\n const yAxisTyped = yAxis as { type?: string; axisLabel?: unknown }\n\n if (!yAxisIsObject || yAxisTyped.type !== 'value') {\n axisFormatter = undefined\n }\n\n return {\n ...yAxisTyped,\n axisLabel: {\n ...(typeof yAxisTyped.axisLabel === 'object' && yAxisTyped.axisLabel\n ? yAxisTyped.axisLabel\n : {}),\n formatter: axisFormatter,\n },\n }\n}\n\n/**\n * Creates a tooltip formatter for ECharts\n * Formats numeric values in tooltip using widget formatter\n * Handles both axis trigger (array) and item trigger (object) modes\n *\n * @param formatter - Optional formatter function from widget config\n * @returns Tooltip formatter function or undefined\n */\nexport function createTooltipFormatter(\n callback: (\n item: CallbackDataParams,\n items: CallbackDataParams[],\n ) => {\n name: string\n seriesName: string\n marker: string\n value: string | number\n },\n) {\n return (params: TopLevelFormatterParams) => {\n // Handle both array (axis trigger) and object (item trigger)\n const items = Array.isArray(params) ? params : [params]\n\n const tooltip = (name: string, callback: string) =>\n `<div style=\"margin: 0px 0 0;line-height:1;\">${name ? `<div style=\"font-size:11px;color:#FFFFFF;font-weight:400;line-height:1; margin-bottom: 10px\">${name}</div>` : ''}<div style=\"margin: 0;line-height:1;\">${callback}</div><div style=\"clear:both\"></div></div>`\n\n const values = items.map((item) => {\n const { name, seriesName, marker, value } = callback(item, items)\n return {\n name,\n seriesName,\n marker,\n value,\n }\n })\n\n const name = values[0]?.name ?? ''\n // Show margin if name exists or there are multiple items\n const showMargin = name || items.length > 1\n const marginStyle = showMargin\n ? 'margin: 10px 0 0;line-height:1;'\n : 'margin: 0;line-height:1;'\n\n const formattedValues = values.map(\n ({ seriesName, marker, value }) =>\n `<div style=\"${marginStyle}\"><div style=\"margin: 0px 0 0;line-height:1;\">${marker}${seriesName ? `<span style=\"font-size:11px;color:#FFFFFF;font-weight:400;margin-left:2px;margin-right:10px\">${seriesName}</span>` : ''}<span style=\"float:right;margin-left:10px;font-size:11px;color:#FFFFFF;font-weight:900\">${value}</span></div></div>`,\n )\n\n return tooltip(name, formattedValues.join(''))\n }\n}\n\n/**\n * Builds a series `label` config that applies formatter to the data value\n * extracted from a dataset row using ECharts encode/dimensionNames.\n *\n * Does not set `show` — labels remain hidden by default per ECharts defaults.\n *\n * @param formatter - Optional numeric value formatter\n * @param encodeKey - The encode dimension key to extract ('y' for vertical charts, 'x' for horizontal)\n */\nexport function buildSeriesLabelConfig(\n formatter?: (value: number) => string,\n encodeKey = 'y',\n): { label: { formatter: (params: CallbackDataParams) => string } } | object {\n if (!formatter) return {}\n\n return {\n label: {\n formatter: (params: CallbackDataParams) => {\n const encodeIndex = params.encode?.[encodeKey]?.[0]\n if (encodeIndex === undefined) return ''\n const dimName = params.dimensionNames?.[encodeIndex]\n const row = params.value as Record<string, string | number>\n const value = dimName ? row[dimName] : undefined\n return typeof value === 'number'\n ? formatter(value)\n : String(value ?? '')\n },\n },\n }\n}\n\n/**\n * Builds a series `label` config that applies formatter to a raw numeric value.\n * Used by histogram where series data is number[] (not datasets).\n *\n * Does not set `show` — labels remain hidden by default per ECharts defaults.\n *\n * @param formatter - Optional numeric value formatter\n */\nexport function buildHistogramSeriesLabelConfig(\n formatter?: (value: number) => string,\n): { label: { formatter: (params: CallbackDataParams) => string } } | object {\n if (!formatter) return {}\n\n return {\n label: {\n formatter: (params: CallbackDataParams) => {\n const value = params.value as number\n return typeof value === 'number'\n ? formatter(value)\n : String(value ?? '')\n },\n },\n }\n}\n","import type { Theme } from '@mui/material'\n\n/**\n * Base skeleton styles shared across all chart widgets\n */\nexport const baseSkeletonStyles = {\n graph: {\n /**\n * Common container style for chart widget skeletons\n */\n container: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n flexDirection: 'column',\n gap: ({ spacing }: Theme) => spacing(1),\n height: ({ spacing }: Theme) => spacing(38),\n },\n },\n} as const\n"],"names":["niceNum","value","absValue","Math","abs","base","pow","floor","log10","rounded","ceil","buildLegendConfig","hasLegend","labelFormatter","show","icon","left","bottom","orient","type","formatter","name","String","buildGridConfig","theme","parseInt","spacing","createTooltipPositioner","point","_params","_dom","_rect","size","position","top","contentSize","viewSize","right","createAxisLabelFormatter","applyXAxisFormatter","xAxis","xAxisIsObject","Array","isArray","xAxisTyped","axisFormatter","undefined","axisLabel","applyYAxisFormatter","yAxis","yAxisIsObject","yAxisTyped","createTooltipFormatter","callback","params","items","tooltip","values","map","item","seriesName","marker","marginStyle","length","formattedValues","join","buildSeriesLabelConfig","encodeKey","label","encodeIndex","encode","dimName","dimensionNames","row","buildHistogramSeriesLabelConfig","baseSkeletonStyles","graph","container","display","alignItems","justifyContent","flexDirection","gap","height"],"mappings":"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"}
|