Skip to content

Commit fd290a4

Browse files
authored
fix: Remove local definition of --uui-box-default-padding for uui-box (#189)
* remove local definition of --uui-box-default-padding * better description of slots * test --uui-box-default-padding can be defined outside scope BREAKING CHANGE: This should now be configured globally
1 parent b2d69bf commit fd290a4

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import { UUITextStyles } from '@umbraco-ui/uui-css/lib';
66
/**
77
* A box for grouping elements
88
* @element uui-box
9-
* @slot headline - headline area
10-
* @slot header - headline area
9+
* @slot headline - headline area, this area is placed within the headline tag which is located inside the header. Use this to ensure the right headline styling.
10+
* @slot header - header area, use this for things that is not the headline but located in the header.
1111
* @slot default - area for the content of the box
1212
* @cssprop --uui-box-default-padding - overwrite the box padding
1313
*
@@ -22,7 +22,6 @@ export class UUIBoxElement extends LitElement {
2222
box-shadow: var(--uui-shadow-depth-1);
2323
border-radius: var(--uui-border-radius);
2424
background-color: var(--uui-interface-surface);
25-
--uui-box-default-padding: var(--uui-size-space-5);
2625
}
2726
2827
#header {

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,24 @@ describe('UUIBox', () => {
2424
});
2525
});
2626

27+
describe('css custom properties', () => {
28+
let wrapper: HTMLDivElement;
29+
let element: UUIBoxElement;
30+
beforeEach(async () => {
31+
wrapper = (await fixture(html`<div
32+
style="--uui-box-default-padding:1337px;">
33+
<uui-box headline="headline"> Main </uui-box>
34+
</div>`)) as HTMLDivElement;
35+
element = wrapper.querySelector('uui-box')!;
36+
});
37+
it('allows for --uui-box-default-padding to be defined outside the scope.', () => {
38+
const elementStyles = window.getComputedStyle(element);
39+
expect(
40+
elementStyles.getPropertyValue('--uui-box-default-padding').trim()
41+
).to.equal('1337px');
42+
});
43+
});
44+
2745
describe('template', () => {
2846
it('renders a default slot', () => {
2947
const slot = element.shadowRoot!.querySelector('slot')!;

0 commit comments

Comments
 (0)