Skip to content

Commit

Permalink
fix: Update rem base value (#5132)
Browse files Browse the repository at this point in the history
* fix: Change REM base value to default

* changeset

* update components

* update faceted-search

* update forms

* update stepper

* update dataviz

* update design-docs

* changeset

* Add placeholder prop to Select component

* update design-tokens

* Refactor styles in _scaffolding.scss

* Update dependencies: @talend/bootstrap-sass (minor)

This commit updates the dependencies in the project, specifically the '@talend/bootstrap-sass' package, to a minor version.

* Update ButtonPrimitive, SizedIcon, ThemeProvider, and globalStyles

* update DS stories

* Update ThemeProvider.scss

* update theme

* update anapshots

* setup cypress viewport to minimal supported resolution

---------

Co-authored-by: Sebastien Romain <[email protected]>
  • Loading branch information
mhuchet and romainseb authored Jan 26, 2024
1 parent 9a21a33 commit 18c1d97
Show file tree
Hide file tree
Showing 211 changed files with 1,171 additions and 1,058 deletions.
11 changes: 11 additions & 0 deletions .changeset/hot-pumpkins-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@talend/react-faceted-search': major
'@talend/design-docs': major
'@talend/react-components': major
'@talend/react-dataviz': major
'@talend/react-stepper': major
'@talend/react-forms': major
'@talend/bootstrap-sass': minor
---

`rem` values have been updated to correspond to the new `rem` base (16px) define by the design system
79 changes: 79 additions & 0 deletions .changeset/tall-steaks-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
'@talend/design-system': major
---

**Breaking change**

What?

The setup of 1rem = 10px has been removed. 1rem = 16px is now the default value.

Why?

Qlik does not set it and use the default value of 1rem = 16px.
Using Coral component in Qlik integrations, we alter their ui by setting 1rem = 10px on the html element.

How?

You can use the following code to update all scss files in a folder, to convert rem values from 10px to 16px:

```javascript
const fs = require('fs');
const path = require('path');

// Get folder path from command-line arguments
const folderPath = process.argv[2];

if (!folderPath) {
console.error('Please provide a folder path as a command-line argument.');
process.exit(1);
}

// Regular expression to match and capture rem values (including potential negative values)
const remRegex = /(-?\d*\.?\d+)rem/g;

// Function to divide rem values by 1.6 and keep the 'rem' unit with minimal decimal places
const replaceRem = (match, value) => {
const result = (parseFloat(value) / 1.6).toFixed(4).replace(/\.?0+$/, '');
return result + 'rem';
};

// Function to process a single file
const processFile = (filePath) => {
const cssInput = fs.readFileSync(filePath, 'utf8');
const updatedCSS = cssInput.replace(remRegex, replaceRem);
fs.writeFileSync(filePath, updatedCSS, 'utf8');
console.log(`Updated: ${filePath}`);
};

// Function to recursively find all .scss files in the specified folder
const findAllScssFiles = (folder) => {
const files = fs.readdirSync(folder);
const scssFiles = [];

files.forEach((file) => {
const filePath = path.join(folder, file);
const stat = fs.statSync(filePath);

if (stat.isDirectory()) {
scssFiles.push(...findAllScssFiles(filePath));
} else if (file.endsWith('.scss')) {
scssFiles.push(filePath);
}
});

return scssFiles;
};

// Find all .scss files in the specified folder
const scssFiles = findAllScssFiles(folderPath);

// Process each file
scssFiles.forEach(processFile);
```

To run the script, save it to a file with a .js extension (e.g., updateRemValues.js) and execute it using Node.js:

```bash
node updateRemValues.js /path/to/your/folder
```
14 changes: 7 additions & 7 deletions packages/components/src/AboutDialog/AboutDialog.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@
:global(.modal-body) {
text-align: center;
padding: {
top: 1rem;
left: 3.2rem;
right: 3.2rem;
top: 0.625rem;
left: 2rem;
right: 2rem;
}

.about {
&-logo {
width: 6.6rem;
height: 6.6rem;
width: 4.125rem;
height: 4.125rem;
}

&-excerpt {
margin-top: 2rem;
margin-top: 1.25rem;
}

&-versions {
margin: 0 auto;
margin-top: 3rem;
margin-top: 1.875rem;
text-align: justify;
table-layout: fixed;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
left: 50%;
transform: translateX(-50%);
color: #015A8E;
font-size: 2rem;
font-size: 1.25rem;
line-height: initial;
}
}
4 changes: 2 additions & 2 deletions packages/components/src/ActionList/ActionList.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
/// @group Custom widgets
////

$tc-action-list-item-width: 20rem !default;
$tc-action-list-item-width: 12.5rem !default;
$tc-action-list-item-icons-size: tokens.$coral-sizing-xxxs !default;
$tc-action-list-item-border-size: 0.2rem !default;
$tc-action-list-item-border-size: 0.125rem !default;

$action-list-background-color: tokens.$coral-color-branding-background;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@use '~@talend/design-tokens/lib/tokens';

$tc-dropdown-loader-padding: $padding-small !default;
$tc-dropdown-button-right-padding: 0.8rem;
$tc-dropdown-button-right-padding: 0.5rem;

.tc-dropdown {
&-button:global(.btn-link) {
Expand All @@ -17,8 +17,8 @@ $tc-dropdown-button-right-padding: 0.8rem;
padding-right: $tc-dropdown-button-right-padding;

.tc-dropdown-caret {
width: 0.8rem;
height: 0.8rem;
width: 0.5rem;
height: 0.5rem;
transition: transform 0.1s ease-in;
will-change: transform;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@use '~@talend/bootstrap-theme/src/theme/guidelines' as *;
@use '~@talend/design-tokens/lib/tokens';

$tc-icon-toggle-size: 2.4rem !default;
$tc-icon-toggle-size: 1.5rem !default;
$tc-icon-toggle-icon-size: $svg-sm-size !default;
$tc-icon-toggle-border: tokens.$coral-border-s-solid tokens.$coral-color-neutral-border !default;
$tc-icon-toggle-tick-size: 12px !default;
Expand Down Expand Up @@ -87,8 +87,8 @@ $tc-icon-toggle-tick-size: 12px !default;
width: $tc-icon-toggle-tick-size;
height: $tc-icon-toggle-tick-size;
border-radius: calc(#{$tc-icon-toggle-tick-size} / 2);
right: -0.4rem;
top: -0.4rem;
right: -0.25rem;
top: -0.25rem;
background: tokens.$coral-color-accent-text;
border: tokens.$coral-border-s-solid tokens.$coral-color-neutral-border-weak;
}
Expand Down
18 changes: 9 additions & 9 deletions packages/components/src/Badge/Badge.module.scss
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
@use '~@talend/bootstrap-theme/src/theme/guidelines' as *;
@use '@talend/design-tokens/lib/tokens';

$tc-badge-large-label-font-size: 1.4rem !default;
$tc-badge-large-label-font-size: 0.875rem !default;
$tc-badge-large-label-font-weight: normal !default;
$tc-badge-large-label-with-categ-font-weight: $font-weight-semi-bold !default;
$tc-badge-large-height: 2.4rem !default;
$tc-badge-large-height: 1.5rem !default;
$tc-badge-large-vertical-padding: calc((#{$tc-badge-large-height} - #{$tc-badge-large-label-font-size} * #{$line-height-base}) / 2) !default; // $line-height-base / 2
$tc-badge-large-margin: $padding-smaller !default;
$tc-badge-large-delete-icon-size: $svg-xs-size !default;
$tc-badge-large-icon-size: $svg-xs-size !default;
$tc-badge-large-padding: $padding-small;

$tc-badge-small-label-font-size: 1.2rem !default;
$tc-badge-small-label-font-size: 0.75rem !default;
$tc-badge-small-label-font-weight: normal !default;
$tc-badge-small-label-with-categ-font-weight: $font-weight-semi-bold !default;
$tc-badge-small-height: 2rem !default;
$tc-badge-small-height: 1.25rem !default;
$tc-badge-small-vertical-padding: calc((#{$tc-badge-small-height} - #{$tc-badge-small-label-font-size} * #{$line-height-base}) / 2) !default; // $line-height-base / 2
$tc-badge-small-margin: $padding-smaller !default;
$tc-badge-small-delete-icon-size: calc(#{$svg-sm-size} / 2) !default;
$tc-badge-small-icon-size: $svg-xs-size !default;
$tc-badge-small-padding: 0.8rem;
$tc-badge-small-padding: 0.5rem;

$tc-badge-disabled-opacity: 0.62;

Expand All @@ -43,7 +43,7 @@ $tc-badge-disabled-opacity: 0.62;

.tc-badge {
display: inline-flex;
max-width: 23.5rem;
max-width: 14.6875rem;

&:not(.tc-badge-readonly) {
cursor: pointer;
Expand Down Expand Up @@ -137,7 +137,7 @@ $tc-badge-disabled-opacity: 0.62;
color: tokens.$coral-color-neutral-text;

span {
max-width: 16rem;
max-width: 10rem;
display: block;
text-overflow: ellipsis;
overflow: hidden;
Expand All @@ -162,7 +162,7 @@ $tc-badge-disabled-opacity: 0.62;

&.tc-badge-display-large {
.tc-badge-separator {
margin-top: 0.4rem;
margin-top: 0.25rem;
}

.tc-badge-button {
Expand Down Expand Up @@ -222,7 +222,7 @@ $tc-badge-disabled-opacity: 0.62;

&.tc-badge-display-small {
.tc-badge-separator {
margin-top: 0.3rem;
margin-top: 0.1875rem;
}

.tc-badge-button {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

// CircularProgress styles
$tc-circular-progress-light-fill: tokens.$coral-color-neutral-text-inverted !default;
$tc-circular-progress-small: 1.2rem;
$tc-circular-progress-regular: 2rem;
$tc-circular-progress-large: 4rem;
$tc-circular-progress-small: 0.75rem;
$tc-circular-progress-regular: 1.25rem;
$tc-circular-progress-large: 2.5rem;
$tc-circular-progress-stroke-width: 5;

.fixed {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ $tc-collapsible-panel-padding-larger: $padding-larger !default;

.panel-header-content {
display: flex;
height: 4rem;
height: 2.5rem;
align-items: center;
padding: 0 $padding-normal;

Expand All @@ -158,7 +158,7 @@ $tc-collapsible-panel-padding-larger: $padding-larger !default;
justify-content: space-between;
flex-basis: 100%;
overflow: hidden;
font-size: 1.4rem;
font-size: 0.875rem;
width: 100%;
padding-right: $padding-smaller;

Expand All @@ -185,13 +185,13 @@ $tc-collapsible-panel-padding-larger: $padding-larger !default;
}

:global(.tc-icon-toggle) {
height: 1.6rem;
width: 1.6rem;
height: 1rem;
width: 1rem;
transform-origin: center;

svg {
height: 1rem;
width: 1rem;
height: 0.625rem;
width: 0.625rem;
}
}

Expand Down Expand Up @@ -308,7 +308,7 @@ $tc-collapsible-panel-padding-larger: $padding-larger !default;

.tag {
white-space: nowrap;
font-size: 1.2rem;
font-size: 0.75rem;
}

.detail {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@use '~@talend/bootstrap-theme/src/theme/guidelines' as *;
@use '~@talend/design-tokens/lib/tokens';

$default-height: 4rem !default;
$default-height: 2.5rem !default;

.tc-tree-header {
align-items: center;
border-bottom: 0.1rem solid tokens.$coral-color-neutral-border;
border-bottom: 0.0625rem solid tokens.$coral-color-neutral-border;
color: tokens.$coral-color-neutral-text;
display: flex;
font-weight: 600;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@use '~@talend/design-tokens/lib/tokens';
@import '~@talend/bootstrap-theme/src/theme/animation';

$model-node-height: 3rem !default;
$model-node-height: 1.875rem !default;

.tc-model {
display: flex;
Expand Down Expand Up @@ -86,7 +86,7 @@ $model-node-height: 3rem !default;

&-quality-circles {
display: inherit;
padding-top: 1.3rem;
padding-top: 0.8125rem;

&-blink {
@include heartbeat(object-blink);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
@use '~@talend/bootstrap-theme/src/theme/guidelines' as *;
@use '~@talend/design-tokens/lib/tokens';

$hightlight-height: 2.2rem !default;
$hightlight-height: 1.375rem !default;
$records-node-height: $hightlight-height !default;
$border-size: 0.1rem;
$border-size: 0.0625rem;

@mixin selection($backgroundColor) {
background: $backgroundColor;
Expand Down Expand Up @@ -32,8 +32,8 @@ $border-size: 0.1rem;
}

:global(.tc-svg-icon) {
height: 1.2rem;
width: 1.2rem;
height: 0.75rem;
width: 0.75rem;
margin: 0;
vertical-align: baseline;
}
Expand Down Expand Up @@ -149,7 +149,7 @@ $border-size: 0.1rem;

.tc-leaf-overflow-icon {
position: absolute;
left: -1.7rem;
left: -1.0625rem;
margin-right: $padding-smaller;

&-chevron {
Expand Down
8 changes: 4 additions & 4 deletions packages/components/src/DataViewer/theme.module.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@use '~@talend/bootstrap-theme/src/theme/guidelines' as *;
@use '~@talend/design-tokens/lib/tokens';

$tc-layout-skeleton-width: 9.6rem !default;
$tc-layout-skeleton-height: 9.6rem !default;
$tc-layout-skeleton-width: 6rem !default;
$tc-layout-skeleton-height: 6rem !default;

.tc-twoviewers-layout {
display: flex;
Expand All @@ -26,8 +26,8 @@ $tc-layout-skeleton-height: 9.6rem !default;
}

&-left {
border-right: 0.5rem solid tokens.$coral-color-neutral-border-weak;
width: 47rem;
border-right: 0.3125rem solid tokens.$coral-color-neutral-border-weak;
width: 29.375rem;
}

&-right {
Expand Down
Loading

0 comments on commit 18c1d97

Please sign in to comment.