Skip to content

Commit 487ba9e

Browse files
authored
Merge branch 'v1/contrib' into feature/no-implicit-lit
2 parents 7155ee1 + 12feafb commit 487ba9e

File tree

16 files changed

+239
-62
lines changed

16 files changed

+239
-62
lines changed

.github/workflows/dependency-review.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ jobs:
1717
- name: 'Checkout Repository'
1818
uses: actions/checkout@v4
1919
- name: 'Dependency Review'
20-
uses: actions/dependency-review-action@v3
20+
uses: actions/dependency-review-action@v4

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
"tsc-files": "1.1.4",
129129
"turbo": "1.11.3",
130130
"typescript": "5.2.2",
131-
"vite": "5.0.5",
131+
"vite": "5.0.12",
132132
"vite-tsconfig-paths": "4.2.0",
133133
"web-component-analyzer": "2.0.0"
134134
},

packages/uui-box/lib/uui-box.element.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ function slotHasContent(target: EventTarget | null): boolean {
1818
* @slot header - header area, use this for things that are not the headline but are located in the header.
1919
* @slot header-actions - right-side of the box header, use this to append some actions that are general for the topic of this box.
2020
* @slot - area for the content of the box
21+
* @cssprop --uui-box-header-padding - overwrite the header padding
2122
* @cssprop --uui-box-default-padding - overwrite the box padding
2223
*
2324
*/
@@ -128,7 +129,10 @@ export class UUIBoxElement extends LitElement {
128129
display: flex;
129130
column-gap: var(--uui-size-space-5);
130131
border-bottom: 1px solid var(--uui-color-divider-standalone);
131-
padding: var(--uui-size-space-4) var(--uui-size-space-5);
132+
padding: var(
133+
--uui-box-header-padding,
134+
var(--uui-size-space-4) var(--uui-size-space-5)
135+
);
132136
}
133137
134138
slot:not([name]) {

packages/uui-popover-container/lib/uui-popover-container.element.ts

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export class UUIPopoverContainerElement extends LitElement {
6969
_actualPlacement: PopoverContainerPlacement = this._placement;
7070

7171
#targetElement: HTMLElement | null = null;
72+
#scrollParents: Element[] = [];
7273

7374
connectedCallback(): void {
7475
//TODO: Remove this polyfill when firefox supports the new popover API
@@ -85,6 +86,7 @@ export class UUIPopoverContainerElement extends LitElement {
8586
disconnectedCallback(): void {
8687
super.disconnectedCallback();
8788
this.removeEventListener('beforetoggle', this.#onBeforeToggle);
89+
this.#stopScrollListener();
8890
}
8991

9092
#onBeforeToggle = (event: any) => {
@@ -96,6 +98,8 @@ export class UUIPopoverContainerElement extends LitElement {
9698
this.id
9799
);
98100

101+
this.#getScrollParents();
102+
99103
// Dispatch a custom event that can be listened to by the popover target.
100104
// Mostly used for UUIButton.
101105
this.#targetElement?.dispatchEvent(
@@ -110,11 +114,11 @@ export class UUIPopoverContainerElement extends LitElement {
110114
);
111115

112116
if (!this._open) {
113-
document.removeEventListener('scroll', this.#initUpdate);
117+
this.#stopScrollListener();
114118
return;
115119
}
116120

117-
document.addEventListener('scroll', this.#initUpdate);
121+
this.#startScrollListener();
118122

119123
requestAnimationFrame(() => {
120124
this.#initUpdate();
@@ -305,6 +309,52 @@ export class UUIPopoverContainerElement extends LitElement {
305309
`${oppositeDirection}-${position}` as PopoverContainerPlacement;
306310
}
307311

312+
#startScrollListener() {
313+
this.#scrollParents.forEach(el => {
314+
el.addEventListener('scroll', this.#initUpdate, { passive: true });
315+
});
316+
document.addEventListener('scroll', this.#initUpdate, { passive: true });
317+
}
318+
#stopScrollListener() {
319+
this.#scrollParents.forEach(el => {
320+
el.removeEventListener('scroll', this.#initUpdate);
321+
});
322+
document.removeEventListener('scroll', this.#initUpdate);
323+
}
324+
325+
#getScrollParents(): any {
326+
if (!this.#targetElement) return;
327+
328+
let style = getComputedStyle(this.#targetElement);
329+
if (style.position === 'fixed') {
330+
return;
331+
}
332+
333+
const includeHidden = false;
334+
const excludeStaticParent = style.position === 'absolute';
335+
const overflowRegex = includeHidden
336+
? /(auto|scroll|hidden)/
337+
: /(auto|scroll)/;
338+
339+
let el = this.#targetElement;
340+
while ((el = el.parentElement as HTMLElement)) {
341+
style = getComputedStyle(el);
342+
343+
if (excludeStaticParent && style.position === 'static') {
344+
continue;
345+
}
346+
if (
347+
overflowRegex.test(style.overflow + style.overflowY + style.overflowX)
348+
) {
349+
this.#scrollParents.push(el);
350+
}
351+
if (style.position === 'fixed') {
352+
return;
353+
}
354+
}
355+
this.#scrollParents.push(document.body);
356+
}
357+
308358
render() {
309359
return html`<slot></slot>`;
310360
}

packages/uui-popover-container/lib/uui-popover-container.story.ts

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,61 @@ export const Tooltip: Story = {
158158
</uui-popover-container>
159159
`,
160160
};
161+
162+
export const InsideScrollContainer: Story = {
163+
args: {
164+
placement: 'bottom-start',
165+
margin: 0,
166+
},
167+
argTypes: {
168+
open: {
169+
control: false,
170+
},
171+
placement: {
172+
options: [
173+
'auto',
174+
'top',
175+
'top-start',
176+
'top-end',
177+
'bottom',
178+
'bottom-start',
179+
'bottom-end',
180+
'right',
181+
'right-start',
182+
'right-end',
183+
'left',
184+
'left-start',
185+
'left-end',
186+
],
187+
},
188+
},
189+
render: args => html`
190+
<div style="height: 500px; overflow: auto; outline: 1px solid black">
191+
<div
192+
style="width: 300px; height: 300px; outline: 1px solid black; overflow: auto;">
193+
<div style="height: 150px"></div>
194+
<uui-button
195+
id="popover-button"
196+
popovertarget="popover-container"
197+
look="primary"
198+
label="Open popover">
199+
Open popover
200+
</uui-button>
201+
<div style="height: 150px"></div>
202+
<div style="height: 150px"></div>
203+
</div>
204+
<div style="height: 400px"></div>
205+
</div>
206+
<uui-popover-container
207+
id="popover-container"
208+
popover
209+
placement=${args.placement}
210+
margin=${args.margin}>
211+
<div
212+
style="width: 100%; background-color: var(--uui-color-surface); max-width: 200px; box-shadow: var(--uui-shadow-depth-4); padding: var(--uui-size-space-4); border-radius: var(--uui-border-radius); font-size: 0.9rem;">
213+
<h3>Scroll!</h3>
214+
Scrolling in any of the 2 boxes should trigger an update
215+
</div>
216+
</uui-popover-container>
217+
`,
218+
};

packages/uui-ref-node-data-type/lib/uui-ref-node-data-type.story.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,22 +81,25 @@ CustomIcon.parameters = {
8181
},
8282
};
8383

84-
export const Border: Story = () => html`
84+
export const Standalone: Story = () => html`
8585
<div style="max-width: 420px;">
86-
<uui-ref-node-data-type border name="TextField" alias="Umbraco.TextField">
86+
<uui-ref-node-data-type
87+
standalone
88+
name="TextField"
89+
alias="Umbraco.TextField">
8790
<uui-action-bar slot="actions">
8891
<uui-button label="Remove">Remove</uui-button>
8992
</uui-action-bar>
9093
</uui-ref-node-data-type>
9194
</div>
9295
`;
9396

94-
Border.parameters = {
97+
Standalone.parameters = {
9598
docs: {
9699
source: {
97100
code: `
98101
<uui-ref-node-data-type
99-
border
102+
standalone
100103
name="TextField"
101104
alias="Umbraco.TextField">
102105
<uui-action-bar slot="actions">

packages/uui-ref-node-document-type/lib/uui-ref-node-document-type.story.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,22 +81,25 @@ CustomIcon.parameters = {
8181
},
8282
};
8383

84-
export const Border: Story = () => html`
84+
export const Standalone: Story = () => html`
8585
<div style="max-width: 420px;">
86-
<uui-ref-node-document-type border name="Product Page" alias="productPage">
86+
<uui-ref-node-document-type
87+
standalone
88+
name="Product Page"
89+
alias="productPage">
8790
<uui-action-bar slot="actions">
8891
<uui-button label="Remove">Remove</uui-button>
8992
</uui-action-bar>
9093
</uui-ref-node-document-type>
9194
</div>
9295
`;
9396

94-
Border.parameters = {
97+
Standalone.parameters = {
9598
docs: {
9699
source: {
97100
code: `
98101
<uui-ref-node-document-type
99-
border
102+
standalone
100103
name="Product Page"
101104
alias="productPage">
102105
<uui-action-bar slot="actions">

packages/uui-ref-node-form/lib/uui-ref-node-form.story.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ CustomIcon.parameters = {
8282
},
8383
};
8484

85-
export const Border: Story = () => html`
85+
export const Standalone: Story = () => html`
8686
<div style="max-width: 420px;">
8787
<uui-ref-node-form
88-
border
88+
standalone
8989
name="Newsletter Signup"
9090
detail="Signup for newsletter">
9191
<uui-action-bar slot="actions">
@@ -95,12 +95,12 @@ export const Border: Story = () => html`
9595
</div>
9696
`;
9797

98-
Border.parameters = {
98+
Standalone.parameters = {
9999
docs: {
100100
source: {
101101
code: `
102102
<uui-ref-node-form
103-
border
103+
standalone
104104
name="Newsletter Signup"
105105
detail="Signup for newsletter">
106106
<uui-action-bar slot="actions">

packages/uui-ref-node-member/lib/uui-ref-node-member.story.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ CustomIcon.parameters = {
8383
},
8484
};
8585

86-
export const Border: Story = () => html`
86+
export const Standalone: Story = () => html`
8787
<div style="max-width: 420px;">
8888
<uui-ref-node-member
89-
border
89+
standalone
9090
name="Arnold Vitz"
9191
group-name="Visitor, Registered-Member">
9292
<uui-action-bar slot="actions">
@@ -96,12 +96,12 @@ export const Border: Story = () => html`
9696
</div>
9797
`;
9898

99-
Border.parameters = {
99+
Standalone.parameters = {
100100
docs: {
101101
source: {
102102
code: `
103103
<uui-ref-node-member
104-
border
104+
standalone
105105
name="Arnold Vitz"
106106
group-name="Visitor, Registered-Member">
107107
<uui-action-bar slot="actions">

0 commit comments

Comments
 (0)