Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for dash 3 #499

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
aa2b717
updates for dash 3 - persistence, loading, dashprivate_layout
AnnMarieW Jan 31, 2025
0bb88c1
change prop from required to optional so default can be set.
AnnMarieW Jan 31, 2025
9b6f087
fix default props
AnnMarieW Feb 1, 2025
a0895ac
updated stepper
AnnMarieW Feb 1, 2025
de71432
handle components like dcc.loading
AnnMarieW Feb 1, 2025
46cc48c
handle components like Checkbox and refactor dash3 utilities
AnnMarieW Feb 2, 2025
c4d80d9
updates for dash 3 - persistence, loading, dashprivate_layout
AnnMarieW Jan 31, 2025
0aae73d
change prop from required to optional so default can be set.
AnnMarieW Jan 31, 2025
56201ee
fix default props
AnnMarieW Feb 1, 2025
4ada77c
updated stepper
AnnMarieW Feb 1, 2025
6422feb
handle components like dcc.loading
AnnMarieW Feb 1, 2025
a5fce26
handle components like Checkbox and refactor dash3 utilities
AnnMarieW Feb 2, 2025
b54e17b
Merge remote-tracking branch 'origin/update-for-dash-3-0' into update…
AnnMarieW Feb 3, 2025
bbb2a15
fix getLoadingStateChildren after review
AnnMarieW Feb 4, 2025
aa986b4
update Hovercard to remove dashprivate
AnnMarieW Feb 4, 2025
ee3e9e7
update Menu to remove dashprivate
AnnMarieW Feb 4, 2025
29e7181
update Popover to remove dashprivate
AnnMarieW Feb 4, 2025
6901204
update Timeline to remove dashprivate
AnnMarieW Feb 4, 2025
1361186
update Stepper
AnnMarieW Feb 4, 2025
70aefe3
update Combobox components
AnnMarieW Feb 4, 2025
f5938b9
update react 18.3 check
AnnMarieW Feb 4, 2025
8af9abb
fix typo
AnnMarieW Feb 4, 2025
9503d92
update data-dash-is-loading
AnnMarieW Feb 5, 2025
9596c6a
update defaultProps and persistence
AnnMarieW Feb 5, 2025
fefd7cf
bump to require dash 3
AnnMarieW Feb 5, 2025
6298050
bump to require dash 3
AnnMarieW Feb 5, 2025
fea7ec5
revert requirements for dash 3 for dmc pre-release
AnnMarieW Feb 6, 2025
c17eef8
add changelog
AnnMarieW Feb 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Change Log

# 1.0.0rc1

### Pre-release Highlights
- This release ensures dash-mantine-components V1 is compatible with both Dash 2 and Dash 3
- If you were using `dmc >= 0.15.0`, there are no known breaking change.
- If you were using `dmc < 0.15.0`, please follow our [migration guide]().
- ⚠️ **Important:** Apps using `dmc < 1.0.0` must pin `dash < 3` to avoid compatibility issues.

### Changed
- Updated to handle changes in Dash 3 #499 by @AnnMarieW:
- Removed `defaultProps` to be compatible with React 18.3
- Handled the removal of the `loading_state` prop
- Updated to use the new `dash_component_api`

# 0.15.3

### Added
Expand Down
2 changes: 1 addition & 1 deletion requires-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dash[ci,dev,testing]>=2.0
dash[ci,dev,testing]>=2
pyyaml>=5.0
pytest<8.1.0
wheel
Expand Down
22 changes: 15 additions & 7 deletions src/ts/components/charts/AreaChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { DashBaseProps } from "props/dash";
import { StylesApiProps } from "props/styles";
import React, { useState, useRef } from "react";
import { getClickData, isEventValid } from "../../utils/charts";
import { getLoadingState } from "../../utils/dash3";

interface Props
extends BoxProps,
Expand Down Expand Up @@ -64,8 +65,19 @@ interface Props
}

/** AreaChart */
const AreaChart = (props: Props) => {
const { setProps, loading_state, clickData, hoverData, clickSeriesName, hoverSeriesName, series, highlightHover, areaChartProps, activeDotProps, areaProps, ...others } = props;
const AreaChart = ({
setProps,
loading_state,
clickData,
hoverData,
clickSeriesName,
hoverSeriesName,
series,
highlightHover = false,
areaChartProps,
activeDotProps,
areaProps,
...others }: Props) => {

const [highlightedArea, setHighlightedArea] = useState(null);
const shouldHighlight = highlightHover && highlightedArea !== null;
Expand Down Expand Up @@ -153,7 +165,7 @@ const AreaChart = (props: Props) => {

return (
<MantineAreaChart
data-dash-is-loading={(loading_state && loading_state.is_loading) || undefined}
data-dash-is-loading={getLoadingState(loading_state) || undefined}
areaChartProps={newProps}
series={series}
activeDotProps={{
Expand All @@ -168,8 +180,4 @@ const AreaChart = (props: Props) => {
);
}

AreaChart.defaultProps = {
highlightHover: false,
};

export default AreaChart;
27 changes: 15 additions & 12 deletions src/ts/components/charts/BarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { DashBaseProps } from "props/dash";
import { StylesApiProps } from "props/styles";
import React, { useState, useRef } from "react";
import { getClickData, isEventValid } from "../../utils/charts";
import { getLoadingState } from "../../utils/dash3";

interface Props
extends BoxProps,
Expand Down Expand Up @@ -53,11 +54,20 @@ interface Props
barLabelColor?: MantineColor;
}


/** BarChart */
const BarChart = (props: Props) => {
const {
setProps, loading_state, clickData, hoverData, barChartProps, clickSeriesName, hoverSeriesName, barProps,
highlightHover, ...others } = props;
const BarChart = ({
setProps,
loading_state,
clickData,
hoverData,
barChartProps,
clickSeriesName,
hoverSeriesName,
barProps,
highlightHover = false,
...others
}: Props) => {

const [highlightedArea, setHighlightedArea] = useState(null);
const shouldHighlight = highlightHover && highlightedArea !== null;
Expand Down Expand Up @@ -129,9 +139,7 @@ const BarChart = (props: Props) => {

return (
<MantineBarChart
data-dash-is-loading={
(loading_state && loading_state.is_loading) || undefined
}
data-dash-is-loading={getLoadingState(loading_state) || undefined}
barChartProps={newProps}
barProps={barPropsFunction}
{...others}
Expand All @@ -141,11 +149,6 @@ const BarChart = (props: Props) => {
};


BarChart.defaultProps = {
withBarValueLabel: false,
highlightHover: false,
};



export default BarChart;
7 changes: 2 additions & 5 deletions src/ts/components/charts/BubbleChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { DashBaseProps } from "props/dash";
import { StylesApiProps } from "props/styles";
import React from "react";
import { getScatterClickData, isEventValid } from "../../utils/charts";
import { getLoadingState } from "../../utils/dash3";

interface Props
extends BoxProps,
Expand Down Expand Up @@ -68,15 +69,11 @@ const BubbleChart = (props: Props) => {

return (
<MantineBubbleChart
data-dash-is-loading={
(loading_state && loading_state.is_loading) || undefined
}
data-dash-is-loading={getLoadingState(loading_state) || undefined}
scatterProps={newProps}
{...others}
/>
);
};

BubbleChart.defaultProps = {};

export default BubbleChart;
29 changes: 18 additions & 11 deletions src/ts/components/charts/CompositeChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { DashBaseProps } from "props/dash";
import { StylesApiProps } from "props/styles";
import React, { useRef, useState } from "react";
import { getClickData, isEventValid } from "../../utils/charts";
import { getLoadingState } from "../../utils/dash3";

interface Props
extends BoxProps,
Expand Down Expand Up @@ -62,10 +63,23 @@ interface Props
maxBarWidth?: number;
}


/** CompositeChart */
const CompositeChart = (props: Props) => {
const { setProps, loading_state, clickData, hoverData, highlightHover, hoverSeriesName, clickSeriesName, composedChartProps, barProps, lineProps, areaProps, activeDotProps, ...others } =
props;
const CompositeChart = ({
setProps,
loading_state,
clickData,
hoverData,
highlightHover = false,
hoverSeriesName,
clickSeriesName,
composedChartProps,
barProps,
lineProps,
areaProps,
activeDotProps,
...others
}: Props) => {

const [highlightedArea, setHighlightedArea] = useState(null);
const shouldHighlight = highlightHover && highlightedArea !== null;
Expand Down Expand Up @@ -159,9 +173,7 @@ const CompositeChart = (props: Props) => {

return (
<MantineCompositeChart
data-dash-is-loading={
(loading_state && loading_state.is_loading) || undefined
}
data-dash-is-loading={getLoadingState(loading_state) || undefined}
composedChartProps={newProps}
barProps={(item) => propsFunction(item, 'bar')} // Pass the chart type as 'bar'
lineProps={(item) => propsFunction(item, 'line')} // Pass the chart type as 'line'
Expand All @@ -177,10 +189,5 @@ const CompositeChart = (props: Props) => {
);
};

CompositeChart.defaultProps = {
withPointLabels: false,
withBarValueLabel: false,
highlightHover: false
};

export default CompositeChart;
9 changes: 4 additions & 5 deletions src/ts/components/charts/DonutChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { DashBaseProps } from "props/dash";
import { StylesApiProps } from "props/styles";
import React, { useState } from "react";
import { getPieClickData, isEventValid } from "../../utils/charts";
import { getLoadingState } from "../../utils/dash3";

interface Props extends BoxProps, StylesApiProps, DashBaseProps {
/** Data used to render chart */
Expand All @@ -15,9 +16,9 @@ interface Props extends BoxProps, StylesApiProps, DashBaseProps {
/** Tooltip animation duration in ms, `0` by default */
tooltipAnimationDuration?: number;
/** Props passed down to `Tooltip` recharts component */
tooltipProps?: any;
tooltipProps?: object;
/** Props passed down to recharts `Pie` component */
pieProps?: any;
pieProps?: object;
/** Controls color of the segments stroke, by default depends on color scheme */
strokeColor?: MantineColor;
/** Controls text color of all labels, by default depends on color scheme */
Expand Down Expand Up @@ -84,9 +85,7 @@ const DonutChart = (props: Props) => {

return (
<MantineDonutChart
data-dash-is-loading={
(loading_state && loading_state.is_loading) || undefined
}
data-dash-is-loading={getLoadingState(loading_state) || undefined}
pieProps={newProps}
{...others}
/>
Expand Down
24 changes: 16 additions & 8 deletions src/ts/components/charts/LineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { DashBaseProps } from "props/dash";
import { StylesApiProps } from "props/styles";
import React, { useState, useRef } from "react";
import { getClickData, isEventValid } from "../../utils/charts";
import { getLoadingState } from "../../utils/dash3";


interface Props
Expand Down Expand Up @@ -61,8 +62,20 @@ interface Props
}

/** Mantine-themed line chart built on top of the Recharts library, */
const LineChart = (props: Props) => {
const { setProps, loading_state, clickData, hoverData, clickSeriesName, hoverSeriesName, series, highlightHover, lineChartProps, activeDotProps, lineProps, ...others } = props;
const LineChart = ({
setProps,
loading_state,
clickData,
hoverData,
clickSeriesName,
hoverSeriesName,
series,
highlightHover = false,
lineChartProps,
activeDotProps,
lineProps,
...others
}: Props) => {

const [highlightedArea, setHighlightedArea] = useState(null);
const shouldHighlight = highlightHover && highlightedArea !== null;
Expand Down Expand Up @@ -149,9 +162,7 @@ const LineChart = (props: Props) => {

return (
<MantineLineChart
data-dash-is-loading={
(loading_state && loading_state.is_loading) || undefined
}
data-dash-is-loading={getLoadingState(loading_state) || undefined}
lineChartProps={newProps}
series={series}
activeDotProps={{
Expand All @@ -166,8 +177,5 @@ const LineChart = (props: Props) => {
);
};

LineChart.defaultProps = {
highlightHover: false,
};

export default LineChart;
5 changes: 2 additions & 3 deletions src/ts/components/charts/PieChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { DashBaseProps } from "props/dash";
import { StylesApiProps } from "props/styles";
import React, { useState } from "react";
import { getPieClickData, isEventValid } from "../../utils/charts";
import { getLoadingState } from "../../utils/dash3";

interface Props extends BoxProps, StylesApiProps, DashBaseProps {
/** Data used to render chart */
Expand Down Expand Up @@ -84,9 +85,7 @@ const PieChart = (props: Props) => {

return (
<MantinePieChart
data-dash-is-loading={
(loading_state && loading_state.is_loading) || undefined
}
data-dash-is-loading={getLoadingState(loading_state) || undefined}
pieProps={newProps}
{...others}
/>
Expand Down
7 changes: 2 additions & 5 deletions src/ts/components/charts/RadarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { DashBaseProps } from "props/dash";
import { StylesApiProps } from "props/styles";
import React from "react";
import { getClickData, isEventValid } from "../../utils/charts";
import { getLoadingState } from "../../utils/dash3";

interface Props extends BoxProps, StylesApiProps, DashBaseProps {
/** Data used in the chart */
Expand Down Expand Up @@ -59,15 +60,11 @@ const RadarChart = (props: Props) => {

return (
<MantineRadarChart
data-dash-is-loading={
(loading_state && loading_state.is_loading) || undefined
}
data-dash-is-loading={getLoadingState(loading_state) || undefined}
radarChartProps={newProps}
{...others}
/>
);
};

RadarChart.defaultProps = {};

export default RadarChart;
6 changes: 2 additions & 4 deletions src/ts/components/charts/ScatterChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { DashBaseProps } from "props/dash";
import { StylesApiProps } from "props/styles";
import React from "react";
import { getScatterClickData, isEventValid } from "../../utils/charts";
import { getLoadingState } from "../../utils/dash3";

interface Props
extends BoxProps,
Expand Down Expand Up @@ -74,15 +75,12 @@ const ScatterChart = (props: Props) => {

return (
<MantineScatterChart
data-dash-is-loading={
(loading_state && loading_state.is_loading) || undefined
}
data-dash-is-loading={getLoadingState(loading_state) || undefined}
scatterProps={newProps}
{...others}
/>
);
};

ScatterChart.defaultProps = {};

export default ScatterChart;
7 changes: 2 additions & 5 deletions src/ts/components/charts/Sparkline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { BoxProps } from "props/box";
import { DashBaseProps } from "props/dash";
import { StylesApiProps } from "props/styles";
import React from "react";
import { getLoadingState } from "../../utils/dash3";

interface Props extends BoxProps, StylesApiProps, DashBaseProps {
/** Data used to render the chart */
Expand Down Expand Up @@ -36,14 +37,10 @@ const Sparkline = (props: Props) => {

return (
<MantineSparkline
data-dash-is-loading={
(loading_state && loading_state.is_loading) || undefined
}
data-dash-is-loading={getLoadingState(loading_state) || undefined}
{...others}
/>
);
};

Sparkline.defaultProps = {};

export default Sparkline;
Loading