Skip to content

Commit cbf00a8

Browse files
authored
feat: add data-ui5-compact-size attribute to root when compact is set (#382)
- in order to have easier styling of the sizes of the components all the css should be applied to the root of the element (such as width, height, etc). - when having a compact size setting applied, all components should change their sizes, in order to track this change in the css we add a private data attribute to the root of each element
1 parent 8220d16 commit cbf00a8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/base/src/UI5Element.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getWCNoConflict } from "./Configuration.js";
1+
import { getWCNoConflict, getCompactSize } from "./Configuration.js";
22
import DOMObserver from "./compatibility/DOMObserver.js";
33
import ShadowDOM from "./compatibility/ShadowDOM.js";
44
import UI5ElementMetadata from "./UI5ElementMetadata.js";
@@ -78,6 +78,12 @@ class UI5Element extends HTMLElement {
7878
}
7979

8080
async _initializeShadowRoot() {
81+
const isCompact = getCompactSize();
82+
83+
if (isCompact) {
84+
this.setAttribute("data-ui5-compact-size", "");
85+
}
86+
8187
if (this.constructor.getMetadata().getNoShadowDOM()) {
8288
return Promise.resolve();
8389
}

0 commit comments

Comments
 (0)