kopia lustrzana https://github.com/shoelace-style/shoelace
77 wiersze
1.5 KiB
TypeScript
77 wiersze
1.5 KiB
TypeScript
import { css } from 'lit';
|
|
import { focusVisibleSelector } from '~/internal/focus-visible';
|
|
import componentStyles from '~/styles/component.styles';
|
|
|
|
export default css`
|
|
${componentStyles}
|
|
|
|
:host {
|
|
--divider-width: 4px;
|
|
--divider-hit-area: 12px;
|
|
--min: 0%;
|
|
--max: 100%;
|
|
|
|
display: grid;
|
|
}
|
|
|
|
.start,
|
|
.end {
|
|
overflow: hidden;
|
|
}
|
|
|
|
.divider {
|
|
flex: 0 0 var(--divider-width);
|
|
display: flex;
|
|
position: relative;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background-color: var(--sl-color-neutral-200);
|
|
color: var(--sl-color-neutral-900);
|
|
z-index: 1;
|
|
}
|
|
|
|
.divider:focus {
|
|
outline: none;
|
|
}
|
|
|
|
:host(:not([disabled])) .divider${focusVisibleSelector} {
|
|
background-color: var(--sl-color-primary-600);
|
|
color: var(--sl-color-neutral-0);
|
|
}
|
|
|
|
:host([disabled]) .divider {
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
/* Horizontal */
|
|
:host(:not([vertical], [disabled])) .divider {
|
|
cursor: col-resize;
|
|
}
|
|
|
|
:host(:not([vertical])) .divider::after {
|
|
display: flex;
|
|
content: '';
|
|
position: absolute;
|
|
height: 100%;
|
|
left: calc(var(--divider-hit-area) / -2 + var(--divider-width) / 2);
|
|
width: var(--divider-hit-area);
|
|
}
|
|
|
|
/* Vertical */
|
|
:host([vertical]) {
|
|
flex-direction: column;
|
|
}
|
|
|
|
:host([vertical]:not([disabled])) .divider {
|
|
cursor: row-resize;
|
|
}
|
|
|
|
:host([vertical]) .divider::after {
|
|
content: '';
|
|
position: absolute;
|
|
width: 100%;
|
|
top: calc(var(--divider-hit-area) / -2 + var(--divider-width) / 2);
|
|
height: var(--divider-hit-area);
|
|
}
|
|
`;
|