From 6ff9f03efd7eeabd1d30c551fd3e2ce356747871 Mon Sep 17 00:00:00 2001 From: Duarte Caldeira <124570762+dlcaldeira@users.noreply.github.com> Date: Fri, 24 May 2024 10:46:54 +0100 Subject: [PATCH 01/75] fix(DGT-528): Fix the rounding issue of QualityBar percentages --- .changeset/many-camels-agree.md | 5 +++ .../QualityBar/QualityRatioBar.utils.ts | 36 +++++++++---------- 2 files changed, 23 insertions(+), 18 deletions(-) create mode 100644 .changeset/many-camels-agree.md diff --git a/.changeset/many-camels-agree.md b/.changeset/many-camels-agree.md new file mode 100644 index 0000000000..d615d6bce1 --- /dev/null +++ b/.changeset/many-camels-agree.md @@ -0,0 +1,5 @@ +--- +"@talend/design-system": patch +--- + +DGT-528: Fix QualityBar rounding issue when the invalid or empty percentages were rounded to 0. Set a miminum value for the rounding to prevent UI inconsistencies diff --git a/packages/design-system/src/components/QualityBar/QualityRatioBar.utils.ts b/packages/design-system/src/components/QualityBar/QualityRatioBar.utils.ts index ad141045f7..f2318cf7d3 100644 --- a/packages/design-system/src/components/QualityBar/QualityRatioBar.utils.ts +++ b/packages/design-system/src/components/QualityBar/QualityRatioBar.utils.ts @@ -35,7 +35,7 @@ export const getQualityPercentagesRounded = ( empty: number = 0, valid: number = 0, na: number = 0, - placeholder = 0, + placeholder: number = 0, ): Required => { const output: Required = { empty: 0, @@ -45,30 +45,30 @@ export const getQualityPercentagesRounded = ( valid: 0, }; - let sumValues = 0; - let sumRounded = 0; const digitMultiplier = Math.pow(10, digits); - const multiplier = 100 * digitMultiplier; - const total = invalid + empty + valid + na + placeholder; - sumValues = (invalid * multiplier) / total; - output.invalid = Math.round(sumValues - sumRounded) / digitMultiplier; - sumRounded = Math.round(sumValues); + if (total === 0) { + return output; + } + + const minPercentage = 1 / digitMultiplier; + + output.invalid = +(invalid > 0 ? Math.max((invalid * 100) / total, minPercentage) : 0).toFixed( + digits, + ); - sumValues += (empty * multiplier) / total; - output.empty = Math.round(sumValues - sumRounded) / digitMultiplier; - sumRounded = Math.round(sumValues); + output.empty = +(empty > 0 ? Math.max((empty * 100) / total, minPercentage) : 0).toFixed(digits); - sumValues += (valid * multiplier) / total; - output.valid = Math.round(sumValues - sumRounded) / digitMultiplier; - sumRounded = Math.round(sumValues); + output.na = +(na > 0 ? Math.max((na * 100) / total, minPercentage) : 0).toFixed(digits); - sumValues += (na * multiplier) / total; - output.na = Math.round(sumValues - sumRounded) / digitMultiplier; + output.placeholder = +( + placeholder > 0 ? Math.max((placeholder * 100) / total, minPercentage) : 0 + ).toFixed(digits); - sumValues += (placeholder * multiplier) / total; - output.placeholder = Math.round(sumValues - sumRounded) / digitMultiplier; + output.valid = +(100 - output.invalid - output.empty - output.na - output.placeholder).toFixed( + digits, + ); return output; }; From bcb24b175ab56def87002e5a6918139e875260db Mon Sep 17 00:00:00 2001 From: Talend bot Date: Fri, 24 May 2024 11:51:39 +0200 Subject: [PATCH 02/75] chore: prepare release (#5318) Co-authored-by: github-actions[bot] --- .changeset/many-camels-agree.md | 5 ----- packages/design-system/CHANGELOG.md | 6 ++++++ packages/design-system/package.json | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 .changeset/many-camels-agree.md diff --git a/.changeset/many-camels-agree.md b/.changeset/many-camels-agree.md deleted file mode 100644 index d615d6bce1..0000000000 --- a/.changeset/many-camels-agree.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@talend/design-system": patch ---- - -DGT-528: Fix QualityBar rounding issue when the invalid or empty percentages were rounded to 0. Set a miminum value for the rounding to prevent UI inconsistencies diff --git a/packages/design-system/CHANGELOG.md b/packages/design-system/CHANGELOG.md index 98da3d4aa5..e2c0619953 100644 --- a/packages/design-system/CHANGELOG.md +++ b/packages/design-system/CHANGELOG.md @@ -1,5 +1,11 @@ # @talend/design-system +## 10.4.4 + +### Patch Changes + +- 6ff9f03: DGT-528: Fix QualityBar rounding issue when the invalid or empty percentages were rounded to 0. Set a miminum value for the rounding to prevent UI inconsistencies + ## 10.4.3 ### Patch Changes diff --git a/packages/design-system/package.json b/packages/design-system/package.json index 6f8e762d8d..f59e6addae 100644 --- a/packages/design-system/package.json +++ b/packages/design-system/package.json @@ -1,6 +1,6 @@ { "name": "@talend/design-system", - "version": "10.4.3", + "version": "10.4.4", "description": "Talend Design System", "main": "lib/index.js", "types": "lib/index.d.ts", From 5b7240ed9301f9a677a88bb5a87d18be2b1b2584 Mon Sep 17 00:00:00 2001 From: Gbacc Date: Wed, 29 May 2024 15:02:13 +0200 Subject: [PATCH 03/75] fix(TMC-28581): UI Form display fix with hint and required asterisk (#5319) * fix(TMC-28581): UI Form display fix with hint and required asterisk * change required * to css --------- Co-authored-by: Geoffroy Baccarini --- .changeset/weak-boats-destroy.md | 5 +++++ .changeset/wet-sloths-talk.md | 5 +++++ .../src/components/Form/Primitives/Field/Field.tsx | 4 ++-- .../fields/FieldTemplate/FieldTemplate.component.js | 2 +- .../forms/src/UIForm/fields/File/File.component.js | 2 +- .../src/UIForm/fields/Select/Select.component.js | 2 +- .../forms/src/UIForm/fields/Text/Text.component.js | 2 +- .../src/UIForm/fields/TextArea/TextArea.component.js | 2 +- packages/forms/src/UIForm/utils/labels.js | 11 ++++++++--- packages/forms/src/UIForm/utils/labels.module.scss | 4 ++++ packages/forms/stories/json/fields/core-text.json | 9 ++++++--- 11 files changed, 35 insertions(+), 13 deletions(-) create mode 100644 .changeset/weak-boats-destroy.md create mode 100644 .changeset/wet-sloths-talk.md create mode 100644 packages/forms/src/UIForm/utils/labels.module.scss diff --git a/.changeset/weak-boats-destroy.md b/.changeset/weak-boats-destroy.md new file mode 100644 index 0000000000..26e9b4c8bf --- /dev/null +++ b/.changeset/weak-boats-destroy.md @@ -0,0 +1,5 @@ +--- +"@talend/design-system": patch +--- + +Form field label property "required" can now be overriden by passing props diff --git a/.changeset/wet-sloths-talk.md b/.changeset/wet-sloths-talk.md new file mode 100644 index 0000000000..fdaba236cb --- /dev/null +++ b/.changeset/wet-sloths-talk.md @@ -0,0 +1,5 @@ +--- +"@talend/react-forms": patch +--- + +UI Form fields with both hint and required asterisk are now displayed correctly diff --git a/packages/design-system/src/components/Form/Primitives/Field/Field.tsx b/packages/design-system/src/components/Form/Primitives/Field/Field.tsx index 9390862f08..0155e9a6bf 100644 --- a/packages/design-system/src/components/Form/Primitives/Field/Field.tsx +++ b/packages/design-system/src/components/Form/Primitives/Field/Field.tsx @@ -47,10 +47,10 @@ const Field = forwardRef( const LabelComponent = hideLabel ? ( - ) : ( -