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

feat(styles): add palettes #3850

Merged
merged 11 commits into from
Nov 25, 2024
Merged

feat(styles): add palettes #3850

merged 11 commits into from
Nov 25, 2024

Conversation

alizedebray
Copy link
Contributor

@alizedebray alizedebray commented Oct 29, 2024

To ease the review, the changes are grouped into 3 commits:

  • feat(styles): add palette styles
  • feat(docs): add palette stories
  • chore: add palette tests

@alizedebray alizedebray requested review from a team as code owners October 29, 2024 14:29
@alizedebray alizedebray linked an issue Oct 29, 2024 that may be closed by this pull request
Copy link

changeset-bot bot commented Oct 29, 2024

🦋 Changeset detected

Latest commit: 698620b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 16 packages
Name Type
@swisspost/design-system-documentation Minor
@swisspost/design-system-styles Minor
@swisspost/design-system-components-angular-workspace Patch
@swisspost/design-system-components Minor
@swisspost/internet-header Patch
@swisspost/design-system-intranet-header-workspace Patch
@swisspost/design-system-nextjs-integration Patch
@swisspost/design-system-styles-primeng-workspace Patch
@swisspost/design-system-intranet-header Minor
@swisspost/design-system-styles-primeng Minor
@swisspost/design-system-components-react Minor
@swisspost/design-system-components-angular Minor
@swisspost/design-system-intranet-header-showcase Patch
@swisspost/design-system-tokens Minor
@swisspost/design-system-icons Minor
@swisspost/design-system-migrations Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@swisspost-bot
Copy link
Contributor

swisspost-bot commented Oct 29, 2024

Related Previews

@alizedebray alizedebray requested a review from gfellerph October 29, 2024 14:35
@alizedebray alizedebray modified the milestone: PPNL Components Oct 30, 2024
@alizedebray alizedebray force-pushed the 3432-helpers-palettes branch 5 times, most recently from f88ba29 to 51d48ab Compare November 5, 2024 15:32
@alizedebray
Copy link
Contributor Author

Accessibility tests are failing because of incorrect tokens.

Copy link
Member

@gfellerph gfellerph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looking good, though the tokens seem not to be up to date/working atm.

packages/styles/index.html Fixed Show resolved Hide resolved
@alizedebray alizedebray force-pushed the 3432-helpers-palettes branch from 2140c96 to a37cd51 Compare November 11, 2024 17:35
@alizedebray
Copy link
Contributor Author

Tokens are now working for all theme and scheme combinations.

However, there's still a problem with the dark color scheme, which can be seen in the palettes documentation.

The problem seems to be that CSS custom properties declared in the :root cannot be overridden in child elements (see the CodePen reproduction).

Suggested solution:

The palettes logic is based on a workaround that uses hard-coded token maps from this file.

I therefore recommend using these token maps to define the foreground and background colors of each palette directly. This way, we avoid relying on CSS variables.

@alizedebray alizedebray changed the base branch from main to export-palette-tokens November 14, 2024 13:34
@alizedebray alizedebray removed the request for review from oliverschuerch November 14, 2024 13:37
@alizedebray alizedebray added the 🚂 PR train PR which follows another one. label Nov 14, 2024
@alizedebray alizedebray changed the base branch from export-palette-tokens to add-cargo-theme November 14, 2024 13:51
@alizedebray alizedebray force-pushed the 3432-helpers-palettes branch from aaa77b9 to 60cd2ed Compare November 14, 2024 14:00
packages/styles/src/palettes/_mixins.scss Outdated Show resolved Hide resolved

Palettes may also include a specific text color that is different from the body color.
You can apply this text color to any element by using the `.palette-text` class.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm missing documentation for people who'd like to implement palettes, without using an entry file. What files are necessary to just get palettes to work and where can they be found?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I created a separate ticket for that since it requires changes to the StylesPackageImport component: #4025

@alizedebray
Copy link
Contributor Author

Limitations for the body color:

  • Already on main:
    The data-color-scheme attribute does not set the body color (see this reproduction)
    This issue will not be solved using the light-dark() CSS function (see this example)
    Schematic of the issue:
    image
    🠊 Resolution: set the body color for each [data-color-scheme="*"] and .palette-* selector.

  • On this PR:
    The body color is not correct for a palette that is used in nested color schemes (see this reproduction)
    This issue will also not be solved using the light-dark() CSS function (see this example)
    Schematic of the issue:
    image
    🠊 Resolution: make sure the color scheme can always be set on the palette directly and document the limitation.

Base automatically changed from add-cargo-theme to main November 21, 2024 11:07
@alizedebray alizedebray removed the 🚂 PR train PR which follows another one. label Nov 21, 2024
@alizedebray alizedebray force-pushed the 3432-helpers-palettes branch from 68776a9 to 2479b4b Compare November 21, 2024 15:11
@gfellerph
Copy link
Member

200w (1)

Nice work!

@alizedebray alizedebray merged commit baef772 into main Nov 25, 2024
9 checks passed
@alizedebray alizedebray deleted the 3432-helpers-palettes branch November 25, 2024 07:50
gfellerph pushed a commit that referenced this pull request Nov 25, 2024
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @swisspost/[email protected]

### Major Changes

- Renamed the alert component to banner and updated the styles of banner
and toast components. The class `.alert` is still supported for now but
is deprecated and will be removed in v10. Changed web component
`<post-alert>` to `<post-banner>`. Additionally, the classes
`.{toast|alert}-primary`, `.{toast|alert}-gray` and
`.toast-notification` have been deprecated. (by
[@leagrdv](https://github.com/leagrdv) with
[#3862](#3862))

- Removed the `alert-fixed-bottom` variant of the alert. (by
[@leagrdv](https://github.com/leagrdv) with
[#3862](#3862))

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Major Changes

- Renamed the alert component to banner and updated the styles of banner
and toast components. The class `.alert` is still supported for now but
is deprecated and will be removed in v10. Changed web component
`<post-alert>` to `<post-banner>`. Additionally, the classes
`.{toast|alert}-primary`, `.{toast|alert}-gray` and
`.toast-notification` have been deprecated. (by
[@leagrdv](https://github.com/leagrdv) with
[#3862](#3862))

- Removed size variants for form select. The sizing classes
`.form-select-sm`, `.form-select-rg`, `.form-select-md` and
`.form-select-lg` no longer have any effect and can be removed safely.
(by [@leagrdv](https://github.com/leagrdv) with
[#3978](#3978))

- Removed the `alert-fixed-bottom` variant of the alert. (by
[@leagrdv](https://github.com/leagrdv) with
[#3862](#3862))

- Removed sizes option for text inputs. (by
[@leagrdv](https://github.com/leagrdv) with
[#3946](#3946))

- Removed deprecated `topic-teaser`. (by
[@leagrdv](https://github.com/leagrdv) with
[#4056](#4056))

- Changed the class name of assistive text below form fields from
`.form-text` to `.form-hint` and improved accessibility by connecting
the hint to the form through `aria-describedby`. (by
[@leagrdv](https://github.com/leagrdv) with
[#3961](#3961))

### Minor Changes

- Added a new `segmented-button` component, which allows users to toggle
between two or more content sections within the same area on the screen.
(by [@alionazherdetska](https://github.com/alionazherdetska) with
[#3879](#3879))

- Internalized bootstrap overflow utilities into the design system. (by
[@leagrdv](https://github.com/leagrdv) with
[#4006](#4006))

- Updated radio-button styles with Design Tokens. (by
[@schaertim](https://github.com/schaertim) with
[#3965](#3965))

- Addes Cargo theme styles. (by
[@alizedebray](https://github.com/alizedebray) with
[#3993](#3993))

- Updated `.form-select` select to v2. (by
[@leagrdv](https://github.com/leagrdv) with
[#3978](#3978))

- Updated checkbox styles with Design Tokens. (by
[@schaertim](https://github.com/schaertim) with
[#3965](#3965))

- Updated switch styles with Design Tokens. (by
[@schaertim](https://github.com/schaertim) with
[#3965](#3965))

- Added color palettes to easily apply colors to a page section using
predefined color sets. (by
[@alizedebray](https://github.com/alizedebray) with
[#3850](#3850))

### Patch Changes

- Updated `.form-control` text input to new Post design. (by
[@leagrdv](https://github.com/leagrdv) with
[#3946](#3946))

- Updated the blockquote styles to match the new Post design. (by
[@myrta2302](https://github.com/myrta2302) with
[#3882](#3882))

## @swisspost/[email protected]

### Minor Changes

- Export new SASS maps for Post and Cargo palettes, directly linking to
the raw color values for both light and dark color schemes. (by
[@alizedebray](https://github.com/alizedebray) with
[#3992](#3992))

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]

## @swisspost/[email protected]



## @swisspost/[email protected]



## @swisspost/[email protected]

### Major Changes

- Removed deprecated `topic-teaser`. (by
[@leagrdv](https://github.com/leagrdv) with
[#4056](#4056))

### Minor Changes

- Added a new `segmented-button` component, which allows users to toggle
between two or more content sections within the same area on the screen.
(by [@alionazherdetska](https://github.com/alionazherdetska) with
[#3879](#3879))

- Internalized bootstrap overflow utilities into the design system. (by
[@leagrdv](https://github.com/leagrdv) with
[#4006](#4006))

- Renamed the alert component to banner and updated the styles of banner
and toast components. The class `.alert` is still supported for now but
is deprecated and will be removed in v10. Changed web component
`<post-alert>` to `<post-banner>`. Additionally, the classes
`.{toast|alert}-primary`, `.{toast|alert}-gray` and
`.toast-notification` have been deprecated. (by
[@leagrdv](https://github.com/leagrdv) with
[#3862](#3862))

- Simplified the markup structure for checkboxes by removing the need to
use the classes `.form-check-input` and `.form-check-label` on the input
field and the label respectively. You can safely remove these classes
from your markup, they no longer have any effect. (by
[@schaertim](https://github.com/schaertim) with
[#3965](#3965))

- Addes Cargo theme styles. (by
[@alizedebray](https://github.com/alizedebray) with
[#3993](#3993))

- Updated `.form-select` select to v2. (by
[@leagrdv](https://github.com/leagrdv) with
[#3978](#3978))

- Added color palettes to easily apply colors to a page section using
predefined color sets. (by
[@alizedebray](https://github.com/alizedebray) with
[#3850](#3850))

### Patch Changes

- Updated `.form-control` text input to new Post design. (by
[@leagrdv](https://github.com/leagrdv) with
[#3946](#3946))

- Updated the blockquote styles to match the new Post design. (by
[@myrta2302](https://github.com/myrta2302) with
[#3882](#3882))

-   Updated dependencies:
    -   @swisspost/[email protected]
    -   @swisspost/[email protected]
    -   @swisspost/[email protected]
    -   @swisspost/[email protected]
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]
    -   @swisspost/[email protected]
    -   @swisspost/[email protected]

## @swisspost/[email protected]

### Patch Changes

-   Updated dependencies:
    -   @swisspost/[email protected]

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[helpers]: Palettes
3 participants