@@ -64,6 +64,7 @@ export class DaysOfWeekSelector extends ResizeMixin(ThemableMixin(LitElement)) {
6464 flex-wrap: nowrap;
6565 overflow: hidden;
6666 align-items: center;
67+ gap: var(--fc-days-of-week-selector-button-space, var(--lumo-space-m));
6768 }
6869
6970 [part="overflow-badge"] {
@@ -94,10 +95,14 @@ export class DaysOfWeekSelector extends ResizeMixin(ThemableMixin(LitElement)) {
9495 box-sizing: border-box;
9596 }
9697
98+ [part="container"] vaadin-context-menu {
99+ margin-left: calc(var(--lumo-space-s) * -1);
100+ }
101+
97102 ::slotted([slot="overflowIcon"]) {
98103 --lumo-icon-size-m: var(--fc-days-of-week-selector-overflow-icon-size, 1em);
99104 }
100-
105+
101106 /* Style the fallback < vaadin-icon > inside the slot */
102107 vaadin-icon.overflow-icon {
103108 --lumo-icon-size-m: var(--fc-days-of-week-selector-overflow-icon-size, 0.75em);
@@ -157,15 +162,17 @@ export class DaysOfWeekSelector extends ResizeMixin(ThemableMixin(LitElement)) {
157162 }
158163
159164 private _updateOnOverflow ( ) {
160- const containerWidth = this . getBoundingClientRect ( ) . width ;
165+ const containerWidth = this . _container . getBoundingClientRect ( ) . width ;
166+ const containerGap = parseFloat ( getComputedStyle ( this . _container ) . gap ) || 0 ;
167+
161168 let usedWidth = 0 ;
162169 const overflowButtons : Node [ ] = [ ] ;
163170 const overflowButtonWidth = this . _getOverflowButtonWidth ( ) ;
164171
165172 for ( const button of this . _daysOfWeek ) {
166173 button . style . display = '' ;
167- const width = button . getBoundingClientRect ( ) . width ;
168-
174+ // Add gap only for buttons after the first.
175+ const width = button . getBoundingClientRect ( ) . width + ( usedWidth > 0 ? containerGap : 0 ) ;
169176 if ( usedWidth + width > containerWidth - overflowButtonWidth ) {
170177 const clonedButton = this . _cloneButton ( button ) ;
171178 overflowButtons . push ( clonedButton ) ;
0 commit comments