Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
cfd927c
refactor(SliderStep): use token instead for hardcoded value (#9651)
adamviktora Sep 20, 2023
e12b872
feat(Drawer): Added start and end to position props, updated resizing…
tlabaj Sep 20, 2023
2953b78
fix(Modal): Prevent duplicate ids within Modal (#9555)
wise-king-sullyman Sep 20, 2023
e27aac2
chore(release): releasing packages [ci skip]
patternfly-build Sep 20, 2023
255563b
chore(Brand): update tests (#9543)
kmcfaul Sep 21, 2023
2da108e
feat(Select) - add appendTo to SelectPopperProps (#9578)
MariaAga Sep 21, 2023
c02dcbc
fix(misc): fixed broken CodeSandbox demos (#9519)
jenny-s51 Sep 21, 2023
0d522ac
chore(release): releasing packages [ci skip]
patternfly-build Sep 21, 2023
82fbf44
chore: update breadcrumb dropdown item arrow to work in RTL (#9603)
mcoker Sep 21, 2023
bf516c9
chore(release): releasing packages [ci skip]
patternfly-build Sep 21, 2023
1eb77cb
fix(Slider): Updated slider to work in RTL. (#9655)
tlabaj Sep 21, 2023
2504201
docs(Toolbar): remove test example (#9614)
kmcfaul Sep 21, 2023
ba947c7
docs(tabs): Clean up React documentation content. (#9606)
edonehoo Sep 21, 2023
026096f
chore(release): releasing packages [ci skip]
patternfly-build Sep 21, 2023
033e6bc
fix(popper): add start/end positioning with RTL support, update defau…
wise-king-sullyman Sep 21, 2023
1bc53da
fix(Dropdown): Add appendTo to dropdownPopperProps interface (#9635)
wise-king-sullyman Sep 21, 2023
7b3ec92
feat(Timestamp): allowed displayed datetime to be UTC (#9649)
thatblindgeye Sep 21, 2023
2fa883d
chore(release): releasing packages [ci skip]
patternfly-build Sep 21, 2023
832d99d
chore(deps): update dependency @patternfly/patternfly to v5.1.0-prere…
renovate[bot] Sep 21, 2023
72f13c8
fix(Tabs): allow RTL scrolling (#9633)
kmcfaul Sep 21, 2023
262e474
chore(release): releasing packages [ci skip]
patternfly-build Sep 21, 2023
faddb9c
fix(Nav): allow RTL scrolling (#9637)
kmcfaul Sep 21, 2023
5a8c6bc
chore(BackgroundImage): update tests (#9584)
kmcfaul Sep 21, 2023
0f8ac62
feat(Label) add option to make label clickable (#9284)
dominik-petrik Sep 21, 2023
99d8d97
feat(charts): add RTL legend support (#9570)
kmcfaul Sep 22, 2023
cb50876
chore(release): releasing packages [ci skip]
patternfly-build Sep 22, 2023
9ae107f
fix(PrimaryDetail): remove primary detail card view require statement…
wise-king-sullyman Sep 25, 2023
f5d67f7
chore(release): releasing packages [ci skip]
patternfly-build Sep 25, 2023
8e1e08d
fix(Draggable): dont disable droppable on false ondrag (#9646)
gitdallas Sep 25, 2023
7d52ed0
chore(release): releasing packages [ci skip]
patternfly-build Sep 25, 2023
e1efd15
chore(screenshots): Updated screenshots (#9660)
tlabaj Sep 26, 2023
4077d38
fix: dry run publishing v6 alphas
nicolethoen Sep 28, 2023
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
4 changes: 2 additions & 2 deletions .github/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ echo "Doing a release..."
LOG=$(git log --format="%s" -1 | grep -Poe "#\d+")
PR_NUM=${LOG:1}

yarn run lerna publish prerelease --preid=prerelease --dist-tag=prerelease --yes 2>&1 | tee lerna-output.txt
# yarn run lerna publish prerelease --preid=alpha --dist-tag=alpha --no-private --yes 2>&1 | tee lerna-output.txt

# use lerna command below for dry run
# yarn run lerna version prerelease --preid=prerelease --yes --no-git-tag-version --no-push | tee lerna-output.txt
yarn run lerna version prerelease --preid=alpha --dist-tag=alpha --no-private --yes --no-git-tag-version --no-push | tee lerna-output.txt

if grep -i "Successfully published" lerna-output.txt; # Leave a Github comment
then
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: release
on:
push:
branches:
- main
- v6
jobs:
build:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
}
},
"version": "independent",
"allowBranch": ["main", "v4", "5.0.x"],
"allowBranch": ["main", "v4", "5.0.x", "v6"],
"packages": ["packages/*", "packages/react-integration/demo-app-ts"],
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
5 changes: 3 additions & 2 deletions packages/eslint-plugin-patternfly-react/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "eslint-plugin-patternfly-react",
"version": "5.1.1-prerelease.1",
"version": "6.0.0-alpha.0",
"private": false,
"main": "./lib/index.js",
"license": "MIT",
"publishConfig": {
"access": "public"
"access": "public",
"tag": "alpha"
},
"repository": {
"type": "git",
Expand Down
10 changes: 10 additions & 0 deletions packages/react-charts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [7.1.1-prerelease.9](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-charts@7.1.1-prerelease.8...@patternfly/react-charts@7.1.1-prerelease.9) (2023-09-22)

### Features

- **charts:** add RTL legend support ([#9570](https://github.com/patternfly/patternfly-react/issues/9570)) ([99d8d97](https://github.com/patternfly/patternfly-react/commit/99d8d975eeb2d562357cdcaa37502748d5794564))

## 7.1.1-prerelease.8 (2023-09-21)

**Note:** Version bump only for package @patternfly/react-charts

## [7.1.1-prerelease.7](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-charts@7.1.1-prerelease.6...@patternfly/react-charts@7.1.1-prerelease.7) (2023-09-18)

**Note:** Version bump only for package @patternfly/react-charts
Expand Down
9 changes: 5 additions & 4 deletions packages/react-charts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@patternfly/react-charts",
"version": "7.1.1-prerelease.7",
"version": "8.0.0-alpha.0",
"description": "This library provides a set of React chart components for use with the PatternFly reference implementation.",
"main": "dist/js/index.js",
"module": "dist/esm/index.js",
Expand All @@ -11,7 +11,8 @@
"*.scss"
],
"publishConfig": {
"access": "public"
"access": "public",
"tag": "alpha"
},
"repository": {
"type": "git",
Expand All @@ -28,8 +29,8 @@
},
"homepage": "https://github.com/patternfly/patternfly-react#readme",
"dependencies": {
"@patternfly/react-styles": "^5.1.1-prerelease.6",
"@patternfly/react-tokens": "^5.1.1-prerelease.6",
"@patternfly/react-styles": "^6.0.0-alpha.0",
"@patternfly/react-tokens": "^6.0.0-alpha.0",
"hoist-non-react-statics": "^3.3.0",
"lodash": "^4.17.19",
"tslib": "^2.5.0",
Expand Down
28 changes: 27 additions & 1 deletion packages/react-charts/src/components/Chart/Chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ import { ChartCommonStyles } from '../ChartTheme/ChartStyles';
import { ChartThemeDefinition } from '../ChartTheme/ChartTheme';
import { getClassName } from '../ChartUtils/chart-helpers';
import { getLabelTextSize } from '../ChartUtils/chart-label';
import { getComputedLegend, getLegendItemsExtraHeight } from '../ChartUtils/chart-legend';
import { getComputedLegend, getLegendItemsExtraHeight, getLegendMaxTextWidth } from '../ChartUtils/chart-legend';
import { getPaddingForSide } from '../ChartUtils/chart-padding';
import { getPatternDefs, mergePatternData, useDefaultPatternProps } from '../ChartUtils/chart-patterns';
import { getChartTheme } from '../ChartUtils/chart-theme-types';
import { useEffect } from 'react';
import { ChartLabel } from '../ChartLabel/ChartLabel';
import { ChartPoint } from '../ChartPoint/ChartPoint';

/**
* Chart is a wrapper component that reconciles the domain for all its children, controls the layout of the chart,
Expand Down Expand Up @@ -284,6 +286,10 @@ export interface ChartProps extends VictoryChartProps {
* cases, the legend may not be visible until enough padding is applied.
*/
legendPosition?: 'bottom' | 'bottom-left' | 'right';
/**
* @beta Text direction of the legend labels.
*/
legendDirection?: 'ltr' | 'rtl';
/**
* The maxDomain prop defines a maximum domain value for a chart. This prop is useful in situations where the maximum
* domain of a chart is static, while the minimum value depends on data or other variable information. If the domain
Expand Down Expand Up @@ -471,6 +477,7 @@ export const Chart: React.FunctionComponent<ChartProps> = ({
legendComponent = <ChartLegend />,
legendData,
legendPosition = ChartCommonStyles.legend.position,
legendDirection = 'ltr',
name,
padding,
patternScale,
Expand Down Expand Up @@ -522,11 +529,30 @@ export const Chart: React.FunctionComponent<ChartProps> = ({
...(labelComponent && { labelComponent }) // Override label component props
});

let legendXOffset = 0;
if (legendDirection === 'rtl') {
legendXOffset = getLegendMaxTextWidth(legendData, theme);
}

const legend = React.cloneElement(legendComponent, {
data: legendData,
...(name && { name: `${name}-${(legendComponent as any).type.displayName}` }),
orientation: legendOrientation,
theme,
...(legendDirection === 'rtl' && {
dataComponent: legendComponent.props.dataComponent ? (
React.cloneElement(legendComponent.props.dataComponent, { transform: `translate(${legendXOffset})` })
) : (
<ChartPoint transform={`translate(${legendXOffset})`} />
)
}),
...(legendDirection === 'rtl' && {
labelComponent: legendComponent.props.labelComponent ? (
React.cloneElement(legendComponent.props.labelComponent, { direction: 'rtl', dx: legendXOffset - 30 })
) : (
<ChartLabel direction="rtl" dx={legendXOffset - 30} />
)
}),
...legendComponent.props
});

Expand Down
37 changes: 36 additions & 1 deletion packages/react-charts/src/components/ChartBullet/ChartBullet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { ChartLegend } from '../ChartLegend/ChartLegend';
import { ChartThemeDefinition } from '../ChartTheme/ChartTheme';
import { ChartTooltip } from '../ChartTooltip/ChartTooltip';
import { ChartBulletStyles } from '../ChartTheme/ChartStyles';
import { getComputedLegend, getLegendItemsExtraHeight } from '../ChartUtils/chart-legend';
import { getComputedLegend, getLegendItemsExtraHeight, getLegendMaxTextWidth } from '../ChartUtils/chart-legend';
import { ChartBulletComparativeErrorMeasure } from './ChartBulletComparativeErrorMeasure';
import { ChartBulletComparativeMeasure } from './ChartBulletComparativeMeasure';
import { ChartBulletComparativeWarningMeasure } from './ChartBulletComparativeWarningMeasure';
Expand All @@ -29,6 +29,8 @@ import { getBulletDomain } from './utils/chart-bullet-domain';
import { getBulletThemeWithLegendColorScale } from './utils/chart-bullet-theme';
import { getPaddingForSide } from '../ChartUtils/chart-padding';
import { useEffect } from 'react';
import { ChartPoint } from '../ChartPoint/ChartPoint';
import { ChartLabel } from '../ChartLabel/ChartLabel';

/**
* ChartBullet renders a dataset as a bullet chart.
Expand Down Expand Up @@ -252,6 +254,10 @@ export interface ChartBulletProps {
* cases, the legend may not be visible until enough padding is applied.
*/
legendPosition?: 'bottom' | 'bottom-left' | 'right';
/**
* @beta Text direction of the legend labels.
*/
legendDirection?: 'ltr' | 'rtl';
/**
* The maxDomain prop defines a maximum domain value for a chart. This prop is useful in situations where the maximum
* domain of a chart is static, while the minimum value depends on data or other variable information. If the domain
Expand Down Expand Up @@ -509,6 +515,7 @@ export const ChartBullet: React.FunctionComponent<ChartBulletProps> = ({
legendComponent = <ChartLegend />,
legendItemsPerRow,
legendPosition = 'bottom',
legendDirection = 'ltr',
maxDomain,
minDomain,
name,
Expand Down Expand Up @@ -656,6 +663,20 @@ export const ChartBullet: React.FunctionComponent<ChartBulletProps> = ({
...comparativeZeroMeasureComponent.props
});

let legendXOffset = 0;
if (legendDirection === 'rtl') {
legendXOffset = getLegendMaxTextWidth(
[
...(primaryDotMeasureLegendData ? primaryDotMeasureLegendData : []),
...(primarySegmentedMeasureLegendData ? primarySegmentedMeasureLegendData : []),
...(comparativeWarningMeasureLegendData ? comparativeWarningMeasureLegendData : []),
...(comparativeErrorMeasureLegendData ? comparativeErrorMeasureLegendData : []),
...(qualitativeRangeLegendData ? qualitativeRangeLegendData : [])
],
theme
);
}

// Legend
const legend = React.cloneElement(legendComponent, {
data: [
Expand All @@ -670,6 +691,20 @@ export const ChartBullet: React.FunctionComponent<ChartBulletProps> = ({
orientation: legendOrientation,
position: legendPosition,
theme,
...(legendDirection === 'rtl' && {
dataComponent: legendComponent.props.dataComponent ? (
React.cloneElement(legendComponent.props.dataComponent, { transform: `translate(${legendXOffset})` })
) : (
<ChartPoint transform={`translate(${legendXOffset})`} />
)
}),
...(legendDirection === 'rtl' && {
labelComponent: legendComponent.props.labelComponent ? (
React.cloneElement(legendComponent.props.labelComponent, { direction: 'rtl', dx: legendXOffset - 30 })
) : (
<ChartLabel direction="rtl" dx={legendXOffset - 30} />
)
}),
...legendComponent.props
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,10 @@ export interface ChartDonutProps extends ChartPieProps {
* cases, the legend may not be visible until enough padding is applied.
*/
legendPosition?: 'bottom' | 'right';
/**
* @beta Text direction of the legend labels.
*/
legendDirection?: 'ltr' | 'rtl';
/**
* The name prop is typically used to reference a component instance when defining shared events. However, this
* optional prop may also be applied to child elements as an ID prefix. This is a workaround to ensure Victory
Expand Down Expand Up @@ -573,6 +577,7 @@ export const ChartDonut: React.FunctionComponent<ChartDonutProps> = ({
containerComponent = <ChartContainer />,
innerRadius,
legendPosition = ChartCommonStyles.legend.position,
legendDirection = 'ltr',
name,
padAngle,
padding,
Expand Down Expand Up @@ -698,6 +703,7 @@ export const ChartDonut: React.FunctionComponent<ChartDonutProps> = ({
innerRadius={chartInnerRadius > 0 ? chartInnerRadius : 0}
key="pf-chart-donut-pie"
legendPosition={legendPosition}
legendDirection={legendDirection}
name={name}
padAngle={padAngle !== undefined ? padAngle : getPadAngle}
padding={padding}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,10 @@ export interface ChartDonutUtilizationProps extends ChartDonutProps {
* cases, the legend may not be visible until enough padding is applied.
*/
legendPosition?: 'bottom' | 'right';
/**
* @beta Text direction of the legend labels.
*/
legendDirection?: 'ltr' | 'rtl';
/**
* The labelRadius prop defines the radius of the arc that will be used for positioning each slice label.
* If this prop is not set, the label radius will default to the radius of the pie + label padding.
Expand Down Expand Up @@ -589,6 +593,7 @@ export const ChartDonutUtilization: React.FunctionComponent<ChartDonutUtilizatio
invert = false,
isStatic = true,
legendPosition = ChartCommonStyles.legend.position,
legendDirection = 'ltr',
padding,
standalone = true,
themeColor,
Expand Down Expand Up @@ -679,6 +684,7 @@ export const ChartDonutUtilization: React.FunctionComponent<ChartDonutUtilizatio
height={height}
key="pf-chart-donut-utilization"
legendPosition={legendPosition}
legendDirection={legendDirection}
padding={padding}
standalone={false}
theme={getThresholdTheme()}
Expand Down
30 changes: 27 additions & 3 deletions packages/react-charts/src/components/ChartPie/ChartPie.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ import { ChartLegend } from '../ChartLegend/ChartLegend';
import { ChartCommonStyles } from '../ChartTheme/ChartStyles';
import { ChartThemeDefinition } from '../ChartTheme/ChartTheme';
import { ChartTooltip } from '../ChartTooltip/ChartTooltip';
import { getComputedLegend, getLegendItemsExtraHeight } from '../ChartUtils/chart-legend';
import { getComputedLegend, getLegendItemsExtraHeight, getLegendMaxTextWidth } from '../ChartUtils/chart-legend';
import { getPaddingForSide } from '../ChartUtils/chart-padding';
import { getPatternDefs, useDefaultPatternProps } from '../ChartUtils/chart-patterns';
import { getTheme } from '../ChartUtils/chart-theme';
import { useEffect } from 'react';
import { ChartPoint } from '../ChartPoint/ChartPoint';
import { ChartLabel } from '../ChartLabel/ChartLabel';

/**
* ChartPie renders a dataset as a pie chart.
Expand Down Expand Up @@ -333,6 +335,10 @@ export interface ChartPieProps extends VictoryPieProps {
* cases, the legend may not be visible until enough padding is applied.
*/
legendPosition?: 'bottom' | 'right';
/**
* @beta Text direction of the legend labels.
*/
legendDirection?: 'ltr' | 'rtl';
/**
* The name prop is typically used to reference a component instance when defining shared events. However, this
* optional prop may also be applied to child elements as an ID prefix. This is a workaround to ensure Victory
Expand Down Expand Up @@ -498,16 +504,15 @@ export const ChartPie: React.FunctionComponent<ChartPieProps> = ({
legendComponent = <ChartLegend />,
legendData,
legendPosition = ChartCommonStyles.legend.position,
legendDirection = 'ltr',
name,
patternScale,
patternUnshiftIndex,

padding,
radius,
standalone = true,
style,
themeColor,

// destructure last
theme = getTheme(themeColor),
labelComponent = allowTooltip ? (
Expand Down Expand Up @@ -576,13 +581,32 @@ export const ChartPie: React.FunctionComponent<ChartPieProps> = ({
/>
);

let legendXOffset = 0;
if (legendDirection === 'rtl') {
legendXOffset = getLegendMaxTextWidth(legendData, theme);
}

const legend = React.cloneElement(legendComponent, {
colorScale,
data: legendData,
...(name && { name: `${name}-${(legendComponent as any).type.displayName}` }),
key: 'pf-chart-pie-legend',
orientation: legendOrientation,
theme,
...(legendDirection === 'rtl' && {
dataComponent: legendComponent.props.dataComponent ? (
React.cloneElement(legendComponent.props.dataComponent, { transform: `translate(${legendXOffset})` })
) : (
<ChartPoint transform={`translate(${legendXOffset})`} />
)
}),
...(legendDirection === 'rtl' && {
labelComponent: legendComponent.props.labelComponent ? (
React.cloneElement(legendComponent.props.labelComponent, { direction: 'rtl', dx: legendXOffset - 30 })
) : (
<ChartLabel direction="rtl" dx={legendXOffset - 30} />
)
}),
...legendComponent.props
});

Expand Down
17 changes: 17 additions & 0 deletions packages/react-charts/src/components/ChartUtils/chart-legend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { VictoryLegend } from 'victory-legend';
import { ChartLegendProps } from '../ChartLegend/ChartLegend';
import { ChartCommonStyles } from '../ChartTheme/ChartStyles';
import { ChartThemeDefinition } from '../ChartTheme/ChartTheme';
import { getLabelTextSize } from '../ChartUtils/chart-label';
import { getPieOrigin } from './chart-origin';
import * as React from 'react';

Expand Down Expand Up @@ -49,6 +50,22 @@ interface ChartLegendTextMaxSizeInterface {
theme: ChartThemeDefinition; // The theme that will be applied to the chart
}

/**
* Returns the max text length in a legend data set to calculate the x offset for right aligned legends.
* @private
*/

export const getLegendMaxTextWidth = (legendData: any[], theme: ChartThemeDefinition) => {
let legendXOffset = 0;
legendData.map((data: any) => {
const labelWidth = getLabelTextSize({ text: data.name, theme }).width;
if (labelWidth > legendXOffset) {
legendXOffset = labelWidth;
}
});
return legendXOffset;
};

/**
* Returns a legend which has been positioned per the given chart properties
* @private
Expand Down
Loading