Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
56 changes: 41 additions & 15 deletions packages/scroller/src/styles/vaadin-scroller-base-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,18 @@ import { css } from 'lit';

export const scrollerStyles = css`
:host {
--_indicator-height: var(--vaadin-scroller-overflow-indicator-height, 1px);
/* Don't let these properties inherit */
--vaadin-scroller-padding-block: 0px;
--vaadin-scroller-padding-inline: 0px;
--vaadin-scroller-overflow-indicator-top-opacity: 0;
--vaadin-scroller-overflow-indicator-bottom-opacity: 0;
display: block;
overflow: auto;
outline: none;
flex: 1;
box-sizing: border-box;
padding: 0 var(--vaadin-scroller-padding-inline);
}

:host([focus-ring]) {
Expand All @@ -33,27 +42,44 @@ export const scrollerStyles = css`
overflow: hidden;
}

:host([theme*='overflow-indicator'])::before,
:host([theme*='overflow-indicator'])::after {
:host::before,
:host::after {
content: '';
display: none;
display: block;
opacity: 0;
position: sticky;
inset: 0;
inset: 0 calc(var(--vaadin-scroller-padding-inline) * -1);
z-index: 9999;
height: 1px;
margin-bottom: -1px;
background: var(--vaadin-scroller-border-color, var(--vaadin-border-color-secondary));
pointer-events: none;
box-sizing: border-box;
height: var(--_indicator-height);
margin-inline: calc(var(--vaadin-scroller-padding-inline) * -1);
background: var(--vaadin-border-color-secondary);
}

:host([theme*='overflow-indicator'])::after {
margin-bottom: 0;
margin-top: -1px;
:host::before {
margin-bottom: calc(var(--vaadin-scroller-padding-block) - var(--_indicator-height));
}

:host([theme~='overflow-indicator-top'][overflow~='top'])::before,
:host([theme~='overflow-indicators'][overflow~='top'])::before,
:host([theme~='overflow-indicators'][overflow~='bottom'])::after,
:host([theme~='overflow-indicator-bottom'][overflow~='bottom'])::after {
display: block;
:host::after {
margin-top: calc(var(--vaadin-scroller-padding-block) - var(--_indicator-height));
}

:host([overflow~='top'])::before {
opacity: var(--vaadin-scroller-overflow-indicator-top-opacity);
}

:host([overflow~='bottom'])::after {
opacity: var(--vaadin-scroller-overflow-indicator-bottom-opacity);
}

:host([theme~='overflow-indicator-top'][overflow~='top']),
:host([theme~='overflow-indicators'][overflow~='top']) {
--vaadin-scroller-overflow-indicator-top-opacity: 1;
}

:host([theme~='overflow-indicators'][overflow~='bottom']),
:host([theme~='overflow-indicator-bottom'][overflow~='bottom']) {
--vaadin-scroller-overflow-indicator-bottom-opacity: 1;
}
`;
25 changes: 24 additions & 1 deletion packages/scroller/src/vaadin-scroller.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,36 @@ import { ScrollerMixin } from './vaadin-scroller-mixin.js';
* </vaadin-scroller>
* ```
*
* The following attributes are exposed for styling:
* ### Styling
*
* The following state attributes are available for styling:
*
* Attribute | Description
* -------------| -----------
* `focus-ring` | Set when the element is focused using the keyboard.
* `focused` | Set when the element is focused.
* `overflow` | Set to `top`, `bottom`, `start`, `end`, all of them, or none.
*
* ### Built-in Theme Variants
*
* `<vaadin-scroller>` supports the following theme variants:
*
* Theme variant | Description
* -----------------------------------------|---------------
* `theme="overflow-indicators"` | Shows visual indicators at the top and bottom when the content is scrolled
* `theme="overflow-indicator-top"` | Shows the visual indicator at the top when the content is scrolled
* `theme="overflow-indicator-top-bottom"` | Shows the visual indicator at the bottom when the content is scrolled
*
* ### Custom CSS Properties
*
* The following custom CSS properties are available for styling:
*
* Custom CSS property | Description
* -----------------------------------|-------------
* `--vaadin-scroller-padding-block` | The CSS padding applied to top and bottom edges
* `--vaadin-scroller-padding-inline` | The CSS padding applied to left and right edges
*
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
*/
declare class Scroller extends ScrollerMixin(ThemableMixin(ElementMixin(HTMLElement))) {}

Expand Down
25 changes: 24 additions & 1 deletion packages/scroller/src/vaadin-scroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,37 @@ import { ScrollerMixin } from './vaadin-scroller-mixin.js';
* </vaadin-scroller>
* ```
*
* The following attributes are exposed for styling:
* ### Styling
*
* The following state attributes are available for styling:
*
* Attribute | Description
* -------------| -----------
* `focus-ring` | Set when the element is focused using the keyboard.
* `focused` | Set when the element is focused.
* `overflow` | Set to `top`, `bottom`, `start`, `end`, all of them, or none.
*
* ### Built-in Theme Variants
*
* `<vaadin-scroller>` supports the following theme variants:
*
* Theme variant | Description
* -----------------------------------------|---------------
* `theme="overflow-indicators"` | Shows visual indicators at the top and bottom when the content is scrolled
* `theme="overflow-indicator-top"` | Shows the visual indicator at the top when the content is scrolled
* `theme="overflow-indicator-top-bottom"` | Shows the visual indicator at the bottom when the content is scrolled
*
* ### Custom CSS Properties
*
* The following custom CSS properties are available for styling:
*
* Custom CSS property | Description
* -----------------------------------|-------------
* `--vaadin-scroller-padding-block` | The CSS padding applied to top and bottom edges
* `--vaadin-scroller-padding-inline` | The CSS padding applied to left and right edges
*
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
*
* @customElement
* @extends HTMLElement
* @mixes ThemableMixin
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 9 additions & 9 deletions packages/tabsheet/src/styles/vaadin-tabsheet-base-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ export const tabSheetStyles = [
position: relative;
flex: 1;
box-sizing: border-box;
padding: var(--vaadin-tabsheet-padding, var(--vaadin-padding-l));
border-top: var(--vaadin-tabsheet-border-width, 1px) solid transparent;
margin-top: calc(var(--vaadin-tabsheet-border-width, 1px) * -1);
--vaadin-scroller-padding-block: var(--vaadin-tabsheet-padding, var(--vaadin-padding-m));
--vaadin-scroller-padding-inline: var(--vaadin-tabsheet-padding, var(--vaadin-padding-m));
--vaadin-scroller-overflow-indicator-top-opacity: 1;
}

[part='content'][focus-ring] {
Expand All @@ -57,14 +57,12 @@ export const tabSheetStyles = [
outline-offset: calc(var(--vaadin-focus-ring-width) * -1);
}

[part='content'][overflow~='top'] {
border-top-color: var(--vaadin-tabsheet-border-color, var(--vaadin-border-color-secondary));
:host([loading]) [part='content'] {
align-content: center;
}

:host([loading]) [part='content'] {
display: flex;
align-items: center;
justify-content: center;
[part='loader'] {
margin: auto;
}

:host([theme~='no-border']) {
Expand All @@ -74,6 +72,8 @@ export const tabSheetStyles = [

:host([theme~='no-padding']) [part='content'] {
padding: 0 !important;
--vaadin-scroller-padding-block: 0px !important;
--vaadin-scroller-padding-inline: 0px !important;
}
`,
];
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion packages/vaadin-lumo-styles/src/components/tabsheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
position: relative;
flex: 1;
box-sizing: border-box;
padding: var(--lumo-space-s) var(--lumo-space-m);
--vaadin-scroller-padding-block: var(--lumo-space-s);
--vaadin-scroller-padding-inline: var(--lumo-space-m);
border-bottom-left-radius: inherit;
border-bottom-right-radius: inherit;
}
Expand All @@ -59,5 +60,7 @@

:host([theme~='no-padding']) [part='content'] {
padding: 0 !important;
--vaadin-scroller-padding-block: 0px !important;
--vaadin-scroller-padding-inline: 0px !important;
}
}
56 changes: 40 additions & 16 deletions packages/virtual-list/src/styles/vaadin-virtual-list-base-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,46 +8,70 @@ import { css } from 'lit';

export const virtualListStyles = css`
:host {
/* Don't let these properties inherit */
--vaadin-virtual-list-padding-block: 0px;
--vaadin-virtual-list-padding-inline: 0px;
Comment on lines +12 to +13
Copy link
Member

Choose a reason for hiding this comment

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

Are these supposed to be used by Aura? Also, should we document them in the JSDoc API?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think themes would set those by default. They are intended more for app devs if they want to apply padding to the scroll containers. But regardless, they should be documented, yes.

--vaadin-virtual-list-overflow-indicator-top-opacity: 0;
--vaadin-virtual-list-overflow-indicator-bottom-opacity: 0;
display: block;
height: 400px;
overflow: auto;
flex: auto;
flex: 1;
align-self: stretch;
box-sizing: border-box;
padding: 0;
--_indicator-height: var(--vaadin-virtual-list-overflow-indicator-height, 1px);
}

:host([hidden]) {
display: none !important;
}

:host(:not([grid])) #items > ::slotted(*) {
width: 100%;
inset-inline: var(--vaadin-virtual-list-padding-inline);
}

#items {
position: relative;
}

:host([theme*='overflow-indicator'])::before,
:host([theme*='overflow-indicator'])::after {
:host::before,
:host::after {
content: '';
display: none;
display: block;
opacity: 0;
position: sticky;
inset: 0;
z-index: 9999;
height: 1px;
margin-bottom: -1px;
background: var(--vaadin-virtual-list-border-color, var(--vaadin-border-color-secondary));
pointer-events: none;
box-sizing: border-box;
height: var(--_indicator-height);
background: var(--vaadin-border-color-secondary);
}

:host([theme*='overflow-indicator'])::after {
margin-bottom: 0;
margin-top: -1px;
:host::before {
margin-bottom: calc(var(--vaadin-virtual-list-padding-block) - var(--_indicator-height));
}

:host([theme~='overflow-indicator-top'][overflow~='top'])::before,
:host([theme~='overflow-indicators'][overflow~='top'])::before,
:host([theme~='overflow-indicators'][overflow~='bottom'])::after,
:host([theme~='overflow-indicator-bottom'][overflow~='bottom'])::after {
display: block;
:host::after {
margin-top: calc(var(--vaadin-virtual-list-padding-block) - var(--_indicator-height));
}

:host([overflow~='top'])::before {
opacity: var(--vaadin-virtual-list-overflow-indicator-top-opacity);
}

:host([overflow~='bottom'])::after {
opacity: var(--vaadin-virtual-list-overflow-indicator-bottom-opacity);
}

:host([theme~='overflow-indicator-top'][overflow~='top']),
:host([theme~='overflow-indicators'][overflow~='top']) {
--vaadin-virtual-list-overflow-indicator-top-opacity: 1;
}

:host([theme~='overflow-indicators'][overflow~='bottom']),
:host([theme~='overflow-indicator-bottom'][overflow~='bottom']) {
--vaadin-virtual-list-overflow-indicator-bottom-opacity: 1;
}
`;
23 changes: 22 additions & 1 deletion packages/virtual-list/src/vaadin-virtual-list.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,34 @@ export { VirtualListDefaultItem, VirtualListItemModel, VirtualListRenderer };
* }
* ```
*
* ### Styling
*
* The following state attributes are available for styling:
*
* Attribute | Description
* -----------------|--------------------------------------------
* `overflow` | Set to `top`, `bottom`, both, or none.
*
* See [Virtual List](https://vaadin.com/docs/latest/components/virtual-list) documentation.
* ### Built-in Theme Variants
*
* `<vaadin-virtual-list>` supports the following theme variants:
*
* Theme variant | Description
* -----------------------------------------|---------------
* `theme="overflow-indicators"` | Shows visual indicators at the top and bottom when the content is scrolled
* `theme="overflow-indicator-top"` | Shows the visual indicator at the top when the content is scrolled
* `theme="overflow-indicator-top-bottom"` | Shows the visual indicator at the bottom when the content is scrolled
*
* ### Custom CSS Properties
*
* The following custom CSS properties are available for styling:
*
* Custom CSS property | Description
* ---------------------------------------|-------------
* `--vaadin-virtual-list-padding-block` | The CSS padding applied to top and bottom edges
* `--vaadin-virtual-list-padding-inline` | The CSS padding applied to left and right edges
*
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
*/
declare class VirtualList<TItem = VirtualListDefaultItem> extends ThemableMixin(ElementMixin(HTMLElement)) {}

Expand Down
23 changes: 22 additions & 1 deletion packages/virtual-list/src/vaadin-virtual-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,34 @@ import { VirtualListMixin } from './vaadin-virtual-list-mixin.js';
* }
* ```
*
* ### Styling
*
* The following state attributes are available for styling:
*
* Attribute | Description
* -----------------|--------------------------------------------
* `overflow` | Set to `top`, `bottom`, both, or none.
*
* See [Virtual List](https://vaadin.com/docs/latest/components/virtual-list) documentation.
* ### Built-in Theme Variants
*
* `<vaadin-virtual-list>` supports the following theme variants:
*
* Theme variant | Description
* -----------------------------------------|---------------
* `theme="overflow-indicators"` | Shows visual indicators at the top and bottom when the content is scrolled
* `theme="overflow-indicator-top"` | Shows the visual indicator at the top when the content is scrolled
* `theme="overflow-indicator-top-bottom"` | Shows the visual indicator at the bottom when the content is scrolled
*
* ### Custom CSS Properties
*
* The following custom CSS properties are available for styling:
*
* Custom CSS property | Description
* ---------------------------------------|-------------
* `--vaadin-virtual-list-padding-block` | The CSS padding applied to top and bottom edges
* `--vaadin-virtual-list-padding-inline` | The CSS padding applied to left and right edges
*
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
*
* @customElement
* @extends HTMLElement
Expand Down