@maggioli-design-system/mds-modal 5.2.1 → 5.3.0
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/cjs/{index-7b5471f5.js → index-6f236cfa.js} +164 -69
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mds-modal.cjs.entry.js +13 -4
- package/dist/cjs/mds-modal.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/common/floating-controller.js +180 -0
- package/dist/collection/common/slot.js +10 -4
- package/dist/collection/components/mds-modal/mds-modal.js +18 -3
- package/dist/collection/dictionary/tree.js +13 -0
- package/dist/collection/type/tree.js +1 -0
- package/dist/components/mds-modal.js +12 -3
- package/dist/documentation.d.ts +8 -0
- package/dist/documentation.json +11 -5
- package/dist/esm/{index-1c34ac95.js → index-f8d2dee4.js} +164 -69
- package/dist/esm/loader.js +2 -2
- package/dist/esm/mds-modal.entry.js +13 -4
- package/dist/esm/mds-modal.js +3 -3
- package/dist/esm-es5/index-f8d2dee4.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mds-modal.entry.js +1 -1
- package/dist/esm-es5/mds-modal.js +1 -1
- package/dist/mds-modal/mds-modal.esm.js +1 -1
- package/dist/mds-modal/mds-modal.js +1 -1
- package/{www/build/p-08a99956.entry.js → dist/mds-modal/p-413a00c5.entry.js} +1 -1
- package/dist/mds-modal/{p-0d78ea55.system.entry.js → p-96958acc.system.entry.js} +1 -1
- package/dist/mds-modal/p-bc1fa4e4.system.js +2 -0
- package/dist/mds-modal/p-c6899cb0.system.js +1 -0
- package/dist/mds-modal/p-ee90f86a.js +2 -0
- package/dist/stats.json +60 -38
- package/dist/types/common/floating-controller.d.ts +46 -0
- package/dist/types/common/slot.d.ts +2 -1
- package/dist/types/dictionary/tree.d.ts +4 -0
- package/dist/types/type/tree.d.ts +3 -0
- package/documentation.json +36 -10
- package/package.json +4 -4
- package/src/common/floating-controller.ts +263 -0
- package/src/common/slot.ts +12 -3
- package/src/dictionary/tree.ts +21 -0
- package/src/fixtures/icons.json +20 -0
- package/src/fixtures/iconsauce.json +6 -0
- package/src/type/tree.ts +12 -0
- package/www/build/mds-modal.esm.js +1 -1
- package/www/build/mds-modal.js +1 -1
- package/{dist/mds-modal/p-08a99956.entry.js → www/build/p-413a00c5.entry.js} +1 -1
- package/www/build/{p-0d78ea55.system.entry.js → p-96958acc.system.entry.js} +1 -1
- package/www/build/p-bc1fa4e4.system.js +2 -0
- package/www/build/p-c6899cb0.system.js +1 -0
- package/www/build/p-ee90f86a.js +2 -0
- package/dist/esm-es5/index-1c34ac95.js +0 -1
- package/dist/mds-modal/p-0ed6e0c8.js +0 -2
- package/dist/mds-modal/p-423dac35.system.js +0 -2
- package/dist/mds-modal/p-67c6f337.system.js +0 -1
- package/www/build/p-0ed6e0c8.js +0 -2
- package/www/build/p-423dac35.system.js +0 -2
- package/www/build/p-67c6f337.system.js +0 -1
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { arrow, autoPlacement, autoUpdate, computePosition, flip, offset, shift, } from "@floating-ui/dom";
|
|
2
|
+
import { cssDurationToMilliseconds } from "./unit";
|
|
3
|
+
import { setAttributeIfEmpty } from "./aria";
|
|
4
|
+
export class FloatingController {
|
|
5
|
+
constructor(host, arrowEl) {
|
|
6
|
+
this.arrowInset = (middleware, arrowPosition) => {
|
|
7
|
+
const { arrow } = middleware;
|
|
8
|
+
const inset = { bottom: '', left: '', right: '', top: '' };
|
|
9
|
+
if (arrow === undefined) {
|
|
10
|
+
return {};
|
|
11
|
+
}
|
|
12
|
+
switch (arrowPosition) {
|
|
13
|
+
case 'bottom':
|
|
14
|
+
inset.left = arrow.x !== null ? `${arrow.x}px` : '';
|
|
15
|
+
inset.top = '100%';
|
|
16
|
+
break;
|
|
17
|
+
case 'left':
|
|
18
|
+
inset.right = '100%';
|
|
19
|
+
inset.top = arrow.y !== null ? `${arrow.y}px` : '';
|
|
20
|
+
break;
|
|
21
|
+
case 'right':
|
|
22
|
+
inset.left = '100%';
|
|
23
|
+
inset.top = arrow.y !== null ? `${arrow.y}px` : '';
|
|
24
|
+
break;
|
|
25
|
+
case 'top':
|
|
26
|
+
inset.left = arrow.x !== null ? `${arrow.x}px` : '';
|
|
27
|
+
inset.top = '';
|
|
28
|
+
break;
|
|
29
|
+
default:
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
return inset;
|
|
33
|
+
};
|
|
34
|
+
this.arrowTransform = (arrowPosition) => {
|
|
35
|
+
let transformProps = this._host.arrow && this._host.visible ? 'scale(1)' : 'scale(0)';
|
|
36
|
+
switch (arrowPosition) {
|
|
37
|
+
case 'bottom':
|
|
38
|
+
transformProps = `rotate(180deg) ${transformProps} translate(0, -100%)`;
|
|
39
|
+
break;
|
|
40
|
+
case 'left':
|
|
41
|
+
transformProps = `rotate(-90deg) ${transformProps} translate(50%, -50%)`;
|
|
42
|
+
break;
|
|
43
|
+
case 'right':
|
|
44
|
+
transformProps = `rotate(90deg) ${transformProps} translate(-50%, -50%)`;
|
|
45
|
+
break;
|
|
46
|
+
case 'top':
|
|
47
|
+
transformProps = `rotate(0deg) ${transformProps} translate(0, 0)`;
|
|
48
|
+
break;
|
|
49
|
+
default:
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
return { transform: transformProps };
|
|
53
|
+
};
|
|
54
|
+
this.arrowTransformOrigin = (arrowPosition) => {
|
|
55
|
+
switch (arrowPosition) {
|
|
56
|
+
case 'bottom':
|
|
57
|
+
return { transformOrigin: 'center top' };
|
|
58
|
+
case 'left':
|
|
59
|
+
return { transformOrigin: 'right center' };
|
|
60
|
+
case 'right':
|
|
61
|
+
return { transformOrigin: 'left center' };
|
|
62
|
+
case 'top':
|
|
63
|
+
return { transformOrigin: 'center bottom' };
|
|
64
|
+
default:
|
|
65
|
+
return { transformOrigin: 'center top' };
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
this.calculatePosition = () => {
|
|
69
|
+
if (!this._caller)
|
|
70
|
+
return;
|
|
71
|
+
const middleware = new Array();
|
|
72
|
+
const config = {};
|
|
73
|
+
if (this._host.shiftPadding) {
|
|
74
|
+
config.padding = this._host.shiftPadding;
|
|
75
|
+
}
|
|
76
|
+
if (this._host.autoPlacement) {
|
|
77
|
+
middleware.push(autoPlacement());
|
|
78
|
+
}
|
|
79
|
+
if (this._host.offset) {
|
|
80
|
+
middleware.push(offset(this._host.offset));
|
|
81
|
+
}
|
|
82
|
+
if (!this._host.autoPlacement && this._host.flip) {
|
|
83
|
+
middleware.push(flip(config));
|
|
84
|
+
}
|
|
85
|
+
if (this._host.shift) {
|
|
86
|
+
middleware.push(shift(config));
|
|
87
|
+
}
|
|
88
|
+
if (this.arrowEl && this._host.arrow) {
|
|
89
|
+
middleware.push(arrow({
|
|
90
|
+
element: this.arrowEl,
|
|
91
|
+
padding: this._host.arrowPadding,
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
computePosition(this._caller, this._host, {
|
|
95
|
+
middleware,
|
|
96
|
+
placement: this._host.placement,
|
|
97
|
+
strategy: this._host.strategy,
|
|
98
|
+
}).then(({ x, y, placement, middlewareData }) => {
|
|
99
|
+
Object.assign(this._host.style, {
|
|
100
|
+
left: `${x}px`,
|
|
101
|
+
top: `${y}px`,
|
|
102
|
+
});
|
|
103
|
+
const arrowStyle = {};
|
|
104
|
+
const arrowPosition = {
|
|
105
|
+
top: 'bottom',
|
|
106
|
+
right: 'left',
|
|
107
|
+
bottom: 'top',
|
|
108
|
+
left: 'right',
|
|
109
|
+
}[placement.split('-')[0]];
|
|
110
|
+
if (arrowPosition && this.arrowEl) {
|
|
111
|
+
Object.assign(arrowStyle, this.arrowTransform(arrowPosition));
|
|
112
|
+
Object.assign(arrowStyle, this.arrowInset(middlewareData, arrowPosition));
|
|
113
|
+
Object.assign(arrowStyle, this.arrowTransformOrigin(arrowPosition));
|
|
114
|
+
Object.assign(this.arrowEl.style, arrowStyle);
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
this._host = host;
|
|
119
|
+
this.arrowEl = arrowEl;
|
|
120
|
+
}
|
|
121
|
+
updateCaller(target) {
|
|
122
|
+
var _a, _b, _c;
|
|
123
|
+
// search caller in document or rootNode of host (if target is in shadowDOM)
|
|
124
|
+
const caller = (_c = (_b = (_a = this._host.parentElement) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector(target)) !== null && _c !== void 0 ? _c : this._host.getRootNode().querySelector(target);
|
|
125
|
+
if (!caller) {
|
|
126
|
+
throw Error(`Target not found: ${target}`);
|
|
127
|
+
}
|
|
128
|
+
this._caller = caller;
|
|
129
|
+
setAttributeIfEmpty(this._caller, 'aria-haspopup', 'true');
|
|
130
|
+
setAttributeIfEmpty(this._caller, 'aria-controls', target);
|
|
131
|
+
setAttributeIfEmpty(this._host, 'role', 'menu');
|
|
132
|
+
setAttributeIfEmpty(this._host, 'aria-labelledby', target);
|
|
133
|
+
return caller;
|
|
134
|
+
}
|
|
135
|
+
updatePosition() {
|
|
136
|
+
if (this.cleanupAutoUpdate)
|
|
137
|
+
this.cleanupAutoUpdate();
|
|
138
|
+
this.cleanupAutoUpdate = autoUpdate(this._caller, this._host, this.calculatePosition);
|
|
139
|
+
}
|
|
140
|
+
dismiss() {
|
|
141
|
+
this.cleanupAutoUpdate();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
export class Backdrop {
|
|
145
|
+
constructor(backdropId) {
|
|
146
|
+
this.defaultBackdropId = 'mds-backdrop';
|
|
147
|
+
this.backdropBackgroundVisible = 'rgba(var(--magma-backdrop-color, 0 0 0) / var(--magma-backdrop-opacity, 0.1))';
|
|
148
|
+
this.backdropBackgroundHidden = 'rgba(var(--magma-backdrop-color, 0 0 0) / 0)';
|
|
149
|
+
this.backdropId = backdropId !== null && backdropId !== void 0 ? backdropId : this.defaultBackdropId;
|
|
150
|
+
this.cssBackdropZIndex = `var(--${this.backdropId}-z-index)`;
|
|
151
|
+
this.cssBackdropDuration = `var(--${this.backdropId}-duration)`;
|
|
152
|
+
}
|
|
153
|
+
attachBackdrop() {
|
|
154
|
+
if (!this.backdropEl) {
|
|
155
|
+
this.backdropEl = document.createElement('div');
|
|
156
|
+
this.backdropEl.className = this.backdropId;
|
|
157
|
+
this.backdropEl.style.inset = '0';
|
|
158
|
+
this.backdropEl.style.pointerEvents = 'none';
|
|
159
|
+
this.backdropEl.style.position = 'fixed';
|
|
160
|
+
this.backdropEl.style.transition = `background-color ${this.cssBackdropDuration} ease-out`;
|
|
161
|
+
this.backdropEl.style.zIndex = this.cssBackdropZIndex;
|
|
162
|
+
}
|
|
163
|
+
this.backdropEl.style.backgroundColor = this.backdropBackgroundHidden;
|
|
164
|
+
document.body.appendChild(this.backdropEl);
|
|
165
|
+
clearTimeout(this.backdropTimer);
|
|
166
|
+
this.backdropTimer = setTimeout(() => {
|
|
167
|
+
this.backdropEl.style.backgroundColor = this.backdropBackgroundVisible;
|
|
168
|
+
}, 1);
|
|
169
|
+
}
|
|
170
|
+
detachBackdrop() {
|
|
171
|
+
if (!this.backdropEl) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
this.backdropEl.style.backgroundColor = 'transparent';
|
|
175
|
+
clearTimeout(this.backdropTimer);
|
|
176
|
+
this.backdropTimer = setTimeout(() => {
|
|
177
|
+
this.backdropEl.remove();
|
|
178
|
+
}, cssDurationToMilliseconds(this.cssBackdropDuration));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
const hasSlottedElements = (el, name) => {
|
|
2
2
|
var _a;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const query = name ? `slot[name="${name}"]` : 'slot:not([name])';
|
|
4
|
+
const slot = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(query);
|
|
5
|
+
if (slot) {
|
|
6
|
+
return slot.assignedElements({ flatten: true }).length > 0;
|
|
6
7
|
}
|
|
8
|
+
return false;
|
|
9
|
+
};
|
|
10
|
+
const hasSlottedNodes = (el, name) => {
|
|
11
|
+
var _a;
|
|
12
|
+
const query = name ? `slot[name="${name}"]` : 'slot:not([name])';
|
|
7
13
|
const slot = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(query);
|
|
8
14
|
if (slot) {
|
|
9
15
|
return slot.assignedNodes().length > 0;
|
|
10
16
|
}
|
|
11
17
|
return false;
|
|
12
18
|
};
|
|
13
|
-
export { hasSlottedElements, };
|
|
19
|
+
export { hasSlottedElements, hasSlottedNodes, };
|
|
@@ -12,6 +12,18 @@ export class MdsModal {
|
|
|
12
12
|
this.window = false;
|
|
13
13
|
this.top = false;
|
|
14
14
|
this.bottom = false;
|
|
15
|
+
/**
|
|
16
|
+
* Specifies if the modal is opened or not
|
|
17
|
+
*/
|
|
18
|
+
this.opened = false;
|
|
19
|
+
/**
|
|
20
|
+
* Specifies the animation position of the modal window
|
|
21
|
+
*/
|
|
22
|
+
this.position = 'center';
|
|
23
|
+
/**
|
|
24
|
+
* Specifies if the component is animating itself or not
|
|
25
|
+
*/
|
|
26
|
+
this.animating = 'none';
|
|
15
27
|
this.updateCSSCustomProps = () => {
|
|
16
28
|
var _a;
|
|
17
29
|
if (typeof window === 'undefined')
|
|
@@ -50,9 +62,6 @@ export class MdsModal {
|
|
|
50
62
|
this.closeEvent.emit();
|
|
51
63
|
}
|
|
52
64
|
};
|
|
53
|
-
this.opened = false;
|
|
54
|
-
this.position = 'center';
|
|
55
|
-
this.animating = 'none';
|
|
56
65
|
}
|
|
57
66
|
componentWillLoad() {
|
|
58
67
|
var _a;
|
|
@@ -117,6 +126,8 @@ export class MdsModal {
|
|
|
117
126
|
"tags": [],
|
|
118
127
|
"text": "Specifies if the modal is opened or not"
|
|
119
128
|
},
|
|
129
|
+
"getter": false,
|
|
130
|
+
"setter": false,
|
|
120
131
|
"attribute": "opened",
|
|
121
132
|
"reflect": true,
|
|
122
133
|
"defaultValue": "false"
|
|
@@ -141,6 +152,8 @@ export class MdsModal {
|
|
|
141
152
|
"tags": [],
|
|
142
153
|
"text": "Specifies the animation position of the modal window"
|
|
143
154
|
},
|
|
155
|
+
"getter": false,
|
|
156
|
+
"setter": false,
|
|
144
157
|
"attribute": "position",
|
|
145
158
|
"reflect": true,
|
|
146
159
|
"defaultValue": "'center'"
|
|
@@ -165,6 +178,8 @@ export class MdsModal {
|
|
|
165
178
|
"tags": [],
|
|
166
179
|
"text": "Specifies if the component is animating itself or not"
|
|
167
180
|
},
|
|
181
|
+
"getter": false,
|
|
182
|
+
"setter": false,
|
|
168
183
|
"attribute": "animating",
|
|
169
184
|
"reflect": true,
|
|
170
185
|
"defaultValue": "'none'"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const treeActionsDictionary = [
|
|
2
|
+
'auto',
|
|
3
|
+
'visible',
|
|
4
|
+
];
|
|
5
|
+
const treeAppearanceDictionary = [
|
|
6
|
+
'depth',
|
|
7
|
+
'none',
|
|
8
|
+
];
|
|
9
|
+
const treeIconDictionary = [
|
|
10
|
+
'folder',
|
|
11
|
+
'chevron',
|
|
12
|
+
];
|
|
13
|
+
export { treeActionsDictionary, treeAppearanceDictionary, treeIconDictionary, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -25,6 +25,18 @@ const MdsModal$1 = /*@__PURE__*/ proxyCustomElement(class MdsModal extends HTMLE
|
|
|
25
25
|
this.window = false;
|
|
26
26
|
this.top = false;
|
|
27
27
|
this.bottom = false;
|
|
28
|
+
/**
|
|
29
|
+
* Specifies if the modal is opened or not
|
|
30
|
+
*/
|
|
31
|
+
this.opened = false;
|
|
32
|
+
/**
|
|
33
|
+
* Specifies the animation position of the modal window
|
|
34
|
+
*/
|
|
35
|
+
this.position = 'center';
|
|
36
|
+
/**
|
|
37
|
+
* Specifies if the component is animating itself or not
|
|
38
|
+
*/
|
|
39
|
+
this.animating = 'none';
|
|
28
40
|
this.updateCSSCustomProps = () => {
|
|
29
41
|
var _a;
|
|
30
42
|
if (typeof window === 'undefined')
|
|
@@ -63,9 +75,6 @@ const MdsModal$1 = /*@__PURE__*/ proxyCustomElement(class MdsModal extends HTMLE
|
|
|
63
75
|
this.closeEvent.emit();
|
|
64
76
|
}
|
|
65
77
|
};
|
|
66
|
-
this.opened = false;
|
|
67
|
-
this.position = 'center';
|
|
68
|
-
this.animating = 'none';
|
|
69
78
|
}
|
|
70
79
|
componentWillLoad() {
|
|
71
80
|
var _a;
|
package/dist/documentation.d.ts
CHANGED
|
@@ -316,6 +316,14 @@ export interface JsonDocsProp {
|
|
|
316
316
|
* ```
|
|
317
317
|
*/
|
|
318
318
|
required: boolean;
|
|
319
|
+
/**
|
|
320
|
+
* `true` if the prop has a `get()`. `false` otherwise
|
|
321
|
+
*/
|
|
322
|
+
getter: boolean;
|
|
323
|
+
/**
|
|
324
|
+
* `true` if the prop has a `set()`. `false` otherwise
|
|
325
|
+
*/
|
|
326
|
+
setter: boolean;
|
|
319
327
|
}
|
|
320
328
|
export interface JsonDocsMethod {
|
|
321
329
|
name: string;
|
package/dist/documentation.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"timestamp": "
|
|
2
|
+
"timestamp": "2025-02-06T08:26:42",
|
|
3
3
|
"compiler": {
|
|
4
4
|
"name": "@stencil/core",
|
|
5
|
-
"version": "4.
|
|
5
|
+
"version": "4.25.1",
|
|
6
6
|
"typescriptVersion": "5.5.4"
|
|
7
7
|
},
|
|
8
8
|
"components": [
|
|
@@ -69,7 +69,9 @@
|
|
|
69
69
|
}
|
|
70
70
|
],
|
|
71
71
|
"optional": true,
|
|
72
|
-
"required": false
|
|
72
|
+
"required": false,
|
|
73
|
+
"getter": false,
|
|
74
|
+
"setter": false
|
|
73
75
|
},
|
|
74
76
|
{
|
|
75
77
|
"name": "opened",
|
|
@@ -91,7 +93,9 @@
|
|
|
91
93
|
}
|
|
92
94
|
],
|
|
93
95
|
"optional": false,
|
|
94
|
-
"required": false
|
|
96
|
+
"required": false,
|
|
97
|
+
"getter": false,
|
|
98
|
+
"setter": false
|
|
95
99
|
},
|
|
96
100
|
{
|
|
97
101
|
"name": "position",
|
|
@@ -155,7 +159,9 @@
|
|
|
155
159
|
}
|
|
156
160
|
],
|
|
157
161
|
"optional": true,
|
|
158
|
-
"required": false
|
|
162
|
+
"required": false,
|
|
163
|
+
"getter": false,
|
|
164
|
+
"setter": false
|
|
159
165
|
}
|
|
160
166
|
],
|
|
161
167
|
"methods": [],
|