@schukai/monster 4.129.1 → 4.129.3
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/package.json +1 -1
- package/source/components/content/stylesheet/camera-capture.mjs +1 -1
- package/source/components/content/stylesheet/copy.mjs +1 -1
- package/source/components/content/viewer/stylesheet/message.mjs +1 -1
- package/source/components/datatable/stylesheet/filter-controls-defaults.mjs +1 -1
- package/source/components/form/message-state-button.mjs +2 -1
- package/source/components/form/popper-button.mjs +51 -9
- package/source/components/form/select.mjs +76 -14
- package/source/components/form/style/context-error.pcss +15 -0
- package/source/components/form/style/context-help.pcss +13 -1
- package/source/components/form/stylesheet/button-bar.mjs +1 -1
- package/source/components/form/stylesheet/confirm-button.mjs +1 -1
- package/source/components/form/stylesheet/context-error.mjs +1 -1
- package/source/components/form/stylesheet/context-help.mjs +1 -1
- package/source/components/form/stylesheet/digits.mjs +1 -1
- package/source/components/form/stylesheet/field-set.mjs +1 -1
- package/source/components/form/stylesheet/login.mjs +1 -1
- package/source/components/form/stylesheet/message-state-button.mjs +13 -6
- package/source/components/form/stylesheet/popper-button.mjs +13 -6
- package/source/components/form/stylesheet/select.mjs +1 -1
- package/source/components/form/util/floating-ui.mjs +808 -168
- package/source/components/layout/popper.mjs +68 -15
- package/source/components/layout/stylesheet/popper.mjs +13 -6
- package/source/components/style/floating-ui.css +57 -1
- package/source/components/stylesheet/floating-ui.mjs +13 -6
|
@@ -31,8 +31,12 @@ import {
|
|
|
31
31
|
getDocument,
|
|
32
32
|
} from "../../dom/util.mjs";
|
|
33
33
|
import { DeadMansSwitch } from "../../util/deadmansswitch.mjs";
|
|
34
|
-
import {
|
|
35
|
-
|
|
34
|
+
import {
|
|
35
|
+
closePositionedPopper,
|
|
36
|
+
isPositionedPopperOpen,
|
|
37
|
+
openPositionedPopper,
|
|
38
|
+
positionPopper,
|
|
39
|
+
} from "../form/util/floating-ui.mjs";
|
|
36
40
|
import { PopperStyleSheet } from "./stylesheet/popper.mjs";
|
|
37
41
|
import { isArray } from "../../types/is.mjs";
|
|
38
42
|
|
|
@@ -165,6 +169,7 @@ class Popper extends CustomElement {
|
|
|
165
169
|
content: "<slot></slot>",
|
|
166
170
|
popper: {
|
|
167
171
|
placement: "top",
|
|
172
|
+
engine: "native",
|
|
168
173
|
middleware: ["autoPlacement", "shift", "offset:15", "arrow"],
|
|
169
174
|
contentOverflow: "both",
|
|
170
175
|
},
|
|
@@ -294,7 +299,7 @@ class Popper extends CustomElement {
|
|
|
294
299
|
* @return {Popper} The popper instance
|
|
295
300
|
*/
|
|
296
301
|
toggleDialog() {
|
|
297
|
-
if (this[popperElementSymbol]
|
|
302
|
+
if (isPositionedPopperOpen(this[popperElementSymbol])) {
|
|
298
303
|
this.hideDialog();
|
|
299
304
|
} else {
|
|
300
305
|
this.showDialog();
|
|
@@ -310,16 +315,20 @@ class Popper extends CustomElement {
|
|
|
310
315
|
*/
|
|
311
316
|
function initEventHandler() {
|
|
312
317
|
this[closeEventHandler] = (event) => {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
318
|
+
if (
|
|
319
|
+
isEventInsidePopperOwner(
|
|
320
|
+
this,
|
|
321
|
+
event,
|
|
322
|
+
this[controlElementSymbol],
|
|
323
|
+
this[buttonElementSymbol],
|
|
324
|
+
this[popperElementSymbol],
|
|
325
|
+
)
|
|
326
|
+
) {
|
|
327
|
+
return;
|
|
319
328
|
}
|
|
320
329
|
|
|
321
330
|
if (
|
|
322
|
-
this[popperElementSymbol]
|
|
331
|
+
!isPositionedPopperOpen(this[popperElementSymbol]) &&
|
|
323
332
|
!containsAttributeToken(this[controlElementSymbol], "class", "open")
|
|
324
333
|
) {
|
|
325
334
|
return;
|
|
@@ -351,6 +360,45 @@ function initEventHandler() {
|
|
|
351
360
|
return this;
|
|
352
361
|
}
|
|
353
362
|
|
|
363
|
+
function isEventInsidePopperOwner(
|
|
364
|
+
owner,
|
|
365
|
+
event,
|
|
366
|
+
controlElement,
|
|
367
|
+
buttonElement,
|
|
368
|
+
popperElement,
|
|
369
|
+
) {
|
|
370
|
+
const path = event.composedPath?.() || [];
|
|
371
|
+
|
|
372
|
+
for (const element of path) {
|
|
373
|
+
if (
|
|
374
|
+
element === owner ||
|
|
375
|
+
element === controlElement ||
|
|
376
|
+
element === buttonElement ||
|
|
377
|
+
element === popperElement
|
|
378
|
+
) {
|
|
379
|
+
return true;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
const target = path[0] || event.target;
|
|
384
|
+
if (!(target instanceof Node)) {
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
if (owner instanceof HTMLElement && owner.contains(target)) {
|
|
389
|
+
return true;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
if (
|
|
393
|
+
owner?.shadowRoot instanceof ShadowRoot &&
|
|
394
|
+
owner.shadowRoot.contains(target)
|
|
395
|
+
) {
|
|
396
|
+
return true;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
return false;
|
|
400
|
+
}
|
|
401
|
+
|
|
354
402
|
/**
|
|
355
403
|
* Sets up event handlers for specific interaction mode
|
|
356
404
|
* @private
|
|
@@ -475,7 +523,7 @@ function hide() {
|
|
|
475
523
|
});
|
|
476
524
|
|
|
477
525
|
if (popperElement instanceof HTMLElement) {
|
|
478
|
-
popperElement
|
|
526
|
+
closePositionedPopper(popperElement);
|
|
479
527
|
}
|
|
480
528
|
|
|
481
529
|
if (controlElement instanceof HTMLElement) {
|
|
@@ -512,7 +560,7 @@ function show() {
|
|
|
512
560
|
return;
|
|
513
561
|
}
|
|
514
562
|
|
|
515
|
-
if (popperElement
|
|
563
|
+
if (isPositionedPopperOpen(popperElement)) {
|
|
516
564
|
return;
|
|
517
565
|
}
|
|
518
566
|
|
|
@@ -523,7 +571,11 @@ function show() {
|
|
|
523
571
|
applyContentOverflowMode.call(self);
|
|
524
572
|
|
|
525
573
|
popperElement.style.visibility = "hidden";
|
|
526
|
-
|
|
574
|
+
openPositionedPopper(
|
|
575
|
+
self[controlElementSymbol],
|
|
576
|
+
popperElement,
|
|
577
|
+
self.getOption("popper", {}),
|
|
578
|
+
);
|
|
527
579
|
|
|
528
580
|
addAttributeToken(controlElement, "class", "open");
|
|
529
581
|
registerWithHost.call(self);
|
|
@@ -549,7 +601,7 @@ function updatePopper() {
|
|
|
549
601
|
return;
|
|
550
602
|
}
|
|
551
603
|
|
|
552
|
-
if (this[popperElementSymbol]
|
|
604
|
+
if (!isPositionedPopperOpen(this[popperElementSymbol])) {
|
|
553
605
|
return;
|
|
554
606
|
}
|
|
555
607
|
|
|
@@ -635,7 +687,8 @@ function initControlReferences() {
|
|
|
635
687
|
this[arrowElementSymbol] = this.shadowRoot.querySelector(
|
|
636
688
|
`[${ATTRIBUTE_ROLE}=arrow]`,
|
|
637
689
|
);
|
|
638
|
-
this[contentElementSymbol] =
|
|
690
|
+
this[contentElementSymbol] =
|
|
691
|
+
this.shadowRoot.querySelector(`[part="content"]`);
|
|
639
692
|
return this;
|
|
640
693
|
}
|
|
641
694
|
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
* For more information about purchasing a commercial license, please contact Volker Schukai.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import {addAttributeToken} from "../../../dom/attributes.mjs";
|
|
14
|
-
import {ATTRIBUTE_ERRORMESSAGE} from "../../../dom/constants.mjs";
|
|
13
|
+
import { addAttributeToken } from "../../../dom/attributes.mjs";
|
|
14
|
+
import { ATTRIBUTE_ERRORMESSAGE } from "../../../dom/constants.mjs";
|
|
15
15
|
|
|
16
|
-
export {PopperStyleSheet}
|
|
16
|
+
export { PopperStyleSheet };
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* @private
|
|
@@ -22,10 +22,17 @@ export {PopperStyleSheet}
|
|
|
22
22
|
const PopperStyleSheet = new CSSStyleSheet();
|
|
23
23
|
|
|
24
24
|
try {
|
|
25
|
-
|
|
25
|
+
PopperStyleSheet.insertRule(
|
|
26
|
+
`
|
|
26
27
|
@layer popper {
|
|
27
28
|
[data-monster-role=control]{box-sizing:border-box;outline:none;width:100%}[data-monster-role=control].flex{align-items:center;display:flex;flex-direction:row}:host{box-sizing:border-box;display:block}div[data-monster-role=popper]{align-content:center;background:var(--monster-bg-color-primary-1);border-color:var(--monster-bg-color-primary-4);border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width);box-shadow:var(--monster-box-shadow-1);box-sizing:border-box;color:var(--monster-color-primary-1);display:none;justify-content:space-between;left:0;max-height:var(--monster-popper-max-height,calc(100vh - 2rem));max-width:var(--monster-popper-max-width,calc(100vw - 2rem));padding:1.1em;position:absolute;top:0;width:-moz-max-content;width:max-content;z-index:var(--monster-z-index-modal)}div[data-monster-role=popper]>[part=content]{max-height:var(--monster-popper-content-max-height,calc(100vh - 4.2rem));max-width:100%;overflow:auto}div[data-monster-role=popper]>[part=content][data-monster-overflow-mode=horizontal]{clip-path:inset(calc(var(--monster-popper-content-block-overflow, 100vh)*-1) 0 calc(var(--monster-popper-content-block-overflow, 100vh)*-1) 0);overflow:visible}div[data-monster-role=popper] div[data-monster-role=arrow]{background:var(--monster-bg-color-primary-1);height:calc(max(var(--monster-popper-witharrrow-distance), -1 * var(--monster-popper-witharrrow-distance))*2);pointer-events:none;position:absolute;width:calc(max(var(--monster-popper-witharrrow-distance), -1 * var(--monster-popper-witharrrow-distance))*2);z-index:-1}[data-monster-role=control]{display:flex;position:relative}
|
|
28
|
-
}`,
|
|
29
|
+
}`,
|
|
30
|
+
0,
|
|
31
|
+
);
|
|
29
32
|
} catch (e) {
|
|
30
|
-
|
|
33
|
+
addAttributeToken(
|
|
34
|
+
document.getRootNode().querySelector("html"),
|
|
35
|
+
ATTRIBUTE_ERRORMESSAGE,
|
|
36
|
+
e + "",
|
|
37
|
+
);
|
|
31
38
|
}
|
|
@@ -1,2 +1,58 @@
|
|
|
1
1
|
/** generated from floating-ui.pcss **/
|
|
2
|
-
div[data-monster-role=popper]
|
|
2
|
+
div[data-monster-role="popper"] {
|
|
3
|
+
align-content: center;
|
|
4
|
+
background: var(--monster-bg-color-primary-1);
|
|
5
|
+
border-color: var(--monster-bg-color-primary-4);
|
|
6
|
+
border-radius: var(--monster-border-radius);
|
|
7
|
+
border-style: var(--monster-border-style);
|
|
8
|
+
border-width: var(--monster-border-width);
|
|
9
|
+
box-shadow: var(--monster-box-shadow-1);
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
color: var(--monster-color-primary-1);
|
|
12
|
+
display: none;
|
|
13
|
+
justify-content: space-between;
|
|
14
|
+
left: 0;
|
|
15
|
+
max-height: var(--monster-popper-max-height, calc(100vh - 2rem));
|
|
16
|
+
max-width: var(--monster-popper-max-width, calc(100vw - 2rem));
|
|
17
|
+
padding: 1.1em;
|
|
18
|
+
position: absolute;
|
|
19
|
+
top: 0;
|
|
20
|
+
width: -moz-max-content;
|
|
21
|
+
width: max-content;
|
|
22
|
+
z-index: var(--monster-z-index-modal);
|
|
23
|
+
}
|
|
24
|
+
div[data-monster-role="popper"] > [part="content"] {
|
|
25
|
+
max-height: var(--monster-popper-content-max-height, calc(100vh - 4.2rem));
|
|
26
|
+
max-width: 100%;
|
|
27
|
+
overflow: auto;
|
|
28
|
+
}
|
|
29
|
+
div[data-monster-role="popper"]
|
|
30
|
+
> [part="content"][data-monster-overflow-mode="horizontal"] {
|
|
31
|
+
clip-path: inset(
|
|
32
|
+
calc(var(--monster-popper-content-block-overflow, 100vh) * -1) 0
|
|
33
|
+
calc(var(--monster-popper-content-block-overflow, 100vh) * -1) 0
|
|
34
|
+
);
|
|
35
|
+
overflow: visible;
|
|
36
|
+
}
|
|
37
|
+
div[data-monster-role="popper"] div[data-monster-role="arrow"] {
|
|
38
|
+
background: var(--monster-bg-color-primary-1);
|
|
39
|
+
height: calc(
|
|
40
|
+
max(
|
|
41
|
+
var(--monster-popper-witharrrow-distance),
|
|
42
|
+
-1 *
|
|
43
|
+
var(--monster-popper-witharrrow-distance)
|
|
44
|
+
) *
|
|
45
|
+
2
|
|
46
|
+
);
|
|
47
|
+
pointer-events: none;
|
|
48
|
+
position: absolute;
|
|
49
|
+
width: calc(
|
|
50
|
+
max(
|
|
51
|
+
var(--monster-popper-witharrrow-distance),
|
|
52
|
+
-1 *
|
|
53
|
+
var(--monster-popper-witharrrow-distance)
|
|
54
|
+
) *
|
|
55
|
+
2
|
|
56
|
+
);
|
|
57
|
+
z-index: -1;
|
|
58
|
+
}
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
* For more information about purchasing a commercial license, please contact Volker Schukai.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import {addAttributeToken} from "../../dom/attributes.mjs";
|
|
14
|
-
import {ATTRIBUTE_ERRORMESSAGE} from "../../dom/constants.mjs";
|
|
13
|
+
import { addAttributeToken } from "../../dom/attributes.mjs";
|
|
14
|
+
import { ATTRIBUTE_ERRORMESSAGE } from "../../dom/constants.mjs";
|
|
15
15
|
|
|
16
|
-
export {FloatingUiStyleSheet}
|
|
16
|
+
export { FloatingUiStyleSheet };
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* @private
|
|
@@ -22,10 +22,17 @@ export {FloatingUiStyleSheet}
|
|
|
22
22
|
const FloatingUiStyleSheet = new CSSStyleSheet();
|
|
23
23
|
|
|
24
24
|
try {
|
|
25
|
-
|
|
25
|
+
FloatingUiStyleSheet.insertRule(
|
|
26
|
+
`
|
|
26
27
|
@layer floatingui {
|
|
27
28
|
div[data-monster-role=popper]{align-content:center;background:var(--monster-bg-color-primary-1);border-color:var(--monster-bg-color-primary-4);border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width);box-shadow:var(--monster-box-shadow-1);box-sizing:border-box;color:var(--monster-color-primary-1);display:none;justify-content:space-between;left:0;max-height:var(--monster-popper-max-height,calc(100vh - 2rem));max-width:var(--monster-popper-max-width,calc(100vw - 2rem));padding:1.1em;position:absolute;top:0;width:-moz-max-content;width:max-content;z-index:var(--monster-z-index-modal)}div[data-monster-role=popper]>[part=content]{max-height:var(--monster-popper-content-max-height,calc(100vh - 4.2rem));max-width:100%;overflow:auto}div[data-monster-role=popper]>[part=content][data-monster-overflow-mode=horizontal]{clip-path:inset(calc(var(--monster-popper-content-block-overflow, 100vh)*-1) 0 calc(var(--monster-popper-content-block-overflow, 100vh)*-1) 0);overflow:visible}div[data-monster-role=popper] div[data-monster-role=arrow]{background:var(--monster-bg-color-primary-1);height:calc(max(var(--monster-popper-witharrrow-distance), -1 * var(--monster-popper-witharrrow-distance))*2);pointer-events:none;position:absolute;width:calc(max(var(--monster-popper-witharrrow-distance), -1 * var(--monster-popper-witharrrow-distance))*2);z-index:-1}
|
|
28
|
-
}`,
|
|
29
|
+
}`,
|
|
30
|
+
0,
|
|
31
|
+
);
|
|
29
32
|
} catch (e) {
|
|
30
|
-
|
|
33
|
+
addAttributeToken(
|
|
34
|
+
document.getRootNode().querySelector("html"),
|
|
35
|
+
ATTRIBUTE_ERRORMESSAGE,
|
|
36
|
+
e + "",
|
|
37
|
+
);
|
|
31
38
|
}
|