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

Fix precedence of the quanta layer by adding a base layer for all the… #6539

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
7 changes: 7 additions & 0 deletions docs/source/configuration/settings-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,13 @@ querystringSearchGet
[See an explanation of character limits in URLs](https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers/417184#417184).
Please test this setting properly before enabling in a production site.

cssLayers
If you want to use CSS layers in Volto styling, it's possible to define them making sure that they are defined and applied at the very top level of the page (head tag).
sneridagh marked this conversation as resolved.
Show resolved Hide resolved
By using this configuration, you can pass the layer list definition as an array:

```js
config.settings.cssLayers = ['reset', 'plone-components', 'layout', 'addons', 'theme'];
```
```

## Views settings
Expand Down
12 changes: 10 additions & 2 deletions packages/components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,19 @@ Using them as a baseline will allow you to quickly build your theme around them.
`@plone/components` basic styles provide a simple, yet powerful, set of tokenized custom CSS properties that will help you customize your own styles on the top of the basic styling.
You can override them in your classes while maintaining them for others.

### CSS layers

This package use CSS layers to provide a way to style the components in a more flexible way.
sneridagh marked this conversation as resolved.
Show resolved Hide resolved
It uses the `plone-components` layer name to scope all the CSS declarations in the package.
The basic styling uses the nested `plone-components.base` named layer.
You can use the `plone-components` layer to override the basic styling, or use the `plone-components.base` layer to override the basic styling in a more specific way.

### Quanta

This package also features the Quanta components.
The Quanta theme is an example of it.
These components use the basic styling as a baseline, not only in styling, but also in the component side, reusing the CSS and custom CSS properties in it.
These components use the basic styling as a baseline, extending them to achieve Quanta look and feel.
sneridagh marked this conversation as resolved.
Show resolved Hide resolved
They also extend the basic React components in a composable way.
The Quanta styling is scoped in the `plone-components.quanta` named layer.

Quanta is built upon the basic styles in an additive way.
The use of the Quanta CSS implies using it upon basic styling.
Expand Down
1 change: 1 addition & 0 deletions packages/components/news/6539.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed precedence of the quanta layer by adding a base layer for all the basic components. @sneridagh
sneridagh marked this conversation as resolved.
Show resolved Hide resolved
18 changes: 13 additions & 5 deletions packages/components/src/stories/Introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ import { Meta } from '@storybook/blocks';

# `@plone/components`

This package contains ReactJS components for using Plone as a headless CMS.
This package contains ReactJS components for Plone 7 and Plone's API-first CMS story.

The purpose of this package is to provide an agnostic set of baseline components to build Plone sites upon.

## Usage

Using the package manager of your choice (npm, yarn, pnpm) install the package:
Using the package manager of your choice (npm, yarn, pnpm) to install the package in your app.
sneridagh marked this conversation as resolved.
Show resolved Hide resolved
Use pnpm in case you are adding them a Volto add-on/workspace:
sneridagh marked this conversation as resolved.
Show resolved Hide resolved

```shell
yarn add @plone/components
pnpm add @plone/components
```

Whenever you want to use the components, all are exported as named exports:
Expand Down Expand Up @@ -53,12 +54,19 @@ or selectively:
import '@plone/components/src/styles/basic/TextField.css';
```

### CSS layers

This package use CSS layers to provide a way to style the components in a more flexible way.
sneridagh marked this conversation as resolved.
Show resolved Hide resolved
It uses the `plone-components` layer name to scope all the CSS declarations in the package.
The basic styling uses the nested `plone-components.base` named layer.
You can use the `plone-components` layer to override the basic styling, or use the `plone-components.base` layer to override the basic styling in a more specific way.

## Quanta
sneridagh marked this conversation as resolved.
Show resolved Hide resolved

This package also features the Quanta components.
The Quanta theme is an example of it.
These components use the basic styling as a baseline, not only in styling, but also in the component side, reusing the CSS and custom CSS properties in it.
These components use the basic styling as a baseline, extending them to achieve Quanta look and feel.
sneridagh marked this conversation as resolved.
Show resolved Hide resolved
They also extend the basic React components in a composable way.
The Quanta styling is scoped in the `plone-components.quanta` named layer.

Quanta is built upon the basic styles in an additive way.
The use of the Quanta CSS implies using it upon basic styling.
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/BlockToolbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@import './Menu.css';
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.blocks-toolbar {
display: flex;
flex-wrap: wrap;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/Breadcrumbs.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-Breadcrumbs {
display: flex;
align-items: center;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/Button.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-Button {
padding: 8px 8px;
border: 1px solid var(--border-color);
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/Calendar.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@import './Button.css';
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-Calendar {
width: fit-content;
max-width: 100%;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/Checkbox.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-Checkbox {
--selected-color: var(--highlight-background);
--selected-color-pressed: var(--highlight-background-pressed);
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/CheckboxGroup.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@import './Button.css';
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-CheckboxGroup {
display: flex;
flex-direction: column;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/ColorArea.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import './ColorSlider.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-ColorArea {
width: 192px;
height: 192px;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/ColorField.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@import './Form.css';
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-ColorField {
display: flex;
flex-direction: column;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/ColorPicker.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@import './Select.css';
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.color-picker {
display: flex;
align-items: center;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/ColorSlider.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@layer plone-components {
@layer plone-components.base {
.react-aria-ColorSlider {
display: grid;
max-width: 300px;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/ColorSwatch.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import './ColorSlider.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-ColorSwatch {
width: 32px;
height: 32px;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/ColorSwatchPicker.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@import './ColorField.css';
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-ColorSwatchPicker {
display: flex;
flex-wrap: wrap;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/ColorWheel.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@layer plone-components {
@layer plone-components.base {
.react-aria-ColorThumb {
width: 20px;
height: 20px;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/ComboBox.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@import './Button.css';
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-ComboBox {
color: var(--text-color);

Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/Container.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@layer plone-components {
@layer plone-components.base {
.q.container {
container-type: inline-size;

Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/DateField.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@import './Button.css';
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-DateField {
color: var(--text-color);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/DatePicker.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@import './Form.css';
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-DatePicker {
color: var(--text-color);

Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/DateRangePicker.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@import './Form.css';
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-DateRangePicker {
color: var(--text-color);

Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/Dialog.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@import './Modal.css';
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-Dialog {
padding: 30px;
outline: none;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/Disclosure.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@import './theme.css';
@import './Button.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-Disclosure {
.react-aria-Button[slot='trigger'] {
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/Form.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@import './Button.css';
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-Form {
display: flex;
flex-direction: column;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/GridList.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@import './ToggleButton.css';
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-GridList {
display: flex;
overflow: auto;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/Label.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-Label {
/* TODO: Review since taken from default quanta */
font-size: 0.9rem;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/Link.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-Link {
position: relative;
color: var(--link-color);
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/ListBox.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@import './Checkbox.css';
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-ListBox {
display: flex;
overflow: auto;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/Menu.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@import './Popover.css';
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-Menu {
overflow: auto;
min-width: 150px;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/Meter.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-Meter {
--fill-color: forestgreen;

Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/Modal.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@import './TextField.css';
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-ModalOverlay {
position: fixed;
z-index: 100;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/NumberField.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@import './Form.css';
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-NumberField {
margin-bottom: 8px;
color: var(--text-color);
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/Popover.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@import './Switch.css';
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-Popover {
--background-color: var(--overlay-background);
max-width: 250px;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/ProgressBar.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-ProgressBar {
display: grid;
width: 250px;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/RadioGroup.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@import './Form.css';
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-RadioGroup {
display: flex;
flex-direction: column;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/RangeCalendar.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@import './Button.css';
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-RangeCalendar {
width: fit-content;
max-width: 100%;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/SearchField.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@import './Form.css';
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-SearchField {
display: grid;
width: fit-content;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/Select.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@import './Form.css';
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-Select {
color: var(--text-color);

Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/Slider.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@import './NumberField.css';
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-Slider {
display: grid;
max-width: 300px;
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/styles/basic/Switch.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import './theme.css';

@layer plone-components {
@layer plone-components.base {
.react-aria-Switch {
display: flex;
align-items: center;
Expand Down
Loading
Loading