@plone/components
Version:
ReactJS components for Plone
155 lines (133 loc) • 3.57 kB
CSS
/* depends on:
@import './Button.css';
@import './ToggleButton.css';
@import './Checkbox.css';
*/
.react-aria-Tree {
display: flex;
overflow: auto;
width: 250px;
max-height: 300px;
box-sizing: border-box;
flex-direction: column;
padding: 4px;
border: 1px solid var(--border-color);
border-radius: 6px;
background: var(--overlay-background);
forced-color-adjust: none;
gap: 2px;
outline: none;
&[data-focus-visible] {
outline: 2px solid var(--focus-ring-color);
outline-offset: -1px;
}
.react-aria-TreeItem {
position: relative;
display: flex;
min-height: 28px;
align-items: center;
padding: 0.286rem 0.286rem 0.286rem 0.571rem;
border-radius: 6px;
color: var(--text-color);
cursor: default;
font-size: 1.072rem;
gap: 0.571rem;
outline: none;
transform: translateZ(0);
--padding: 8px;
.react-aria-Button[slot='chevron'] {
all: unset;
display: flex;
width: 1.3rem;
height: 100%;
align-items: center;
justify-content: center;
padding-left: calc((var(--tree-item-level) - 1) * var(--padding));
visibility: hidden;
svg {
width: 12px;
height: 12px;
fill: none;
rotate: 0deg;
stroke: currentColor;
stroke-width: 3px;
transition: rotate 200ms;
}
}
&[data-has-child-items] .react-aria-Button[slot='chevron'] {
visibility: visible;
}
&[data-expanded] .react-aria-Button[slot='chevron'] svg {
rotate: 90deg;
}
&[data-focus-visible] {
outline: 2px solid var(--focus-ring-color);
outline-offset: -2px;
}
&[data-pressed] {
background: var(--gray-100);
}
&[data-selected] {
background: var(--highlight-background);
color: var(--highlight-foreground);
--focus-ring-color: var(--highlight-foreground);
&[data-focus-visible] {
outline-color: var(--highlight-foreground);
outline-offset: -4px;
}
.react-aria-Button {
color: var(--highlight-foreground);
--highlight-hover: rgb(255 255 255 / 0.1);
--highlight-pressed: rgb(255 255 255 / 0.2);
}
}
&[data-disabled] {
color: var(--text-color-disabled);
}
.react-aria-Button:not([slot]) {
padding: 0.286rem 0.429rem;
border: none;
margin-left: auto;
background: transparent;
font-size: 1.2rem;
line-height: 1.2em;
transition: background 200ms;
&[data-hovered] {
background: var(--highlight-hover);
}
&[data-pressed] {
background: var(--highlight-pressed);
box-shadow: none;
}
}
}
/* join selected items if :has selector is supported */
@supports selector(:has(.foo)) {
gap: 0;
.react-aria-TreeItem[data-selected]:has(+ [data-selected]) {
border-end-end-radius: 0;
border-end-start-radius: 0;
}
.react-aria-TreeItem[data-selected] + [data-selected] {
border-start-end-radius: 0;
border-start-start-radius: 0;
}
}
:where(.react-aria-TreeItem) .react-aria-Checkbox {
--selected-color: var(--highlight-foreground);
--selected-color-pressed: var(--highlight-foreground-pressed);
--checkmark-color: var(--highlight-background);
--background-color: var(--highlight-background);
}
}
.react-aria-TreeItem[data-href] {
cursor: pointer;
}
.react-aria-Tree {
&[data-empty] {
display: flex;
align-items: center;
justify-content: center;
font-style: italic;
}
}