@rettangoli/ui 1.0.22 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rettangoli-iife-layout.min.js +3 -2
- package/dist/rettangoli-iife-ui.min.js +35 -34
- package/package.json +1 -1
- package/src/components/sidebar/sidebar.handlers.js +23 -3
- package/src/components/sidebar/sidebar.schema.yaml +4 -0
- package/src/components/sidebar/sidebar.store.js +10 -2
- package/src/primitives/dialog.js +4 -1
- package/src/primitives/popover.js +2 -1
package/package.json
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
const parseBooleanProp = (value) => {
|
|
2
|
+
if (value === true) {
|
|
3
|
+
return true;
|
|
4
|
+
}
|
|
5
|
+
if (value === false || value === undefined || value === null) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
if (typeof value === 'string') {
|
|
9
|
+
const normalizedValue = value.trim().toLowerCase();
|
|
10
|
+
return normalizedValue === '' || normalizedValue === 'true';
|
|
11
|
+
}
|
|
12
|
+
return false;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const resolveCompactTooltipEnabled = (props = {}) => {
|
|
16
|
+
if (props.tooltip !== undefined && props.tooltip !== null) {
|
|
17
|
+
return parseBooleanProp(props.tooltip);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return parseBooleanProp(props.showCompactTooltip);
|
|
21
|
+
};
|
|
22
|
+
|
|
1
23
|
export const handleHeaderClick = (deps, payload) => {
|
|
2
24
|
const { store, dispatchEvent } = deps;
|
|
3
25
|
const event = payload._event;
|
|
@@ -41,9 +63,7 @@ export const handleItemClick = (deps, payload) => {
|
|
|
41
63
|
|
|
42
64
|
export const handleItemMouseEnter = (deps, payload) => {
|
|
43
65
|
const { props, store, render } = deps;
|
|
44
|
-
const showCompactTooltip = props
|
|
45
|
-
props.showCompactTooltip === '' ||
|
|
46
|
-
props.showCompactTooltip === 'true';
|
|
66
|
+
const showCompactTooltip = resolveCompactTooltipEnabled(props);
|
|
47
67
|
|
|
48
68
|
if (!showCompactTooltip || (props.mode || 'full') === 'full') {
|
|
49
69
|
return;
|
|
@@ -7,9 +7,13 @@ propsSchema:
|
|
|
7
7
|
hideHeader:
|
|
8
8
|
type: boolean
|
|
9
9
|
default: false
|
|
10
|
+
tooltip:
|
|
11
|
+
type: boolean
|
|
12
|
+
default: false
|
|
10
13
|
showCompactTooltip:
|
|
11
14
|
type: boolean
|
|
12
15
|
default: false
|
|
16
|
+
description: Deprecated alias for tooltip. Use tooltip instead.
|
|
13
17
|
w:
|
|
14
18
|
type: string
|
|
15
19
|
bwr:
|
|
@@ -8,7 +8,7 @@ export const createInitialState = () => Object.freeze({
|
|
|
8
8
|
},
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
const blacklistedAttrs = ['id', 'class', 'style', 'slot', 'header', 'items', 'selectedItemId', 'mode', 'hideHeader', 'showCompactTooltip', 'w', 'bwr'];
|
|
11
|
+
const blacklistedAttrs = ['id', 'class', 'style', 'slot', 'header', 'items', 'selectedItemId', 'mode', 'hideHeader', 'tooltip', 'showCompactTooltip', 'w', 'bwr'];
|
|
12
12
|
|
|
13
13
|
const stringifyAttrs = (props = {}) => {
|
|
14
14
|
return Object.entries(props).filter(([key]) => !blacklistedAttrs.includes(key)).map(([key, value]) => `${key}=${value}`).join(' ');
|
|
@@ -50,6 +50,14 @@ const parseBooleanProp = (value) => {
|
|
|
50
50
|
return false;
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
+
const resolveCompactTooltipEnabled = (props = {}) => {
|
|
54
|
+
if (props.tooltip !== undefined && props.tooltip !== null) {
|
|
55
|
+
return parseBooleanProp(props.tooltip);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return parseBooleanProp(props.showCompactTooltip);
|
|
59
|
+
};
|
|
60
|
+
|
|
53
61
|
const resolveSidebarWidth = (value, mode) => {
|
|
54
62
|
if (value !== undefined && value !== null && value !== '') {
|
|
55
63
|
return value;
|
|
@@ -142,7 +150,7 @@ export const selectViewData = ({ state, props }) => {
|
|
|
142
150
|
const items = resolvedItems ? flattenItems(resolvedItems, selectedItemId) : [];
|
|
143
151
|
|
|
144
152
|
const showHeader = !parseBooleanProp(props.hideHeader);
|
|
145
|
-
const showCompactTooltip =
|
|
153
|
+
const showCompactTooltip = resolveCompactTooltipEnabled(props);
|
|
146
154
|
const rightBorderWidth = props.bwr || 'xs';
|
|
147
155
|
// Computed values based on mode
|
|
148
156
|
const sidebarWidth = resolveSidebarWidth(props.w, mode);
|
package/src/primitives/dialog.js
CHANGED
|
@@ -229,7 +229,10 @@ class RettangoliDialogElement extends HTMLElement {
|
|
|
229
229
|
|
|
230
230
|
window.addEventListener("resize", this._onWindowResize);
|
|
231
231
|
this._observeAssignedContent();
|
|
232
|
-
this.
|
|
232
|
+
this._layoutRetryCount = 0;
|
|
233
|
+
// Apply the first centering pass before paint so the enter animation
|
|
234
|
+
// starts from the final position instead of jumping after mount.
|
|
235
|
+
this._applyAdaptiveCentering();
|
|
233
236
|
}
|
|
234
237
|
}
|
|
235
238
|
|
|
@@ -25,6 +25,7 @@ class RettangoliPopoverElement extends HTMLElement {
|
|
|
25
25
|
left: 0;
|
|
26
26
|
width: 100vw;
|
|
27
27
|
height: 100vh;
|
|
28
|
+
z-index: 2000;
|
|
28
29
|
/* Prevent dialog from being focused */
|
|
29
30
|
pointer-events: none;
|
|
30
31
|
}
|
|
@@ -37,7 +38,7 @@ class RettangoliPopoverElement extends HTMLElement {
|
|
|
37
38
|
|
|
38
39
|
.popover-container {
|
|
39
40
|
position: fixed;
|
|
40
|
-
z-index:
|
|
41
|
+
z-index: inherit;
|
|
41
42
|
outline: none;
|
|
42
43
|
pointer-events: auto;
|
|
43
44
|
}
|